From 662bc35be2a687b4ceda4002d26eb55516477022 Mon Sep 17 00:00:00 2001 From: "DESKTOP-J7ED0MB\\yinjinlu" <411641505@qq.com> Date: Thu, 27 Oct 2022 23:53:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=94=AE=E9=80=80=E8=B4=A7=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E6=A0=B8=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wm/controller/WmRtSalseController.java | 35 +- .../ktg/mes/wm/domain/tx/RtSalseTxBean.java | 318 ++++++++++++++++++ .../ktg/mes/wm/mapper/WmRtSalseMapper.java | 8 + .../mes/wm/service/IStorageCoreService.java | 2 + .../ktg/mes/wm/service/IWmRtSalseService.java | 8 + .../service/impl/StorageCoreServiceImpl.java | 17 + .../wm/service/impl/WmRtSalseServiceImpl.java | 6 + 7 files changed, 390 insertions(+), 4 deletions(-) create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtSalseTxBean.java diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtSalseController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtSalseController.java index 5284f71..a4601f4 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtSalseController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtSalseController.java @@ -5,13 +5,13 @@ import javax.servlet.http.HttpServletResponse; import com.ktg.common.constant.UserConstants; import com.ktg.common.utils.StringUtils; -import com.ktg.mes.wm.domain.WmStorageArea; -import com.ktg.mes.wm.domain.WmStorageLocation; -import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.domain.tx.RtSalseTxBean; import com.ktg.mes.wm.service.*; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; @@ -24,7 +24,6 @@ import com.ktg.common.annotation.Log; import com.ktg.common.core.controller.BaseController; import com.ktg.common.core.domain.AjaxResult; import com.ktg.common.enums.BusinessType; -import com.ktg.mes.wm.domain.WmRtSalse; import com.ktg.common.utils.poi.ExcelUtil; import com.ktg.common.core.page.TableDataInfo; @@ -167,4 +166,32 @@ public class WmRtSalseController extends BaseController return toAjax(wmRtSalseService.deleteWmRtSalseByRtIds(rtIds)); } + + /** + * 执行退货 + * @param rtId + * @return + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:edit')") + @Log(title = "产品销售退货单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{rtId}") + public AjaxResult execute(@PathVariable Long rtId){ + WmRtSalse rtSalse = wmRtSalseService.selectWmRtSalseByRtId(rtId); + WmRtSalseLine param = new WmRtSalseLine(); + param.setRtId(rtId); + List lines = wmRtSalseLineService.selectWmRtSalseLineList(param); + if(CollectionUtils.isEmpty(lines)){ + return AjaxResult.error("请添加退货单行信息!"); + } + + List beans = wmRtSalseService.getTxBeans(rtId); + + storageCoreService.processRtSalse(beans); + + rtSalse.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmRtSalseService.updateWmRtSalse(rtSalse); + return AjaxResult.success(); + } + } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtSalseTxBean.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtSalseTxBean.java new file mode 100644 index 0000000..2e4dd01 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/tx/RtSalseTxBean.java @@ -0,0 +1,318 @@ +package com.ktg.mes.wm.domain.tx; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.core.domain.BaseEntity; + +import java.math.BigDecimal; +import java.util.Date; + +public class RtSalseTxBean extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 产品物料ID */ + private Long itemId; + + /** 产品物料编码 */ + private String itemCode; + + /** 产品物料名称 */ + private String itemName; + + /** 规格型号 */ + private String specification; + + /** 单位 */ + private String unitOfMeasure; + + /** 入库批次号 */ + private String batchCode; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + private String warehouseCode; + + /** 仓库名称 */ + private String warehouseName; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + private String locationCode; + + /** 库区名称 */ + private String locationName; + + /** 库位ID */ + private Long areaId; + + /** 库位编码 */ + private String areaCode; + + /** 库位名称 */ + private String areaName; + + /** 供应商ID */ + private Long clientId; + + /** 客户编号 */ + private String clientCode; + + /** 客户名称 */ + private String clientName; + + /** 客户简称 */ + private String clientNick; + + /** 单据类型 */ + private String sourceDocType; + + /** 单据ID */ + private Long sourceDocId; + + /** 单据编号 */ + private String sourceDocCode; + + /** 单据行ID */ + private Long sourceDocLineId; + + /** 事务数量 */ + private BigDecimal transactionQuantity; + + /** 退货日期 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + private Date rtDate; + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getSpecification() { + return specification; + } + + public void setSpecification(String specification) { + this.specification = specification; + } + + public String getUnitOfMeasure() { + return unitOfMeasure; + } + + public void setUnitOfMeasure(String unitOfMeasure) { + this.unitOfMeasure = unitOfMeasure; + } + + public String getBatchCode() { + return batchCode; + } + + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + + public Long getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(Long warehouseId) { + this.warehouseId = warehouseId; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + + public Long getLocationId() { + return locationId; + } + + public void setLocationId(Long locationId) { + this.locationId = locationId; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public Long getClientId() { + return clientId; + } + + public void setClientId(Long clientId) { + this.clientId = clientId; + } + + public String getClientCode() { + return clientCode; + } + + public void setClientCode(String clientCode) { + this.clientCode = clientCode; + } + + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public String getClientNick() { + return clientNick; + } + + public void setClientNick(String clientNick) { + this.clientNick = clientNick; + } + + public String getSourceDocType() { + return sourceDocType; + } + + public void setSourceDocType(String sourceDocType) { + this.sourceDocType = sourceDocType; + } + + public Long getSourceDocId() { + return sourceDocId; + } + + public void setSourceDocId(Long sourceDocId) { + this.sourceDocId = sourceDocId; + } + + public String getSourceDocCode() { + return sourceDocCode; + } + + public void setSourceDocCode(String sourceDocCode) { + this.sourceDocCode = sourceDocCode; + } + + public Long getSourceDocLineId() { + return sourceDocLineId; + } + + public void setSourceDocLineId(Long sourceDocLineId) { + this.sourceDocLineId = sourceDocLineId; + } + + public BigDecimal getTransactionQuantity() { + return transactionQuantity; + } + + public void setTransactionQuantity(BigDecimal transactionQuantity) { + this.transactionQuantity = transactionQuantity; + } + + public Date getRtDate() { + return rtDate; + } + + public void setRtDate(Date rtDate) { + this.rtDate = rtDate; + } + + @Override + public String toString() { + return "RtSalseTxBean{" + + "itemId=" + itemId + + ", itemCode='" + itemCode + '\'' + + ", itemName='" + itemName + '\'' + + ", specification='" + specification + '\'' + + ", unitOfMeasure='" + unitOfMeasure + '\'' + + ", batchCode='" + batchCode + '\'' + + ", warehouseId=" + warehouseId + + ", warehouseCode='" + warehouseCode + '\'' + + ", warehouseName='" + warehouseName + '\'' + + ", locationId=" + locationId + + ", locationCode='" + locationCode + '\'' + + ", locationName='" + locationName + '\'' + + ", areaId=" + areaId + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", clientId=" + clientId + + ", clientCode='" + clientCode + '\'' + + ", clientName='" + clientName + '\'' + + ", clientNick='" + clientNick + '\'' + + ", sourceDocType='" + sourceDocType + '\'' + + ", sourceDocId=" + sourceDocId + + ", sourceDocCode='" + sourceDocCode + '\'' + + ", sourceDocLineId=" + sourceDocLineId + + ", transactionQuantity=" + transactionQuantity + + ", rtDate=" + rtDate + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtSalseMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtSalseMapper.java index 80e1d6b..d257bb7 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtSalseMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtSalseMapper.java @@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper; import java.util.List; import com.ktg.mes.wm.domain.WmRtSalse; +import com.ktg.mes.wm.domain.tx.RtSalseTxBean; /** * 产品销售退货单Mapper接口 @@ -28,6 +29,13 @@ public interface WmRtSalseMapper public List selectWmRtSalseList(WmRtSalse wmRtSalse); + /** + * + * @param rtId + * @return + */ + public List getTxBeans(Long rtId); + /** * 检查编号唯一性 * @return diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IStorageCoreService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IStorageCoreService.java index e181d86..9fbc7a7 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IStorageCoreService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IStorageCoreService.java @@ -57,4 +57,6 @@ public interface IStorageCoreService { */ public void processProductSalse(List lines); + public void processRtSalse(List lines); + } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtSalseService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtSalseService.java index b743006..75910d7 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtSalseService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtSalseService.java @@ -2,6 +2,7 @@ package com.ktg.mes.wm.service; import java.util.List; import com.ktg.mes.wm.domain.WmRtSalse; +import com.ktg.mes.wm.domain.tx.RtSalseTxBean; /** * 产品销售退货单Service接口 @@ -28,6 +29,13 @@ public interface IWmRtSalseService public List selectWmRtSalseList(WmRtSalse wmRtSalse); + /** + * + * @param rtId + * @return + */ + public List getTxBeans(Long rtId); + /** * 检查编号唯一性 * @return diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/StorageCoreServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/StorageCoreServiceImpl.java index 42c5f40..4ece732 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/StorageCoreServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/StorageCoreServiceImpl.java @@ -328,5 +328,22 @@ public class StorageCoreServiceImpl implements IStorageCoreService { } } + @Override + public void processRtSalse(List lines) { + if(CollUtil.isEmpty(lines)){ + throw new BussinessException("没有需要处理的原料消耗单行"); + } + String transactionType = UserConstants.TRANSACTION_TYPE_PRODUCT_RS; + for(int i=0;i getTxBeans(Long rtId) { + return wmRtSalseMapper.getTxBeans(rtId); + } + @Override public String checkUnique(WmRtSalse wmRtSalse) { WmRtSalse salse = wmRtSalseMapper.checkUnique(wmRtSalse);