From 42fe60d0d400f6f38738ae0607483931c96d3470 Mon Sep 17 00:00:00 2001 From: xins Date: Wed, 17 Jan 2024 09:26:15 +0800 Subject: [PATCH] =?UTF-8?q?1.3.5=20WMS:=20=E5=AE=8C=E6=88=90=E6=88=90?= =?UTF-8?q?=E5=93=81=E5=87=BA=E5=BA=93=E7=94=B3=E8=AF=B7=E5=92=8C=E6=88=90?= =?UTF-8?q?=E5=93=81=E5=87=BA=E5=BA=93=E7=A1=AE=E8=AE=A4=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E3=80=82=20=E4=BF=AE=E6=94=B9PDA=E6=8E=A5=E5=8F=A3=EF=BC=9A?= =?UTF-8?q?=E8=BD=AC=E5=BA=93=E4=BB=BB=E5=8A=A1(=E5=8D=8A=E6=88=90?= =?UTF-8?q?=E5=93=81=E5=87=BA=E5=8D=8A=E6=88=90=E5=93=81=E5=BA=93=E5=85=A5?= =?UTF-8?q?=E6=88=90=E5=93=81=E5=BA=93)=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hw/common/core/constant/WmsConstants.java | 14 +- .../com/hw/common/core/utils/uuid/Seq.java | 87 +++- .../wms/controller/WmsMobileController.java | 130 +++++- .../wms/controller/WmsTransferController.java | 105 +++++ .../com/hw/wms/domain/WmsProductOutstock.java | 91 ++++ .../wms/domain/WmsProductOutstockDetail.java | 96 ++-- .../com/hw/wms/domain/WmsProductStock.java | 21 + .../java/com/hw/wms/domain/WmsTransfer.java | 436 ++++++++++++++++++ .../com/hw/wms/domain/WmsTransferDetail.java | 255 ++++++++++ .../hw/wms/mapper/WmsBaseWarehouseMapper.java | 2 +- .../WmsProductOutstockDetailMapper.java | 61 +++ .../wms/mapper/WmsProductOutstockMapper.java | 55 ++- .../hw/wms/mapper/WmsProductStockMapper.java | 9 + .../com/hw/wms/mapper/WmsTransferMapper.java | 99 ++++ .../IWmsProductOutstockDetailService.java | 61 +++ .../service/IWmsProductOutstockService.java | 32 +- .../wms/service/IWmsProductStockService.java | 8 + .../hw/wms/service/IWmsTransferService.java | 97 ++++ .../WmsProductOutstockDetailServiceImpl.java | 190 ++++++++ .../impl/WmsProductOutstockServiceImpl.java | 133 +++++- .../impl/WmsProductStockServiceImpl.java | 44 +- .../service/impl/WmsRawReturnServiceImpl.java | 2 +- .../service/impl/WmsTransferServiceImpl.java | 381 +++++++++++++++ .../mapper/wms/WmsBaseWarehouseMapper.xml | 2 +- .../wms/WmsProductOutstockDetailMapper.xml | 121 +++++ .../mapper/wms/WmsProductOutstockMapper.xml | 85 +++- .../mapper/wms/WmsProductStockMapper.xml | 20 +- .../mapper/wms/WmsTransferMapper.xml | 270 +++++++++++ 28 files changed, 2751 insertions(+), 156 deletions(-) create mode 100644 hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsTransferController.java create mode 100644 hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsTransfer.java create mode 100644 hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsTransferDetail.java create mode 100644 hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockDetailMapper.java create mode 100644 hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsTransferMapper.java create mode 100644 hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductOutstockDetailService.java create mode 100644 hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsTransferService.java create mode 100644 hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockDetailServiceImpl.java create mode 100644 hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java create mode 100644 hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockDetailMapper.xml create mode 100644 hw-modules/hw-wms/src/main/resources/mapper/wms/WmsTransferMapper.xml diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/WmsConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/WmsConstants.java index 107453b..575d366 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/WmsConstants.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/WmsConstants.java @@ -124,10 +124,9 @@ public class WmsConstants { public static final String WMS_MOVEMERGE_TYPE_MERGE = "2";//合库 - public static final String WMS_WAREHOUSE_TYPE_NORMAL = "0";//普通仓库 - public static final String WMS_WAREHOUSE_TYPE_AGV = "1";//AGV仓库 - - public static final String WMS_WAREHOUSE_TYPE_WORKBIN_AGV = "2";//料箱AGV仓库 + public static final String WMS_WAREHOUSE_TYPE_NORMAL = "1";//普通仓库 + public static final String WMS_WAREHOUSE_TYPE_AGV = "2";//AGV仓库 + public static final String WMS_WAREHOUSE_TYPE_WORKBIN_AGV = "3";//料箱AGV仓库 public static final Map OPERATION_TYPE_MAP = new HashMap(); static { @@ -190,4 +189,11 @@ public class WmsConstants { public static final String WMS_TRANSFER_DETAIL_TYPE_INSTOCK = "2";//入库 + + /*成品出库记录成品类型*/ + public static final String WMS_PRODUCT_OUTSTOCK_PRODUCT_TYPE_SEMI = "2";//半成品 + public static final String WMS_PRODUCT_OUTSTOCK_PRODUCT_TYPE_PRODUCT = "3";//成品 + + /*成品出库记录出库类型*/ + public static final String WMS_PRODUCT_OUTSTOCK_TYPE_SALE = "1";//销售出库 } diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/utils/uuid/Seq.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/utils/uuid/Seq.java index 07702d9..89a36b3 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/utils/uuid/Seq.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/utils/uuid/Seq.java @@ -1,14 +1,14 @@ package com.hw.common.core.utils.uuid; import java.util.concurrent.atomic.AtomicInteger; + import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.StringUtils; /** * @author ruoyi 序列生成类 */ -public class Seq -{ +public class Seq { // 通用序列类型 public static final String commSeqType = "COMMON"; @@ -24,26 +24,44 @@ public class Seq // 机器标识 private static final String machineCode = "A"; + + // 成品出库记录序列类型 + public static final String productOutstockSeqType = "PRODUCTOUTSTOCK"; + + // 成品出库记录接口序列数 + private static AtomicInteger productOutstockSeq = new AtomicInteger(1); + + // 成品出库记录标识 + public static final String productOutstockCode = "PO"; + + + // 原材料退库记录序列类型 + public static final String rawReturnSeqType = "RAWRETURN"; + + // 原材料退库记录接口序列数 + private static AtomicInteger rawReturnSeq = new AtomicInteger(1); + + // 原材料退库记录标识 + public static final String rawReturnCode = "RR"; + + /** * 获取通用序列号 - * + * * @return 序列值 */ - public static String getId() - { + public static String getId() { return getId(commSeqType); } - + /** * 默认16位序列号 yyMMddHHmmss + 一位机器标识 + 3长度循环递增字符串 - * + * * @return 序列值 */ - public static String getId(String type) - { + public static String getId(String type) { AtomicInteger atomicInt = commSeq; - if (uploadSeqType.equals(type)) - { + if (uploadSeqType.equals(type)) { atomicInt = uploadSeq; } return getId(atomicInt, 3); @@ -51,13 +69,12 @@ public class Seq /** * 通用接口序列号 yyMMddHHmmss + 一位机器标识 + length长度循环递增字符串 - * + * * @param atomicInt 序列数 - * @param length 数值长度 + * @param length 数值长度 * @return 序列值 */ - public static String getId(AtomicInteger atomicInt, int length) - { + public static String getId(AtomicInteger atomicInt, int length) { String result = DateUtils.dateTimeNow(); result += machineCode; result += getSeq(atomicInt, length); @@ -66,21 +83,51 @@ public class Seq /** * 序列循环递增字符串[1, 10 的 (length)幂次方), 用0左补齐length位数 - * + * * @return 序列值 */ - private synchronized static String getSeq(AtomicInteger atomicInt, int length) - { + private synchronized static String getSeq(AtomicInteger atomicInt, int length) { // 先取值再+1 int value = atomicInt.getAndIncrement(); // 如果更新后值>=10 的 (length)幂次方则重置为1 int maxSeq = (int) Math.pow(10, length); - if (atomicInt.get() >= maxSeq) - { + if (atomicInt.get() >= maxSeq) { atomicInt.set(1); } // 转字符串,用0左补齐 return StringUtils.padl(value, length); } + + + /** + * 默认16位序列号 yyMMddHHmmss + 一位机器标识 + 3长度循环递增字符串 + * + * @return 序列值 + */ + public static String getId(String type,String code) { + AtomicInteger atomicInt = commSeq; + if (productOutstockSeqType.equals(type)) { + atomicInt = productOutstockSeq; + }else if (rawReturnSeqType.equals(type)) { + atomicInt = rawReturnSeq; + } + return getId(atomicInt, 3,code); + } + + + /** + * 通用接口序列号 yyMMddHHmmss + 一位机器标识 + length长度循环递增字符串 + * + * @param atomicInt 序列数 + * @param length 数值长度 + * @return 序列值 + */ + public static String getId(AtomicInteger atomicInt, int length, String code) { + String result = DateUtils.dateTimeNow(); + result += code; + result += getSeq(atomicInt, length); + return result; + } + } 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 7e63db5..29733c8 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 @@ -12,10 +12,12 @@ import com.hw.common.security.annotation.RequiresPermissions; import com.hw.wms.domain.*; import com.hw.wms.domain.vo.*; import com.hw.wms.service.*; +import javafx.scene.control.Tab; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -40,6 +42,12 @@ public class WmsMobileController extends BaseController { @Autowired private IWmsProductInstockService wmsProductInstockService; + @Autowired + private IWmsProductOutstockService wmsProductOutstockService; + + @Autowired + private IWmsProductOutstockDetailService wmsProductOutstockDetailService; + @Autowired private IWmsMoveMergeService wmsMoveMergeService; @@ -68,12 +76,12 @@ public class WmsMobileController extends BaseController { */ // @RequiresPermissions("wms:rawoutstock:list") @GetMapping("/getToAuditedRawOutstocks") - public AjaxResult getToAuditedRawOutstocks() { + public TableDataInfo getToAuditedRawOutstocks() { startPage(); WmsRawOutstock wmsRawOutstock = new WmsRawOutstock(); wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_TOAUDIT); List list = wmsRawOutstockService.selectWmsRawOutstockList(wmsRawOutstock); - return success(list); + return getDataTable(list); } /** @@ -98,13 +106,13 @@ public class WmsMobileController extends BaseController { * 查询原材料审核通过的出库记录明细列表 */ // @RequiresPermissions("wms:rawoutstock:list") - @PostMapping("/getAuditPassRawOutstockDetails") - public AjaxResult getAuditPassRawOutstockDetails(@Validated @RequestBody WmsRawOutstockDetailVo wmsRawOutstockDetailVo) { + @GetMapping("/getAuditPassRawOutstockDetails") + public TableDataInfo getAuditPassRawOutstockDetails(WmsRawOutstockDetail wmsRawOutstockDetail) { startPage(); - WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail(); - wmsRawOutstockDetail.setApplyBy(wmsRawOutstockDetailVo.getApplyBy()); +// WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail(); +// wmsRawOutstockDetail.setApplyBy(request.getParameter("applyBy")); List list = wmsRawOutstockService.selectAuditPassRawOutstockDetails(wmsRawOutstockDetail); - return success(list); + return getDataTable(list); } /** @@ -122,12 +130,12 @@ public class WmsMobileController extends BaseController { */ // @RequiresPermissions("wms:rawoutstock:list") @GetMapping("/getToAuditedRawReturns") - public AjaxResult getToAuditedRawReturns() { + public TableDataInfo getToAuditedRawReturns() { startPage(); WmsRawReturn wmsRawReturn = new WmsRawReturn(); wmsRawReturn.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_TOAUDIT); List list = wmsRawReturnService.selectWmsRawReturnJoinList(wmsRawReturn); - return success(list); + return getDataTable(list); } /** @@ -153,12 +161,12 @@ public class WmsMobileController extends BaseController { */ // @RequiresPermissions("wms:rawoutstock:list") @PostMapping("/getAuditPassRawReturnDetails") - public AjaxResult getAuditPassRawReturnDetails(@Validated @RequestBody WmsRawOutstockDetailVo wmsRawOutstockDetailVo) { + public TableDataInfo getAuditPassRawReturnDetails(WmsRawReturnDetail wmsRawReturnDetail) { startPage(); - WmsRawReturnDetail wmsRawReturnDetail = new WmsRawReturnDetail(); - wmsRawReturnDetail.setApplyBy(wmsRawOutstockDetailVo.getApplyBy()); +// WmsRawReturnDetail wmsRawReturnDetail = new WmsRawReturnDetail(); +// wmsRawReturnDetail.setApplyBy(request.getParameter("applyBy")); List list = wmsRawReturnService.selectAuditPassRawReturnDetails(wmsRawReturnDetail); - return success(list); + return getDataTable(list); } /** @@ -217,11 +225,13 @@ public class WmsMobileController extends BaseController { * 根据仓库ID获取成品库存信息 */ // @RequiresPermissions("wms:rawoutstock:query") - @GetMapping(value = "/getProductStock") - public AjaxResult getProductStock(Long warehouseId) { - WmsProductStock queryProductStock = new WmsProductStock(); - queryProductStock.setWarehouseId(warehouseId); - return success(wmsProductStockService.selectWmsProductStockJoinList(queryProductStock)); + @GetMapping(value = "/getProductStocksByWarehouseId") + public TableDataInfo getProductStocksByWarehouseId( WmsProductStock queryProductStock) { + startPage(); +// WmsProductStock queryProductStock = new WmsProductStock(); +// queryProductStock.setWarehouseId(Long.valueOf(request.getParameter("warehouseId"))); + List list = wmsProductStockService.selectWmsProductStockJoinList(queryProductStock); + return getDataTable(list); } @@ -240,10 +250,12 @@ public class WmsMobileController extends BaseController { */ // @RequiresPermissions("wms:rawoutstock:query") @GetMapping(value = "/getTransfers") - public AjaxResult getTransfers() { + public TableDataInfo getTransfers() { + startPage(); WmsTransfer queryTransfer = new WmsTransfer(); queryTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH); - return success(wmsTransferService.selectWmsTransferJoinList(queryTransfer)); + List list = wmsTransferService.selectWmsTransferJoinList(queryTransfer); + return getDataTable(list); } @@ -267,6 +279,84 @@ public class WmsMobileController extends BaseController { } + /** + * 根据销售订单编号获取成品库存列表 + */ +// @RequiresPermissions("wms:rawoutstock:query") + @GetMapping(value = "/getProductStocksBySalesorderCode") + public TableDataInfo getProductStocksBySalesorderCode(WmsProductStock queryProductStock) { + startPage(); +// WmsProductStock queryProductStock = new WmsProductStock(); +// queryProductStock.setSaleorderCode(request.getParameter("salesorderCode")); +// queryProductStock.setStockType(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT); + List list = wmsProductStockService.selectWmsProductStocksBySaleorder(queryProductStock); + return getDataTable(list); + } + + /** + * 成品出库申请(包括人工合agv的出库申请) + */ + @Log(title = "成品出库记录", businessType = BusinessType.INSERT) + @PostMapping(("/applyProductOutstock")) + public AjaxResult applyProductOutstock(@RequestBody WmsProductOutstock wmsProductOutstock) { + return toAjax(wmsProductOutstockService.insertWmsProductOutstock(wmsProductOutstock)); + } + + + /** + * 获取人工成品出库任务列表 + */ +// @RequiresPermissions("wms:rawoutstock:query") + @GetMapping(value = "/getProductOutStocks") + public TableDataInfo getProductOutStocks(WmsProductOutstock queryProductOutstock) { + startPage(); + queryProductOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL); + queryProductOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH); + queryProductOutstock.setProductType(WmsConstants.WMS_PRODUCT_OUTSTOCK_PRODUCT_TYPE_PRODUCT); + List list = wmsProductOutstockService.selectWmsProductOutstockJoinList(queryProductOutstock); + return getDataTable(list); + } + + /** + * 获取人工成品出库任务明细,参数是productOutstockId + */ +// @RequiresPermissions("wms:rawoutstock:query") + @GetMapping(value = "/getProductOutStockWithDetails") + public AjaxResult getProductOutStockWithDetails(WmsProductOutstock queryProductOutstock) { + AjaxResult ajax = AjaxResult.success(); + WmsProductOutstock productOutstock = wmsProductOutstockService. + selectWmsProductOutstockJoinByOutstockId(queryProductOutstock.getProductOutstockId()); + + startPage(); + WmsProductOutstockDetail queryProductOutstockDetail = new WmsProductOutstockDetail(); + List productOutstockDetails = wmsProductOutstockDetailService.selectWmsProductOutstockDetailList(queryProductOutstockDetail); + + ajax.put("productOutstock",productOutstock); + ajax.put("productOutstockDetails",productOutstockDetails); + return ajax; + } + + /** + * 人工成品出库确认 + */ + @Log(title = "成品出库明细", businessType = BusinessType.INSERT) + @PostMapping(("/confirmProductOutstockDetail")) + public AjaxResult confirmProductOutstockDetail(@RequestBody WmsProductOutstockDetail wmsProductOutstockDetail) { + return toAjax(wmsProductOutstockDetailService.insertWmsProductOutstockDetail(wmsProductOutstockDetail)); + } + + + + + + + + + + + + + /** * 人工移库 */ diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsTransferController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsTransferController.java new file mode 100644 index 0000000..61a3ac2 --- /dev/null +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsTransferController.java @@ -0,0 +1,105 @@ +package com.hw.wms.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +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.domain.WmsTransfer; +import com.hw.wms.service.IWmsTransferService; +import com.hw.common.core.web.controller.BaseController; +import com.hw.common.core.web.domain.AjaxResult; +import com.hw.common.core.utils.poi.ExcelUtil; +import com.hw.common.core.web.page.TableDataInfo; + +/** + * 转库记录Controller + * + * @author xins + * @date 2024-01-12 + */ +@RestController +@RequestMapping("/transfer") +public class WmsTransferController extends BaseController +{ + @Autowired + private IWmsTransferService wmsTransferService; + + /** + * 查询转库记录列表 + */ + @RequiresPermissions("wms:transfer:list") + @GetMapping("/list") + public TableDataInfo list(WmsTransfer wmsTransfer) + { + startPage(); + List list = wmsTransferService.selectWmsTransferList(wmsTransfer); + return getDataTable(list); + } + + /** + * 导出转库记录列表 + */ + @RequiresPermissions("wms:transfer:export") + @Log(title = "转库记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmsTransfer wmsTransfer) + { + List list = wmsTransferService.selectWmsTransferList(wmsTransfer); + ExcelUtil util = new ExcelUtil(WmsTransfer.class); + util.exportExcel(response, list, "转库记录数据"); + } + + /** + * 获取转库记录详细信息 + */ + @RequiresPermissions("wms:transfer:query") + @GetMapping(value = "/{transferId}") + public AjaxResult getInfo(@PathVariable("transferId") Long transferId) + { + return success(wmsTransferService.selectWmsTransferByTransferId(transferId)); + } + + /** + * 新增转库记录 + */ + @RequiresPermissions("wms:transfer:add") + @Log(title = "转库记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmsTransfer wmsTransfer) + { + return toAjax(wmsTransferService.insertWmsTransfer(wmsTransfer)); + } + + /** + * 修改转库记录 + */ + @RequiresPermissions("wms:transfer:edit") + @Log(title = "转库记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmsTransfer wmsTransfer) + { + return toAjax(wmsTransferService.updateWmsTransfer(wmsTransfer)); + } + + /** + * 删除转库记录 + */ + @RequiresPermissions("wms:transfer:remove") + @Log(title = "转库记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{transferIds}") + public AjaxResult remove(@PathVariable Long[] transferIds) + { + return toAjax(wmsTransferService.deleteWmsTransferByTransferIds(transferIds)); + } +} 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 3071bea..39952e4 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 @@ -1,5 +1,6 @@ package com.hw.wms.domain; +import java.math.BigDecimal; import java.util.List; import java.util.Date; @@ -70,6 +71,22 @@ public class WmsProductOutstock extends BaseEntity { @Excel(name = "计划明细编号,关联pd_base_plan_detail的plan_detail_code") private String planDetailCode; + private String saleorderCode; + + private String projectNo; + + + private Long productId; + + /** + * 申请数量 + * */ + private BigDecimal applyQty; + + /** + * 已出库数量 + * */ + private BigDecimal outstockQty; /** * 申请原因 */ @@ -141,6 +158,14 @@ public class WmsProductOutstock extends BaseEntity { @Excel(name = "执行结束时间", width = 30, dateFormat = "yyyy-MM-dd") private Date endTime; + private String warehouseName; + + private String materialCode; + + private String materialName; + + + /** * 成品出库记录明细信息 */ @@ -218,6 +243,46 @@ public class WmsProductOutstock extends BaseEntity { this.planDetailCode = planDetailCode; } + public String getSaleorderCode() { + return saleorderCode; + } + + public void setSaleorderCode(String saleorderCode) { + this.saleorderCode = saleorderCode; + } + + public String getProjectNo() { + return projectNo; + } + + public void setProjectNo(String projectNo) { + this.projectNo = projectNo; + } + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public BigDecimal getApplyQty() { + return applyQty; + } + + public void setApplyQty(BigDecimal applyQty) { + this.applyQty = applyQty; + } + + public BigDecimal getOutstockQty() { + return outstockQty; + } + + public void setOutstockQty(BigDecimal outstockQty) { + this.outstockQty = outstockQty; + } + public void setApplyReason(String applyReason) { this.applyReason = applyReason; } @@ -314,6 +379,32 @@ public class WmsProductOutstock extends BaseEntity { this.wmsProductOutstockDetailList = wmsProductOutstockDetailList; } + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public String getMaterialCode() { + return materialCode; + } + + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + + @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/WmsProductOutstockDetail.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstockDetail.java index 23055b6..eb35f20 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstockDetail.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstockDetail.java @@ -10,9 +10,9 @@ import com.hw.common.core.web.domain.BaseEntity; /** * 成品出库记录明细对象 wms_product_outstock_detail - * - * @author xs - * @date 2023-12-20 + * + * @author xins + * @date 2024-01-16 */ public class WmsProductOutstockDetail extends BaseEntity { @@ -33,18 +33,22 @@ public class WmsProductOutstockDetail extends BaseEntity @Excel(name = "库位编码") private String locationCode; - /** 销售订单 */ - @Excel(name = "销售订单") - private String salesOrder; + /** 成品条码 */ + @Excel(name = "成品条码") + private String productBarcode; - /** 项目号 */ - @Excel(name = "项目号") - private String projectNo; + /** 成品批次 */ + @Excel(name = "成品批次") + private String productBatch; /** 成品ID */ @Excel(name = "成品ID") private Long productId; + /** 计划数量 */ + @Excel(name = "计划数量") + private BigDecimal planAmount; + /** 出库数量 */ @Excel(name = "出库数量") private BigDecimal outstockAmount; @@ -72,120 +76,129 @@ public class WmsProductOutstockDetail extends BaseEntity @Excel(name = "执行结束时间", width = 30, dateFormat = "yyyy-MM-dd") private Date endTime; - public void setProductOutstockDetailId(Long productOutstockDetailId) + public void setProductOutstockDetailId(Long productOutstockDetailId) { this.productOutstockDetailId = productOutstockDetailId; } - public Long getProductOutstockDetailId() + public Long getProductOutstockDetailId() { return productOutstockDetailId; } - public void setProductOutstockId(Long productOutstockId) + public void setProductOutstockId(Long productOutstockId) { this.productOutstockId = productOutstockId; } - public Long getProductOutstockId() + public Long getProductOutstockId() { return productOutstockId; } - public void setWarehouseId(Long warehouseId) + public void setWarehouseId(Long warehouseId) { this.warehouseId = warehouseId; } - public Long getWarehouseId() + public Long getWarehouseId() { return warehouseId; } - public void setLocationCode(String locationCode) + public void setLocationCode(String locationCode) { this.locationCode = locationCode; } - public String getLocationCode() + public String getLocationCode() { return locationCode; } - public void setSalesOrder(String salesOrder) + public void setProductBarcode(String productBarcode) { - this.salesOrder = salesOrder; + this.productBarcode = productBarcode; } - public String getSalesOrder() + public String getProductBarcode() { - return salesOrder; + return productBarcode; } - public void setProjectNo(String projectNo) + public void setProductBatch(String productBatch) { - this.projectNo = projectNo; + this.productBatch = productBatch; } - public String getProjectNo() + public String getProductBatch() { - return projectNo; + return productBatch; } - public void setProductId(Long productId) + public void setProductId(Long productId) { this.productId = productId; } - public Long getProductId() + public Long getProductId() { return productId; } - public void setOutstockAmount(BigDecimal outstockAmount) + public void setPlanAmount(BigDecimal planAmount) + { + this.planAmount = planAmount; + } + + public BigDecimal getPlanAmount() + { + return planAmount; + } + public void setOutstockAmount(BigDecimal outstockAmount) { this.outstockAmount = outstockAmount; } - public BigDecimal getOutstockAmount() + public BigDecimal getOutstockAmount() { return outstockAmount; } - public void setExecuteStatus(String executeStatus) + public void setExecuteStatus(String executeStatus) { this.executeStatus = executeStatus; } - public String getExecuteStatus() + public String getExecuteStatus() { return executeStatus; } - public void setErpStatus(String erpStatus) + public void setErpStatus(String erpStatus) { this.erpStatus = erpStatus; } - public String getErpStatus() + public String getErpStatus() { return erpStatus; } - public void setUpdateDate(Date updateDate) + public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } - public Date getUpdateDate() + public Date getUpdateDate() { return updateDate; } - public void setBeginTime(Date beginTime) + public void setBeginTime(Date beginTime) { this.beginTime = beginTime; } - public Date getBeginTime() + public Date getBeginTime() { return beginTime; } - public void setEndTime(Date endTime) + public void setEndTime(Date endTime) { this.endTime = endTime; } - public Date getEndTime() + public Date getEndTime() { return endTime; } @@ -197,9 +210,10 @@ public class WmsProductOutstockDetail extends BaseEntity .append("productOutstockId", getProductOutstockId()) .append("warehouseId", getWarehouseId()) .append("locationCode", getLocationCode()) - .append("salesOrder", getSalesOrder()) - .append("projectNo", getProjectNo()) + .append("productBarcode", getProductBarcode()) + .append("productBatch", getProductBatch()) .append("productId", getProductId()) + .append("planAmount", getPlanAmount()) .append("outstockAmount", getOutstockAmount()) .append("executeStatus", getExecuteStatus()) .append("erpStatus", getErpStatus()) diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductStock.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductStock.java index f64ce96..451805d 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductStock.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductStock.java @@ -95,6 +95,11 @@ public class WmsProductStock extends BaseEntity private String materialName; + private BigDecimal orderAmount; + + private String warehouseName; + + public void setProductStockId(Long productStockId) { this.productStockId = productStockId; @@ -263,6 +268,22 @@ public class WmsProductStock extends BaseEntity this.materialName = materialName; } + public BigDecimal getOrderAmount() { + return orderAmount; + } + + public void setOrderAmount(BigDecimal orderAmount) { + this.orderAmount = orderAmount; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + @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/WmsTransfer.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsTransfer.java new file mode 100644 index 0000000..b570a5d --- /dev/null +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsTransfer.java @@ -0,0 +1,436 @@ +package com.hw.wms.domain; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.hw.common.core.annotation.Excel; +import com.hw.common.core.web.domain.BaseEntity; + +/** + * 转库记录对象 wms_transfer + * + * @author xins + * @date 2024-01-12 + */ +public class WmsTransfer extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 转库记录ID */ + private Long transferId; + + /** 任务编号 */ + @Excel(name = "任务编号") + private String taskCode; + + /** 原仓库ID */ + @Excel(name = "原仓库ID") + private Long oriWarehouseId; + + /** 原库位编码 */ + @Excel(name = "原库位编码") + private String oriLocationCode; + + /** 目标仓库ID */ + @Excel(name = "目标仓库ID") + private Long targetWarehouseId; + + /** 目标库位编码 */ + @Excel(name = "目标库位编码") + private String targetLocationCode; + + /** 物料ID */ + @Excel(name = "物料ID") + private Long materialId; + + /** 产品批次号 */ + @Excel(name = "产品批次号") + private String productBatch; + + /** 计划编号,关联pd_base_plan_info的plan_code */ + @Excel(name = "计划编号,关联pd_base_plan_info的plan_code") + private String planCode; + + /** 申请数量 */ + @Excel(name = "申请数量") + private BigDecimal applyQty; + + /** 已出数量 */ + @Excel(name = "已出数量") + private BigDecimal outstockQty; + + /** 已入数量 */ + @Excel(name = "已入数量") + private BigDecimal instockQty; + + /** 操作类型(0自动,1人工,2强制,3调度) */ + @Excel(name = "操作类型(0自动,1人工,2强制,3调度)") + private String operationType; + + /** 转库类型(1、出半成品库入成品库) */ + @Excel(name = "转库类型(1、出半成品库入成品库)") + private String transferType; + + /** 申请原因 */ + @Excel(name = "申请原因") + private String applyReason; + + /** 审核原因 */ + @Excel(name = "审核原因") + private String auditReason; + + /** 审核状态(0待审核,1审核通过,2审核未通过) */ + @Excel(name = "审核状态(0待审核,1审核通过,2审核未通过)") + private String auditStatus; + + /** 执行状态(0待执行,1待执行,2已完成) */ + @Excel(name = "执行状态(0待执行,1待执行,2已完成)") + private String executeStatus; + + /** 申请人 */ + @Excel(name = "申请人") + private String applyBy; + + /** 申请时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date applyDate; + + /** 审核人 */ + @Excel(name = "审核人") + private String auditBy; + + /** 审核时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date auditDate; + + /** 最后更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date updateDate; + + /** 开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date beginTime; + + /** 结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date endTime; + + + + private String oriWarehouseName; + private String targetWarehouseName; + private String materialCode; + private String materialName; + + /** 转库记录明细;移库合库记录对应的明细信息信息 */ + private List wmsTransferDetailList; + + public void setTransferId(Long transferId) + { + this.transferId = transferId; + } + + public Long getTransferId() + { + return transferId; + } + public void setTaskCode(String taskCode) + { + this.taskCode = taskCode; + } + + public String getTaskCode() + { + return taskCode; + } + public void setOriWarehouseId(Long oriWarehouseId) + { + this.oriWarehouseId = oriWarehouseId; + } + + public Long getOriWarehouseId() + { + return oriWarehouseId; + } + public void setOriLocationCode(String oriLocationCode) + { + this.oriLocationCode = oriLocationCode; + } + + public String getOriLocationCode() + { + return oriLocationCode; + } + public void setTargetWarehouseId(Long targetWarehouseId) + { + this.targetWarehouseId = targetWarehouseId; + } + + public Long getTargetWarehouseId() + { + return targetWarehouseId; + } + public void setTargetLocationCode(String targetLocationCode) + { + this.targetLocationCode = targetLocationCode; + } + + public String getTargetLocationCode() + { + return targetLocationCode; + } + public void setMaterialId(Long materialId) + { + this.materialId = materialId; + } + + public Long getMaterialId() + { + return materialId; + } + public void setProductBatch(String productBatch) + { + this.productBatch = productBatch; + } + + public String getProductBatch() + { + return productBatch; + } + public void setPlanCode(String planCode) + { + this.planCode = planCode; + } + + public String getPlanCode() + { + return planCode; + } + public void setApplyQty(BigDecimal applyQty) + { + this.applyQty = applyQty; + } + + public BigDecimal getApplyQty() + { + return applyQty; + } + public void setOutstockQty(BigDecimal outstockQty) + { + this.outstockQty = outstockQty; + } + + public BigDecimal getOutstockQty() + { + return outstockQty; + } + public void setInstockQty(BigDecimal instockQty) + { + this.instockQty = instockQty; + } + + public BigDecimal getInstockQty() + { + return instockQty; + } + public void setOperationType(String operationType) + { + this.operationType = operationType; + } + + public String getOperationType() + { + return operationType; + } + public void setTransferType(String transferType) + { + this.transferType = transferType; + } + + public String getTransferType() + { + return transferType; + } + public void setApplyReason(String applyReason) + { + this.applyReason = applyReason; + } + + public String getApplyReason() + { + return applyReason; + } + public void setAuditReason(String auditReason) + { + this.auditReason = auditReason; + } + + public String getAuditReason() + { + return auditReason; + } + public void setAuditStatus(String auditStatus) + { + this.auditStatus = auditStatus; + } + + public String getAuditStatus() + { + return auditStatus; + } + public void setExecuteStatus(String executeStatus) + { + this.executeStatus = executeStatus; + } + + public String getExecuteStatus() + { + return executeStatus; + } + public void setApplyBy(String applyBy) + { + this.applyBy = applyBy; + } + + public String getApplyBy() + { + return applyBy; + } + public void setApplyDate(Date applyDate) + { + this.applyDate = applyDate; + } + + public Date getApplyDate() + { + return applyDate; + } + public void setAuditBy(String auditBy) + { + this.auditBy = auditBy; + } + + public String getAuditBy() + { + return auditBy; + } + public void setAuditDate(Date auditDate) + { + this.auditDate = auditDate; + } + + public Date getAuditDate() + { + return auditDate; + } + public void setUpdateDate(Date updateDate) + { + this.updateDate = updateDate; + } + + public Date getUpdateDate() + { + return updateDate; + } + public void setBeginTime(Date beginTime) + { + this.beginTime = beginTime; + } + + public Date getBeginTime() + { + return beginTime; + } + public void setEndTime(Date endTime) + { + this.endTime = endTime; + } + + public Date getEndTime() + { + return endTime; + } + + public List getWmsTransferDetailList() + { + return wmsTransferDetailList; + } + + public void setWmsTransferDetailList(List wmsTransferDetailList) + { + this.wmsTransferDetailList = wmsTransferDetailList; + } + + public String getOriWarehouseName() { + return oriWarehouseName; + } + + public void setOriWarehouseName(String oriWarehouseName) { + this.oriWarehouseName = oriWarehouseName; + } + + public String getTargetWarehouseName() { + return targetWarehouseName; + } + + public void setTargetWarehouseName(String targetWarehouseName) { + this.targetWarehouseName = targetWarehouseName; + } + + public String getMaterialCode() { + return materialCode; + } + + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("transferId", getTransferId()) + .append("taskCode", getTaskCode()) + .append("oriWarehouseId", getOriWarehouseId()) + .append("oriLocationCode", getOriLocationCode()) + .append("targetWarehouseId", getTargetWarehouseId()) + .append("targetLocationCode", getTargetLocationCode()) + .append("materialId", getMaterialId()) + .append("productBatch", getProductBatch()) + .append("planCode", getPlanCode()) + .append("applyQty", getApplyQty()) + .append("outstockQty", getOutstockQty()) + .append("instockQty", getInstockQty()) + .append("operationType", getOperationType()) + .append("transferType", getTransferType()) + .append("applyReason", getApplyReason()) + .append("auditReason", getAuditReason()) + .append("auditStatus", getAuditStatus()) + .append("executeStatus", getExecuteStatus()) + .append("applyBy", getApplyBy()) + .append("applyDate", getApplyDate()) + .append("auditBy", getAuditBy()) + .append("auditDate", getAuditDate()) + .append("updateBy", getUpdateBy()) + .append("updateDate", getUpdateDate()) + .append("beginTime", getBeginTime()) + .append("endTime", getEndTime()) + .append("wmsTransferDetailList", getWmsTransferDetailList()) + .toString(); + } +} diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsTransferDetail.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsTransferDetail.java new file mode 100644 index 0000000..57a179f --- /dev/null +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsTransferDetail.java @@ -0,0 +1,255 @@ +package com.hw.wms.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.hw.common.core.annotation.Excel; +import com.hw.common.core.web.domain.BaseEntity; + +/** + * 转库记录明细;移库合库记录对应的明细信息对象 wms_transfer_detail + * + * @author xins + * @date 2024-01-12 + */ +public class WmsTransferDetail extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 转库记录明细ID */ + private Long transferDetailId; + + /** 转库ID,关联wms_transfer的transfer_id */ + @Excel(name = "转库ID,关联wms_transfer的transfer_id") + private Long transferId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String locationCode; + + /** 存放物料条码,入库扫描条码时,从打印条码记录表中获取,关联条码信息的barcode_info */ + @Excel(name = "存放物料条码,入库扫描条码时,从打印条码记录表中获取,关联条码信息的barcode_info") + private String materialBarcode; + + /** 批次;入库扫描条码时,从打印条码记录表中获取,关联条码信息的batch_code */ + @Excel(name = "批次;入库扫描条码时,从打印条码记录表中获取,关联条码信息的batch_code") + private String instockBatch; + + /** 物料ID */ + @Excel(name = "物料ID") + private Long materialId; + + /** 计划数量 */ + @Excel(name = "计划数量") + private BigDecimal planAmount; + + /** 实际数量 */ + @Excel(name = "实际数量") + private BigDecimal realAmount; + + /** 执行状态(0待执行,1执行中,2执行完成) */ + @Excel(name = "执行状态(0待执行,1执行中,2执行完成)") + private String executeStatus; + + /** 执行人 */ + @Excel(name = "执行人") + private String executePerson; + + /** 执行时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date executeTime; + + /** 转明细类型(1出库2入库) */ + @Excel(name = "转明细类型(1出库2入库)") + private String transferDetailType; + + /** 使用机台名称;入库扫描条码时,从打印条码记录表中获取 */ + @Excel(name = "使用机台名称;入库扫描条码时,从打印条码记录表中获取") + private String machineName; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createDate; + + /** 最后更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date updateDate; + + /** 有效标记 */ + @Excel(name = "有效标记") + private String activeFlag; + + public void setTransferDetailId(Long transferDetailId) + { + this.transferDetailId = transferDetailId; + } + + public Long getTransferDetailId() + { + return transferDetailId; + } + public void setTransferId(Long transferId) + { + this.transferId = transferId; + } + + public Long getTransferId() + { + return transferId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setMaterialBarcode(String materialBarcode) + { + this.materialBarcode = materialBarcode; + } + + public String getMaterialBarcode() + { + return materialBarcode; + } + public void setInstockBatch(String instockBatch) + { + this.instockBatch = instockBatch; + } + + public String getInstockBatch() + { + return instockBatch; + } + public void setMaterialId(Long materialId) + { + this.materialId = materialId; + } + + public Long getMaterialId() + { + return materialId; + } + public void setPlanAmount(BigDecimal planAmount) + { + this.planAmount = planAmount; + } + + public BigDecimal getPlanAmount() + { + return planAmount; + } + public void setRealAmount(BigDecimal realAmount) + { + this.realAmount = realAmount; + } + + public BigDecimal getRealAmount() + { + return realAmount; + } + public void setExecuteStatus(String executeStatus) + { + this.executeStatus = executeStatus; + } + + public String getExecuteStatus() + { + return executeStatus; + } + public void setExecutePerson(String executePerson) + { + this.executePerson = executePerson; + } + + public String getExecutePerson() + { + return executePerson; + } + public void setExecuteTime(Date executeTime) + { + this.executeTime = executeTime; + } + + public Date getExecuteTime() + { + return executeTime; + } + public void setTransferDetailType(String transferDetailType) + { + this.transferDetailType = transferDetailType; + } + + public String getTransferDetailType() + { + return transferDetailType; + } + public void setMachineName(String machineName) + { + this.machineName = machineName; + } + + public String getMachineName() + { + return machineName; + } + public void setCreateDate(Date createDate) + { + this.createDate = createDate; + } + + public Date getCreateDate() + { + return createDate; + } + public void setUpdateDate(Date updateDate) + { + this.updateDate = updateDate; + } + + public Date getUpdateDate() + { + return updateDate; + } + public void setActiveFlag(String activeFlag) + { + this.activeFlag = activeFlag; + } + + public String getActiveFlag() + { + return activeFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("transferDetailId", getTransferDetailId()) + .append("transferId", getTransferId()) + .append("locationCode", getLocationCode()) + .append("materialBarcode", getMaterialBarcode()) + .append("instockBatch", getInstockBatch()) + .append("materialId", getMaterialId()) + .append("planAmount", getPlanAmount()) + .append("realAmount", getRealAmount()) + .append("executeStatus", getExecuteStatus()) + .append("executePerson", getExecutePerson()) + .append("executeTime", getExecuteTime()) + .append("transferDetailType", getTransferDetailType()) + .append("machineName", getMachineName()) + .append("createBy", getCreateBy()) + .append("createDate", getCreateDate()) + .append("updateBy", getUpdateBy()) + .append("updateDate", getUpdateDate()) + .append("activeFlag", getActiveFlag()) + .toString(); + } +} diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsBaseWarehouseMapper.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsBaseWarehouseMapper.java index 3a77cff..11b7d0b 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsBaseWarehouseMapper.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsBaseWarehouseMapper.java @@ -100,6 +100,6 @@ public interface WmsBaseWarehouseMapper * @param warehouseId 仓库信息主键 * @return 仓库信息 */ -// public WmsBaseWarehouse selectWmsBaseWarehouseByWarehouseId(Long warehouseId); + public WmsBaseWarehouse selectWmsBaseWarehouseByWarehouseId(Long warehouseId); } 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 new file mode 100644 index 0000000..dc460e3 --- /dev/null +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockDetailMapper.java @@ -0,0 +1,61 @@ +package com.hw.wms.mapper; + +import java.util.List; +import com.hw.wms.domain.WmsProductOutstockDetail; + +/** + * 成品出库记录明细Mapper接口 + * + * @author xins + * @date 2024-01-16 + */ +public interface WmsProductOutstockDetailMapper +{ + /** + * 查询成品出库记录明细 + * + * @param productOutstockDetailId 成品出库记录明细主键 + * @return 成品出库记录明细 + */ + public WmsProductOutstockDetail selectWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId); + + /** + * 查询成品出库记录明细列表 + * + * @param wmsProductOutstockDetail 成品出库记录明细 + * @return 成品出库记录明细集合 + */ + public List selectWmsProductOutstockDetailList(WmsProductOutstockDetail wmsProductOutstockDetail); + + /** + * 新增成品出库记录明细 + * + * @param wmsProductOutstockDetail 成品出库记录明细 + * @return 结果 + */ + public int insertWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail); + + /** + * 修改成品出库记录明细 + * + * @param wmsProductOutstockDetail 成品出库记录明细 + * @return 结果 + */ + public int updateWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail); + + /** + * 删除成品出库记录明细 + * + * @param productOutstockDetailId 成品出库记录明细主键 + * @return 结果 + */ + public int deleteWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId); + + /** + * 批量删除成品出库记录明细 + * + * @param productOutstockDetailIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmsProductOutstockDetailByProductOutstockDetailIds(Long[] productOutstockDetailIds); +} diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockMapper.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockMapper.java index 26b0b35..b777572 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockMapper.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockMapper.java @@ -6,15 +6,15 @@ import com.hw.wms.domain.WmsProductOutstockDetail; /** * 成品出库记录Mapper接口 - * + * * @author xs * @date 2023-12-20 */ -public interface WmsProductOutstockMapper +public interface WmsProductOutstockMapper { /** * 查询成品出库记录 - * + * * @param productOutstockId 成品出库记录主键 * @return 成品出库记录 */ @@ -22,7 +22,7 @@ public interface WmsProductOutstockMapper /** * 查询成品出库记录列表 - * + * * @param wmsProductOutstock 成品出库记录 * @return 成品出库记录集合 */ @@ -30,7 +30,7 @@ public interface WmsProductOutstockMapper /** * 新增成品出库记录 - * + * * @param wmsProductOutstock 成品出库记录 * @return 结果 */ @@ -38,7 +38,7 @@ public interface WmsProductOutstockMapper /** * 修改成品出库记录 - * + * * @param wmsProductOutstock 成品出库记录 * @return 结果 */ @@ -46,7 +46,7 @@ public interface WmsProductOutstockMapper /** * 删除成品出库记录 - * + * * @param productOutstockId 成品出库记录主键 * @return 结果 */ @@ -54,7 +54,7 @@ public interface WmsProductOutstockMapper /** * 批量删除成品出库记录 - * + * * @param productOutstockIds 需要删除的数据主键集合 * @return 结果 */ @@ -62,26 +62,55 @@ public interface WmsProductOutstockMapper /** * 批量删除成品出库记录明细 - * + * * @param productOutstockIds 需要删除的数据主键集合 * @return 结果 */ public int deleteWmsProductOutstockDetailByProductOutstockIds(Long[] productOutstockIds); - + /** * 批量新增成品出库记录明细 - * + * * @param wmsProductOutstockDetailList 成品出库记录明细列表 * @return 结果 */ public int batchWmsProductOutstockDetail(List wmsProductOutstockDetailList); - + /** * 通过成品出库记录主键删除成品出库记录明细信息 - * + * * @param productOutstockId 成品出库记录ID * @return 结果 */ public int deleteWmsProductOutstockDetailByProductOutstockId(Long productOutstockId); + + + + + + /** + * 查询成品出库记录列表,Join material,warehouse + * + * @param wmsProductOutstock 成品出库记录 + * @return 成品出库记录集合 + */ + public List selectWmsProductOutstockJoinList(WmsProductOutstock wmsProductOutstock); + + /** + * 查询成品出库记录,join warehouse,material,获取出库总数量 + * + * @param productOutstockId 成品出库记录主键 + * @return 成品出库记录 + */ + public WmsProductOutstock selectWmsProductOutstockJoinByOutstockId(Long productOutstockId); + + /** + * 查询成品出库记录 + * + * @param productOutstockId 成品出库记录主键 + * @return 成品出库记录 + */ + public WmsProductOutstock selectOnlyWmsProductOutstockByOutstockId(Long productOutstockId); + } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductStockMapper.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductStockMapper.java index 89f9c9c..140ecd5 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductStockMapper.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductStockMapper.java @@ -97,4 +97,13 @@ public interface WmsProductStockMapper */ public List selectWmsProductStockJoinList(WmsProductStock wmsProductStock); + /** + * 根据销售订单查询成品库存列表Join material,warehouse,totalAmount>0 + * + * @param wmsProductStock 成品库存 + * @return 成品库存集合 + */ + public List selectWmsProductStocksBySaleorder(WmsProductStock wmsProductStock); + + } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsTransferMapper.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsTransferMapper.java new file mode 100644 index 0000000..1b7a443 --- /dev/null +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsTransferMapper.java @@ -0,0 +1,99 @@ +package com.hw.wms.mapper; + +import java.util.List; +import com.hw.wms.domain.WmsTransfer; +import com.hw.wms.domain.WmsTransferDetail; + +/** + * 转库记录Mapper接口 + * + * @author xins + * @date 2024-01-12 + */ +public interface WmsTransferMapper +{ + /** + * 查询转库记录 + * + * @param transferId 转库记录主键 + * @return 转库记录 + */ + public WmsTransfer selectWmsTransferByTransferId(Long transferId); + + /** + * 查询转库记录列表 + * + * @param wmsTransfer 转库记录 + * @return 转库记录集合 + */ + public List selectWmsTransferList(WmsTransfer wmsTransfer); + + /** + * 新增转库记录 + * + * @param wmsTransfer 转库记录 + * @return 结果 + */ + public int insertWmsTransfer(WmsTransfer wmsTransfer); + + /** + * 修改转库记录 + * + * @param wmsTransfer 转库记录 + * @return 结果 + */ + public int updateWmsTransfer(WmsTransfer wmsTransfer); + + /** + * 删除转库记录 + * + * @param transferId 转库记录主键 + * @return 结果 + */ + public int deleteWmsTransferByTransferId(Long transferId); + + /** + * 批量删除转库记录 + * + * @param transferIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmsTransferByTransferIds(Long[] transferIds); + + /** + * 批量删除转库记录明细;移库合库记录对应的明细信息 + * + * @param transferIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmsTransferDetailByTransferIds(Long[] transferIds); + + /** + * 批量新增转库记录明细;移库合库记录对应的明细信息 + * + * @param wmsTransferDetailList 转库记录明细;移库合库记录对应的明细信息列表 + * @return 结果 + */ + public int batchWmsTransferDetail(List wmsTransferDetailList); + + + /** + * 通过转库记录主键删除转库记录明细;移库合库记录对应的明细信息信息 + * + * @param transferId 转库记录ID + * @return 结果 + */ + public int deleteWmsTransferDetailByTransferId(Long transferId); + + + + + /** + * 查询转库记录列表,Join原仓库,目标仓库和物料 + * + * @param wmsTransfer 转库记录 + * @return 转库记录集合 + */ + public List selectWmsTransferJoinList(WmsTransfer wmsTransfer); + +} diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductOutstockDetailService.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductOutstockDetailService.java new file mode 100644 index 0000000..29968a1 --- /dev/null +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductOutstockDetailService.java @@ -0,0 +1,61 @@ +package com.hw.wms.service; + +import java.util.List; +import com.hw.wms.domain.WmsProductOutstockDetail; + +/** + * 成品出库记录明细Service接口 + * + * @author xins + * @date 2024-01-16 + */ +public interface IWmsProductOutstockDetailService +{ + /** + * 查询成品出库记录明细 + * + * @param productOutstockDetailId 成品出库记录明细主键 + * @return 成品出库记录明细 + */ + public WmsProductOutstockDetail selectWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId); + + /** + * 查询成品出库记录明细列表 + * + * @param wmsProductOutstockDetail 成品出库记录明细 + * @return 成品出库记录明细集合 + */ + public List selectWmsProductOutstockDetailList(WmsProductOutstockDetail wmsProductOutstockDetail); + + /** + * 新增成品出库记录明细 + * + * @param wmsProductOutstockDetail 成品出库记录明细 + * @return 结果 + */ + public int insertWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail); + + /** + * 修改成品出库记录明细 + * + * @param wmsProductOutstockDetail 成品出库记录明细 + * @return 结果 + */ + public int updateWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail); + + /** + * 批量删除成品出库记录明细 + * + * @param productOutstockDetailIds 需要删除的成品出库记录明细主键集合 + * @return 结果 + */ + public int deleteWmsProductOutstockDetailByProductOutstockDetailIds(Long[] productOutstockDetailIds); + + /** + * 删除成品出库记录明细信息 + * + * @param productOutstockDetailId 成品出库记录明细主键 + * @return 结果 + */ + public int deleteWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId); +} 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 1676e30..cf02957 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 @@ -5,15 +5,15 @@ import com.hw.wms.domain.WmsProductOutstock; /** * 成品出库记录Service接口 - * + * * @author xs * @date 2023-12-20 */ -public interface IWmsProductOutstockService +public interface IWmsProductOutstockService { /** * 查询成品出库记录 - * + * * @param productOutstockId 成品出库记录主键 * @return 成品出库记录 */ @@ -21,7 +21,7 @@ public interface IWmsProductOutstockService /** * 查询成品出库记录列表 - * + * * @param wmsProductOutstock 成品出库记录 * @return 成品出库记录集合 */ @@ -29,7 +29,7 @@ public interface IWmsProductOutstockService /** * 新增成品出库记录 - * + * * @param wmsProductOutstock 成品出库记录 * @return 结果 */ @@ -37,7 +37,7 @@ public interface IWmsProductOutstockService /** * 修改成品出库记录 - * + * * @param wmsProductOutstock 成品出库记录 * @return 结果 */ @@ -45,7 +45,7 @@ public interface IWmsProductOutstockService /** * 批量删除成品出库记录 - * + * * @param productOutstockIds 需要删除的成品出库记录主键集合 * @return 结果 */ @@ -53,9 +53,25 @@ public interface IWmsProductOutstockService /** * 删除成品出库记录信息 - * + * * @param productOutstockId 成品出库记录主键 * @return 结果 */ public int deleteWmsProductOutstockByProductOutstockId(Long productOutstockId); + + /** + * 查询成品出库记录列表 Join material,warehouse + * + * @param wmsProductOutstock 成品出库记录 + * @return 成品出库记录 + */ + public List selectWmsProductOutstockJoinList(WmsProductOutstock wmsProductOutstock); + + /** + * 查询成品出库记录,join warehouse,material,获取出库总数量 + * + * @param productOutstockId 成品出库记录主键 + * @return 成品出库记录 + */ + public WmsProductOutstock selectWmsProductOutstockJoinByOutstockId(Long productOutstockId); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductStockService.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductStockService.java index 3c4fb88..da9a85f 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductStockService.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsProductStockService.java @@ -66,4 +66,12 @@ public interface IWmsProductStockService * @return 成品库存 */ public List selectWmsProductStockJoinList(WmsProductStock wmsProductStock); + + /** + * 根据销售订单查询成品库存列表Join material,warehouse,totalAmount>0 + * + * @param wmsProductStock 成品库存 + * @return 成品库存 + */ + public List selectWmsProductStocksBySaleorder(WmsProductStock wmsProductStock); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsTransferService.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsTransferService.java new file mode 100644 index 0000000..1be8e24 --- /dev/null +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsTransferService.java @@ -0,0 +1,97 @@ +package com.hw.wms.service; + +import java.util.List; +import com.hw.wms.domain.WmsTransfer; +import com.hw.wms.domain.WmsTransferDetail; +import org.springframework.transaction.annotation.Transactional; + +/** + * 转库记录Service接口 + * + * @author xins + * @date 2024-01-12 + */ +public interface IWmsTransferService +{ + /** + * 查询转库记录 + * + * @param transferId 转库记录主键 + * @return 转库记录 + */ + public WmsTransfer selectWmsTransferByTransferId(Long transferId); + + /** + * 查询转库记录列表 + * + * @param wmsTransfer 转库记录 + * @return 转库记录集合 + */ + public List selectWmsTransferList(WmsTransfer wmsTransfer); + + /** + * 新增转库记录 + * + * @param wmsTransfer 转库记录 + * @return 结果 + */ + public int insertWmsTransfer(WmsTransfer wmsTransfer); + + /** + * 修改转库记录 + * + * @param wmsTransfer 转库记录 + * @return 结果 + */ + public int updateWmsTransfer(WmsTransfer wmsTransfer); + + /** + * 批量删除转库记录 + * + * @param transferIds 需要删除的转库记录主键集合 + * @return 结果 + */ + public int deleteWmsTransferByTransferIds(Long[] transferIds); + + /** + * 删除转库记录信息 + * + * @param transferId 转库记录主键 + * @return 结果 + */ + public int deleteWmsTransferByTransferId(Long transferId); + + + + + + /** + * 申请转库(适合五楼半成品库入成品库) + * + * @param wmsTransfers + * @return + */ + public int applyTransfers(List wmsTransfers); + + /** + * 查询转库记录列表,Join原仓库,目标仓库和物料 + * + * @param wmsTransfer 转库记录 + * @return 转库记录 + */ + public List selectWmsTransferJoinList(WmsTransfer wmsTransfer); + + /** + * 转库出库,适合五楼半成品出半成品库 + * @param wmsTransferDetail + * @return + */ + public int transferOutstock(WmsTransferDetail wmsTransferDetail); + + /** + * 转库入库,适合五楼半成品入成品库 + * @param wmsTransferDetail + * @return + */ + public int transferInstock(WmsTransferDetail wmsTransferDetail); +} 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 new file mode 100644 index 0000000..190e29c --- /dev/null +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductOutstockDetailServiceImpl.java @@ -0,0 +1,190 @@ +package com.hw.wms.service.impl; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import com.hw.common.core.constant.WmsConstants; +import com.hw.common.core.exception.ServiceException; +import com.hw.common.security.utils.SecurityUtils; +import com.hw.wms.domain.WmsBaseLocation; +import com.hw.wms.domain.WmsProductOutstock; +import com.hw.wms.domain.WmsProductStock; +import com.hw.wms.mapper.WmsBaseLocationMapper; +import com.hw.wms.mapper.WmsProductOutstockMapper; +import com.hw.wms.mapper.WmsProductStockMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.hw.wms.mapper.WmsProductOutstockDetailMapper; +import com.hw.wms.domain.WmsProductOutstockDetail; +import com.hw.wms.service.IWmsProductOutstockDetailService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 成品出库记录明细Service业务层处理 + * + * @author xins + * @date 2024-01-16 + */ +@Service +public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockDetailService { + @Autowired + private WmsProductOutstockDetailMapper wmsProductOutstockDetailMapper; + + @Autowired + private WmsProductOutstockMapper wmsProductOutstockMapper; + + @Autowired + private WmsProductStockMapper wmsProductStockMapper; + + @Autowired + private WmsBaseLocationMapper wmsBaseLocationMapper; + + + /** + * 查询成品出库记录明细 + * + * @param productOutstockDetailId 成品出库记录明细主键 + * @return 成品出库记录明细 + */ + @Override + public WmsProductOutstockDetail selectWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId) { + return wmsProductOutstockDetailMapper.selectWmsProductOutstockDetailByProductOutstockDetailId(productOutstockDetailId); + } + + /** + * 查询成品出库记录明细列表 + * + * @param wmsProductOutstockDetail 成品出库记录明细 + * @return 成品出库记录明细 + */ + @Override + public List selectWmsProductOutstockDetailList(WmsProductOutstockDetail wmsProductOutstockDetail) { + return wmsProductOutstockDetailMapper.selectWmsProductOutstockDetailList(wmsProductOutstockDetail); + } + + /** + * 新增成品出库记录明细 + * + * @param wmsProductOutstockDetail 成品出库记录明细 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail) { + String locationCode = wmsProductOutstockDetail.getLocationCode(); + String productBarcode = wmsProductOutstockDetail.getProductBarcode(); + String productBatch = wmsProductOutstockDetail.getProductBatch(); + Long productOutstockId = wmsProductOutstockDetail.getProductOutstockId(); + + WmsBaseLocation location = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode); + if (location == null) { + throw new ServiceException(String.format("库位编码%1$s错误", locationCode)); + } + + WmsProductOutstock productOutstock = wmsProductOutstockMapper.selectOnlyWmsProductOutstockByOutstockId(productOutstockId); + if (productOutstock == null) { + throw new ServiceException("没有此成品出库任务信息"); + } + + if (!productOutstock.getWarehouseId().equals(location.getWarehouseId())) { + throw new ServiceException("没有此仓库出库任务"); + } + + if (productOutstock.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) { + throw new ServiceException("此出库申请已完成,不能再出库"); + } + + WmsProductStock productStock = wmsProductStockMapper.selectProductStockByLocationAndBatch(locationCode, productBatch, WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT); + if (productStock == null) { + throw new ServiceException("此库位没有库存"); + } + BigDecimal totalAmount = 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); + if (availableAmount.compareTo(BigDecimal.ZERO) <= 0) { + throw new ServiceException("此库位没有可出库存"); + } + + 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)); + } + + String userName = SecurityUtils.getUsername(); + Date currentDate = new Date(); + //更新出库记录 + 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); + + //更新库存 + productStock.setTotalAmount(totalAmount.subtract(BigDecimal.ONE)); + productStock.setUpdateBy(userName); + productStock.setUpdateDate(currentDate); + wmsProductStockMapper.updateWmsProductStock(productStock); + + //插入出库记录明细 + wmsProductOutstockDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH); + wmsProductOutstockDetail.setBeginTime(currentDate); + wmsProductOutstockDetail.setEndTime(currentDate); + wmsProductOutstockDetail.setWarehouseId(location.getWarehouseId()); + wmsProductOutstockDetail.setPlanAmount(BigDecimal.ONE); + wmsProductOutstockDetail.setOutstockAmount(BigDecimal.ONE); + + wmsProductOutstockDetailMapper.insertWmsProductOutstockDetail(wmsProductOutstockDetail); + + //todo:同步erp + + return 1; + } + + /** + * 修改成品出库记录明细 + * + * @param wmsProductOutstockDetail 成品出库记录明细 + * @return 结果 + */ + @Override + public int updateWmsProductOutstockDetail(WmsProductOutstockDetail wmsProductOutstockDetail) { + return wmsProductOutstockDetailMapper.updateWmsProductOutstockDetail(wmsProductOutstockDetail); + } + + /** + * 批量删除成品出库记录明细 + * + * @param productOutstockDetailIds 需要删除的成品出库记录明细主键 + * @return 结果 + */ + @Override + public int deleteWmsProductOutstockDetailByProductOutstockDetailIds(Long[] productOutstockDetailIds) { + return wmsProductOutstockDetailMapper.deleteWmsProductOutstockDetailByProductOutstockDetailIds(productOutstockDetailIds); + } + + /** + * 删除成品出库记录明细信息 + * + * @param productOutstockDetailId 成品出库记录明细主键 + * @return 结果 + */ + @Override + public int deleteWmsProductOutstockDetailByProductOutstockDetailId(Long productOutstockDetailId) { + return wmsProductOutstockDetailMapper.deleteWmsProductOutstockDetailByProductOutstockDetailId(productOutstockDetailId); + } +} 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 9c556af..c87edb1 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 @@ -1,9 +1,22 @@ package com.hw.wms.service.impl; +import java.math.BigDecimal; +import java.util.Date; import java.util.List; + +import com.hw.common.core.constant.WmsConstants; +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.wms.domain.WmsBaseWarehouse; +import com.hw.wms.domain.WmsProductStock; +import com.hw.wms.mapper.WmsBaseWarehouseMapper; +import com.hw.wms.mapper.WmsProductStockMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + import java.util.ArrayList; + import com.hw.common.core.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; import com.hw.wms.domain.WmsProductOutstockDetail; @@ -18,11 +31,16 @@ import com.hw.wms.service.IWmsProductOutstockService; * @date 2023-12-20 */ @Service -public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService -{ +public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService { @Autowired private WmsProductOutstockMapper wmsProductOutstockMapper; + @Autowired + private WmsProductStockMapper wmsProductStockMapper; + + @Autowired + private WmsBaseWarehouseMapper wmsBaseWarehouseMapper; + /** * 查询成品出库记录 * @@ -30,8 +48,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService * @return 成品出库记录 */ @Override - public WmsProductOutstock selectWmsProductOutstockByProductOutstockId(Long productOutstockId) - { + public WmsProductOutstock selectWmsProductOutstockByProductOutstockId(Long productOutstockId) { return wmsProductOutstockMapper.selectWmsProductOutstockByProductOutstockId(productOutstockId); } @@ -42,8 +59,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService * @return 成品出库记录 */ @Override - public List selectWmsProductOutstockList(WmsProductOutstock wmsProductOutstock) - { + public List selectWmsProductOutstockList(WmsProductOutstock wmsProductOutstock) { return wmsProductOutstockMapper.selectWmsProductOutstockList(wmsProductOutstock); } @@ -53,12 +69,62 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService * @param wmsProductOutstock 成品出库记录 * @return 结果 */ - @Transactional(rollbackFor = Exception.class) @Override - public int insertWmsProductOutstock(WmsProductOutstock wmsProductOutstock) - { + public int insertWmsProductOutstock(WmsProductOutstock wmsProductOutstock) { + Long warehouseId = wmsProductOutstock.getWarehouseId(); + String saleorderCode = wmsProductOutstock.getSaleorderCode(); + Long productId = wmsProductOutstock.getProductId(); + BigDecimal applyQty = wmsProductOutstock.getApplyQty(); + + WmsProductStock queryProductStock = new WmsProductStock(); + queryProductStock.setWarehouseId(warehouseId); + queryProductStock.setSaleorderCode(saleorderCode); + queryProductStock.setProductId(productId); + List productStocks = wmsProductStockMapper.selectWmsProductStocksBySaleorder(queryProductStock); + if (productStocks == null || productStocks.isEmpty()) { + throw new ServiceException("没有库存"); + } + + WmsProductStock productStock = productStocks.get(0); + BigDecimal orderAmount = productStock.getOrderAmount(); + /*获取仓库可用库存数量*/ + 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); + + /*获取已申请出库数量*/ + WmsProductOutstock queryProductOutStock = new WmsProductOutstock(); + queryProductOutStock.setSaleorderCode(saleorderCode); + List wmsProductOutstocks = wmsProductOutstockMapper.selectWmsProductOutstockList(queryProductOutStock); + BigDecimal sumApplyQty = wmsProductOutstocks.stream().map(WmsProductOutstock::getApplyQty).reduce(BigDecimal.ZERO, BigDecimal::add); + + //可申请数量 + BigDecimal availableApplyQty = availableAmount.subtract(sumApplyQty); + + if (applyQty.compareTo(availableApplyQty) > 0) { + throw new ServiceException("可申请数量为" + availableApplyQty); + } + + WmsBaseWarehouse warehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(warehouseId); + String operationType = warehouse.getWarehouseType().equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL) + ? WmsConstants.WMS_OPERATION_TYPE_MANUAL : WmsConstants.WMS_OPERATION_TYPE_AUTO; + + 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.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE); + wmsProductOutstock.setApplyBy(userName); + wmsProductOutstock.setApplyDate(currentDate); + wmsProductOutstock.setTaskCode(Seq.getId(Seq.productOutstockSeqType, Seq.productOutstockCode)); + int rows = wmsProductOutstockMapper.insertWmsProductOutstock(wmsProductOutstock); - insertWmsProductOutstockDetail(wmsProductOutstock); + + //todo:如果是agv自动仓库,需要调用WCS进行调度出库 + return rows; } @@ -70,8 +136,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService */ @Transactional(rollbackFor = Exception.class) @Override - public int updateWmsProductOutstock(WmsProductOutstock wmsProductOutstock) - { + public int updateWmsProductOutstock(WmsProductOutstock wmsProductOutstock) { wmsProductOutstockMapper.deleteWmsProductOutstockDetailByProductOutstockId(wmsProductOutstock.getProductOutstockId()); insertWmsProductOutstockDetail(wmsProductOutstock); return wmsProductOutstockMapper.updateWmsProductOutstock(wmsProductOutstock); @@ -85,8 +150,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService */ @Transactional(rollbackFor = Exception.class) @Override - public int deleteWmsProductOutstockByProductOutstockIds(Long[] productOutstockIds) - { + public int deleteWmsProductOutstockByProductOutstockIds(Long[] productOutstockIds) { wmsProductOutstockMapper.deleteWmsProductOutstockDetailByProductOutstockIds(productOutstockIds); return wmsProductOutstockMapper.deleteWmsProductOutstockByProductOutstockIds(productOutstockIds); } @@ -99,8 +163,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService */ @Transactional(rollbackFor = Exception.class) @Override - public int deleteWmsProductOutstockByProductOutstockId(Long productOutstockId) - { + public int deleteWmsProductOutstockByProductOutstockId(Long productOutstockId) { wmsProductOutstockMapper.deleteWmsProductOutstockDetailByProductOutstockId(productOutstockId); return wmsProductOutstockMapper.deleteWmsProductOutstockByProductOutstockId(productOutstockId); } @@ -110,22 +173,44 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService * * @param wmsProductOutstock 成品出库记录对象 */ - public void insertWmsProductOutstockDetail(WmsProductOutstock wmsProductOutstock) - { + public void insertWmsProductOutstockDetail(WmsProductOutstock wmsProductOutstock) { List wmsProductOutstockDetailList = wmsProductOutstock.getWmsProductOutstockDetailList(); Long productOutstockId = wmsProductOutstock.getProductOutstockId(); - if (StringUtils.isNotNull(wmsProductOutstockDetailList)) - { + if (StringUtils.isNotNull(wmsProductOutstockDetailList)) { List list = new ArrayList(); - for (WmsProductOutstockDetail wmsProductOutstockDetail : wmsProductOutstockDetailList) - { + for (WmsProductOutstockDetail wmsProductOutstockDetail : wmsProductOutstockDetailList) { wmsProductOutstockDetail.setProductOutstockId(productOutstockId); list.add(wmsProductOutstockDetail); } - if (list.size() > 0) - { + if (list.size() > 0) { wmsProductOutstockMapper.batchWmsProductOutstockDetail(list); } } } + + + /** + * 查询成品出库记录列表 Join material,warehouse + * + * @param wmsProductOutstock 成品出库记录 + * @return 成品出库记录 + */ + @Override + public List selectWmsProductOutstockJoinList(WmsProductOutstock wmsProductOutstock) { + return wmsProductOutstockMapper.selectWmsProductOutstockJoinList(wmsProductOutstock); + } + + + /** + * 查询成品出库记录,join warehouse,material,获取出库总数量 + * + * @param productOutstockId 成品出库记录主键 + * @return 成品出库记录 + */ + @Override + public WmsProductOutstock selectWmsProductOutstockJoinByOutstockId(Long productOutstockId) { + return wmsProductOutstockMapper.selectWmsProductOutstockJoinByOutstockId(productOutstockId); + } + + } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductStockServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductStockServiceImpl.java index c8c5eec..f61ba52 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductStockServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsProductStockServiceImpl.java @@ -1,6 +1,12 @@ package com.hw.wms.service.impl; +import java.math.BigDecimal; +import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import com.hw.common.core.exception.ServiceException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hw.wms.mapper.WmsProductStockMapper; @@ -14,8 +20,7 @@ import com.hw.wms.service.IWmsProductStockService; * @date 2023-12-20 */ @Service -public class WmsProductStockServiceImpl implements IWmsProductStockService -{ +public class WmsProductStockServiceImpl implements IWmsProductStockService { @Autowired private WmsProductStockMapper wmsProductStockMapper; @@ -26,8 +31,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService * @return 成品库存 */ @Override - public WmsProductStock selectWmsProductStockByProductStockId(Long productStockId) - { + public WmsProductStock selectWmsProductStockByProductStockId(Long productStockId) { return wmsProductStockMapper.selectWmsProductStockByProductStockId(productStockId); } @@ -38,8 +42,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService * @return 成品库存 */ @Override - public List selectWmsProductStockList(WmsProductStock wmsProductStock) - { + public List selectWmsProductStockList(WmsProductStock wmsProductStock) { return wmsProductStockMapper.selectWmsProductStockList(wmsProductStock); } @@ -50,8 +53,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService * @return 结果 */ @Override - public int insertWmsProductStock(WmsProductStock wmsProductStock) - { + public int insertWmsProductStock(WmsProductStock wmsProductStock) { return wmsProductStockMapper.insertWmsProductStock(wmsProductStock); } @@ -62,8 +64,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService * @return 结果 */ @Override - public int updateWmsProductStock(WmsProductStock wmsProductStock) - { + public int updateWmsProductStock(WmsProductStock wmsProductStock) { return wmsProductStockMapper.updateWmsProductStock(wmsProductStock); } @@ -74,8 +75,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService * @return 结果 */ @Override - public int deleteWmsProductStockByProductStockIds(Long[] productStockIds) - { + public int deleteWmsProductStockByProductStockIds(Long[] productStockIds) { return wmsProductStockMapper.deleteWmsProductStockByProductStockIds(productStockIds); } @@ -86,8 +86,7 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService * @return 结果 */ @Override - public int deleteWmsProductStockByProductStockId(Long productStockId) - { + public int deleteWmsProductStockByProductStockId(Long productStockId) { return wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStockId); } @@ -99,10 +98,23 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService * @return 成品库存 */ @Override - public List selectWmsProductStockJoinList(WmsProductStock wmsProductStock) - { + public List selectWmsProductStockJoinList(WmsProductStock wmsProductStock) { return wmsProductStockMapper.selectWmsProductStockJoinList(wmsProductStock); } + /** + * 根据销售订单查询成品库存列表Join material,warehouse,totalAmount>0 + * + * @param wmsProductStock 成品库存 + * @return 成品库存 + */ + @Override + public List selectWmsProductStocksBySaleorder(WmsProductStock wmsProductStock) { + List list = wmsProductStockMapper.selectWmsProductStocksBySaleorder(wmsProductStock); + if (list == null || list.isEmpty()) { + throw new ServiceException("无此销售订单信息"); + } + return list; + } } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java index cd6a19e..ff39b36 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java @@ -428,7 +428,7 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { toUpdatedWmsRawReturn.setPlanCode(wmsRawReturn.getPlanCode()); toUpdatedWmsRawReturn.setPlanDetailCode(wmsRawReturn.getPlanDetailCode()); toUpdatedWmsRawReturn.setTaskType(wmsRawReturn.getTaskType()); - toUpdatedWmsRawReturn.setTaskCode(Seq.getId()); + toUpdatedWmsRawReturn.setTaskCode(Seq.getId(Seq.rawReturnSeqType,Seq.rawReturnCode)); // toUpdatedWmsRawReturn.setProductId(); toUpdatedWmsRawReturn.setApplyReason(wmsRawReturn.getApplyReason()); diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java new file mode 100644 index 0000000..407fb7d --- /dev/null +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsTransferServiceImpl.java @@ -0,0 +1,381 @@ +package com.hw.wms.service.impl; + +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.security.utils.SecurityUtils; +import com.hw.mes.api.RemoteMesService; +import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import com.hw.wms.domain.WmsBaseLocation; +import com.hw.wms.domain.WmsProductStock; +import com.hw.wms.mapper.WmsBaseLocationMapper; +import com.hw.wms.mapper.WmsProductStockMapper; +import com.hw.wms.mapper.WmsTransferDetailMapper; +import com.hw.wms.service.IWmsTransactionalService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; + +import com.hw.common.core.utils.StringUtils; +import org.springframework.transaction.annotation.Transactional; +import com.hw.wms.domain.WmsTransferDetail; +import com.hw.wms.mapper.WmsTransferMapper; +import com.hw.wms.domain.WmsTransfer; +import com.hw.wms.service.IWmsTransferService; + +import javax.annotation.Resource; + +/** + * 转库记录Service业务层处理 + * + * @author xins + * @date 2024-01-12 + */ +@Service +public class WmsTransferServiceImpl implements IWmsTransferService { + @Autowired + private WmsTransferMapper wmsTransferMapper; + + @Autowired + private WmsTransferDetailMapper wmsTransferDetailMapper; + + @Autowired + private WmsBaseLocationMapper wmsBaseLocationMapper; + + @Autowired + private WmsProductStockMapper wmsProductStockMapper; + + @Autowired + private IWmsTransactionalService wmsTransactionalService; + + @Resource + private RemoteMesService remoteMesService; + + /** + * 查询转库记录 + * + * @param transferId 转库记录主键 + * @return 转库记录 + */ + @Override + public WmsTransfer selectWmsTransferByTransferId(Long transferId) { + return wmsTransferMapper.selectWmsTransferByTransferId(transferId); + } + + /** + * 查询转库记录列表 + * + * @param wmsTransfer 转库记录 + * @return 转库记录 + */ + @Override + public List selectWmsTransferList(WmsTransfer wmsTransfer) { + return wmsTransferMapper.selectWmsTransferList(wmsTransfer); + } + + /** + * 新增转库记录 + * + * @param wmsTransfer 转库记录 + * @return 结果 + */ + @Transactional + @Override + public int insertWmsTransfer(WmsTransfer wmsTransfer) { + int rows = wmsTransferMapper.insertWmsTransfer(wmsTransfer); + insertWmsTransferDetail(wmsTransfer); + return rows; + } + + /** + * 修改转库记录 + * + * @param wmsTransfer 转库记录 + * @return 结果 + */ + @Transactional + @Override + public int updateWmsTransfer(WmsTransfer wmsTransfer) { + wmsTransferMapper.deleteWmsTransferDetailByTransferId(wmsTransfer.getTransferId()); + insertWmsTransferDetail(wmsTransfer); + return wmsTransferMapper.updateWmsTransfer(wmsTransfer); + } + + /** + * 批量删除转库记录 + * + * @param transferIds 需要删除的转库记录主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteWmsTransferByTransferIds(Long[] transferIds) { + wmsTransferMapper.deleteWmsTransferDetailByTransferIds(transferIds); + return wmsTransferMapper.deleteWmsTransferByTransferIds(transferIds); + } + + /** + * 删除转库记录信息 + * + * @param transferId 转库记录主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteWmsTransferByTransferId(Long transferId) { + wmsTransferMapper.deleteWmsTransferDetailByTransferId(transferId); + return wmsTransferMapper.deleteWmsTransferByTransferId(transferId); + } + + /** + * 新增转库记录明细;移库合库记录对应的明细信息信息 + * + * @param wmsTransfer 转库记录对象 + */ + public void insertWmsTransferDetail(WmsTransfer wmsTransfer) { + List wmsTransferDetailList = wmsTransfer.getWmsTransferDetailList(); + Long transferId = wmsTransfer.getTransferId(); + if (StringUtils.isNotNull(wmsTransferDetailList)) { + List list = new ArrayList(); + for (WmsTransferDetail wmsTransferDetail : wmsTransferDetailList) { + wmsTransferDetail.setTransferId(transferId); + list.add(wmsTransferDetail); + } + if (list.size() > 0) { + wmsTransferMapper.batchWmsTransferDetail(list); + } + } + } + + + /** + * 申请转库(适合五楼半成品库入成品库) + * + * @param wmsTransfers + * @return + */ + @Override + public int applyTransfers(List wmsTransfers) { + String userName = SecurityUtils.getUsername(); + Date currentDate = new Date(); + //todo:生成任务编号 + //需要在循环内执行事务,不能用this调用,需要新建一个Service + wmsTransfers.forEach(wmsTransfer -> { + wmsTransactionalService.applyTransfer(wmsTransfer, userName, currentDate); + }); + + return 1; + } + + /** + * 查询转库记录列表,Join原仓库,目标仓库和物料 + * + * @param wmsTransfer 转库记录 + * @return 转库记录 + */ + @Override + public List selectWmsTransferJoinList(WmsTransfer wmsTransfer) { + return wmsTransferMapper.selectWmsTransferJoinList(wmsTransfer); + } + + + /** + * 转库出库,适合五楼半成品出半成品库 + * + * @param wmsTransferDetail + * @return + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int transferOutstock(WmsTransferDetail wmsTransferDetail) { + String userName = SecurityUtils.getUsername(); + Date currentDate = new Date(); + String locationCode = wmsTransferDetail.getLocationCode(); + String materialBarcode = wmsTransferDetail.getMaterialBarcode(); + + R mesBaseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); + if (mesBaseBarcodeInfoR == null) { + throw new ServiceException("物料编码错误"); + } + MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoR.getData(); + if (mesBaseBarcodeInfo == null) { + throw new ServiceException("物料编码错误"); + } + + String productBatch = mesBaseBarcodeInfo.getBatchCode(); + + Long transferId = wmsTransferDetail.getTransferId(); + WmsTransfer wmsTransfer; + + if (transferId == null) { + WmsTransfer queryTransfer = new WmsTransfer(); + queryTransfer.setOriLocationCode(locationCode); + queryTransfer.setProductBatch(productBatch); + queryTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH); + List wmsTransfers = wmsTransferMapper.selectWmsTransferList(queryTransfer); + if (wmsTransfers == null || wmsTransfers.isEmpty()) { + throw new ServiceException("没有此任务"); + } + if (wmsTransfers.size() > 1) { + throw new ServiceException("有多条此库位任务,请选择具体任务后点击出库"); + } + + wmsTransfer = wmsTransfers.get(0); + } else { + wmsTransfer = wmsTransferMapper.selectWmsTransferByTransferId(transferId); + } + + BigDecimal applyQty = wmsTransfer.getApplyQty(); + BigDecimal outstockQty = wmsTransfer.getOutstockQty() == null ? BigDecimal.ZERO : wmsTransfer.getOutstockQty(); + BigDecimal currentOutstockQty = outstockQty.add(BigDecimal.ONE); + if (applyQty.compareTo(currentOutstockQty) < 0) { + throw new ServiceException("已出库完成,不能多次出库"); + } + + //插入转库任务明细 + wmsTransferDetail.setTransferId(wmsTransfer.getTransferId()); + wmsTransferDetail.setInstockBatch(productBatch); + wmsTransferDetail.setMaterialId(mesBaseBarcodeInfo.getMaterialId()); + wmsTransferDetail.setRealAmount(BigDecimal.ONE); + wmsTransferDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH); + wmsTransferDetail.setTransferDetailType(WmsConstants.WMS_TRANSFER_DETAIL_TYPE_OUTSTOCK); + wmsTransferDetail.setCreateBy(userName); + wmsTransferDetail.setCreateDate(currentDate); + wmsTransferDetail.setExecutePerson(userName); + wmsTransferDetail.setExecuteTime(currentDate); + wmsTransferDetailMapper.insertWmsTransferDetail(wmsTransferDetail); + + //更新转库任务 + wmsTransfer.setOutstockQty(currentOutstockQty); + wmsTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_EXECUTING); + wmsTransfer.setUpdateDate(currentDate); + wmsTransfer.setUpdateBy(userName); + wmsTransferMapper.updateWmsTransfer(wmsTransfer); + + //更新成品库存 + WmsProductStock productStock = wmsProductStockMapper.selectProductStockByLocationAndBatch(locationCode, productBatch,WmsConstants.PRODUCT_STOCK_STOCK_TYPE_SEMI); + productStock.setTotalAmount(productStock.getTotalAmount().subtract(BigDecimal.ONE)); + productStock.setOccupyAmount(productStock.getOccupyAmount().subtract(BigDecimal.ONE)); + productStock.setUpdateDate(currentDate); + productStock.setUpdateBy(userName); + wmsProductStockMapper.updateWmsProductStock(productStock); + + return 1; + } + + /** + * 转库入库,适合五楼半成品入成品库 + * + * @param wmsTransferDetail + * @return + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int transferInstock(WmsTransferDetail wmsTransferDetail) { + String userName = SecurityUtils.getUsername(); + Date currentDate = new Date(); + String locationCode = wmsTransferDetail.getLocationCode(); + String materialBarcode = wmsTransferDetail.getMaterialBarcode(); + + R mesBaseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); + if (mesBaseBarcodeInfoR == null) { + throw new ServiceException("物料编码错误"); + } + MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoR.getData(); + if (mesBaseBarcodeInfo == null) { + throw new ServiceException("物料编码错误"); + } + String productBatch = mesBaseBarcodeInfo.getBatchCode(); + + WmsBaseLocation location = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode); + Long warehouseId = location.getWarehouseId(); + + Long transferId = wmsTransferDetail.getTransferId(); + WmsTransfer wmsTransfer; + if (transferId == null) { + WmsTransfer queryTransfer = new WmsTransfer(); + queryTransfer.setTargetWarehouseId(warehouseId); + queryTransfer.setProductBatch(productBatch); + queryTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_EXECUTING); + List wmsTransfers = wmsTransferMapper.selectWmsTransferList(queryTransfer); + if (wmsTransfers == null || wmsTransfers.isEmpty()) { + throw new ServiceException("没有此任务或者还未出库"); + } + if (wmsTransfers.size() > 1) { + throw new ServiceException("有多条此库位任务,请选择具体任务后点击出库"); + } + + wmsTransfer = wmsTransfers.get(0); + } else { + wmsTransfer = wmsTransferMapper.selectWmsTransferByTransferId(transferId); + } + + BigDecimal applyQty = wmsTransfer.getApplyQty(); + BigDecimal outstockQty = wmsTransfer.getOutstockQty() == null ? BigDecimal.ZERO : wmsTransfer.getOutstockQty(); + BigDecimal instockQty = wmsTransfer.getInstockQty(); + BigDecimal currentInstockQty = instockQty.add(BigDecimal.ONE); + + if (outstockQty.compareTo(currentInstockQty) < 0) { + throw new ServiceException("请先出库再入库"); + } + + //插入转库任务明细 + wmsTransferDetail.setTransferId(wmsTransfer.getTransferId()); + wmsTransferDetail.setInstockBatch(productBatch); + wmsTransferDetail.setMaterialId(mesBaseBarcodeInfo.getMaterialId()); + wmsTransferDetail.setRealAmount(BigDecimal.ONE); + wmsTransferDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH); + wmsTransferDetail.setTransferDetailType(WmsConstants.WMS_TRANSFER_DETAIL_TYPE_INSTOCK); + wmsTransferDetail.setCreateBy(userName); + wmsTransferDetail.setCreateDate(currentDate); + wmsTransferDetail.setExecutePerson(userName); + wmsTransferDetail.setExecuteTime(currentDate); + wmsTransferDetailMapper.insertWmsTransferDetail(wmsTransferDetail); + + //更新转库任务 + wmsTransfer.setInstockQty(currentInstockQty); + if (applyQty.compareTo(currentInstockQty) == 0) {//出库和入库都已完成 + wmsTransfer.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH); + } + + wmsTransfer.setUpdateDate(currentDate); + wmsTransfer.setUpdateBy(userName); + wmsTransferMapper.updateWmsTransfer(wmsTransfer); + + //更新成品库存 + WmsProductStock productStock = wmsProductStockMapper.selectProductStockByLocationAndBatch(locationCode, productBatch,WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT); + if (productStock == null) { + productStock = new WmsProductStock(); + productStock.setTotalAmount(BigDecimal.ONE); + productStock.setWarehouseId(warehouseId); + productStock.setLocationCode(locationCode); + productStock.setStockType(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT); + productStock.setProductBatch(productBatch); + // productStock.setQualityStatus();//todo: 获取质检状态 + productStock.setProductId(mesBaseBarcodeInfo.getMaterialId()); + productStock.setPlanCode(mesBaseBarcodeInfo.getPlanCode()); + productStock.setPlanDetailCode(mesBaseBarcodeInfo.getPlanDetailCode()); + productStock.setSaleorderCode(mesBaseBarcodeInfo.getSaleorderCode()); + productStock.setCreateDate(currentDate); + productStock.setCreateBy(userName); + wmsProductStockMapper.insertWmsProductStock(productStock); + } else { + productStock.setTotalAmount(productStock.getTotalAmount().add(BigDecimal.ONE)); + productStock.setUpdateDate(currentDate); + productStock.setUpdateBy(userName); + wmsProductStockMapper.updateWmsProductStock(productStock); + } + + + //TODO:同步ERP库存 + return 1; + } + + +} diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsBaseWarehouseMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsBaseWarehouseMapper.xml index 4393ee6..1a5e26b 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsBaseWarehouseMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsBaseWarehouseMapper.xml @@ -270,7 +270,7 @@ - select a.warehouse_id, a.warehouse_instock_type, a.warehouse_type, a.warehouse_code, a.warehouse_name, a.warehouse_category_id, a.warehouse_floor, a.dept_id, a.multi_row_type, a.multi_side_type, a.batch_mix, a.product_mix, a.workbin_flag, a.warehouse_location, a.active_flag, a.audit_flag, a.return_flag, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag, a.factory_id, a.data_source, a.schame, a.line_flag from wms_base_warehouse a where a.warehouse_id = #{warehouseId} 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 new file mode 100644 index 0000000..5e78951 --- /dev/null +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockDetailMapper.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + select product_outstock_detail_id, product_outstock_id, warehouse_id, location_code, product_barcode, product_batch, product_id, plan_amount, outstock_amount, execute_status, erp_status, update_by, update_date, begin_time, end_time from wms_product_outstock_detail + + + + + + + + insert into wms_product_outstock_detail + + product_outstock_id, + warehouse_id, + location_code, + product_barcode, + product_batch, + product_id, + plan_amount, + outstock_amount, + execute_status, + erp_status, + update_by, + update_date, + begin_time, + end_time, + + + #{productOutstockId}, + #{warehouseId}, + #{locationCode}, + #{productBarcode}, + #{productBatch}, + #{productId}, + #{planAmount}, + #{outstockAmount}, + #{executeStatus}, + #{erpStatus}, + #{updateBy}, + #{updateDate}, + #{beginTime}, + #{endTime}, + + + + + update wms_product_outstock_detail + + product_outstock_id = #{productOutstockId}, + warehouse_id = #{warehouseId}, + location_code = #{locationCode}, + product_barcode = #{productBarcode}, + product_batch = #{productBatch}, + product_id = #{productId}, + plan_amount = #{planAmount}, + outstock_amount = #{outstockAmount}, + execute_status = #{executeStatus}, + erp_status = #{erpStatus}, + update_by = #{updateBy}, + update_date = #{updateDate}, + begin_time = #{beginTime}, + end_time = #{endTime}, + + where product_outstock_detail_id = #{productOutstockDetailId} + + + + delete from wms_product_outstock_detail where product_outstock_detail_id = #{productOutstockDetailId} + + + + delete from wms_product_outstock_detail where product_outstock_detail_id in + + #{productOutstockDetailId} + + + 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 700a0e2..26c16fe 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 @@ -14,6 +14,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + @@ -26,6 +31,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -37,8 +45,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - @@ -50,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select product_outstock_id, task_code, warehouse_id, location_code, product_type,operation_type, outstock_type, plan_code, plan_detail_code, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time from wms_product_outstock + select product_outstock_id, task_code, warehouse_id, location_code, product_type,operation_type, outstock_type, plan_code, plan_detail_code,saleorder_code,project_no, product_id,apply_qty,outstock_qty,apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time from wms_product_outstock + select wpo.product_outstock_id, wpo.task_code, wpo.warehouse_id, wpo.location_code, wpo.product_type,wpo.operation_type, wpo.outstock_type, + wpo.plan_code, wpo.plan_detail_code,wpo.saleorder_code, wpo.product_id,wpo.apply_qty,wpo.outstock_qty,wpo.apply_reason, wpo.execute_status,wpo.apply_by, wpo.apply_date, + wbw.warehouse_name,mbmi.material_code,mbmi.material_name + from wms_product_outstock wpo left join wms_base_warehouse wbw on wpo.warehouse_id =wbw.warehouse_id + left join mes_base_material_info mbmi on wpo.product_id = mbmi.material_id + + and wpo.task_code = #{taskCode} + and wpo.warehouse_id = #{warehouseId} + and wpo.location_code = #{locationCode} + and wpo.product_type = #{productType} + and wpo.operation_type = #{operationType} + and wpo.outstock_type = #{outstockType} + and wpo.plan_code = #{planCode} + and wpo.plan_detail_code = #{planDetailCode} + and wpo.apply_reason = #{applyReason} + and wpo.audit_reason = #{auditReason} + and wpo.audit_status = #{auditStatus} + and wpo.execute_status = #{executeStatus} + and (wpo.execute_status = '0' or wpo.execute_status = '1') + and wpo.apply_by = #{applyBy} + and wpo.apply_date = #{applyDate} + and wpo.audit_by = #{auditBy} + and wpo.audit_date = #{auditDate} + and wpo.update_date = #{updateDate} + and wpo.begin_time = #{beginTime} + and wpo.end_time = #{endTime} + + + + + + + + + + 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 537c18c..69e1689 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 @@ -26,10 +26,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select product_stock_id, warehouse_id, location_code, stock_type, product_batch, quality_status, product_id, plan_code, plan_detail_code, total_amount, frozen_amount, occupy_amount, create_by, create_date, update_by, update_date, active_flag, instock_date from wms_product_stock + select product_stock_id, warehouse_id, location_code, stock_type, product_batch, quality_status, product_id, plan_code, plan_detail_code,saleorder_code, total_amount, frozen_amount, occupy_amount, create_by, create_date, update_by, update_date, active_flag, instock_date from wms_product_stock + diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsTransferMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsTransferMapper.xml new file mode 100644 index 0000000..c20ada9 --- /dev/null +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsTransferMapper.xml @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select transfer_id, task_code, ori_warehouse_id, ori_location_code, target_warehouse_id, target_location_code, material_id, product_batch, plan_code, apply_qty, outstock_qty, instock_qty, operation_type, transfer_type, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time from wms_transfer + + + + + + + + insert into wms_transfer + + task_code, + ori_warehouse_id, + ori_location_code, + target_warehouse_id, + target_location_code, + material_id, + product_batch, + plan_code, + apply_qty, + outstock_qty, + instock_qty, + operation_type, + transfer_type, + apply_reason, + audit_reason, + audit_status, + execute_status, + apply_by, + apply_date, + audit_by, + audit_date, + update_by, + update_date, + begin_time, + end_time, + + + #{taskCode}, + #{oriWarehouseId}, + #{oriLocationCode}, + #{targetWarehouseId}, + #{targetLocationCode}, + #{materialId}, + #{productBatch}, + #{planCode}, + #{applyQty}, + #{outstockQty}, + #{instockQty}, + #{operationType}, + #{transferType}, + #{applyReason}, + #{auditReason}, + #{auditStatus}, + #{executeStatus}, + #{applyBy}, + #{applyDate}, + #{auditBy}, + #{auditDate}, + #{updateBy}, + #{updateDate}, + #{beginTime}, + #{endTime}, + + + + + update wms_transfer + + task_code = #{taskCode}, + ori_warehouse_id = #{oriWarehouseId}, + ori_location_code = #{oriLocationCode}, + target_warehouse_id = #{targetWarehouseId}, + target_location_code = #{targetLocationCode}, + material_id = #{materialId}, + product_batch = #{productBatch}, + plan_code = #{planCode}, + apply_qty = #{applyQty}, + outstock_qty = #{outstockQty}, + instock_qty = #{instockQty}, + operation_type = #{operationType}, + transfer_type = #{transferType}, + apply_reason = #{applyReason}, + audit_reason = #{auditReason}, + audit_status = #{auditStatus}, + execute_status = #{executeStatus}, + apply_by = #{applyBy}, + apply_date = #{applyDate}, + audit_by = #{auditBy}, + audit_date = #{auditDate}, + update_by = #{updateBy}, + update_date = #{updateDate}, + begin_time = #{beginTime}, + end_time = #{endTime}, + + where transfer_id = #{transferId} + + + + delete from wms_transfer where transfer_id = #{transferId} + + + + delete from wms_transfer where transfer_id in + + #{transferId} + + + + + delete from wms_transfer_detail where transfer_id in + + #{transferId} + + + + + delete from wms_transfer_detail where transfer_id = #{transferId} + + + + insert into wms_transfer_detail( transfer_detail_id, transfer_id, location_code, material_barcode, instock_batch, material_id, plan_amount, real_amount, execute_status, execute_person, execute_time, transfer_detail_type, machine_name, create_by, create_date, update_by, update_date, active_flag) values + + ( #{item.transferDetailId}, #{item.transferId}, #{item.locationCode}, #{item.materialBarcode}, #{item.instockBatch}, #{item.materialId}, #{item.planAmount}, #{item.realAmount}, #{item.executeStatus}, #{item.executePerson}, #{item.executeTime}, #{item.transferDetailType}, #{item.machineName}, #{item.createBy}, #{item.createDate}, #{item.updateBy}, #{item.updateDate}, #{item.activeFlag}) + + + + + + + + + + + + + + + + +