From ef7fd0dfb5956efa261bf6cf29756bbc14bb8c94 Mon Sep 17 00:00:00 2001 From: xs Date: Sat, 16 Nov 2024 19:35:06 +0800 Subject: [PATCH] =?UTF-8?q?3.5.0=20RFID=E6=89=8B=E6=8C=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hw/mes/api/domain/MesPurchaseOrder.java | 10 + .../printer/api/domain/vo/PrintContentVo.java | 4 + .../dms/DmsBillsFaultInstanceMapper.xml | 1 + .../controller/MesProductPlanController.java | 17 + .../MesPurchaseOrderController.java | 31 +- .../domain/MesProduceStatisticsDetail.java | 339 ++++++++++++++++++ .../MesProduceStatisticsDetailMaterial.java | 122 +++++++ .../hw/mes/domain/MesProductPlanDetail.java | 21 ++ .../java/com/hw/mes/domain/MesSaleOrder.java | 10 + .../hw/mes/domain/MesStatusChangeInfo.java | 145 ++++++++ .../com/hw/mes/mapper/MesOrderBindMapper.java | 11 +- .../MesProduceStatisticsDetailMapper.java | 87 +++++ .../mapper/MesProductPlanDetailMapper.java | 8 + .../hw/mes/mapper/MesProductPlanMapper.java | 9 + .../hw/mes/mapper/MesPurchaseOrderMapper.java | 9 + .../mes/mapper/MesStatusChangeInfoMapper.java | 70 ++++ .../hw/mes/service/IMesOrderBindService.java | 8 + .../service/IMesProductPlanDetailService.java | 6 + .../mes/service/IMesPurchaseOrderService.java | 8 + .../impl/MesBaseBarcodeInfoServiceImpl.java | 85 ++++- .../impl/MesBasePalletInfoServiceImpl.java | 55 ++- .../impl/MesBaseStationInfoServiceImpl.java | 1 - .../hw/mes/service/impl/MesImportImpl.java | 2 +- .../service/impl/MesOrderBindServiceImpl.java | 13 + .../impl/MesProductPlanDetailServiceImpl.java | 121 ++++++- .../impl/MesPurchaseOrderServiceImpl.java | 12 + .../service/impl/MesSaleOrderServiceImpl.java | 44 ++- .../mapper/mes/MesBaseBarcodeInfoMapper.xml | 1 + .../mapper/mes/MesOrderBindMapper.xml | 26 ++ .../mes/MesProduceStatisticsDetailMapper.xml | 190 ++++++++++ .../mapper/mes/MesProductPlanDetailMapper.xml | 21 ++ .../mapper/mes/MesProductPlanMapper.xml | 38 ++ .../mapper/mes/MesPurchaseOrderMapper.xml | 21 +- .../mapper/mes/MesSaleOrderMapper.xml | 2 +- .../mapper/mes/MesSaleOrderRelateMapper.xml | 1 + .../mapper/mes/MesStatusChangeInfoMapper.xml | 89 +++++ .../java/com/hw/wms/domain/WmsRawReturn.java | 11 + .../impl/WmsProductInstockServiceImpl.java | 51 ++- .../impl/WmsProductOutstockServiceImpl.java | 48 ++- .../service/impl/WmsRawReturnServiceImpl.java | 16 +- .../service/impl/WmsTransferServiceImpl.java | 11 + .../mapper/wms/WmsProductStockMapper.xml | 2 +- .../mapper/wms/WmsRawReturnMapper.xml | 2 + .../mapper/wms/WmsRawStockMapper.xml | 3 +- hw-ui/src/api/mes/purchaseOrder.js | 20 ++ .../views/board/barcode/workshopBarcode.vue | 45 ++- .../src/views/board/common/applyRawReturn.vue | 64 ++-- hw-ui/src/views/board/fifthFloor/index.vue | 58 ++- .../src/views/board/fourthFloor/assemble.vue | 8 +- hw-ui/src/views/mes/barcode/index.vue | 96 +++-- hw-ui/src/views/mes/basePalletInfo/index.vue | 9 +- hw-ui/src/views/mes/materialBom/index.vue | 101 +++--- hw-ui/src/views/mes/productOrder/index.vue | 4 +- .../views/mes/purchaseApplyProcess/index.vue | 2 +- .../src/views/mes/purchaseOrder/bindOrder.vue | 23 +- .../mes/purchaseOrder/selectOrderBind.vue | 6 +- .../mes/purchaseOrder/selectSaleOrder.vue | 15 +- .../views/mes/saleOrder/bindingPurchase.vue | 40 ++- hw-ui/src/views/qms/base/checkrule/index.vue | 24 +- .../views/qms/base/qualityinstance/index.vue | 19 +- .../views/wms/info/inventoryCheck/detail.vue | 4 +- .../src/views/wms/info/rawoutstock/index.vue | 2 +- hw-ui/src/views/wms/info/rawreturn/index.vue | 2 +- hw-ui/src/views/wms/info/stocktotal/index.vue | 14 +- 64 files changed, 2081 insertions(+), 257 deletions(-) create mode 100644 hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProduceStatisticsDetail.java create mode 100644 hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProduceStatisticsDetailMaterial.java create mode 100644 hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesStatusChangeInfo.java create mode 100644 hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProduceStatisticsDetailMapper.java create mode 100644 hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesStatusChangeInfoMapper.java create mode 100644 hw-modules/hw-mes/src/main/resources/mapper/mes/MesProduceStatisticsDetailMapper.xml create mode 100644 hw-modules/hw-mes/src/main/resources/mapper/mes/MesStatusChangeInfoMapper.xml diff --git a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesPurchaseOrder.java b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesPurchaseOrder.java index 79fa79e..a42835f 100644 --- a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesPurchaseOrder.java +++ b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesPurchaseOrder.java @@ -295,6 +295,8 @@ public class MesPurchaseOrder extends BaseEntity { private String projectNo; + private Long materialBomId; + public Long getSerialNumber() { return serialNumber; @@ -760,6 +762,14 @@ public class MesPurchaseOrder extends BaseEntity { this.projectNo = projectNo; } + public Long getMaterialBomId() { + return materialBomId; + } + + public void setMaterialBomId(Long materialBomId) { + this.materialBomId = materialBomId; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/hw-api/hw-api-printer/src/main/java/com/hw/printer/api/domain/vo/PrintContentVo.java b/hw-api/hw-api-printer/src/main/java/com/hw/printer/api/domain/vo/PrintContentVo.java index 60cac22..c732adb 100644 --- a/hw-api/hw-api-printer/src/main/java/com/hw/printer/api/domain/vo/PrintContentVo.java +++ b/hw-api/hw-api-printer/src/main/java/com/hw/printer/api/domain/vo/PrintContentVo.java @@ -29,6 +29,10 @@ public class PrintContentVo { public static final String PRINT_TEMPLATE_RAW = "raw"; public static final String PRINT_TEMPLATE_PRODUCT = "product"; public static final String PRINT_TEMPLATE_BIND = "bind"; + public static final String PRINT_TEMPLATE_SMALL = "small"; + + public static final String SMALL_LABEL_KEY_TEXT = "text"; + public static final String SMALL_LABEL_KEY_QRCODE = "qrcode"; private String key; diff --git a/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBillsFaultInstanceMapper.xml b/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBillsFaultInstanceMapper.xml index a564841..b33bda8 100644 --- a/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBillsFaultInstanceMapper.xml +++ b/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBillsFaultInstanceMapper.xml @@ -210,6 +210,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and is_flag = #{isFlag} and device_id = #{deviceId} + order by dbfi.repair_instance_id desc 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 688c681..1116658 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 @@ -295,4 +295,21 @@ public class MesProductPlanController extends BaseController { } } + + + /** + * 生成生产明细统计 + */ + @Log(title = "生产明细统计", businessType = BusinessType.START) + @PostMapping("/generateProduceStatisticsDetail") +// @InnerAuth + public R generateProduceStatisticsDetail() { + try { + mesProductPlanDetailService.generateProduceStatisticsDetail(""); + return R.ok(); + } catch (Exception e) { + e.printStackTrace(); + return R.fail(e.getMessage()); + } + } } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesPurchaseOrderController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesPurchaseOrderController.java index 9323a98..030b00b 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesPurchaseOrderController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesPurchaseOrderController.java @@ -5,7 +5,10 @@ import javax.servlet.http.HttpServletResponse; import com.hw.common.core.domain.R; import com.hw.common.security.annotation.InnerAuth; +import com.hw.mes.api.domain.MesOrderBind; +import com.hw.mes.domain.MesMaterialBom; import com.hw.mes.domain.MesSaleOrder; +import com.hw.mes.service.IMesMaterialBomService; import com.hw.mes.service.IMesOrderBindService; import com.hw.mes.service.IMesSaleOrderService; import org.springframework.beans.factory.annotation.Autowired; @@ -43,6 +46,9 @@ public class MesPurchaseOrderController extends BaseController @Autowired private IMesSaleOrderService mesSaleOrderService; + @Autowired + private IMesMaterialBomService mesMaterialBomService; + @Autowired private IMesOrderBindService mesOrderBindService; @@ -78,7 +84,7 @@ public class MesPurchaseOrderController extends BaseController @GetMapping(value = "/{purchaseOrderId}") public AjaxResult getInfo(@PathVariable("purchaseOrderId") Long purchaseOrderId) { - return success(mesPurchaseOrderService.selectMesPurchaseOrderByPurchaseOrderId(purchaseOrderId)); + return success(mesPurchaseOrderService.selectMesPurchaseOrderJoinMaterialByPurchaseOrderId(purchaseOrderId)); } /** @@ -235,6 +241,18 @@ public class MesPurchaseOrderController extends BaseController } + /** + * 获取生产bom列表 + * @param mesMaterialBom + * @return + */ + @GetMapping("/getMaterialBoms") + public AjaxResult getMaterialBoms(MesMaterialBom mesMaterialBom) + { + List list = mesMaterialBomService.selectMesMaterialBomList(mesMaterialBom); + return success(list); + } + /** * 自动出库不在特定日期raw_instock记录中的采购订单信息(group by) @@ -247,6 +265,17 @@ public class MesPurchaseOrderController extends BaseController } + /** + * 查询采购订单绑定销售订单信息 + */ + @GetMapping("/getOrderBinds") + public AjaxResult getOrderBinds(MesOrderBind mesOrderBind) + { + List list = mesOrderBindService.selectMesOrderBindJoinProductList(mesOrderBind); + return success(list); + } + + /** * 获取采购订单信息详细信息 diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProduceStatisticsDetail.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProduceStatisticsDetail.java new file mode 100644 index 0000000..d04737e --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProduceStatisticsDetail.java @@ -0,0 +1,339 @@ +package com.hw.mes.domain; + +import java.util.List; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +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_produce_statistics_detail + * + * @author xins + * @date 2024-11-07 + */ +public class MesProduceStatisticsDetail extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键标识 */ + private Long statisticsDetailId; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long productOrderId; + + /** 销售订单ID */ + @Excel(name = "销售订单ID") + private Long saleOrderId; + + /** 销售订单号 */ + @Excel(name = "销售订单号") + private String saleorderCode; + + /** 生产计划ID */ + @Excel(name = "生产计划ID") + private Long planId; + + /** 计划编号,关联mes_product_plan_info的plan_code */ + @Excel(name = "计划编号,关联mes_product_plan_info的plan_code") + private String planCode; + + /** 生产计划明细ID */ + @Excel(name = "生产计划明细ID") + private Long planDetailId; + + /** 生产计划明细编号 */ + @Excel(name = "生产计划明细编号") + private String planDetailCode; + + /** 生产成品ID */ + @Excel(name = "生产成品ID") + private Long productId; + + /** 生产成名编码 */ + @Excel(name = "生产成名编码") + private String productCode; + + /** 生产成品名称 */ + @Excel(name = "生产成品名称") + private String productName; + + /** 生产成品规格 */ + @Excel(name = "生产成品规格") + private String productSpec; + + /** 操作人员ID,关联sys_user的user_id */ + @Excel(name = "操作人员ID,关联sys_user的user_id") + private Long userId; + + /** 操作人员名称,关联sys_user的nick_name */ + @Excel(name = "操作人员名称,关联sys_user的nick_name") + private String nickName; + + /** 工序ID */ + @Excel(name = "工序ID") + private Long processId; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 计划开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "计划开始时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date planBeginTime; + + /** 计划结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "计划结束时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date planEndTime; + + /** 开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date realBeginTime; + + /** 完成时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date realEndTime; + + /** 生产用时(单位:S) */ + @Excel(name = "生产用时(单位:S)") + private Long produceTime; + + /** 生产统计明细使用物料情况;车间生产派工信息 */ + private List mesProduceStatisticsDetailMaterialList; + + public void setStatisticsDetailId(Long statisticsDetailId) + { + this.statisticsDetailId = statisticsDetailId; + } + + public Long getStatisticsDetailId() + { + return statisticsDetailId; + } + public void setProductOrderId(Long productOrderId) + { + this.productOrderId = productOrderId; + } + + public Long getProductOrderId() + { + return productOrderId; + } + public void setSaleOrderId(Long saleOrderId) + { + this.saleOrderId = saleOrderId; + } + + public Long getSaleOrderId() + { + return saleOrderId; + } + public void setSaleorderCode(String saleorderCode) + { + this.saleorderCode = saleorderCode; + } + + public String getSaleorderCode() + { + return saleorderCode; + } + public void setPlanId(Long planId) + { + this.planId = planId; + } + + public Long getPlanId() + { + return planId; + } + public void setPlanCode(String planCode) + { + this.planCode = planCode; + } + + public String getPlanCode() + { + return planCode; + } + public void setPlanDetailId(Long planDetailId) + { + this.planDetailId = planDetailId; + } + + public Long getPlanDetailId() + { + return planDetailId; + } + public void setPlanDetailCode(String planDetailCode) + { + this.planDetailCode = planDetailCode; + } + + public String getPlanDetailCode() + { + return planDetailCode; + } + public void setProductId(Long productId) + { + this.productId = productId; + } + + public Long getProductId() + { + return productId; + } + public void setProductCode(String productCode) + { + this.productCode = productCode; + } + + public String getProductCode() + { + return productCode; + } + public void setProductName(String productName) + { + this.productName = productName; + } + + public String getProductName() + { + return productName; + } + public void setProductSpec(String productSpec) + { + this.productSpec = productSpec; + } + + public String getProductSpec() + { + return productSpec; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setNickName(String nickName) + { + this.nickName = nickName; + } + + public String getNickName() + { + return nickName; + } + public void setProcessId(Long processId) + { + this.processId = processId; + } + + public Long getProcessId() + { + return processId; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setPlanBeginTime(Date planBeginTime) + { + this.planBeginTime = planBeginTime; + } + + public Date getPlanBeginTime() + { + return planBeginTime; + } + public void setPlanEndTime(Date planEndTime) + { + this.planEndTime = planEndTime; + } + + public Date getPlanEndTime() + { + return planEndTime; + } + public void setRealBeginTime(Date realBeginTime) + { + this.realBeginTime = realBeginTime; + } + + public Date getRealBeginTime() + { + return realBeginTime; + } + public void setRealEndTime(Date realEndTime) + { + this.realEndTime = realEndTime; + } + + public Date getRealEndTime() + { + return realEndTime; + } + public void setProduceTime(Long produceTime) + { + this.produceTime = produceTime; + } + + public Long getProduceTime() + { + return produceTime; + } + + public List getMesProduceStatisticsDetailMaterialList() + { + return mesProduceStatisticsDetailMaterialList; + } + + public void setMesProduceStatisticsDetailMaterialList(List mesProduceStatisticsDetailMaterialList) + { + this.mesProduceStatisticsDetailMaterialList = mesProduceStatisticsDetailMaterialList; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("statisticsDetailId", getStatisticsDetailId()) + .append("productOrderId", getProductOrderId()) + .append("saleOrderId", getSaleOrderId()) + .append("saleorderCode", getSaleorderCode()) + .append("planId", getPlanId()) + .append("planCode", getPlanCode()) + .append("planDetailId", getPlanDetailId()) + .append("planDetailCode", getPlanDetailCode()) + .append("productId", getProductId()) + .append("productCode", getProductCode()) + .append("productName", getProductName()) + .append("productSpec", getProductSpec()) + .append("userId", getUserId()) + .append("nickName", getNickName()) + .append("processId", getProcessId()) + .append("processName", getProcessName()) + .append("planBeginTime", getPlanBeginTime()) + .append("planEndTime", getPlanEndTime()) + .append("realBeginTime", getRealBeginTime()) + .append("realEndTime", getRealEndTime()) + .append("produceTime", getProduceTime()) + .append("createTime", getCreateTime()) + .append("mesProduceStatisticsDetailMaterialList", getMesProduceStatisticsDetailMaterialList()) + .toString(); + } +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProduceStatisticsDetailMaterial.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProduceStatisticsDetailMaterial.java new file mode 100644 index 0000000..465a098 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProduceStatisticsDetailMaterial.java @@ -0,0 +1,122 @@ +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_produce_statistics_detail_material + * + * @author xins + * @date 2024-11-07 + */ +public class MesProduceStatisticsDetailMaterial extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键标识 */ + private Long statisticsDetailMaterialId; + + /** 生产统计明细ID */ + @Excel(name = "生产统计明细ID") + private Long statisticsDetailId; + + /** 物料ID */ + @Excel(name = "物料ID") + private Long materialId; + + /** 物料编码 */ + @Excel(name = "物料编码") + private String materialCode; + + /** 物料名称 */ + @Excel(name = "物料名称") + private String materialName; + + /** 物料规格 */ + @Excel(name = "物料规格") + private String materialSpec; + + /** 使用数量 */ + @Excel(name = "使用数量") + private BigDecimal usedAmount; + + public void setStatisticsDetailMaterialId(Long statisticsDetailMaterialId) + { + this.statisticsDetailMaterialId = statisticsDetailMaterialId; + } + + public Long getStatisticsDetailMaterialId() + { + return statisticsDetailMaterialId; + } + public void setStatisticsDetailId(Long statisticsDetailId) + { + this.statisticsDetailId = statisticsDetailId; + } + + public Long getStatisticsDetailId() + { + return statisticsDetailId; + } + public void setMaterialId(Long materialId) + { + this.materialId = materialId; + } + + public Long getMaterialId() + { + return materialId; + } + public void setMaterialCode(String materialCode) + { + this.materialCode = materialCode; + } + + public String getMaterialCode() + { + return materialCode; + } + public void setMaterialName(String materialName) + { + this.materialName = materialName; + } + + public String getMaterialName() + { + return materialName; + } + public void setMaterialSpec(String materialSpec) + { + this.materialSpec = materialSpec; + } + + public String getMaterialSpec() + { + return materialSpec; + } + public void setUsedAmount(BigDecimal usedAmount) + { + this.usedAmount = usedAmount; + } + + public BigDecimal getUsedAmount() + { + return usedAmount; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("statisticsDetailMaterialId", getStatisticsDetailMaterialId()) + .append("statisticsDetailId", getStatisticsDetailId()) + .append("materialId", getMaterialId()) + .append("materialCode", getMaterialCode()) + .append("materialName", getMaterialName()) + .append("materialSpec", getMaterialSpec()) + .append("usedAmount", getUsedAmount()) + .toString(); + } +} 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 6afb942..1c0e64b 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 @@ -71,6 +71,11 @@ public class MesProductPlanDetail extends BaseEntity private String rawMaterialBarcode; + private String statisticsFlag;//统计标识,用来查询判断条件使用 + + private String nickName; + + public void setPlanDetailId(Long planDetailId) { this.planDetailId = planDetailId; @@ -211,6 +216,22 @@ public class MesProductPlanDetail extends BaseEntity this.rawMaterialBarcode = rawMaterialBarcode; } + public String getStatisticsFlag() { + return statisticsFlag; + } + + public void setStatisticsFlag(String statisticsFlag) { + this.statisticsFlag = statisticsFlag; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + @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/MesSaleOrder.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesSaleOrder.java index 50959e0..d850c44 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesSaleOrder.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesSaleOrder.java @@ -199,6 +199,8 @@ public class MesSaleOrder extends BaseEntity { private Long virtualSaleOrderId; + private String parentIds; + public String getMaterialModel() { return materialModel; @@ -464,6 +466,14 @@ public class MesSaleOrder extends BaseEntity { this.virtualSaleOrderId = virtualSaleOrderId; } + public String getParentIds() { + return parentIds; + } + + public void setParentIds(String parentIds) { + this.parentIds = parentIds; + } + @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/MesStatusChangeInfo.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesStatusChangeInfo.java new file mode 100644 index 0000000..4f91739 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesStatusChangeInfo.java @@ -0,0 +1,145 @@ +package com.hw.mes.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +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_status_change_info + * + * @author xins + * @date 2024-11-07 + */ +public class MesStatusChangeInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键标识 */ + private Long statusChangeInfoId; + + /** 变化类型(1:mes_product_order) */ + @Excel(name = "变化类型", readConverterExp = "1=:mes_product_order") + private String changeType; + + /** 变化ID */ + @Excel(name = "变化ID") + private Long changeId; + + /** 老状态 */ + @Excel(name = "老状态") + private String oldStatus; + + /** 新状态 */ + @Excel(name = "新状态") + private String newStatus; + + /** 创建人 */ + @Excel(name = "创建人") + private String changeBy; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date changeTime; + + private Long productOrderId; + + private Long planDetailId; + + + public void setStatusChangeInfoId(Long statusChangeInfoId) + { + this.statusChangeInfoId = statusChangeInfoId; + } + + public Long getStatusChangeInfoId() + { + return statusChangeInfoId; + } + public void setChangeType(String changeType) + { + this.changeType = changeType; + } + + public String getChangeType() + { + return changeType; + } + public void setChangeId(Long changeId) + { + this.changeId = changeId; + } + + public Long getChangeId() + { + return changeId; + } + public void setOldStatus(String oldStatus) + { + this.oldStatus = oldStatus; + } + + public String getOldStatus() + { + return oldStatus; + } + public void setNewStatus(String newStatus) + { + this.newStatus = newStatus; + } + + public String getNewStatus() + { + return newStatus; + } + public void setChangeBy(String changeBy) + { + this.changeBy = changeBy; + } + + public String getChangeBy() + { + return changeBy; + } + public void setChangeTime(Date changeTime) + { + this.changeTime = changeTime; + } + + public Date getChangeTime() + { + return changeTime; + } + + public Long getProductOrderId() { + return productOrderId; + } + + public void setProductOrderId(Long productOrderId) { + this.productOrderId = productOrderId; + } + + public Long getPlanDetailId() { + return planDetailId; + } + + public void setPlanDetailId(Long planDetailId) { + this.planDetailId = planDetailId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("statusChangeInfoId", getStatusChangeInfoId()) + .append("changeType", getChangeType()) + .append("changeId", getChangeId()) + .append("oldStatus", getOldStatus()) + .append("newStatus", getNewStatus()) + .append("changeBy", getChangeBy()) + .append("changeTime", getChangeTime()) + .toString(); + } +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesOrderBindMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesOrderBindMapper.java index 33c5d3c..feb7eb5 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesOrderBindMapper.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesOrderBindMapper.java @@ -60,11 +60,20 @@ public interface MesOrderBindMapper public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds); /** - * 查询采购销售订单绑定信息列表,Join material + * 查询采购销售订单绑定信息列表,Join material and product and saleorder * * @param mesOrderBind 采购销售订单绑定信息 * @return 采购销售订单绑定信息集合 */ public List selectMesOrderBindJoinList(MesOrderBind mesOrderBind); + + /** + * 查询采购销售订单绑定信息列表,Join product + * + * @param mesOrderBind 采购销售订单绑定信息 + * @return 采购销售订单绑定信息集合 + */ + public List selectMesOrderBindJoinProductList(MesOrderBind mesOrderBind); + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProduceStatisticsDetailMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProduceStatisticsDetailMapper.java new file mode 100644 index 0000000..a6e5e52 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProduceStatisticsDetailMapper.java @@ -0,0 +1,87 @@ +package com.hw.mes.mapper; + +import java.util.List; +import com.hw.mes.domain.MesProduceStatisticsDetail; +import com.hw.mes.domain.MesProduceStatisticsDetailMaterial; + +/** + * 生产统计明细Mapper接口 + * + * @author xins + * @date 2024-11-07 + */ +public interface MesProduceStatisticsDetailMapper +{ + /** + * 查询生产统计明细 + * + * @param statisticsDetailId 生产统计明细主键 + * @return 生产统计明细 + */ + public MesProduceStatisticsDetail selectMesProduceStatisticsDetailByStatisticsDetailId(Long statisticsDetailId); + + /** + * 查询生产统计明细列表 + * + * @param mesProduceStatisticsDetail 生产统计明细 + * @return 生产统计明细集合 + */ + public List selectMesProduceStatisticsDetailList(MesProduceStatisticsDetail mesProduceStatisticsDetail); + + /** + * 新增生产统计明细 + * + * @param mesProduceStatisticsDetail 生产统计明细 + * @return 结果 + */ + public int insertMesProduceStatisticsDetail(MesProduceStatisticsDetail mesProduceStatisticsDetail); + + /** + * 修改生产统计明细 + * + * @param mesProduceStatisticsDetail 生产统计明细 + * @return 结果 + */ + public int updateMesProduceStatisticsDetail(MesProduceStatisticsDetail mesProduceStatisticsDetail); + + /** + * 删除生产统计明细 + * + * @param statisticsDetailId 生产统计明细主键 + * @return 结果 + */ + public int deleteMesProduceStatisticsDetailByStatisticsDetailId(Long statisticsDetailId); + + /** + * 批量删除生产统计明细 + * + * @param statisticsDetailIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMesProduceStatisticsDetailByStatisticsDetailIds(Long[] statisticsDetailIds); + + /** + * 批量删除生产统计明细使用物料情况;车间生产派工 + * + * @param statisticsDetailIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMesProduceStatisticsDetailMaterialByStatisticsDetailIds(Long[] statisticsDetailIds); + + /** + * 批量新增生产统计明细使用物料情况;车间生产派工 + * + * @param mesProduceStatisticsDetailMaterialList 生产统计明细使用物料情况;车间生产派工列表 + * @return 结果 + */ + public int batchMesProduceStatisticsDetailMaterial(List mesProduceStatisticsDetailMaterialList); + + + /** + * 通过生产统计明细主键删除生产统计明细使用物料情况;车间生产派工信息 + * + * @param statisticsDetailId 生产统计明细ID + * @return 结果 + */ + public int deleteMesProduceStatisticsDetailMaterialByStatisticsDetailId(Long statisticsDetailId); +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanDetailMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanDetailMapper.java index ce07f8d..a182ced 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanDetailMapper.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanDetailMapper.java @@ -94,4 +94,12 @@ public interface MesProductPlanDetailMapper public MesProductPlanDetail selectMesProductPlanDetailByMaterialBarcode(String materialBarcode); + /** + * 查询生产计划明细列表,供生成统计数据使用 + * + * @param mesProductPlanDetail 生产计划明细 + * @return 生产计划明细集合 + */ + public List selectMesProductPlanDetailList4Statistics(MesProductPlanDetail mesProductPlanDetail); + } 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 97766d7..eca448b 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 @@ -145,4 +145,13 @@ public interface MesProductPlanMapper public List selectOnlyConflictMesProductPlans(MesProductPlan mesProductPlan); + /** + * 查询生产派工 + * + * @param planId 生产计划ID + * @return 生产派工 + */ + public MesProductPlan selectOnlyMesProductPlanByPlanId(Long planId); + + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesPurchaseOrderMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesPurchaseOrderMapper.java index 7b30fc4..aa977d9 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesPurchaseOrderMapper.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesPurchaseOrderMapper.java @@ -151,5 +151,14 @@ public interface MesPurchaseOrderMapper */ public MesPurchaseOrder selectPurchaseOrderJoinSupplierProjectByOrderId(Long purchaseOrderId); + /** + * 查询采购订单信息,Join material + * + * @param purchaseOrderId 采购订单信息主键 + * @return 采购订单信息 + */ + public MesPurchaseOrder selectMesPurchaseOrderJoinMaterialByPurchaseOrderId(Long purchaseOrderId); + + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesStatusChangeInfoMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesStatusChangeInfoMapper.java new file mode 100644 index 0000000..4e0c020 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesStatusChangeInfoMapper.java @@ -0,0 +1,70 @@ +package com.hw.mes.mapper; + +import java.util.List; +import com.hw.mes.domain.MesStatusChangeInfo; + +/** + * 状态变化信息Mapper接口 + * + * @author xins + * @date 2024-11-07 + */ +public interface MesStatusChangeInfoMapper +{ + /** + * 查询状态变化信息 + * + * @param statusChangeInfoId 状态变化信息主键 + * @return 状态变化信息 + */ + public MesStatusChangeInfo selectMesStatusChangeInfoByStatusChangeInfoId(Long statusChangeInfoId); + + /** + * 查询状态变化信息列表 + * + * @param mesStatusChangeInfo 状态变化信息 + * @return 状态变化信息集合 + */ + public List selectMesStatusChangeInfoList(MesStatusChangeInfo mesStatusChangeInfo); + + /** + * 新增状态变化信息 + * + * @param mesStatusChangeInfo 状态变化信息 + * @return 结果 + */ + public int insertMesStatusChangeInfo(MesStatusChangeInfo mesStatusChangeInfo); + + /** + * 修改状态变化信息 + * + * @param mesStatusChangeInfo 状态变化信息 + * @return 结果 + */ + public int updateMesStatusChangeInfo(MesStatusChangeInfo mesStatusChangeInfo); + + /** + * 删除状态变化信息 + * + * @param statusChangeInfoId 状态变化信息主键 + * @return 结果 + */ + public int deleteMesStatusChangeInfoByStatusChangeInfoId(Long statusChangeInfoId); + + /** + * 批量删除状态变化信息 + * + * @param statusChangeInfoIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMesStatusChangeInfoByStatusChangeInfoIds(Long[] statusChangeInfoIds); + + /** + * 查询状态变化信息列表,根据productOrderId和planDetailId + * + * @param mesStatusChangeInfo 状态变化信息 + * @return 状态变化信息集合 + */ + public List selectMesStatusChangeInfoListByProduce(MesStatusChangeInfo mesStatusChangeInfo); + +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesOrderBindService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesOrderBindService.java index 486a2e7..a91f454 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesOrderBindService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesOrderBindService.java @@ -67,4 +67,12 @@ public interface IMesOrderBindService * @return 采购销售订单绑定信息 */ public List selectMesOrderBindJoinList(MesOrderBind mesOrderBind); + + /** + * 查询采购销售订单绑定信息列表,Join product + * + * @param mesOrderBind 采购销售订单绑定信息 + * @return 采购销售订单绑定信息 + */ + public List selectMesOrderBindJoinProductList(MesOrderBind mesOrderBind); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanDetailService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanDetailService.java index 4f34636..978d0e8 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanDetailService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductPlanDetailService.java @@ -132,4 +132,10 @@ public interface IMesProductPlanDetailService { * @return */ public int productPlanDetailContinue(MesProductPlanDetailPauseVo mesProductPlanDetailPauseVo); + + /** + * 生成生产计划明细统计表 + * @param time + */ + public void generateProduceStatisticsDetail(String time); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesPurchaseOrderService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesPurchaseOrderService.java index 4a53d72..8cc6df7 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesPurchaseOrderService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesPurchaseOrderService.java @@ -158,4 +158,12 @@ public interface IMesPurchaseOrderService * @return 采购订单信息 */ public MesPurchaseOrder selectPurchaseOrderJoinSupplierProjectByOrderId(Long purchaseOrderId); + + /** + * 查询采购订单信息,join material + * + * @param purchaseOrderId 采购订单信息主键 + * @return 采购订单信息 + */ + public MesPurchaseOrder selectMesPurchaseOrderJoinMaterialByPurchaseOrderId(Long purchaseOrderId); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java index ef017fe..04aae4f 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java @@ -91,6 +91,9 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService @Resource private RemoteWmsService remoteWmsService; + public final String splitCharacter = "/"; + public final int materialNameLength = 4; + /** * 查询条码信息 * @@ -294,11 +297,12 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService Date currentDate = new Date(); String userName = SecurityUtils.getUsername(); MesBaseBarcodeInfo queryBaseBarcodeInfo = new MesBaseBarcodeInfo(); + queryBaseBarcodeInfo.setPurchaseOrderId(mesBaseBarcodeInfo.getPurchaseOrderId()); queryBaseBarcodeInfo.setMaterialId(mesBaseBarcodeInfo.getMaterialId()); queryBaseBarcodeInfo.setBarcodeType(MesConstants.MES_BARCODE_TYPE_RAW_REGULAR); List baseBarcodeInfos = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoList(queryBaseBarcodeInfo); if (baseBarcodeInfos != null && !baseBarcodeInfos.isEmpty()) { - throw new ServiceException("已经有此物料固定条码,无需重复生成"); + throw new ServiceException("已经有此采购订单物料的固定条码,无需重复生成"); } String barcodeInfo = Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode); @@ -896,16 +900,32 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService String userName = SecurityUtils.getUsername(); Date currentDate = DateUtils.getNowDate(); if (productBarcodesArr != null) { - for (String productBarcode : productBarcodesArr) { + StringBuilder materialNameBuilder = new StringBuilder(); + for (String oriProductBarcode : productBarcodesArr) { //先根据之前的成品条码信息获取托盘信息 - MesBasePalletInfo basePalletInfo = mesBasePalletInfoMapper.selectMesBasePalletInfoByBarcode(productBarcode); - MesBaseBarcodeInfo productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(productBarcode); + + MesBaseBarcodeInfo productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(oriProductBarcode); if (productBarcodeInfo == null) { - allErrorMsgBuilder.append("成品条码").append(productBarcode).append("不存在;"); - } else { - productBarcodeInfoList.add(productBarcodeInfo); + allErrorMsgBuilder.append("成品/配对码").append(oriProductBarcode).append("不存在;"); + } + + if(productBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_BIND)){ + productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(productBarcodeInfo.getBindBarcode()); + if (productBarcodeInfo == null) { + allErrorMsgBuilder.append("成品/配对码[").append(oriProductBarcode).append("]的成品不存在;"); + } + } + + productBarcodeInfoList.add(productBarcodeInfo); + MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate(); + querySaleOrderRelate.setBindBarcode(productBarcodeInfo.getBarcodeInfo()); + List mesSaleOrderRelates = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelate); + if(mesSaleOrderRelates!=null && !mesSaleOrderRelates.isEmpty()){ + allErrorMsgBuilder.append("此条码[").append(oriProductBarcode).append("]已经生成过原材料条码;"); } + + MesBasePalletInfo basePalletInfo = mesBasePalletInfoMapper.selectMesBasePalletInfoByBarcode(productBarcodeInfo.getBarcodeInfo()); //多个成品条码绑定的条码必须相同 if (basePalletInfo != null) { if (StringUtils.isEmpty(palletInfoCode)) { @@ -921,14 +941,20 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService basePalletInfoList.add(basePalletInfo); } - allErrorMsgBuilder.append(this.checkInternalMesBaseBarcode(productBarcode, productBarcodeInfo, mesBaseBarcodeInfo)); + allErrorMsgBuilder.append(this.checkInternalMesBaseBarcode(productBarcodeInfo.getBarcodeInfo(), productBarcodeInfo, mesBaseBarcodeInfo)); + + String materialName = productBarcodeInfo.getMaterialName(); + materialName = materialName.substring(0,materialNameLength); + materialNameBuilder.append(splitCharacter).append(materialName); } barcodeInfo = Seq.getId(Seq.mesInternalVirtualBarcodeSeqType, Seq.mesInternalVirtualBarcodeCode); + String mergeMaterialName = materialNameBuilder.toString().replaceFirst(splitCharacter,""); + //新建虚拟物料 - materialId = this.insertNewVirtualMaterial(barcodeInfo, userName, currentDate); + materialId = this.insertNewVirtualMaterial(barcodeInfo,mergeMaterialName, userName, currentDate); } else { MesBasePalletInfo basePalletInfo = mesBasePalletInfoMapper.selectMesBasePalletInfoByBarcode(productBarcodes); @@ -1042,6 +1068,10 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService // if (bindBarcodeRelate != null) { // allErrorMsgBuilder.append("成品条码:").append(productBarcodeInfo.getBarcodeInfo()).append("已经生成过原材料条码;"); // } + + + + //四楼到五楼,主要是多个成品合并到一个托盘后生成原材料条码需要保存以下信息,一个成品的保不保存无所谓 MesSaleOrderRelate saleOrderRelate = new MesSaleOrderRelate(); saleOrderRelate.setBarcodeInfo(barcodeInfo); @@ -1320,6 +1350,9 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService List toUpdatedMaterialBoms = new ArrayList<>(); StringBuilder errorMsgBuilder = new StringBuilder(); + int materialNameLength = 4; + String splitCharacter = "|"; + StringBuilder materialNameBuilder = new StringBuilder();//将多个物料的名称拼接(取前几个字符(materialNameLength)拼接,目前是前4个字符) for (MesSaleOrderRelate mesSaleOrderRelate : mesSaleOrderRelateList) { if (mesSaleOrderRelate.getOrderAmount() == null || mesSaleOrderRelate.getOrderAmount().compareTo(BigDecimal.ONE) != 0) { throw new ServiceException("请选择采购数量为1的采购订单信息"); @@ -1396,6 +1429,10 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService dbOrderBind.setUpdateBy(userName); mesOrderBindMapper.updateMesOrderBind(dbOrderBind); + + String materialName = mesSaleOrderRelate.getMaterialName(); + materialName = materialName.substring(0,materialNameLength); + materialNameBuilder.append(splitCharacter).append(materialName); // materialCodes.add(mesPurchaseOrderVo.getMaterialCode()); } @@ -1403,11 +1440,12 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService throw new ServiceException(errorMsgBuilder.toString()); } + String mergeMaterialName = materialNameBuilder.toString().replaceFirst(splitCharacter,""); String barcodeInfo = Seq.getId(Seq.mesPurchaseVirtualBarcodeSeqType, Seq.mesPurchaseVirtualBarcodeCode); //新建虚拟物料 - Long materialId = this.insertNewVirtualMaterial(barcodeInfo, userName, currentDate); + Long materialId = this.insertNewVirtualMaterial(barcodeInfo, mergeMaterialName,userName, currentDate); //创建虚拟销售订单,保存对应的销售订单列表 MesSaleOrder virtualSaleOrder = this.insertNewVirtualSaleOrder(materialId, barcodeInfo, mesBaseBarcodeInfo.getSaleorderCode(), mesSaleOrderRelateList, userName, currentDate); @@ -1427,6 +1465,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService toInsertedBarcodeInfo.setSaleorderCode(mesBaseBarcodeInfo.getSaleorderCode()); toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO); toInsertedBarcodeInfo.setSingleFlag(MesConstants.MES_BARCODE_SINGLE_FLAG_MERGE); + toInsertedBarcodeInfo.setAmount(new BigDecimal(mesSaleOrderRelateList.size())); // toInsertedBarcodeInfo.setBarcodeSpec(materialCodes.toString()); mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo); @@ -1447,11 +1486,11 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService } - public long insertNewVirtualMaterial(String barcodeInfo, String userName, Date currentDate) { + public long insertNewVirtualMaterial(String barcodeInfo, String materialName,String userName, Date currentDate) { //虚拟成品和虚拟原材料用一个物料 MesBaseMaterialInfo mesBaseMaterialInfo = new MesBaseMaterialInfo(); mesBaseMaterialInfo.setMaterialCode(barcodeInfo); - mesBaseMaterialInfo.setMaterialName(barcodeInfo); + mesBaseMaterialInfo.setMaterialName(materialName); mesBaseMaterialInfo.setBatchFlag(MesConstants.NOT_IS_BATCH); // mesBaseMaterialInfo.setMaterialCategories(MesConstants.MES_MATERIAL_CATEGORIES_RAW); mesBaseMaterialInfo.setActiveFlag(MesConstants.MES_MATERIAL_ALWAYS_FLAG_NO); @@ -1627,6 +1666,17 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService //修改后的合并信息 List mesSaleOrderRelateList = mesBaseBarcodeInfo.getMesSaleOrderRelateList(); + StringBuilder materialNameBuilder = new StringBuilder(); + + for(MesSaleOrderRelate mesSaleOrderRelate:mesSaleOrderRelateList){ + String materialName = mesSaleOrderRelate.getMaterialName(); + materialName = materialName.substring(0,materialNameLength); + materialNameBuilder.append(splitCharacter).append(materialName); + } + + String mergeMaterialName = materialNameBuilder.toString().replaceFirst(splitCharacter,""); + mesBaseBarcodeInfo.setAmount(new BigDecimal(mesSaleOrderRelateList.size())); + //数据库中的合并信息 MesSaleOrderRelate querySaleOrderRelateByBarcodeInfo = new MesSaleOrderRelate(); querySaleOrderRelateByBarcodeInfo.setBarcodeInfo(barcodeInfo); @@ -1697,7 +1747,13 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService } + MesBaseMaterialInfo virtualMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialId(mesBaseBarcodeInfo.getMaterialId()); + virtualMaterialInfo.setMaterialName(mergeMaterialName); + + mesBaseMaterialInfoMapper.updateMesBaseMaterialInfo(virtualMaterialInfo); + //生成条码 + mesBaseBarcodeInfo.setUpdateBy(userName); mesBaseBarcodeInfo.setUpdateTime(currentDate); @@ -1752,6 +1808,10 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService public StringBuilder handleInsertSaleOrderRelates(List toInsertedSaleOrderRelateList, MesBaseBarcodeInfo baseBarcodeInfo, MesMaterialBom virtualMaterialBom, String userName, Date currentDate) { StringBuilder errorMsgBuilder = new StringBuilder(); + if(toInsertedSaleOrderRelateList==null || toInsertedSaleOrderRelateList.isEmpty()){ + return errorMsgBuilder; + } + List toUpdatedMaterialBoms = new ArrayList<>(); for (MesSaleOrderRelate mesSaleOrderRelate : toInsertedSaleOrderRelateList) { if (mesSaleOrderRelate.getOrderAmount() == null || mesSaleOrderRelate.getOrderAmount().compareTo(BigDecimal.ONE) != 0) { @@ -2290,4 +2350,5 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService // } // // } + } 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 58108b9..25e3455 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 @@ -155,7 +155,40 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService { throw new ServiceException("此物料条码还未打印"); } - if (StringUtils.isNotEmpty(mesBaseBarcodeInfo.getPalletInfoCode()) && mesBaseBarcodeInfo.getPalletInfoCode().equals(palletInfoCode)) { + if (mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)) { + WmsWarehouseMaterial wmsWarehouseMaterial = new WmsWarehouseMaterial(); + wmsWarehouseMaterial.setStorageId(mesBaseBarcodeInfo.getMaterialId()); + R isExistWarehouseMaterial = remoteWmsService.isExistWarehouseMaterial(wmsWarehouseMaterial, SecurityConstants.INNER); + if (!isExistWarehouseMaterial.getData()) { + throw new ServiceException("此物料还没有配置仓库信息"); + } + } + + + String userName = SecurityUtils.getUsername(); + Date currentDate = new Date(); + String oriPalletInfoCode=""; + if (mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_BIND)) { + MesBaseBarcodeInfo productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(mesBaseBarcodeInfo.getBindBarcode()); + oriPalletInfoCode = productBarcodeInfo.getPalletInfoCode(); + materialBarcode = productBarcodeInfo.getBarcodeInfo(); + + + productBarcodeInfo.setPalletInfoCode(palletInfoCode); + productBarcodeInfo.setUpdateBy(userName); + productBarcodeInfo.setUpdateTime(currentDate); + mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(productBarcodeInfo); + + } else { + oriPalletInfoCode = mesBaseBarcodeInfo.getPalletInfoCode(); + mesBaseBarcodeInfo.setPalletInfoCode(palletInfoCode); + mesBaseBarcodeInfo.setUpdateBy(userName); + mesBaseBarcodeInfo.setUpdateTime(currentDate); + mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo); + } + + + if (StringUtils.isNotEmpty(oriPalletInfoCode) && oriPalletInfoCode.equals(palletInfoCode)) { throw new ServiceException("已经绑定过"); } @@ -174,26 +207,10 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService { throw new ServiceException("此物料条码存在原材料库存,不能绑定"); } - if(mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)){ - WmsWarehouseMaterial wmsWarehouseMaterial = new WmsWarehouseMaterial(); - wmsWarehouseMaterial.setStorageId(mesBaseBarcodeInfo.getMaterialId()); - R isExistWarehouseMaterial = remoteWmsService.isExistWarehouseMaterial(wmsWarehouseMaterial, SecurityConstants.INNER); - if (!isExistWarehouseMaterial.getData()) { - throw new ServiceException("此物料还没有配置仓库信息"); - } - } - - - String userName = SecurityUtils.getUsername(); - Date currentDate = new Date(); - mesBaseBarcodeInfo.setPalletInfoCode(palletInfoCode); - mesBaseBarcodeInfo.setUpdateBy(userName); - mesBaseBarcodeInfo.setUpdateTime(currentDate); - mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo); mesBasePalletInfo.setMaterialBarcode(materialBarcode); mesBasePalletInfo.setMaterialId(mesBaseBarcodeInfo.getMaterialId()); - mesBasePalletInfo.setMaterialCode(mesBasePalletInfo.getMaterialCode()); + mesBasePalletInfo.setMaterialCode(mesBaseBarcodeInfo.getMaterialCode()); mesBasePalletInfo.setMaterialName(mesBaseBarcodeInfo.getMaterialName()); mesBasePalletInfo.setUpdateBy(userName); mesBasePalletInfo.setUpdateTime(currentDate); @@ -233,7 +250,7 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService { String hostIp = IpUtils.getIpAddr(); String printKey = "print_" + hostIp; redisTemplate.opsForList().rightPush(printKey, printContentJson.toString()); - redisTemplate.expire(printKey,1, TimeUnit.DAYS); + redisTemplate.expire(printKey, 1, TimeUnit.DAYS); // redisTemplate.convertAndSend("print_10.10.3.119", printContentJson.toString()); } catch (Exception e) { throw new ServiceException("打印失败:" + e.getMessage()); 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 b04aa16..5fb554a 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,7 +101,6 @@ public class MesBaseStationInfoServiceImpl implements IMesBaseStationInfoService */ @Override public MesBaseStationInfo getLoginStationInfo() { - //TODO:正式时需要修改回来 String ipAddress = SecurityUtils.getLoginUser().getIpaddr(); // ipAddress = "192.168.2.25"; diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesImportImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesImportImpl.java index 3f0cbff..94d198d 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesImportImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesImportImpl.java @@ -386,7 +386,7 @@ public class MesImportImpl implements IMesImportService { } Cell amountCell = rowC.getCell(5); Cell brandCell = rowC.getCell(6); - if (StringUtils.isNotEmpty(materialCode)) { + if (StringUtils.isNotEmpty(materialCode) && !materialCode.equals("物料编码")) { MesBaseMaterialInfo materialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(materialCode); if (StringUtils.isNotNull(materialInfo)) { MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom(); diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesOrderBindServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesOrderBindServiceImpl.java index 328d4e6..aef2623 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesOrderBindServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesOrderBindServiceImpl.java @@ -104,4 +104,17 @@ public class MesOrderBindServiceImpl implements IMesOrderBindService { ? mesOrderBind.getSpecificationParameter().replaceAll("\\s+", "") : ""); return mesOrderBindMapper.selectMesOrderBindJoinList(mesOrderBind); } + + + + /** + * 查询采购销售订单绑定信息列表,Join product + * + * @param mesOrderBind 采购销售订单绑定信息 + * @return 采购销售订单绑定信息 + */ + @Override + public List selectMesOrderBindJoinProductList(MesOrderBind mesOrderBind) { + return mesOrderBindMapper.selectMesOrderBindJoinList(mesOrderBind); + } } 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 cd3d843..181feb3 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 @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -52,6 +53,12 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer @Autowired private MesProductOrderMapper mesProductOrderMapper; + @Autowired + private MesStatusChangeInfoMapper mesStatusChangeInfoMapper; + + @Autowired + private MesProduceStatisticsDetailMapper mesProduceStatisticsDetailMapper; + @Autowired private MesConfig mesConfig; @@ -365,7 +372,6 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer } - //如果是五楼拆分,校验是否有配对条码 if (StringUtils.isNotEmpty(mesProductPlanDetail.getProcessType()) && mesProductPlanDetail.getProcessType().equals(MesConstants.MES_PROCESS_TYPE_FIFTH_SPLIT)) { @@ -528,7 +534,8 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer @Override @Transactional(rollbackFor = Exception.class) public MesProductPlanDetail startNextMesProductPlanDetail(MesProductPlanDetail mesProductPlanDetail, String startType) { - //根据planId获取最新一条的生产计划明细 + //根据planId和userId获取最新一条的生产计划明细 + mesProductPlanDetail.setUserId(SecurityUtils.getUserId()); MesProductPlanDetail newestPlanDetail = mesProductPlanDetailMapper.selectNewestMesProductPlanDetail(mesProductPlanDetail); //如果此计划有最新的计划明细 @@ -665,14 +672,14 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer } - if (StringUtils.isNotEmpty(bindBarcodeInfo.getTransferredPlanDetailCode())) { - throw new ServiceException("此条码已经扫描使用过,不能再次使用"); - } +// if (StringUtils.isNotEmpty(bindBarcodeInfo.getTransferredPlanDetailCode())) { +// throw new ServiceException("此条码已经扫描使用过,不能再次使用"); +// } MesProductPlan barcodeProductPlan; if (bindBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_PRODUCT)) {//如果是成品码,则是4楼绑定的,需要找到5楼生成的原材料条码 - //四楼到5楼的装配开始时有可能柜体还没运输上来,还未生成原材料条码,组装出库再判断 + //四楼到5楼的装配开始时有可能柜体还没运输上来,还未生成原材料条码,组装出库再判断 // MesBaseBindBarcode mesBaseBindBarcode = mesBaseBindBarcodeMapper.selectMesBaseBindBarcodeByBindBarcode(mesBaseBarcodeInfo.getBindBarcode()); // if (mesBaseBindBarcode ==null) { // throw new ServiceException("未按成品条码生成原材料条码"); @@ -693,8 +700,16 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer if (!barcodeProductPlan.getDispatchCode().equals(dispatchCode)) { throw new ServiceException("此条码的派工单号为:" + barcodeProductPlan.getDispatchCode() + ",与此派工单号不符"); } - } + MesProductPlanDetail queryProductPlanDetail = new MesProductPlanDetail(); + queryProductPlanDetail.setMaterialBarcode(materialBarcode); + queryProductPlanDetail.setUserId(SecurityUtils.getUserId()); + List mesProductPlanDetails = mesProductPlanDetailMapper.selectMesProductPlanDetailList(queryProductPlanDetail); + if(mesProductPlanDetails!=null && !mesProductPlanDetails.isEmpty()){ + throw new ServiceException("您已经扫描此条码开始过,请勿重复扫描"); + } + + } bindBarcodeInfo.setTransferredPlanDetailCode(planDetailCode); @@ -754,7 +769,6 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer } - /** * 生产计划明细暂停 * @@ -763,13 +777,13 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer */ @Override public int productPlanDetailPause(MesProductPlanDetailPauseVo mesProductPlanDetailPauseVo) { - MesProductPlanDetail mesProductPlanDetail = mesProductPlanDetailMapper.selectMesProductPlanDetailByPlanDetailId(mesProductPlanDetailPauseVo.getPlanDetailId()) ; + MesProductPlanDetail mesProductPlanDetail = mesProductPlanDetailMapper.selectMesProductPlanDetailByPlanDetailId(mesProductPlanDetailPauseVo.getPlanDetailId()); String planDetailStatus = mesProductPlanDetail.getPlanDetailStatus(); // 明细状态:1-未开始;2-已开始;3-已完成;4-暂停,9-异常完成(校验物料信息不完整) //已开始的可以改为暂停 - if(!planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_STARTED)){ + if (!planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_STARTED)) { String planDetailStatusPrompt = MesConstants.PLAN_DETAIL_STATUS_PROMPT_MAP.get(planDetailStatus); throw new ServiceException(String.format("此生产计划明细已经%s,不能暂停!", planDetailStatusPrompt)); } @@ -781,7 +795,6 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer } - /** * 生产计划明细继续 * @@ -790,13 +803,13 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer */ @Override public int productPlanDetailContinue(MesProductPlanDetailPauseVo mesProductPlanDetailPauseVo) { - MesProductPlanDetail mesProductPlanDetail = mesProductPlanDetailMapper.selectMesProductPlanDetailByPlanDetailId(mesProductPlanDetailPauseVo.getPlanDetailId()) ; + MesProductPlanDetail mesProductPlanDetail = mesProductPlanDetailMapper.selectMesProductPlanDetailByPlanDetailId(mesProductPlanDetailPauseVo.getPlanDetailId()); String planDetailStatus = mesProductPlanDetail.getPlanDetailStatus(); // 明细状态:1-未开始;2-已开始;3-已完成;4-暂停,9-异常完成(校验物料信息不完整) //已开始的可以改为暂停 - if(!planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_PAUSE)){ + if (!planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_PAUSE)) { String planDetailStatusPrompt = MesConstants.PLAN_DETAIL_STATUS_PROMPT_MAP.get(planDetailStatus); throw new ServiceException(String.format("此生产计划明细已经%s,不能继续!", planDetailStatusPrompt)); } @@ -807,4 +820,86 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer return mesProductPlanDetailMapper.updateMesProductPlanDetail(mesProductPlanDetail); } + + /** + * 生成生产计划明细统计表 + * @param time + */ + @Override + public void generateProduceStatisticsDetail(String time) { + MesProductPlanDetail queryProductPlandetail = new MesProductPlanDetail(); + queryProductPlandetail.setPlanDetailStatus(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_FINISH); + queryProductPlandetail.setStatisticsFlag("1"); + List mesProductPlanDetailList = mesProductPlanDetailMapper.selectMesProductPlanDetailList4Statistics(queryProductPlandetail); + + for (MesProductPlanDetail mesProductPlanDetail : mesProductPlanDetailList) { + MesProductPlan mesProductPlan = mesProductPlanMapper.selectOnlyMesProductPlanByPlanId(mesProductPlanDetail.getPlanId()); + + //易耗品标识,分摊到各个生产计划明细中 + + + //计算工时 + Date realBeginTime = mesProductPlanDetail.getRealBeginTime(); + Date realEndTime = mesProductPlanDetail.getRealEndTime(); + Long produceTime = realEndTime.getTime()-realBeginTime.getTime(); + + MesStatusChangeInfo queryStatusChangeInfo = new MesStatusChangeInfo(); + queryStatusChangeInfo.setProductOrderId(mesProductPlan.getProductOrderId()); + queryStatusChangeInfo.setPlanDetailId(mesProductPlanDetail.getPlanDetailId()); + List mesStatusChangeInfoList = mesStatusChangeInfoMapper.selectMesStatusChangeInfoListByProduce(queryStatusChangeInfo); + +// Optional result = mesStatusChangeInfoList.stream() +// .filter(msci -> (StringUtils.isEmpty(msci.getOldStatus()) && msci.getNewStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_STARTED)) +// || StringUtils.isNotEmpty(msci.getOldStatus()) && msci.getOldStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED) +// && msci.getNewStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_STARTED)) +// .findFirst(); +// if(result.isPresent()){ +// MesStatusChangeInfo startStatus = result.get(); +// } + + List pause2StartOrFinishChangeInfoList = mesStatusChangeInfoList.stream() + .filter(msci -> StringUtils.isNotEmpty(msci.getOldStatus()) && ((msci.getOldStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_PAUSE) + && msci.getNewStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_STARTED)) + || (msci.getOldStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_PAUSE) + && msci.getNewStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_FINISH)))).collect(Collectors.toList()); + + List start2PauseChangeInfoList = mesStatusChangeInfoList.stream() + .filter(msci -> StringUtils.isNotEmpty(msci.getOldStatus()) && (msci.getOldStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_STARTED) + && msci.getNewStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_PAUSE))).collect(Collectors.toList()); + + if (pause2StartOrFinishChangeInfoList.size() == start2PauseChangeInfoList.size()) { + for (int i = 0; i < pause2StartOrFinishChangeInfoList.size(); i++) { + MesStatusChangeInfo pause2StartOrFinishChangeInfo = pause2StartOrFinishChangeInfoList.get(i); + MesStatusChangeInfo start2PauseChangeInfo = start2PauseChangeInfoList.get(i); + Long startOrFinshChangeTimeL = pause2StartOrFinishChangeInfo.getChangeTime().getTime(); + Long pauseChangeTimeL = start2PauseChangeInfo.getChangeTime().getTime(); + produceTime = produceTime -(startOrFinshChangeTimeL-pauseChangeTimeL); + } + } + + + MesProduceStatisticsDetail mesProduceStatisticsDetail = new MesProduceStatisticsDetail(); + mesProduceStatisticsDetail.setProductOrderId(mesProductPlan.getProductOrderId()); + mesProduceStatisticsDetail.setSaleOrderId(mesProductPlan.getSaleOrderId()); + mesProduceStatisticsDetail.setSaleorderCode(mesProductPlan.getSaleorderCode()); + mesProduceStatisticsDetail.setPlanId(mesProductPlanDetail.getPlanId()); + mesProduceStatisticsDetail.setPlanCode(mesProductPlan.getPlanCode()); + mesProduceStatisticsDetail.setPlanDetailId(mesProductPlanDetail.getPlanDetailId()); + mesProduceStatisticsDetail.setPlanDetailCode(mesProductPlanDetail.getPlanDetailCode()); + mesProduceStatisticsDetail.setProductId(mesProductPlan.getMaterialId()); + mesProduceStatisticsDetail.setUserId(mesProductPlanDetail.getUserId()); + mesProduceStatisticsDetail.setNickName(mesProductPlanDetail.getNickName()); + mesProduceStatisticsDetail.setProcessId(mesProductPlan.getProcessId()); + mesProduceStatisticsDetail.setProcessName(mesProductPlan.getProcessName()); + mesProduceStatisticsDetail.setPlanBeginTime(mesProductPlan.getPlanBeginTime()); + mesProduceStatisticsDetail.setPlanEndTime(mesProductPlan.getRealEndTime()); + mesProduceStatisticsDetail.setRealBeginTime(realBeginTime); + mesProduceStatisticsDetail.setRealEndTime(realEndTime); + mesProduceStatisticsDetail.setProduceTime(produceTime); + mesProduceStatisticsDetail.setCreateTime(new Date()); + + mesProduceStatisticsDetailMapper.insertMesProduceStatisticsDetail(mesProduceStatisticsDetail); + + } + } } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java index b2f004d..6366011 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java @@ -585,4 +585,16 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { public MesPurchaseOrder selectPurchaseOrderJoinSupplierProjectByOrderId(Long purchaseOrderId) { return mesPurchaseOrderMapper.selectPurchaseOrderJoinSupplierProjectByOrderId(purchaseOrderId); } + + + /** + * 查询采购订单信息,join material + * + * @param purchaseOrderId 采购订单信息主键 + * @return 采购订单信息 + */ + @Override + public MesPurchaseOrder selectMesPurchaseOrderJoinMaterialByPurchaseOrderId(Long purchaseOrderId) { + return mesPurchaseOrderMapper.selectMesPurchaseOrderJoinMaterialByPurchaseOrderId(purchaseOrderId); + } } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesSaleOrderServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesSaleOrderServiceImpl.java index 1a406dd..bc27049 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesSaleOrderServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesSaleOrderServiceImpl.java @@ -1,6 +1,7 @@ package com.hw.mes.service.impl; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -11,7 +12,9 @@ import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.api.domain.MesSaleOrderRelate; import com.hw.mes.api.domain.vo.MesBaseBarcodeInfoTransferVo; import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo; +import com.hw.mes.domain.MesMaterialBom; import com.hw.mes.mapper.MesBaseBarcodeInfoMapper; +import com.hw.mes.mapper.MesMaterialBomMapper; import com.hw.mes.mapper.MesSaleOrderRelateMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -37,6 +40,9 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService { @Autowired private MesSaleOrderRelateMapper mesSaleOrderRelateMapper; + @Autowired + private MesMaterialBomMapper mesMaterialBomMapper; + /** * 查询销售订单信息 * @@ -116,7 +122,36 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService { public List selectMesSaleOrderJoinMaterialList(MesSaleOrder mesSaleOrder) { mesSaleOrder.setMaterialSpec(StringUtils.isNotEmpty(mesSaleOrder.getMaterialSpec()) ? mesSaleOrder.getMaterialSpec().replaceAll("\\s+", "") : ""); - return mesSaleOrderMapper.selectMesSaleOrderJoinMaterialList(mesSaleOrder); + if (mesSaleOrder.getMaterialId() != null) { + MesMaterialBom queryMaterialBom = new MesMaterialBom(); + queryMaterialBom.setMaterialId(mesSaleOrder.getMaterialId()); + List mesMaterialBoms = mesMaterialBomMapper.selectMesMaterialBomList(queryMaterialBom); + if (mesMaterialBoms != null && !mesMaterialBoms.isEmpty()) { + StringBuilder parentIdsBuilder = new StringBuilder(); + for (MesMaterialBom mesMaterialBom : mesMaterialBoms) { + String ancestors = mesMaterialBom.getAncestors(); + int commaIndex = ancestors.indexOf(","); + if (commaIndex >= 0) { + String ancestorPostfix = ancestors.substring(commaIndex + 1); + commaIndex = ancestorPostfix.indexOf(","); + if (commaIndex >= 0) { + ancestorPostfix = ancestorPostfix.substring(commaIndex + 1); + } + parentIdsBuilder.append(",").append(ancestorPostfix); + } + + } + + String parentIds = parentIdsBuilder.toString().replaceFirst(",", ""); + mesSaleOrder.setParentIds(parentIds); + return mesSaleOrderMapper.selectMesSaleOrderJoinMaterialList(mesSaleOrder); + } else { + return new ArrayList<>(); + } + + } else { + return mesSaleOrderMapper.selectMesSaleOrderJoinMaterialList(mesSaleOrder); + } } @@ -173,11 +208,12 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService { /** * 根据relatesaleorderId查询关联的成品信息 + * * @param saleOrderId * @return */ @Override - public List getRelateProductsBySaleOrderId(Long saleOrderId){ + public List getRelateProductsBySaleOrderId(Long saleOrderId) { MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate(); querySaleOrderRelate.setSaleOrderId(saleOrderId); return mesSaleOrderRelateMapper.selectMesSaleOrderRelateJoinProductList(querySaleOrderRelate); @@ -185,16 +221,16 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService { /** * 根据relatesaleorderId查询关联的原材料信息 + * * @param saleOrderId * @return */ @Override - public List selectMesSaleOrderRelateJoinList(Long saleOrderId){ + public List selectMesSaleOrderRelateJoinList(Long saleOrderId) { MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate(); querySaleOrderRelate.setSaleOrderId(saleOrderId); return mesSaleOrderRelateMapper.selectMesSaleOrderRelateJoinList(querySaleOrderRelate); } - } 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 7bb000b..3efb368 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 @@ -103,6 +103,7 @@ and bbi.print_time = #{printTime} + and bbi.purchase_order_id = #{purchaseOrderId} and bbi.print_person = #{printPerson} and bbi.print_flag = #{printFlag} and bbi.batch_flag = #{batchFlag} diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesOrderBindMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesOrderBindMapper.xml index 8b4482a..8325705 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesOrderBindMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesOrderBindMapper.xml @@ -169,4 +169,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by mob.order_bind_id desc + + + + + + \ No newline at end of file diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProduceStatisticsDetailMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProduceStatisticsDetailMapper.xml new file mode 100644 index 0000000..f2b2960 --- /dev/null +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProduceStatisticsDetailMapper.xml @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select statistics_detail_id, product_order_id, sale_order_id, saleorder_code, plan_id, plan_code, plan_detail_id, plan_detail_code, product_id, product_code, product_name, product_spec, user_id, nick_name, process_id, process_name, plan_begin_time, plan_end_time, real_begin_time, real_end_time, produce_time, create_time from mes_produce_statistics_detail + + + + + + + + insert into mes_produce_statistics_detail + + product_order_id, + sale_order_id, + saleorder_code, + plan_id, + plan_code, + plan_detail_id, + plan_detail_code, + product_id, + product_code, + product_name, + product_spec, + user_id, + nick_name, + process_id, + process_name, + plan_begin_time, + plan_end_time, + real_begin_time, + real_end_time, + produce_time, + create_time, + + + #{productOrderId}, + #{saleOrderId}, + #{saleorderCode}, + #{planId}, + #{planCode}, + #{planDetailId}, + #{planDetailCode}, + #{productId}, + #{productCode}, + #{productName}, + #{productSpec}, + #{userId}, + #{nickName}, + #{processId}, + #{processName}, + #{planBeginTime}, + #{planEndTime}, + #{realBeginTime}, + #{realEndTime}, + #{produceTime}, + #{createTime}, + + + + + update mes_produce_statistics_detail + + product_order_id = #{productOrderId}, + sale_order_id = #{saleOrderId}, + saleorder_code = #{saleorderCode}, + plan_id = #{planId}, + plan_code = #{planCode}, + plan_detail_id = #{planDetailId}, + plan_detail_code = #{planDetailCode}, + product_id = #{productId}, + product_code = #{productCode}, + product_name = #{productName}, + product_spec = #{productSpec}, + user_id = #{userId}, + nick_name = #{nickName}, + process_id = #{processId}, + process_name = #{processName}, + plan_begin_time = #{planBeginTime}, + plan_end_time = #{planEndTime}, + real_begin_time = #{realBeginTime}, + real_end_time = #{realEndTime}, + produce_time = #{produceTime}, + create_time = #{createTime}, + + where statistics_detail_id = #{statisticsDetailId} + + + + delete from mes_produce_statistics_detail where statistics_detail_id = #{statisticsDetailId} + + + + delete from mes_produce_statistics_detail where statistics_detail_id in + + #{statisticsDetailId} + + + + + delete from mes_produce_statistics_detail_material where statistics_detail_id in + + #{statisticsDetailId} + + + + + delete from mes_produce_statistics_detail_material where statistics_detail_id = #{statisticsDetailId} + + + + insert into mes_produce_statistics_detail_material( statistics_detail_material_id, statistics_detail_id, material_id, material_code, material_name, material_spec, used_amount) values + + ( #{item.statisticsDetailMaterialId}, #{item.statisticsDetailId}, #{item.materialId}, #{item.materialCode}, #{item.materialName}, #{item.materialSpec}, #{item.usedAmount}) + + + \ No newline at end of file diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanDetailMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanDetailMapper.xml index c5e8f73..a668ada 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanDetailMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanDetailMapper.xml @@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -43,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and real_end_time = #{realEndTime} and plan_detail_status = #{planDetailStatus} and is_flag = #{isFlag} + and material_barcode = #{materialBarcode} order by plan_detail_status asc,plan_detail_id desc @@ -138,6 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" real_begin_time, real_end_time, plan_detail_status from mes_product_plan_detail mppd + and user_id = #{userId} and plan_id = #{planId} and exists (select 1 from mes_product_plan mpp where mppd.plan_id=mpp.plan_id and mpp.station_id=#{stationId}) @@ -166,4 +169,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where material_barcode = #{materialBarcode} + + + + + + + + + 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 bd093e2..f14955d 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 @@ -546,4 +546,42 @@ + + + + diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml index dde12f3..4faf53c 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml @@ -299,7 +299,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and mpo.specification_parameter like concat('%', #{specificationParameter}, '%') and mbmi.material_spec like concat('%', #{materialSpec}, '%') and mbmi.always_flag = #{alwaysFlag} - + and exists (select 1 from mes_material_bom mmb where mmb.erp_material_id=mpo.material_id and mmb.ancestors like concat('0,', #{materialBomId}, '%') ) order by mpo.erp_modify_date desc,mpo.po_no ,mpo.material_name @@ -474,7 +474,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and replace(pbmi.material_spec,' ','') like concat('%', #{productSpec}, '%') - order by mpo.po_no + order by mpo.create_time desc @@ -498,4 +498,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where a.purchase_order_id = #{purchaseOrderId} + + + + + + + diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml index eeed4a6..ac50833 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml @@ -270,7 +270,7 @@ and mso.sale_order_classfication = #{saleOrderClassfication} and exists (select 1 from mes_sale_order_relate msor where mso.sale_order_id = msor.relate_sale_order_id and msor.sale_order_id=#{virtualSaleOrderId}) and not exists (select 1 from mes_sale_order_relate msor where mso.sale_order_id = msor.relate_sale_order_id) - + and exists (select 1 from mes_material_bom mmb where mmb.erp_material_id=mso.material_id and mmb.material_bom_id in (${parentIds})) order by mso.erp_modify_date desc diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderRelateMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderRelateMapper.xml index d0790d3..b66cbbe 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderRelateMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderRelateMapper.xml @@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and barcode_info = #{barcodeInfo} + and bind_barcode = #{bindBarcode} and sale_order_id = #{saleOrderId} and relate_sale_order_id = #{relateSaleOrderId} and purchase_order_id = #{purchaseOrderId} diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesStatusChangeInfoMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesStatusChangeInfoMapper.xml new file mode 100644 index 0000000..7c1a54c --- /dev/null +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesStatusChangeInfoMapper.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + select status_change_info_id, change_type, change_id, old_status, new_status, change_by, change_time from mes_status_change_info + + + + + + + + insert into mes_status_change_info + + change_type, + change_id, + old_status, + new_status, + change_by, + change_time, + + + #{changeType}, + #{changeId}, + #{oldStatus}, + #{newStatus}, + #{changeBy}, + #{changeTime}, + + + + + update mes_status_change_info + + change_type = #{changeType}, + change_id = #{changeId}, + old_status = #{oldStatus}, + new_status = #{newStatus}, + change_by = #{changeBy}, + change_time = #{changeTime}, + + where status_change_info_id = #{statusChangeInfoId} + + + + delete from mes_status_change_info where status_change_info_id = #{statusChangeInfoId} + + + + delete from mes_status_change_info where status_change_info_id in + + #{statusChangeInfoId} + + + + + + + \ No newline at end of file diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawReturn.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawReturn.java index b576ca4..cae3335 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawReturn.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawReturn.java @@ -139,6 +139,9 @@ public class WmsRawReturn extends BaseEntity private String productName; + private String executeStatusStr; + + /** 原材料退库记录明细信息 */ private List wmsRawReturnDetailList; @@ -437,6 +440,14 @@ public class WmsRawReturn extends BaseEntity this.productName = productName; } + public String getExecuteStatusStr() { + return executeStatusStr; + } + + public void setExecuteStatusStr(String executeStatusStr) { + this.executeStatusStr = executeStatusStr; + } + @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/service/impl/WmsProductInstockServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductInstockServiceImpl.java index cb39a05..d00fabc 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 @@ -201,7 +201,7 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { throw new RuntimeException("没有绑定的成品条码信息!"); } - for(MesBaseBindBarcode baseBindBarcode:baseBindBarcodeList){ + for (MesBaseBindBarcode baseBindBarcode : baseBindBarcodeList) { this.saveWmsProductInstock(baseLocation.getWarehouseId(), locationCode, baseBarcodeInfo.getPlanCode(), baseBarcodeInfo.getPlanDetailCode(), null, baseBindBarcode.getProductId(), userName, currentDate); @@ -417,14 +417,32 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { * @return */ public int produceInstock(MesBaseBarcodeInfo baseBarcodeInfo, Long warehouseId, String productType, String operationType, String executeStatus, Long warehouseFloor) { - //半成品入库按原材料入库的柜体原料码进行入库 if (productType.equals(WmsConstants.PRODUCT_INSTOCK_STOCK_TYPE_SEMI)) { if (!baseBarcodeInfo.getBarcodeType().equals(WmsConstants.RWA_STOCK_STOCK_TYPE_RAW)) { throw new ServiceException("请按原材料柜体条码入库"); } - } else {//其他按成品条码入库 - if (!baseBarcodeInfo.getBarcodeType().equals(WmsConstants.RWA_STOCK_STOCK_TYPE_PRODUCT)) { + } else {//其他按成品条码入库(四楼对内生产的可以按配对码入库) + String barcodeType = baseBarcodeInfo.getBarcodeType(); + //判断条码信息如果是配对码,则需要通过配对码找成品条码入库 + if (barcodeType.equals(MesConstants.MES_BARCODE_TYPE_BIND)) { + String productBarcode = baseBarcodeInfo.getBindBarcode(); + R productBarcodeInfoR = remoteMesService.getBarcode(productBarcode, SecurityConstants.INNER); + if (productBarcodeInfoR == null) { + throw new ServiceException("没找到成品条码"); + } + MesBaseBarcodeInfo productBarcodeInfo = productBarcodeInfoR.getData(); + if (productBarcodeInfo == null) { + throw new ServiceException("没找到成品条码!"); + } + baseBarcodeInfo.setBarcodeInfo(productBarcodeInfo.getBarcodeInfo()); + baseBarcodeInfo.setPlanCode(productBarcodeInfo.getPlanCode()); + baseBarcodeInfo.setPlanDetailCode(productBarcodeInfo.getPlanDetailCode()); + baseBarcodeInfo.setBatchCode(productBarcodeInfo.getBatchCode()); + + } else if (barcodeType.equals(WmsConstants.RWA_STOCK_STOCK_TYPE_PRODUCT)) { + + } else { throw new ServiceException("请按成品条码入库"); } } @@ -433,19 +451,19 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { throw new ServiceException("此条码还未打印"); } - //如果执行状态不是已完成,是agv入库,则需要判断是否有入库记录,避免重复提交;如果执行状态是已完成(人工入库),则判断是否有此成品条码库存即可 - if (!executeStatus.equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) { - WmsProductInstock queryProductInstock = new WmsProductInstock(); - queryProductInstock.setProductBatch(baseBarcodeInfo.getBarcodeInfo());//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("已经有此成品入库记录"); - } - } + //判断是否已经入过库,不能重复入库 +// if (!executeStatus.equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) { + WmsProductInstock queryProductInstock = new WmsProductInstock(); + queryProductInstock.setProductBatch(baseBarcodeInfo.getBarcodeInfo());//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(); @@ -477,7 +495,6 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { } - /** * 查询成品入库记录;成品入库记录列表,join material * 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 68600c9..935fcd5 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 @@ -272,8 +272,8 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService } List unConfirmedProductOutstockDetailList = wmsProductOutstockDetailList.stream(). - filter(wpod ->!wpod.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_CONFIRM)).collect(Collectors.toList()); - if(unConfirmedProductOutstockDetailList==null || unConfirmedProductOutstockDetailList.isEmpty()){ + filter(wpod -> !wpod.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_CONFIRM)).collect(Collectors.toList()); + if (unConfirmedProductOutstockDetailList == null || unConfirmedProductOutstockDetailList.isEmpty()) { throw new ServiceException("没有待确认成品出库信息"); } @@ -317,13 +317,6 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService Long warehouseId = wmsProduceInstockVo.getWarehouseId(); String materialBarcode = wmsProduceInstockVo.getMaterialBarcode(); - WmsProductStock productStock = wmsProductStockMapper.selectProductStockByBatch(materialBarcode); - BigDecimal availableAmount = getAvailableAmount(productStock); //可申请数量 - - if (availableAmount.compareTo(BigDecimal.ONE) < 0) { - throw new ServiceException("没有库存信息"); - } - R mesBaseBarcodeInfoData = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); if (mesBaseBarcodeInfoData == null) { throw new ServiceException("物料条码有误"); @@ -332,6 +325,37 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService if (mesBaseBarcodeInfo == null) { throw new ServiceException("物料条码有误!"); } + + String barcodeType = mesBaseBarcodeInfo.getBarcodeType(); + //判断条码信息如果是配对码,则需要通过配对码找成品条码入库 + if (barcodeType.equals(MesConstants.MES_BARCODE_TYPE_BIND)) { + String productBarcode = mesBaseBarcodeInfo.getBindBarcode(); + R productBarcodeInfoR = remoteMesService.getBarcode(productBarcode, SecurityConstants.INNER); + if (productBarcodeInfoR == null) { + throw new ServiceException("没找到成品条码"); + } + MesBaseBarcodeInfo productBarcodeInfo = productBarcodeInfoR.getData(); + if (productBarcodeInfo == null) { + throw new ServiceException("没找到成品条码!"); + } + mesBaseBarcodeInfo.setBarcodeInfo(productBarcodeInfo.getBarcodeInfo()); + mesBaseBarcodeInfo.setBatchCode(productBarcodeInfo.getBatchCode()); + mesBaseBarcodeInfo.setPlanCode(productBarcodeInfo.getPlanCode()); + mesBaseBarcodeInfo.setPlanDetailCode(productBarcodeInfo.getPlanDetailCode()); + + } else if (barcodeType.equals(WmsConstants.RWA_STOCK_STOCK_TYPE_PRODUCT)) { + + } else { + throw new ServiceException("请按成品条码入库"); + } + + WmsProductStock productStock = wmsProductStockMapper.selectProductStockByBatch(mesBaseBarcodeInfo.getBarcodeInfo()); + BigDecimal availableAmount = getAvailableAmount(productStock); //可申请数量 + + if (availableAmount.compareTo(BigDecimal.ONE) < 0) { + throw new ServiceException("没有库存信息"); + } + Long materialId = mesBaseBarcodeInfo.getMaterialId(); Long saleOrderId = mesBaseBarcodeInfo.getSaleOrderId(); String saleorderCode = mesBaseBarcodeInfo.getSaleorderCode(); @@ -343,7 +367,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService String userName = SecurityUtils.getUsername(); Date currentDate = new Date(); - Long productOutstockId=null; + Long productOutstockId = null; //如果是直接出库 if (outRequirement.equals(WmsConstants.WMS_WAREHOUSE_OUT_REQUIREMENT_DIRECT)) { WmsProductOutstock wmsProductOutstock = new WmsProductOutstock(); @@ -392,7 +416,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService } List auditPassProductOutstocks = saleProductOutstocks.stream().filter(wmsProductOutstock -> - wmsProductOutstock.getAuditStatus().equals(WmsConstants.WMS_AUDIT_STATUS_PASS) + wmsProductOutstock.getAuditStatus().equals(WmsConstants.WMS_AUDIT_STATUS_PASS) ).collect(Collectors.toList()); if (auditPassProductOutstocks == null || auditPassProductOutstocks.isEmpty()) { throw new ServiceException("此销售订单[" + saleorderCode + "]的成品出库申请未审核通过"); @@ -410,7 +434,6 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService } - //更新出库记录 if (applyQty.compareTo(currentOutstockQty) == 0) { productOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH); @@ -425,6 +448,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService } productOutstock.setUpdateDate(currentDate); productOutstock.setUpdateBy(userName); + productOutstock.setProductBatch(materialBarcode); wmsProductOutstockMapper.updateWmsProductOutstock(productOutstock); wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStock.getProductStockId()); diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java index 8c96917..e2714f5 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java @@ -309,7 +309,7 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { // throw new ServiceException("输入数量需为1"); // } // } - if(!wmsRawReturn.getMaterialId().equals(mesBaseBarcodeInfo.getMaterialId())){ + if (!wmsRawReturn.getMaterialId().equals(mesBaseBarcodeInfo.getMaterialId())) { throw new ServiceException("退库物料不匹配"); } @@ -488,6 +488,16 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { String taskCode = Seq.getId(Seq.rawReturnSeqType, Seq.rawReturnCode); for (WmsRawReturn rawReturn : wmsRawReturns) { + if (baseWarehouse.getWarehouseFloor().equals(5L)) { + WmsRawReturn queryRawReturn = new WmsRawReturn(); + queryRawReturn.setEndStationCode(rawReturn.getEndStationCode()); + queryRawReturn.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE + "," + WmsConstants.WMS_EXECUTE_STATUS_EXECUTING); + List wmsRawReturnList = wmsRawReturnMapper.selectWmsRawReturnList(queryRawReturn); + if (wmsRawReturnList != null && !wmsRawReturnList.isEmpty()) { + throw new ServiceException("此工位还有未完成的退库物料"); + } + } + BigDecimal planAmount = rawReturn.getPlanAmount(); if (planAmount.compareTo(BigDecimal.ZERO) <= 0) { throw new ServiceException("数量需大于0"); @@ -508,7 +518,6 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { } - // /** // * 申请退库 // * @@ -656,6 +665,7 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { /** * 查询原材料退库记录 * 审核按钮查询 + * * @param taskCode 原材料退库记录任务编号 * @return 原材料退库记录审核返回VO对象 */ @@ -665,7 +675,7 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { WmsRawReturn queryRawReturn = new WmsRawReturn(); queryRawReturn.setTaskCode(taskCode); List wmsRawReturnList = wmsRawReturnMapper.selectGetRawReturnByTaskCode(queryRawReturn); - if (wmsRawReturnList.size() > 0){ + if (wmsRawReturnList.size() > 0) { WmsRawReturn wmsRawReturn = wmsRawReturnList.get(0); wmsRawReturnAuditReturnVo.setWmsRawReturn(wmsRawReturn); wmsRawReturnAuditReturnVo.setWmsRawReturnDetailList(wmsRawReturnList); 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 cb9501e..a1df380 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 @@ -226,6 +226,12 @@ public class WmsTransferServiceImpl implements IWmsTransferService { throw new ServiceException("库位不存在"); } + WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(oriLocation.getWarehouseId()); + if(!baseWarehouse.getWarehouseInstockType().equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_SEMI)){ + throw new ServiceException("请从半成品库出库"); + } + + //删除成品库存 WmsProductStock productStock = wmsProductStockMapper.selectProductStockByBatch(materialBarcode); if (productStock == null) { @@ -307,6 +313,11 @@ public class WmsTransferServiceImpl implements IWmsTransferService { throw new ServiceException("库位不存在"); } + WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(targetLocation.getWarehouseId()); + if(!baseWarehouse.getWarehouseInstockType().equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_PRODUCT)){ + throw new ServiceException("请入成品库"); + } + WmsProductStock queryProductStock = new WmsProductStock(); queryProductStock.setLocationCode(targetLocationCode); List productStocks = wmsProductStockMapper.selectOnlyWmsProductStockInList(queryProductStock); 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 637a106..bfa9bd0 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 @@ -74,7 +74,7 @@ and wps.location_code = #{locationCode} and wps.stock_type = #{stockType} and wps.stock_type in ('2','3') - and wps.product_batch = #{productBatch} + and wps.product_batch like concat('%', #{productBatch}, '%') and wps.quality_status = #{qualityStatus} and wps.product_id = #{productId} and wps.plan_code = #{planCode} diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawReturnMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawReturnMapper.xml index eb88af8..0ba066c 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawReturnMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawReturnMapper.xml @@ -88,6 +88,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and audit_reason = #{auditReason} and audit_status = #{auditStatus} and execute_status = #{executeStatus} + and execute_status in (${executeStatusStr}) + and end_station_code = #{endStationCode} and apply_by = #{applyBy} and apply_date = #{applyDate} and audit_by = #{auditBy} diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawStockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawStockMapper.xml index a60e62e..e50a1e4 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawStockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawStockMapper.xml @@ -334,7 +334,8 @@ '%') and mso.saleorder_code like concat('%', #{saleorderCode}, '%') - and wrs.instock_batch = #{instockBatch} + and wrs.instock_batch like concat('%', #{instockBatch}, + '%') and wrs.instock_date = #{instockDate} and wrs.last_outstock_time = #{lastOutstockTime} and wrs.quality_status = #{qualityStatus} diff --git a/hw-ui/src/api/mes/purchaseOrder.js b/hw-ui/src/api/mes/purchaseOrder.js index 0d33d5c..0cdd799 100644 --- a/hw-ui/src/api/mes/purchaseOrder.js +++ b/hw-ui/src/api/mes/purchaseOrder.js @@ -138,3 +138,23 @@ export function getPurchaseOrdersWithBind(query) { params: query }) } + + +// 获取生产bom List +export function getMaterialBoms(query) { + return request({ + url: '/mes/purchaseOrder/getMaterialBoms', + method: 'get', + params: query + }) +} + + +// 查询采购订单信息列表 +export function getOrderBinds(query) { + return request({ + url: '/mes/purchaseOrder/getOrderBinds', + method: 'get', + params: query + }) +} diff --git a/hw-ui/src/views/board/barcode/workshopBarcode.vue b/hw-ui/src/views/board/barcode/workshopBarcode.vue index 3a06609..c18db25 100644 --- a/hw-ui/src/views/board/barcode/workshopBarcode.vue +++ b/hw-ui/src/views/board/barcode/workshopBarcode.vue @@ -125,7 +125,6 @@ - - - + + @@ -290,10 +289,13 @@ import { checkSemiOutstock, reprintBarcodes } from "@/api/board/barcode"; +import {monitorSerialData} from "@/utils/serial" +import {noticeData} from "@/utils/notice"; export default { name: "Barcode", dicts: ['bind_status', 'active_flag', 'barcode_type', 'mes_print_flag'], + mixins: [monitorSerialData], data() { return { // 遮罩层 @@ -511,7 +513,7 @@ export default { planDetailCode: this.defineData.planDetailCode, singleFlag: this.defineData.singleFlag, saleOrderId: this.defineData.saleOrderId, - productId:this.defineData.productId, + productId: this.defineData.productId, batchFlag: '0', bindBarcode: bindBarcode, barcodeType: "", @@ -524,7 +526,7 @@ export default { planId: this.defineData.planId, planCode: this.defineData.planCode, planDetailCode: this.defineData.planDetailCode, - productId : this.defineData.productId, + productId: this.defineData.productId, saleOrderId: this.defineData.saleOrderId, saleorderCode: this.defineData.saleorderCode, materialBomId: this.defineData.materialBomId, @@ -535,6 +537,26 @@ export default { this.queryParams.planDetailCode = this.defineData.planDetailCode; this.queryParams.singleFlag = this.SINGLE_FLAG.INTERNAL; this.queryParams.barcodeType = this.BARCODE_TYPE.RAW; + + // if (!this.checkSerialConnected()) { + // this.$confirm('请连接条码枪', '提示', { + // confirmButtonText: '连接', + // showClose: true, + // // beforeClose:async(action,instance,done)=>{ + // // if(action==='confirm'){ + // // }else{ + // // this.connectSerialPort(); + // // } + // // + // // }, + // showCancelButton: true, + // type: 'warning' + // }).then(() => { + // this.connectSerial(this.setSerialData); + // }).catch(() => { + // }); + // } + } }, @@ -917,6 +939,19 @@ export default { }, + setSerialData() { + + if (this.internalForm.productBarcode && this.internalForm.productBarcode !== '') { + this.internalForm.productBarcode = "," + this.serialData; + } else { + this.internalForm.productBarcode = this.serialData; + } + + + // console.log(this.serialData) + }, + + } }; diff --git a/hw-ui/src/views/board/common/applyRawReturn.vue b/hw-ui/src/views/board/common/applyRawReturn.vue index 16a8c5f..ba7fd3a 100644 --- a/hw-ui/src/views/board/common/applyRawReturn.vue +++ b/hw-ui/src/views/board/common/applyRawReturn.vue @@ -27,9 +27,10 @@ - 物料信息 + 物料信息 - + 新增 @@ -40,6 +41,7 @@ :header-cell-style="{textAlign:'center'}" max-height="19.13vw" style="width: 100%;" + v-if="materialVisible" > { if (valid) { - if (this.wmsRawReturnList.length <= 0) { - this.$modal.msgWarning("请选择要退库的物料"); - return; - } - - for (const wmsRawReturn of this.wmsRawReturnList) { - if(wmsRawReturn.planAmount <=0){ - this.$modal.msgWarning("退库数量需大于0"); + if (this.form.warehouseFloor === 5) { + this.form.planAmount = 1; + this.wmsRawReturnList.push(this.form); + } else { + if (this.wmsRawReturnList.length <= 0) { + this.$modal.msgWarning("请选择要退库的物料"); return; } - wmsRawReturn.applyReason = this.form.applyReason; - wmsRawReturn.taskType = this.form.taskType; + + for (const wmsRawReturn of this.wmsRawReturnList) { + if (wmsRawReturn.planAmount <= 0) { + this.$modal.msgWarning("退库数量需大于0"); + return; + } + wmsRawReturn.applyReason = this.form.applyReason; + wmsRawReturn.taskType = this.form.taskType; + } } this.submitloading = true; @@ -358,7 +369,6 @@ export default { }, - } }; diff --git a/hw-ui/src/views/board/fifthFloor/index.vue b/hw-ui/src/views/board/fifthFloor/index.vue index a2b4074..e1e4553 100644 --- a/hw-ui/src/views/board/fifthFloor/index.vue +++ b/hw-ui/src/views/board/fifthFloor/index.vue @@ -41,10 +41,10 @@ :disabled="form.planDetailStatus === '已完成' || !form.planDetailCode" @click="completeCollectMaterials()">完成领料 - 扫描 - + + + + 退料 @@ -524,6 +524,7 @@ import WorkshopNotice from "@/components/workshopNotice/index.vue"; import {noticeData} from "@/utils/notice" import ViewFile from "@/components/viewFile/index.vue"; import {getDispatchSOPAttachList} from "@/api/mes/productplan"; +import {monitorSerialData} from "@/utils/serial"; const setState = (e) => { if (e === '1') { @@ -557,7 +558,7 @@ export default { closeRawReturnDialog:this.closeRawReturnDialog } }, - mixins: [noticeData], + mixins: [monitorSerialData, noticeData], data() { return { fileList: [], @@ -736,6 +737,7 @@ export default { } }, async mounted() { + this.firstConnectSerial(); // setInterval(() => { // this.$notify.info({ // title: '通知', @@ -1562,6 +1564,26 @@ export default { } this.rawBackVisible = true; + + if (!this.checkSerialConnected()) { + this.$confirm('请连接条码枪', '提示', { + confirmButtonText: '连接', + showClose: true, + // beforeClose:async(action,instance,done)=>{ + // if(action==='confirm'){ + // }else{ + // this.connectSerialPort(); + // } + // + // }, + showCancelButton: true, + type: 'warning' + }).then(() => { + this.connectSerial(this.setSerialData); + }).catch(() => { + }); + } + }, @@ -1800,6 +1822,32 @@ export default { }); }, + + + firstConnectSerial() { + if (!this.checkSerialConnected()) { + this.$confirm('请连接条码枪', '提示', { + confirmButtonText: '连接', + showClose: true, + showCancelButton: true, + type: 'warning' + }).then(() => { + this.connectSerial(this.setSerialData); + }).catch(() => { + }); + } + }, + + setSerialData() { + if (this.rawBackVisible) { + this.rawBackForm.materialBarcode = this.serialData; + } else { + this.input1 = this.serialData; + } + // console.log(this.serialData) + }, + + } } diff --git a/hw-ui/src/views/board/fourthFloor/assemble.vue b/hw-ui/src/views/board/fourthFloor/assemble.vue index a946713..5ee53d9 100644 --- a/hw-ui/src/views/board/fourthFloor/assemble.vue +++ b/hw-ui/src/views/board/fourthFloor/assemble.vue @@ -275,9 +275,9 @@ :visible.sync="productInstockVisible" :title="productInstockTitle" width="40%"> - - - + + +