diff --git a/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue b/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue index 2106526..f63a6c8 100644 --- a/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue +++ b/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue @@ -216,11 +216,11 @@ export default { align: 'center', dataIndex: 'batch' }, - // { - // title: '序列号', - // align: "center", - // dataIndex: 'sn' - // }, + { + title: '序列号', + align: "center", + dataIndex: 'sn' + }, { title: '入库日期', align: 'center', diff --git a/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue b/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue index ea03104..56cc191 100644 --- a/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue +++ b/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue @@ -350,11 +350,11 @@ export default { align: 'center', dataIndex: 'batch' }, - // { - // title:'序列号', - // align:"center", - // dataIndex: 'sn' - // }, + { + title:'序列号', + align:"center", + dataIndex: 'sn' + }, { title: '入库日期', align: 'center', diff --git a/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerDetailList.vue b/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerDetailList.vue index 65b5b6a..326bfb6 100644 --- a/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerDetailList.vue +++ b/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerDetailList.vue @@ -219,6 +219,11 @@ export default { dataIndex: 'batch' }, { + title: '序列号', + align: "center", + dataIndex: 'sn' + }, + { title: '创建人', align: "center", dataIndex: 'createBy' diff --git a/ant-design-vue-jeecg/src/views/system/shipment/ShipmentContainerDetailList.vue b/ant-design-vue-jeecg/src/views/system/shipment/ShipmentContainerDetailList.vue index 12f8e2a..7ba133a 100644 --- a/ant-design-vue-jeecg/src/views/system/shipment/ShipmentContainerDetailList.vue +++ b/ant-design-vue-jeecg/src/views/system/shipment/ShipmentContainerDetailList.vue @@ -220,6 +220,11 @@ export default { dataIndex: 'batch' }, { + title: '序列号', + align: "center", + dataIndex: 'sn' + }, + { title: '创建人', align: "center", dataIndex: 'createBy' diff --git a/ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue b/ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue index 2b7c1cc..2e8debd 100644 --- a/ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue +++ b/ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue @@ -188,6 +188,11 @@ export default { dataIndex: 'batch' }, { + title: '序列号', + align: 'center', + dataIndex: 'sn' + }, + { title: '库存状态', align: 'center', dataIndex: 'inventoryStatus_dictText', diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/entity/MaterialInfo.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/entity/MaterialInfo.java index 8591eac..8d0a545 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/entity/MaterialInfo.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/entity/MaterialInfo.java @@ -28,6 +28,11 @@ public class MaterialInfo implements Comparable<MaterialInfo> { */ @ApiModelProperty(value = "顺序") private int sequence; + /** + * 序列号 + */ + @ApiModelProperty(value = "序列号") + private String sn; @Override public int compareTo(@NotNull MaterialInfo o) { diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/servuce/impl/MesServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/servuce/impl/MesServiceImpl.java index 7c394a4..cd6e5f8 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/servuce/impl/MesServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/servuce/impl/MesServiceImpl.java @@ -112,30 +112,28 @@ public class MesServiceImpl implements IMesService { if (receiptDetailList == null || receiptDetailList.size() == 0) { return Result.error("MES下发入库信息,没有找到匹配的入库单详情, 上游单号:" + referCode); } - for (ReceiptDetail receiptDetail : receiptDetailList) { - String materialCode = receiptDetail.getMaterialCode(); - BigDecimal taskQty = BigDecimal.ZERO; - boolean hav = false; - for (MaterialInfo materialInfo : materialInfoList) { + + for (MaterialInfo materialInfo : materialInfoList) { + for (ReceiptDetail receiptDetail : receiptDetailList) { + String materialCode = receiptDetail.getMaterialCode(); + BigDecimal taskQty = BigDecimal.ZERO; if (materialInfo.getMaterialCode().equals(materialCode)) { - hav = true; taskQty = materialInfo.getQty(); - break; + String sn = materialInfo.getSn(); + Receive receive = new Receive(); + receive.setId(receiptDetail.getId()); + receive.setContainerCode(containerCode); + receive.setMaterialCode(materialCode); + receive.setMaterialName(receiptDetail.getMaterialName()); + receive.setMaterialSpec(receiptDetail.getMaterialSpec()); + receive.setMaterialUnit(receiptDetail.getMaterialUnit()); + receive.setInventoryStatus(receiptDetail.getInventoryStatus()); + receive.setQty(receiptDetail.getQty()); + receive.setSn(sn); + receive.setTaskQty(taskQty); + receiveList.add(receive); } } - if (hav) { - Receive receive = new Receive(); - receive.setId(receiptDetail.getId()); - receive.setContainerCode(containerCode); - receive.setMaterialCode(materialCode); - receive.setMaterialName(receiptDetail.getMaterialName()); - receive.setMaterialSpec(receiptDetail.getMaterialSpec()); - receive.setMaterialUnit(receiptDetail.getMaterialUnit()); - receive.setInventoryStatus(receiptDetail.getInventoryStatus()); - receive.setQty(receiptDetail.getQty()); - receive.setTaskQty(taskQty); - receiveList.add(receive); - } } Result result = receiveService.receiving(receiveList, warehouseCode); if (!result.isSuccess()) { diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/tv/TvController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/tv/TvController.java index 0940874..f03cc42 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/tv/TvController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/tv/TvController.java @@ -1,14 +1,12 @@ package org.jeecg.modules.wms.api.tv; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.date.DateUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + import org.jeecg.common.api.vo.Result; import org.jeecg.modules.wms.api.mobile.entity.TvTaskVo; import org.jeecg.modules.wms.config.location.entity.Location; @@ -18,27 +16,29 @@ import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; +import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.entity.ShipmentContainerAdvice; +import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.service.IShipmentContainerAdviceService; import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService; import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail; import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; -import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService; -import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; import org.jeecg.modules.wms.task.taskHeader.service.impl.TaskDetailServiceImpl; import org.jeecg.modules.wms.task.taskHeader.service.impl.TaskHeaderServiceImpl; import org.jeecg.utils.StringUtils; import org.jeecg.utils.constant.QuantityConstant; -import org.jeecg.utils.support.PassApiAuthentication; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.util.*; -import java.util.stream.Collectors; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUtil; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; /** */ @@ -71,9 +71,11 @@ public class TvController { @Resource private IInventoryDetailService inventoryDetailService; + @Resource + private IShipmentContainerAdviceService shipmentContainerAdviceService; @GetMapping("taskOfStation") - public Result<List<TvTaskVo>> importExcel(String code, HttpServletResponse response) { + public Result<List<TvTaskVo>> taskOfStation(String code, HttpServletResponse response) { addResponseHeader(response, QuantityConstant.TV_VERSION); List<String> stationList = new ArrayList<>(); @@ -103,8 +105,7 @@ public class TvController { statusMap.put("100", "任务完成"); LambdaQueryWrapper<TaskHeader> hQuery = Wrappers.lambdaQuery(); - hQuery.eq(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_ARRIVED_STATION) - .in(stationList.size() > 0, TaskHeader::getToPortCode, stationList); + hQuery.eq(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_ARRIVED_STATION).in(stationList.size() > 0, TaskHeader::getToPortCode, stationList); List<TaskHeader> headers = taskHeaderService.list(hQuery); List<TvTaskVo> list = new ArrayList<>(); @@ -128,12 +129,12 @@ public class TvController { * @param response * @param key */ - private void addResponseHeader(HttpServletResponse response, String key){ + private void addResponseHeader(HttpServletResponse response, String key) { try { String version = parameterConfigurationService.getValueByCode(key); response.setHeader(key, version); - response.setHeader("Access-Control-Expose-Headers",key); - }catch (Exception e){ + response.setHeader("Access-Control-Expose-Headers", key); + } catch (Exception e) { log.error("查找电视版本参数错误", e); } } @@ -287,13 +288,13 @@ public class TvController { long sumNum = sumLocationList.size(); long haveContainerNum = sumLocationList.stream().filter(l -> StringUtils.isNotEmpty(l.getContainerCode())).count(); long unHaveContainerNum = sumNum - haveContainerNum; - //巷道 + // 巷道 resultMap.put("roadWay", roadWay + "号巷道"); - //库位总数 + // 库位总数 resultMap.put("sumNum", String.valueOf(sumNum)); - //有托盘库位 + // 有托盘库位 resultMap.put("haveContainerNum", String.valueOf(haveContainerNum)); - //空闲库位 + // 空闲库位 resultMap.put("unHaveContainerNum", String.valueOf(unHaveContainerNum)); float usagerate = (Math.round(haveContainerNum / (float)sumNum * 100)) / 100f; resultMap.put("usagerate", (int)(usagerate * 100) + "%"); @@ -355,4 +356,53 @@ public class TvController { return Result.OK(result); } + @GetMapping("getAdviceByTv") + public Result getAdviceByTv(String code, HttpServletResponse response) { + + addResponseHeader(response, QuantityConstant.TV_VERSION); + List<String> stationList = new ArrayList<>(); + if (StringUtils.isNotEmpty(code)) { + stationList = Arrays.asList(code.split(",")); + } + + HashMap<String, String> typeMap = new HashMap<>(); + typeMap.put("100", "整盘入库"); + typeMap.put("200", "补充入库"); + typeMap.put("300", "整盘出库"); + typeMap.put("400", "分拣出库"); + typeMap.put("500", "空容器入库"); + typeMap.put("600", "空容器出库"); + typeMap.put("700", "盘点"); + typeMap.put("800", "移库"); + typeMap.put("900", "出库查看"); + typeMap.put("1000", "换站"); + typeMap.put("1100", "空托盘组入库"); + typeMap.put("1200", "空托盘组出库"); + typeMap.put("1300", "空托盘组换站"); + + HashMap<String, String> statusMap = new HashMap<>(); + statusMap.put("1", "生成任务"); + statusMap.put("10", "下发任务"); + statusMap.put("50", "到达拣选台"); + statusMap.put("100", "任务完成"); + + LambdaQueryWrapper<TaskHeader> hQuery = Wrappers.lambdaQuery(); + hQuery.eq(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_ARRIVED_STATION).in(stationList.size() > 0, TaskHeader::getToPortCode, stationList); + List<TaskHeader> taskHeaderList = taskHeaderService.list(hQuery); + + List<ShipmentContainerAdvice> shipmentContainerAdviceList = new ArrayList<>(); + for (TaskHeader taskHeader : taskHeaderList) { + if (taskHeader.getTaskType() == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) { + int shipmentContainerHeaderId = taskHeader.getShipmentContainerHeaderId(); + List<ShipmentContainerAdvice> shipmentContainerAdviceList1 = + shipmentContainerAdviceService.getShipmentContainerAdviceListByShipmentContainerId(shipmentContainerHeaderId); + if (CollectionUtils.isNotEmpty(shipmentContainerAdviceList1)) { + shipmentContainerAdviceList.addAll(shipmentContainerAdviceList1); + } + } + } + + return Result.OK(shipmentContainerAdviceList); + } + } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java index 8a070af..53cb4bd 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java @@ -280,9 +280,7 @@ public class WcsServiceImpl implements WcsService { } } if (taskType == QuantityConstant.TASK_TYPE_WHOLERECEIPT) { - if (!lockStationService.unlockStation(taskHeader.getToPortCode(), warehouseCode)) { - throw new JeecgBootException("分配库位,解锁站台失败:" + taskHeader.getToPortCode()); - } + lockStationService.unlockStation(taskHeader.getToPortCode(), warehouseCode); } taskHeader = new TaskHeader(); taskHeader.setId(Integer.parseInt(taskNo)); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java index 7cbe865..9bc451a 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java @@ -224,6 +224,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai taskDetail.setBatch(receiptContainerDetail.getBatch()); taskDetail.setLot(receiptContainerDetail.getLot()); taskDetail.setProject(receiptContainerDetail.getProject()); + taskDetail.setSn(receiptContainerDetail.getSn()); taskDetail.setReceiveTime(receiptContainerDetail.getReceiveTime()); taskDetailList.add(taskDetail); ReceiptDetail receiptDetail = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()); @@ -260,7 +261,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai throw new JeecgBootException("创建入库任务, 更新入库单明细失败"); } } - String value = parameterConfigurationService.getValueByCode(QuantityConstant.START_LOCKING_STATION,zoneCode); + String value = parameterConfigurationService.getValueByCode(QuantityConstant.START_LOCKING_STATION, zoneCode); if (StringUtils.isNotEmpty(value)) { int lockStation = Integer.parseInt(value); if (lockStation == QuantityConstant.START_LOCK_STATION) { 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 8edf6b9..d59c3a2 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 @@ -1202,6 +1202,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi if (shipmentContainerHeader == null) { return Result.error("生成出库任务时, 出库组盘头" + "未找到,操作中止"); } + shipmentContainerHeader = shipmentContainerHeaderService.getById(shipmentContainerHeader.getId()); if (shipmentContainerHeader.getStatus() >= QuantityConstant.SHIPMENT_CONTAINER_TASK) { return Result.error("生成出库任务时, 出库组盘头" + shipmentContainerHeader.getId() + "已经生成任务,请不要重复生成,操作中止"); } @@ -1245,10 +1246,6 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi } int taskType = QuantityConstant.TASK_TYPE_SORTINGSHIPMENT; String zoneCode = location.getZoneCode(); -// if (taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) { -// shipmentContainerHeader.setToLocationCode(fromLocationCode); -// } - shipmentContainerHeader.setTaskType(taskType); TaskHeader taskHeader = new TaskHeader(); taskHeader.setPreTaskNo(preTaskNo); taskHeader.setTaskType(taskType); @@ -1267,8 +1264,11 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi if (!success) { throw new JeecgBootException("生成出库任务时, 创建任务失败"); } - shipmentContainerHeader.setStatus(QuantityConstant.SHIPMENT_CONTAINER_TASK); - success = shipmentContainerHeaderService.updateById(shipmentContainerHeader); + ShipmentContainerHeader shipmentContainerHeader1 = new ShipmentContainerHeader(); + shipmentContainerHeader1.setId(shipmentContainerHeader.getId()); + shipmentContainerHeader1.setTaskType(taskType); + shipmentContainerHeader1.setStatus(QuantityConstant.SHIPMENT_CONTAINER_TASK); + success = shipmentContainerHeaderService.updateById(shipmentContainerHeader1); if (!success) { throw new JeecgBootException("生成出库任务时, 更新出库组盘头失败"); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerAdvice/service/IShipmentContainerAdviceService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerAdvice/service/IShipmentContainerAdviceService.java index f9b8422..644599f 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerAdvice/service/IShipmentContainerAdviceService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerAdvice/service/IShipmentContainerAdviceService.java @@ -3,6 +3,7 @@ package org.jeecg.modules.wms.shipment.shipmentContainerAdvice.service; import java.math.BigDecimal; import java.util.List; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.entity.ShipmentContainerAdvice; import com.baomidou.mybatisplus.extension.service.IService; @@ -17,5 +18,15 @@ public interface IShipmentContainerAdviceService extends IService<ShipmentContai boolean updateQtyById(BigDecimal qty, int id); + boolean updateStatusById(int status, int id); + + /** + * 取消配盘 + * @return + */ + Result cancelCombine(Integer id); + List<ShipmentContainerAdvice> getShipmentContainerAdviceListByShipmentCode(String shipmentCode, String warehouseCode); + + List<ShipmentContainerAdvice> getShipmentContainerAdviceListByShipmentContainerId(int shipmentContainerId); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerAdvice/service/impl/ShipmentContainerAdviceServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerAdvice/service/impl/ShipmentContainerAdviceServiceImpl.java index c5e6cb6..b03790f 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerAdvice/service/impl/ShipmentContainerAdviceServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerAdvice/service/impl/ShipmentContainerAdviceServiceImpl.java @@ -3,35 +3,136 @@ package org.jeecg.modules.wms.shipment.shipmentContainerAdvice.service.impl; import java.math.BigDecimal; import java.util.List; +import javax.annotation.Resource; + +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.entity.ShipmentContainerAdvice; import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.mapper.ShipmentContainerAdviceMapper; import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.service.IShipmentContainerAdviceService; +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerDetailService; +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService; +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService; +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; +import org.jeecg.utils.constant.QuantityConstant; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.monitor4all.logRecord.context.LogRecordContext; +import lombok.extern.slf4j.Slf4j; + /** * @Description: 出库预配盘 * @Author: jeecg-boot * @Date: 2023-11-16 * @Version: V1.0 */ +@Slf4j @Service public class ShipmentContainerAdviceServiceImpl extends ServiceImpl<ShipmentContainerAdviceMapper, ShipmentContainerAdvice> implements IShipmentContainerAdviceService { + @Resource + private IShipmentContainerHeaderService shipmentContainerHeaderService; + @Resource + private IShipmentContainerDetailService shipmentContainerDetailService; + @Resource + private IShipmentDetailService shipmentDetailService; + @Resource + private IShipmentHeaderService shipmentHeaderService; + @Resource + private IInventoryDetailService inventoryDetailService; + @Resource + private IShipmentContainerAdviceService shipmentContainerAdviceService; + @Override public boolean updateQtyById(BigDecimal qty, int id) { - return false; + ShipmentContainerAdvice shipmentContainerAdvice = new ShipmentContainerAdvice(); + shipmentContainerAdvice.setQty(qty); + shipmentContainerAdvice.setId(id); + boolean success = updateById(shipmentContainerAdvice); + return success; + } + + @Override + public boolean updateStatusById(int status, int id) { + ShipmentContainerAdvice shipmentContainerAdvice = new ShipmentContainerAdvice(); + shipmentContainerAdvice.setStatus(status); + shipmentContainerAdvice.setId(id); + boolean success = updateById(shipmentContainerAdvice); + return success; + } + + @Override + @Transactional(rollbackFor = JeecgBootException.class) + public Result cancelCombine(Integer id) { + log.info("开始取消预配盘,id:" + id); + ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(id); + if (shipmentContainerHeader == null) { + return Result.error("取消出库预配盘失败, 没有找到出库组盘头ID:" + id); + } + int status = shipmentContainerHeader.getStatus(); + if (status >= QuantityConstant.SHIPMENT_CONTAINER_TASK) { + return Result.error("取消出库预配盘失败,出库配盘状态是生成出库任务"); + } + List<ShipmentContainerAdvice> shipmentContainerAdviceList = shipmentContainerAdviceService.getShipmentContainerAdviceListByShipmentContainerId(id); + for (ShipmentContainerAdvice shipmentContainerAdvice : shipmentContainerAdviceList) { + ShipmentDetail shipmentDetail = shipmentDetailService.getById(shipmentContainerAdvice.getShipmentDetailId()); + if (shipmentDetail == null) { + throw new JeecgBootException("取消出库预配盘失败, 没有找到出库单,出库详情ID:" + shipmentContainerAdvice.getShipmentDetailId()); + } + shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_BUILD); + BigDecimal taskQty = shipmentDetail.getTaskQty().subtract(shipmentContainerAdvice.getQty()); + shipmentDetail.setTaskQty(taskQty); + if (!shipmentDetailService.updateTaskQtyAndStatusById(taskQty, QuantityConstant.SHIPMENT_HEADER_BUILD, shipmentDetail.getId())) { + throw new JeecgBootException("取消出库预配盘失败, 更新出库明细失败,出库详情ID:" + shipmentContainerAdvice.getShipmentDetailId()); + } + if (!shipmentContainerAdviceService.removeById(shipmentContainerAdvice.getId())) { + throw new JeecgBootException("取消出库预配盘失败, 删除出库组盘明细表失败,配盘详情ID:" + shipmentContainerAdvice.getId()); + } + if (!shipmentHeaderService.updateShipmentHeaderStatus(shipmentDetail.getShipmentId())) { + throw new JeecgBootException("取消出库预配盘失败, 更新出库单头失败,出库单ID:" + shipmentDetail.getShipmentId()); + } + InventoryDetail inventoryDetail = inventoryDetailService.getById(shipmentContainerAdvice.getInventoryDetailId()); + if (inventoryDetail == null) { + throw new JeecgBootException("取消出库预配盘失败, 没有找到库存详情失败,库存详情ID:" + shipmentContainerAdvice.getInventoryDetailId()); + } + BigDecimal inventoryDetailTaskQty = inventoryDetail.getTaskQty().subtract(shipmentContainerAdvice.getQty()); + if (!inventoryDetailService.updateTaskQtyById(inventoryDetailTaskQty, shipmentContainerAdvice.getInventoryDetailId())) { + throw new JeecgBootException("取消出库预配盘失败, 解锁库存详情失败,库存详情ID:" + inventoryDetail.getId()); + } + } + if (!shipmentContainerHeaderService.removeById(id)) { + throw new JeecgBootException("取消出库预配盘失败, 删除出库组盘头表失败,配盘ID:" + id); + } + LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(shipmentContainerAdviceList)); + log.info("完成取消预配盘,id:" + id); + return Result.ok("取消预配盘成功"); } @Override public List<ShipmentContainerAdvice> getShipmentContainerAdviceListByShipmentCode(String shipmentCode, String warehouseCode) { LambdaQueryWrapper<ShipmentContainerAdvice> shipmentContainerAdviceLambdaQueryWrapper = Wrappers.lambdaQuery(); - shipmentContainerAdviceLambdaQueryWrapper.eq(ShipmentContainerAdvice::getShipmentCode, shipmentCode).eq(ShipmentContainerAdvice::getWarehouseCode, - warehouseCode); + shipmentContainerAdviceLambdaQueryWrapper.eq(ShipmentContainerAdvice::getShipmentCode, shipmentCode) + .eq(ShipmentContainerAdvice::getWarehouseCode, warehouseCode).lt(ShipmentContainerAdvice::getStatus, QuantityConstant.SHIPMENT_CONTAINER_FINISHED); + List<ShipmentContainerAdvice> shipmentContainerAdviceList = list(shipmentContainerAdviceLambdaQueryWrapper); + return shipmentContainerAdviceList; + } + + @Override + public List<ShipmentContainerAdvice> getShipmentContainerAdviceListByShipmentContainerId(int shipmentContainerId) { + LambdaQueryWrapper<ShipmentContainerAdvice> shipmentContainerAdviceLambdaQueryWrapper = Wrappers.lambdaQuery(); + shipmentContainerAdviceLambdaQueryWrapper.eq(ShipmentContainerAdvice::getShipmentContainerId, shipmentContainerId).lt(ShipmentContainerAdvice::getStatus, + QuantityConstant.SHIPMENT_CONTAINER_FINISHED); List<ShipmentContainerAdvice> shipmentContainerAdviceList = list(shipmentContainerAdviceLambdaQueryWrapper); return shipmentContainerAdviceList; } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/entity/ShipmentContainerHeader.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/entity/ShipmentContainerHeader.java index a032800..13adc4e 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/entity/ShipmentContainerHeader.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/entity/ShipmentContainerHeader.java @@ -77,6 +77,9 @@ public class ShipmentContainerHeader implements Serializable { @Excel(name = "目标出入口", width = 15) @ApiModelProperty(value = "目标出入口") private String toPort; + /** 是否预配盘 */ + @ApiModelProperty(value = "是否预配盘") + private Integer advice; /** 备用字段1 */ @Excel(name = "备用字段1", width = 15) @ApiModelProperty(value = "备用字段1") diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerHeaderServiceImpl.java index e269890..7d2a632 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerHeaderServiceImpl.java @@ -15,6 +15,7 @@ import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterCon import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; +import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.service.IShipmentContainerAdviceService; import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; import org.jeecg.modules.wms.shipment.shipmentContainerHeader.mapper.ShipmentContainerDetailMapper; @@ -69,6 +70,8 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont private IHuahengMultiHandlerService huahengMultiHandlerService; @Resource private IParameterConfigurationService parameterConfigurationService; + @Resource + private IShipmentContainerAdviceService shipmentContainerAdviceService; @Override @Transactional @@ -165,9 +168,8 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont shipmentContainerHeader.setStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD); boolean success = this.updateStatusById(QuantityConstant.SHIPMENT_CONTAINER_BUILD, shipmentContainerHeader.getId()); if (!success) { - throw new JeecgBootException("取消入库任务时, 更新入库组盘头失败"); + throw new JeecgBootException("取消出库任务时, 更新出库组盘头失败"); } - List<ShipmentContainerDetail> shipmentContainerDetailList = shipmentContainerDetailService.getShipmentContainerDetailListByHeaderId(shipmentContainerHeader.getId()); List<ShipmentDetail> shipmentDetailList = new ArrayList<>(); @@ -202,9 +204,17 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont } int cancelTaskRule = Integer.parseInt(value); if (cancelTaskRule == QuantityConstant.RULE_TASK_CANCEL_CONTAINER) { - Result result = shipmentContainerHeaderService.cancelCombine(shipmentContainerHeader.getId()); - if (!result.isSuccess()) { - throw new JeecgBootException("取消出库任务时, 取消配盘失败"); + int shipmentContainerAdvice = shipmentContainerHeader.getAdvice(); + if (shipmentContainerAdvice == QuantityConstant.STATUS_CLOSE) { + Result result = shipmentContainerHeaderService.cancelCombine(shipmentContainerHeader.getId()); + if (!result.isSuccess()) { + throw new JeecgBootException("取消出库任务时, 取消配盘失败"); + } + } else { + Result result = shipmentContainerAdviceService.cancelCombine(shipmentContainerHeader.getId()); + if (!result.isSuccess()) { + throw new JeecgBootException("取消出库任务时, 取消配盘失败"); + } } } log.info("完成取消出库任务,任务id" + taskHeader.getId()); 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 ffe8091..4c7c614 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 @@ -515,8 +515,11 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, throw new JeecgBootException("自动预配盘出库, 没有合适的出库口"); } Port port = portList.get(0); - shipmentContainerHeader.setToPort(port.getCode()); - boolean success = shipmentContainerHeaderService.updateById(shipmentContainerHeader); + ShipmentContainerHeader shipmentContainerHeader1 = new ShipmentContainerHeader(); + shipmentContainerHeader1.setId(shipmentContainerHeader.getId()); + shipmentContainerHeader1.setToPort(port.getCode()); + shipmentContainerHeader1.setAdvice(QuantityConstant.STATUS_OPEN); + boolean success = shipmentContainerHeaderService.updateById(shipmentContainerHeader1); if (!success) { throw new JeecgBootException("自动预配盘出库, 更新出库组盘头失败"); } 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 b49cdea..9689881 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 @@ -45,6 +45,8 @@ import org.jeecg.modules.wms.receipt.receiving.domain.Receive; import org.jeecg.modules.wms.receipt.receiving.service.IReceiveService; import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; import org.jeecg.modules.wms.shipment.shipmentCombination.service.IShipmentCombinationService; +import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.entity.ShipmentContainerAdvice; +import org.jeecg.modules.wms.shipment.shipmentContainerAdvice.service.IShipmentContainerAdviceService; import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerDetailService; @@ -157,6 +159,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea private ILockStationService lockStationService; @Resource private IQualityDetailService qualityDetailService; + @Resource + private IShipmentContainerAdviceService shipmentContainerAdviceService; @Override @Transactional @@ -1273,6 +1277,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea inventoryDetail.setBatch(taskDetail.getBatch()); inventoryDetail.setLot(taskDetail.getLot()); inventoryDetail.setProject(taskDetail.getProject()); + inventoryDetail.setSn(taskDetail.getSn()); inventoryDetail.setReceiveTime(taskDetail.getReceiveTime()); inventoryDetail.setReceiptDate(new Date()); inventoryDetailList.add(inventoryDetail); @@ -1296,6 +1301,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea inventoryTransaction.setBatch(taskDetail.getBatch()); inventoryTransaction.setLot(taskDetail.getLot()); inventoryTransaction.setProject(taskDetail.getProject()); + inventoryTransaction.setSn(taskDetail.getSn()); inventoryTransaction.setInventoryStatus(taskDetail.getInventoryStatus()); inventoryTransaction.setQty(receiptQty); inventoryTransaction.setReceiptQty(receiptQty); @@ -1397,6 +1403,13 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (!success) { throw new JeecgBootException("完成出库任务,更新出库组盘头失败"); } + List<ShipmentContainerAdvice> shipmentContainerAdviceList = + shipmentContainerAdviceService.getShipmentContainerAdviceListByShipmentContainerId(shipmentContainerHeader.getId()); + for (ShipmentContainerAdvice shipmentContainerAdvice : shipmentContainerAdviceList) { + if (!shipmentContainerAdviceService.updateStatusById(QuantityConstant.SHIPMENT_CONTAINER_FINISHED, shipmentContainerAdvice.getId())) { + throw new JeecgBootException("完成出库任务,更新出库预配盘失败"); + } + } } Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), taskType, containerCode, fromLocationCode, toLocationCode, warehouseCode); @@ -1641,6 +1654,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea InventoryDetail inventoryDetail2 = inventoryDetailList.get(j); if (inventoryDetail1.getMaterialCode().equals(inventoryDetail2.getMaterialCode()) && inventoryDetail1.getBatch().equals(inventoryDetail2.getBatch()) && inventoryDetail1.getLot().equals(inventoryDetail2.getLot()) && inventoryDetail1.getProject().equals(inventoryDetail2.getProject()) + && inventoryDetail1.getSn().equals(inventoryDetail2.getSn()) && inventoryDetail1.getInventoryStatus().equals(inventoryDetail2.getInventoryStatus())) { // 属性一样的库存,相加合并。 BigDecimal totalQty = inventoryDetail1.getQty().add(inventoryDetail2.getQty()); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java b/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java index 30c3d5e..7eb79ec 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java @@ -531,6 +531,10 @@ public class QuantityConstant { public static final String TV_VERSION = "Tv-Ver"; public static final String RULE_SHIPMENT_ZONE = "shipmentZoneRule"; public static final String SHIPMENT_WHOLE_TASK_CLEAR_INVENTORY = "shipmentWholeTaskClearInventory"; + public static final String RULE_SHIPMENT_CONTAINER_ADVICE = "shipmentContainerAdvice"; + + public static final int STATUS_CLOSE = 0; + public static final int STATUS_OPEN = 1; public static final int DOUBLE_FORK = 1; public static final int SINGLE_FORK = 0;