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 37245de..92825b6 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 @@ -75,4 +75,7 @@ public class MesConstants { /** 附件类别;9-其他文件 */ public static final String MES_ATTACH_TYPE_OTHER = "9"; + + /**校验类型(0不校验,1人工校验,2自动校验)*/ + public static final String MES_MATERIAL_BOM_CHECK_TYPE_MANUAL = "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 0c90ab0..0057ec1 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 @@ -70,6 +70,7 @@ public class WmsConstants { public static final String WMS_EXECUTE_STATUS_EXECUTING = "1";//执行中 public static final String WMS_EXECUTE_STATUS_FINISH = "2";//完成执行 + public static final String WMS_EXECUTE_STATUS_CONFIRM = "3";//已确认(适合成品出库在一楼最终确认使用) public static final String WMS_EXECUTE_STATUS_NOT_FINISH = "notFinish";//未完成执行 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 5993462..5dcb156 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,6 +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; @@ -135,7 +136,7 @@ public class MesApiController extends BaseController { /** - * 开始下一生产计划明细(适用于四楼激光切割),开始时生成一条计划明细 + * 开始下一生产计划明细(适用于四楼折弯焊接和五楼),开始时生成一条计划明细 * 传planId */ @Log(title = "生产计划明细", businessType = BusinessType.START) @@ -166,4 +167,13 @@ public class MesApiController extends BaseController { return success(productPlanService.getDrawings(queryProductPlan)); } + + /** + * 扫描确认物料使用(适用于一楼和五楼扫描确认) + */ + @Log(title = "生产计划明细", businessType = BusinessType.CONFIRM) + @PostMapping(("/scanMaterial2Confirm")) + public AjaxResult scanMaterial2Confirm(@RequestBody MesMaterialScanVo mesMaterialScanVo) { + return success(productPlanService.scanMaterial2Confirm(mesMaterialScanVo)); + } } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesMaterialCheckResult.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesMaterialCheckResult.java index eb9559d..71399e5 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesMaterialCheckResult.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesMaterialCheckResult.java @@ -8,7 +8,7 @@ import com.hw.common.core.web.domain.BaseEntity; /** * 生产计划校验记录对象 mes_material_check_result - * + * * @author xins * @date 2024-02-21 */ @@ -39,61 +39,74 @@ public class MesMaterialCheckResult extends BaseEntity @Excel(name = "检验数量") private BigDecimal checkAmount; - public void setMaterialCheckResultId(Long materialCheckResultId) + /** + * 校验类型(0不校验,1人工校验,2自动校验) + */ + private String checkType; + + public void setMaterialCheckResultId(Long materialCheckResultId) { this.materialCheckResultId = materialCheckResultId; } - public Long getMaterialCheckResultId() + public Long getMaterialCheckResultId() { return materialCheckResultId; } - public void setPlanId(Long planId) + public void setPlanId(Long planId) { this.planId = planId; } - public Long getPlanId() + public Long getPlanId() { return planId; } - public void setPlanDetailId(Long planDetailId) + public void setPlanDetailId(Long planDetailId) { this.planDetailId = planDetailId; } - public Long getPlanDetailId() + public Long getPlanDetailId() { return planDetailId; } - public void setMaterialId(Long materialId) + public void setMaterialId(Long materialId) { this.materialId = materialId; } - public Long getMaterialId() + public Long getMaterialId() { return materialId; } - public void setStandardAmount(BigDecimal standardAmount) + public void setStandardAmount(BigDecimal standardAmount) { this.standardAmount = standardAmount; } - public BigDecimal getStandardAmount() + public BigDecimal getStandardAmount() { return standardAmount; } - public void setCheckAmount(BigDecimal checkAmount) + public void setCheckAmount(BigDecimal checkAmount) { this.checkAmount = checkAmount; } - public BigDecimal getCheckAmount() + public BigDecimal getCheckAmount() { return checkAmount; } + public String getCheckType() { + return checkType; + } + + public void setCheckType(String checkType) { + this.checkType = checkType; + } + @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/domain/MesMaterialCheckResultDetail.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesMaterialCheckResultDetail.java new file mode 100644 index 0000000..f03086f --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesMaterialCheckResultDetail.java @@ -0,0 +1,94 @@ +package com.hw.mes.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.hw.common.core.annotation.Excel; +import com.hw.common.core.web.domain.BaseEntity; + +/** + * 生产计划明细校验信息详情对象 mes_material_check_result_detail + * + * @author xins + * @date 2024-04-07 + */ +public class MesMaterialCheckResultDetail extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键标识 */ + private Long checkResultDetailId; + + /** 生产计划明细校验信息ID */ + @Excel(name = "生产计划明细校验信息ID") + private Long materialCheckResultId; + + /** 物料条码 */ + @Excel(name = "物料条码") + private String materialBarcode; + + /** 批次码 */ + @Excel(name = "批次码") + private String batchCode; + + /** 检验数量 */ + @Excel(name = "检验数量") + private BigDecimal checkAmount; + + public void setCheckResultDetailId(Long checkResultDetailId) + { + this.checkResultDetailId = checkResultDetailId; + } + + public Long getCheckResultDetailId() + { + return checkResultDetailId; + } + public void setMaterialCheckResultId(Long materialCheckResultId) + { + this.materialCheckResultId = materialCheckResultId; + } + + public Long getMaterialCheckResultId() + { + return materialCheckResultId; + } + public void setMaterialBarcode(String materialBarcode) + { + this.materialBarcode = materialBarcode; + } + + public String getMaterialBarcode() + { + return materialBarcode; + } + public void setBatchCode(String batchCode) + { + this.batchCode = batchCode; + } + + public String getBatchCode() + { + return batchCode; + } + public void setCheckAmount(BigDecimal checkAmount) + { + this.checkAmount = checkAmount; + } + + public BigDecimal getCheckAmount() + { + return checkAmount; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("checkResultDetailId", getCheckResultDetailId()) + .append("materialCheckResultId", getMaterialCheckResultId()) + .append("materialBarcode", getMaterialBarcode()) + .append("batchCode", getBatchCode()) + .append("checkAmount", getCheckAmount()) + .toString(); + } +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/vo/MesMaterialScanVo.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/vo/MesMaterialScanVo.java new file mode 100644 index 0000000..56dc83c --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/vo/MesMaterialScanVo.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: MesMaterialScanVo + * @Author : xins + * @Date :2024-04-07 10:17 + * @Version :1.0 + */ +@Data +public class MesMaterialScanVo { + + //生产计划ID + @NotNull(message = "生产计划ID必须输入") + private Long planId; + + //生产计划明细ID + @NotNull(message = "生产计划明细ID必须输入") + private Long planDetailId; + + + //物料条码 + @NotBlank(message = "物料条码必须输入") + private String materialBarcode; + + //数量 + @NotNull(message = "数量必须输入") + private BigDecimal checkAmount; +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesMaterialCheckResultDetailMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesMaterialCheckResultDetailMapper.java new file mode 100644 index 0000000..bcc511d --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesMaterialCheckResultDetailMapper.java @@ -0,0 +1,61 @@ +package com.hw.mes.mapper; + +import java.util.List; +import com.hw.mes.domain.MesMaterialCheckResultDetail; + +/** + * 生产计划明细校验信息详情Mapper接口 + * + * @author xins + * @date 2024-04-07 + */ +public interface MesMaterialCheckResultDetailMapper +{ + /** + * 查询生产计划明细校验信息详情 + * + * @param checkResultDetailId 生产计划明细校验信息详情主键 + * @return 生产计划明细校验信息详情 + */ + public MesMaterialCheckResultDetail selectMesMaterialCheckResultDetailByCheckResultDetailId(Long checkResultDetailId); + + /** + * 查询生产计划明细校验信息详情列表 + * + * @param mesMaterialCheckResultDetail 生产计划明细校验信息详情 + * @return 生产计划明细校验信息详情集合 + */ + public List selectMesMaterialCheckResultDetailList(MesMaterialCheckResultDetail mesMaterialCheckResultDetail); + + /** + * 新增生产计划明细校验信息详情 + * + * @param mesMaterialCheckResultDetail 生产计划明细校验信息详情 + * @return 结果 + */ + public int insertMesMaterialCheckResultDetail(MesMaterialCheckResultDetail mesMaterialCheckResultDetail); + + /** + * 修改生产计划明细校验信息详情 + * + * @param mesMaterialCheckResultDetail 生产计划明细校验信息详情 + * @return 结果 + */ + public int updateMesMaterialCheckResultDetail(MesMaterialCheckResultDetail mesMaterialCheckResultDetail); + + /** + * 删除生产计划明细校验信息详情 + * + * @param checkResultDetailId 生产计划明细校验信息详情主键 + * @return 结果 + */ + public int deleteMesMaterialCheckResultDetailByCheckResultDetailId(Long checkResultDetailId); + + /** + * 批量删除生产计划明细校验信息详情 + * + * @param checkResultDetailIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMesMaterialCheckResultDetailByCheckResultDetailIds(Long[] checkResultDetailIds); +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesMaterialCheckResultMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesMaterialCheckResultMapper.java index be7ce64..23d0d21 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesMaterialCheckResultMapper.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesMaterialCheckResultMapper.java @@ -1,19 +1,20 @@ package com.hw.mes.mapper; import java.util.List; + import com.hw.mes.domain.MesMaterialCheckResult; +import org.apache.ibatis.annotations.Param; /** * 生产计划校验记录Mapper接口 - * + * * @author xins * @date 2024-02-21 */ -public interface MesMaterialCheckResultMapper -{ +public interface MesMaterialCheckResultMapper { /** * 查询生产计划校验记录 - * + * * @param materialCheckResultId 生产计划校验记录主键 * @return 生产计划校验记录 */ @@ -21,7 +22,7 @@ public interface MesMaterialCheckResultMapper /** * 查询生产计划校验记录列表 - * + * * @param mesMaterialCheckResult 生产计划校验记录 * @return 生产计划校验记录集合 */ @@ -29,7 +30,7 @@ public interface MesMaterialCheckResultMapper /** * 新增生产计划校验记录 - * + * * @param mesMaterialCheckResult 生产计划校验记录 * @return 结果 */ @@ -37,7 +38,7 @@ public interface MesMaterialCheckResultMapper /** * 修改生产计划校验记录 - * + * * @param mesMaterialCheckResult 生产计划校验记录 * @return 结果 */ @@ -45,7 +46,7 @@ public interface MesMaterialCheckResultMapper /** * 删除生产计划校验记录 - * + * * @param materialCheckResultId 生产计划校验记录主键 * @return 结果 */ @@ -53,9 +54,35 @@ public interface MesMaterialCheckResultMapper /** * 批量删除生产计划校验记录 - * + * * @param materialCheckResultIds 需要删除的数据主键集合 * @return 结果 */ public int deleteMesMaterialCheckResultByMaterialCheckResultIds(Long[] materialCheckResultIds); + + /** + * 根据唯一索引查询生产计划校验记录 + * + * @param planId + * @param planDetailId + * @param materialId + * @return + */ + public MesMaterialCheckResult selectMesMaterialCheckResultByUI(@Param("planId") Long planId, + @Param("planDetailId") Long planDetailId, + @Param("materialId") Long materialId); + + + /** + * 查询生产计划校验记录列表 + * @param planId + * @param planDetailId + * @param ancestors + * @return + */ + public List selectMesMaterialCheckResult(@Param("planId") Long planId, + @Param("planDetailId") Long planDetailId, + @Param("ancestors") String ancestors); + + } 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 90278fb..f24ce67 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,8 @@ 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.MesMaterialScanVo; +import org.springframework.transaction.annotation.Transactional; /** * 生产派工Service接口 @@ -111,4 +113,12 @@ public interface IMesProductPlanService */ public List getDrawings(MesProductPlan mesProductPlan); + + /** + * 在生产时校验物料使用 + * + * @param mesMaterialScanVo + * @return + */ + public int scanMaterial2Confirm(MesMaterialScanVo mesMaterialScanVo); } 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 eb36946..f315d3b 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 @@ -5,9 +5,12 @@ import com.hw.common.core.exception.ServiceException; import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.uuid.Seq; import com.hw.common.security.utils.SecurityUtils; +import com.hw.mes.domain.MesMaterialCheckResult; import com.hw.mes.domain.MesProductPlan; import com.hw.mes.domain.MesProductPlanDetail; import com.hw.mes.domain.vo.MesProductPlanDetailVo; +import com.hw.mes.mapper.MesMaterialBomMapper; +import com.hw.mes.mapper.MesMaterialCheckResultMapper; import com.hw.mes.mapper.MesProductPlanDetailMapper; import com.hw.mes.mapper.MesProductPlanMapper; import com.hw.mes.service.IMesProductPlanDetailService; @@ -19,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * 生产计划明细Service业务层处理 @@ -34,6 +38,9 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer @Autowired private MesProductPlanMapper mesProductPlanMapper; + @Autowired + private MesMaterialCheckResultMapper mesMaterialCheckResultMapper; + /** * 查询生产计划明细 * @@ -199,7 +206,9 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer @Override @Transactional(rollbackFor = Exception.class) public int completeMesProductPlanDetail(MesProductPlanDetail mesProductPlanDetail) { - MesProductPlanDetail dbProductPlanDetail = mesProductPlanDetailMapper.selectMesProductPlanDetailByPlanDetailId(mesProductPlanDetail.getPlanDetailId()); + Long planDetailId = mesProductPlanDetail.getPlanDetailId(); + MesProductPlanDetail dbProductPlanDetail = mesProductPlanDetailMapper. + selectMesProductPlanDetailByPlanDetailId(planDetailId); String planDetailStatus = dbProductPlanDetail.getPlanDetailStatus(); if (planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_TO_START)) { throw new ServiceException("此生产计划明细未开始"); @@ -207,7 +216,8 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer throw new ServiceException("此生产计划明细已结束"); } - MesProductPlan dbProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(dbProductPlanDetail.getPlanId()); + 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("此生产计划未派工,不能结束"); @@ -215,7 +225,19 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer throw new ServiceException("此生产计划已结束"); } - //todo:校验生产计划明细校验信息, 更新生产工单状态、结束时间和完成数量(需要获取所有生产计划,顺序工单是否都已完成等) + //校验生产计划明细校验信息(如果是多个工序只校验最后一个工序,一楼和四楼都是一个工序,暂时不校验最后一个工序), + List checkResults = + mesMaterialCheckResultMapper.selectMesMaterialCheckResult(planId, planDetailId, "0," + dbProductPlan.getMaterialBomId()); + List filterCheckResults = checkResults.stream().filter( + materialCheckResult -> (materialCheckResult.getCheckAmount() == null || + !materialCheckResult.getCheckAmount().equals(materialCheckResult.getStandardAmount())) + && materialCheckResult.getCheckType().equals(MesConstants.MES_MATERIAL_BOM_CHECK_TYPE_MANUAL)) + .collect(Collectors.toList()); + String updatePlanDetailStatus = MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_FINISH; + if (filterCheckResults != null && !filterCheckResults.isEmpty()) { + updatePlanDetailStatus = MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_ABNORMAL_FINISH; + } + Date currentDate = new Date(); String userName = SecurityUtils.getUsername(); BigDecimal planAmount = null; @@ -233,6 +255,9 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer if (newComplementAmount.compareTo(planAmount) >= 0) { dbProductPlan.setPlanStatus(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH); dbProductPlan.setRealEndTime(currentDate); + + + //todo:更新生产工单状态、结束时间和完成数量(根据finalprocessFlag更新生产工单) } dbProductPlan.setCompleteAmount(newComplementAmount); dbProductPlan.setUpdateTime(currentDate); @@ -241,7 +266,7 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer mesProductPlanDetail.setUpdateTime(currentDate); mesProductPlanDetail.setUpdateBy(userName); - mesProductPlanDetail.setPlanDetailStatus(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_FINISH); + mesProductPlanDetail.setPlanDetailStatus(updatePlanDetailStatus); mesProductPlanDetail.setRealEndTime(currentDate); return mesProductPlanDetailMapper.updateMesProductPlanDetail(mesProductPlanDetail); } 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 e334762..588d708 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 @@ -1,6 +1,8 @@ package com.hw.mes.service.impl; +import java.math.BigDecimal; import java.util.Arrays; +import java.util.Date; import java.util.List; import com.hw.common.core.constant.MesConstants; @@ -8,10 +10,10 @@ import com.hw.common.core.exception.ServiceException; import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.uuid.Seq; import com.hw.common.security.utils.SecurityUtils; -import com.hw.mes.domain.MesBaseAttachInfo; -import com.hw.mes.domain.MesProductOrder; -import com.hw.mes.mapper.MesBaseAttachInfoMapper; -import com.hw.mes.mapper.MesProductPlanDetailMapper; +import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import com.hw.mes.domain.*; +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; @@ -21,9 +23,6 @@ import java.util.ArrayList; import com.hw.common.core.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; -import com.hw.mes.domain.MesProductPlanDetail; -import com.hw.mes.mapper.MesProductPlanMapper; -import com.hw.mes.domain.MesProductPlan; import com.hw.mes.service.IMesProductPlanService; /** @@ -49,6 +48,15 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService { @Autowired private MesProductPlanDetailMapper productPlanDetailMapper; + @Autowired + private MesMaterialCheckResultMapper mesMaterialCheckResultMapper; + + @Autowired + private MesMaterialCheckResultDetailMapper mesMaterialCheckResultDetailMapper; + + @Autowired + private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper; + /** * 查询生产派工 * @@ -286,4 +294,74 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService { return null; } + + /** + * 在生产时校验物料使用 + * + * @param mesMaterialScanVo + * @return + */ + @Transactional + @Override + public int scanMaterial2Confirm(MesMaterialScanVo mesMaterialScanVo) { + Long planId = mesMaterialScanVo.getPlanId(); + Long planDetailId = mesMaterialScanVo.getPlanDetailId(); + BigDecimal checkAmount = mesMaterialScanVo.getCheckAmount(); + String materialBarcode = mesMaterialScanVo.getMaterialBarcode(); + if (checkAmount.compareTo(BigDecimal.ZERO) <= 0) { + throw new ServiceException("数量需大于0"); + } + + MesMaterialCheckResultDetail queryCheckResultDetail = new MesMaterialCheckResultDetail(); + queryCheckResultDetail.setMaterialBarcode(materialBarcode); + List checkResultDetailList = mesMaterialCheckResultDetailMapper.selectMesMaterialCheckResultDetailList(queryCheckResultDetail); + if (checkResultDetailList != null && !checkResultDetailList.isEmpty()) { + throw new ServiceException("此物料已经验证过,无需重复验证"); + } + + MesBaseBarcodeInfo baseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode); + if (baseBarcodeInfo == null) { + throw new ServiceException("物料条码有误"); + } + Long materialId = baseBarcodeInfo.getMaterialId(); + String batchFlag = baseBarcodeInfo.getBatchFlag(); + String batchCode = baseBarcodeInfo.getBatchCode(); + if (!batchFlag.equals(MesConstants.IS_BATCH)) { + if (checkAmount.compareTo(BigDecimal.ONE) != 0) { + throw new ServiceException("数量需等于1"); + } + } + + String userName = SecurityUtils.getUsername(); + Date currentDate = new Date(); + MesMaterialCheckResult mesMaterialCheckResult = mesMaterialCheckResultMapper. + selectMesMaterialCheckResultByUI(planId, planDetailId, materialId); + if (mesMaterialCheckResult == null) { + mesMaterialCheckResult = new MesMaterialCheckResult(); + mesMaterialCheckResult.setPlanId(planId); + mesMaterialCheckResult.setPlanDetailId(planDetailId); + mesMaterialCheckResult.setMaterialId(materialId); + mesMaterialCheckResult.setCheckAmount(checkAmount); + mesMaterialCheckResult.setUpdateBy(userName); + mesMaterialCheckResult.setUpdateTime(currentDate); + mesMaterialCheckResultMapper.insertMesMaterialCheckResult(mesMaterialCheckResult); + } else { + mesMaterialCheckResult.setCheckAmount(mesMaterialCheckResult.getCheckAmount() + .add(checkAmount)); + mesMaterialCheckResult.setUpdateBy(userName); + mesMaterialCheckResult.setUpdateTime(currentDate); + mesMaterialCheckResultMapper.updateMesMaterialCheckResult(mesMaterialCheckResult); + } + + MesMaterialCheckResultDetail mesMaterialCheckResultDetail = new MesMaterialCheckResultDetail(); + mesMaterialCheckResultDetail.setMaterialCheckResultId(mesMaterialCheckResult.getMaterialCheckResultId()); + mesMaterialCheckResultDetail.setMaterialBarcode(materialBarcode); + mesMaterialCheckResultDetail.setBatchCode(batchCode); + mesMaterialCheckResultDetail.setCheckAmount(checkAmount); + mesMaterialCheckResultDetailMapper.insertMesMaterialCheckResultDetail(mesMaterialCheckResultDetail); + + return 1; + + + } } 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 408dfb3..57173ac 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 @@ -14,6 +14,7 @@ + @@ -47,6 +48,7 @@ bbi.barcode_info, bbi.batch_code, bbi.pallet_info_code, + bbi.bind_barcode, bbi.material_id, bmi.material_name, bbi.manufacturer_id, @@ -235,4 +237,4 @@ where bbi.barcode_info = #{barcodeInfo} limit 1 - \ No newline at end of file + diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesMaterialCheckResultDetailMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesMaterialCheckResultDetailMapper.xml new file mode 100644 index 0000000..3acb5af --- /dev/null +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesMaterialCheckResultDetailMapper.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + select check_result_detail_id, material_check_result_id, material_barcode, batch_code, check_amount from mes_material_check_result_detail + + + + + + + + insert into mes_material_check_result_detail + + material_check_result_id, + material_barcode, + batch_code, + check_amount, + + + #{materialCheckResultId}, + #{materialBarcode}, + #{batchCode}, + #{checkAmount}, + + + + + update mes_material_check_result_detail + + material_check_result_id = #{materialCheckResultId}, + material_barcode = #{materialBarcode}, + batch_code = #{batchCode}, + check_amount = #{checkAmount}, + + where check_result_detail_id = #{checkResultDetailId} + + + + delete from mes_material_check_result_detail where check_result_detail_id = #{checkResultDetailId} + + + + delete from mes_material_check_result_detail where check_result_detail_id in + + #{checkResultDetailId} + + + diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesMaterialCheckResultMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesMaterialCheckResultMapper.xml index aa18f14..833f913 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesMaterialCheckResultMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesMaterialCheckResultMapper.xml @@ -13,6 +13,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -81,4 +83,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{materialCheckResultId} + + + + + + + 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 50dbfd2..8e3e4d5 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 @@ -24,6 +24,17 @@ public class WmsConfig */ private Long fifthSemiWarehouseId; + /** + * 一楼成品仓库ID + */ + private Long firstFloorProductWarehouseId; + + /** + * 四楼成品仓库ID + */ + private Long fourthFloorProductWarehouseId; + + public String getFifthAssembleStationCode() { return fifthAssembleStationCode; } @@ -39,4 +50,20 @@ public class WmsConfig public void setFifthSemiWarehouseId(Long fifthSemiWarehouseId) { this.fifthSemiWarehouseId = fifthSemiWarehouseId; } + + public Long getFirstFloorProductWarehouseId() { + return firstFloorProductWarehouseId; + } + + public void setFirstFloorProductWarehouseId(Long firstFloorProductWarehouseId) { + this.firstFloorProductWarehouseId = firstFloorProductWarehouseId; + } + + public Long getFourthFloorProductWarehouseId() { + return fourthFloorProductWarehouseId; + } + + public void setFourthFloorProductWarehouseId(Long fourthFloorProductWarehouseId) { + this.fourthFloorProductWarehouseId = fourthFloorProductWarehouseId; + } } 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 45524e2..5c123b8 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 @@ -39,6 +39,9 @@ public class WmsApiController extends BaseController { @Autowired private IWmsStockTotalService wmsStockTotalService; + @Autowired + private IWmsProductInstockService wmsProductInstockService; + /** * 根据工位查询查询仓库列表 @@ -107,4 +110,24 @@ public class WmsApiController extends BaseController { return toAjax(wmsRawOutstockService.directRawOutstock(wmsRawOutstock)); } + /** + * 新增成品入库记录(适合于一楼生产完成品入虚拟库,没有库位) + */ +// @RequiresPermissions("wms:mobile:addrawinstock") + @Log(title = "成品入库记录", businessType = BusinessType.INSERT) + @PostMapping(("/firstFloorProduceInstock")) + public AjaxResult firstFloorProduceInstock(@Validated @RequestBody WmsProduceInstockVo wmsProduceInstockVo) { + return toAjax(wmsProductInstockService.firstFloorProduceInstock(wmsProduceInstockVo)); + } + + /** + * 新增成品入库记录(适合于四楼生产完成品入虚拟库,没有库位) + */ +// @RequiresPermissions("wms:mobile:addrawinstock") + @Log(title = "成品入库记录", businessType = BusinessType.INSERT) + @PostMapping(("/fourthFloorProduceInstock")) + public AjaxResult fourthFloorProduceInstock(@Validated @RequestBody WmsProduceInstockVo wmsProduceInstockVo) { + return toAjax(wmsProductInstockService.fourthFloorProduceInstock(wmsProduceInstockVo)); + } + } 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 3b1a935..44bd1e1 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 @@ -224,7 +224,7 @@ public class WmsMobileController extends BaseController { /** - * 人工成品入库 + * 人工成品入库(适用于5楼成品入库) */ @Log(title = "成品入库记录", businessType = BusinessType.INSERT) @PostMapping(("/addProductInstock")) @@ -387,8 +387,8 @@ public class WmsMobileController extends BaseController { @Log(title = "成品出库确认", businessType = BusinessType.UPDATE) @PostMapping(("/finalConfirmProductOutstock")) public AjaxResult finalConfirmProductOutstock(@RequestBody @Validated WmsProductOutstockConfirmVo wmsProductOutstockConfirmVo) { - wmsProductOutstockService.finalConfirmProductOutstock(wmsProductOutstockConfirmVo); - return toAjax(1); + + return toAjax(wmsProductOutstockService.finalConfirmProductOutstock(wmsProductOutstockConfirmVo)); } @@ -407,8 +407,8 @@ public class WmsMobileController extends BaseController { */ @Log(title = "生产入库", businessType = BusinessType.INSERT) @PostMapping(("/produceInstock")) - public AjaxResult produceInstock(@Validated @RequestBody WmsProduceInstockVo wmsProduceInstockVo) { - return toAjax(wmsProductInstockService.produceInstock(wmsProduceInstockVo)); + public AjaxResult fifthFloorProduceInstock(@Validated @RequestBody WmsProduceInstockVo wmsProduceInstockVo) { + return toAjax(wmsProductInstockService.fifthFloorProduceInstock(wmsProduceInstockVo)); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsInventoryCheck.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsInventoryCheck.java index 3db88b6..82f8faf 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsInventoryCheck.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsInventoryCheck.java @@ -68,6 +68,8 @@ public class WmsInventoryCheck extends BaseEntity /** 盘点记录明细;盘点记录对应的明细信息信息 */ private List wmsInventoryCheckDetailList; + private String warehouseName; + public void setInventoryCheckId(Long inventoryCheckId) { this.inventoryCheckId = inventoryCheckId; @@ -176,6 +178,14 @@ public class WmsInventoryCheck extends BaseEntity this.wmsInventoryCheckDetailList = wmsInventoryCheckDetailList; } + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java index 49f7532..6a311f9 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java @@ -19,142 +19,122 @@ import com.hw.common.core.web.domain.BaseEntity; public class WmsProductOutstock extends BaseEntity { private static final long serialVersionUID = 1L; - /** - * 成品出库记录ID - */ + /** 成品出库记录ID */ private Long productOutstockId; - /** - * 任务编号;移库时必须 - */ - @Excel(name = "任务编号;移库时必须") + /** 任务编号 */ + @Excel(name = "任务编号") private String taskCode; - /** - * 仓库ID;领料时需要保存 - */ + /** 仓库ID;领料时需要保存 */ @Excel(name = "仓库ID;领料时需要保存") private Long warehouseId; - /** - * 库位编码;移库时需要保存 - */ - @Excel(name = "库位编码;移库时需要保存") + /** 库位编码 */ + @Excel(name = "库位编码") private String locationCode; - /** - * 成品类型(2半成品,3成品) - */ + /** 成品类型(2半成品,3成品) */ + @Excel(name = "成品类型", readConverterExp = "2=半成品,3成品") private String productType; - /** - * 操作类型(0自动,1手动,2强制,3调度) - */ - @Excel(name = "操作类型(0自动,1手动,2强制,3调度)") + /** 操作类型(0自动,1人工,2强制,3调度) */ + @Excel(name = "操作类型(0自动,1人工,2强制,3调度)") private String operationType; - /** - * 出库类型(1销售出库 9其他出库) - */ + /** 出库类型(1销售出库 9其他出库) */ @Excel(name = "出库类型(1销售出库 9其他出库)") private String outstockType; - /** - * 计划编号,关联pd_base_plan_info的plan_id - */ + /** 计划编号,关联pd_base_plan_info的plan_code */ @Excel(name = "计划编号,关联pd_base_plan_info的plan_code") private String planCode; - /** - * 计划明细ID,关联pd_base_plan_detail的plan_detail_id - */ + /** 计划明细编号,关联pd_base_plan_detail的plan_detail_code */ @Excel(name = "计划明细编号,关联pd_base_plan_detail的plan_detail_code") private String planDetailCode; + /** 销售订单ID主键 */ + @Excel(name = "销售订单ID主键") private Long saleOrderId; + + /** 销售订单编号 */ + @Excel(name = "销售订单编号") private String saleorderCode; + /** 项目号 */ + @Excel(name = "项目号") private String projectNo; - + /** 成品ID,关联物料信息主键 */ + @Excel(name = "成品ID,关联物料信息主键") private Long productId; - /** - * 申请数量 - * */ + /** 成品批次 */ + @Excel(name = "成品批次") + private String productBatch; + + /** 托盘RFID代码 */ + @Excel(name = "托盘RFID代码") + private String palletInfoCode; + + /** 出库目的地 */ + @Excel(name = "出库目的地") + private String endStationCode; + + /** 申请数量 */ + @Excel(name = "申请数量") private BigDecimal applyQty; - /** - * 已出库数量 - * */ + /** 已出数量 */ + @Excel(name = "已出数量") private BigDecimal outstockQty; - /** - * 申请原因 - */ + + /** 申请原因 */ @Excel(name = "申请原因") private String applyReason; - /** - * 审核原因 - */ + /** 审核原因 */ @Excel(name = "审核原因") private String auditReason; - /** - * 审核状态(0待审核,1审核通过,2审核未通过) - */ + /** 审核状态(0待审核,1审核通过,2审核未通过) */ @Excel(name = "审核状态(0待审核,1审核通过,2审核未通过)") private String auditStatus; - /** - * 执行状态(0待执行,1执行中,2执行完成) - */ + /** 执行状态(0待执行,1执行中,2执行完成) */ @Excel(name = "执行状态(0待执行,1执行中,2执行完成)") private String executeStatus; - /** - * 申请人 - */ + /** 申请人 */ @Excel(name = "申请人") private String applyBy; - /** - * 申请时间 - */ + /** 申请时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd") private Date applyDate; - /** - * 审核人 - */ + /** 审核人 */ @Excel(name = "审核人") private String auditBy; - /** - * 审核时间 - */ + /** 审核时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd") private Date auditDate; - /** - * 最后更新时间 - */ + /** 最后更新时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd") private Date updateDate; - /** - * 执行开始时间 - */ + /** 执行开始时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "执行开始时间", width = 30, dateFormat = "yyyy-MM-dd") private Date beginTime; - /** - * 执行结束时间 - */ + /** 执行结束时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "执行结束时间", width = 30, dateFormat = "yyyy-MM-dd") private Date endTime; @@ -405,6 +385,30 @@ public class WmsProductOutstock extends BaseEntity { this.erpAmount = erpAmount; } + public String getProductBatch() { + return productBatch; + } + + public void setProductBatch(String productBatch) { + this.productBatch = productBatch; + } + + public String getPalletInfoCode() { + return palletInfoCode; + } + + public void setPalletInfoCode(String palletInfoCode) { + this.palletInfoCode = palletInfoCode; + } + + public String getEndStationCode() { + return endStationCode; + } + + public void setEndStationCode(String endStationCode) { + this.endStationCode = endStationCode; + } + public List getWmsProductOutstockDetailList() { return wmsProductOutstockDetailList; } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockDetailMapper.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockDetailMapper.java index dc460e3..09a5969 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockDetailMapper.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockDetailMapper.java @@ -5,15 +5,15 @@ import com.hw.wms.domain.WmsProductOutstockDetail; /** * 成品出库记录明细Mapper接口 - * + * * @author xins * @date 2024-01-16 */ -public interface WmsProductOutstockDetailMapper +public interface WmsProductOutstockDetailMapper { /** * 查询成品出库记录明细 - * + * * @param productOutstockDetailId 成品出库记录明细主键 * @return 成品出库记录明细 */ @@ -21,7 +21,7 @@ public interface WmsProductOutstockDetailMapper /** * 查询成品出库记录明细列表 - * + * * @param wmsProductOutstockDetail 成品出库记录明细 * @return 成品出库记录明细集合 */ @@ -29,7 +29,7 @@ public interface WmsProductOutstockDetailMapper /** * 新增成品出库记录明细 - * + * * @param wmsProductOutstockDetail 成品出库记录明细 * @return 结果 */ @@ -37,7 +37,7 @@ public interface WmsProductOutstockDetailMapper /** * 修改成品出库记录明细 - * + * * @param wmsProductOutstockDetail 成品出库记录明细 * @return 结果 */ @@ -45,7 +45,7 @@ public interface WmsProductOutstockDetailMapper /** * 删除成品出库记录明细 - * + * * @param productOutstockDetailId 成品出库记录明细主键 * @return 结果 */ @@ -53,9 +53,21 @@ public interface WmsProductOutstockDetailMapper /** * 批量删除成品出库记录明细 - * + * * @param productOutstockDetailIds 需要删除的数据主键集合 * @return 结果 */ public int deleteWmsProductOutstockDetailByProductOutstockDetailIds(Long[] productOutstockDetailIds); + + + + + /** + * 查询成品出库记录明细 + * + * @param productBarcode 成品条码 + * @return 成品出库记录明细 + */ + public WmsProductOutstockDetail selectWmsProductOutstockDetailByProductBarcode(String productBarcode); + } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductInstockService.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductInstockService.java index 3752aec..421fcab 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductInstockService.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductInstockService.java @@ -1,6 +1,8 @@ package com.hw.wms.service; import java.util.List; + +import com.hw.common.core.constant.WmsConstants; import com.hw.wms.domain.WmsProductInstock; import com.hw.wms.domain.vo.WmsProduceInstockVo; import com.hw.wms.domain.vo.WmsProductInstockVo; @@ -12,8 +14,7 @@ import org.springframework.transaction.annotation.Transactional; * @author xins * @date 2023-12-25 */ -public interface IWmsProductInstockService -{ +public interface IWmsProductInstockService { /** * 查询成品入库记录;成品入库记录 * @@ -71,10 +72,30 @@ public interface IWmsProductInstockService */ public int insertWmsProductInstock(WmsProductInstockVo wmsProductInstockVo); + + /** * 生产入库,适合在五楼背板安装区(将组装好的柜体入到半成品库) + * + * @param wmsProduceInstockVo + * @return + */ + public int fifthFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo); + + /** + * 新增成品入库记录(适用于Web端,适用于1楼成品入库,入虚拟库,无库位) + * + * @param wmsProduceInstockVo + * @return + */ + public int firstFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo); + + + /** + * 新增成品入库记录(适用于Web端,适用于4楼成品入库,入虚拟库,无库位) + * * @param wmsProduceInstockVo * @return */ - public int produceInstock(WmsProduceInstockVo wmsProduceInstockVo); + public int fourthFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsMoveServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsMoveServiceImpl.java index ba3cf52..6cf19ec 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsMoveServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsMoveServiceImpl.java @@ -231,12 +231,19 @@ public class WmsMoveServiceImpl implements IWmsMoveService { throw new ServiceException("原库位有占用库存信息,不能进行移库"); } - //目标库位需要是空库位 + WmsRawStock queryTargetRawStock = new WmsRawStock(); queryTargetRawStock.setLocationCode(targetLocationCode); List targetRawStocks = wmsRawStockMapper.selectWmsRawStockInList(queryTargetRawStock); - if (targetRawStocks != null && !targetRawStocks.isEmpty()) { - throw new ServiceException("目标库位有库存,不能进行移库"); + //移库时(movetype为1时)目标库位需要是空库位,合库时(movetype为2时)目标库位需要是非空库位 + if (wmsMoveApplyVo.getMoveType().equals(WmsConstants.WMS_MOVEMERGE_TYPE_MOVE)) { + if (targetRawStocks != null && !targetRawStocks.isEmpty()) { + throw new ServiceException("目标库位有库存,不能进行移库"); + } + } else { + if (targetRawStocks == null || targetRawStocks.isEmpty()) { + throw new ServiceException("目标库位无库存,不能进行合库"); + } } toInsertedMoves = getMovesByRawStocks(wmsRawStocks, wmsMoveApplyVo, userName, currentDate); diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductInstockServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductInstockServiceImpl.java index dc590bd..5f40fbc 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductInstockServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductInstockServiceImpl.java @@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.stream.Collectors; import com.hw.common.core.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; @@ -157,7 +158,7 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { /** - * 新增成品入库记录(适用于移动手持端) + * 新增成品入库记录(适用于移动手持端,适用于5楼成品入库) * * @param wmsProductInstockVo 原材料入库记录 * @return 结果 @@ -181,7 +182,7 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { //todo 仓库可存储此物料判断是否可以入此库位 Date currentDate = new Date(); - String userName = SecurityUtils.getUsername();//todo 是否改成nickname + String userName = SecurityUtils.getUsername(); WmsProductInstock wmsProductInstock = new WmsProductInstock(); wmsProductInstock.setWarehouseId(baseLocation.getWarehouseId()); wmsProductInstock.setLocationCode(locationCode); @@ -190,8 +191,11 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { wmsProductInstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH); wmsProductInstock.setPlanCode(baseBarcodeInfo.getPlanCode()); wmsProductInstock.setPlanDetailCode(baseBarcodeInfo.getPlanDetailCode()); + wmsProductInstock.setProductBatch(materialBarcode); + wmsProductInstock.setProductId(productId); wmsProductInstock.setInstockType(WmsConstants.PRODUCT_INSTOCK_INSTOCK_TYPE_PRODUCT); wmsProductInstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS); + wmsProductInstock.setInstockAmount(BigDecimal.ONE); wmsProductInstock.setApplyBy(userName); wmsProductInstock.setApplyDate(currentDate); @@ -199,15 +203,15 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { int rows = wmsProductInstockMapper.insertWmsProductInstock(wmsProductInstock); //插入明细 - insertWmsProductInstockDetail(wmsProductInstock, materialBarcode, productId, wmsProductInstockVo); +// insertWmsProductInstockDetail(wmsProductInstock, materialBarcode, productId, wmsProductInstockVo); //更新库存 - updateProductStock(wmsProductInstock, baseBarcodeInfo, baseLocation, - materialBarcode, productId, userName, currentDate); + updateProductStock(baseBarcodeInfo, locationCode, baseLocation.getWarehouseId(), baseLocation.getWarehouseFloor(), userName, currentDate); return rows; } + /** * 插入成品入库明细,手持成品入库使用。适用于4楼成品入库 * @@ -233,38 +237,45 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { /** - * 更新成品库存 + * 更新成品库存,适合于五楼PDA扫描成品入库 * - * @param wmsProductInstock - * @param baseLocation - * @param productBatch - * @param productId + * @param baseBarcodeInfo + * @param locationCode + * @param warehouseId + * @param warehouseFloor * @param userName * @param currentDate */ - public void updateProductStock(WmsProductInstock wmsProductInstock, MesBaseBarcodeInfo baseBarcodeInfo, WmsBaseLocation baseLocation, - String productBatch, Long productId, String userName, Date currentDate) { - String locationCode = wmsProductInstock.getLocationCode(); + public void updateProductStock(MesBaseBarcodeInfo baseBarcodeInfo, String locationCode, Long warehouseId, Long warehouseFloor, + String userName, Date currentDate) { + BigDecimal instockAmount = new BigDecimal(1); //判断此库位的数量限制,是否还能入库 +// WmsProductStock queryProductStock = new WmsProductStock(); +// queryProductStock.setLocationCode(locationCode); +// BigDecimal totalAmount = wmsProductStockMapper.getProductStockTotalAmount(queryProductStock); +// totalAmount = totalAmount == null ? BigDecimal.ZERO : totalAmount; +// if (totalAmount.add(instockAmount).compareTo(baseLocation.getQtyLimit()) > 0) { +// throw new ServiceException("已超出库位数量限制,请重新选择库位"); +// } + String materialBarcode = baseBarcodeInfo.getBarcodeInfo(); WmsProductStock queryProductStock = new WmsProductStock(); - queryProductStock.setLocationCode(locationCode); - BigDecimal totalAmount = wmsProductStockMapper.getProductStockTotalAmount(queryProductStock); - totalAmount = totalAmount == null ? BigDecimal.ZERO : totalAmount; - if (totalAmount.add(instockAmount).compareTo(baseLocation.getQtyLimit()) > 0) { - throw new ServiceException("已超出库位数量限制,请重新选择库位"); + queryProductStock.setProductBatch(materialBarcode); + WmsProductStock productStock = wmsProductStockMapper.selectProductStockByBatch(materialBarcode); + if (productStock != null) { + throw new ServiceException("此成品已经入库,无需重复入库"); } //一个成品一个条码,对应一条库存信息 WmsProductStock wmsProductStock = new WmsProductStock(); - wmsProductStock.setWarehouseId(wmsProductInstock.getWarehouseId()); + wmsProductStock.setWarehouseId(warehouseId); wmsProductStock.setLocationCode(locationCode); wmsProductStock.setStockType(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT); - wmsProductStock.setProductId(productId); - wmsProductStock.setProductBatch(productBatch); + wmsProductStock.setProductId(baseBarcodeInfo.getMaterialId()); + wmsProductStock.setProductBatch(materialBarcode); wmsProductStock.setPlanCode(baseBarcodeInfo.getPlanCode()); wmsProductStock.setPlanDetailCode(baseBarcodeInfo.getPlanDetailCode()); - wmsProductStock.setWarehouseFloor(baseLocation.getWarehouseFloor()); + wmsProductStock.setWarehouseFloor(warehouseFloor); wmsProductStock.setSaleorderCode(baseBarcodeInfo.getSaleorderCode()); // wmsProductStock.setQualityStatus(wmsRawInstockVo.getQualityStatus()); wmsProductStock.setTotalAmount(instockAmount); @@ -282,28 +293,96 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { * @return */ @Override - public int produceInstock(WmsProduceInstockVo wmsProduceInstockVo) { + public int fifthFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo) { + Long warehouseId = wmsConfig.getFifthSemiWarehouseId();//五楼半成品库 + String productType = WmsConstants.PRODUCT_STOCK_STOCK_TYPE_SEMI; + String operationType = WmsConstants.WMS_OPERATION_TYPE_AUTO; + String executeStatus = WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE; + + return produceInstock(wmsProduceInstockVo, warehouseId, productType, operationType, executeStatus, 5L); + } + + /** + * 新增成品入库记录(适用于Web端,适用于1楼成品入库,入虚拟库,无库位) + * + * @param wmsProduceInstockVo + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int firstFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo) { + Long warehouseId = wmsConfig.getFirstFloorProductWarehouseId(); + String productType = WmsConstants.PRODUCT_INSTOCK_STOCK_TYPE_PRODUCT; + String operationType = WmsConstants.WMS_OPERATION_TYPE_MANUAL; + String executeStatus = WmsConstants.WMS_EXECUTE_STATUS_FINISH; + return produceInstock(wmsProduceInstockVo, warehouseId, productType, operationType, executeStatus, 1L); + } + + + /** + * 新增成品入库记录(适用于Web端,适用于4楼成品入库,入虚拟库,无库位) + * + * @param wmsProduceInstockVo + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int fourthFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo) { + Long warehouseId = wmsConfig.getFourthFloorProductWarehouseId(); + String productType = WmsConstants.PRODUCT_INSTOCK_STOCK_TYPE_PRODUCT; + String operationType = WmsConstants.WMS_OPERATION_TYPE_MANUAL; + String executeStatus = WmsConstants.WMS_EXECUTE_STATUS_FINISH; + return produceInstock(wmsProduceInstockVo, warehouseId, productType, operationType, executeStatus, 4L); + } + + + /** + * 新增成品入库记录 + * + * @param wmsProduceInstockVo + * @param warehouseId + * @param productType + * @param operationType + * @param executeStatus + * @return + */ + public int produceInstock(WmsProduceInstockVo wmsProduceInstockVo, Long warehouseId, String productType, String operationType, String executeStatus, Long warehouseFloor) { String materialBarcode = wmsProduceInstockVo.getMaterialBarcode(); R baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); + if (baseBarcodeInfoR == null) { + throw new ServiceException("物料编码有误"); + } MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); if (baseBarcodeInfo == null) { throw new ServiceException("物料编码有误"); } - WmsProductInstock queryProductInstock = new WmsProductInstock(); - queryProductInstock.setProductBatch(materialBarcode); - List wmsProductInstocks = wmsProductInstockMapper.selectWmsProductInstockList(queryProductInstock); - if (wmsProductInstocks != null && !wmsProductInstocks.isEmpty()) { - throw new ServiceException("已经有此物料入库记录"); + if (baseBarcodeInfo.getBarcodeType().equals(WmsConstants.RWA_STOCK_STOCK_TYPE_RAW)) { + throw new ServiceException("此物料条码为原材料,非成品条码"); } - Long warehouseId = wmsConfig.getFifthSemiWarehouseId();//五楼半成品库 + //如果执行状态不是已完成,是agv入库,则需要判断是否有入库记录,避免重复提交;如果执行状态是已完成(人工入库),则判断是否有此成品条码库存即可 + if (!executeStatus.equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) { + WmsProductInstock queryProductInstock = new WmsProductInstock(); + queryProductInstock.setProductBatch(materialBarcode);//productbatch是索引,查出来再过滤性能更快 + List wmsProductInstocks = wmsProductInstockMapper.selectWmsProductInstockList(queryProductInstock); + if (wmsProductInstocks != null && !wmsProductInstocks.isEmpty()) { + List incompleteProductInstocks = wmsProductInstocks.stream().filter( + wmsProductInstock -> !wmsProductInstock.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)).collect(Collectors.toList()); + if (incompleteProductInstocks != null && !incompleteProductInstocks.isEmpty()) { + throw new ServiceException("已经有此成品入库记录"); + } + } + } + + String userName = SecurityUtils.getUsername(); + Date currentDate = new Date(); WmsProductInstock wmsProductInstock = new WmsProductInstock(); wmsProductInstock.setTaskCode(Seq.getId(Seq.productInstockSeqType, Seq.productInstockCode)); wmsProductInstock.setWarehouseId(warehouseId); wmsProductInstock.setPalletInfoCode(baseBarcodeInfo.getPalletInfoCode()); - wmsProductInstock.setProductType(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_SEMI); - wmsProductInstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_AUTO); + wmsProductInstock.setProductType(productType); + wmsProductInstock.setOperationType(operationType); wmsProductInstock.setPlanCode(baseBarcodeInfo.getPlanCode()); wmsProductInstock.setPlanDetailCode(baseBarcodeInfo.getPlanDetailCode()); wmsProductInstock.setInstockType(WmsConstants.PRODUCT_INSTOCK_INSTOCK_TYPE_PRODUCT); @@ -311,14 +390,16 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { wmsProductInstock.setProductBatch(materialBarcode); wmsProductInstock.setInstockAmount(BigDecimal.ONE); wmsProductInstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS); - wmsProductInstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE); - wmsProductInstock.setApplyBy(SecurityUtils.getUsername()); - wmsProductInstock.setApplyDate(new Date()); + wmsProductInstock.setExecuteStatus(executeStatus); + wmsProductInstock.setApplyBy(userName); + wmsProductInstock.setApplyDate(currentDate); + if (executeStatus.equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) { + updateProductStock(baseBarcodeInfo, "", warehouseId, warehouseFloor, userName, currentDate); + } return wmsProductInstockMapper.insertWmsProductInstock(wmsProductInstock); } - public void syncToErp() { //todo 根据质检状态是通过的同步给ERP } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockDetailServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockDetailServiceImpl.java index 0ab3b10..aa221c3 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockDetailServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockDetailServiceImpl.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import java.util.Date; import java.util.List; +import com.alibaba.cloud.commons.lang.StringUtils; import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.constant.WmsConstants; import com.hw.common.core.domain.R; @@ -11,6 +12,7 @@ import com.hw.common.core.exception.ServiceException; import com.hw.common.security.utils.SecurityUtils; import com.hw.mes.api.RemoteMesService; import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import com.hw.wms.config.WmsConfig; import com.hw.wms.domain.WmsBaseLocation; import com.hw.wms.domain.WmsProductOutstock; import com.hw.wms.domain.WmsProductStock; @@ -46,6 +48,12 @@ public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockD @Autowired private WmsBaseLocationMapper wmsBaseLocationMapper; + @Autowired + private WmsConfig wmsConfig; + + @Resource + private RemoteMesService remoteMesService; + /** * 查询成品出库记录明细 @@ -83,9 +91,13 @@ public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockD String productBarcode = wmsProductOutstockDetail.getProductBarcode();//成品条码和批次码相同 Long productOutstockId = wmsProductOutstockDetail.getProductOutstockId(); - WmsBaseLocation location = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode); - if (location == null) { - throw new ServiceException(String.format("库位编码%1$s错误", locationCode)); + R baseBarcodeInfoR = remoteMesService.getBarcode(productBarcode, SecurityConstants.INNER); + if (baseBarcodeInfoR == null) { + throw new ServiceException("物料编码有误"); + } + MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); + if (baseBarcodeInfo == null) { + throw new ServiceException("物料编码有误"); } WmsProductOutstock productOutstock = wmsProductOutstockMapper.selectOnlyWmsProductOutstockByOutstockId(productOutstockId); @@ -93,17 +105,31 @@ public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockD throw new ServiceException("没有此成品出库任务信息"); } - if (!productOutstock.getWarehouseId().equals(location.getWarehouseId())) { - throw new ServiceException("没有此仓库出库任务"); + if(!productOutstock.getProductId().equals(baseBarcodeInfo.getMaterialId())) { + throw new ServiceException("物料编码有误"); + } + + if(StringUtils.isEmpty(locationCode) && + (wmsConfig.getFirstFloorProductWarehouseId().equals(productOutstock.getWarehouseId()) || + wmsConfig.getFourthFloorProductWarehouseId().equals(productOutstock.getWarehouseId()))){ + locationCode = "0"; + wmsProductOutstockDetail.setLocationCode("0"); + }else{ + WmsBaseLocation location = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode); + if (location == null) { + throw new ServiceException(String.format("库位编码%1$s错误", locationCode)); + } + if (!productOutstock.getWarehouseId().equals(location.getWarehouseId())) { + throw new ServiceException("没有此仓库出库任务"); + } } if (productOutstock.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) { throw new ServiceException("此出库申请已完成,不能再出库"); } - WmsProductStock productStock = wmsProductStockMapper.selectProductStockByLocationAndBatchAndSaleOrderId(locationCode, - productBarcode, productOutstock.getSaleOrderId(), WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT); - if (productStock == null) { + WmsProductStock productStock = wmsProductStockMapper.selectProductStockByBatch(productBarcode); + if (productStock == null || !productStock.getSaleOrderId().equals(productOutstock.getSaleOrderId())) { throw new ServiceException("此库位没有对应订单库存"); } @@ -155,7 +181,7 @@ public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockD wmsProductOutstockDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH); wmsProductOutstockDetail.setBeginTime(currentDate); wmsProductOutstockDetail.setEndTime(currentDate); - wmsProductOutstockDetail.setWarehouseId(location.getWarehouseId()); + wmsProductOutstockDetail.setWarehouseId(productStock.getWarehouseId()); wmsProductOutstockDetail.setPlanAmount(BigDecimal.ONE); wmsProductOutstockDetail.setOutstockAmount(BigDecimal.ONE); 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 8826d0a..373adc6 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 @@ -12,6 +12,7 @@ import com.hw.wms.domain.WmsBaseWarehouse; import com.hw.wms.domain.WmsProductStock; import com.hw.wms.domain.vo.WmsProductOutstockConfirmVo; import com.hw.wms.mapper.WmsBaseWarehouseMapper; +import com.hw.wms.mapper.WmsProductOutstockDetailMapper; import com.hw.wms.mapper.WmsProductStockMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,6 +37,9 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService @Autowired private WmsProductOutstockMapper wmsProductOutstockMapper; + @Autowired + private WmsProductOutstockDetailMapper wmsProductOutstockDetailMapper; + @Autowired private WmsProductStockMapper wmsProductStockMapper; @@ -94,7 +98,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService BigDecimal frozenAmount = productStock.getFrozenAmount() == null ? BigDecimal.ZERO : productStock.getFrozenAmount();//冻结数量暂时没用 BigDecimal occupyAmount = productStock.getOccupyAmount() == null ? BigDecimal.ZERO : productStock.getOccupyAmount();// BigDecimal availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount); - BigDecimal sumApplyQty = productStock.getApplyAmount();//获取已申请出库数量 + BigDecimal sumApplyQty = productStock.getApplyAmount() == null ? BigDecimal.ZERO : productStock.getApplyAmount();//获取已申请出库数量 // WmsProductOutstock queryProductOutStock = new WmsProductOutstock(); // queryProductOutStock.setSaleorderCode(saleorderCode); @@ -220,15 +224,39 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService /** * 适用于成品出库后,运输到指定地点,根据销售订单最终确认 + * * @param wmsProductOutstockConfirmVo * @return */ @Override - public int finalConfirmProductOutstock(WmsProductOutstockConfirmVo wmsProductOutstockConfirmVo){ - System.out.println("111"+wmsProductOutstockConfirmVo.getSaleorderCode()); - System.out.println("3333"+wmsProductOutstockConfirmVo.getMaterialBarcode()); + public int finalConfirmProductOutstock(WmsProductOutstockConfirmVo wmsProductOutstockConfirmVo) { + WmsProductOutstockDetail productOutstockDetail = wmsProductOutstockDetailMapper. + selectWmsProductOutstockDetailByProductBarcode(wmsProductOutstockConfirmVo.getMaterialBarcode()); + if (productOutstockDetail == null) { + throw new ServiceException("没有此成品出库信息"); + } + + String executeStatus = productOutstockDetail.getExecuteStatus(); + if (executeStatus.equals(WmsConstants.WMS_EXECUTE_STATUS_CONFIRM)) { + throw new ServiceException("此成品出库已经确认,无需再次确认"); + } + if (!executeStatus.equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) { + throw new ServiceException("此成品还未出库,不能进行确认"); + } + + WmsProductOutstock wmsProductOutstock = wmsProductOutstockMapper. + selectOnlyWmsProductOutstockByOutstockId(productOutstockDetail.getProductOutstockId()); + if (wmsProductOutstock.getSaleorderCode() == null || + !wmsProductOutstock.getSaleorderCode().equals(wmsProductOutstockConfirmVo.getSaleorderCode())) { + throw new ServiceException("销售订单成品出库记录不匹配"); + } + + productOutstockDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_CONFIRM); + productOutstockDetail.setConfirmAmount(BigDecimal.ONE); + productOutstockDetail.setUpdateDate(new Date()); + productOutstockDetail.setUpdateBy(SecurityUtils.getUsername()); - return 1; + return wmsProductOutstockDetailMapper.updateWmsProductOutstockDetail(productOutstockDetail); } } 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 876da70..ea340ec 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 @@ -287,6 +287,9 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { } R baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); + if (baseBarcodeInfoR == null) { + throw new ServiceException("物料编码有误"); + } MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); if (baseBarcodeInfo == null) { throw new ServiceException("物料编码有误"); @@ -301,6 +304,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { String batchCode = baseBarcodeInfo.getBatchCode(); + //todo:后续判断outrequirement //判断是否有此出库任务,人工出库的同一个出库记录,同一个库位、同一个物料对应一个明细(agv的有可能是多个) WmsRawOutstock queryRawOutstock = new WmsRawOutstock(); queryRawOutstock.setLocationCode(locationCode); 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 aff1c9b..0d1a982 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 @@ -221,6 +221,13 @@ public class WmsTransferServiceImpl implements IWmsTransferService { if (oriLocation == null) { throw new ServiceException("库位不存在"); } + + //删除成品库存 + WmsProductStock productStock = wmsProductStockMapper.selectProductStockByBatch(materialBarcode); + if (productStock == null) { + throw new ServiceException("无此成品库存"); + } + WmsTransfer wmsTransfer = new WmsTransfer(); wmsTransfer.setTaskCode(Seq.getId(Seq.wmsTransferSeqType, Seq.wmsTransferSeqCode)); wmsTransfer.setOriWarehouseId(oriLocation.getWarehouseId()); @@ -252,8 +259,6 @@ public class WmsTransferServiceImpl implements IWmsTransferService { wmsTransferDetailMapper.insertWmsTransferDetail(wmsTransferDetail); - //删除成品库存 - WmsProductStock productStock = wmsProductStockMapper.selectProductStockByBatch(materialBarcode); wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStock.getProductStockId()); return 1; @@ -293,7 +298,7 @@ public class WmsTransferServiceImpl implements IWmsTransferService { queryTransfer.setProductBatch(materialBarcode); queryTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH); List wmsTransfers = wmsTransferMapper.selectWmsTransferList(queryTransfer); - if(wmsTransfers==null || wmsTransfers.isEmpty()){ + if (wmsTransfers == null || wmsTransfers.isEmpty()) { throw new ServiceException("没有此成品的转库出库记录,不能转库入库"); } diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsInventoryCheckMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsInventoryCheckMapper.xml index f9f11d5..2bfccb5 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsInventoryCheckMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsInventoryCheckMapper.xml @@ -19,6 +19,7 @@ + diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml index c6fe646..c2c3127 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml @@ -68,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and location_code = #{locationCode} and product_type = #{productType} and operation_type = #{operationType} + and product_batch = #{productBatch} and plan_code = #{planCode} and plan_detail_code = #{planDetailCode} and instock_type = #{instockType} diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockDetailMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockDetailMapper.xml index d8311dd..bdb1d9e 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockDetailMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockDetailMapper.xml @@ -120,4 +120,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{productOutstockDetailId} + + + + + + + diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml index e8409a1..ced8139 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml @@ -18,6 +18,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -282,7 +285,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 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 73491ec..c3e0dd6 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 @@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select product_stock_id, warehouse_id, location_code, stock_type, product_batch, quality_status, product_id, plan_code, plan_detail_code,saleorder_code, total_amount, frozen_amount, occupy_amount, create_by, create_date, update_by, update_date, active_flag, instock_date from wms_product_stock + select product_stock_id, warehouse_id, location_code, stock_type, product_batch, quality_status, product_id, plan_code, plan_detail_code,sale_order_id,saleorder_code, total_amount, frozen_amount, occupy_amount, create_by, create_date, update_by, update_date, active_flag, instock_date from wms_product_stock