From 07294c5b3a2ea804860a171f4824e29d30cab198 Mon Sep 17 00:00:00 2001 From: xs Date: Sat, 3 Aug 2024 12:01:33 +0800 Subject: [PATCH] =?UTF-8?q?2.8.1=20=E8=BD=A6=E9=97=B4MES=E5=AE=8C=E5=96=84?= =?UTF-8?q?=EF=BC=9A=201=E3=80=81=E5=9B=9B=E6=A5=BC=E8=A3=85=E9=85=8D?= =?UTF-8?q?=E5=B7=A5=E5=BA=8F=E5=A2=9E=E5=8A=A0=E5=AF=B9=E5=86=85=E6=88=90?= =?UTF-8?q?=E5=93=81=E5=87=BA=E5=BA=93=E5=8A=9F=E8=83=BD=202=E3=80=81?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90=E6=9D=A1=E7=A0=81=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=9B=B4=E6=96=B0=E7=BB=91=E5=AE=9A=E6=9D=A1=E7=A0=81?= =?UTF-8?q?=203=E3=80=81=E5=AF=B9=E5=86=85=E7=94=9F=E4=BA=A7=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E6=88=90=E5=93=81=E6=9D=A1=E7=A0=81=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E6=A0=87=E8=AF=86=E8=A6=81=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hw/mes/api/domain/MesBaseBarcodeInfo.java | 11 + .../hw/common/core/constant/MesConstants.java | 7 + .../hw/mes/controller/MesApiController.java | 48 +-- .../service/IMesBaseBarcodeInfoService.java | 8 + .../impl/MesBaseBarcodeInfoServiceImpl.java | 51 +++ .../mapper/mes/MesBaseBarcodeInfoMapper.xml | 5 + .../hw/wms/controller/WmsApiController.java | 12 + .../service/IWmsProductOutstockService.java | 11 + .../impl/WmsProductInstockServiceImpl.java | 10 +- .../WmsProductOutstockDetailServiceImpl.java | 6 +- .../impl/WmsProductOutstockServiceImpl.java | 73 +++- .../mapper/wms/WmsProductStockMapper.xml | 3 + hw-ui/src/api/board/index.js | 19 + .../src/views/board/fourthFloor/assemble.vue | 351 ++++++++++-------- 14 files changed, 420 insertions(+), 195 deletions(-) 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 0ee3017..29fb2a6 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 @@ -129,6 +129,9 @@ public class MesBaseBarcodeInfo extends BaseEntity @Excel(name = "项目号") private String projectNo; + private String completeFlag;//完整标识 + + /** * 流转到的生产计划明细编号,用于在生产时使用条码开始明细使用,关联mes_product_plan_detail的plan_detail_code*/ private String transferredPlanDetailCode; @@ -444,6 +447,14 @@ public class MesBaseBarcodeInfo extends BaseEntity return projectNo; } + public String getCompleteFlag() { + return completeFlag; + } + + public void setCompleteFlag(String completeFlag) { + this.completeFlag = completeFlag; + } + public String getTransferredPlanDetailCode() { return transferredPlanDetailCode; } diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java index c70a390..788138a 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java @@ -189,4 +189,11 @@ public class MesConstants { * 生产工序末工序标识 */ public static final String MES_FINAL_PROCESS_FLAG_YES = "1";//是 + + + /** + * 条码信息完整标识 + */ + public static final String MES_BASE_BARCODE_COMPLETE_FLAG_YES = "1"; + public static final String MES_BASE_BARCODE_COMPLETE_FLAG_NO = "0"; } 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 7537f54..760f9c1 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 @@ -52,8 +52,7 @@ public class MesApiController extends BaseController { * 查询当前登录工位信息 */ @GetMapping("/getLoginStationInfo") - public AjaxResult getLoginStationInfo() - { + public AjaxResult getLoginStationInfo() { MesBaseStationInfo loginStationInfo = mesBaseStationInfoService.getLoginStationInfo(); return success(loginStationInfo); } @@ -162,7 +161,7 @@ public class MesApiController extends BaseController { @Log(title = "生产计划明细", businessType = BusinessType.START) @PostMapping(("/startNextProductPlanDetail")) public AjaxResult startNextProductPlanDetail(@RequestBody MesProductPlanDetail mesProductPlanDetail) { - return success(productPlanDetailService.startNextMesProductPlanDetail(mesProductPlanDetail,"")); + return success(productPlanDetailService.startNextMesProductPlanDetail(mesProductPlanDetail, "")); } /** @@ -188,7 +187,7 @@ public class MesApiController extends BaseController { MesProductPlanDetail mesProductPlanDetail = new MesProductPlanDetail(); mesProductPlanDetail.setPlanId(mesProductPlanDetailAttachVo.getPlanId()); mesProductPlanDetail.setAttachId(mesProductPlanDetailAttachVo.getAttachId()); - return success(productPlanDetailService.startNextMesProductPlanDetail(mesProductPlanDetail,"")); + return success(productPlanDetailService.startNextMesProductPlanDetail(mesProductPlanDetail, "")); } /** @@ -231,6 +230,7 @@ public class MesApiController extends BaseController { /** * 查询物料安装情况 + * * @param hashMap (installType=1已安装,installType=2未安装) * @return */ @@ -241,8 +241,6 @@ public class MesApiController extends BaseController { } - - /** * 更新绑定的原材料条码的plancode和plandetailcode */ @@ -254,8 +252,7 @@ public class MesApiController extends BaseController { @GetMapping("/listProductBarcode") - public TableDataInfo listProductBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) - { + public TableDataInfo listProductBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) { startPage(); List list = mesBaseBarcodeInfoService.selectMesBaseBarcodeInfoList(mesBaseBarcodeInfo); return getDataTable(list); @@ -266,9 +263,8 @@ public class MesApiController extends BaseController { * 新增成品条码信息 */ @Log(title = "条码信息", businessType = BusinessType.INSERT) - @PostMapping(value="/addProductBarcode") - public AjaxResult addProductBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo) - { + @PostMapping(value = "/addProductBarcode") + public AjaxResult addProductBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo) { return toAjax(mesBaseBarcodeInfoService.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo)); } @@ -278,8 +274,7 @@ public class MesApiController extends BaseController { * 根据条码信息获取条码信息详细信息 */ @GetMapping(value = "/selectProductBarcodeInfoByBarcodeInfo/{barcodeInfo}") - public AjaxResult selectProductBarcodeInfoByBarcodeInfo(@PathVariable("barcodeInfo") String barcodeInfo) - { + public AjaxResult selectProductBarcodeInfoByBarcodeInfo(@PathVariable("barcodeInfo") String barcodeInfo) { return success(mesBaseBarcodeInfoService.selectProductBarcodeInfoByBarcodeInfo(barcodeInfo)); } @@ -287,33 +282,42 @@ public class MesApiController extends BaseController { * 内部生产新增原材料条码信息 */ @Log(title = "条码信息", businessType = BusinessType.INSERT) - @PostMapping(value="/addInternalBarcode") - public AjaxResult addInternalBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo) - { + @PostMapping(value = "/addInternalBarcode") + public AjaxResult addInternalBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo) { return toAjax(mesBaseBarcodeInfoService.insertInternalMesBaseBarcode(mesBaseBarcodeInfo)); } - /** * 重新生成条码信息(之前的条码作废) */ @Log(title = "条码信息", businessType = BusinessType.REGENERATE) - @PostMapping(value="/regenerateBarcode") - public AjaxResult regenerateBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo) - { + @PostMapping(value = "/regenerateBarcode") + public AjaxResult regenerateBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo) { return toAjax(mesBaseBarcodeInfoService.regenerateBarcode(mesBaseBarcodeInfo)); } /** * 打印成品条码 + * * @param barcodeIds * @return */ @GetMapping(value = "/printProductBarcodes/{barcodeIds}") - public AjaxResult printProductBarcodes(@PathVariable Long[] barcodeIds) - { + public AjaxResult printProductBarcodes(@PathVariable Long[] barcodeIds) { return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds, MesConstants.MES_BARCODE_TYPE_PRODUCT)); } + + + /** + * 校验四楼成品出库 + * + * @param materialBarcode + * @return + */ + @GetMapping(value = "/check4thFloorProduceOutstock/{materialBarcode}") + public AjaxResult check4thFloorProduceOutstock(@PathVariable String materialBarcode) { + return success(mesBaseBarcodeInfoService.check4thFloorProduceOutstock(materialBarcode)); + } } 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 42caf3d..f4fce57 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 @@ -167,4 +167,12 @@ public interface IMesBaseBarcodeInfoService * @return */ public List selectWarehouseBarCodeList(MesBaseBarcodeInfo mesBaseBarcodeInfo); + + + /** + * 校验条码是否是内部销售,可以直接出库 + * @param materialBarcode + * @return + */ + public int check4thFloorProduceOutstock(String materialBarcode); } 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 30898e8..a333a1a 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 @@ -281,6 +281,8 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService String saleOrderCode; Long materialId; String barcode = Seq.getId(Seq.mesCompBarcodeSeqType, Seq.mesCompBarcodeCode); + + //在五楼根据原材料条码单独生成成品条码 if (StringUtils.isNotEmpty(mesBaseBarcodeInfo.getSingleFlag()) && mesBaseBarcodeInfo.getSingleFlag().equals(MesConstants.MES_BARCODE_SINGLE_FLAG_YES)) { String rawMaterialBarcode = mesBaseBarcodeInfo.getProductBarcode(); @@ -357,6 +359,10 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService saleOrderId = productPlan.getSaleOrderId(); saleOrderCode = productPlan.getSaleorderCode(); materialId = productPlan.getMaterialId(); + + MesProductOrder mesProductOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(productPlan.getProductOrderId()); + mesBaseBarcodeInfo.setCompleteFlag(mesProductOrder.getSaleType().equals(MesConstants.MES_PRODUCT_ORDER_SALE) + ? MesConstants.MES_BASE_BARCODE_COMPLETE_FLAG_YES : MesConstants.MES_BASE_BARCODE_COMPLETE_FLAG_NO); } @@ -810,6 +816,13 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService throw new ServiceException("此成品条码已经打印过原材料条码,无需重复打印"); } + WmsProductStockVo queryProductStockVo = new WmsProductStockVo(); + queryProductStockVo.setProductBatch(productBarcode); + R isExistProductStock = remoteWmsService.isExistProductStock(queryProductStockVo, SecurityConstants.INNER); + if (isExistProductStock.getData()) { + throw new ServiceException("此物料条码还未出库,不能生成原材料条码"); + } + //先根据之前的成品条码信息获取托盘信息 MesBasePalletInfo queryPalletInfo = new MesBasePalletInfo(); queryPalletInfo.setMaterialBarcode(productBarcode); @@ -914,6 +927,17 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService mesBasePalletInfoMapper.updateMesBasePalletInfo(basePalletInfo); } + MesBaseBarcodeInfo queryBindBarcode = new MesBaseBarcodeInfo(); + queryBindBarcode.setBindBarcode(oldBarcode); + List bindBarcodeInfos = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoList(queryBindBarcode); + if (bindBarcodeInfos != null && !bindBarcodeInfos.isEmpty()) { + for (MesBaseBarcodeInfo bindBarcode : bindBarcodeInfos) { + bindBarcode.setBindBarcode(newBarcode); + bindBarcode.setUpdateBy(userName); + bindBarcode.setUpdateTime(currentDate); + mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(bindBarcode); + } + } mesBaseBarcodeInfo.setBarcodeInfo(newBarcode); mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_NO); @@ -946,4 +970,31 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService return mesBaseBarcodeInfoMapper.selectWarehouseBarCodeList(mesBaseBarcodeInfo); } + + /** + * 校验条码是否是内部销售,可以直接出库 + * + * @param materialBarcode + * @return + */ + @Override + public int check4thFloorProduceOutstock(String materialBarcode) { + MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode); + if (mesBaseBarcodeInfo == null) { + throw new ServiceException("物料条码有误"); + } + String planCode = mesBaseBarcodeInfo.getPlanCode(); + MesProductOrder mesProductOrder = mesProductOrderMapper.selectMesProductOrderByPlanCode(planCode); + if (mesProductOrder == null) { + throw new ServiceException("未找到生产任务"); + } + + if (!mesProductOrder.getSaleType().equals(MesConstants.MES_PRODUCT_ORDER_INTERNAL)) { + throw new ServiceException("此生产任务为外部销售,不能直接出库"); + } + + + return 1; + } + } diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml index 70d4901..f17ac8d 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 @@ -33,6 +33,7 @@ + @@ -103,6 +104,8 @@ and bbi.barcode_info = #{barcodeInfo} and bbi.batch_code = #{batchCode} and bbi.pallet_info_code = #{palletInfoCode} + and bbi.bind_barcode = #{bindBarcode} + and bbi.material_id = #{materialId} and bmi.material_code like concat('%', #{materialCode}, @@ -174,6 +177,7 @@ sale_order_id, saleorder_code, project_no, + complete_flag, serial_number, remark, bind_status, @@ -210,6 +214,7 @@ #{saleOrderId}, #{saleorderCode}, #{projectNo}, + #{completeFlag}, #{serialNumber}, #{remark}, #{bindStatus}, diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java index bc42ff7..41aaac3 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java @@ -45,6 +45,9 @@ public class WmsApiController extends BaseController { @Autowired private IWmsProductInstockService wmsProductInstockService; + @Autowired + private IWmsProductOutstockService wmsProductOutstockService; + @Autowired private IWmsErpScheduledTaskService wmsErpScheduledTaskService; @@ -146,6 +149,15 @@ public class WmsApiController extends BaseController { return toAjax(wmsProductInstockService.fourthFloorProduceInstock(wmsProduceInstockVo)); } + /** + * 对内生产成品出库记录(适合于四楼生产成品出虚拟库,没有库位) + */ + @Log(title = "成品出库记录", businessType = BusinessType.INSERT) + @PostMapping(("/fourthFloorProduceOutstock")) + public AjaxResult fourthFloorProduceOutstock(@Validated @RequestBody WmsProduceInstockVo wmsProduceInstockVo) { + return toAjax(wmsProductOutstockService.fourthFloorProduceOutstock(wmsProduceInstockVo)); + } + /** * 申请返库,wcs轮询后执行完成要插入库存,完整标识为否 */ diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductOutstockService.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductOutstockService.java index 707034a..b73c4da 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductOutstockService.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductOutstockService.java @@ -2,7 +2,9 @@ package com.hw.wms.service; import java.util.List; import com.hw.wms.domain.WmsProductOutstock; +import com.hw.wms.domain.vo.WmsProduceInstockVo; import com.hw.wms.domain.vo.WmsProductOutstockConfirmVo; +import org.springframework.transaction.annotation.Transactional; /** * 成品出库记录Service接口 @@ -83,4 +85,13 @@ public interface IWmsProductOutstockService * @return */ public int finalConfirmProductOutstock(WmsProductOutstockConfirmVo wmsProductOutstockConfirmVo); + + + /** + * 新增成品出库记录(适用于Web端,适用于4楼成品出库,出虚拟库,无库位) + * + * @param wmsProduceInstockVo + * @return + */ + public int fourthFloorProduceOutstock(WmsProduceInstockVo wmsProduceInstockVo); } 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 dd219e9..f3991d6 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 @@ -277,6 +277,7 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { wmsProductStock.setPlanCode(baseBarcodeInfo.getPlanCode()); wmsProductStock.setPlanDetailCode(baseBarcodeInfo.getPlanDetailCode()); wmsProductStock.setWarehouseFloor(warehouseFloor); + wmsProductStock.setSaleOrderId(baseBarcodeInfo.getSaleOrderId()); wmsProductStock.setSaleorderCode(baseBarcodeInfo.getSaleorderCode()); // wmsProductStock.setQualityStatus(wmsRawInstockVo.getQualityStatus()); wmsProductStock.setTotalAmount(instockAmount); @@ -358,9 +359,9 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { throw new ServiceException("物料条码有误"); } -// if (baseBarcodeInfo.getBarcodeType().equals(WmsConstants.RWA_STOCK_STOCK_TYPE_RAW)) { -// throw new ServiceException("此物料条码为原材料,非成品条码"); -// } + if (baseBarcodeInfo.getBarcodeType().equals(WmsConstants.RWA_STOCK_STOCK_TYPE_RAW)) { + throw new ServiceException("此物料条码为原材料,非成品条码"); + } //按原材料入库的柜体原料码进行入库 if (baseBarcodeInfo.getPrintFlag().equals(MesConstants.MES_BARCODE_PRINT_FLAG_NO)) { throw new ServiceException("此条码还未打印"); @@ -405,8 +406,5 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { return wmsProductInstockMapper.insertWmsProductInstock(wmsProductInstock); } - public void syncToErp() { - //todo 根据质检状态是通过的同步给ERP - } } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockDetailServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockDetailServiceImpl.java index aa221c3..a74d5b8 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockDetailServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockDetailServiceImpl.java @@ -93,11 +93,11 @@ public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockD R baseBarcodeInfoR = remoteMesService.getBarcode(productBarcode, SecurityConstants.INNER); if (baseBarcodeInfoR == null) { - throw new ServiceException("物料编码有误"); + throw new ServiceException("物料条码有误"); } MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); if (baseBarcodeInfo == null) { - throw new ServiceException("物料编码有误"); + throw new ServiceException("物料条码有误"); } WmsProductOutstock productOutstock = wmsProductOutstockMapper.selectOnlyWmsProductOutstockByOutstockId(productOutstockId); @@ -106,7 +106,7 @@ public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockD } if(!productOutstock.getProductId().equals(baseBarcodeInfo.getMaterialId())) { - throw new ServiceException("物料编码有误"); + throw new ServiceException("物料条码有误"); } if(StringUtils.isEmpty(locationCode) && 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 d318bfd..e947d38 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 @@ -4,12 +4,18 @@ import java.math.BigDecimal; import java.util.Date; import java.util.List; +import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.constant.WmsConstants; +import com.hw.common.core.domain.R; import com.hw.common.core.exception.ServiceException; import com.hw.common.core.utils.uuid.Seq; import com.hw.common.security.utils.SecurityUtils; +import com.hw.mes.api.RemoteMesService; +import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import com.hw.wms.config.WmsConfig; import com.hw.wms.domain.WmsBaseWarehouse; import com.hw.wms.domain.WmsProductStock; +import com.hw.wms.domain.vo.WmsProduceInstockVo; import com.hw.wms.domain.vo.WmsProductOutstockConfirmVo; import com.hw.wms.mapper.WmsBaseWarehouseMapper; import com.hw.wms.mapper.WmsProductOutstockDetailMapper; @@ -26,6 +32,8 @@ import com.hw.wms.mapper.WmsProductOutstockMapper; import com.hw.wms.domain.WmsProductOutstock; import com.hw.wms.service.IWmsProductOutstockService; +import javax.annotation.Resource; + /** * 成品出库记录Service业务层处理 * @@ -46,6 +54,12 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService @Autowired private WmsBaseWarehouseMapper wmsBaseWarehouseMapper; + @Autowired + private WmsConfig wmsConfig; + + @Resource + private RemoteMesService remoteMesService; + /** * 查询成品出库记录 * @@ -70,7 +84,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService /** * 新增成品出库记录 - *|参数名|类型|必选|说明| + * |参数名|类型|必选|说明| * |:---- |:---|:----- |----- | * | warehouseId | long 仓库ID;领料时需要保存 | * | saleorderId | string @@ -88,7 +102,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService String saleorderCode = wmsProductOutstock.getSaleorderCode(); Long productId = wmsProductOutstock.getProductId(); BigDecimal applyQty = wmsProductOutstock.getApplyQty(); - if(applyQty.compareTo(BigDecimal.ZERO) <=0){ + if (applyQty.compareTo(BigDecimal.ZERO) <= 0) { throw new ServiceException("申请数量需大于0"); } @@ -97,6 +111,8 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService queryProductStock.setSaleorderCode(saleorderCode); queryProductStock.setProductId(productId); queryProductStock.setSaleOrderId(wmsProductOutstock.getSaleOrderId()); + + //group by wps.warehouse_id,wps.sale_order_id,wps.product_id获取的以下库存信息 List productStocks = wmsProductStockMapper.selectWmsProductStocksBySaleorder(queryProductStock); if (productStocks == null || productStocks.isEmpty()) { throw new ServiceException("没有库存"); @@ -270,4 +286,57 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService return wmsProductOutstockDetailMapper.updateWmsProductOutstockDetail(productOutstockDetail); } + + /** + * 新增成品出库记录(适用于Web端,适用于4楼成品出库,出虚拟库,无库位) + * + * @param wmsProduceInstockVo + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int fourthFloorProduceOutstock(WmsProduceInstockVo wmsProduceInstockVo) { + //对内生产可直接出库,外部销售需要申请后才能出库(外部销售在手机端操作出库) + Long warehouseId = wmsConfig.getFourthFloorProductWarehouseId(); + String materialBarcode = wmsProduceInstockVo.getMaterialBarcode(); + + WmsProductStock productStock = wmsProductStockMapper.selectProductStockByBatch(materialBarcode); + BigDecimal availableAmount = getAvailableAmount(productStock); //可申请数量 + + if (availableAmount.compareTo(BigDecimal.ONE) < 0) { + throw new ServiceException("没有库存信息"); + } + + WmsProductOutstock wmsProductOutstock = new WmsProductOutstock(); + String userName = SecurityUtils.getUsername(); + Date currentDate = new Date(); + wmsProductOutstock.setWarehouseId(warehouseId); + wmsProductOutstock.setProductType(WmsConstants.WMS_PRODUCT_OUTSTOCK_PRODUCT_TYPE_PRODUCT); + wmsProductOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL); + wmsProductOutstock.setOutstockType(WmsConstants.WMS_PRODUCT_OUTSTOCK_TYPE_SALE); + wmsProductOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS); + wmsProductOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH); + wmsProductOutstock.setApplyBy(userName); + wmsProductOutstock.setApplyDate(currentDate); + wmsProductOutstock.setTaskCode(Seq.getId(Seq.productOutstockSeqType, Seq.productOutstockCode)); + + wmsProductOutstockMapper.insertWmsProductOutstock(wmsProductOutstock); + + return wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStock.getProductStockId()); + + } + + private static BigDecimal getAvailableAmount(WmsProductStock productStock) { + if (productStock == null) { + throw new ServiceException("没有库存信息"); + } + + /*获取仓库可用库存数量*/ + BigDecimal totalAmount = productStock.getTotalAmount() == null ? BigDecimal.ZERO : productStock.getTotalAmount(); + BigDecimal frozenAmount = productStock.getFrozenAmount() == null ? BigDecimal.ZERO : productStock.getFrozenAmount();//冻结数量暂时没用 + BigDecimal occupyAmount = productStock.getOccupyAmount() == null ? BigDecimal.ZERO : productStock.getOccupyAmount();// + BigDecimal availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount); + return availableAmount; + } + } 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 1dd7f78..dce9ef3 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 @@ -108,6 +108,7 @@ product_id, plan_code, plan_detail_code, + sale_order_id, saleorder_code, total_amount, frozen_amount, @@ -130,6 +131,7 @@ #{productId}, #{planCode}, #{planDetailCode}, + #{saleOrderId}, #{saleorderCode}, #{totalAmount}, #{frozenAmount}, @@ -155,6 +157,7 @@ product_id = #{productId}, plan_code = #{planCode}, plan_detail_code = #{planDetailCode}, + sale_order_id = #{saleOrderId}, saleorder_code = #{saleorderCode}, total_amount = #{totalAmount}, frozen_amount = #{frozenAmount}, diff --git a/hw-ui/src/api/board/index.js b/hw-ui/src/api/board/index.js index a26972f..2cb9e6c 100644 --- a/hw-ui/src/api/board/index.js +++ b/hw-ui/src/api/board/index.js @@ -99,6 +99,25 @@ export function fourthFloorProduceInstock(data) { }) } +// 校验四楼成品出库 +export function check4thFloorProduceOutstock(materialBarcode) { + return request({ + url: '/mes/api/check4thFloorProduceOutstock/'+materialBarcode, + method: 'get' + }) +} + + +// 四楼成品出库 +export function fourthFloorProduceOutstock(data) { + return request({ + url: '/wms/api/fourthFloorProduceOutstock', + method: 'post', + data: data + }) +} + + //扫描物料条码确认使用 export function scanMaterial2Confirm(data) { return request({ diff --git a/hw-ui/src/views/board/fourthFloor/assemble.vue b/hw-ui/src/views/board/fourthFloor/assemble.vue index 52c0861..5f582ed 100644 --- a/hw-ui/src/views/board/fourthFloor/assemble.vue +++ b/hw-ui/src/views/board/fourthFloor/assemble.vue @@ -7,65 +7,65 @@