From c856cfc5e695d0fcab2665fadf6969ab81f13cc1 Mon Sep 17 00:00:00 2001 From: xs Date: Wed, 6 Nov 2024 14:54:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?3.4.5=20=E4=B8=80=E6=A5=BC=E5=B7=A5?= =?UTF-8?q?=E5=BA=8F=E7=94=B3=E8=AF=B7=E9=A2=86=E6=96=99=EF=BC=8C=E6=88=90?= =?UTF-8?q?=E5=93=81=E5=85=A5=E5=BA=93=E5=92=8C=E6=88=90=E5=93=81=E5=87=BA?= =?UTF-8?q?=E5=BA=93=E5=AE=8C=E5=96=84=20=E6=88=90=E5=93=81=E5=87=BA?= =?UTF-8?q?=E5=BA=93=E8=AE=B0=E5=BD=95=EF=BC=8C=E5=8E=9F=E6=9D=90=E6=96=99?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E8=AE=B0=E5=BD=95=E5=92=8C=E6=88=90=E5=93=81?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E5=AE=A1=E6=A0=B8=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hw/wms/controller/WmsApiController.java | 27 ++- .../wms/controller/WmsMobileController.java | 2 +- .../com/hw/wms/domain/WmsProductOutstock.java | 11 ++ .../hw/wms/domain/vo/WmsProduceInstockVo.java | 4 + .../WmsProductOutstockDetailMapper.java | 4 +- .../service/IWmsProductInstockService.java | 11 +- .../service/IWmsProductOutstockService.java | 4 +- .../impl/WmsProductInstockServiceImpl.java | 36 +--- .../WmsProductOutstockDetailServiceImpl.java | 2 + .../impl/WmsProductOutstockServiceImpl.java | 162 ++++++++++++++++-- .../impl/WmsRawOutstockServiceImpl.java | 2 +- .../impl/WmsStockTotalServiceImpl.java | 2 +- .../mapper/wms/WmsProductInstockMapper.xml | 4 + .../wms/WmsProductOutstockDetailMapper.xml | 8 +- .../mapper/wms/WmsProductOutstockMapper.xml | 4 + .../mapper/wms/WmsRawOutstockMapper.xml | 3 +- hw-ui/src/api/board/index.js | 9 + hw-ui/src/views/board/firstFloor/index.vue | 62 +++++-- .../src/views/wms/common/applyRawOutstock.vue | 2 +- .../views/wms/info/productoutstock/index.vue | 18 -- .../src/views/wms/info/rawoutstock/index.vue | 22 +++ .../productoutstock/index.vue | 3 - 22 files changed, 292 insertions(+), 110 deletions(-) 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 1cbe8dc..1b8288c 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 @@ -9,6 +9,7 @@ import com.hw.common.core.web.page.TableDataInfo; import com.hw.common.log.annotation.Log; import com.hw.common.log.enums.BusinessType; import com.hw.common.security.annotation.RequiresPermissions; +import com.hw.wms.config.WmsConfig; import com.hw.wms.domain.*; import com.hw.wms.domain.vo.*; import com.hw.wms.service.*; @@ -58,6 +59,8 @@ public class WmsApiController extends BaseController { @Autowired private IWmsLocationBarcodeService wmsLocationBarcodeService; + @Autowired + private WmsConfig wmsConfig; /** * 根据工位查询查询仓库列表 @@ -153,7 +156,9 @@ public class WmsApiController extends BaseController { @Log(title = "成品入库记录", businessType = BusinessType.INSERT) @PostMapping(("/firstFloorProduceInstock")) public AjaxResult firstFloorProduceInstock(@Validated @RequestBody WmsProduceInstockVo wmsProduceInstockVo) { - return toAjax(wmsProductInstockService.firstFloorProduceInstock(wmsProduceInstockVo)); + wmsProduceInstockVo.setWarehouseId(wmsConfig.getFirstFloorProductWarehouseId()); + wmsProduceInstockVo.setWarehouseFloor(1L); + return toAjax(wmsProductInstockService.firstFourthFloorProduceInstock(wmsProduceInstockVo)); } /** @@ -163,16 +168,30 @@ public class WmsApiController extends BaseController { @Log(title = "成品入库记录", businessType = BusinessType.INSERT) @PostMapping(("/fourthFloorProduceInstock")) public AjaxResult fourthFloorProduceInstock(@Validated @RequestBody WmsProduceInstockVo wmsProduceInstockVo) { - return toAjax(wmsProductInstockService.fourthFloorProduceInstock(wmsProduceInstockVo)); + wmsProduceInstockVo.setWarehouseId(wmsConfig.getFourthFloorProductWarehouseId()); + wmsProduceInstockVo.setWarehouseFloor(4L); + return toAjax(wmsProductInstockService.firstFourthFloorProduceInstock(wmsProduceInstockVo)); } /** - * 对内生产成品出库记录(适合于四楼生产成品出虚拟库,没有库位) + * 对内生产成品出库记录(适合于一楼生产成品出虚拟库,没有库位) + */ + @Log(title = "成品出库记录", businessType = BusinessType.INSERT) + @PostMapping(("/firstFloorProduceOutstock")) + public AjaxResult firstFloorProduceOutstock(@Validated @RequestBody WmsProduceInstockVo wmsProduceInstockVo) { + wmsProduceInstockVo.setWarehouseId(wmsConfig.getFirstFloorProductWarehouseId()); + return toAjax(wmsProductOutstockService.firstFourthFloorProduceOutstock(wmsProduceInstockVo)); + } + + + /** + * 成品出库(适合于四楼生产成品出虚拟库,没有库位) */ @Log(title = "成品出库记录", businessType = BusinessType.INSERT) @PostMapping(("/fourthFloorProduceOutstock")) public AjaxResult fourthFloorProduceOutstock(@Validated @RequestBody WmsProduceInstockVo wmsProduceInstockVo) { - return toAjax(wmsProductOutstockService.fourthFloorProduceOutstock(wmsProduceInstockVo)); + wmsProduceInstockVo.setWarehouseId(wmsConfig.getFourthFloorProductWarehouseId()); + return toAjax(wmsProductOutstockService.firstFourthFloorProduceOutstock(wmsProduceInstockVo)); } /** diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsMobileController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsMobileController.java index f57f3f5..d809239 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsMobileController.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsMobileController.java @@ -332,7 +332,7 @@ public class WmsMobileController extends BaseController { // WmsProductStock queryProductStock = new WmsProductStock(); // queryProductStock.setSaleorderCode(request.getParameter("salesorderCode")); // queryProductStock.setStockType(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT); - queryStockTotal.setWarehouseType(WmsConstants.WMS_WAREHOUSE_TYPE_AGV); +// queryStockTotal.setWarehouseType(WmsConstants.WMS_WAREHOUSE_TYPE_AGV); List wmsStockTotals = wmsStockTotalService.selectWmsStockTotalList4ProductApply(queryStockTotal); return getDataTable(wmsStockTotals); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java index 45d0b0d..00ddbe8 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java @@ -161,6 +161,9 @@ public class WmsProductOutstock extends BaseEntity { private String unitCode; + private String executeIncompleteFlag;//执行未完成标识 + + /** * 成品出库记录明细信息 */ @@ -478,6 +481,14 @@ public class WmsProductOutstock extends BaseEntity { this.materialSpec = materialSpec; } + public String getExecuteIncompleteFlag() { + return executeIncompleteFlag; + } + + public void setExecuteIncompleteFlag(String executeIncompleteFlag) { + this.executeIncompleteFlag = executeIncompleteFlag; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/vo/WmsProduceInstockVo.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/vo/WmsProduceInstockVo.java index 432a581..96d7de4 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/vo/WmsProduceInstockVo.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/vo/WmsProduceInstockVo.java @@ -17,4 +17,8 @@ public class WmsProduceInstockVo { @NotBlank(message="物料条码必须输入") private String materialBarcode; + private Long warehouseId; + + private Long warehouseFloor; + } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockDetailMapper.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockDetailMapper.java index 09a5969..fe5e9ba 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockDetailMapper.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockDetailMapper.java @@ -63,11 +63,11 @@ public interface WmsProductOutstockDetailMapper /** - * 查询成品出库记录明细 + * 查询成品出库记录明细(弃用) * * @param productBarcode 成品条码 * @return 成品出库记录明细 */ - public WmsProductOutstockDetail selectWmsProductOutstockDetailByProductBarcode(String productBarcode); +// public WmsProductOutstockDetail selectWmsProductOutstockDetailByProductBarcode(String productBarcode); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductInstockService.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductInstockService.java index 1e3b54f..8f76b37 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductInstockService.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductInstockService.java @@ -82,22 +82,15 @@ public interface IWmsProductInstockService { */ public int fifthFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo); - /** - * 新增成品入库记录(适用于Web端,适用于1楼成品入库,入虚拟库,无库位) - * - * @param wmsProduceInstockVo - * @return - */ - public int firstFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo); /** - * 新增成品入库记录(适用于Web端,适用于4楼成品入库,入虚拟库,无库位) + * 新增成品入库记录(适用于Web端,适用于1楼和4楼成品入库,入虚拟库,无库位) * * @param wmsProduceInstockVo * @return */ - public int fourthFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo); + public int firstFourthFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo); /** * 查询成品入库记录;成品入库记录列表,join material 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 c06390b..91aa66c 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 @@ -89,12 +89,12 @@ public interface IWmsProductOutstockService /** - * 新增成品出库记录(适用于Web端,适用于4楼成品出库,出虚拟库,无库位) + * 新增成品出库记录(适用于Web端,适用于1楼和4楼成品出库,出虚拟库,无库位) * * @param wmsProduceInstockVo * @return */ - public int fourthFloorProduceOutstock(WmsProduceInstockVo wmsProduceInstockVo); + public int firstFourthFloorProduceOutstock(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 182b398..cb39a05 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 @@ -380,15 +380,15 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { } /** - * 新增成品入库记录(适用于Web端,适用于1楼成品入库,入虚拟库,无库位) + * 新增成品入库记录(适用于Web端,适用于1楼或4楼成品入库,入虚拟库,无库位) * * @param wmsProduceInstockVo * @return */ @Override @Transactional(rollbackFor = Exception.class) - public int firstFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo) { - Long warehouseId = wmsConfig.getFirstFloorProductWarehouseId(); + public int firstFourthFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo) { + Long warehouseId = wmsProduceInstockVo.getWarehouseId(); String productType = WmsConstants.PRODUCT_INSTOCK_STOCK_TYPE_PRODUCT; String operationType = WmsConstants.WMS_OPERATION_TYPE_MANUAL; String executeStatus = WmsConstants.WMS_EXECUTE_STATUS_FINISH; @@ -402,33 +402,7 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { throw new ServiceException("物料条码有误"); } - return produceInstock(baseBarcodeInfo, warehouseId, productType, operationType, executeStatus, 1L); - } - - - /** - * 新增成品入库记录(适用于Web端,适用于4楼成品入库,入虚拟库,无库位) - * - * @param wmsProduceInstockVo - * @return - */ - @Override - @Transactional(rollbackFor = Exception.class) - public int fourthFloorProduceInstock(WmsProduceInstockVo wmsProduceInstockVo) { - Long warehouseId = wmsConfig.getFourthFloorProductWarehouseId(); - String productType = WmsConstants.PRODUCT_INSTOCK_STOCK_TYPE_PRODUCT; - String operationType = WmsConstants.WMS_OPERATION_TYPE_MANUAL; - String executeStatus = WmsConstants.WMS_EXECUTE_STATUS_FINISH; - String materialBarcode = wmsProduceInstockVo.getMaterialBarcode(); - R baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); - if (baseBarcodeInfoR == null) { - throw new ServiceException("物料条码有误"); - } - MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); - if (baseBarcodeInfo == null) { - throw new ServiceException("物料条码有误"); - } - return produceInstock(baseBarcodeInfo, warehouseId, productType, operationType, executeStatus, 4L); + return produceInstock(baseBarcodeInfo, warehouseId, productType, operationType, executeStatus, wmsProduceInstockVo.getWarehouseFloor()); } @@ -483,6 +457,8 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService { wmsProductInstock.setOperationType(operationType); wmsProductInstock.setPlanCode(baseBarcodeInfo.getPlanCode()); wmsProductInstock.setPlanDetailCode(baseBarcodeInfo.getPlanDetailCode()); + wmsProductInstock.setSaleOrderId(baseBarcodeInfo.getSaleOrderId()); + wmsProductInstock.setSaleorderCode(baseBarcodeInfo.getSaleorderCode()); wmsProductInstock.setInstockType(WmsConstants.PRODUCT_INSTOCK_INSTOCK_TYPE_PRODUCT); wmsProductInstock.setProductId(baseBarcodeInfo.getMaterialId()); wmsProductInstock.setProductBatch(baseBarcodeInfo.getBarcodeInfo()); 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 a74d5b8..a311023 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 @@ -89,6 +89,7 @@ public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockD public int insertWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail) { String locationCode = wmsProductOutstockDetail.getLocationCode(); String productBarcode = wmsProductOutstockDetail.getProductBarcode();//成品条码和批次码相同 + //在PDA成品出库,需要选择出库的申请单,然后输入库位码和物料条码 Long productOutstockId = wmsProductOutstockDetail.getProductOutstockId(); R baseBarcodeInfoR = remoteMesService.getBarcode(productBarcode, SecurityConstants.INNER); @@ -109,6 +110,7 @@ public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockD throw new ServiceException("物料条码有误"); } + //一楼成品库和四楼成品库没有库位 if(StringUtils.isEmpty(locationCode) && (wmsConfig.getFirstFloorProductWarehouseId().equals(productOutstock.getWarehouseId()) || wmsConfig.getFourthFloorProductWarehouseId().equals(productOutstock.getWarehouseId()))){ 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 b827205..68600c9 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,6 +4,7 @@ import java.math.BigDecimal; import java.util.Date; import java.util.List; +import com.hw.common.core.constant.MesConstants; import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.constant.WmsConstants; import com.hw.common.core.domain.R; @@ -22,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.stream.Collectors; import com.hw.common.core.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; @@ -262,12 +264,22 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService */ @Override public int finalConfirmProductOutstock(WmsProductOutstockConfirmVo wmsProductOutstockConfirmVo) { - WmsProductOutstockDetail productOutstockDetail = wmsProductOutstockDetailMapper. - selectWmsProductOutstockDetailByProductBarcode(wmsProductOutstockConfirmVo.getMaterialBarcode()); - if (productOutstockDetail == null) { + WmsProductOutstockDetail queryProductOutstockDetail = new WmsProductOutstockDetail(); + queryProductOutstockDetail.setProductBarcode(wmsProductOutstockConfirmVo.getMaterialBarcode()); + List wmsProductOutstockDetailList = wmsProductOutstockDetailMapper.selectWmsProductOutstockDetailList(queryProductOutstockDetail); + if (wmsProductOutstockDetailList == null || wmsProductOutstockDetailList.isEmpty()) { throw new ServiceException("没有此成品出库信息"); } + List unConfirmedProductOutstockDetailList = wmsProductOutstockDetailList.stream(). + filter(wpod ->!wpod.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_CONFIRM)).collect(Collectors.toList()); + if(unConfirmedProductOutstockDetailList==null || unConfirmedProductOutstockDetailList.isEmpty()){ + throw new ServiceException("没有待确认成品出库信息"); + } + + WmsProductOutstockDetail productOutstockDetail = unConfirmedProductOutstockDetailList.get(0); + + String executeStatus = productOutstockDetail.getExecuteStatus(); if (executeStatus.equals(WmsConstants.WMS_EXECUTE_STATUS_CONFIRM)) { throw new ServiceException("此成品出库已经确认,无需再次确认"); @@ -300,9 +312,9 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService */ @Override @Transactional(rollbackFor = Exception.class) - public int fourthFloorProduceOutstock(WmsProduceInstockVo wmsProduceInstockVo) { + public int firstFourthFloorProduceOutstock(WmsProduceInstockVo wmsProduceInstockVo) { //对内生产可直接出库,外部销售需要申请后才能出库(外部销售在手机端操作出库) - Long warehouseId = wmsConfig.getFourthFloorProductWarehouseId(); + Long warehouseId = wmsProduceInstockVo.getWarehouseId(); String materialBarcode = wmsProduceInstockVo.getMaterialBarcode(); WmsProductStock productStock = wmsProductStockMapper.selectProductStockByBatch(materialBarcode); @@ -312,23 +324,137 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService throw new ServiceException("没有库存信息"); } - WmsProductOutstock wmsProductOutstock = new WmsProductOutstock(); + R mesBaseBarcodeInfoData = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); + if (mesBaseBarcodeInfoData == null) { + throw new ServiceException("物料条码有误"); + } + MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoData.getData(); + if (mesBaseBarcodeInfo == null) { + throw new ServiceException("物料条码有误!"); + } + Long materialId = mesBaseBarcodeInfo.getMaterialId(); + Long saleOrderId = mesBaseBarcodeInfo.getSaleOrderId(); + String saleorderCode = mesBaseBarcodeInfo.getSaleorderCode(); + String planCode = mesBaseBarcodeInfo.getPlanCode(); + String planDetailCode = mesBaseBarcodeInfo.getPlanDetailCode(); + + WmsBaseWarehouse warehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(warehouseId); + String outRequirement = warehouse.getOutRequirement(); + 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.setProductBatch(materialBarcode); - wmsProductOutstock.setApplyBy(userName); - wmsProductOutstock.setApplyDate(currentDate); - wmsProductOutstock.setTaskCode(Seq.getId(Seq.productOutstockSeqType, Seq.productOutstockCode)); + Long productOutstockId=null; + //如果是直接出库 + if (outRequirement.equals(WmsConstants.WMS_WAREHOUSE_OUT_REQUIREMENT_DIRECT)) { + WmsProductOutstock wmsProductOutstock = new WmsProductOutstock(); + 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.setProductId(materialId); + wmsProductOutstock.setPlanCode(planCode); + wmsProductOutstock.setPlanDetailCode(planDetailCode); + wmsProductOutstock.setSaleOrderId(saleOrderId); + wmsProductOutstock.setSaleorderCode(saleorderCode); + wmsProductOutstock.setProductBatch(materialBarcode); + wmsProductOutstock.setApplyBy(userName); + wmsProductOutstock.setApplyDate(currentDate); + wmsProductOutstock.setTaskCode(Seq.getId(Seq.productOutstockSeqType, Seq.productOutstockCode)); + + wmsProductOutstockMapper.insertWmsProductOutstock(wmsProductOutstock); + + productOutstockId = wmsProductOutstock.getProductOutstockId(); + wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStock.getProductStockId()); + } else { + WmsProductOutstock queryProductOutstock = new WmsProductOutstock(); + queryProductOutstock.setWarehouseId(warehouseId); + queryProductOutstock.setExecuteIncompleteFlag("1"); + queryProductOutstock.setProductType(WmsConstants.PRODUCT_INSTOCK_STOCK_TYPE_PRODUCT); + queryProductOutstock.setProductId(materialId); + + List wmsProductOutstocks = wmsProductOutstockMapper.selectWmsProductOutstockList(queryProductOutstock); + if (wmsProductOutstocks == null || wmsProductOutstocks.isEmpty()) { + throw new ServiceException("请先从PDA执行成品出库申请"); + } + + if (saleOrderId == null || saleOrderId.equals((0L))) { + throw new ServiceException("此成品为安全库存,不能出库"); + } + + List saleProductOutstocks = wmsProductOutstocks.stream().filter(wmsProductOutstock -> + wmsProductOutstock.getSaleOrderId() != null && wmsProductOutstock.getSaleOrderId().equals(saleOrderId) + ).collect(Collectors.toList()); + + if (saleProductOutstocks == null || saleProductOutstocks.isEmpty()) { + throw new ServiceException("没有此销售订单[" + saleorderCode + "]的成品出库申请"); + } + + List auditPassProductOutstocks = saleProductOutstocks.stream().filter(wmsProductOutstock -> + wmsProductOutstock.getAuditStatus().equals(WmsConstants.WMS_AUDIT_STATUS_PASS) + ).collect(Collectors.toList()); + if (auditPassProductOutstocks == null || auditPassProductOutstocks.isEmpty()) { + throw new ServiceException("此销售订单[" + saleorderCode + "]的成品出库申请未审核通过"); + } + + WmsProductOutstock productOutstock = saleProductOutstocks.get(0); + + /**判断已出库数量和申请的数量*/ + BigDecimal applyQty = productOutstock.getApplyQty() == null ? BigDecimal.ZERO : productOutstock.getApplyQty(); + BigDecimal outstockQty = productOutstock.getOutstockQty() == null ? BigDecimal.ZERO : productOutstock.getOutstockQty(); + + BigDecimal currentOutstockQty = outstockQty.add(BigDecimal.ONE); + if (applyQty.compareTo(currentOutstockQty) < 0) { + throw new ServiceException(String.format("出库申请数量为%1$s,不能再出库", applyQty)); + } + + + + //更新出库记录 + if (applyQty.compareTo(currentOutstockQty) == 0) { + productOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH); + productOutstock.setEndTime(currentDate); + } else if (applyQty.compareTo(currentOutstockQty) > 0) { + productOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_EXECUTING); + } + + productOutstock.setOutstockQty(currentOutstockQty); + if (productOutstock.getBeginTime() == null) { + productOutstock.setBeginTime(currentDate); + } + productOutstock.setUpdateDate(currentDate); + productOutstock.setUpdateBy(userName); + wmsProductOutstockMapper.updateWmsProductOutstock(productOutstock); + + wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStock.getProductStockId()); + + productOutstockId = productOutstock.getProductOutstockId(); + } - wmsProductOutstockMapper.insertWmsProductOutstock(wmsProductOutstock); - return wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStock.getProductStockId()); + //插入出库记录明细 + WmsProductOutstockDetail wmsProductOutstockDetail = new WmsProductOutstockDetail(); + wmsProductOutstockDetail.setProductOutstockId(productOutstockId); + wmsProductOutstockDetail.setLocationCode("virtual"); + wmsProductOutstockDetail.setWarehouseId(warehouseId); + wmsProductOutstockDetail.setProductBarcode(materialBarcode); + wmsProductOutstockDetail.setProductBatch(mesBaseBarcodeInfo.getBatchCode()); + wmsProductOutstockDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH); + wmsProductOutstockDetail.setProductId(materialId); + wmsProductOutstockDetail.setPlanAmount(BigDecimal.ONE); + wmsProductOutstockDetail.setOutstockAmount(BigDecimal.ONE); + wmsProductOutstockDetail.setBeginTime(currentDate); + wmsProductOutstockDetail.setEndTime(currentDate); + wmsProductOutstockDetail.setWarehouseId(productStock.getWarehouseId()); + wmsProductOutstockDetail.setPlanAmount(BigDecimal.ONE); + wmsProductOutstockDetail.setOutstockAmount(BigDecimal.ONE); + wmsProductOutstockDetail.setUpdateDate(currentDate); + wmsProductOutstockDetail.setUpdateBy(userName); + + wmsProductOutstockDetailMapper.insertWmsProductOutstockDetail(wmsProductOutstockDetail); + + return 1; } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java index 9c6e3a9..68141bc 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java @@ -85,7 +85,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { public WmsRawOutstock selectWmsRawOutstockByRawOutstockId(Long rawOutstockId) { WmsRawOutstock wmsRawOutstock = wmsRawOutstockMapper.selectWmsRawOutstockJoinMaterialById(rawOutstockId); WmsRawOutstockDetail queryRawOutstockDetail = new WmsRawOutstockDetail(); - queryRawOutstockDetail.setRawOutstockId(wmsRawOutstock.getRawOutstockId()); + queryRawOutstockDetail.setRawOutstockId(rawOutstockId); List wmsRawOutstockDetailList = wmsRawOutstockDetailMapper.selectWmsRawOutstockDetailList(queryRawOutstockDetail); wmsRawOutstock.setWmsRawOutstockDetailList(wmsRawOutstockDetailList); // if(wmsRawOutstockDetailList!=null && !wmsRawOutstockDetailList.isEmpty()){ diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java index d1d8714..a647a4c 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java @@ -157,7 +157,7 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService { String materialClassfication = wmsStockTotal.getMaterialClassfication(); Long warehouseId = wmsStockTotal.getWarehouseId(); - if(materialClassfication.equals(MesConstants.MES_MATERIAL_CLASSFICATION_VIRTUAL)){ + if(StringUtils.isNotEmpty(materialClassfication) && materialClassfication.equals(MesConstants.MES_MATERIAL_CLASSFICATION_VIRTUAL)){ //五楼原料周转区仓库ID if (warehouseId.equals(wmsConfig.getFifthCabinetWarehouseId())) { wmsStockTotal.setMaterialId(wmsStockTotal.getProductId()); diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml index 9a310d8..6022709 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml @@ -110,6 +110,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" location_code, product_type, operation_type, + saleorder_code, + sale_order_id, plan_code, plan_detail_code, instock_type, @@ -138,6 +140,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{locationCode}, #{productType}, #{operationType}, + #{saleorderCode}, + #{saleOrderId}, #{planCode}, #{planDetailCode}, #{instockType}, diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockDetailMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockDetailMapper.xml index bdb1d9e..6e9653c 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockDetailMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockDetailMapper.xml @@ -125,9 +125,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + + diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml index 053bf92..7a82777 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml @@ -76,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and task_code = #{taskCode} and warehouse_id = #{warehouseId} + and product_id = #{productId} and location_code = #{locationCode} and product_batch = #{productBatch} and product_type = #{productType} @@ -94,6 +95,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and update_date = #{updateDate} and begin_time = #{beginTime} and end_time = #{endTime} + and execute_status in ('0','1') + @@ -357,6 +360,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and wro.audit_status = #{auditStatus} and wro.apply_by like concat('%', #{applyBy}, '%') + order by wro.product_outstock_id desc select wro.raw_outstock_id, wro.task_code, wro.warehouse_id, wro.location_code, wro.order_id, wro.plan_code, wro.plan_detail_code, wro.station_id,wro.material_batch, wro.material_id, wro.operation_type, wro.task_type, wro.apply_reason, wro.audit_reason, wro.audit_status, wro.execute_status, wro.apply_by, wro.apply_date, - wro.audit_by, wro.audit_date, wro.update_by, wro.update_date, wro.begin_time, wro.end_time,wbw.warehouse_name + wro.audit_by, wro.audit_date, wro.update_by, wro.update_date, wro.begin_time, wro.end_time,wro.outstock_amount,wro.real_outstock_amount,wbw.warehouse_name from wms_raw_outstock wro left join wms_base_warehouse wbw on wro.warehouse_id = wbw.warehouse_id and wro.task_code like concat('%', #{taskCode}, '%') @@ -271,6 +271,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and wro.plan_detail_code like concat('%', #{planDetailCode}, '%') and wro.apply_reason like concat('%', #{applyReason}, '%') and wro.audit_status = #{auditStatus} + and wro.execute_status = #{executeStatus} and wro.task_type = #{taskType} and wro.apply_by like concat('%', #{applyBy}, '%') diff --git a/hw-ui/src/api/board/index.js b/hw-ui/src/api/board/index.js index 4aa4bbf..7074bdc 100644 --- a/hw-ui/src/api/board/index.js +++ b/hw-ui/src/api/board/index.js @@ -90,6 +90,15 @@ export function firstFloorProduceInstock(data) { }) } +// 一楼成品出库 +export function firstFloorProduceOutstock(data) { + return request({ + url: '/wms/api/firstFloorProduceOutstock', + method: 'post', + data: data + }) +} + // 四楼成品入库 export function fourthFloorProduceInstock(data) { return request({ diff --git a/hw-ui/src/views/board/firstFloor/index.vue b/hw-ui/src/views/board/firstFloor/index.vue index f434c84..76fe942 100644 --- a/hw-ui/src/views/board/firstFloor/index.vue +++ b/hw-ui/src/views/board/firstFloor/index.vue @@ -245,25 +245,23 @@ 领料 扫描 退库 条码 @@ -330,7 +328,8 @@
- 成品入库 + 成品入库 + 成品出库 退出
@@ -352,7 +351,7 @@ @@ -468,6 +467,7 @@ import { startProductPlanDetail, completeProductPlanDetail, firstFloorProduceInstock, + firstFloorProduceOutstock, scanMaterial2Confirm, selectMaterialInstallationCircumstance, productPlanDetailPause,productPlanDetailContinue @@ -535,7 +535,14 @@ export default { tableData2: [], tableData3: [], submitLoading:false, + productInstockType: null,//类型,出库还是入库 + PRODUCT_INSTOCK_TYPE: { + INSTOCK: "1",//入库 + OUTSTOCK: "2",//出库 + }, + productInstockVisible: false, + productInstockTitle: '', productInstockForm: { materialBarcode: null }, @@ -593,7 +600,7 @@ export default { } }, mounted() { - if(!this.$route.query){ + if(this.finalProcessFlag === '1'){ this.firstConnectSerial(); } @@ -870,31 +877,56 @@ export default { /** 成品入库按钮操作 */ handleProductInstock() { + this.productInstockTitle = "成品入库"; + this.productInstockType = this.PRODUCT_INSTOCK_TYPE.INSTOCK; + this.handleProductStock(); + }, + + /** 成品出库按钮操作 */ + handleProductOutstock() { + this.productInstockTitle = "成品出库"; + this.productInstockType = this.PRODUCT_INSTOCK_TYPE.OUTSTOCK; + this.handleProductStock(); + }, + + handleProductStock() { this.resetProductInstock(); this.productInstockVisible = true; - if (!this.checkSerialConnected()) { this.$confirm('请连接条码枪', '提示', { confirmButtonText: '连接', showClose: true, + // beforeClose:async(action,instance,done)=>{ + // if(action==='confirm'){ + // }else{ + // this.connectSerialPort(); + // } + // + // }, showCancelButton: true, type: 'warning' }).then(() => { - console.log("dddd") this.connectSerial(this.setSerialData); }).catch(() => { }); } }, - submitProductInstock() { this.$refs["productInstockForm"].validate(valid => { if (valid) { - firstFloorProduceInstock(this.productInstockForm).then(response => { - this.$modal.msgSuccess("入库成功"); - this.cancelProductInstock(); - }); + if (this.productInstockType === this.PRODUCT_INSTOCK_TYPE.INSTOCK) { + firstFloorProduceInstock(this.productInstockForm).then(response => { + this.$modal.msgSuccess("入库成功"); + this.cancelProductInstock(); + }); + } else if (this.productInstockType === this.PRODUCT_INSTOCK_TYPE.OUTSTOCK) { + firstFloorProduceOutstock(this.productInstockForm).then(response => { + this.$modal.msgSuccess("出库成功"); + this.cancelProductInstock(); + }); + + } } }); }, diff --git a/hw-ui/src/views/wms/common/applyRawOutstock.vue b/hw-ui/src/views/wms/common/applyRawOutstock.vue index 4c23929..b4dd02a 100644 --- a/hw-ui/src/views/wms/common/applyRawOutstock.vue +++ b/hw-ui/src/views/wms/common/applyRawOutstock.vue @@ -19,7 +19,7 @@ :data="form.wmsRawOutstockDetailList" :header-cell-style="{textAlign:'center'}" max-height="19.13vw" - style="width: 100%;" + style="width: 100%;overflow-x: auto" > - - - - - - - - diff --git a/hw-ui/src/views/wms/info/rawoutstock/index.vue b/hw-ui/src/views/wms/info/rawoutstock/index.vue index 8a5c5cd..9c5e333 100644 --- a/hw-ui/src/views/wms/info/rawoutstock/index.vue +++ b/hw-ui/src/views/wms/info/rawoutstock/index.vue @@ -74,6 +74,21 @@ /> + + + + + 搜索 重置 @@ -94,6 +109,8 @@ + + @@ -103,6 +120,11 @@ + + +