diff --git a/ant-design-vue-jeecg/src/api/api.js b/ant-design-vue-jeecg/src/api/api.js index 5b2b068..d01a395 100644 --- a/ant-design-vue-jeecg/src/api/api.js +++ b/ant-design-vue-jeecg/src/api/api.js @@ -151,6 +151,8 @@ export const autoCombination = (params) => postAction('/shipment/shipmentCombina export const autoShipment = (params) => postAction('/shipment/shipmentHeader/autoShipment', params); //自动预配盘出库 export const autoShipmentAdvice = (params) => postAction('/shipment/shipmentHeader/autoShipmentAdvice', params); +//备货 +export const stockUp = (params) => postAction('/shipment/shipmentHeader/stockUp', params); //平库路径指引 export const autoFlatShipmentAdvice = (params) => postAction('/shipment/shipmentHeader/autoFlatShipmentAdvice', params); //根据序列号扣减预配盘的库存 diff --git a/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue b/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue index b393881..b11c6a0 100644 --- a/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue +++ b/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue @@ -120,6 +120,7 @@ <div class="table-operator"> <a-button v-has="'shipmentHeader:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button> <a-button v-has="'shipmentHeader:mergeShipment'" @click="mergeShipment" type="primary">合并单据</a-button> + <a-button v-has="'shipmentHeader:stockUp'" @click="stockUp" type="primary">备货</a-button> <a-button v-has="'shipmentHeader:export'" type="primary" icon="download" @click="handleExportXls('出库单')">导出</a-button> <a-upload v-has="'shipmentHeader:import'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> <a-button type="primary" icon="import">导入</a-button> @@ -275,7 +276,7 @@ import {downFile, getAction} from '@/api/manage' import ShipmentDetailList from './ShipmentDetailList' import {initDictOptions, filterMultiDictText} from '@/components/dict/JDictSelectUtil' import '@/assets/less/TableExpand.less' -import {getCompanyList, backErpShipment, getZoneList, autoFlatShipmentAdvice} from '@/api/api' +import {getCompanyList, backErpShipment, getZoneList, autoFlatShipmentAdvice, stockUp} from '@/api/api' import {getShipmentTypeList} from '@/api/api' import {getCustomerList} from '@/api/api' import {autoCombination} from '@/api/api' @@ -712,6 +713,31 @@ export default { this.searchQuery(); }); }, + stockUp() { + if (this.selectedRowKeys.length <= 0) { + this.$message.warning('至少选择一条记录!') + return + } + var shipmentHeaderList = [] + for (var a = 0; a < this.selectedRowKeys.length; a++) { + if (this.selectionRows[a] != null && this.selectionRows[a].firstStatus == 0 && this.selectionRows[a].lastStatus == 0) { + shipmentHeaderList.push(this.selectionRows[a]) + } + } + if (shipmentHeaderList.length > 0) { + stockUp(shipmentHeaderList).then(res => { + this.loading = false + if (res.success) { + this.$message.success(res.message) + this.searchQuery() + } else { + this.$message.error(res.message) + } + }) + } else { + this.$message.error("至少选择两条符合条件的记录!") + } + }, autoFlatShipmentAdvice(record) { this.loading = true; autoFlatShipmentAdvice(record).then((res) => { diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/IHuahengMultiHandlerService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/IHuahengMultiHandlerService.java index e3f4824..2e65704 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/IHuahengMultiHandlerService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/IHuahengMultiHandlerService.java @@ -46,6 +46,8 @@ public interface IHuahengMultiHandlerService { Result autoFlatShipmentAdvice(String shipmentCode, String warehouseCode); + Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode); + Result autoShipment(String shipmentCode, String warehouseCode); Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/impl/HuahengMultiHandlerServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/impl/HuahengMultiHandlerServiceImpl.java index 99f356d..3f2da6c 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/impl/HuahengMultiHandlerServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/impl/HuahengMultiHandlerServiceImpl.java @@ -408,6 +408,18 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem } @Override + public Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode) { + Result result = handleMultiProcess("stockUp", new MultiProcessListener() { + @Override + public Result<?> doProcess() { + Result result = shipmentHeaderService.stockUp(shipmentHeaderList, warehouseCode); + return result; + } + }); + return result; + } + + @Override public Result autoShipment(String shipmentCode, String warehouseCode) { Result result = handleMultiProcess("combination", new MultiProcessListener() { @Override diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java index 949157a..dd8a274 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java @@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -124,6 +125,7 @@ public class InventoryDetail implements Serializable { /** 入库日期 */ @Excel(name = "入库日期", width = 15) @ApiModelProperty(value = "入库日期") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") private Date receiptDate; /** 库龄(天) */ @Excel(name = "库龄(天)", width = 15) diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java index 636c25c..9c22e95 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import java.util.List; import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.wms.config.location.entity.Location; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; import org.jeecg.modules.wms.shipment.shipmentCombination.entity.FlatShipment; @@ -11,6 +12,7 @@ import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.entity.ShipmentCon import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; /** * @author 游杰 @@ -29,6 +31,8 @@ public interface IShipmentCombinationService { Result autoCombination(String shipmentCode, boolean advice, String warehouseCode); + Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode); + Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, int forceTaskType, String warehouseCode); @@ -50,6 +54,10 @@ public interface IShipmentCombinationService { Result autoCombinationDetail(ShipmentDetail shipmentDetail, boolean advice, BigDecimal shipQty); + Result stockUp(ShipmentDetail shipmentDetail); + + Result stockUpMove(Location location); + ShipmentContainerHeader addShipmentContainerHeader(InventoryDetail inventoryDetail, ShipmentDetail shipmentDetail); ShipmentContainerDetail addShipmentContainerDetail(ShipmentContainerHeader shipmentContainerHeader, CombinationModel combinationModel); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java index 73bfb56..abb37b2 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java @@ -299,6 +299,58 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi @Override @Transactional(rollbackFor = Exception.class) + public Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode) { + log.info("备货,单号" + shipmentHeaderList); + List<String> shipmentCodeList = shipmentHeaderList.stream().map(ShipmentHeader::getCode).collect(Collectors.toList()); + for (ShipmentHeader shipmentHeader : shipmentHeaderList) { + if (shipmentHeader == null) { + return Result.error("备货, 系统没有此单据"); + } + if (shipmentHeader.getLastStatus() >= QuantityConstant.SHIPMENT_HEADER_COMPLETED) { + return Result.OK("备货,出库单已经作业完毕"); + } + } + LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); + shipmentDetailLambdaQueryWrapper.in(ShipmentDetail::getShipmentCode, shipmentCodeList).eq(ShipmentDetail::getWarehouseCode, warehouseCode); + List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(shipmentDetailLambdaQueryWrapper); + if (shipmentDetailList.isEmpty()) { + return Result.error("备货, 出库单没有明细", null); + } + boolean over = true; + for (int i = 0; i < shipmentDetailList.size() - 1; i++) { + for (int j = shipmentDetailList.size() - 1; j > i; j--) { + ShipmentDetail shipmentDetail1 = shipmentDetailList.get(i); + ShipmentDetail shipmentDetail2 = shipmentDetailList.get(j); + if (shipmentDetail1.getMaterialCode().equals(shipmentDetail2.getMaterialCode()) && shipmentDetail1.getBatch().equals(shipmentDetail2.getBatch()) + && shipmentDetail1.getLot().equals(shipmentDetail2.getLot()) && shipmentDetail1.getProject().equals(shipmentDetail2.getProject()) + && shipmentDetail1.getInventoryStatus().equals(shipmentDetail2.getInventoryStatus())) { + BigDecimal totalQty = shipmentDetail1.getQty().add(shipmentDetail2.getQty()); + shipmentDetail1.setQty(totalQty); + ShipmentDetail shipmentDetail = new ShipmentDetail(); + shipmentDetail.setId(shipmentDetail1.getId()); + shipmentDetail.setQty(totalQty); + shipmentDetailList.remove(j); + } + } + } + for (ShipmentDetail shipmentDetail : shipmentDetailList) { + if (shipmentDetail.getTaskQty().compareTo(shipmentDetail.getQty()) < 0) { + over = false; + } + Result result = shipmentCombinationService.stockUp(shipmentDetail); + if (!result.isSuccess()) { + throw new JeecgBootException(result.getMessage()); + } + } + log.info("备货完成,单号" + shipmentHeaderList); + if (over) { + return Result.error("出库单已经备货"); + } + return Result.OK("备货完成"); + } + + @Override + @Transactional(rollbackFor = Exception.class) public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber) { return shipmentCombinationService.createShipmentTask(shipmentContainerHeader, 0, warehouseCode, shipmentOrder, sequence, sequenceNumber); } @@ -403,6 +455,107 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi @Override @Transactional(rollbackFor = Exception.class) + public Result stockUp(ShipmentDetail shipmentDetail) { + // 出库数量 + BigDecimal shipmentQty = shipmentDetail.getQty().subtract(shipmentDetail.getTaskQty()); + // 判断是否还有需要出库的物料,如果没有就跳过该物料 + if (shipmentQty.compareTo(BigDecimal.ZERO) <= 0) { + return Result.OK("备货, 出库数量必须大于0"); + } + List<InventoryDetail> inventoryList = shipmentCombinationService.getInventorys(shipmentDetail); + // 去除已锁的库存 + ArrayList<InventoryDetail> removeInventoryList = new ArrayList<>(); + List<ReceiptContainerHeader> receiptContainerHeaderList = receiptContainerHeaderService.getUnCompleteCombineList(); + List<ShipmentContainerHeader> shipmentContainerHeaderList = shipmentContainerHeaderService.getNotCombineList(); + for (InventoryDetail inventoryDetail : inventoryList) { + String containerCode = inventoryDetail.getContainerCode(); + String warehouseCode = inventoryDetail.getWarehouseCode(); + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if (container == null) { + return Result.error("备货,没有找到容器:" + containerCode); + } + if (container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { + removeInventoryList.add(inventoryDetail); + continue; + } + for (ReceiptContainerHeader receiptContainerHeader : receiptContainerHeaderList) { + if (receiptContainerHeader.getContainerCode().equals(containerCode)) { + removeInventoryList.add(inventoryDetail); + continue; + } + } + for (ShipmentContainerHeader shipmentContainerHeader : shipmentContainerHeaderList) { + if (shipmentContainerHeader.getContainerCode().equals(containerCode)) { + removeInventoryList.add(inventoryDetail); + continue; + } + } + } + inventoryList.removeAll(removeInventoryList); + if (inventoryList.size() < 1) { + return Result.error("备货," + shipmentDetail.getMaterialName() + "没有符合出库条件的库存"); + } + + for (InventoryDetail inventoryDetail : inventoryList) { + BigDecimal inventoryQty = inventoryDetail.getQty().subtract(inventoryDetail.getTaskQty()); + if (inventoryQty.compareTo(BigDecimal.ZERO) == 0) { + continue; + } + // 判断需要配盘数量是否等于0,等于0代表配盘完毕,完毕就退出内循环 + if (shipmentQty.compareTo(BigDecimal.ZERO) == 0) { + break; + } + if (shipmentQty.compareTo(BigDecimal.ZERO) < 0) { + throw new JeecgBootException("备货,出库数量不能小于0"); + } + if (inventoryQty.compareTo(shipmentQty) >= 0) { + shipmentQty = BigDecimal.ZERO; + } else { + shipmentQty = shipmentQty.subtract(inventoryQty); + } + String locationCode = inventoryDetail.getLocationCode(); + Location location = locationService.getLocationByCode(locationCode, inventoryDetail.getWarehouseCode()); + Result result = shipmentCombinationService.stockUpMove(location); + if (!result.isSuccess()) { + throw new JeecgBootException("备货失败" + result.getMessage()); + } + } + return Result.OK("备货成功"); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result stockUpMove(Location fromLocation) { + int rowFlag = fromLocation.getRowFlag(); + Location insideLocation = locationService.getInsideNear(fromLocation); + if (insideLocation == null) { + return Result.ok("备货移库, 分配库位时" + fromLocation + "没有找到对应的内侧库位"); + } + String insideLocationCode = insideLocation.getCode(); + String warehouseCode = insideLocation.getWarehouseCode(); + if (rowFlag == QuantityConstant.ROW_OUT) { + // 如果对应内侧库位有托盘 + if (StringUtils.isNotEmpty(insideLocation.getContainerCode())) { + // 如果对应内侧库位有托盘数据,那么不可能会有入库类型的任务,因为正在执行的入库类型的任务 库位是不会有托盘数据的。 + TaskHeader unCompleteTaskHeader = taskHeaderService.getUnCompleteTaskByFromLocationCode(insideLocationCode, warehouseCode); + if (unCompleteTaskHeader == null) { + // 找空闲库位,优先找外侧空闲库位,作为移库目的地 + Location destinationLocation = locationService.getEmptyLocation(insideLocation); + if (destinationLocation == null) { + return Result.error("备货移库, 移库没有剩余库位"); + } + Result<TaskHeader> result = taskHeaderService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode(), warehouseCode); + if (!result.isSuccess()) { + throw new JeecgBootException("备货移库," + result.getMessage()); + } + } + } + } + return Result.ok("备货移库成功"); + } + + @Override + @Transactional(rollbackFor = Exception.class) @OperationLog(bizId = "''", bizType = "'出库单追踪'", tag = "'详情配盘'", extra = "#extraJsonString", msg = "''", recordReturnValue = true) public Result combination(CombinationModel combinationModel) { BigDecimal shipmentQty = combinationModel.getShipQty(); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java index 4ee99e0..c8a6345 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java @@ -471,6 +471,16 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS return result; } + @AutoLog(value = "备货") + @ApiOperation(value = "备货", notes = "备货") + @PostMapping("/stockUp") + @ResponseBody + public Result stockUp(@RequestBody List<ShipmentHeader> shipmentHeaderList, HttpServletRequest req) { + String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); + Result result = huahengMultiHandlerService.stockUp(shipmentHeaderList, warehouseCode); + return result; + } + /** * 获取出库单物料库存信息 * @return diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentDetailService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentDetailService.java index 35a9332..b603d05 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentDetailService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentDetailService.java @@ -4,7 +4,6 @@ import java.math.BigDecimal; import java.util.List; import org.jeecg.common.api.vo.Result; -import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; import com.baomidou.mybatisplus.extension.service.IService; @@ -23,6 +22,8 @@ public interface IShipmentDetailService extends IService<ShipmentDetail> { public List<ShipmentDetail> getShipmentDetailListByShipmentId(Integer id); + List<ShipmentDetail> getShipmentDetailListByShipmentCode(String code); + boolean batchSave(List<ShipmentDetail> shipmentDetailList); boolean updateTaskQtyAndStatusById(BigDecimal taskQty, int status, int id); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentHeaderService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentHeaderService.java index e2efba9..625b904 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentHeaderService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentHeaderService.java @@ -54,6 +54,8 @@ public interface IShipmentHeaderService extends IService<ShipmentHeader> { Result autoFlatShipmentAdvice(String shipmentCode, String warehouseCode); + Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode); + Result createShipment(WaveConfig waveConfig, List<WaveConfigDetail> waveConfigDetailList); Result updateShipmentHeader(ShipmentDetail shipmentDetail); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java index caa3921..cb385fa 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java @@ -117,6 +117,14 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, } @Override + public List<ShipmentDetail> getShipmentDetailListByShipmentCode(String code) { + LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); + shipmentDetailLambdaQueryWrapper.eq(ShipmentDetail::getShipmentCode, code); + List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(shipmentDetailLambdaQueryWrapper); + return shipmentDetailList; + } + + @Override public boolean batchSave(List<ShipmentDetail> shipmentDetailList) { return this.saveBatch(shipmentDetailList); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java index 2157734..6d1c974 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java @@ -496,7 +496,7 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, if (shipmentContainerHeader == null) { throw new JeecgBootException("自动出库, 没有找到出库表头:" + shipmentContainerId); } - if (shipmentContainerHeader.getStatus().intValue() == QuantityConstant.SHIPMENT_CONTAINER_FINISHED) { + if (shipmentContainerHeader.getStatus().intValue() > QuantityConstant.SHIPMENT_CONTAINER_BUILD) { continue; } int taskType = shipmentContainerHeader.getTaskType(); @@ -690,6 +690,44 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, @Override @Transactional(rollbackFor = Exception.class) + public Result stockUp(List<ShipmentHeader> shipmentHeaderList, String warehouseCode) { + for (ShipmentHeader shipmentHeader : shipmentHeaderList) { + if (shipmentHeader == null) { + throw new JeecgBootException("备货, 没有找到出库单"); + } + String shipmentCode = shipmentHeader.getCode(); + if (StringUtils.isEmpty(shipmentCode)) { + return Result.error("备货, 出库单编码为空"); + } + if (StringUtils.isEmpty(warehouseCode)) { + return Result.error("备货, 仓库编码为空"); + } + String zoneCode = shipmentHeader.getZoneCode(); + if (StringUtils.isEmpty(zoneCode)) { + throw new JeecgBootException("备货, 库区编码为空"); + } + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); + if (zone == null) { + throw new JeecgBootException("备货, 库区为空"); + } + String zoneType = zone.getType(); + if (StringUtils.isEmpty(zoneType)) { + throw new JeecgBootException("备货, 库区类型编码为空"); + } + if (!zoneType.equals(QuantityConstant.ZONE_TYPE_STEREOSCOPIC)) { + throw new JeecgBootException("备货, 库区类型必须为立库区类型"); + } + } + Result result = shipmentCombinationService.stockUp(shipmentHeaderList, warehouseCode); + if (!result.isSuccess()) { + throw new JeecgBootException("备货," + result.getMessage()); + } + + return Result.OK("备货成功"); + } + + @Override + @Transactional(rollbackFor = Exception.class) public Result createShipment(WaveConfig waveConfig, List<WaveConfigDetail> waveConfigDetailList) { String zoneType = null; if (StringUtils.isNotEmpty(waveConfig.getZoneCode())) { diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java index 5d832a2..c502bf5 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java @@ -1918,7 +1918,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea @Transactional(rollbackFor = Exception.class) public boolean combineInventoryDetail(String containerCode, String warehouseCode) { boolean success = false; - InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); if (inventoryHeader == null) { throw new JeecgBootException("合并库存时, 没有找到库存头");