diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java index 5dcb156..d9b3395 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java @@ -10,10 +10,7 @@ import com.hw.common.security.utils.SecurityUtils; import com.hw.mes.domain.MesMaterialBom; import com.hw.mes.domain.MesProductPlan; import com.hw.mes.domain.MesProductPlanDetail; -import com.hw.mes.domain.vo.MesMaterialScanVo; -import com.hw.mes.domain.vo.MesProductPlanDetailAttachVo; -import com.hw.mes.domain.vo.MesProductPlanDetailCompleteAttachVo; -import com.hw.mes.domain.vo.MesProductPlanDetailVo; +import com.hw.mes.domain.vo.*; import com.hw.mes.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; @@ -39,6 +36,9 @@ public class MesApiController extends BaseController { @Autowired private IMesProductPlanDetailService productPlanDetailService; + @Autowired + private IMesBaseBarcodeInfoService mesBaseBarcodeInfoService; + /** * 查询物料BOM信息列表 */ @@ -176,4 +176,25 @@ public class MesApiController extends BaseController { public AjaxResult scanMaterial2Confirm(@RequestBody MesMaterialScanVo mesMaterialScanVo) { return success(productPlanService.scanMaterial2Confirm(mesMaterialScanVo)); } + + + /** + * 在五楼柜体拆分后绑定背板条码(成品条码)和柜体条码 + */ + @Log(title = "条码信息", businessType = BusinessType.BIND) + @PostMapping(("/bindBarcode")) + public AjaxResult bindBarcode(@RequestBody MesBindBarcodeVo mesBindBarcodeVo) { + return success(mesBaseBarcodeInfoService.bindBarcode(mesBindBarcodeVo)); + } + + /** + * 在五楼柜体拆分后将门板下发给相应工位组装(分配任务) + */ + @Log(title = "柜体分配任务", businessType = BusinessType.ALLOCATE) + @PostMapping(("/assignTask")) + public AjaxResult assignTask(@RequestBody MesAssignTaskVo mesAssignTaskVo) { + productPlanService.assignTask(mesAssignTaskVo); + return success(); + } + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java index 9e0c7d4..4b53b8f 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java @@ -128,4 +128,15 @@ public class MesBaseBarcodeInfoController extends BaseController { return success(mesBaseBarcodeInfoService.selectMesBaseBarcodeInfoByBarcodeInfo(barcodeInfo)); } + + /** + * 根据绑定的条码信息获取条码信息详细信息 + */ + @InnerAuth + @GetMapping(value = "/getBarcodeByBindBarcode/{bindBarcode}") + public AjaxResult getBindBarcodeInfo(@PathVariable("bindBarcode") String bindBarcode) + { + return success(mesBaseBarcodeInfoService.selectMesBaseBarcodeInfoByBindBarcode(bindBarcode)); + } + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/vo/MesAssignTaskVo.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/vo/MesAssignTaskVo.java new file mode 100644 index 0000000..bc486d4 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/vo/MesAssignTaskVo.java @@ -0,0 +1,39 @@ +package com.hw.mes.domain.vo; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +/** + * @Description: 五楼柜体拆分后下发任务VO对象 + * @ClassName: MesAssignTaskVo + * @Author : xins + * @Date :2024-04-11 15:40 + * @Version :1.0 + */ +@Data +public class MesAssignTaskVo { + + //工位序号,代表第几个工位 + @NotNull(message = "工位序号必须输入") + private Integer stationNo; + + //物料条码 + @NotBlank(message = "物料条码必须输入") + private String materialBarcode; + + + +// //生产计划明细ID +// @NotNull(message = "生产计划明细ID必须输入") +// private Long planDetailId; +// +// + +// +// //数量 +// @NotNull(message = "数量必须输入") +// private BigDecimal checkAmount; +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/vo/MesBindBarcodeVo.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/vo/MesBindBarcodeVo.java new file mode 100644 index 0000000..ecee937 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/vo/MesBindBarcodeVo.java @@ -0,0 +1,35 @@ +package com.hw.mes.domain.vo; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +/** + * @Description: 柜体绑定vo对象 + * @ClassName: MesBindBarcodeVo + * @Author : xins + * @Date :2024-04-10 17:09 + * @Version :1.0 + */ +@Data +public class MesBindBarcodeVo { + + //生产计划code + @NotBlank(message = "生产计划Code必须输入") + private String planCode; + + //生产计划明细code + @NotBlank(message = "生产计划明细Code必须输入") + private String planDetailCode; + + + //物料条码 + @NotBlank(message = "成品条码必须输入") + private String productBarcode; + + //物料条码 + @NotBlank(message = "物料条码必须输入") + private String materialBarcode; +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseBarcodeInfoMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseBarcodeInfoMapper.java index d0c1f6e..21efd6b 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseBarcodeInfoMapper.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseBarcodeInfoMapper.java @@ -68,4 +68,15 @@ public interface MesBaseBarcodeInfoMapper * @return 结果 */ public int deleteMesBaseBarcodeInfoByBarcodeIds(Long[] barcodeIds); + + + + + /** + * 查询条码信息 + * + * @param bindBarcode 绑定条码信息 + * @return 条码信息 + */ + public MesBaseBarcodeInfo selectMesBaseBarcodeInfoByBindBarcode(String bindBarcode); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java index ba73a4b..9c8db74 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java @@ -1,6 +1,7 @@ package com.hw.mes.service; import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import com.hw.mes.domain.vo.MesBindBarcodeVo; import java.util.List; @@ -76,4 +77,20 @@ public interface IMesBaseBarcodeInfoService */ public int printBarCode(Long[] barcodeIds); + /** + * 绑定条码信息(适用于五楼柜体拆分区) + * + * @param mesBindBarcodeVo + * @return + */ + public int bindBarcode(MesBindBarcodeVo mesBindBarcodeVo); + + + /** + * 查询条码信息 + * + * @param bindBarcode 绑定条码信息 + * @return 条码信息 + */ + public MesBaseBarcodeInfo selectMesBaseBarcodeInfoByBindBarcode(String bindBarcode); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanService.java index f24ce67..39399c4 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanService.java @@ -5,6 +5,7 @@ import java.util.List; import com.hw.mes.domain.MesBaseAttachInfo; import com.hw.mes.domain.MesProductOrder; import com.hw.mes.domain.MesProductPlan; +import com.hw.mes.domain.vo.MesAssignTaskVo; import com.hw.mes.domain.vo.MesMaterialScanVo; import org.springframework.transaction.annotation.Transactional; @@ -121,4 +122,11 @@ public interface IMesProductPlanService * @return */ public int scanMaterial2Confirm(MesMaterialScanVo mesMaterialScanVo); + + /** + * 在五楼柜体拆分区拆分完柜体将门板下发给工位装配 + * @param mesAssignTaskVo + */ + public void assignTask(MesAssignTaskVo mesAssignTaskVo); + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java index 26a7403..b9ecd24 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java @@ -1,6 +1,7 @@ package com.hw.mes.service.impl; import java.math.BigDecimal; +import java.util.Date; import java.util.List; import com.hw.common.core.constant.MesConstants; @@ -12,6 +13,7 @@ import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.uuid.Seq; import com.hw.common.security.utils.SecurityUtils; import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import com.hw.mes.domain.vo.MesBindBarcodeVo; import com.hw.printer.api.RemotePrinterService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -69,6 +71,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService /** * 新增条码信息 * barcode_type '条码类型(1=原材料,2=半成品,3=成品,4=背板)' + * * @param mesBaseBarcodeInfo 条码信息 * @return 结果 */ @@ -177,4 +180,67 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService throw new ServiceException(buffer.toString()); } } + + + /** + * 绑定条码信息(适用于五楼柜体拆分区) + * + * @param mesBindBarcodeVo + * @return + */ + @Override + public int bindBarcode(MesBindBarcodeVo mesBindBarcodeVo) { + String productBarcode = mesBindBarcodeVo.getProductBarcode(); + String materialBarcode = mesBindBarcodeVo.getMaterialBarcode(); + String planCode = mesBindBarcodeVo.getPlanCode(); + String planDetailCode = mesBindBarcodeVo.getPlanDetailCode(); + + MesBaseBarcodeInfo productBarcodeInfo = mesBaseBarcodeInfoMapper + .selectMesBaseBarcodeInfoByBarcodeInfo(productBarcode); + if (productBarcodeInfo == null) { + throw new ServiceException("成品条码有误"); + } + + if (productBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)) { + throw new ServiceException("物料条码有误"); + } + + if (!productBarcodeInfo.getPlanCode().equals(planCode)) { + throw new ServiceException("绑定不匹配,此成品条码工单编号为:" + productBarcodeInfo.getPlanCode()); + } + + if (StringUtils.isNotEmpty(productBarcodeInfo.getBindBarcode())) { + throw new ServiceException("此成品条码已经绑定,无需重复绑定"); + } + + MesBaseBarcodeInfo materialBarcodeInfo = mesBaseBarcodeInfoMapper + .selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode); + if (materialBarcodeInfo == null || + !materialBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)) { + throw new ServiceException("物料条码有误"); + } + + productBarcodeInfo.setBindBarcode(materialBarcode); + productBarcodeInfo.setBindBy(SecurityUtils.getUsername()); + productBarcodeInfo.setBindTime(new Date()); + productBarcodeInfo.setBindStatus(MesConstants.MES_BARCODE_BIND_STATUS_BINDING); + productBarcodeInfo.setPlanDetailCode(planDetailCode); + return mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(productBarcodeInfo); + } + + + + + + + /** + * 查询条码信息 + * + * @param bindBarcode 绑定条码信息 + * @return 条码信息 + */ + @Override + public MesBaseBarcodeInfo selectMesBaseBarcodeInfoByBindBarcode(String bindBarcode) { + return mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBindBarcode(bindBarcode); + } } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java index 588d708..c817da1 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java @@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.Date; import java.util.List; +import com.alibaba.fastjson.JSONObject; import com.hw.common.core.constant.MesConstants; import com.hw.common.core.exception.ServiceException; import com.hw.common.core.utils.DateUtils; @@ -12,11 +13,13 @@ import com.hw.common.core.utils.uuid.Seq; import com.hw.common.security.utils.SecurityUtils; import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.domain.*; +import com.hw.mes.domain.vo.MesAssignTaskVo; import com.hw.mes.domain.vo.MesMaterialScanVo; import com.hw.mes.mapper.*; import com.hw.mes.service.IMesBaseAttachInfoService; import com.hw.mes.service.IMesProductOrderService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import java.util.ArrayList; @@ -57,6 +60,9 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService { @Autowired private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper; + @Autowired + private StringRedisTemplate redisTemplate; + /** * 查询生产派工 * @@ -189,6 +195,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService { /** * 获取生产派工附件List列表 + * * @param planId * @param attachType * @return @@ -197,7 +204,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService { public List getDispatchAttachList(Long planId, String attachType) { MesProductPlan mesProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(planId); try { - if (attachType.equals(MesConstants.MES_ATTACH_TYPE_DRAWING)){ + if (attachType.equals(MesConstants.MES_ATTACH_TYPE_DRAWING)) { if (StringUtils.isEmpty(mesProductPlan.getAttachId())) { return new ArrayList<>(); } @@ -361,7 +368,21 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService { mesMaterialCheckResultDetailMapper.insertMesMaterialCheckResultDetail(mesMaterialCheckResultDetail); return 1; + } + + + /** + * 在五楼柜体拆分区拆分完柜体将门板下发给工位装配 + * @param mesAssignTaskVo + */ + @Override + public void assignTask(MesAssignTaskVo mesAssignTaskVo) { + //1、先发布信息,设置超时时间,如果超时需要删除此key,避免重复读取 + redisTemplate.convertAndSend(MesConstants.MES_ASSIGN_TASK_KEY, mesAssignTaskVo.getStationNo()); + //2、订阅者读取此条信息后会给出反馈,需要在程序已开始订阅此条反馈信息,如果在10s内返回,则成功,如果10s内失败则失败 + System.out.println(redisTemplate.opsForValue().get(MesConstants.MES_ASSIGN_TASK_KEY)); +// redisTemplate.c } } diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml index 88b1a73..dfb1a7a 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml @@ -238,4 +238,9 @@ where bbi.barcode_info = #{barcodeInfo} limit 1 + + diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java index 187883c..da95d7a 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java @@ -136,8 +136,8 @@ public class WmsApiController extends BaseController { */ @Log(title = "原材料返库记录", businessType = BusinessType.APPLY) @PostMapping(("/applyRawBack")) - public AjaxResult applyRawBack(@Validated @RequestBody List wmsRawReturns) { - return toAjax(wmsRawReturnService.applyRawReturn(wmsRawReturns)); + public AjaxResult applyRawBack(@Validated @RequestBody WmsRawBackVo wmsRawBackVo) { + return toAjax(wmsRawInstockService.applyRawBack(wmsRawBackVo)); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/vo/WmsRawBackVo.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/vo/WmsRawBackVo.java new file mode 100644 index 0000000..149cf48 --- /dev/null +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/vo/WmsRawBackVo.java @@ -0,0 +1,23 @@ +package com.hw.wms.domain.vo; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @Description: 原材料返库VO对象 + * @ClassName: WmsRawBackVo + * @Author : xins + * @Date :2024-04-11 14:07 + * @Version :1.0 + */ +@Data +public class WmsRawBackVo { + //物料条码 + @NotBlank(message="物料条码必须输入") + private String materialBarcode; + + @NotNull(message="返库ID不能为空") + private Long warehouseId; +} diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawInstockService.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawInstockService.java index 8b463f7..ee3453d 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawInstockService.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawInstockService.java @@ -2,6 +2,7 @@ package com.hw.wms.service; import java.util.List; import com.hw.wms.domain.WmsRawInstock; +import com.hw.wms.domain.vo.WmsRawBackVo; import com.hw.wms.domain.vo.WmsRawInstockVo; import org.springframework.transaction.annotation.Transactional; @@ -72,4 +73,10 @@ public interface IWmsRawInstockService */ public int insertWmsRawInstock(WmsRawInstockVo wmsRawInstockVo); + + /** + * 柜体拆分后返库 + * @param wmsRawBackVo + */ + public int applyRawBack(WmsRawBackVo wmsRawBackVo); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawInstockServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawInstockServiceImpl.java index 206df31..1606550 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawInstockServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawInstockServiceImpl.java @@ -3,6 +3,7 @@ package com.hw.wms.service.impl; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; import com.hw.common.core.constant.MesConstants; import com.hw.common.core.constant.SecurityConstants; @@ -15,6 +16,7 @@ import com.hw.mes.api.RemoteMesService; import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.wms.domain.WmsBaseLocation; import com.hw.wms.domain.WmsRawStock; +import com.hw.wms.domain.vo.WmsRawBackVo; import com.hw.wms.domain.vo.WmsRawInstockVo; import com.hw.wms.mapper.WmsBaseLocationMapper; import com.hw.wms.mapper.WmsRawStockMapper; @@ -133,6 +135,9 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService { public int insertWmsRawInstock(WmsRawInstockVo wmsRawInstockVo) { String materialBarcode = wmsRawInstockVo.getMaterialBarcode(); R baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); + if (baseBarcodeInfoR == null) { + throw new ServiceException("物料编码有误"); + } MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); if (baseBarcodeInfo == null) { throw new ServiceException("物料编码有误"); @@ -164,7 +169,7 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService { Date currentDate = new Date(); String userName = SecurityUtils.getUsername(); WmsRawInstock wmsRawInstock = new WmsRawInstock(); - wmsRawInstock.setTaskCode(Seq.getId(Seq.rawInstockSeqType,Seq.rawInstockSeqCode)); + wmsRawInstock.setTaskCode(Seq.getId(Seq.rawInstockSeqType, Seq.rawInstockSeqCode)); wmsRawInstock.setWarehouseId(baseLocation.getWarehouseId()); wmsRawInstock.setLocationCode(locationCode); wmsRawInstock.setPoNo(baseBarcodeInfo.getPoNo()); @@ -237,8 +242,65 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService { } } - public void syncToErp() { - //todo 根据质检状态是通过的同步给ERP + + /** + * 柜体拆分后返库 + * + * @param wmsRawBackVo + */ + @Override + public int applyRawBack(WmsRawBackVo wmsRawBackVo) { + String materialBarcode = wmsRawBackVo.getMaterialBarcode(); + R baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); + if (baseBarcodeInfoR == null) { + throw new ServiceException("物料编码有误"); + } + MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); + if (baseBarcodeInfo == null) { + throw new ServiceException("物料编码有误"); + } + + //判断此柜体是否已跟拆分门板绑定,如果未绑定不允许返库 + R bindBarcodeInfoR = remoteMesService.getBarcodeByBindBarcode(materialBarcode, SecurityConstants.INNER); + if (bindBarcodeInfoR == null) { + throw new ServiceException("没找到绑定信息,不能返库"); + } + MesBaseBarcodeInfo bindBarcodeInfo = bindBarcodeInfoR.getData(); + if (bindBarcodeInfo == null) { + throw new ServiceException("没找到绑定信息,不能返库"); + } + + //判断是否有返库记录,不能重复提交 + WmsRawInstock queryRawInstock = new WmsRawInstock(); + queryRawInstock.setMaterialBarcode(materialBarcode);//materialBarcode是索引,先不需要加别的条件,获取出来再过滤 + List wmsRawInstocks = wmsRawInstockMapper.selectWmsRawInstockList(queryRawInstock); + if (wmsRawInstocks != null && !wmsRawInstocks.isEmpty()) { + List returnRawInstocks = wmsRawInstocks.stream().filter + (wmsRawInstock -> wmsRawInstock.getInstockType().equals(WmsConstants.RAW_INSTOCK_INSTOCK_TYPE_RETURN)) + .collect(Collectors.toList()); + if (returnRawInstocks != null && !returnRawInstocks.isEmpty()) { + throw new ServiceException("已经有此物料返库记录,无需重复返库"); + } + } + + + WmsRawInstock wmsRawInstock = new WmsRawInstock(); + wmsRawInstock.setTaskCode(Seq.getId(Seq.rawInstockSeqType, Seq.rawInstockSeqCode)); + wmsRawInstock.setWarehouseId(wmsRawBackVo.getWarehouseId()); + wmsRawInstock.setPoNo(baseBarcodeInfo.getPoNo()); + wmsRawInstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_AUTO); + wmsRawInstock.setInstockType(WmsConstants.RAW_INSTOCK_INSTOCK_TYPE_RETURN); + wmsRawInstock.setMaterialId(baseBarcodeInfo.getMaterialId()); + wmsRawInstock.setMaterialBarcode(materialBarcode); + wmsRawInstock.setMaterialBatchCode(baseBarcodeInfo.getBatchCode()); + wmsRawInstock.setPalletInfoCode(baseBarcodeInfo.getPalletInfoCode()); + wmsRawInstock.setInstockAmount(BigDecimal.ONE); + wmsRawInstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE); + wmsRawInstock.setApplyBy(SecurityUtils.getUsername()); + wmsRawInstock.setApplyDate(new Date()); + + //wcs轮询后执行完成要更新库存 + return wmsRawInstockMapper.insertWmsRawInstock(wmsRawInstock); } } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java index ea340ec..cd306f6 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java @@ -479,6 +479,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { //判断仓库类型,出库记录保存对应操作类型,出库记录明细保存对应出库方式 WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(warehouseId); + String taskType = StringUtils.isEmpty(wmsRawOutstock.getTaskType()) ? WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_PICKING + : wmsRawOutstock.getTaskType(); String warehouseType = baseWarehouse.getWarehouseType(); String queryQualityStatus = WmsConstants.WMS_QUALITY_STATUS_PASS; @@ -524,7 +526,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { wmsRawStockMapper.updateWmsRawStock(wmsRawStock); //原材料出库记录(有break,以下方法需要写在此处) - WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode, + WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode,taskType, planAmount, currentDate, userName); toInsertedRawOutstocks.add(toInsertedRawOutstock); @@ -538,7 +540,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { wmsRawStockMapper.updateWmsRawStock(wmsRawStock); //原材料出库记录(有break,以下方法需要写在此处) - WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode, + WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode,taskType, planAmount, currentDate, userName); toInsertedRawOutstocks.add(toInsertedRawOutstock); @@ -553,7 +555,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { wmsRawStockMapper.updateWmsRawStock(wmsRawStock); //原材料出库记录(有break,以下方法需要写在此处) - WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode, + WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode,taskType, planAmount, currentDate, userName); toInsertedRawOutstocks.add(toInsertedRawOutstock); @@ -591,7 +593,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { * @param userName * @return */ - private WmsRawOutstock getWmsRawOutstock(WmsRawStock wmsRawStock, WmsBaseWarehouse baseWarehouse, String planCode, String planDetailCode, Long materialId, String taskCode, + private WmsRawOutstock getWmsRawOutstock(WmsRawStock wmsRawStock, WmsBaseWarehouse baseWarehouse, + String planCode, String planDetailCode, Long materialId, String taskCode,String taskType, BigDecimal planAmount, Date currentDate, String userName) { //出库要求 (0申请出库,1申请审核出库,2直接出库) String outRequirement = baseWarehouse.getOutRequirement(); @@ -626,7 +629,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { toInsertedRawOutstock.setPlanCode(planCode); toInsertedRawOutstock.setPlanDetailCode(planDetailCode); toInsertedRawOutstock.setMaterialBatch(wmsRawStock.getInstockBatch()); - toInsertedRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_PICKING); + toInsertedRawOutstock.setTaskType(taskType); toInsertedRawOutstock.setCreateTime(currentDate); toInsertedRawOutstock.setCreateBy(userName); @@ -983,7 +986,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { wmsRawOutstock.setEndStationCode(wmsConfig.getFifthAssembleStationCode());//目标位置,五楼组装区域 todo 读配置文件获取 wmsRawOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_AUTO); - wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_SPLIT); + wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_INSTALL); wmsRawOutstock.setApplyBy(SecurityUtils.getUsername()); wmsRawOutstock.setApplyDate(new Date()); wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS); @@ -997,6 +1000,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { /** * 直接出库(适合四楼激光切割工位板材出库) + * * @param wmsRawOutstock * @return */ diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawInstockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawInstockMapper.xml index 3afffa3..4ce6a8c 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawInstockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawInstockMapper.xml @@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -39,18 +40,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and task_code = #{taskCode} and warehouse_id = #{warehouseId} + and material_barcode = #{materialBarcode} and location_code = #{locationCode} and po_no = #{poNo} and operation_type = #{operationType} and instock_type = #{instockType} - and apply_reason = #{applyReason} - and audit_reason = #{auditReason} - and audit_status = #{auditStatus} and execute_status = #{executeStatus} and apply_by = #{applyBy} and apply_date = #{applyDate} - and audit_by = #{auditBy} - and audit_date = #{auditDate} and update_date = #{updateDate} and begin_time = #{beginTime} and end_time = #{endTime} diff --git a/hw-ui/src/views/board/fifthFloor/index.vue b/hw-ui/src/views/board/fifthFloor/index.vue index c871e2d..f33b180 100644 --- a/hw-ui/src/views/board/fifthFloor/index.vue +++ b/hw-ui/src/views/board/fifthFloor/index.vue @@ -25,7 +25,7 @@
- 领料 + 领柜体 绑定 返库 完成 @@ -195,39 +195,25 @@
- - - - - - - - - - - - + - - + + - + @@ -264,13 +250,14 @@ width="120" >
- 申请领料 + 申请领柜体
@@ -326,6 +313,12 @@ title="柜体返库" width="40%"> + + + + + @@ -466,10 +459,14 @@ export default { rawBackVisible: false, rawBackForm: { materialBarcode: null, + warehouseId: null }, rawBackRules: { materialBarcode: [ { required: true, message: "物料条码不能为空", trigger: "blur" } + ], + warehouseId: [ + { required: true, message: "仓库不能为空", trigger: "change" } ] } } @@ -699,7 +696,7 @@ export default { this.nowStation = val }, completeStation() { - console.log(this.nowStation) + alert(JSON.stringify(this.nowStation)) this.assignModel = false }, getInfo(e) { @@ -1058,7 +1055,7 @@ export default { }) }, - // 领料页面 + // 领柜体页面 getMaterials() { this.searchMaterialValue = '' this.dialogVisible = true @@ -1072,7 +1069,7 @@ export default { wmsRawOutstockDetailList: [] } // 获取仓库信息 - getWarehouses({"warehouseFloor": 5}).then(e => { + getWarehouses({"warehouseFloor": 5,"returnFlag":1}).then(e => { this.warehouseList = e.data this.form1.warehouseId = e.data[0]?.warehouseId this.searchMaterial(""); @@ -1082,6 +1079,10 @@ export default { // 物料搜索 searchMaterial(val) { + if(this.form1.warehouseId==null || this.form1.warehouseId == undefined + || this.form1.warehouseId==""){ + return; + } getStockTotal({ warehouseId: this.form1.warehouseId, materialName: val @@ -1093,7 +1094,7 @@ export default { materialName: r.materialName, availableAmount: r.totalAmount - r.occupyAmount - r.frozenAmount, unavailableAmount: r.occupyAmount + r.frozenAmount, - planAmount: r.planAmount + planAmount: 1 } }) }) @@ -1107,11 +1108,12 @@ export default { }, receiveMaterial() { + this.form1.taskType = '2';//拆分出库 applyRawOutstock(this.form1).then(e => { if (e.code === 200) { this.dialogVisible = false this.$message({ - message: '领料完成', + message: '申请领柜体成功', type: 'success' }); } @@ -1167,13 +1169,24 @@ export default { resetRawBack() { this.rawBackForm = { materialBarcode: null, + warehouseId:null }; this.resetForm("rawBackForm"); }, - /** 成品入库按钮操作 */ + /** 柜体返库按钮操作 */ handleRawBack(scope) { this.resetRawBack(); + // 获取仓库信息 + if(this.warehouseList==null || this.warehouseList.length==0){ + getWarehouses({"warehouseFloor": 5,"returnFlag":1}).then(e => { + this.warehouseList = e.data + this.rawBackForm.warehouseId = this.warehouseList[0]?.warehouseId + }) + }else{ + this.rawBackForm.warehouseId = this.warehouseList[0]?.warehouseId + } + this.rawBackVisible = true; },