diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java index da95d7a..7211397 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java @@ -64,7 +64,7 @@ public class WmsApiController extends BaseController { // String ancestors = mesMaterialBom.getAncestors(); // ancestors = "0," + ancestors; // mesMaterialBom.setAncestors(ancestors); - List list = wmsStockTotalService.selectWmsStockTotalJoinList(queryStockTotal); + List list = wmsStockTotalService.selectWmsStockTotalJoinListBySaleOrder(queryStockTotal); return success(list); } 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 a1eba67..35ff6a8 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 @@ -94,7 +94,7 @@ public class WmsMobileController extends BaseController { /** * 新增原材料入库记录(原材料人工入库) */ - @RequiresPermissions("wms:mobile:addrawinstock") +// @RequiresPermissions("wms:mobile:addrawinstock") @Log(title = "原材料入库记录", businessType = BusinessType.INSERT) @PostMapping(("/addRawInstock")) public AjaxResult addRawInstock(@Validated @RequestBody WmsRawInstockVo wmsRawInstockVo) { diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawOutstock.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawOutstock.java index 32f5669..f900cf6 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawOutstock.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawOutstock.java @@ -206,6 +206,8 @@ public class WmsRawOutstock extends BaseEntity { private String materialBarcode; + private Long saleOrderId; + /** * 原材料出库记录明细信息 */ @@ -515,6 +517,14 @@ public class WmsRawOutstock extends BaseEntity { this.materialBarcode = materialBarcode; } + public Long getSaleOrderId() { + return saleOrderId; + } + + public void setSaleOrderId(Long saleOrderId) { + this.saleOrderId = saleOrderId; + } + @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/WmsRawOutstockDetail.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawOutstockDetail.java index 6c49f3a..0f82939 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawOutstockDetail.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsRawOutstockDetail.java @@ -158,6 +158,11 @@ public class WmsRawOutstockDetail extends BaseEntity { private String auditStatus; private String palletInfoCode; + + /**仓库总库存信息ID*/ + private Long stockTotalId; + + public void setRawOutstockDetailId(Long rawOutstockDetailId) { this.rawOutstockDetailId = rawOutstockDetailId; } @@ -390,6 +395,14 @@ public class WmsRawOutstockDetail extends BaseEntity { this.palletInfoCode = palletInfoCode; } + public Long getStockTotalId() { + return stockTotalId; + } + + public void setStockTotalId(Long stockTotalId) { + this.stockTotalId = stockTotalId; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) @@ -414,6 +427,7 @@ public class WmsRawOutstockDetail extends BaseEntity { .append("updateBy", getUpdateBy()) .append("updateDate", getUpdateDate()) .append("stackAmount", getStackAmount()) + .append("stockTotalId", getStockTotalId()) .toString(); } } 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 26ffaa6..d64adde 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 @@ -41,6 +41,11 @@ public class WmsStockTotal extends BaseEntity @Excel(name = "物料ID") private Long materialId; + private Long saleOrderId; + + private String safeFlag; + + /** 物料编号 */ @Excel(name = "物料编号") private String materialCode; @@ -129,6 +134,23 @@ public class WmsStockTotal extends BaseEntity { return materialId; } + + public Long getSaleOrderId() { + return saleOrderId; + } + + public void setSaleOrderId(Long saleOrderId) { + this.saleOrderId = saleOrderId; + } + + public String getSafeFlag() { + return safeFlag; + } + + public void setSafeFlag(String safeFlag) { + this.safeFlag = safeFlag; + } + public void setTotalAmount(BigDecimal totalAmount) { this.totalAmount = totalAmount; diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsStockTotalMapper.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsStockTotalMapper.java index 9dfb033..2f9aaee 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsStockTotalMapper.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsStockTotalMapper.java @@ -65,11 +65,11 @@ public interface WmsStockTotalMapper /** - * 查询总库存列表 + * 查询总库存列表(根据销售订单查询库存,包含安全库存) * * @param wmsStockTotal 总库存 * @return 总库存集合 */ - public List selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal); + public List selectWmsStockTotalJoinListBySaleOrder(WmsStockTotal wmsStockTotal); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsStockTotalService.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsStockTotalService.java index 5e02a2e..f85ca43 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsStockTotalService.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsStockTotalService.java @@ -66,5 +66,5 @@ public interface IWmsStockTotalService * @param wmsStockTotal 总库存 * @return 总库存 */ - public List selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal); + public List selectWmsStockTotalJoinListBySaleOrder(WmsStockTotal wmsStockTotal); } 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 284d2a1..d393ced 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 @@ -52,6 +52,9 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { @Autowired private WmsBaseLocationMapper wmsBaseLocationMapper; + @Autowired + private WmsStockTotalMapper wmsStockTotalMapper; + @Autowired private WmsConfig wmsConfig; @@ -467,6 +470,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { * 申请领料 * 在申请领料时,不管是否需要审核,都需要锁定库位和修改占用数量(但审核不通过的话需要解锁库位和更新占用数量) * 申请时没有保存wms_raw_outstock_detail表,没有指定库位 + * * @param wmsRawOutstock 原材料出库记录 * @return 结果 */ @@ -476,8 +480,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { String planCode = wmsRawOutstock.getPlanCode(); String planDetailCode = wmsRawOutstock.getPlanDetailCode(); - if (StringUtils.isEmpty(planCode)) { - throw new ServiceException("请选择生产详细信息再领料"); + if (StringUtils.isEmpty(planCode) || StringUtils.isEmpty(planDetailCode)) { + throw new ServiceException("请选择计划明细信息再领料"); } Long warehouseId = wmsRawOutstock.getWarehouseId(); @@ -501,87 +505,40 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { String taskCode = Seq.getId(Seq.rawOutstockSeqType, Seq.rawOutstockSeqCode); //传入的申请领料list遍历 rawOutstockDetails.forEach(rawOutstockDetail -> { + 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 availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount); + BigDecimal planAmount = rawOutstockDetail.getPlanAmount() == null ? BigDecimal.ZERO : rawOutstockDetail.getPlanAmount();//申请数量 - Long materialId = rawOutstockDetail.getMaterialId(); + if (planAmount.compareTo(BigDecimal.ZERO) > 0) { - BigDecimal realRawStock = BigDecimal.ZERO;//实际库存总量 - WmsRawStock queryRawStock = new WmsRawStock(); - queryRawStock.setWarehouseId(warehouseId); - queryRawStock.setMaterialId(materialId); - queryRawStock.setCompleteFlag(WmsConstants.WMS_RAW_STOCK_COMPLETE_FLAY_YES); -// queryRawStock.setQualityStatus(queryQualityStatus);//todo:先不过滤质检状态 - //TODO:需要先查看wms_raw_stock_occupy,是否有此生产订单的占用明细,有的话需要计算并且更新 - //判断库位和可用数量(总数量减冻结数量和占用数量),按先进先出(按入库时间排序获取) - List wmsRawStocks = wmsRawStockMapper.selectWmsRawStocks4Apply(queryRawStock); - if (wmsRawStocks != null && !wmsRawStocks.isEmpty()) { - for (WmsRawStock wmsRawStock : wmsRawStocks) { - BigDecimal totalAmount = wmsRawStock.getTotalAmount(); - BigDecimal frozenAmount = wmsRawStock.getFrozenAmount() == null ? BigDecimal.ZERO : wmsRawStock.getFrozenAmount(); - BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount(); - BigDecimal availableAmount = totalAmount.subtract(frozenAmount).subtract(occupyAmount); - realRawStock = realRawStock.add(availableAmount); - //可出库数量大于0 - if (availableAmount.compareTo(BigDecimal.ZERO) > 0) { - //如果申请数量大于此库位可出库的数量则继续进行下一库位判断 - if (planAmount.compareTo(availableAmount) > 0) { - //占用数量更改 - wmsRawStock.setOccupyAmount(occupyAmount.add(availableAmount)); - wmsRawStock.setUpdateDate(currentDate); - wmsRawStock.setUpdateBy(userName); - //如果同一个物料有多条记录的处理(最好避免前端可以传多条同一个物料的申请), - //提前更新(主要是更新数量等信息,避免在下一次判断中还使用上次的数量),放在事务中 - wmsRawStockMapper.updateWmsRawStock(wmsRawStock); - - //原材料出库记录(有break,以下方法需要写在此处) - WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode, taskType, - planAmount, currentDate, userName); - toInsertedRawOutstocks.add(toInsertedRawOutstock); - - planAmount = planAmount.subtract(availableAmount); - } else if (planAmount.compareTo(availableAmount) == 0) {//计划数量等于可出库数量 - //占用数量更改 - wmsRawStock.setOccupyAmount(occupyAmount.add(availableAmount)); - wmsRawStock.setUpdateDate(currentDate); - wmsRawStock.setUpdateBy(userName); - //如果同一个物料有多条记录的处理,提前更新(主要是更新数量等信息,避免在下一次判断中还使用上次的数量),放在事务中 - wmsRawStockMapper.updateWmsRawStock(wmsRawStock); - - //原材料出库记录(有break,以下方法需要写在此处) - WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode, taskType, - planAmount, currentDate, userName); - toInsertedRawOutstocks.add(toInsertedRawOutstock); - - planAmount = BigDecimal.ZERO; - break; - } else if (planAmount.compareTo(availableAmount) < 0) { - //占用数量更改 - wmsRawStock.setOccupyAmount(occupyAmount.add(planAmount)); - wmsRawStock.setUpdateDate(currentDate); - wmsRawStock.setUpdateBy(userName); - //如果同一个物料有多条记录的处理,提前更新(主要是更新数量等信息,避免在下一次判断中还使用上次的数量),放在事务中 - wmsRawStockMapper.updateWmsRawStock(wmsRawStock); - - //原材料出库记录(有break,以下方法需要写在此处) - WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(wmsRawStock, baseWarehouse, planCode, planDetailCode, materialId, taskCode, taskType, - planAmount, currentDate, userName); - toInsertedRawOutstocks.add(toInsertedRawOutstock); - - planAmount = BigDecimal.ZERO; - break; - } - } - } + //可出库数量大于0 + if (planAmount.compareTo(availableAmount) <= 0) { + //占用数量更改 + wmsStockTotal.setOccupyAmount(occupyAmount.add(availableAmount)); + wmsStockTotal.setUpdateDate(currentDate); + wmsStockTotal.setUpdateBy(userName); + wmsStockTotalMapper.updateWmsStockTotal(wmsStockTotal); + + WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(baseWarehouse, planCode, planDetailCode, + rawOutstockDetail.getMaterialId(), taskCode, taskType, wmsRawOutstock.getApplyReason(), + planAmount, currentDate, userName); + toInsertedRawOutstocks.add(toInsertedRawOutstock); + + } else { + throw new ServiceException("物料[" + rawOutstockDetail.getMaterialName() + "]库存不够,申请数量不能大于" + availableAmount); } - //以上将申请的数量跟库存数量比对,如果库存数量足够则planAmount减去库存会=0,如果不够则剩余的planAmount会>0 - if (planAmount.compareTo(BigDecimal.ZERO) > 0) { - throw new ServiceException("物料名称为[" + rawOutstockDetail.getMaterialName() + "]库存不足,只有" + realRawStock); - } } }); - wmsRawOutstockMapper.batchWmsRawOutstock(toInsertedRawOutstocks); + if (!toInsertedRawOutstocks.isEmpty()) { + wmsRawOutstockMapper.batchWmsRawOutstock(toInsertedRawOutstocks); + } return 1; } @@ -590,7 +547,6 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { /** * 获取待保存的原材料出库记录 * - * @param wmsRawStock * @param baseWarehouse * @param planCode * @param planDetailCode @@ -601,8 +557,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { * @param userName * @return */ - private WmsRawOutstock getWmsRawOutstock(WmsRawStock wmsRawStock, WmsBaseWarehouse baseWarehouse, - String planCode, String planDetailCode, Long materialId, String taskCode, String taskType, + private WmsRawOutstock getWmsRawOutstock(WmsBaseWarehouse baseWarehouse, + String planCode, String planDetailCode, Long materialId, String taskCode, String taskType,String applyReason, BigDecimal planAmount, Date currentDate, String userName) { //出库要求 (0申请出库,1申请审核出库,2直接出库) String outRequirement = baseWarehouse.getOutRequirement(); @@ -624,19 +580,20 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { } toInsertedRawOutstock.setTaskCode(taskCode); - toInsertedRawOutstock.setWarehouseId(wmsRawStock.getWarehouseId()); - toInsertedRawOutstock.setLocationCode(wmsRawStock.getLocationCode()); + toInsertedRawOutstock.setWarehouseId(baseWarehouse.getWarehouseId()); +// toInsertedRawOutstock.setLocationCode(wmsRawStock.getLocationCode()); toInsertedRawOutstock.setStationId(SecurityUtils.getStationId()); - toInsertedRawOutstock.setPalletInfoCode(wmsRawStock.getPalletInfoCode()); +// toInsertedRawOutstock.setPalletInfoCode(wmsRawStock.getPalletInfoCode()); toInsertedRawOutstock.setOperationType(operationType); toInsertedRawOutstock.setApplyBy(userName); + toInsertedRawOutstock.setApplyReason(applyReason); toInsertedRawOutstock.setApplyDate(currentDate); toInsertedRawOutstock.setEndStationCode(SecurityUtils.getStationCode()); toInsertedRawOutstock.setMaterialId(materialId); toInsertedRawOutstock.setOutstockAmount(planAmount); toInsertedRawOutstock.setPlanCode(planCode); toInsertedRawOutstock.setPlanDetailCode(planDetailCode); - toInsertedRawOutstock.setMaterialBatch(wmsRawStock.getInstockBatch()); +// toInsertedRawOutstock.setMaterialBatch(wmsRawStock.getInstockBatch()); toInsertedRawOutstock.setTaskType(taskType); toInsertedRawOutstock.setCreateTime(currentDate); toInsertedRawOutstock.setCreateBy(userName); @@ -833,7 +790,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { } - private WmsRawOutstock agvRawOutstock(WmsAgvRawOutstockVo wmsAgvRawOutstockVo, WmsBaseLocation oriBaseLocation, String moveMaterialBarcode, Long moveMaterialId, + private WmsRawOutstock agvRawOutstock(WmsAgvRawOutstockVo wmsAgvRawOutstockVo, WmsBaseLocation + oriBaseLocation, String moveMaterialBarcode, Long moveMaterialId, String taskType, String userName, Date currentDate) { WmsRawOutstock rawOutstock = new WmsRawOutstock(); rawOutstock.setWarehouseId(oriBaseLocation.getWarehouseId()); @@ -863,7 +821,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { } - private WmsRawInstock agvRawInstock(WmsAgvRawOutstockVo wmsAgvRawOutstockVo, WmsBaseLocation targetBaseLocation, String moveMaterialBarcode, Long moveMaterialId, + private WmsRawInstock agvRawInstock(WmsAgvRawOutstockVo wmsAgvRawOutstockVo, WmsBaseLocation + targetBaseLocation, String moveMaterialBarcode, Long moveMaterialId, String userName, Date currentDate) { WmsRawInstock rawInstock = new WmsRawInstock(); rawInstock.setWarehouseId(wmsAgvRawOutstockVo.getWarehouseId()); diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java index cbfba70..2246619 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java @@ -98,16 +98,15 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService /** - * 查询总库存列表,Join material + * (根据销售订单查询库存,包含安全库存),Join material * * @param wmsStockTotal 总库存 * @return 总库存 */ @Override - public List selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal) + public List selectWmsStockTotalJoinListBySaleOrder(WmsStockTotal wmsStockTotal) { - //todo:还需要计算锁库的数量 - return wmsStockTotalMapper.selectWmsStockTotalJoinList(wmsStockTotal); + return wmsStockTotalMapper.selectWmsStockTotalJoinListBySaleOrder(wmsStockTotal); } } 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 17c4b78..56b2694 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 @@ -291,9 +291,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into wms_raw_outstock(raw_outstock_id, task_code,warehouse_id,location_code,order_id,plan_code,plan_detail_code,station_id,material_id,material_batch,pallet_info_code,outstock_amount,end_station_code,operation_type,task_type,audit_status,execute_status,apply_by,apply_date) values + insert into wms_raw_outstock(raw_outstock_id, task_code,warehouse_id,location_code,order_id,plan_code,plan_detail_code,station_id,material_id,material_batch,pallet_info_code,outstock_amount,end_station_code,operation_type,task_type,audit_status,execute_status,apply_by,apply_date,apply_reason) values - ( #{item.rawOutstockId}, #{item.taskCode}, #{item.warehouseId}, #{item.locationCode}, #{item.orderId}, #{item.planCode}, #{item.planDetailCode}, #{item.stationId}, #{item.materialId}, #{item.materialBatch}, #{item.palletInfoCode}, #{item.outstockAmount}, #{item.endStationCode}, #{item.operationType}, #{item.taskType}, #{item.auditStatus}, #{item.executeStatus}, #{item.applyBy}, #{item.applyDate}) + ( #{item.rawOutstockId}, #{item.taskCode}, #{item.warehouseId}, #{item.locationCode}, #{item.orderId}, #{item.planCode}, #{item.planDetailCode}, #{item.stationId}, #{item.materialId}, #{item.materialBatch}, #{item.palletInfoCode}, #{item.outstockAmount}, #{item.endStationCode}, #{item.operationType}, #{item.taskType}, #{item.auditStatus}, #{item.executeStatus}, #{item.applyBy}, #{item.applyDate}, #{item.applyReason}) 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 ed1fb8b..093d6fd 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 @@ -10,6 +10,8 @@ + + @@ -52,6 +54,8 @@ and wst.warehouse_floor = #{warehouseFloor} and wst.stock_type = #{stockType} and wst.material_id = #{materialId} + and wst.sale_order_id = #{saleOrderId} + and wst.safe_flag = #{safeFlag} and wst.total_amount = #{totalAmount} and wst.frozen_amount = #{frozenAmount} and wst.occupy_amount = #{occupyAmount} @@ -131,9 +135,9 @@ - select wst.stock_total_id, wst.warehouse_id, wst.warehouse_floor, wst.stock_type, wst.material_id, - wst.total_amount, wst.frozen_amount, wst.occupy_amount, + wst.total_amount, wst.frozen_amount, wst.occupy_amount,wst.safe_flag, mbmi.material_code,mbmi.material_name from wms_stock_total wst left join mes_base_material_info mbmi on wst.material_id = mbmi.material_id @@ -146,6 +150,8 @@ #{materialName}, '%') + and (wst.sale_order_id = #{saleOrderId} or wst.safe_flag='1') + and wst.safe_flag='1' diff --git a/hw-ui/src/views/board/fifthFloor/index.vue b/hw-ui/src/views/board/fifthFloor/index.vue index 479ad03..033cf47 100644 --- a/hw-ui/src/views/board/fifthFloor/index.vue +++ b/hw-ui/src/views/board/fifthFloor/index.vue @@ -286,6 +286,15 @@ prop="materialName" > + + + + { - this.form = val.data - this.form.materialId = e.materialId - this.form.materialName = e.materialName - this.form.planDetailStatus = setState(val.data.planDetailStatus) - }) - }, // 领柜体页面 getMaterials(returnFlag) { if (returnFlag == '1') { this.applyMaterialTitle = "领柜体"; - this.planAmount = 1; - this.planAmountDisabled = true; + this.planAmount = null; + this.maxPlanAmount = 1; this.taskType = '2';//拆分出库 } else { this.applyMaterialTitle = "领料"; this.planAmount = null; - this.planAmountDisabled = false; + this.maxPlanAmount = 1000000000; this.taskType='1';//生产领料 } @@ -1370,6 +1370,7 @@ export default { planId: this.form?.planId, planCode: this.form?.planCode, planDetailCode: this.form?.planDetailCode, + saleOrderId: this.form?.saleOrderId, applyReason: '', taskType: '1', wmsRawOutstockDetailList: [] @@ -1391,13 +1392,16 @@ export default { } getStockTotal({ warehouseId: this.form1.warehouseId, - materialName: val + materialName: val, + saleOrderId: this.form.saleOrderId, }).then(e => { this.form1.wmsRawOutstockDetailList = e.data.map(r => { return { + stockTotalId: r.stockTotalId, materialId: r.materialId, materialCode: r.materialCode, materialName: r.materialName, + safeFlag: r.safeFlag, availableAmount: r.totalAmount - r.occupyAmount - r.frozenAmount, unavailableAmount: r.occupyAmount + r.frozenAmount, planAmount: this.planAmount diff --git a/hw-ui/src/views/board/firstFloor/index.vue b/hw-ui/src/views/board/firstFloor/index.vue index d2502e4..379b19a 100644 --- a/hw-ui/src/views/board/firstFloor/index.vue +++ b/hw-ui/src/views/board/firstFloor/index.vue @@ -341,6 +341,14 @@ prop="materialName" > + + + { this.tableData1 = res.rows this.totalNum3 = Math.ceil(res.total / 5) @@ -802,6 +811,7 @@ export default { this.planId = e.row.planId this.materialBomId = e.row.materialBomId this.nowMaterial = e.row.materialName + this.saleOrderId = e.row.saleOrderId this.nowNum3 = 1 await getProductPlanDetails({pageNum: 1, pageSize: 5, planId: e.row.planId}).then(res => { if (res.rows.length === 0) { @@ -871,6 +881,7 @@ export default { planId: val.row.planId, planCode: val.row.planCode, planDetailCode: val.row.planDetailCode, + saleOrderId : this.saleOrderId, applyReason: '', taskType: '1', wmsRawOutstockDetailList: [] @@ -900,13 +911,16 @@ export default { searchMaterial(val) { getStockTotal({ warehouseId: this.form.warehouseId, + saleOrderId: this.saleOrderId, materialName: val }).then(e => { this.form.wmsRawOutstockDetailList = e.data.map(r => { return { + stockTotalId: r.stockTotalId, materialId: r.materialId, materialCode: r.materialCode, materialName: r.materialName, + safeFlag: r.safeFlag, availableAmount: r.totalAmount - r.occupyAmount - r.frozenAmount, unavailableAmount: r.occupyAmount + r.frozenAmount, planAmount: r.planAmount