diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java index b5fbf5a..0b5b3e9 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java @@ -306,7 +306,7 @@ public class MesApiController extends BaseController { */ @GetMapping(value = "/printProductBarcodes/{barcodeIds}") public AjaxResult printProductBarcodes(@PathVariable Long[] barcodeIds) { - return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds, MesConstants.MES_BARCODE_TYPE_PRODUCT)); + return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds, MesConstants.MES_BARCODE_TYPE_PRODUCT,false)); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java index 251895a..9724e00 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java @@ -124,10 +124,22 @@ public class MesBaseBarcodeInfoController extends BaseController * @return */ @GetMapping(value = "/printBarcodes/{barcodeIds}") - @RequiresPermissions("mes:barcode:printBarcodes") + @RequiresPermissions("mes:barcode:printBarcode") public AjaxResult printBarcodes(@PathVariable Long[] barcodeIds) { - return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds,MesConstants.MES_BARCODE_TYPE_RAW)); + return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds,MesConstants.MES_BARCODE_TYPE_RAW,false)); + } + + /** + * 补打印原材料条码 + * @param barcodeIds + * @return + */ + @GetMapping(value = "/reprintBarcodes/{barcodeIds}") + @RequiresPermissions("mes:barcode:reprint") + public AjaxResult reprintBarcodes(@PathVariable Long[] barcodeIds) + { + return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds,MesConstants.MES_BARCODE_TYPE_RAW,true)); } /** @@ -207,7 +219,7 @@ public class MesBaseBarcodeInfoController extends BaseController @RequiresPermissions("mes:barcode:printProductBarcodes") public AjaxResult printProductBarcodes(@PathVariable Long[] barcodeIds) { - return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds, MesConstants.MES_BARCODE_TYPE_PRODUCT)); + return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds, MesConstants.MES_BARCODE_TYPE_PRODUCT,false)); } 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 eccccb2..cc03ccc 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 @@ -49,7 +49,7 @@ public class MesPurchaseOrderController extends BaseController public TableDataInfo list(MesPurchaseOrder mesPurchaseOrder) { startPage(); - List list = mesPurchaseOrderService.selectMesPurchaseOrderList(mesPurchaseOrder); + List list = mesPurchaseOrderService.selectMesPurchaseOrderJoinList(mesPurchaseOrder); return getDataTable(list); } @@ -118,7 +118,7 @@ public class MesPurchaseOrderController extends BaseController public TableDataInfo getSaleOrders(MesSaleOrder querySaleOrder) { startPage(); - List list = mesSaleOrderService.selectMesSaleOrderList(querySaleOrder); + List list = mesSaleOrderService.selectMesSaleOrderJoinMaterialList(querySaleOrder); return getDataTable(list); } @@ -200,4 +200,16 @@ public class MesPurchaseOrderController extends BaseController return toAjax(mesPurchaseOrderService.removeSalesBindPurchase(saleOrderId, purchaseOrderIds)); } + + /** + * 删除采购订单信息 + */ + @RequiresPermissions("mes:purchaseOrder:bind") + @Log(title = "采购订单板顶信息", businessType = BusinessType.DELETE) + @GetMapping("/deleteOrderBind/{orderBindIds}") + public AjaxResult deleteOrderBind(@PathVariable Long[] orderBindIds) + { + return toAjax(mesPurchaseOrderService.deleteMesOrderBindByOrderBindIds(orderBindIds)); + } + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesOrderBind.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesOrderBind.java index 5aad862..1ce0cc6 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesOrderBind.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesOrderBind.java @@ -1,6 +1,8 @@ package com.hw.mes.domain; import java.math.BigDecimal; +import java.util.Objects; + import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.hw.common.core.annotation.Excel; @@ -12,179 +14,194 @@ import com.hw.common.core.web.domain.BaseEntity; * @author xins * @date 2024-05-16 */ -public class MesOrderBind extends BaseEntity -{ +public class MesOrderBind extends BaseEntity { private static final long serialVersionUID = 1L; - /** 主键标识 */ + /** + * 主键标识 + */ private Long orderBindId; - /** 安全库存标识(1是,0否) */ + /** + * 安全库存标识(1是,0否) + */ @Excel(name = "安全库存标识(1是,0否)") private String safeFlag; - /** 销售订单ID;对应FID */ + /** + * 销售订单ID;对应FID + */ @Excel(name = "销售订单ID;对应FID") private Long saleOrderId; - /** 销售订单编号 */ + /** + * 销售订单编号 + */ @Excel(name = "销售订单编号") private String saleOrderCode; - /** ERP成品ID */ + /** + * ERP成品ID + */ @Excel(name = "ERP成品ID") private Long productId; - /** 成品编号 */ + /** + * 成品编号 + */ @Excel(name = "成品编号") private String productCode; - /** 成品名称 */ + /** + * 成品名称 + */ @Excel(name = "成品名称") private String productName; - /** 采购订单ID */ + /** + * 采购订单ID + */ @Excel(name = "采购订单ID") private Long purchaseOrderId; - /** 采购订单编号 */ + /** + * 采购订单编号 + */ @Excel(name = "采购订单编号") private String poNo; - /** ERP物料ID */ + /** + * ERP物料ID + */ @Excel(name = "ERP物料ID") private Long materialId; - /** 物料编号 */ + /** + * 物料编号 + */ @Excel(name = "物料编号") private String materialCode; - /** 物料名称 */ + /** + * 物料名称 + */ @Excel(name = "物料名称") private String materialName; - /** 绑定数量 */ + /** + * 绑定数量 + */ @Excel(name = "绑定数量") private BigDecimal bindAmount; - /**绑定条码数量*/ + /** + * 绑定条码数量 + */ private BigDecimal barcodeAmount; - public void setOrderBindId(Long orderBindId) - { + private String productSpec; + + public void setOrderBindId(Long orderBindId) { this.orderBindId = orderBindId; } - public Long getOrderBindId() - { + public Long getOrderBindId() { return orderBindId; } - public void setSafeFlag(String safeFlag) - { + + public void setSafeFlag(String safeFlag) { this.safeFlag = safeFlag; } - public String getSafeFlag() - { + public String getSafeFlag() { return safeFlag; } - public void setSaleOrderId(Long saleOrderId) - { + + public void setSaleOrderId(Long saleOrderId) { this.saleOrderId = saleOrderId; } - public Long getSaleOrderId() - { + public Long getSaleOrderId() { return saleOrderId; } - public void setSaleOrderCode(String saleOrderCode) - { + + public void setSaleOrderCode(String saleOrderCode) { this.saleOrderCode = saleOrderCode; } - public String getSaleOrderCode() - { + public String getSaleOrderCode() { return saleOrderCode; } - public void setProductId(Long productId) - { + + public void setProductId(Long productId) { this.productId = productId; } - public Long getProductId() - { + public Long getProductId() { return productId; } - public void setProductCode(String productCode) - { + + public void setProductCode(String productCode) { this.productCode = productCode; } - public String getProductCode() - { + public String getProductCode() { return productCode; } - public void setProductName(String productName) - { + + public void setProductName(String productName) { this.productName = productName; } - public String getProductName() - { + public String getProductName() { return productName; } - public void setPurchaseOrderId(Long purchaseOrderId) - { + + public void setPurchaseOrderId(Long purchaseOrderId) { this.purchaseOrderId = purchaseOrderId; } - public Long getPurchaseOrderId() - { + public Long getPurchaseOrderId() { return purchaseOrderId; } - public void setPoNo(String poNo) - { + + public void setPoNo(String poNo) { this.poNo = poNo; } - public String getPoNo() - { + public String getPoNo() { return poNo; } - public void setMaterialId(Long materialId) - { + + public void setMaterialId(Long materialId) { this.materialId = materialId; } - public Long getMaterialId() - { + public Long getMaterialId() { return materialId; } - public void setMaterialCode(String materialCode) - { + + public void setMaterialCode(String materialCode) { this.materialCode = materialCode; } - public String getMaterialCode() - { + public String getMaterialCode() { return materialCode; } - public void setMaterialName(String materialName) - { + + public void setMaterialName(String materialName) { this.materialName = materialName; } - public String getMaterialName() - { + public String getMaterialName() { return materialName; } - public void setBindAmount(BigDecimal bindAmount) - { + + public void setBindAmount(BigDecimal bindAmount) { this.bindAmount = bindAmount; } - public BigDecimal getBindAmount() - { + public BigDecimal getBindAmount() { return bindAmount; } @@ -196,9 +213,17 @@ public class MesOrderBind extends BaseEntity this.barcodeAmount = barcodeAmount; } + public String getProductSpec() { + return productSpec; + } + + public void setProductSpec(String productSpec) { + this.productSpec = productSpec; + } + @Override public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) .append("orderBindId", getOrderBindId()) .append("safeFlag", getSafeFlag()) .append("saleOrderId", getSaleOrderId()) @@ -219,4 +244,17 @@ public class MesOrderBind extends BaseEntity .append("updateTime", getUpdateTime()) .toString(); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + MesOrderBind that = (MesOrderBind) o; + return Objects.equals(orderBindId, that.orderBindId) && barcodeAmount.compareTo(that.barcodeAmount) == 0; + } + + @Override + public int hashCode() { + return Objects.hash(orderBindId, barcodeAmount); + } } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesPurchaseOrder.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesPurchaseOrder.java index f2be518..8bd7143 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesPurchaseOrder.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesPurchaseOrder.java @@ -59,27 +59,27 @@ public class MesPurchaseOrder extends BaseEntity { private BigDecimal completeAmount; /** 审核日期;对应FApproveDate */ - @JsonFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") @Excel(name = "审核日期;对应FApproveDate", width = 30, dateFormat = "yyyy-MM-dd") private Date approveDate; /** ERP最后修改日期;对应FModifyDate */ - @JsonFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") @Excel(name = "ERP最后修改日期;对应FModifyDate", width = 30, dateFormat = "yyyy-MM-dd") private Date erpModifyDate; /** 计划交货日期;对应FDeliveryDate */ - @JsonFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") @Excel(name = "计划交货日期;对应FDeliveryDate", width = 30, dateFormat = "yyyy-MM-dd") private Date planDeliveryDate; /** 计划开始日期 */ - @JsonFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") @Excel(name = "计划开始日期", width = 30, dateFormat = "yyyy-MM-dd") private Date beginDate; /** 计划结束日期 */ - @JsonFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") @Excel(name = "计划结束日期", width = 30, dateFormat = "yyyy-MM-dd") private Date endDate; @@ -88,7 +88,7 @@ public class MesPurchaseOrder extends BaseEntity { private String orderStatus; /** 完成日期 */ - @JsonFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") @Excel(name = "完成日期", width = 30, dateFormat = "yyyy-MM-dd") private Date completeDate; @@ -176,6 +176,9 @@ public class MesPurchaseOrder extends BaseEntity { private long mesMaterialId;//物料信息表的物料ID主键 + private String alwaysFlag; + + public Long getSerialNumber() { return serialNumber; } @@ -549,6 +552,14 @@ public class MesPurchaseOrder extends BaseEntity { this.mesMaterialId = mesMaterialId; } + public String getAlwaysFlag() { + return alwaysFlag; + } + + public void setAlwaysFlag(String alwaysFlag) { + this.alwaysFlag = alwaysFlag; + } + @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 54c8c7b..b9f5cc5 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 @@ -166,6 +166,11 @@ public class MesSaleOrder extends BaseEntity { */ private String materialModel; + private String materialSpec; + + private Long erpMaterialId; + + public String getMaterialModel() { return materialModel; } @@ -358,6 +363,22 @@ public class MesSaleOrder extends BaseEntity { return isFlag; } + public String getMaterialSpec() { + return materialSpec; + } + + public void setMaterialSpec(String materialSpec) { + this.materialSpec = materialSpec; + } + + public Long getErpMaterialId() { + return erpMaterialId; + } + + public void setErpMaterialId(Long erpMaterialId) { + this.erpMaterialId = erpMaterialId; + } + @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/vo/MesOrderBindVo.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/vo/MesOrderBindVo.java new file mode 100644 index 0000000..9bb4529 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/vo/MesOrderBindVo.java @@ -0,0 +1,54 @@ +package com.hw.mes.domain.vo; + +import com.hw.mes.domain.MesOrderBind; +import com.hw.mes.domain.MesProductPlan; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description: 采购订单绑定销售订单VO对象 + * @ClassName: MesOrderBindVo + * @Author : xins + * @Date :2024-08-14 13:46 + * @Version :1.0 + */ +@Data +public class MesOrderBindVo { + + //物料ERPID + @NotNull(message = "物料ERPId必须输入") + private Long erpMaterialId; + + //采购订单ID + @NotNull(message = "采购订单Id必须输入") + private Long purchaseOrderId; + + //订单计划数量 + @NotNull(message = "订单计划数量不能为空") + private BigDecimal orderAmount; + + //物料编码 + @NotEmpty(message = "物料编码不能为空") + private String materialCode; + + //物料名称 + @NotEmpty(message = "物料名称不能为空") + private String materialName; + + //采购订单号 + @NotEmpty(message = "采购订单号不能为空") + private String poNo; + + + //保存的订单绑定信息 + @NotNull(message = "绑定信息不能为空") + private List mesOrderBindList; + + //待删除的订单绑定ID + private Long[] toDeletedOrderBindIds; + +} 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 e6439eb..bfa21be 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 @@ -109,4 +109,11 @@ public interface MesPurchaseOrderMapper */ List selectPurchaseOrderBindList(MesPurchaseOrder mesPurchaseOrder); + /** + * 查询采购订单信息列表,join material + * @param mesPurchaseOrder + * @return + */ + List selectMesPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder); + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java index 05496d5..6527ad5 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java @@ -105,10 +105,12 @@ public interface IMesBaseBarcodeInfoService * 打印物料条码 * * @param barcodeIds - * @param printType 打印类型(1原材料 3成品) + * @param printType 打印类型(1原材料 3成品) + * @param reprintFlag 重新打印标识(1重新打印) * @return */ - public int printBarcodes(Long[] barcodeIds,String printType); + public int printBarcodes(Long[] barcodeIds, String printType,boolean reprintFlag); + /** * 配对条码信息(适用于五楼柜体拆分区) 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 5b59034..9d5d70e 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 @@ -27,6 +27,14 @@ public interface IMesPurchaseOrderService */ public List selectMesPurchaseOrderList(MesPurchaseOrder mesPurchaseOrder); + /** + * 查询采购订单信息列表,Join material + * + * @param mesPurchaseOrder 采购订单信息 + * @return 采购订单信息 + */ + public List selectMesPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder); + /** * 新增采购订单信息 * @@ -113,4 +121,12 @@ public interface IMesPurchaseOrderService * @return 采购订单信息 */ public List selectPurchaseOrderBindList(MesPurchaseOrder mesPurchaseOrder); + + /** + * 批量删除采购订单绑定信息 + * + * @param orderBindIds 需要删除的采购订单绑定信息主键 + * @return 结果 + */ + public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds); } 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 c7025a4..c0fac5b 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 @@ -584,18 +584,19 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService * 打印物料条码 * * @param barcodeIds - * @param printType 打印类型(1原材料 3成品) + * @param printType 打印类型(1原材料 3成品) + * @param reprintFlag 重新打印标识(1重新打印) * @return */ @Override @Transactional - public int printBarcodes(Long[] barcodeIds, String printType) { + public int printBarcodes(Long[] barcodeIds, String printType, boolean reprintFlag) { //获取条码List - List> printContents = new ArrayList<>(); - List toUpdatedBaseBarcodeInfos = new ArrayList<>(); +// List> printContents = new ArrayList<>(); +// List toUpdatedBaseBarcodeInfos = new ArrayList<>(); for (Long barcodeId : barcodeIds) { - printBarcodesByBarcodeId(barcodeId, printType); + printBarcodesByBarcodeId(barcodeId, printType, reprintFlag); } // for (MesBaseBarcodeInfo toUpdateMesBaseBarcodeInfo : toUpdatedBaseBarcodeInfos) { @@ -617,17 +618,19 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService // throw new RuntimeException(printResultR.getMsg()); // } - return toUpdatedBaseBarcodeInfos.size(); + return 1; } @Transactional(propagation = Propagation.REQUIRES_NEW) - public void printBarcodesByBarcodeId(Long barcodeId, String printType) { + public void printBarcodesByBarcodeId(Long barcodeId, String printType, boolean reprintFlag) { MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoJoinByBarcodeId(barcodeId); - String printFlag = mesBaseBarcodeInfo.getPrintFlag(); - if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) { - throw new ServiceException("此物料条码[" + mesBaseBarcodeInfo.getBarcodeInfo() + "]已经打印过,不能重复打印"); + if (!reprintFlag) { + String printFlag = mesBaseBarcodeInfo.getPrintFlag(); + if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) { + throw new ServiceException("此物料条码[" + mesBaseBarcodeInfo.getBarcodeInfo() + "]已经打印过,不能重复打印"); + } } String materialName = mesBaseBarcodeInfo.getMaterialName(); @@ -740,7 +743,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService mesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate()); mesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername()); mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES); - mesBaseBarcodeInfo.setPrintNumber(1L); + mesBaseBarcodeInfo.setPrintNumber(mesBaseBarcodeInfo.getPrintNumber() == null ? 1L : mesBaseBarcodeInfo.getPrintNumber() + 1); mesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate()); this.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo); 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 7a46abb..66b74a9 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 @@ -4,6 +4,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; import com.hw.common.core.constant.MesConstants; import com.hw.common.core.exception.ServiceException; @@ -14,6 +15,7 @@ import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.api.domain.MesBaseMaterialInfo; import com.hw.mes.domain.MesOrderBind; import com.hw.mes.domain.MesSaleOrder; +import com.hw.mes.domain.vo.MesOrderBindVo; import com.hw.mes.mapper.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -66,6 +68,21 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { return mesPurchaseOrderMapper.selectMesPurchaseOrderList(mesPurchaseOrder); } + /** + * 查询采购订单信息列表,Join material + * + * @param mesPurchaseOrder 采购订单信息 + * @return 采购订单信息 + */ + @Override + public List selectMesPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder) { + mesPurchaseOrder.setMaterialSpec(StringUtils.isNotEmpty(mesPurchaseOrder.getMaterialSpec()) + ? mesPurchaseOrder.getMaterialSpec().replaceAll("\\s+", "") : ""); + mesPurchaseOrder.setSpecificationParameter(StringUtils.isNotEmpty(mesPurchaseOrder.getSpecificationParameter()) + ? mesPurchaseOrder.getSpecificationParameter().replaceAll("\\s+", "") : ""); + return mesPurchaseOrderMapper.selectMesPurchaseOrderJoinList(mesPurchaseOrder); + } + /** * 新增采购订单信息 * @@ -120,7 +137,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { * @return 结果 */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public int bindOrder(MesPurchaseOrder mesPurchaseOrder) { Long erpMaterialId = mesPurchaseOrder.getMaterialId(); MesBaseMaterialInfo mesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(erpMaterialId); @@ -137,15 +154,9 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { } Long purchaseOrderId = mesPurchaseOrder.getPurchaseOrderId(); - MesBaseBarcodeInfo queryBaseBarcodeInfo = new MesBaseBarcodeInfo(); - queryBaseBarcodeInfo.setPurchaseOrderId(purchaseOrderId); - int mesBaseBarcodeInfoCount = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoCount(queryBaseBarcodeInfo); - if (mesBaseBarcodeInfoCount > 0) { - throw new ServiceException("此采购订单已经生成条码,不能再绑定"); - } - - - mesPurchaseOrderMapper.deleteMesOrderBindByPurchaseOrderId(mesPurchaseOrder.getPurchaseOrderId()); + MesOrderBind queryOrderBind = new MesOrderBind(); + queryOrderBind.setPurchaseOrderId(purchaseOrderId); + List dbMesOrderBinds = mesOrderBindMapper.selectMesOrderBindList(queryOrderBind); Date currentDate = new Date(); String userName = SecurityUtils.getUsername(); @@ -155,8 +166,46 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { String poNo = mesPurchaseOrder.getPoNo(); BigDecimal orderAmount = mesPurchaseOrder.getOrderAmount(); List orderBinds = mesPurchaseOrder.getMesOrderBindList(); + List toUpdatedOrderBinds = orderBinds.stream().filter(ob -> + ob.getOrderBindId() != null).collect(Collectors.toList()); + + List toInsertedOrderBinds = orderBinds.stream().filter(ob -> + ob.getOrderBindId() == null).collect(Collectors.toList()); + + /**判断两个数据库的list和前端提交的list是否相同,根据orderbindid和barcodeamount判断*/ + boolean areEqual = + (dbMesOrderBinds != null && toUpdatedOrderBinds != null) && + dbMesOrderBinds.size() == toUpdatedOrderBinds.size() && + dbMesOrderBinds.containsAll(toUpdatedOrderBinds) && + toUpdatedOrderBinds.containsAll(dbMesOrderBinds); + if (!areEqual) { + throw new ServiceException("订单绑定数据有变化,请重新绑定"); + } + + + /** + * 更新数据 + */ BigDecimal totalBindAmount = BigDecimal.ZERO; - for (MesOrderBind orderBind : orderBinds) { + for (MesOrderBind toUpdatedOrderBind : toUpdatedOrderBinds) { + BigDecimal bindAmount = toUpdatedOrderBind.getBindAmount() == null ? + BigDecimal.ZERO : toUpdatedOrderBind.getBindAmount(); + if (bindAmount.compareTo(BigDecimal.ZERO) <= 0) { + throw new ServiceException("绑定数量需大于0"); + } + if (bindAmount.compareTo(toUpdatedOrderBind.getBarcodeAmount()) < 0) { + throw new ServiceException("绑定数量不能小于已经生成的条码数量"); + } + toUpdatedOrderBind.setUpdateTime(currentDate); + toUpdatedOrderBind.setUpdateBy(userName); + totalBindAmount = totalBindAmount.add(bindAmount); + mesOrderBindMapper.updateMesOrderBind(toUpdatedOrderBind); + } + + /** + * 插入数据 + */ + for (MesOrderBind orderBind : toInsertedOrderBinds) { if (StringUtils.isEmpty(orderBind.getSafeFlag())) { throw new ServiceException("请全部选择安全标识"); } @@ -176,21 +225,20 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { throw new ServiceException("绑定数量需大于0"); } orderBind.setPurchaseOrderId(purchaseOrderId); + orderBind.setPoNo(poNo); orderBind.setCreateTime(currentDate); orderBind.setCreateBy(userName); - orderBind.setMaterialId(erpMaterialId); - orderBind.setMaterialCode(materialCode); - orderBind.setMaterialName(materialName); - orderBind.setPoNo(poNo); - totalBindAmount = totalBindAmount.add(bindAmount); } if (totalBindAmount.compareTo(orderAmount) > 0) { - throw new ServiceException("总绑定数量" + totalBindAmount + "不能大于订单计划数量" + orderAmount); + throw new ServiceException("现总绑定数量为" + totalBindAmount + ",不能大于订单计划数量" + orderAmount); } - return mesPurchaseOrderMapper.batchMesOrderBind(orderBinds); + if (toInsertedOrderBinds != null && !toInsertedOrderBinds.isEmpty()) { + mesPurchaseOrderMapper.batchMesOrderBind(toInsertedOrderBinds); + } + return 1; } @@ -215,6 +263,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { /** * 获取销售订单未绑定采购订单 + * * @param mesPurchaseOrder * @return */ @@ -225,6 +274,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { /** * 获取销售订单已绑定采购订单List + * * @param mesPurchaseOrder * @return */ @@ -236,6 +286,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { /** * 保存销售订单绑定采购订单 + * * @param purchaseOrderList * @return */ @@ -243,7 +294,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { @Transactional(rollbackFor = ServiceException.class) public int saveSalesBindPurchase(List purchaseOrderList) { Long saleOrderId = purchaseOrderList.get(0).getSaleOrderId(); - if (StringUtils.isNull(saleOrderId)){ + if (StringUtils.isNull(saleOrderId)) { return 0; } //校验数据 @@ -262,7 +313,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { selectOrderBind.setSaleOrderId(saleOrderId); selectOrderBind.setPurchaseOrderId(purchaseOrderId); List bindList = mesOrderBindMapper.selectMesOrderBindList(selectOrderBind); - if (bindList.size() == 0){ + if (bindList.size() == 0) { MesOrderBind orderBind = new MesOrderBind(); MesPurchaseOrder mesPurchaseOrder = mesPurchaseOrderMapper.selectMesPurchaseOrderByPurchaseOrderId(purchaseOrderId); Long materialId = mesPurchaseOrder.getMaterialId(); @@ -329,7 +380,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { selectOrderBind.setSaleOrderId(saleOrderId); selectOrderBind.setPurchaseOrderId(purchaseOrderId); List bindList = mesOrderBindMapper.selectMesOrderBindList(selectOrderBind); - if (bindList.size() > 0){ + if (bindList.size() > 0) { list.add(bindList.get(0).getOrderBindId()); } } @@ -350,4 +401,21 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { } + /** + * 批量删除采购订单绑定信息 + * + * @param orderBindIds 需要删除的采购订单绑定信息主键 + * @return 结果 + */ + @Override + public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds) { + for (Long orderBindId : orderBindIds) { + MesOrderBind mesOrderBind = mesOrderBindMapper.selectMesOrderBindByOrderBindId(orderBindId); + if (mesOrderBind.getBarcodeAmount() != null && mesOrderBind.getBarcodeAmount().compareTo(BigDecimal.ONE) >= 0) { + throw new ServiceException("已经生成条码数量的不能删除"); + } + } + return mesOrderBindMapper.deleteMesOrderBindByOrderBindIds(orderBindIds); + } + } 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 d9c232c..2761090 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 @@ -2,6 +2,7 @@ package com.hw.mes.service.impl; import java.util.List; import com.hw.common.core.utils.DateUtils; +import com.hw.common.core.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hw.mes.mapper.MesSaleOrderMapper; @@ -105,6 +106,8 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService @Override public List selectMesSaleOrderJoinMaterialList(MesSaleOrder mesSaleOrder) { + mesSaleOrder.setMaterialSpec(StringUtils.isNotEmpty(mesSaleOrder.getMaterialSpec()) + ? mesSaleOrder.getMaterialSpec().replaceAll("\\s+", "") : ""); return mesSaleOrderMapper.selectMesSaleOrderJoinMaterialList(mesSaleOrder); } } 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 fc4aed4..3cae01c 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 @@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -64,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -75,6 +77,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -109,10 +113,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -337,4 +351,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by mpo.erp_modify_date desc,mpo.po_no ,mpo.material_name + + + + 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 e9ca8cc..2532046 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 @@ -34,6 +34,8 @@ + + @@ -225,9 +227,11 @@ select mso.sale_order_id, mso.saleorder_code, mso.document_status, + mso.material_id as erp_material_id, mbmi.material_id, - mso.material_code, - mso.material_name, + mbmi.material_code, + mbmi.material_name, + mbmi.material_spec, mso.order_amount, mso.complete_amount, mso.release_qty, @@ -238,11 +242,15 @@ mso.complete_date from mes_sale_order mso left join mes_base_material_info mbmi on mso.material_id = mbmi.erp_id - and mso.saleorder_code = #{saleorderCode} - and mso.material_code = #{materialCode} - and mso.material_name like concat('%', #{materialName}, + and mso.saleorder_code like concat('%', #{saleorderCode}, + '%') + and mbmi.material_code like concat('%', #{materialCode}, + '%') + and mbmi.material_name like concat('%', #{materialName}, '%') + and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec}, + '%') diff --git a/hw-ui/src/api/mes/barcode.js b/hw-ui/src/api/mes/barcode.js index 844ab3a..f10e3ac 100644 --- a/hw-ui/src/api/mes/barcode.js +++ b/hw-ui/src/api/mes/barcode.js @@ -158,3 +158,12 @@ export function addRegularBarcode(data) { data: data }) } + + +// 打印原材料条码 +export function reprintBarcodes(barcodeIds) { + return request({ + url: '/mes/barcode/reprintBarcodes/' + barcodeIds, + method: 'get' + }) +} diff --git a/hw-ui/src/api/mes/purchaseOrder.js b/hw-ui/src/api/mes/purchaseOrder.js index 5e1e0b6..6e35646 100644 --- a/hw-ui/src/api/mes/purchaseOrder.js +++ b/hw-ui/src/api/mes/purchaseOrder.js @@ -66,6 +66,13 @@ export function bindOrder(data) { } +// 删除绑定的采购订单信息 +export function deleteOrderBind(orderBindIds) { + return request({ + url: '/mes/purchaseOrder/deleteOrderBind/'+orderBindIds, + method: 'get' + }) +} // 查询采购订单信息详细,校验是否需要绑定 export function getCheckedPurchaseOrder(purchaseOrderId) { diff --git a/hw-ui/src/router/index.js b/hw-ui/src/router/index.js index ed26f5f..dad2493 100644 --- a/hw-ui/src/router/index.js +++ b/hw-ui/src/router/index.js @@ -297,13 +297,13 @@ export const dynamicRoutes = [ ], }, { - path: '/mes/product-order', + path: '/mes/purchase-order', component: Layout, hidden: true, - permissions: ['mes:productOrder:bind'], + permissions: ['mes:purchaseOrder:bind'], children: [ { - path: 'bind/:purchaseOrderId(\\d+)', + path: 'bind/:purchaseOrderId(\\d+)/:materialSpec', component: () => import('@/views/mes/purchaseOrder/bindOrder'), name: 'orderBind', meta: { title: '订单信息绑定', activeMenu: '/mes/purchaseOrder' } diff --git a/hw-ui/src/views/mes/purchaseOrder/bindOrder.vue b/hw-ui/src/views/mes/purchaseOrder/bindOrder.vue index 466f1bf..6270491 100644 --- a/hw-ui/src/views/mes/purchaseOrder/bindOrder.vue +++ b/hw-ui/src/views/mes/purchaseOrder/bindOrder.vue @@ -1,8 +1,5 @@