diff --git a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java index 030e06b7..4ba1d2a2 100644 --- a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java +++ b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java @@ -124,6 +124,10 @@ public class MesBaseBarcodeInfo extends BaseEntity @Excel(name = "项目号") private String projectNo; + /** + * 流转到的生产计划明细编号,用于在生产时使用条码开始明细使用,关联mes_product_plan_detail的plan_detail_code*/ + private String transferredPlanDetailCode; + /** 流水号 */ @Excel(name = "流水号") private String serialNumber; @@ -401,6 +405,15 @@ public class MesBaseBarcodeInfo extends BaseEntity { return projectNo; } + + public String getTransferredPlanDetailCode() { + return transferredPlanDetailCode; + } + + public void setTransferredPlanDetailCode(String transferredPlanDetailCode) { + this.transferredPlanDetailCode = transferredPlanDetailCode; + } + public void setSerialNumber(String serialNumber) { this.serialNumber = serialNumber; diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java index 8f7dfed5..3f221ff0 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java @@ -137,6 +137,9 @@ public class MesConstants { public static final String MES_BARCODE_PRINT_FLAG_NO = "0";//否 + /**工序类型*/ + public static final String MES_PROCESS_TYPE_FIFTH_SPLIT = "1";//五楼拆分工序 + } diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/WmsConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/WmsConstants.java index 810f3b96..fc585a58 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/WmsConstants.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/WmsConstants.java @@ -240,4 +240,9 @@ public class WmsConstants { //车间生产区域类型 public static final String MES_AREA_TYPE_FOUTHFLOOR_ASSEMBLE = "3";//四楼装配区域 public static final String MES_AREA_TYPE_FOUTHFLOOR_PARTS = "4";//四楼零配件仓库 + + + //原材料出库拆分标识 + public static final String WMS_RAW_OUTSTOCK_SPLIT_FLAG_YES = "1"; + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductPlanController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductPlanController.java index 1e57d625..cf848869 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductPlanController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductPlanController.java @@ -149,27 +149,57 @@ public class MesProductPlanController extends BaseController return toAjax(mesProductPlanService.orderAddMesProductPlanList(productPlanEditVo)); } - /** - * 获取生产派工图纸List列表 + /* *//** + * 获取生产派工图纸List列表(暂时不用) * @param planId * @return - */ + *//* @GetMapping(value = "/drawingList/{planId}") public AjaxResult getDispatchDrawingList(@PathVariable("planId") Long planId) { return success(mesProductPlanService.getDispatchAttachList(planId, MesConstants.MES_ATTACH_TYPE_DRAWING)); } - /** - * 获取生产派工SOP附件List列表 + *//** + * 获取生产派工SOP附件List列表(暂时不用) * @param planId * @return - */ + *//* @GetMapping(value = "/SOPAttachList/{planId}") public AjaxResult getDispatchSOPAttachList(@PathVariable("planId") Long planId) { return success(mesProductPlanService.getDispatchAttachList(planId, MesConstants.MES_ATTACH_TYPE_SOP)); } +*/ + + + /** + * 获取生产派工图纸List列表 + * @param dispatchCode + * @param processId + * @return + */ + @GetMapping(value = "/drawingList/{dispatchCode}/{processId}") + public AjaxResult getDispatchDrawingList(@PathVariable("dispatchCode") String dispatchCode, + @PathVariable("processId") Long processId) + { + return success(mesProductPlanService.getDispatchAttachList(dispatchCode,processId, MesConstants.MES_ATTACH_TYPE_DRAWING)); + } + + /** + * 获取生产派工SOP附件List列表 + * @param dispatchCode + * @param processId + * @return + */ + @GetMapping(value = "/SOPAttachList/{dispatchCode}/{processId}") + public AjaxResult getDispatchSOPAttachList(@PathVariable("dispatchCode") String dispatchCode, + @PathVariable("processId") Long processId) + { + return success(mesProductPlanService.getDispatchAttachList(dispatchCode,processId,MesConstants.MES_ATTACH_TYPE_SOP)); + } + + /** * 工单撤回 diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlan.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlan.java index 8b01dd68..0fc16a57 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlan.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlan.java @@ -167,6 +167,11 @@ public class MesProductPlan extends BaseEntity */ private String materialName; + /** + * 物料规格 + */ + private String materialSpec; + /** 生产计划明细信息 */ @@ -495,6 +500,14 @@ public class MesProductPlan extends BaseEntity this.materialName = materialName; } + public String getMaterialSpec() { + return materialSpec; + } + + public void setMaterialSpec(String materialSpec) { + this.materialSpec = materialSpec; + } + public String getProcessType() { return processType; } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlanDetail.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlanDetail.java index b50cca36..ebfeff8d 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlanDetail.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductPlanDetail.java @@ -66,6 +66,8 @@ public class MesProductPlanDetail extends BaseEntity private String materialBarcode; + private String processType;//工序类型,1五楼拆分工序 + public void setPlanDetailId(Long planDetailId) { this.planDetailId = planDetailId; @@ -190,6 +192,14 @@ public class MesProductPlanDetail extends BaseEntity this.materialBarcode = materialBarcode; } + public String getProcessType() { + return processType; + } + + public void setProcessType(String processType) { + this.processType = processType; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanMapper.java index 6b70e924..52ba6428 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanMapper.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanMapper.java @@ -126,4 +126,13 @@ public interface MesProductPlanMapper */ public int deleteMesProductPlanByDispatchCode(String dispatchCode); + + /** + * 查询生产派工 + * + * @param mesProductPlan 生产派工 + * @return 生产派工 + */ + public List selectOnlyMesProductPlans(MesProductPlan mesProductPlan); + } 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 1b4ca0fe..f74acd84 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 @@ -112,6 +112,16 @@ public interface IMesProductPlanService */ public List getDispatchAttachList(Long planId, String attachType); + /** + * 获取生产派工单号和工序获取附件List列表 + * + * @param dispatchCode + * @param processId + * @param attachType + * @return + */ + public List getDispatchAttachList(String dispatchCode,Long processId, String attachType); + /** * 工单撤回 * diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBasePalletInfoServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBasePalletInfoServiceImpl.java index a6e7fc07..06a2365e 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBasePalletInfoServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBasePalletInfoServiceImpl.java @@ -8,12 +8,15 @@ import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.exception.ServiceException; import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.StringUtils; +import com.hw.common.core.utils.poi.ExcelUtil; import com.hw.common.security.utils.SecurityUtils; import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.domain.vo.MesPalletInfoBindVo; import com.hw.mes.mapper.MesBaseBarcodeInfoMapper; import com.hw.printer.api.RemotePrinterService; import com.hw.printer.api.domain.vo.PrintContentVo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hw.mes.mapper.MesBasePalletInfoMapper; @@ -31,6 +34,9 @@ import javax.annotation.Resource; */ @Service public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService { + private static final Logger log = LoggerFactory.getLogger(MesBasePalletInfoServiceImpl.class); + + @Autowired private MesBasePalletInfoMapper mesBasePalletInfoMapper; @@ -119,16 +125,18 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService { @Override @Transactional(rollbackFor = Exception.class) public int bindPalletInfo(MesPalletInfoBindVo mesPalletInfoBindVo) { - String palletInfoCode = mesPalletInfoBindVo.getPalletInfoCode(); - String materialBarcode = mesPalletInfoBindVo.getMaterialBarcode(); + String palletInfoCode = mesPalletInfoBindVo.getPalletInfoCode().trim(); + String materialBarcode = mesPalletInfoBindVo.getMaterialBarcode().trim(); MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode); if (mesBaseBarcodeInfo == null) { + log.error("palletInfoCode:"+palletInfoCode+",materialBarcode:"+materialBarcode); throw new ServiceException("物料条码有误"); } MesBasePalletInfo mesBasePalletInfo = mesBasePalletInfoMapper.selectMesBasePalletInfoByPalletInfoCode(palletInfoCode); if (mesBasePalletInfo == null) { + log.error("palletInfoCode:"+palletInfoCode+",materialBarcode:"+materialBarcode); throw new ServiceException("托盘码有误"); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseStationInfoServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseStationInfoServiceImpl.java index b9b4a0fc..b04aa168 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseStationInfoServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseStationInfoServiceImpl.java @@ -101,14 +101,16 @@ public class MesBaseStationInfoServiceImpl implements IMesBaseStationInfoService */ @Override public MesBaseStationInfo getLoginStationInfo() { + //TODO:正式时需要修改回来 String ipAddress = SecurityUtils.getLoginUser().getIpaddr(); - ipAddress = "192.168.2.20";//TODO:正式时需要删除 +// ipAddress = "192.168.2.25"; MesBaseStationInfo mesBaseStationInfo = mesBaseStationInfoMapper.selectMesBaseStationInfoByStationIp(ipAddress); Integer processFloor = SecurityUtils.getProcessFloor(); if (mesBaseStationInfo != null && mesBaseStationInfo.getFloor() != null && !mesBaseStationInfo.getFloor().equals(processFloor)) { throw new ServiceException("请在" + processFloor + "楼登录此工序"); } +// MesBaseStationInfo mesBaseStationInfo = mesBaseStationInfoMapper.selectMesBaseStationInfoByStationId(526l); return mesBaseStationInfo; } } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductOrderServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductOrderServiceImpl.java index 849d09d0..383b772e 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductOrderServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductOrderServiceImpl.java @@ -79,6 +79,9 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService { }else{ mesProductOrder.setSaleAmount(mesProductOrder.getPlanAmount()); } + if (mesProductOrder.getSaleOrderId() == null) { + mesProductOrder.setSaleOrderId(0L); + } return mesProductOrderMapper.insertMesProductOrder(mesProductOrder); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanDetailServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanDetailServiceImpl.java index f285d8da..21243419 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanDetailServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanDetailServiceImpl.java @@ -7,6 +7,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.config.MesConfig; import com.hw.mes.domain.*; import com.hw.mes.domain.vo.MesProductPlanDetailVo; import com.hw.mes.mapper.*; @@ -191,7 +192,7 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer String userName = SecurityUtils.getUsername(); Long userId = SecurityUtils.getUserId(); - startProductOrder(dbProductPlan,currentDate,userName); + startProductOrder(dbProductPlan, currentDate, userName); if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED)) { dbProductPlan.setRealBeginTime(currentDate); @@ -224,21 +225,33 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer selectMesProductPlanDetailByPlanDetailId(planDetailId); String planDetailStatus = dbProductPlanDetail.getPlanDetailStatus(); if (planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_TO_START)) { - throw new ServiceException("此生产计划明细未开始"); + throw new ServiceException("此生产明细未开始"); } else if (planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_FINISH)) { - throw new ServiceException("此生产计划明细已结束"); + throw new ServiceException("此生产明细已结束"); } Long planId = dbProductPlanDetail.getPlanId(); MesProductPlan dbProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(planId); String planStatus = dbProductPlan.getPlanStatus(); if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_TO_DISPATCH)) { - throw new ServiceException("此生产计划未派工,不能结束"); + throw new ServiceException("此生产明细未派工,不能结束"); } else if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH)) { - throw new ServiceException("此生产计划已结束"); + throw new ServiceException("此生产派工已结束"); + } + + //如果是五楼拆分,校验是否有绑定条码 + if (mesProductPlanDetail.getProcessType().equals(MesConstants.MES_PROCESS_TYPE_FIFTH_SPLIT)) { + MesBaseBarcodeInfo queryBaseBarcodeInfo = new MesBaseBarcodeInfo(); + queryBaseBarcodeInfo.setPlanDetailCode(dbProductPlanDetail.getPlanDetailCode()); + List mesBaseBarcodeInfos = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoList(queryBaseBarcodeInfo); + List bindBaseBarcodeInfos = mesBaseBarcodeInfos.stream().filter(mesBaseBarcodeInfo -> + StringUtils.isNotEmpty(mesBaseBarcodeInfo.getBindBarcode())).collect(Collectors.toList()); + if (bindBaseBarcodeInfos == null || bindBaseBarcodeInfos.isEmpty()) { + throw new ServiceException("请绑定条码执行返库后再执行完成"); + } } - //校验生产计划明细校验信息(如果是多个工序只校验最后一个工序,一楼和四楼都是一个工序,暂时不校验最后一个工序), + //校验生产计划明细物料使用情况校验信息(如果是多个工序只校验最后一个工序,一楼是一个工序,暂时不校验最后一个工序) List checkResults = mesMaterialCheckResultMapper.selectMesMaterialCheckResult(planId, planDetailId, "0," + dbProductPlan.getMaterialBomId()); List filterCheckResults = checkResults.stream().filter( @@ -270,9 +283,9 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer dbProductPlan.setPlanStatus(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH); dbProductPlan.setRealEndTime(currentDate); - - //todo:更新生产工单状态、结束时间和完成数量(根据finalprocessFlag更新生产工单) + //todo:更新生产任务状态、结束时间和完成数量(根据finalprocessFlag更新生产任务) } + dbProductPlan.setCompleteAmount(newComplementAmount); dbProductPlan.setUpdateTime(currentDate); dbProductPlan.setUpdateBy(userName); @@ -330,21 +343,59 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer if (!planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_FINISH) && !planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_ABNORMAL_FINISH)) { //如果不是完成状态则不能开始下一任务明细 - throw new ServiceException("请先完成上一任务明细"); + throw new ServiceException("请先完成上一生产明细"); } else { Date realEndTime = newestPlanDetail.getRealEndTime(); - //todo:在完成任务后需要过多久才能继续下一任务 + //在完成任务后需要过多久才能继续下一任务,先不考虑 } } + MesProductPlan mesProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(mesProductPlanDetail.getPlanId()); + //判断生产计划的状态 + String planStatus = mesProductPlan.getPlanStatus(); + if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_TO_DISPATCH)) { + throw new ServiceException("还未派工,不能开始"); + } else if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH)) { + throw new ServiceException("此生产派工已经结束"); + } + + Date currentDate = new Date(); + String userName = SecurityUtils.getUsername(); + Long userId = SecurityUtils.getUserId(); + + + String planDetailCode = Seq.getId(Seq.mesProductPlanDetailSeqType, Seq.mesProductPlanDetailCode); //五楼装配工位要扫码开始 if (startType.equals(MesConstants.MES_START_TYPE_FIFTH_FLOOR_ASSEMBLE)) { String materialBarcode = mesProductPlanDetail.getMaterialBarcode(); MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode); if (mesBaseBarcodeInfo == null) { - throw new ServiceException("物料条码有误"); + throw new ServiceException("条码有误"); + } + + if (!mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_BACKPLATE) && + !mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_DOOR)) { + throw new ServiceException("请扫描背板或门板条码开始"); + } + + if (StringUtils.isEmpty(mesBaseBarcodeInfo.getBindBarcode())) { + throw new ServiceException("此条码有误,未绑定任何柜体"); + } + + if(StringUtils.isNotEmpty(mesBaseBarcodeInfo.getTransferredPlanDetailCode())){ + throw new ServiceException("此条码已经扫描使用过,不能再次使用"); + } + + //校验此条码是否是同一派工单 + MesProductPlan barcodeProductPlan = mesProductPlanMapper.selectOnlyMesProductPlanByPlanCode(mesBaseBarcodeInfo.getPlanCode()); + if (barcodeProductPlan == null) { + throw new ServiceException("条码有误,没有相关派工"); + } + if (!barcodeProductPlan.getDispatchCode().equals(mesProductPlan.getDispatchCode())) { + throw new ServiceException("此条码的派工单号为:" + barcodeProductPlan.getDispatchCode() + ",与此派工单号不符"); } + // MesMaterialAssignInfo queryMaterialAssignInfo = new MesMaterialAssignInfo(); // queryMaterialAssignInfo.setMaterialBarcode(materialBarcode); // List mesMaterialAssignInfoList = mesMaterialAssignInfoMapper.selectMesMaterialAssignInfoList(queryMaterialAssignInfo); @@ -352,23 +403,17 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer // throw new ServiceException("此物料条码还没下发到工位"); // } - } - + mesBaseBarcodeInfo.setTransferredPlanDetailCode(planDetailCode); + mesBaseBarcodeInfo.setUpdateTime(currentDate); + mesBaseBarcodeInfo.setUpdateBy(userName); + mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo); - MesProductPlan mesProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(mesProductPlanDetail.getPlanId()); - //判断生产计划的状态 - String planStatus = mesProductPlan.getPlanStatus(); - if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_TO_DISPATCH)) { - throw new ServiceException("还未派工,不能开始"); - } else if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH)) { - throw new ServiceException("此生产派工已经结束"); } - Date currentDate = new Date(); - String userName = SecurityUtils.getUsername(); - Long userId = SecurityUtils.getUserId(); - startProductOrder(mesProductPlan,currentDate,userName); + //判断生产任务状态,并根据状态更新生产任务 + startProductOrder(mesProductPlan, currentDate, userName); + if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED)) {//如果状态是已开始,需要修改计划的状态和开始时间 mesProductPlan.setPlanStatus(MesConstants.MES_PRODUCT_PLAN_STATUS_STARTED); @@ -379,7 +424,7 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer } mesProductPlanDetail.setPlanDetailStatus(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_STARTED); - mesProductPlanDetail.setPlanDetailCode(Seq.getId(Seq.mesProductPlanDetailSeqType, Seq.mesProductPlanDetailCode)); + mesProductPlanDetail.setPlanDetailCode(planDetailCode); mesProductPlanDetail.setPlanCode(mesProductPlan.getPlanCode()); mesProductPlanDetail.setPlanDetailStatus(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_STARTED); mesProductPlanDetail.setIsFlag("1"); @@ -391,25 +436,26 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer mesProductPlanDetailMapper.insertMesProductPlanDetail(mesProductPlanDetail); + + return mesProductPlanDetail; } - - public void startProductOrder(MesProductPlan productPlan,Date currentDate,String userName){ + public void startProductOrder(MesProductPlan productPlan, Date currentDate, String userName) { MesProductOrder productOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(productPlan.getProductOrderId()); - if(productOrder==null){ - throw new ServiceException("无此生产工单"); + if (productOrder == null) { + throw new ServiceException("无此生产任务"); } String orderStatus = productOrder.getOrderStatus(); - if(!orderStatus.equals(MesConstants.BEGIN) && !orderStatus.equals(MesConstants.PUBLISHED)){ + if (!orderStatus.equals(MesConstants.BEGIN) && !orderStatus.equals(MesConstants.PUBLISHED)) { String orderStatusPrompt = MesConstants.ORDER_STATUS_PROMPT_MAP.get(orderStatus); - throw new ServiceException(String.format("此生产工单已经%s,不能开始!", orderStatusPrompt)); + throw new ServiceException(String.format("此生产任务已经%s,不能开始!", orderStatusPrompt)); } - if(orderStatus.equals(MesConstants.PUBLISHED)){ + if (orderStatus.equals(MesConstants.PUBLISHED)) { productOrder.setOrderStatus(MesConstants.BEGIN); productOrder.setRealBeginTime(currentDate); productOrder.setUpdateBy(userName); 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 3dd21a5f..04316109 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 @@ -307,6 +307,54 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService { } } + + /** + * 获取生产派工单号和工序获取附件List列表 + * + * @param dispatchCode + * @param processId + * @param attachType + * @return + */ + @Override + public List getDispatchAttachList(String dispatchCode, Long processId, String attachType) { + MesProductPlan queryProductPlan = new MesProductPlan(); + queryProductPlan.setProcessId(processId); + queryProductPlan.setDispatchCode(dispatchCode); + List mesProductPlans = mesProductPlanMapper.selectOnlyMesProductPlans(queryProductPlan); + if (mesProductPlans != null && !mesProductPlans.isEmpty()) { + MesProductPlan mesProductPlan = mesProductPlans.get(0); + try { + if (attachType.equals(MesConstants.MES_ATTACH_TYPE_DRAWING)) { + if (StringUtils.isEmpty(mesProductPlan.getAttachId())) { + return new ArrayList<>(); + } + Long[] attachIds = Arrays.stream(mesProductPlan.getAttachId().split(",")) + .map(String::trim) + .map(Long::parseLong) + .toArray(Long[]::new); + return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(attachIds); + } else if (attachType.equals(MesConstants.MES_ATTACH_TYPE_SOP)) { + if (StringUtils.isEmpty(mesProductPlan.getSopId())) { + return new ArrayList<>(); + } + Long[] sopIds = Arrays.stream(mesProductPlan.getSopId().split(",")) + .map(String::trim) + .map(Long::parseLong) + .toArray(Long[]::new); + return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(sopIds); + } else { + return new ArrayList<>(); + } + } catch (Exception e) { + return new ArrayList<>(); + } + } + return new ArrayList<>(); + + } + + /** * 工单撤回 * @@ -341,7 +389,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService { public List selectMesProductPlanJoinList(MesProductPlan mesProductPlan) { Long processId = SecurityUtils.getProcessId(); Long userId = SecurityUtils.getUserId(); - if(!SecurityUtils.isAdmin(userId)) { + if (!SecurityUtils.isAdmin(userId)) { mesProductPlan.setUserId(userId); } mesProductPlan.setProcessId(processId); @@ -431,7 +479,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService { if (!barcodeType.equals(MesConstants.MES_BARCODE_TYPE_RAW)) { throw new ServiceException("此条码为非原材料条码"); } - + String userName = SecurityUtils.getUsername(); Date currentDate = new Date(); MesMaterialCheckResult mesMaterialCheckResult = mesMaterialCheckResultMapper. 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 9ca91279..67956007 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 @@ -32,6 +32,7 @@ + @@ -42,7 +43,7 @@ - + @@ -74,6 +75,7 @@ bbi.sale_order_id, bbi.saleorder_code, bbi.project_no, + bbi.transferred_plan_detail_code, bbi.print_flag, bbi.serial_number, bbi.remark, @@ -141,6 +143,7 @@ barcode_info, batch_code, pallet_info_code, + bind_barcode, material_id, manufacturer_id, amount, @@ -175,6 +178,7 @@ #{barcodeInfo}, #{batchCode}, #{palletInfoCode}, + #{bindBarcode}, #{materialId}, #{manufacturerId}, #{amount}, @@ -227,6 +231,7 @@ sale_order_id = #{saleOrderId}, saleorder_code = #{saleorderCode}, project_no = #{projectNo}, + transferred_plan_detail_code = #{transferredPlanDetailCode}, serial_number = #{serialNumber}, remark = #{remark}, bind_barcode = #{bindBarcode}, @@ -342,7 +347,7 @@ bmi.material_code, bmi.material_name, bmi.material_spec, - bmi.bind_flag, + bmi.always_flag, qcr.check_status from mes_base_barcode_info bbi left join mes_base_material_info bmi on bmi.material_id = bbi.material_id diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml index 6513a7b2..f1a727f3 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml @@ -22,7 +22,7 @@ - + @@ -58,6 +58,7 @@ bmi.material_spec, bmi.net_weight, bmi.gross_weight, + bmi.always_flag, bmi.factory_id, bmi.create_org_id, bmi.purchase_price_unit_id, @@ -200,7 +201,7 @@ material_spec = #{materialSpec}, net_weight = #{netWeight}, gross_weight = #{grossWeight}, - bind_flag = #{bindFlag}, + always_flag = #{alwaysFlag}, factory_id = #{factoryId}, create_org_id = #{createOrgId}, use_org_id = #{useOrgId}, @@ -214,7 +215,7 @@ update_time = #{updateTime}, approve_date = #{approveDate}, erp_modify_date = #{erpModifyDate}, - bind_flag = #{bindFlag}, + always_flag = #{alwaysFlag}, batch_amount = #{batchAmount}, where material_id = #{materialId} @@ -322,7 +323,7 @@ bmi.material_spec, bmi.net_weight, bmi.gross_weight, - bmi.bind_flag, + bmi.always_flag, bmi.factory_id, bmi.create_org_id, bmi.use_org_id, diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml index efdbcf54..22b86355 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml @@ -41,6 +41,7 @@ + @@ -198,7 +199,7 @@ insert into mes_product_plan product_order_id, - sale_order_id, + sale_order_id, saleorder_code, plan_code, dispatch_code, @@ -337,7 +338,7 @@ mpp.material_bom_id, mpp.process_id, mpp.process_order, mpp.last_process_id,mpp.user_id, mpp.station_id, mpp.dispatch_amount, mpp.plan_amount, mpp.complete_amount, mpp.plan_begin_time, mpp.plan_end_time, mpp.real_begin_time, mpp.real_end_time, - mpp.attach_id, mpp.plan_status, mpo.plan_delivery_date,mbmi.material_code,mbmi.material_name + mpp.attach_id, mpp.plan_status, mpo.plan_delivery_date,mbmi.material_code,mbmi.material_name,mbmi.material_spec from mes_product_plan mpp left join mes_product_order mpo on mpp.product_order_id = mpo.product_order_id left join mes_base_material_info mbmi on mpp.material_id=mbmi.material_id @@ -457,4 +458,38 @@ where dispatch_code = #{dispatchCode} + + + + diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/config/WmsConfig.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/config/WmsConfig.java index baaf1f69..9e9ffecb 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/config/WmsConfig.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/config/WmsConfig.java @@ -18,6 +18,11 @@ public class WmsConfig { */ private String fifthAssembleStationCode; + /** + * 五楼拆分区域位置编码 + */ + private String fifthSplitStationCode; + /** * 五楼半成品仓库ID */ @@ -57,6 +62,14 @@ public class WmsConfig { this.fifthAssembleStationCode = fifthAssembleStationCode; } + public String getFifthSplitStationCode() { + return fifthSplitStationCode; + } + + public void setFifthSplitStationCode(String fifthSplitStationCode) { + this.fifthSplitStationCode = fifthSplitStationCode; + } + public Long getFifthSemiWarehouseId() { return fifthSemiWarehouseId; } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsMobileController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsMobileController.java index 3ba99552..bbde3d4e 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsMobileController.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsMobileController.java @@ -225,7 +225,7 @@ public class WmsMobileController extends BaseController { /** - * 人工成品入库(适用于5楼成品入库) + * 人工成品入库(适用于5楼成品入库,弃用) */ @Log(title = "成品入库记录", businessType = BusinessType.INSERT) @PostMapping(("/addProductInstock")) diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductStock.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductStock.java index 3deb3434..3f0820ca 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductStock.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductStock.java @@ -45,6 +45,8 @@ public class WmsProductStock extends BaseEntity @Excel(name = "入库批次号") private String productBatch; + private String palletInfoCode; + /** 质检状态(1检验中,2质检通过,3质检不通过) */ @Excel(name = "质检状态(1检验中,2质检通过,3质检不通过)") private String qualityStatus; @@ -166,6 +168,15 @@ public class WmsProductStock extends BaseEntity { return productBatch; } + + public String getPalletInfoCode() { + return palletInfoCode; + } + + public void setPalletInfoCode(String palletInfoCode) { + this.palletInfoCode = palletInfoCode; + } + public void setQualityStatus(String qualityStatus) { this.qualityStatus = qualityStatus; diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawOutstock.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawOutstock.java index f8f0b555..40e684e5 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawOutstock.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawOutstock.java @@ -55,6 +55,8 @@ public class WmsRawOutstock extends BaseEntity { @Excel(name = "销售订单ID") private Long orderId; + private Long saleOrderId; + /** * 计划编号,关联pd_base_plan_info的plan_id */ @@ -115,6 +117,9 @@ public class WmsRawOutstock extends BaseEntity { @Excel(name = "任务类型(1生产领料,2移库出库,3合库出库,9其他领料)") private String taskType; + private String splitFlag; + + /** * 申请原因 */ @@ -209,7 +214,6 @@ public class WmsRawOutstock extends BaseEntity { private String materialBarcode; - private Long saleOrderId; /** * 原材料出库记录明细信息 @@ -368,6 +372,14 @@ public class WmsRawOutstock extends BaseEntity { return taskType; } + public String getSplitFlag() { + return splitFlag; + } + + public void setSplitFlag(String splitFlag) { + this.splitFlag = splitFlag; + } + public void setApplyReason(String applyReason) { this.applyReason = applyReason; } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockServiceImpl.java index a6d93968..d318bfda 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockServiceImpl.java @@ -70,6 +70,14 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService /** * 新增成品出库记录 + *|参数名|类型|必选|说明| + * |:---- |:---|:----- |----- | + * | warehouseId | long 仓库ID;领料时需要保存 | + * | saleorderId | string + * | saleorderCode | string + * | productId | long + * | applyQty | bigDecimal 申请数量 | + * | applyReason | string 申请原因 | * * @param wmsProductOutstock 成品出库记录 * @return 结果 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 24a24f09..bd54d0e8 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 @@ -290,7 +290,6 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService { } } - WmsRawInstock wmsRawInstock = new WmsRawInstock(); wmsRawInstock.setTaskCode(Seq.getId(Seq.rawInstockSeqType, Seq.rawInstockSeqCode)); wmsRawInstock.setWarehouseId(wmsRawBackVo.getWarehouseId()); 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 93ad90b7..e70afe5e 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 @@ -500,7 +500,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { String planDetailCode = wmsRawOutstock.getPlanDetailCode(); if (StringUtils.isEmpty(planCode) || StringUtils.isEmpty(planDetailCode)) { - throw new ServiceException("请选择计划明细信息再领料"); + throw new ServiceException("请选择派工明细信息再领料"); } Long warehouseId = wmsRawOutstock.getWarehouseId(); @@ -515,6 +515,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { : wmsRawOutstock.getTaskType(); String warehouseType = baseWarehouse.getWarehouseType(); + //TODO 判断质检状态,还是在实际出库时判断质检状态 String queryQualityStatus = WmsConstants.WMS_QUALITY_STATUS_PASS; @@ -545,7 +546,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(baseWarehouse, wmsRawOutstock, rawOutstockDetail.getMaterialId(), taskCode, taskType, - planAmount, currentDate, userName, wmsStockTotal.getStockTotalId()); + planAmount, currentDate, userName, wmsStockTotal.getStockTotalId(), wmsStockTotal.getSaleOrderId()); toInsertedRawOutstocks.add(toInsertedRawOutstock); } else { @@ -577,7 +578,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { */ private WmsRawOutstock getWmsRawOutstock(WmsBaseWarehouse baseWarehouse, WmsRawOutstock wmsRawOutstockParam, Long materialId, String taskCode, String taskType, - BigDecimal planAmount, Date currentDate, String userName, Long stockTotalId) { + BigDecimal planAmount, Date currentDate, String userName, Long stockTotalId, Long saleOrderId) { //出库要求 (0申请出库,1申请审核出库,2直接出库) String outRequirement = baseWarehouse.getOutRequirement(); String warehouseType = baseWarehouse.getWarehouseType(); @@ -586,6 +587,21 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { WmsRawOutstock toInsertedRawOutstock = new WmsRawOutstock(); toInsertedRawOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE); + + //如果是五楼拆分区,一个明细只能领取一个柜体 + if (wmsRawOutstockParam.getTaskType().equals(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_SPLIT)) { + WmsRawOutstock queryRawOutstock = new WmsRawOutstock(); + queryRawOutstock.setPlanDetailCode(wmsRawOutstockParam.getPlanDetailCode()); + queryRawOutstock.setSplitFlag(WmsConstants.WMS_RAW_OUTSTOCK_SPLIT_FLAG_YES); + + List wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockList(queryRawOutstock); + if (wmsRawOutstocks != null && !wmsRawOutstocks.isEmpty()) { + throw new ServiceException("一个明细信息只能领取一个柜体"); + } + + toInsertedRawOutstock.setSplitFlag(WmsConstants.WMS_RAW_OUTSTOCK_SPLIT_FLAG_YES); + } + if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {//如果是普通仓库,需要校验审核标识 if (outRequirement.equals(WmsConstants.WMS_WAREHOUSE_OUT_REQUIREMENT_APPLY_AUDIT)) { toInsertedRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_TOAUDIT); @@ -602,12 +618,18 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { // toInsertedRawOutstock.setLocationCode(wmsRawStock.getLocationCode()); toInsertedRawOutstock.setStationId(wmsRawOutstockParam.getStationId()); toInsertedRawOutstock.setStockTotalId(stockTotalId); + toInsertedRawOutstock.setSaleOrderId(saleOrderId); // toInsertedRawOutstock.setPalletInfoCode(wmsRawStock.getPalletInfoCode()); toInsertedRawOutstock.setOperationType(operationType); toInsertedRawOutstock.setApplyBy(userName); toInsertedRawOutstock.setApplyReason(wmsRawOutstockParam.getApplyReason()); toInsertedRawOutstock.setApplyDate(currentDate); - toInsertedRawOutstock.setEndStationCode(wmsRawOutstockParam.getEndStationCode()); + if (wmsRawOutstockParam.getTaskType().equals(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_PICKING)) { + toInsertedRawOutstock.setEndStationCode(wmsRawOutstockParam.getEndStationCode()); + + } else if (wmsRawOutstockParam.getTaskType().equals(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_SPLIT)) { + toInsertedRawOutstock.setEndStationCode((wmsConfig.getFifthSplitStationCode())); + } toInsertedRawOutstock.setMaterialId(materialId); toInsertedRawOutstock.setOutstockAmount(planAmount); toInsertedRawOutstock.setPlanCode(wmsRawOutstockParam.getPlanCode()); @@ -949,6 +971,17 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { if (StringUtils.isEmpty(bindBarcode)) { throw new ServiceException("此柜体还未绑定"); } + //通过绑定的条码找到物料信息和saleorderid + R bindBarcodeInfoR = remoteMesService.getBarcode(bindBarcode, SecurityConstants.INNER); + if (bindBarcodeInfoR == null) { + throw new ServiceException("绑定的柜体条码有误"); + } + MesBaseBarcodeInfo bindBarcodeInfo = bindBarcodeInfoR.getData(); + if (bindBarcodeInfo == null) { + throw new ServiceException("绑定的柜体条码有误"); + } + + WmsRawOutstock queryRawOutstock = new WmsRawOutstock(); queryRawOutstock.setMaterialBatch(bindBarcode); List wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockList(queryRawOutstock); @@ -973,10 +1006,11 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { wmsRawOutstock.setOrderId(baseBarcodeInfo.getSaleOrderId()); wmsRawOutstock.setPlanCode(baseBarcodeInfo.getPlanCode()); wmsRawOutstock.setPlanDetailCode(baseBarcodeInfo.getPlanDetailCode()); - wmsRawOutstock.setMaterialId(baseBarcodeInfo.getMaterialId()); + wmsRawOutstock.setMaterialId(bindBarcodeInfo.getMaterialId()); wmsRawOutstock.setMaterialBatch(bindBarcode); - wmsRawOutstock.setPalletInfoCode(baseBarcodeInfo.getPalletInfoCode());//在绑定时需要在条码信息中记录托盘码 + wmsRawOutstock.setPalletInfoCode(bindBarcodeInfo.getPalletInfoCode());//在绑定时需要在条码信息中记录托盘码 wmsRawOutstock.setOutstockAmount(BigDecimal.ONE); + wmsRawOutstock.setSaleOrderId(bindBarcodeInfo.getSaleOrderId()); wmsRawOutstock.setEndStationCode(wmsConfig.getFifthAssembleStationCode());//目标位置,五楼组装区域 wmsRawOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_AUTO); @@ -1213,6 +1247,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { @Override public WmsRawOutstock getNewestOutstockCabinet(WmsRawOutstock wmsRawOutstock) { wmsRawOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH); + wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_SPLIT); return wmsRawOutstockMapper.selectNewestWmsRawOutstock(wmsRawOutstock); } } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java index 0d1a982b..a2c7fd54 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java @@ -200,11 +200,11 @@ public class WmsTransferServiceImpl implements IWmsTransferService { R mesBaseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); if (mesBaseBarcodeInfoR == null) { - throw new ServiceException("物料编码错误"); + throw new ServiceException("物料条码错误"); } MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoR.getData(); if (mesBaseBarcodeInfo == null) { - throw new ServiceException("物料编码错误"); + throw new ServiceException("物料条码错误"); } @@ -227,6 +227,9 @@ public class WmsTransferServiceImpl implements IWmsTransferService { if (productStock == null) { throw new ServiceException("无此成品库存"); } + if (!productStock.getLocationCode().equals(wmsTransferDetail.getLocationCode())) { + throw new ServiceException("出库库位编码错误"); + } WmsTransfer wmsTransfer = new WmsTransfer(); wmsTransfer.setTaskCode(Seq.getId(Seq.wmsTransferSeqType, Seq.wmsTransferSeqCode)); @@ -280,11 +283,11 @@ public class WmsTransferServiceImpl implements IWmsTransferService { R mesBaseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); if (mesBaseBarcodeInfoR == null) { - throw new ServiceException("物料编码错误"); + throw new ServiceException("物料条码错误"); } MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoR.getData(); if (mesBaseBarcodeInfo == null) { - throw new ServiceException("物料编码错误"); + throw new ServiceException("物料条码错误"); } WmsBaseLocation targetLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(targetLocationCode); @@ -302,6 +305,13 @@ public class WmsTransferServiceImpl implements IWmsTransferService { throw new ServiceException("没有此成品的转库出库记录,不能转库入库"); } + WmsProductStock queryProductStock = new WmsProductStock(); + queryProductStock.setLocationCode(targetLocationCode); + List productStocks = wmsProductStockMapper.selectOnlyWmsProductStockInList(queryProductStock); + if(productStocks!=null && !productStocks.isEmpty()){ + throw new ServiceException("此库位已经有库存,不能入库"); + } + Long targetWarehouseId = targetLocation.getWarehouseId(); WmsBaseWarehouse targetWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(targetWarehouseId); @@ -337,6 +347,7 @@ public class WmsTransferServiceImpl implements IWmsTransferService { productStock.setLocationCode(targetLocationCode); productStock.setStockType(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT); productStock.setProductBatch(materialBarcode); + productStock.setPalletInfoCode(mesBaseBarcodeInfo.getPalletInfoCode()); // productStock.setQualityStatus();//todo: 获取质检状态 productStock.setWarehouseFloor(targetWarehouse.getWarehouseFloor()); productStock.setProductId(mesBaseBarcodeInfo.getMaterialId()); diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductStockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductStockMapper.xml index 5605c785..1dd7f780 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductStockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductStockMapper.xml @@ -11,6 +11,7 @@ + @@ -41,6 +42,7 @@ wps.location_code, wps.stock_type, wps.product_batch, + wps.pallet_info_code, wps.quality_status, wps.product_id, mbmi.material_code, @@ -101,6 +103,7 @@ location_code, stock_type, product_batch, + pallet_info_code, quality_status, product_id, plan_code, @@ -122,6 +125,7 @@ #{locationCode}, #{stockType}, #{productBatch}, + #{palletInfoCode}, #{qualityStatus}, #{productId}, #{planCode}, @@ -146,6 +150,7 @@ location_code = #{locationCode}, stock_type = #{stockType}, product_batch = #{productBatch}, + pallet_info_code = #{palletInfoCode}, quality_status = #{qualityStatus}, product_id = #{productId}, plan_code = #{planCode}, @@ -308,7 +313,7 @@ and wps.update_date = #{updateDate} and wps.active_flag = #{activeFlag} and wps.instock_date = #{instockDate} - and wps.totalAmount>0 + and wps.total_amount>0 diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawOutstockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawOutstockMapper.xml index a4e7d2cd..b6cbc6a3 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawOutstockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawOutstockMapper.xml @@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -22,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -74,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select raw_outstock_id, task_code, warehouse_id, location_code, stock_total_id,order_id, plan_code, plan_detail_code, station_id, material_id, material_batch, pallet_info_code, outstock_amount, real_outstock_amount, end_station_code, operation_type, task_type, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time, erp_status, erp_amount from wms_raw_outstock + select raw_outstock_id, task_code, warehouse_id, location_code, stock_total_id,order_id,sale_order_id, plan_code, plan_detail_code, station_id, material_id, material_batch, pallet_info_code, outstock_amount, real_outstock_amount, end_station_code, operation_type, task_type, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time, erp_status, erp_amount from wms_raw_outstock - insert into wms_raw_outstock(raw_outstock_id, task_code,warehouse_id,location_code,stock_total_id,order_id,plan_code,plan_detail_code,station_id,material_id,material_batch,pallet_info_code,outstock_amount,end_station_code,operation_type,task_type,audit_status,execute_status,apply_by,apply_date,apply_reason) values + insert into wms_raw_outstock(raw_outstock_id, task_code,warehouse_id,location_code,stock_total_id,order_id,sale_order_id,plan_code,plan_detail_code,station_id,material_id,material_batch,pallet_info_code,outstock_amount,end_station_code,operation_type,task_type,split_flag,audit_status,execute_status,apply_by,apply_date,apply_reason) values - ( #{item.rawOutstockId}, #{item.taskCode}, #{item.warehouseId}, #{item.locationCode}, #{item.stockTotalId}, #{item.orderId}, #{item.planCode}, #{item.planDetailCode}, #{item.stationId}, #{item.materialId}, #{item.materialBatch}, #{item.palletInfoCode}, #{item.outstockAmount}, #{item.endStationCode}, #{item.operationType}, #{item.taskType}, #{item.auditStatus}, #{item.executeStatus}, #{item.applyBy}, #{item.applyDate}, #{item.applyReason}) + ( #{item.rawOutstockId}, #{item.taskCode}, #{item.warehouseId}, #{item.locationCode}, #{item.stockTotalId}, #{item.orderId},#{item.saleOrderId}, #{item.planCode}, #{item.planDetailCode}, #{item.stationId}, #{item.materialId}, #{item.materialBatch}, #{item.palletInfoCode}, #{item.outstockAmount}, #{item.endStationCode}, #{item.operationType}, #{item.taskType}, #{item.splitFlag},#{item.auditStatus}, #{item.executeStatus}, #{item.applyBy}, #{item.applyDate}, #{item.applyReason}) @@ -331,7 +340,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"