From f5de044819b6b8e401f809e0052a7213413fb7aa Mon Sep 17 00:00:00 2001 From: btobab Date: Mon, 9 Mar 2026 10:24:53 +0800 Subject: [PATCH] chore: sync local changes and notice tab updates --- AGENTS.md | 38 + .../InboundResourceOccupancyStatus.java | 2 +- .../zbf/system/domain/TRkWareNoticeTab.java | 782 +----------------- .../impl/TRkWareNoticeServiceImpl.java | 146 ++-- 4 files changed, 96 insertions(+), 872 deletions(-) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..e2e2cd9 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,38 @@ +# 项目工作指令 + +本文件作用域覆盖整个仓库。 + +## 触发规则:对代码进行命名优化 + +当用户明确提到 `对代码进行命名优化` 时,按以下规则执行,并将其视为本项目内的长期指令。 + +### 目标 + +命名优化的核心目标不是“机械改名”,而是**消除糟糕命名对阅读和理解代码造成的阻碍**。凡是命名不合理、语义弱、缩写随意、无法体现业务意图、容易误导读者的地方,都属于优化范围。 + +### 执行原则 + +1. 优先提升可读性、可理解性和业务语义表达,不做表面化筛查。 +2. 不仅检查方法名,也检查局部变量、参数名、返回值变量名、集合名、布尔变量名、DTO/VO 字段名、查询条件对象名、临时变量名等。 +3. 对过度泛化或无业务语义的命名进行替换,例如: + - `wrapper` 这类只有技术含义、没有业务上下文的命名,应改为带业务语义的名称,如 `palletQueryWrapper`。 + - `plcs` 这类难以理解、缩写随意且影响阅读的命名,应改为清晰表达含义的名称,如 `palletList`、`matchedPallets` 等。 +4. 命名必须结合所在上下文,准确表达“这是什么、装的是什么、为什么存在”,避免仅仅因为类型已知就偷懒使用笼统命名。 +5. 若原命名已清晰、稳定且符合上下文,不为了“统一而统一”进行无价值改名。 +6. 改名时保持行为不变,并同步更新所有受影响引用,避免产生不一致或语义偏差。 +7. 绝对不允许修改业务逻辑, 只允许优化代码命名 +8. 一段一段的执行命名优化, 当优化完一段后可以简要总结, 然后自动优化下一段 + +### 判断标准 + +若一个命名满足以下任一情况,应优先考虑优化: + +- 需要读者额外猜测其含义; +- 只能体现技术实现,不能体现业务语义; +- 使用随意缩写,且不是团队普遍认可的标准术语; +- 无法直接看出集合内元素、布尔值含义或对象用途; +- 在当前方法或业务场景中会明显影响阅读流畅度。 + +### 输出要求 + +执行这类任务时,应以“提升阅读体验”为首要标准,必要时可在结果说明中指出关键重命名的理由,但不要做与命名无关的顺手重构。 diff --git a/zbf-common/src/main/java/com/zbf/common/enums/custom/InboundResourceOccupancyStatus.java b/zbf-common/src/main/java/com/zbf/common/enums/custom/InboundResourceOccupancyStatus.java index 725ca6c..0b63d13 100644 --- a/zbf-common/src/main/java/com/zbf/common/enums/custom/InboundResourceOccupancyStatus.java +++ b/zbf-common/src/main/java/com/zbf/common/enums/custom/InboundResourceOccupancyStatus.java @@ -5,7 +5,7 @@ package com.zbf.common.enums.custom; */ public enum InboundResourceOccupancyStatus { - IDLE("0", "空闲"), + EMPTY("0", "空闲"), OCCUPIED("1", "占用"); private final String code; diff --git a/zbf-system/src/main/java/com/zbf/system/domain/TRkWareNoticeTab.java b/zbf-system/src/main/java/com/zbf/system/domain/TRkWareNoticeTab.java index b8bbd28..2b55831 100644 --- a/zbf-system/src/main/java/com/zbf/system/domain/TRkWareNoticeTab.java +++ b/zbf-system/src/main/java/com/zbf/system/domain/TRkWareNoticeTab.java @@ -5,6 +5,8 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.zbf.common.annotation.Excel; import com.zbf.common.core.domain.BaseEntity; import lombok.Data; +import lombok.Getter; +import lombok.Setter; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.poi.ss.usermodel.IndexedColors; @@ -20,6 +22,8 @@ import java.util.Date; * @date 2024-06-18 */ @Data +@Setter +@Getter public class TRkWareNoticeTab extends BaseEntity { private static final long serialVersionUID = 1L; @@ -38,7 +42,7 @@ private static final long serialVersionUID = 1L; private String deliveryId; //来源单据号 private String sourceNum; - /** 子需求编号 */ + /** 子需求编号-订单号 */ @Excel(name = "子需求编号") private String salesOrderNumber; @@ -397,787 +401,13 @@ private static final long serialVersionUID = 1L; private String rfidEpc; - public String getNeedPerson() { - return needPerson; - } - - public void setNeedPerson(String needPerson) { - this.needPerson = needPerson; - } - - public String getNeedTel() { - return needTel; - } - - public void setNeedTel(String needTel) { - this.needTel = needTel; - } - - public BigDecimal getNoTaxPrice() { - return noTaxPrice; - } - - public void setNoTaxPrice(BigDecimal noTaxPrice) { - this.noTaxPrice = noTaxPrice; - } - - public BigDecimal getNoTaxMoney() { - return noTaxMoney; - } - - public void setNoTaxMoney(BigDecimal noTaxMoney) { - this.noTaxMoney = noTaxMoney; - } - - public BigDecimal getPurchaseTaxRate() { - return purchaseTaxRate; - } - - public void setPurchaseTaxRate(BigDecimal purchaseTaxRate) { - this.purchaseTaxRate = purchaseTaxRate; - } - - - public BigDecimal getReceivingNum() { - return receivingNum; - } - - public void setReceivingNum(BigDecimal receivingNum) { - this.receivingNum = receivingNum; - } - - public BigDecimal getPurchaseTax() { - return purchaseTax; - } - - public void setPurchaseTax(BigDecimal purchaseTax) { - this.purchaseTax = purchaseTax; - } - - public String getSmartSelectionMode() { - return smartSelectionMode; - } - - public void setSmartSelectionMode(String smartSelectionMode) { - this.smartSelectionMode = smartSelectionMode; - } - - public String getInvoiceTitle() { - return invoiceTitle; - } - - public void setInvoiceTitle(String invoiceTitle) { - this.invoiceTitle = invoiceTitle; - } - - public String getSourceNum() { - return sourceNum; - } - - public void setSourceNum(String sourceNum) { - this.sourceNum = sourceNum; - } - - public String getIndependentAccounting() { - return independentAccounting; - } - - public void setIndependentAccounting(String independentAccounting) { - this.independentAccounting = independentAccounting; - } - - public String getSendeDate() { - return sendeDate; - } - - public void setSendeDate(String sendeDate) { - this.sendeDate = sendeDate; - } - - public String getReportTime() { - return reportTime; - } - - public void setReportTime(String reportTime) { - this.reportTime = reportTime; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public BigDecimal getTotalArraAmout() { - return totalArraAmout; - } - - public void setTotalArraAmout(BigDecimal totalArraAmout) { - this.totalArraAmout = totalArraAmout; - } - - public String getArrivalNum() { - return arrivalNum; - } - - public void setArrivalNum(String arrivalNum) { - this.arrivalNum = arrivalNum; - } - - public String getEmphasisGoods() { - return emphasisGoods; - } - - public void setEmphasisGoods(String emphasisGoods) { - this.emphasisGoods = emphasisGoods; - } - - public String getExpedited() { - return expedited; - } - - public void setExpedited(String expedited) { - this.expedited = expedited; - } - - public String getIndividualInvoicing() { - return individualInvoicing; - } - - public void setIndividualInvoicing(String individualInvoicing) { - this.individualInvoicing = individualInvoicing; - } - - public BigDecimal getRejectNum() { - return rejectNum; - } - - public void setRejectNum(BigDecimal rejectNum) { - this.rejectNum = rejectNum; - } - - public String getPurchaser() { - return purchaser; - } - - public void setPurchaser(String purchaser) { - this.purchaser = purchaser; - } - - public String getAttachments() { - return attachments; - } - - public void setAttachments(String attachments) { - this.attachments = attachments; - } - - public String getSupplierAttachments() { - return supplierAttachments; - } - - public void setSupplierAttachments(String supplierAttachments) { - this.supplierAttachments = supplierAttachments; - } - - - public String getRecPerson() { - return recPerson; - } - - public void setRecPerson(String recPerson) { - this.recPerson = recPerson; - } - - public String getArraDate() { - return arraDate; - } - - public void setArraDate(String arraDate) { - this.arraDate = arraDate; - } - - public String getDocumentStatus() { - return documentStatus; - } - - public void setDocumentStatus(String documentStatus) { - this.documentStatus = documentStatus; - } - - public String getDataSource() { - return dataSource; - } - - public void setDataSource(String dataSource) { - this.dataSource = dataSource; - } - - public String getStorageShortName() { - return storageShortName; - } - - public void setStorageShortName(String storageShortName) { - this.storageShortName = storageShortName; - } - - public String getAbc() { - return abc; - } - - public void setAbc(String abc) { - this.abc = abc; - } - - public String getLevelType() { - return levelType; - } - - public void setLevelType(String levelType) { - this.levelType = levelType; - } - - - public String getDeliveryId() { - return deliveryId; - } - - public void setDeliveryId(String deliveryId) { - this.deliveryId = deliveryId; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getProviderName() { - return providerName; - } - - public void setProviderName(String providerName) { - this.providerName = providerName; - } - - public String getPurchaseId() { - return purchaseId; - } - - public void setPurchaseId(String purchaseId) { - this.purchaseId = purchaseId; - } - - public String getShippingDept() { - return shippingDept; - } - - public void setShippingDept(String shippingDept) { - this.shippingDept = shippingDept; - } - - public String getContact() { - return contact; - } - - public void setContact(String contact) { - this.contact = contact; - } - - public String getTelephone() { - return telephone; - } - - public void setTelephone(String telephone) { - this.telephone = telephone; - } - - public String getReceiveAddr() { - return receiveAddr; - } - - public void setReceiveAddr(String receiveAddr) { - this.receiveAddr = receiveAddr; - } - - - - public String getPurchaseDept() { - return purchaseDept; - } - - public void setPurchaseDept(String purchaseDept) { - this.purchaseDept = purchaseDept; - } - - public String getReceivingArea() { - return receivingArea; - } - - public void setReceivingArea(String receivingArea) { - this.receivingArea = receivingArea; - } - - public String getUseReceiver() { - return useReceiver; - } - - public void setUseReceiver(String useReceiver) { - this.useReceiver = useReceiver; - } - - public String getUseCustodian() { - return useCustodian; - } - - public void setUseCustodian(String useCustodian) { - this.useCustodian = useCustodian; - } - - public String getUseLeader() { - return useLeader; - } - - public void setUseLeader(String useLeader) { - this.useLeader = useLeader; - } - - public String getReceiver() { - return receiver; - } - - public void setReceiver(String receiver) { - this.receiver = receiver; - } - - public String getProduclotId() { - return produclotId; - } - - public void setProduclotId(String produclotId) { - this.produclotId = produclotId; - } - - public String getReceiverDept() { - return receiverDept; - } - - public void setReceiverDept(String receiverDept) { - this.receiverDept = receiverDept; - } - - public String getTenderer() { - return tenderer; - } - - public void setTenderer(String tenderer) { - this.tenderer = tenderer; - } - - public boolean isAddFlg() { - return addFlg; -} - -public void setAddFlg(boolean addFlg) { - this.addFlg = addFlg; -} - -public boolean isEditFlg() { - return editFlg; -} - -public void setEditFlg(boolean editFlg) { - this.editFlg = editFlg; -} - -public String getStorageLocation() { - return storageLocation; -} - -public void setStorageLocation(String storageLocation) { - this.storageLocation = storageLocation; -} - -public BigDecimal getRecNumNow() { - return recNumNow; -} - -public void setRecNumNow(BigDecimal recNumNow) { - this.recNumNow = recNumNow; -} - -/**库位 */ + /**库位 */ private String storageLocation; /**本次接收数量 */ @Excel(name = "本次签收数量",type = Excel.Type.EXPORT) private BigDecimal recNumNow; - public void setId(String id) { - this.id = id; - } - - public String getId() { - return id; - } - public void setSalesOrderNumber(String salesOrderNumber) { - this.salesOrderNumber = salesOrderNumber; - } - - public String getSalesOrderNumber() { - return salesOrderNumber; - } - public void setNoticeId(String noticeId) { - this.noticeId = noticeId; - } - - public String getNoticeId() { - return noticeId; - } - public void setGoodsId(String goodsId) { - this.goodsId = goodsId; - } - - public String getGoodsId() { - return goodsId; - } - public void setGoodsName(String goodsName) { - this.goodsName = goodsName; - } - - public String getGoodsName() { - return goodsName; - } - public void setUnit(String unit) { - this.unit = unit; - } - - public String getUnit() { - return unit; - } - public void setSpecification(String specification) { - this.specification = specification; - } - - public String getSpecification() { - return specification; - } - public void setRecoil(String recoil) { - this.recoil = recoil; - } - - public String getRecoil() { - return recoil; - } - public void setBrand(String brand) { - this.brand = brand; - } - - public String getBrand() { - return brand; - } - public void setPrice(BigDecimal price) { - this.price = price; - } - - public BigDecimal getPrice() { - return price; - } - public void setTotalMoney(BigDecimal totalMoney) { - this.totalMoney = totalMoney; - } - - public BigDecimal getTotalMoney() { - return totalMoney; - } - public void setArraMount(BigDecimal arraMount) { - this.arraMount = arraMount; - } - - public BigDecimal getArraMount() { - return arraMount; - } - public void setRecNum(BigDecimal recNum) { - this.recNum = recNum; - } - - public BigDecimal getRecNum() { - return recNum; - } - public void setProject(String project) { - this.project = project; - } - - public String getProject() { - return project; - } - public void setNeedDept(String needDept) { - this.needDept = needDept; - } - - public String getNeedDept() { - return needDept; - } - public void setUseType(String useType) { - this.useType = useType; - } - - public String getUseType() { - return useType; - } - public void setScaleUnit(String scaleUnit) { - this.scaleUnit = scaleUnit; - } - - public String getScaleUnit() { - return scaleUnit; - } - public void setTotalVolume(BigDecimal totalVolume) { - this.totalVolume = totalVolume; - } - - public BigDecimal getTotalVolume() { - return totalVolume; - } - public void setTotalRoughWeight(BigDecimal totalRoughWeight) { - this.totalRoughWeight = totalRoughWeight; - } - - public BigDecimal getTotalRoughWeight() { - return totalRoughWeight; - } - public void setTotalNetWeigh(BigDecimal totalNetWeigh) { - this.totalNetWeigh = totalNetWeigh; - } - - public BigDecimal getTotalNetWeigh() { - return totalNetWeigh; - } - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - public BigDecimal getAmount() { - return amount; - } - public void setProductionDate(Date productionDate) { - this.productionDate = productionDate; - } - - public Date getProductionDate() { - return productionDate; - } - public void setStorageId(String storageId) { - this.storageId = storageId; - } - - public String getStorageId() { - return storageId; - } - public void setStorageAreaId(String storageAreaId) { - this.storageAreaId = storageAreaId; - } - - public String getStorageAreaId() { - return storageAreaId; - } - public void setPackageId(String packageId) { - this.packageId = packageId; - } - - public String getPackageId() { - return packageId; - } - public void setGoodsTypeId(String goodsTypeId) { - this.goodsTypeId = goodsTypeId; - } - - public String getGoodsTypeId() { - return goodsTypeId; - } - public void setBarcode(String barcode) { - this.barcode = barcode; - } - - public String getBarcode() { - return barcode; - } - public void setGoodsVolume(BigDecimal goodsVolume) { - this.goodsVolume = goodsVolume; - } - - public BigDecimal getGoodsVolume() { - return goodsVolume; - } - public void setPrintSts(String printSts) { - this.printSts = printSts; - } - - public String getPrintSts() { - return printSts; - } - public void setPrintCs(Long printCs) { - this.printCs = printCs; - } - - public Long getPrintCs() { - return printCs; - } - public void setNetWeigh(BigDecimal netWeigh) { - this.netWeigh = netWeigh; - } - - public BigDecimal getNetWeigh() { - return netWeigh; - } - public void setKindNum(Long kindNum) { - this.kindNum = kindNum; - } - - public Long getKindNum() { - return kindNum; - } - public void setExpiryDate(String expiryDate) { - this.expiryDate = expiryDate; - } - - public String getExpiryDate() { - return expiryDate; - } - public void setOperateDate(Date operateDate) { - this.operateDate = operateDate; - } - - public Date getOperateDate() { - return operateDate; - } - public void setProductStatus(String productStatus) { - this.productStatus = productStatus; - } - - public String getProductStatus() { - return productStatus; - } - public void setReceivingStatus(String receivingStatus) { - this.receivingStatus = receivingStatus; - } - - public String getReceivingStatus() { - return receivingStatus; - } - public void setInStatus(String inStatus) { - this.inStatus = inStatus; - } - - public String getInStatus() { - return inStatus; - } - public void setCtl(String ctl) { - this.ctl = ctl; - } - - public String getCtl() { - return ctl; - } - public void setQualityInspectionDate(String qualityInspectionDate) { - this.qualityInspectionDate = qualityInspectionDate; - } - - public String getQualityInspectionDate() { - return qualityInspectionDate; - } - public void setStatus(String status) { - this.status = status; - } - - public String getStatus() { - return status; - } - - public BigDecimal getAcceNum() { - return acceNum; - } - - public void setAcceNum(BigDecimal acceNum) { - this.acceNum = acceNum; - } - - public void setQualityInspecStatus(String qualityInspecStatus) { - this.qualityInspecStatus = qualityInspecStatus; - } - - public String getQualityInspecStatus() { - return qualityInspecStatus; - } - public void setOrderType(String orderType) { - this.orderType = orderType; - } - - public String getOrderType() { - return orderType; - } - public void setApplicant(String applicant) { - this.applicant = applicant; - } - - public String getApplicant() { - return applicant; - } - public void setSupplier(String supplier) { - this.supplier = supplier; - } - - public String getSupplier() { - return supplier; - } - public void setQualified(String qualified) { - this.qualified = qualified; - } - - public String getQualified() { - return qualified; - } - public void setPlanDate(String planDate) { - this.planDate = planDate; - } - - public String getPlanDate() { - return planDate; - } - public void setPlanTime(String planTime) { - this.planTime = planTime; - } - - public String getPlanTime() { - return planTime; - } - public void setNeedCycle(BigDecimal needCycle) { - this.needCycle = needCycle; - } - - public BigDecimal getNeedCycle() { - return needCycle; - } - public void setNeedType(String needType) { - this.needType = needType; - } - - public String getNeedType() { - return needType; - } - public void setBatchNo(String batchNo) { - this.batchNo = batchNo; - } - - public String getBatchNo() { - return batchNo; - } - - @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/zbf-system/src/main/java/com/zbf/system/service/impl/TRkWareNoticeServiceImpl.java b/zbf-system/src/main/java/com/zbf/system/service/impl/TRkWareNoticeServiceImpl.java index c3301a0..f80a3de 100644 --- a/zbf-system/src/main/java/com/zbf/system/service/impl/TRkWareNoticeServiceImpl.java +++ b/zbf-system/src/main/java/com/zbf/system/service/impl/TRkWareNoticeServiceImpl.java @@ -117,9 +117,6 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl confirmNoticeTab(TRkWareNoticeTabUpdate confirmRequest) { // 返回结果 @@ -383,14 +388,14 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl matchedStocks = tMiStockMapper.selectTMiStockList(stockQuery); - if (matchedStocks.size() > 0) { + if (!matchedStocks.isEmpty()) { resultMap.put("error", "托盘【" + confirmRequest.getCtlNo() + "】已占用,请更换"); - throw new RuntimeException("托盘" + confirmRequest.getCtlNo() + "已占用,请更换"); - }*/ + throw new RuntimeException("托盘" + confirmRequest.getCtlNo() + "已占用,请更换"); + } //校验托盘容器是否正确 @@ -408,7 +413,7 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl noticeTabByBusinessKey = new HashMap(); + Map noticeTabFromDbById = new HashMap<>(); for (int i = 0; i < inboundNotice.getTRkWareNoticeTabList().size(); i++) { TRkWareNoticeTab noticeTab = inboundNotice.getTRkWareNoticeTabList().get(i); - noticeTabByBusinessKey.put(noticeTab.getSalesOrderNumber() + noticeTab.getGoodsId(), noticeTab); + noticeTabFromDbById.put(noticeTab.getId(), noticeTab); } if ("".equals(confirmRequest.getUserName())) { confirmRequest.setUserName(confirmRequest.getRecordPerson()); } - List updatedNoticeTabs = new ArrayList(); - List inboundTasksToCreate = new ArrayList(); + List updatedNoticeTabs = new ArrayList<>(); + List inboundTasksToCreate = new ArrayList<>(); //冻结校验 List submittedNoticeTabs = confirmRequest.getTrkWareNoticeTabList(); for (TRkWareNoticeTab submittedNoticeTab : submittedNoticeTabs) { - TRkWareNoticeTab noticeTabInDb = mapper.selectTRkWareNoticeTabById(submittedNoticeTab.getId()); + TRkWareNoticeTab noticeTabInDb = noticeTabFromDbById.get(submittedNoticeTab.getId()); + if (noticeTabInDb == null) { + resultMap.put("error", "物料【" + submittedNoticeTab.getGoodsName() + "】的通知单明细不存在"); + throw new RuntimeException("物料【" + submittedNoticeTab.getGoodsName() + "】的通知单明细不存在"); + } if (InboundNoticeTabInStatus.LOCKED.getCode().equals(noticeTabInDb.getInStatus())) { resultMap.put("error", "物料【" + noticeTabInDb.getGoodsName() + "】已冻结,不可收货"); log.error("物料【" + noticeTabInDb.getInStatus() + "】已冻结,不可收货"); @@ -448,7 +457,7 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl 0) { resultMap.put("error", "物料【" + submittedNoticeTab.getGoodsName() + "】的收货数量不能大于签收数量"); throw new RuntimeException("物料【" + submittedNoticeTab.getGoodsName() + "】的收货数量不能大于签收数量"); @@ -508,14 +513,12 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl noticeTabByBusinessKey = new HashMap(); + Map existingNoticeTabById = new HashMap(); for (int i = 0; i < inboundNotice.getTRkWareNoticeTabList().size(); i++) { TRkWareNoticeTab noticeTab = inboundNotice.getTRkWareNoticeTabList().get(i); - noticeTabByBusinessKey.put(noticeTab.getSalesOrderNumber() + noticeTab.getGoodsId(), noticeTab); + existingNoticeTabById.put(noticeTab.getId(), noticeTab); } List noticeTabsToInsert = new ArrayList(); @@ -1060,9 +1060,9 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl 0) { - Map receivingGoodsTabByBusinessKey = new HashMap(); + Map receivingGoodsTabById = new HashMap(); if (receivingGoods != null) { for (TRkReceivingGoodsTab receivingGoodsTab : receivingGoods.getTRkReceivingGoodsTabList()) { - receivingGoodsTabByBusinessKey.put(receivingGoodsTab.getSalesOrderNumber() + receivingGoodsTab.getGoodsId(), receivingGoodsTab); + receivingGoodsTabById.put(receivingGoodsTab.getId(), receivingGoodsTab); } } List receivingGoodsTabsToInsert = new ArrayList<>(); @@ -1237,8 +1237,7 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl receivingGoodsTabsToUpdate = new ArrayList(); for (TRkWareNoticeTab noticeTab : inboundNotice.getTRkWareNoticeTabList()) { - TRkReceivingGoodsTab receivingGoodsTabToUpdate = receivingGoodsTabByBusinessKey - .get(noticeTab.getSalesOrderNumber() + noticeTab.getGoodsId()); + TRkReceivingGoodsTab receivingGoodsTabToUpdate = receivingGoodsTabById.get(noticeTab.getId()); if (receivingGoodsTabToUpdate != null) { receivingGoodsTabToUpdate.setRecNum(noticeTab.getRecNum()); receivingGoodsTabToUpdate.setReceivingStatus(noticeTab.getReceivingStatus()); @@ -1306,12 +1305,10 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl shelvesConfirm(TRkWareNoticeTabUpdate shelfConfirmRequest) { // 返回结果 Map resultMap = new HashMap<>(); - - - // 库位 if (ObjectUtils.isEmpty(shelfConfirmRequest.getStorageLocation())) { resultMap.put("error", "库位不能为空"); @@ -1332,12 +1329,7 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl palletQueryWrapper = new LambdaQueryWrapper<>(); palletQueryWrapper.eq(TBasePallet::getPalletId, shelfConfirmRequest.getCtlNo()); @@ -1362,7 +1353,7 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl tMiStocks = null; - // if (!ObjectUtils.isEmpty(shelfConfirmRequest.getCtlNo())) { - // // 校验同一托盘号在库存中是否存在 - // TMiStock stockQuery = new TMiStock(); - // stockQuery.setCtl(shelfConfirmRequest.getCtlNo()); - // tMiStocks = tMiStockMapper.selectTMiStockList(stockQuery); - - // if (tMiStocks.size() > 0) { - // resultMap.put("error", "托盘【" + shelfConfirmRequest.getCtlNo() + "】已占用,请更换"); - // return resultMap; - // } - // } - - // // 校验同一库位是否占用 - // TMiStock tMiStock2 = new TMiStock(); - // tMiStock2.setLocationId(shelfConfirmRequest.getStorageLocation()); - // tMiStocks = tMiStockMapper.selectTMiStockList(tMiStock2); - - // if (tMiStocks.size() > 0) { - // resultMap.put("error", "库位【" + shelfConfirmRequest.getCtlNo() + "】已占用,请更换"); - // return resultMap; - // } + // 校验同一库位是否占用 + TMiStock stockDupOccupyQuery = new TMiStock(); + stockDupOccupyQuery.setLocationId(shelfConfirmRequest.getStorageLocation()); + List stockDupOccupyList = tMiStockMapper.selectTMiStockList(stockDupOccupyQuery); + if (stockDupOccupyList != null && !stockDupOccupyList.isEmpty()) { + resultMap.put("error", "库位【" + shelfConfirmRequest.getCtlNo() + "】已占用,请更换"); + return resultMap; + } // 超期呆滞时间获取 SysConfig overdueStagnationConfigQuery = new SysConfig(); overdueStagnationConfigQuery.setConfigKey("overdue.stagnation"); List overdueStagnationConfigList = sysConfigMapper.selectConfigList(overdueStagnationConfigQuery); - if (overdueStagnationConfigList.size() > 0) { + if (!overdueStagnationConfigList.isEmpty()) { shelfConfirmRequest.getExtras().put("extraTime", overdueStagnationConfigList.get(0).getConfigValue()); } else { shelfConfirmRequest.getExtras().put("extraTime", ""); } - List updatedNoticeTabs = new ArrayList(); - List realStockRecordsToInsert = new ArrayList(); - List virtualStockRecordsToInsert = new ArrayList(); + List updatedNoticeTabs = new ArrayList<>(); + List realStockRecordsToInsert = new ArrayList<>(); + List virtualStockRecordsToInsert = new ArrayList<>(); // 判断通知单明细是否存在为完成的 Boolean allNoticeTabsCompleted = true; @@ -1487,11 +1464,6 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - // queryWrapper.eq(TBaseStorage::getStorageId, submittedInboundTask.getStorageId()); - // TBaseStorage storage = tBaseStorageMapper.selectOne(queryWrapper); - // tabOld.setStorageShortName(storage.getStorageShortName()); - noticeTabToUpdate.setUpdateBy(shelfConfirmRequest.getUserName()); noticeTabToUpdate.setUpdateTime(new Date()); @@ -1511,21 +1483,16 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl 0) { - Map receivingGoodsTabByBusinessKey = new HashMap(); + Map receivingGoodsTabById = new HashMap(); if (receivingGoods != null) { for (TRkReceivingGoodsTab receivingGoodsTab : receivingGoods.getTRkReceivingGoodsTabList()) { - receivingGoodsTabByBusinessKey.put(receivingGoodsTab.getSalesOrderNumber() + receivingGoodsTab.getGoodsId(), receivingGoodsTab); + receivingGoodsTabById.put(receivingGoodsTab.getId(), receivingGoodsTab); } } @@ -1655,8 +1618,7 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl receivingGoodsTabsToUpdate = new ArrayList(); for (TRkWareNoticeTab updatedNoticeTab : updatedNoticeTabs) { - TRkReceivingGoodsTab receivingGoodsTabToUpdate = receivingGoodsTabByBusinessKey - .get(updatedNoticeTab.getSalesOrderNumber() + updatedNoticeTab.getGoodsId()); + TRkReceivingGoodsTab receivingGoodsTabToUpdate = receivingGoodsTabById.get(updatedNoticeTab.getId()); if (receivingGoodsTabToUpdate != null) { receivingGoodsTabToUpdate.setRecNum(updatedNoticeTab.getRecNum()); receivingGoodsTabToUpdate.setReceivingStatus(updatedNoticeTab.getReceivingStatus()); @@ -1731,9 +1693,6 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl