From 23e4502cbe6df30b7b7c77e905e519f29ef422a4 Mon Sep 17 00:00:00 2001 From: xins Date: Fri, 24 May 2024 11:29:04 +0800 Subject: [PATCH] =?UTF-8?q?2.3.5=20WMS:=20=E6=A0=B9=E6=8D=AE=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=92=8C=E9=94=80=E5=94=AE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=BB=91=E5=AE=9A=E5=85=B3=E7=B3=BB=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8E=9F=E6=9D=90=E6=96=99=E5=87=BA=E5=BA=93=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hw/wms/controller/WmsScadaController.java | 1 + .../java/com/hw/wms/domain/WmsStockTotal.java | 172 ++++++++++-------- .../hw/wms/mapper/WmsRawOutstockMapper.java | 2 +- .../impl/WmsRawOutstockServiceImpl.java | 76 ++++---- .../mapper/wms/WmsRawOutstockMapper.xml | 5 +- .../mapper/wms/WmsStockTotalMapper.xml | 1 + 6 files changed, 144 insertions(+), 113 deletions(-) diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsScadaController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsScadaController.java index 156fb66..1c86a34 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsScadaController.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsScadaController.java @@ -82,6 +82,7 @@ public class WmsScadaController extends BaseController { +/**此方法暂时不用*/ @Log(title = "原材料出库记录", businessType = BusinessType.AUDIT) @PostMapping(("/applyAgvRawOutstock")) public AjaxResult applyAgvRawOutstock(@Validated @RequestBody WmsAgvRawOutstockVo wmsAgvRawOutstockVo) { diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsStockTotal.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsStockTotal.java index d64adde..3c94d70 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsStockTotal.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsStockTotal.java @@ -2,6 +2,7 @@ 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; @@ -14,30 +15,41 @@ import com.hw.common.core.web.domain.BaseEntity; * @author xins * @date 2024-03-14 */ -public class WmsStockTotal extends BaseEntity -{ +public class WmsStockTotal extends BaseEntity { private static final long serialVersionUID = 1L; - /** 总库存ID */ + /** + * 总库存ID + */ private Long stockTotalId; - /** 仓库ID */ + /** + * 仓库ID + */ @Excel(name = "仓库ID") private Long warehouseId; - /** 仓库名称 */ + /** + * 仓库名称 + */ @Excel(name = "仓库名称") private String warehouseName; - /** 仓库楼层 */ + /** + * 仓库楼层 + */ @Excel(name = "仓库楼层") private Long warehouseFloor; - /** 库存类型:1原材料,2半成品,3成品 */ + /** + * 库存类型:1原材料,2半成品,3成品 + */ @Excel(name = "库存类型:1原材料,2半成品,3成品") private String stockType; - /** 物料ID */ + /** + * 物料ID + */ @Excel(name = "物料ID") private Long materialId; @@ -46,37 +58,53 @@ public class WmsStockTotal extends BaseEntity private String safeFlag; - /** 物料编号 */ + /** + * 物料编号 + */ @Excel(name = "物料编号") private String materialCode; - /** 物料名称 */ + /** + * 物料名称 + */ @Excel(name = "物料名称") private String materialName; - /** 总数量;仓库存放的总数量 */ + /** + * 总数量;仓库存放的总数量 + */ @Excel(name = "总数量;仓库存放的总数量") private BigDecimal totalAmount; - /** 冻结数量;手动冻结的,暂时可不用 */ + /** + * 冻结数量;手动冻结的,暂时可不用 + */ @Excel(name = "冻结数量;手动冻结的,暂时可不用") private BigDecimal frozenAmount; - /** 占用数量;申请时占用的数量,在出库时要减去出库数量,并且总数量要同步更新; */ + /** + * 占用数量;申请时占用的数量,在出库时要减去出库数量,并且总数量要同步更新; + */ @Excel(name = "占用数量;申请时占用的数量,在出库时要减去出库数量,并且总数量要同步更新;") private BigDecimal occupyAmount; - /** 创建时间 */ + /** + * 创建时间 + */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date createDate; - /** 最后更新时间 */ + /** + * 最后更新时间 + */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date updateDate; - /** 有效标记 */ + /** + * 有效标记 + */ @Excel(name = "有效标记") private String activeFlag; @@ -89,49 +117,43 @@ public class WmsStockTotal extends BaseEntity this.warehouseName = warehouseName; } - public void setStockTotalId(Long stockTotalId) - { + public void setStockTotalId(Long stockTotalId) { this.stockTotalId = stockTotalId; } - public Long getStockTotalId() - { + public Long getStockTotalId() { return stockTotalId; } - public void setWarehouseId(Long warehouseId) - { + + public void setWarehouseId(Long warehouseId) { this.warehouseId = warehouseId; } - public Long getWarehouseId() - { + public Long getWarehouseId() { return warehouseId; } - public void setWarehouseFloor(Long warehouseFloor) - { + + public void setWarehouseFloor(Long warehouseFloor) { this.warehouseFloor = warehouseFloor; } - public Long getWarehouseFloor() - { + public Long getWarehouseFloor() { return warehouseFloor; } - public void setStockType(String stockType) - { + + public void setStockType(String stockType) { this.stockType = stockType; } - public String getStockType() - { + public String getStockType() { return stockType; } - public void setMaterialId(Long materialId) - { + + public void setMaterialId(Long materialId) { this.materialId = materialId; } - public Long getMaterialId() - { + public Long getMaterialId() { return materialId; } @@ -151,58 +173,52 @@ public class WmsStockTotal extends BaseEntity this.safeFlag = safeFlag; } - public void setTotalAmount(BigDecimal totalAmount) - { + public void setTotalAmount(BigDecimal totalAmount) { this.totalAmount = totalAmount; } - public BigDecimal getTotalAmount() - { - return totalAmount; + public BigDecimal getTotalAmount() { + + return totalAmount == null || totalAmount.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : totalAmount; } - public void setFrozenAmount(BigDecimal frozenAmount) - { + + public void setFrozenAmount(BigDecimal frozenAmount) { this.frozenAmount = frozenAmount; } - public BigDecimal getFrozenAmount() - { - return frozenAmount; + public BigDecimal getFrozenAmount() { + return frozenAmount == null || frozenAmount.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : frozenAmount; } - public void setOccupyAmount(BigDecimal occupyAmount) - { + + public void setOccupyAmount(BigDecimal occupyAmount) { this.occupyAmount = occupyAmount; } - public BigDecimal getOccupyAmount() - { - return occupyAmount; + public BigDecimal getOccupyAmount() { + return occupyAmount == null || occupyAmount.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : occupyAmount; } - public void setCreateDate(Date createDate) - { + + public void setCreateDate(Date createDate) { this.createDate = createDate; } - public Date getCreateDate() - { + public Date getCreateDate() { return createDate; } - public void setUpdateDate(Date updateDate) - { + + public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } - public Date getUpdateDate() - { + public Date getUpdateDate() { return updateDate; } - public void setActiveFlag(String activeFlag) - { + + public void setActiveFlag(String activeFlag) { this.activeFlag = activeFlag; } - public String getActiveFlag() - { + public String getActiveFlag() { return activeFlag; } @@ -224,20 +240,20 @@ public class WmsStockTotal extends BaseEntity @Override public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("stockTotalId", getStockTotalId()) - .append("warehouseId", getWarehouseId()) - .append("warehouseFloor", getWarehouseFloor()) - .append("stockType", getStockType()) - .append("materialId", getMaterialId()) - .append("totalAmount", getTotalAmount()) - .append("frozenAmount", getFrozenAmount()) - .append("occupyAmount", getOccupyAmount()) - .append("createBy", getCreateBy()) - .append("createDate", getCreateDate()) - .append("updateBy", getUpdateBy()) - .append("updateDate", getUpdateDate()) - .append("activeFlag", getActiveFlag()) - .toString(); + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("stockTotalId", getStockTotalId()) + .append("warehouseId", getWarehouseId()) + .append("warehouseFloor", getWarehouseFloor()) + .append("stockType", getStockType()) + .append("materialId", getMaterialId()) + .append("totalAmount", getTotalAmount()) + .append("frozenAmount", getFrozenAmount()) + .append("occupyAmount", getOccupyAmount()) + .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/WmsRawOutstockMapper.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsRawOutstockMapper.java index f365b58..971be97 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsRawOutstockMapper.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsRawOutstockMapper.java @@ -114,7 +114,7 @@ public interface WmsRawOutstockMapper /** - * 查询原材料出库记录列表,join material + * 查询原材料出库记录列表,join material,warehouse * * @param wmsRawOutstock 原材料出库记录 * @return 原材料出库记录集合 diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java index 653a01c..6ae8583 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java @@ -240,7 +240,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { BigDecimal planAmount = wmsRawOutstock.getOutstockAmount(); WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(instockBatch); if (wmsRawStock != null) { - BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? + BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null || + wmsRawStock.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount(); if (occupyAmount.compareTo(planAmount) >= 0) { wmsRawStock.setOccupyAmount(occupyAmount.subtract(planAmount)); @@ -306,27 +307,35 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { } } - String batchCode = baseBarcodeInfo.getBatchCode(); + WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode); + if (baseLocation == null) { + throw new ServiceException("库位码有误"); + } - //todo:后续判断outrequirement //判断是否有此出库任务,人工出库的同一个出库记录,同一个库位、同一个物料对应一个明细(agv的有可能是多个) - WmsRawOutstock queryRawOutstock = new WmsRawOutstock(); - queryRawOutstock.setLocationCode(locationCode); - queryRawOutstock.setInstockBatch(batchCode); - queryRawOutstock.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE + "," + WmsConstants.WMS_EXECUTE_STATUS_EXECUTING); - queryRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS); - queryRawOutstock.setRawOutstockId(rawOutstockId); + WmsRawOutstock wmsRawOutstock; + if (rawOutstockId != null) { + wmsRawOutstock = wmsRawOutstockMapper.selectWmsRawOutstockByRawOutstockId(rawOutstockId); + } else { + WmsRawOutstock queryRawOutstock = new WmsRawOutstock(); + queryRawOutstock.setWarehouseId(baseLocation.getWarehouseId()); + queryRawOutstock.setMaterialId(baseBarcodeInfo.getMaterialId()); + queryRawOutstock.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE + "," + WmsConstants.WMS_EXECUTE_STATUS_EXECUTING); + queryRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS); + queryRawOutstock.setRawOutstockId(rawOutstockId); + + List wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockList(queryRawOutstock); + if (wmsRawOutstocks == null || wmsRawOutstocks.isEmpty()) { + throw new ServiceException("无此出库任务"); + } - List wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockList(queryRawOutstock); - if (wmsRawOutstocks == null || wmsRawOutstocks.isEmpty()) { - throw new ServiceException("无此出库任务"); - } + if (wmsRawOutstocks.size() > 1) { + throw new ServiceException("请选择具体出库任务后点击确认"); + } - if (wmsRawOutstocks.size() > 1) { - throw new ServiceException("请选择具体出库任务后点击确认"); + wmsRawOutstock = wmsRawOutstocks.get(0); } - WmsRawOutstock wmsRawOutstock = wmsRawOutstocks.get(0); WmsRawOutstockDetail queryRawOutstockDetail = new WmsRawOutstockDetail(); queryRawOutstockDetail.setRawOutstockId(wmsRawOutstock.getRawOutstockId()); @@ -369,20 +378,22 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { wmsRawOutstock.setUpdateBy(userName); wmsRawOutstockMapper.updateWmsRawOutstock(wmsRawOutstock); - insertRawOutstockDetail(wmsRawOutstock, materialBarcode, batchCode, userName, currentDate); + insertRawOutstockDetail(wmsRawOutstock, locationCode, materialBarcode, baseBarcodeInfo.getBatchCode(), userName, currentDate); + + updateRawStock(materialBarcode, outstockAmount, userName, currentDate); - updateRawStock(locationCode, batchCode, outstockAmount, userName, currentDate); + //trigger中更新stocktotal的占用数量和库存数量 return 1; } - public void insertRawOutstockDetail(WmsRawOutstock wmsRawOutstock, String materialBarcode, String batchCode, + public void insertRawOutstockDetail(WmsRawOutstock wmsRawOutstock, String locationCode, String materialBarcode, String batchCode, String userName, Date currentDate) { WmsRawOutstockDetail wmsRawOutstockDetail = new WmsRawOutstockDetail(); wmsRawOutstockDetail.setRawOutstockId(wmsRawOutstock.getRawOutstockId()); wmsRawOutstockDetail.setTaskCode(wmsRawOutstock.getTaskCode()); wmsRawOutstockDetail.setWarehouseId(wmsRawOutstock.getWarehouseId()); - wmsRawOutstockDetail.setLocationCode(wmsRawOutstock.getLocationCode()); + wmsRawOutstockDetail.setLocationCode(locationCode); wmsRawOutstockDetail.setMaterialId(wmsRawOutstock.getMaterialId()); wmsRawOutstockDetail.setMaterialBarcode(materialBarcode); wmsRawOutstockDetail.setInstockBatch(batchCode); @@ -398,15 +409,14 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { } - public void updateRawStock(String locationCode, String batchCode, BigDecimal outstockAmount, String userName, Date currentDate) { + public void updateRawStock(String materialBarcode, BigDecimal outstockAmount, String userName, Date currentDate) { //更新原材料库存占用数量和总数量 - //todo 批次码 - WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(batchCode); + WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(materialBarcode); if (wmsRawStock == null) { throw new ServiceException("没找到库存信息"); } else { BigDecimal totalAmount = wmsRawStock.getTotalAmount() == null ? BigDecimal.ZERO : wmsRawStock.getTotalAmount(); - BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount(); + BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null || wmsRawStock.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount(); BigDecimal updatedOccupyAmount = occupyAmount.subtract(outstockAmount); BigDecimal updatedTotalAmount = totalAmount.subtract(outstockAmount); updatedOccupyAmount = updatedOccupyAmount.compareTo(BigDecimal.ZERO) >= 0 ? updatedOccupyAmount : BigDecimal.ZERO; @@ -508,8 +518,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { Long stockTotalId = rawOutstockDetail.getStockTotalId(); WmsStockTotal wmsStockTotal = wmsStockTotalMapper.selectWmsStockTotalByStockTotalId(stockTotalId); BigDecimal totalAmount = wmsStockTotal.getTotalAmount(); - BigDecimal frozenAmount = wmsStockTotal.getFrozenAmount() == null ? BigDecimal.ZERO : wmsStockTotal.getFrozenAmount(); - BigDecimal occupyAmount = wmsStockTotal.getOccupyAmount() == null ? BigDecimal.ZERO : wmsStockTotal.getOccupyAmount(); + BigDecimal frozenAmount = wmsStockTotal.getFrozenAmount() == null || wmsStockTotal.getFrozenAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsStockTotal.getFrozenAmount(); + BigDecimal occupyAmount = wmsStockTotal.getOccupyAmount() == null || wmsStockTotal.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsStockTotal.getOccupyAmount(); BigDecimal availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount); BigDecimal planAmount = rawOutstockDetail.getPlanAmount() == null ? @@ -692,8 +702,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { String moveMaterialBarcode = ""; Long moveMaterialId = null; for (WmsRawStock wmsRawStock : rawStockList) { - BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount(); - BigDecimal frozenAmount = wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount(); + BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null || wmsRawStock.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount(); + BigDecimal frozenAmount = wmsRawStock.getFrozenAmount() == null || wmsRawStock.getFrozenAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount(); WmsBaseLocation wmsBaseLocation = baseLocationsMap.get(wmsRawStock.getLocationCode()); //先确认出库库位,可用数量>=1,库位状态是正常的 @@ -1042,8 +1052,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { queryRawStock.setWarehouseId(wmsConfig.getFourthFloorPalteWarehouseId()); List wmsRawStocks = wmsRawStockMapper.selectWmsRawStockList(queryRawStock); List availableRawStocks = wmsRawStocks.stream().filter(wmsRawStock -> - (wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount()) - .subtract(wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); + (wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null || wmsRawStock.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount()) + .subtract(wmsRawStock.getFrozenAmount() == null || wmsRawStock.getFrozenAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); if (availableRawStocks != null && !availableRawStocks.isEmpty()) { List returnMsg = availableRawStocks.stream().map(WmsRawStock::getLocationAndMaterial).collect(Collectors.toList()); return returnMsg.toString(); @@ -1058,8 +1068,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { querySafeRawStock.setWarehouseId(wmsConfig.getFourthFloorPalteWarehouseId()); List safeRawStocks = wmsRawStockMapper.selectWmsRawStockList(querySafeRawStock); List availableSafeRawStocks = safeRawStocks.stream().filter(wmsRawStock -> - (wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount()) - .subtract(wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); + (wmsRawStock.getTotalAmount().subtract(wmsRawStock.getOccupyAmount() == null || wmsRawStock.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount()) + .subtract(wmsRawStock.getFrozenAmount() == null || wmsRawStock.getFrozenAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount())).compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); if (availableSafeRawStocks != null && !availableSafeRawStocks.isEmpty()) { List returnMsg = availableSafeRawStocks.stream().map(WmsRawStock::getLocationAndMaterial).collect(Collectors.toList()); return returnMsg.toString(); @@ -1108,7 +1118,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { wmsRawOutstock.setApplyDate(currentDate); wmsRawOutstockMapper.insertWmsRawOutstock(wmsRawOutstock); - this.insertRawOutstockDetail(wmsRawOutstock, materialBarcode, batchCode, + this.insertRawOutstockDetail(wmsRawOutstock, locationCode,materialBarcode, batchCode, userName, currentDate); directOutstockUpdateRawStock(locationCode, materialBarcode, outstockAmount, userName, currentDate); diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawOutstockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawOutstockMapper.xml index 56b2694..bc12e18 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawOutstockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsRawOutstockMapper.xml @@ -281,13 +281,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select wro.raw_outstock_id as raw_outstock_detail_id, wro.task_code,wro.location_code,wro.material_batch as instock_batch,wro.outstock_amount as plan_amount,wro.real_outstock_amount as outstock_amount, wro.apply_by,wro.apply_date,wro.apply_reason,wro.audit_by,wro.audit_date,wro.audit_reason,wro.plan_code,wro.plan_detail_code,wro.audit_status,wro.task_type, wro.execute_status,wro.erp_status,wro.erp_amount, - mbmi.material_code,mbmi.material_name + mbmi.material_code,mbmi.material_name, + mbr.warehouse_name from wms_raw_outstock wro left join mes_base_material_info mbmi on wro.material_id = mbmi.material_id + left join wms_base_warehouse mbr on wro.warehouse_id = mbr.warehouse_id and wro.task_code = #{taskCode} and wro.audit_status = #{auditStatus} and wro.apply_by like concat('%', #{applyBy}, '%') + order by wro.raw_outstock_id desc diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsStockTotalMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsStockTotalMapper.xml index 093d6fd..881c31a 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsStockTotalMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsStockTotalMapper.xml @@ -142,6 +142,7 @@ from wms_stock_total wst left join mes_base_material_info mbmi on wst.material_id = mbmi.material_id + and wst.total_amount>0 and wst.warehouse_id = #{warehouseId} and wst.warehouse_floor = #{warehouseFloor} and wst.stock_type = #{stockType}