diff --git a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java index f4bcfe7..ae9f37a 100644 --- a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java +++ b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java @@ -69,6 +69,10 @@ public class MesBaseBarcodeInfo extends BaseEntity @Excel(name = "物料ID") private Long materialId; + /**条码规格*/ + private String barcodeSpec; + + /** 供应商ID */ @Excel(name = "供应商ID") private Long manufacturerId; @@ -314,6 +318,15 @@ public class MesBaseBarcodeInfo extends BaseEntity { return materialId; } + + public String getBarcodeSpec() { + return barcodeSpec; + } + + public void setBarcodeSpec(String barcodeSpec) { + this.barcodeSpec = barcodeSpec; + } + public void setManufacturerId(Long manufacturerId) { this.manufacturerId = manufacturerId; diff --git a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseMaterialInfo.java b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseMaterialInfo.java index 2dea4b7..aa53ffb 100644 --- a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseMaterialInfo.java +++ b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseMaterialInfo.java @@ -118,6 +118,9 @@ public class MesBaseMaterialInfo extends BaseEntity @Excel(name = "审核日期;对应FApproveDate", width = 30, dateFormat = "yyyy-MM-dd") private Date approveDate; + /**安全库存数量*/ + private BigDecimal safeStockAmount; + /** erp最后更新日期;对应FModifyDate */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "erp最后更新日期;对应FModifyDate", width = 30, dateFormat = "yyyy-MM-dd") @@ -362,6 +365,15 @@ public class MesBaseMaterialInfo extends BaseEntity { return approveDate; } + + public BigDecimal getSafeStockAmount() { + return safeStockAmount; + } + + public void setSafeStockAmount(BigDecimal safeStockAmount) { + this.safeStockAmount = safeStockAmount; + } + public void setErpModifyDate(Date erpModifyDate) { this.erpModifyDate = erpModifyDate; 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 8f06c23..251895a 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 @@ -8,7 +8,9 @@ import com.hw.common.security.annotation.InnerAuth; import com.hw.common.security.utils.SecurityUtils; import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.api.domain.MesBaseMaterialInfo; +import com.hw.mes.domain.MesPurchaseOrder; import com.hw.mes.service.IMesBaseMaterialInfoService; +import com.hw.mes.service.IMesPurchaseOrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -43,6 +45,9 @@ public class MesBaseBarcodeInfoController extends BaseController @Autowired private IMesBaseMaterialInfoService mesBaseMaterialInfoService; + @Autowired + private IMesPurchaseOrderService mesPurchaseOrderService; + /** * 查询条码信息列表 */ @@ -250,7 +255,7 @@ public class MesBaseBarcodeInfoController extends BaseController /** * 无采购订单新增原材料条码信息 */ - @RequiresPermissions("mes:barcode:internalAdd") + @RequiresPermissions("mes:barcode:noPurchaseAdd") @Log(title = "条码信息", businessType = BusinessType.INSERT) @PostMapping(value="/addNoPurchaseBarcode") public AjaxResult addNoPurchaseBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo) @@ -261,7 +266,6 @@ public class MesBaseBarcodeInfoController extends BaseController /** * 校验是否有同样物料是批次的条码 */ - @RequiresPermissions("mes:barcode:internalAdd") @PostMapping(value="/checkBarcode") public AjaxResult checkBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo) { @@ -318,4 +322,17 @@ public class MesBaseBarcodeInfoController extends BaseController } + + /** + * 查询条码信息列表 + */ + @RequiresPermissions("mes:barcode:add") + @GetMapping("/selectPurchaseOrderBindList") + public TableDataInfo selectPurchaseOrderBindList(MesPurchaseOrder mesPurchaseOrder) + { + startPage(); + List list = mesPurchaseOrderService.selectPurchaseOrderBindList(mesPurchaseOrder); + return getDataTable(list); + } + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesMobileController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesMobileController.java index 2d503ec..4a53866 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesMobileController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesMobileController.java @@ -24,7 +24,7 @@ public class MesMobileController extends BaseController { /** - * 物料条码和托盘码绑定 + * rfid 物料条码和托盘码绑定 */ @Log(title = "托盘信息", businessType = BusinessType.BIND) @PostMapping(("/bindPalletInfo")) 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 051e676..5aad862 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 @@ -67,6 +67,9 @@ public class MesOrderBind extends BaseEntity @Excel(name = "绑定数量") private BigDecimal bindAmount; + /**绑定条码数量*/ + private BigDecimal barcodeAmount; + public void setOrderBindId(Long orderBindId) { this.orderBindId = orderBindId; @@ -185,6 +188,14 @@ public class MesOrderBind extends BaseEntity return bindAmount; } + public BigDecimal getBarcodeAmount() { + return barcodeAmount; + } + + public void setBarcodeAmount(BigDecimal barcodeAmount) { + this.barcodeAmount = barcodeAmount; + } + @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/MesPurchaseOrder.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesPurchaseOrder.java index 3e9c20e..f2be518 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 @@ -164,6 +164,18 @@ public class MesPurchaseOrder extends BaseEntity { /** 序号 */ private Long serialNumber; + /**订单绑定的数量和条码的数量,以-分割*/ + private String orderBindBarcodeAmount; + + /**安全库存绑定的数量和条码的数量,以-分割*/ + private String safeBindBarcodeAmount; + + private String batchFlag; + + private BigDecimal batchAmount; + + private long mesMaterialId;//物料信息表的物料ID主键 + public Long getSerialNumber() { return serialNumber; } @@ -497,6 +509,46 @@ public class MesPurchaseOrder extends BaseEntity { this.bindFlag = bindFlag; } + public String getOrderBindBarcodeAmount() { + return orderBindBarcodeAmount; + } + + public void setOrderBindBarcodeAmount(String orderBindBarcodeAmount) { + this.orderBindBarcodeAmount = orderBindBarcodeAmount; + } + + public String getSafeBindBarcodeAmount() { + return safeBindBarcodeAmount; + } + + public void setSafeBindBarcodeAmount(String safeBindBarcodeAmount) { + this.safeBindBarcodeAmount = safeBindBarcodeAmount; + } + + public String getBatchFlag() { + return batchFlag; + } + + public void setBatchFlag(String batchFlag) { + this.batchFlag = batchFlag; + } + + public BigDecimal getBatchAmount() { + return batchAmount; + } + + public void setBatchAmount(BigDecimal batchAmount) { + this.batchAmount = batchAmount; + } + + public long getMesMaterialId() { + return mesMaterialId; + } + + public void setMesMaterialId(long mesMaterialId) { + this.mesMaterialId = mesMaterialId; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesPurchaseOrderMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesPurchaseOrderMapper.java index 7ea0aa1..e6439eb 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 @@ -101,4 +101,12 @@ public interface MesPurchaseOrderMapper * @return */ List saleBindPurchaseOrderList(MesPurchaseOrder mesPurchaseOrder); + + /** + * 获取销售订单已绑定采购订单List,for 原材料条码选择采购订单使用 + * @param mesPurchaseOrder + * @return + */ + List selectPurchaseOrderBindList(MesPurchaseOrder mesPurchaseOrder); + } 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 a77d0c5..5b59034 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 @@ -105,4 +105,12 @@ public interface IMesPurchaseOrderService * @return */ public int removeSalesBindPurchase(Long saleOrderId, Long[] purchaseOrderIds); + + /** + * 获取销售订单已绑定采购订单List,for 原材料条码选择采购订单使用 + * + * @param mesPurchaseOrder 采购订单信息 + * @return 采购订单信息 + */ + public List selectPurchaseOrderBindList(MesPurchaseOrder mesPurchaseOrder); } 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 5759a55..c7025a4 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 @@ -108,6 +108,8 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService public List selectMesBaseBarcodeInfoList(MesBaseBarcodeInfo mesBaseBarcodeInfo) { mesBaseBarcodeInfo.setMaterialSpec(StringUtils.isNotEmpty(mesBaseBarcodeInfo.getMaterialSpec()) ? mesBaseBarcodeInfo.getMaterialSpec().replaceAll("\\s+", "") : ""); + mesBaseBarcodeInfo.setBarcodeSpec(StringUtils.isNotEmpty(mesBaseBarcodeInfo.getBarcodeSpec()) + ? mesBaseBarcodeInfo.getBarcodeSpec().replaceAll("\\s+", "") : ""); return mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoList(mesBaseBarcodeInfo); } @@ -140,12 +142,6 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService Date currentDate = new Date(); String userName = SecurityUtils.getUsername(); Long purchaseOrderId = mesBaseBarcodeInfo.getPurchaseOrderId(); - MesBaseBarcodeInfo queryBaseBarcodeInfo = new MesBaseBarcodeInfo(); - queryBaseBarcodeInfo.setPurchaseOrderId(purchaseOrderId); - int mesBaseBarcodeInfoCount = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoCount(queryBaseBarcodeInfo); - if (mesBaseBarcodeInfoCount > 0) { - throw new ServiceException("此采购订单已经生成条码,无需重复生成"); - } Long materialId = mesBaseBarcodeInfo.getMaterialId(); MesBaseMaterialInfo mesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialId(materialId); @@ -168,8 +164,9 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService } BigDecimal totalBindAmount = mesOrderBinds.stream().map(MesOrderBind::getBindAmount).reduce(BigDecimal.ZERO, BigDecimal::add); - if (barcodeAmount.compareTo(totalBindAmount) != 0) { - throw new ServiceException("采购订单还未完全绑定到销售订单"); + BigDecimal totalBarcodeAmount = mesOrderBinds.stream().map(MesOrderBind::getBarcodeAmount).reduce(BigDecimal.ZERO, BigDecimal::add); + if (totalBindAmount.subtract(totalBarcodeAmount).compareTo(barcodeAmount) != 0) { + throw new ServiceException("采购订单绑定数据有变化,请重新选择采购订单绑定"); } String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode); @@ -177,23 +174,36 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService for (MesOrderBind mesOrderBind : mesOrderBinds) { BigDecimal bindAmount = mesOrderBind.getBindAmount(); - for (int i = 0; i < bindAmount.intValue(); i++) { - // 生成数量条的不同条码内容 - toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, batchCode, userName, currentDate); - - toInsertedBarcodeInfo.setSaleOrderId(mesOrderBind.getSaleOrderId()); - toInsertedBarcodeInfo.setSaleorderCode(mesOrderBind.getSaleOrderCode()); - toInsertedBarcodeInfo.setSafeFlag(mesOrderBind.getSafeFlag()); - - mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo); + BigDecimal bindBarcodeAmount = mesOrderBind.getBarcodeAmount(); + BigDecimal canBindAmount = bindAmount.subtract(bindBarcodeAmount); + + if (canBindAmount.compareTo(BigDecimal.ONE) >= 0) { + for (int i = 0; i < canBindAmount.intValue(); i++) { + // 生成数量条的不同条码内容 + toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, batchCode, userName, currentDate); + + toInsertedBarcodeInfo.setSaleOrderId(mesOrderBind.getSaleOrderId()); + toInsertedBarcodeInfo.setSaleorderCode(mesOrderBind.getSaleOrderCode()); + toInsertedBarcodeInfo.setSafeFlag(mesOrderBind.getSafeFlag()); + + mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo); + } + + //更新订单绑定的条码已绑定数量 + mesOrderBind.setBarcodeAmount(bindAmount); + mesOrderBind.setUpdateBy(userName); + mesOrderBind.setUpdateTime(currentDate); + mesOrderBindMapper.updateMesOrderBind(mesOrderBind); } + } } else { MesBaseBarcodeInfo toInsertedBarcodeInfo; String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode); for (long i = 0; i < barcodeAmount.intValue(); i++) { - // 生成数量条的不同条码内容 + // 生成条码数量的不同条码内容 toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, batchCode, userName, currentDate); + toInsertedBarcodeInfo.setSaleOrderId(0L); toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES); mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo); } @@ -202,22 +212,21 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService /** - * 校验是否有同样物料是批次的条码 + * 校验是否有同样物料是批次的条码,暂时不用此方法 * * @param mesBaseBarcodeInfo */ @Override public int checkBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) { - if (mesBaseBarcodeInfo.getConfirmFlag() == null || !mesBaseBarcodeInfo.getConfirmFlag().equals("1")) { - MesBaseBarcodeInfo queryBarcodeInfo = new MesBaseBarcodeInfo(); - queryBarcodeInfo.setMaterialId(mesBaseBarcodeInfo.getMaterialId()); - queryBarcodeInfo.setBatchFlag(MesConstants.IS_BATCH); - List mesBaseBarcodeInfos = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoList(queryBarcodeInfo); - if (mesBaseBarcodeInfos != null && !mesBaseBarcodeInfos.isEmpty()) { - return 2; - } + MesBaseBarcodeInfo queryBarcodeInfo = new MesBaseBarcodeInfo(); + queryBarcodeInfo.setMaterialId(mesBaseBarcodeInfo.getMaterialId()); + queryBarcodeInfo.setBatchFlag(MesConstants.IS_BATCH); + List mesBaseBarcodeInfos = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoList(queryBarcodeInfo); + if (mesBaseBarcodeInfos != null && !mesBaseBarcodeInfos.isEmpty()) { + return 2; } + return 1; } @@ -258,6 +267,13 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService public int generateRegularRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) { Date currentDate = new Date(); String userName = SecurityUtils.getUsername(); + MesBaseBarcodeInfo queryBaseBarcodeInfo = new MesBaseBarcodeInfo(); + 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("已经有此物料固定条码,无需重复生成"); + } String barcodeInfo = Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode); mesBaseBarcodeInfo.setBarcodeInfo(barcodeInfo); @@ -266,6 +282,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService mesBaseBarcodeInfo.setBatchFlag(MesConstants.IS_BATCH); mesBaseBarcodeInfo.setBarcodeType(MesConstants.MES_BARCODE_TYPE_RAW_REGULAR); mesBaseBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES); + mesBaseBarcodeInfo.setSaleOrderId(0L); mesBaseBarcodeInfo.setCreateBy(userName); mesBaseBarcodeInfo.setCreateTime(currentDate); @@ -489,6 +506,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService toInsertedBarcodeInfo.setLastOutstockDate(mesBaseBarcodeInfo.getLastOutstockDate()); toInsertedBarcodeInfo.setProjectNo(mesBaseBarcodeInfo.getProjectNo()); toInsertedBarcodeInfo.setBatchFlag(mesBaseBarcodeInfo.getBatchFlag()); + toInsertedBarcodeInfo.setBarcodeSpec(mesBaseBarcodeInfo.getBarcodeSpec()); if (mesBaseBarcodeInfo.getBatchFlag().equals(MesConstants.NOT_IS_BATCH)) { toInsertedBarcodeInfo.setAmount(new BigDecimal(1)); } @@ -661,7 +679,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService PrintContentVo printMaterialSpec = new PrintContentVo(); printMaterialSpec.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_SPEC); - printMaterialSpec.setValue(mesBaseBarcodeInfo.getMaterialSpec().replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", "")); + printMaterialSpec.setValue(mesBaseBarcodeInfo.getBarcodeSpec().replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", "")); printMaterialSpec.setType(PrintContentVo.TYPE_TEXT); PrintContentVo printQty = new PrintContentVo(); 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 06a2365..7076502 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 @@ -4,7 +4,9 @@ import java.util.Date; import java.util.HashMap; import java.util.List; +import com.hw.common.core.constant.MesConstants; import com.hw.common.core.constant.SecurityConstants; +import com.hw.common.core.domain.R; import com.hw.common.core.exception.ServiceException; import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.StringUtils; @@ -15,6 +17,9 @@ import com.hw.mes.domain.vo.MesPalletInfoBindVo; import com.hw.mes.mapper.MesBaseBarcodeInfoMapper; import com.hw.printer.api.RemotePrinterService; import com.hw.printer.api.domain.vo.PrintContentVo; +import com.hw.wms.api.RemoteWmsService; +import com.hw.wms.api.domain.vo.WmsProductStockVo; +import com.hw.wms.api.domain.vo.WmsRawStockVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -46,6 +51,9 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService { @Resource private RemotePrinterService remotePrinterService; + @Resource + private RemoteWmsService remoteWmsService; + /** * 查询托盘信息 * @@ -119,6 +127,7 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService { /** * 绑定托盘信息 + * * @param mesPalletInfoBindVo * @return */ @@ -130,16 +139,40 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService { MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode); if (mesBaseBarcodeInfo == null) { - log.error("palletInfoCode:"+palletInfoCode+",materialBarcode:"+materialBarcode); + log.error("palletInfoCode:" + palletInfoCode + ",materialBarcode:" + materialBarcode); throw new ServiceException("物料条码有误"); } MesBasePalletInfo mesBasePalletInfo = mesBasePalletInfoMapper.selectMesBasePalletInfoByPalletInfoCode(palletInfoCode); if (mesBasePalletInfo == null) { - log.error("palletInfoCode:"+palletInfoCode+",materialBarcode:"+materialBarcode); + log.error("palletInfoCode:" + palletInfoCode + ",materialBarcode:" + materialBarcode); throw new ServiceException("托盘码有误"); } + if (!mesBaseBarcodeInfo.getPrintFlag().equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) { + throw new ServiceException("此物料条码还未打印"); + } + + if (StringUtils.isNotEmpty(mesBaseBarcodeInfo.getPalletInfoCode()) && mesBaseBarcodeInfo.getPalletInfoCode().equals(palletInfoCode)) { + throw new ServiceException("已经绑定过"); + } + + + WmsProductStockVo queryProductStockVo = new WmsProductStockVo(); + queryProductStockVo.setProductBatch(materialBarcode); + R isExistProductStock = remoteWmsService.isExistProductStock(queryProductStockVo, SecurityConstants.INNER); + if (isExistProductStock.getData()) { + throw new ServiceException("此物料条码存在成品库存,不能绑定"); + } + + WmsRawStockVo queryRawStockVo = new WmsRawStockVo(); + queryRawStockVo.setInstockBatch(materialBarcode); + R isExistRawStock = remoteWmsService.isExistRawStock(queryRawStockVo, SecurityConstants.INNER); + if (isExistRawStock.getData()) { + throw new ServiceException("此物料条码存在原材料库存,不能绑定"); + } + + String userName = SecurityUtils.getUsername(); Date currentDate = new Date(); mesBaseBarcodeInfo.setPalletInfoCode(palletInfoCode); @@ -158,8 +191,6 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService { } - - /** * 打印托盘RFID编码 * 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 e2b4003..7a46abb 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 @@ -338,4 +338,16 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { } + /** + * 获取销售订单已绑定采购订单List,for 原材料条码选择采购订单使用 + * + * @param mesPurchaseOrder 采购订单信息 + * @return 采购订单信息 + */ + @Override + public List selectPurchaseOrderBindList(MesPurchaseOrder mesPurchaseOrder) { + return mesPurchaseOrderMapper.selectPurchaseOrderBindList(mesPurchaseOrder); + } + + } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsRawStockController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsRawStockController.java index 75d3857..3f45fd3 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsRawStockController.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsRawStockController.java @@ -107,6 +107,11 @@ public class WmsRawStockController extends BaseController } + @PostMapping(value = "/checkRawStock") + public AjaxResult checkRawStock(@RequestBody WmsRawStock wmsRawStock){ + return success(wmsRawStockService.checkRawStock(wmsRawStock)); + } + /** * 获取原材料库存信息 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 75e93e1..b576ca4 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 @@ -131,8 +131,12 @@ public class WmsRawReturn extends BaseEntity private String warehouseName; + private String materialCode; + private String materialName; + private String materialSpec; + private String productName; /** 原材料退库记录明细信息 */ @@ -401,6 +405,14 @@ public class WmsRawReturn extends BaseEntity this.warehouseName = warehouseName; } + public String getMaterialCode() { + return materialCode; + } + + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + public String getMaterialName() { return materialName; } @@ -409,6 +421,14 @@ public class WmsRawReturn extends BaseEntity this.materialName = materialName; } + public String getMaterialSpec() { + return materialSpec; + } + + public void setMaterialSpec(String materialSpec) { + this.materialSpec = materialSpec; + } + public String getProductName() { return productName; } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawStockService.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawStockService.java index 6331038..ccf716c 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawStockService.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsRawStockService.java @@ -66,4 +66,11 @@ public interface IWmsRawStockService * @return */ public WmsRawStock getWmsRawStockByInstockBatch(String instockBatch); + + /** + * 根据物料ID校验库存 + * @param wmsRawStock + * @return + */ + public boolean checkRawStock(WmsRawStock wmsRawStock); } 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 fce4f83..4f6e5db 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 @@ -147,12 +147,17 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService String operationType = warehouse.getWarehouseType().equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL) ? WmsConstants.WMS_OPERATION_TYPE_MANUAL : WmsConstants.WMS_OPERATION_TYPE_AUTO; + String auditStatus = WmsConstants.WMS_AUDIT_STATUS_PASS; + if (warehouse.getOutRequirement().equals(WmsConstants.WMS_WAREHOUSE_OUT_REQUIREMENT_APPLY_AUDIT)) { + auditStatus = WmsConstants.WMS_AUDIT_STATUS_TOAUDIT; + } + String userName = SecurityUtils.getUsername(); Date currentDate = new Date(); wmsProductOutstock.setProductType(WmsConstants.WMS_PRODUCT_OUTSTOCK_PRODUCT_TYPE_PRODUCT); wmsProductOutstock.setOperationType(operationType); wmsProductOutstock.setOutstockType(WmsConstants.WMS_PRODUCT_OUTSTOCK_TYPE_SALE); - wmsProductOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS); + wmsProductOutstock.setAuditStatus(auditStatus); wmsProductOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE); wmsProductOutstock.setApplyBy(userName); wmsProductOutstock.setApplyDate(currentDate); @@ -329,6 +334,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService /** * 查询成品出库记录列表,供审核使用 + * * @param wmsProductOutstock * @return */ @@ -339,6 +345,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService /** * 获取成品出库记录详细信息,供审核使用 + * * @param productOutstockId * @return */ @@ -350,6 +357,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService /** * 审核成品出库记录 + * * @param wmsProductOutstockAuditVo * @return */ diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawStockServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawStockServiceImpl.java index 8b48fab..e99fcef 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawStockServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawStockServiceImpl.java @@ -1,6 +1,7 @@ package com.hw.wms.service.impl; import java.util.List; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hw.wms.mapper.WmsRawStockMapper; @@ -9,97 +10,104 @@ import com.hw.wms.service.IWmsRawStockService; /** * 原材料库存Service业务层处理 - * + * * @author xs * @date 2023-12-20 */ @Service -public class WmsRawStockServiceImpl implements IWmsRawStockService -{ +public class WmsRawStockServiceImpl implements IWmsRawStockService { @Autowired private WmsRawStockMapper wmsRawStockMapper; /** * 查询原材料库存 - * + * * @param rawStockId 原材料库存主键 * @return 原材料库存 */ @Override - public WmsRawStock selectWmsRawStockByRawStockId(Long rawStockId) - { + public WmsRawStock selectWmsRawStockByRawStockId(Long rawStockId) { return wmsRawStockMapper.selectWmsRawStockByRawStockId(rawStockId); } /** * 查询原材料库存列表 - * + * * @param wmsRawStock 原材料库存 * @return 原材料库存 */ @Override - public List selectWmsRawStockList(WmsRawStock wmsRawStock) - { - List wmsRawStocks= wmsRawStockMapper.selectWmsRawStockList(wmsRawStock);; + public List selectWmsRawStockList(WmsRawStock wmsRawStock) { + List wmsRawStocks = wmsRawStockMapper.selectWmsRawStockList(wmsRawStock); + ; return wmsRawStocks; } /** * 新增原材料库存 - * + * * @param wmsRawStock 原材料库存 * @return 结果 */ @Override - public int insertWmsRawStock(WmsRawStock wmsRawStock) - { + public int insertWmsRawStock(WmsRawStock wmsRawStock) { return wmsRawStockMapper.insertWmsRawStock(wmsRawStock); } /** * 修改原材料库存 - * + * * @param wmsRawStock 原材料库存 * @return 结果 */ @Override - public int updateWmsRawStock(WmsRawStock wmsRawStock) - { + public int updateWmsRawStock(WmsRawStock wmsRawStock) { return wmsRawStockMapper.updateWmsRawStock(wmsRawStock); } /** * 批量删除原材料库存 - * + * * @param rawStockIds 需要删除的原材料库存主键 * @return 结果 */ @Override - public int deleteWmsRawStockByRawStockIds(Long[] rawStockIds) - { + public int deleteWmsRawStockByRawStockIds(Long[] rawStockIds) { return wmsRawStockMapper.deleteWmsRawStockByRawStockIds(rawStockIds); } /** * 删除原材料库存信息 - * + * * @param rawStockId 原材料库存主键 * @return 结果 */ @Override - public int deleteWmsRawStockByRawStockId(Long rawStockId) - { + public int deleteWmsRawStockByRawStockId(Long rawStockId) { return wmsRawStockMapper.deleteWmsRawStockByRawStockId(rawStockId); } /** * 根据原材料条码获取原材料库存信息 + * * @param instockBatch * @return */ @Override - public WmsRawStock getWmsRawStockByInstockBatch(String instockBatch){ + public WmsRawStock getWmsRawStockByInstockBatch(String instockBatch) { return wmsRawStockMapper.selectRawStockByBarcode(instockBatch); } + + + /** + * 根据物料ID校验库存 + * @param wmsRawStock + * @return + */ + @Override + public boolean checkRawStock(WmsRawStock wmsRawStock) { + List wmsRawStocks = wmsRawStockMapper.selectWmsRawStockList(wmsRawStock); + return wmsRawStocks != null && !wmsRawStocks.isEmpty(); + } } 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 789ed51..eb88af8 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 @@ -36,7 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -311,8 +313,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" wrr.warehouse_id, wrr.location_code, wrr.material_id, + mbmi.material_code, mbmi.material_name, - wrr.batch_code, + mbmi.material_spec, + wrr.material_barcode, wrr.plan_amount, wrr.return_amount, wrr.execute_status, diff --git a/hw-ui/src/api/mes/barcode.js b/hw-ui/src/api/mes/barcode.js index c3da48d..844ab3a 100644 --- a/hw-ui/src/api/mes/barcode.js +++ b/hw-ui/src/api/mes/barcode.js @@ -130,10 +130,10 @@ export function addProductBarcode(data) { -// 无采购订单新增原材料条码信息 -export function checkBarcode(data) { +// 根据物料ID校验库存 +export function checkRawStock(data) { return request({ - url: '/mes/barcode/checkBarcode', + url: '/wms/rawstock/checkRawStock', method: 'post', data: data }) diff --git a/hw-ui/src/api/mes/purchaseOrder.js b/hw-ui/src/api/mes/purchaseOrder.js index c930f21..5e1e0b6 100644 --- a/hw-ui/src/api/mes/purchaseOrder.js +++ b/hw-ui/src/api/mes/purchaseOrder.js @@ -109,3 +109,14 @@ export function removeSalesBindPurchase(data) { params: data }) } + + + +//查询采购订单信息,for 采购新增原材料条码 +export function selectPurchaseOrderBindList(query) { + return request({ + url: '/mes/barcode/selectPurchaseOrderBindList', + method: 'get', + params: query + }) +} diff --git a/hw-ui/src/router/index.js b/hw-ui/src/router/index.js index 9217393..ed26f5f 100644 --- a/hw-ui/src/router/index.js +++ b/hw-ui/src/router/index.js @@ -529,7 +529,7 @@ export const dynamicRoutes = [ path: '/wms/product-outstock', component: Layout, hidden: true, - permissions: ['wms:productoutstock:audit:list'], + permissions: ['wms:productoutstock:audit:query'], children: [ { path: 'audit/:taskCode', @@ -544,7 +544,7 @@ export const dynamicRoutes = [ path: '/wms/raw-outstock', component: Layout, hidden: true, - permissions: ['wms:rawoutstock:audit:list'], + permissions: ['wms:rawoutstock:audit:query'], children: [ { path: 'audit/:taskCode/:detailFlag/:warehouseName', @@ -575,7 +575,7 @@ export const dynamicRoutes = [ path: '/wms/raw-return', component: Layout, hidden: true, - permissions: ['wms:rawreturn:audit:list'], + permissions: ['wms:rawreturn:audit:query'], children: [ { path: 'audit/:rawReturnId/:detailFlag/:warehouseName', diff --git a/hw-ui/src/views/mes/barcode/index.vue b/hw-ui/src/views/mes/barcode/index.vue index c607d8d..c93346f 100644 --- a/hw-ui/src/views/mes/barcode/index.vue +++ b/hw-ui/src/views/mes/barcode/index.vue @@ -1,6 +1,23 @@