diff --git a/ant-design-vue-jeecg/src/api/api.js b/ant-design-vue-jeecg/src/api/api.js index 202cfa7..6ebe097 100644 --- a/ant-design-vue-jeecg/src/api/api.js +++ b/ant-design-vue-jeecg/src/api/api.js @@ -286,6 +286,8 @@ export const createBatchShipmentTaskByAgv = (params) => postAction('/shipment/sh export const createShipmentTaskAndAgvTask = (params) => postAction('/shipment/shipmentCombination/createShipmentTaskAndAgvTask', params); //完成平库出库 export const completeFlatShipment = (params) => postAction('/shipment/shipmentCombination/completeFlatShipment', params); +//平库入库 +export const flatReceipt = (params) => postAction('/receipt/receiveHeader/flatReceipt', params); // 中转HTTP请求 export const transitRESTful = { diff --git a/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue b/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue index 5f1ddb1..7602156 100644 --- a/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue +++ b/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue @@ -40,8 +40,13 @@ </a-form-item> </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> - <a-form-item label="库位编码"> - <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> + <a-form-item label="起始库位编码"> + <a-input placeholder="请输入起始库位编码" v-model="queryParam.fromLocationCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="目标库位编码"> + <a-input placeholder="请输入目标库位编码" v-model="queryParam.toLocationCode"></a-input> </a-form-item> </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> diff --git a/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue b/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue index 6c480ef..a19ea23 100644 --- a/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue +++ b/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue @@ -132,7 +132,7 @@ <!-- <a v-else-if="record.status == 0" @click="selectContainerStatus(record)" v-has="'receiptContainerHeader:createTask'"><a-button type="primary">生成任务</a-button><a-divider type="vertical"/></a>--> <a v-if="record.status == 0 && record.taskType == 200" @click="selectPort(record)" v-has="'receiptContainerHeader:createTask'"><a-button type="primary">生成任务</a-button><a-divider type="vertical"/></a> <a v-else-if="record.status == 0" @click="createTask(record)" v-has="'receiptContainerHeader:createTask'"><a-button type="primary">生成任务</a-button><a-divider type="vertical"/></a> - <a-popconfirm v-if="record.status == 0" v-has="'receiptContainerHeader:delete'" title="确定取消配盘吗?" @confirm="() => handleDelete(record.id)"> + <a-popconfirm v-if="record.status == 0" v-has="'receipatContainerHeader:delete'" title="确定取消配盘吗?" @confirm="() => handleDelete(record.id)"> <a><a-button type="danger">取消配盘</a-button> <a-divider type="vertical"/></a> </a-popconfirm> diff --git a/ant-design-vue-jeecg/src/views/system/shipment/ShipmentContainerHeaderList.vue b/ant-design-vue-jeecg/src/views/system/shipment/ShipmentContainerHeaderList.vue index 94fad6e..7e77eff 100644 --- a/ant-design-vue-jeecg/src/views/system/shipment/ShipmentContainerHeaderList.vue +++ b/ant-design-vue-jeecg/src/views/system/shipment/ShipmentContainerHeaderList.vue @@ -130,7 +130,7 @@ <a><a-button type="danger">取消配盘</a-button> <a-divider type="vertical"/></a> </a-popconfirm> <a v-has="'shipmentContainerHeader:edit'" @click="handleEdit(record)"><a-button type="default">编辑</a-button> <a-divider type="vertical"/></a> - <a v-if="record.status == 10" v-has="'shipmentContainerHeader:reduceInventoryDetailBySn'" @click="openReduce(record)"><a-button type="primary">扣减库存</a-button></a> + <a v-if="record.status == 10 && record.taskType == 400" v-has="'shipmentContainerHeader:reduceInventoryDetailBySn'" @click="openReduce(record)"><a-button type="primary">扣减库存</a-button></a> </span> </a-table> </div> diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/port/service/IPortService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/port/service/IPortService.java index 027f513..8318839 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/port/service/IPortService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/port/service/IPortService.java @@ -18,7 +18,9 @@ public interface IPortService extends IService<Port> { List<Port> getPortListByType(int type, Integer roadWay, String zoneCode, String warehouseCode); - Port getPortByCode(String code, Integer roadWay, String zoneCode, String warehouseCode); +// Port getPortByCode(String code, Integer roadWay, String zoneCode, String warehouseCode); + + Port getPortByCode(String code, Integer type, String zoneCode, String warehouseCode); Port getPortByCode(String code, String zoneCode, String warehouseCode); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/port/service/impl/PortServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/port/service/impl/PortServiceImpl.java index 914b628..dfde49f 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/port/service/impl/PortServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/port/service/impl/PortServiceImpl.java @@ -42,10 +42,10 @@ public class PortServiceImpl extends ServiceImpl<PortMapper, Port> implements IP } @Override - public Port getPortByCode(String code, Integer roadWay, String zoneCode, String warehouseCode) { + public Port getPortByCode(String code, Integer type, String zoneCode, String warehouseCode) { LambdaQueryWrapper<Port> portLambdaQueryWrapper = Wrappers.lambdaQuery(); - portLambdaQueryWrapper.eq(Port::getCode, code).eq(Port::getZoneCode, zoneCode).eq(Port::getWarehouseCode, warehouseCode).in(roadWay != null, - Port::getRoadWay, roadWay); + portLambdaQueryWrapper.eq(Port::getCode, code).eq(Port::getZoneCode, zoneCode).eq(Port::getWarehouseCode, warehouseCode).in(type != null, Port::getType, + type); Port port = getOne(portLambdaQueryWrapper); return port; } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/SelfCheck.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/SelfCheck.java new file mode 100644 index 0000000..592d386 --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/SelfCheck.java @@ -0,0 +1,378 @@ +package org.jeecg.modules.wms.monitor.job; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.DateUtils; +import org.jeecg.modules.system.service.impl.SysAnnouncementServiceImpl; +import org.jeecg.modules.wms.config.container.entity.Container; +import org.jeecg.modules.wms.config.container.service.IContainerService; +import org.jeecg.modules.wms.config.location.entity.Location; +import org.jeecg.modules.wms.config.location.service.ILocationService; +import org.jeecg.modules.wms.config.locationHigh.service.ILocationHighService; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; +import org.jeecg.utils.StringUtils; +import org.jeecg.utils.constant.QuantityConstant; +import org.jeecg.utils.support.SystemSync; +import org.quartz.*; + +import javax.annotation.Resource; +import java.sql.Timestamp; +import java.util.*; +import java.util.stream.Collectors; + +@Slf4j +@PersistJobDataAfterExecution +@DisallowConcurrentExecution +public class SelfCheck implements Job { + + @Resource + private IContainerService containerService; + + @Resource + private ITaskHeaderService taskHeaderService; + + @Resource + private IInventoryHeaderService inventoryHeaderService; + + @Resource + private ILocationService locationService; + + @Resource + private SysAnnouncementServiceImpl sysAnnouncementService; + + @Resource + SystemSync systemSync; + + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + log.info(String.format("开始进行自检,时间:" + DateUtils.getTimestamp())); + Timestamp timestamp = DateUtils.getTimestamp(); + List<Container> containerList = new ArrayList<>(); + List<String> container = new ArrayList<>(); + List<TaskHeader> taskHeaderList = new ArrayList<>(); + List<String> taskContainer = new ArrayList<>(); + List<String> common = new ArrayList<>(); + List<String> inventoryContainer = new ArrayList<>(); + List<Location> locationList = new ArrayList<>(); + List<String> locationContainerCode = new ArrayList<>(); + List<String> location = new ArrayList<>(); + List<String> taskLocation = new ArrayList<>(); + Map<String, String> map = new HashMap<>(); + Map<String, String> map2 = new HashMap<>(); + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); + LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); + // 锁定的容器查看是否有任务 + containerLambdaQueryWrapper.eq(Container::getStatus, QuantityConstant.STATUS_CONTAINER_LOCK); + containerList = containerService.list(containerLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(containerList)) { + container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); + taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); + taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); + // 是否有任务 + if (!CollectionUtils.isEmpty(taskHeaderList)) { + taskContainer = taskHeaderList.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); + common = taskHeaderService.findCommonData(taskContainer, container, true); + if (!CollectionUtils.isEmpty(common)) { + log.info("自检完成,容器:" + common + "已锁定,但不存在任务"); + String msg = "容器:" + common + "已锁定,但不存在任务"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } else { + log.info("自检完成,容器:" + container + "已锁定,但不存在任务"); + String msg = "容器:" + container + "已锁定,但不存在任务"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } + // 空闲的容器查看是否有任务 +// containerLambdaQueryWrapper = Wrappers.lambdaQuery(); +// containerLambdaQueryWrapper.eq(Container::getStatus, QuantityConstant.STATUS_CONTAINER_EMPTY); +// containerList = containerService.list(containerLambdaQueryWrapper); +// if (!CollectionUtils.isEmpty(containerList)) { +// container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); +// taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); +// taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); +// taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); +// taskContainer = taskHeaderList.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); +// common = taskHeaderService.findCommonData(container, taskContainer, false); +// if (!CollectionUtils.isEmpty(common)) { +// log.info("自检完成,容器:" + common + "是空闲,但存在任务"); +// String msg = "容器:" + common + "是空闲,但存在任务"; +// systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); +// } +// } + // 有货或满盘的容器 查看是否有库存 + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); + containerLambdaQueryWrapper.in(Container::getFillStatus, QuantityConstant.STATUS_CONTAINER_FILL_SOME, QuantityConstant.STATUS_CONTAINER_FILL_FULL); + containerList = containerService.list(containerLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(containerList)) { + container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); + List<InventoryHeader> inventoryHeaders = inventoryHeaderService.list(inventoryHeaderLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(inventoryHeaders)) { + inventoryContainer = inventoryHeaders.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); + common = taskHeaderService.findCommonData(inventoryContainer, container, true); + if (!CollectionUtils.isEmpty(common)) { + log.info("自检完成,容器:" + common + "状态是有货,但没有库存"); + String msg = "容器:" + common + "状态是有货,但没有库存"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } else { + log.info("自检完成,容器:" + container + "状态是有货,但没有库存"); + String msg = "容器:" + container + "状态是有货,但没有库存"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } + // 空盘容器 是否有库存 + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); + containerLambdaQueryWrapper.in(Container::getFillStatus, QuantityConstant.STATUS_CONTAINER_EMPTY, QuantityConstant.STATUS_CONTAINER_FILL_MANY); + containerList = containerService.list(containerLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(containerList)) { + container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); + List<InventoryHeader> inventoryHeaders = inventoryHeaderService.list(inventoryHeaderLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(inventoryHeaders)) { + inventoryContainer = inventoryHeaders.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); + common = taskHeaderService.findCommonData(container, inventoryContainer, false); + if (!CollectionUtils.isEmpty(common)) { + log.info("自检完成,容器:" + common + "状态是空盘,但存在库存"); + String msg = "容器:" + common + "状态是空盘,但存在库存"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } + } + // 容器有库位=对应库位有这个容器 + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); + containerLambdaQueryWrapper.ne(Container::getLocationCode, QuantityConstant.EMPTY_STRING); + containerList = containerService.list(containerLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(containerList)) { + common = new ArrayList<>(); + for (Container container1 : containerList) { + map.put(container1.getCode(), container1.getLocationCode()); + } + locationLambdaQueryWrapper.ne(Location::getContainerCode, QuantityConstant.EMPTY_STRING); + locationList = locationService.list(locationLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(locationList)) { + for (Location location1 : locationList) { + map2.put(location1.getContainerCode(), location1.getCode()); + } + for (Map.Entry<String, String> stringStringEntry : map.entrySet()) { + String key = stringStringEntry.getKey(); + if (map2.get(key) == null) { + common.add(key); + } else { + // 如果键存在于map2中,执行相应操作 + String value1 = stringStringEntry.getValue(); + String value2 = map2.get(key); + if (!value1.equals(value2)) { + // 值不相同的处理逻辑 + common.add(key); + } + } + } + if (!CollectionUtils.isEmpty(common)) { + log.info("自检完成,容器:" + common + "对应的库位和库位表中的不一致"); + String msg = "容器:" + common + "对应的库位和库位表中的不一致"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } else { + container = containerList.stream().map(i ->i.getCode()).collect(Collectors.toList()); + log.info("自检完成,容器:" + container + " 对应的库位和库位表中的不一致"); + String msg = "容器:" + container + " 对应的库位和库位表中的不一致"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } + // 容器有库位 查看库位是否有容器 +// containerLambdaQueryWrapper = Wrappers.lambdaQuery(); +// containerLambdaQueryWrapper.ne(Container::getLocationCode, QuantityConstant.EMPTY_STRING); +// containerList = containerService.list(containerLambdaQueryWrapper); +// if (!CollectionUtils.isEmpty(containerList)) { +// container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); +// locationLambdaQueryWrapper.ne(Location::getContainerCode, QuantityConstant.EMPTY_STRING); +// locationList = locationService.list(locationLambdaQueryWrapper); +// if (!CollectionUtils.isEmpty(locationList)) { +// locationContainerCode = locationList.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); +// common = taskHeaderService.findCommonData(locationContainerCode, container, true); +// if (!CollectionUtils.isEmpty(common)) { +// log.info("自检完成,容器:" + common + "有库位信息,但库位没有容器信息"); +// String msg = "容器:" + common + "有库位信息,但库位没有容器信息"; +// systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); +// } +// } else { +// log.info("自检完成,容器:" + container + "有库位信息,但库位没有容器信息"); +// String msg = "容器:" + common + "有库位信息,但库位没有容器信息"; +// systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); +// } +// } + // 容器没库位 查看库位是否有容器 + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); + containerLambdaQueryWrapper.eq(Container::getLocationCode, QuantityConstant.EMPTY_STRING); + containerList = containerService.list(containerLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(containerList)) { + container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); + locationLambdaQueryWrapper.ne(Location::getContainerCode, QuantityConstant.EMPTY_STRING); + locationList = locationService.list(locationLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(locationList)) { + locationContainerCode = locationList.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); + common = taskHeaderService.findCommonData(container, locationContainerCode, false); + if (!CollectionUtils.isEmpty(common)) { + log.info("自检完成,容器:" + common + "没有库位信息,但库位有容器信息"); + String msg = "容器:" + common + "没有库位信息,但库位有容器信息"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } + } + // 库位空闲,查看是否有任务 +// locationLambdaQueryWrapper = Wrappers.lambdaQuery(); +// locationLambdaQueryWrapper.eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY); +// locationList = locationService.list(locationLambdaQueryWrapper); +// taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); +// taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); +// // 是否有任务 +// if (!CollectionUtils.isEmpty(taskHeaderList)) { +// if (!CollectionUtils.isEmpty(locationList)) { +// location = locationList.stream().map(i -> i.getCode()).collect(Collectors.toList()); +// taskLocation = (taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getToLocationCode())).collect(Collectors.toList())).stream() +// .map(t -> t.getToLocationCode()).collect(Collectors.toList()); +// taskLocation.addAll((taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getFromLocationCode())).collect(Collectors.toList())).stream() +// .map(t -> t.getFromLocationCode()).collect(Collectors.toList())); +// common = taskHeaderService.findCommonData(location, taskLocation, false); +// if (!CollectionUtils.isEmpty(common)) { +// log.info("自检完成,库位:" + common + "是空闲,但存在任务"); +// String msg = "库位:" + common + "是空闲,但存在任务"; +// systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); +// } +// } +// } + // 库位锁定,查看是否有任务 + locationLambdaQueryWrapper = Wrappers.lambdaQuery(); + locationLambdaQueryWrapper.eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_LOCK); + locationList = locationService.list(locationLambdaQueryWrapper); + taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); + taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(locationList)) { + location = locationList.stream().map(i -> i.getCode()).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(taskHeaderList)) { + taskLocation = (taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getToLocationCode())).collect(Collectors.toList())).stream() + .map(t -> t.getToLocationCode()).collect(Collectors.toList()); + taskLocation.addAll((taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getFromLocationCode())).collect(Collectors.toList())).stream() + .map(t -> t.getFromLocationCode()).collect(Collectors.toList())); + if (!CollectionUtils.isEmpty(taskLocation)) { + common = taskHeaderService.findCommonData(taskLocation, location, true); + if (!CollectionUtils.isEmpty(common)) { + log.info("自检完成,库位:" + common + "已锁定,但不存在任务"); + String msg = "库位:" + common + "已锁定,但不存在任务"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } else { + log.info("自检完成,库位:" + location + "已锁定,但不存在任务"); + String msg = "库位:" + location + "已锁定,但不存在任务"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } else { + log.info("自检完成,库位:" + location + "已锁定,但不存在任务"); + String msg = "库位:" + location + "已锁定,但不存在任务"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } + // 库位有容器,查看容器是否有库位 + locationLambdaQueryWrapper = Wrappers.lambdaQuery(); + locationLambdaQueryWrapper.ne(Location::getContainerCode, QuantityConstant.EMPTY_STRING); + locationList = locationService.list(locationLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(locationList)) { + locationContainerCode = locationList.stream().map(i -> i.getCode()).collect(Collectors.toList()); + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); + containerLambdaQueryWrapper.ne(Container::getLocationCode, QuantityConstant.EMPTY_STRING); + containerList = containerService.list(containerLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(containerList)) { + container = containerList.stream().map(i -> i.getLocationCode()).collect(Collectors.toList()); + common = taskHeaderService.findCommonData(container, locationContainerCode, true); + if (!CollectionUtils.isEmpty(common)) { + log.info("自检完成,库位:" + common + "有容器信息,但容器没有库位信息"); + String msg = "库位:" + common + "有容器信息,但容器没有库位信息"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } else { + log.info("自检完成,库位:" + locationContainerCode + "有容器信息,但容器没有库位信息"); + String msg = "库位:" + locationContainerCode + "有容器信息,但容器没有库位信息"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } + // 库位没有容器,查看容器是否有这个库位 + locationLambdaQueryWrapper = Wrappers.lambdaQuery(); + locationLambdaQueryWrapper.eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING); + locationList = locationService.list(locationLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(locationList)) { + locationContainerCode = locationList.stream().map(i -> i.getCode()).collect(Collectors.toList()); + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); + containerLambdaQueryWrapper.ne(Container::getLocationCode, QuantityConstant.EMPTY_STRING); + containerList = containerService.list(containerLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(containerList)) { + container = containerList.stream().map(i -> i.getLocationCode()).collect(Collectors.toList()); + common = taskHeaderService.findCommonData(locationContainerCode, container, true); + if (!CollectionUtils.isEmpty(common)) { + log.info("自检完成,库位:" + common + "没有容器信息,但容器有库位信息"); + String msg = "库位:" + common + "没有容器信息,但容器有库位信息"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } + } + // 存在有任务,查看容器库位是否锁定 + taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); + taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(taskHeaderList)) { + taskContainer = taskHeaderList.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); + taskLocation = (taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getToLocationCode())).collect(Collectors.toList())).stream() + .map(t -> t.getToLocationCode()).collect(Collectors.toList()); + taskLocation.addAll((taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getFromLocationCode())).collect(Collectors.toList())).stream() + .map(t -> t.getFromLocationCode()).collect(Collectors.toList())); + if (!CollectionUtils.isEmpty(taskContainer)) { + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); + containerLambdaQueryWrapper.eq(Container::getStatus, QuantityConstant.STATUS_CONTAINER_LOCK); + containerList = containerService.list(containerLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(containerList)) { + container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); + common = taskHeaderService.findCommonData(container, taskContainer, true); + if (!CollectionUtils.isEmpty(common)) { + log.info("自检完成,容器:" + common + "存在任务,但容器未锁定"); + String msg = "容器:" + common + "存在任务,但容器未锁定"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } else { + log.info("自检完成,容器:" + taskContainer + "存在任务,但容器未锁定"); + String msg = "容器:" + taskContainer + "存在任务,但容器未锁定"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } + if (!CollectionUtils.isEmpty(taskLocation)) { + locationLambdaQueryWrapper = Wrappers.lambdaQuery(); + locationLambdaQueryWrapper.eq(Location::getStatus, QuantityConstant.STATUS_CONTAINER_LOCK); + locationList = locationService.list(locationLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(locationList)) { + location = locationList.stream().map(i -> i.getCode()).collect(Collectors.toList()); + common = taskHeaderService.findCommonData(location, taskLocation, true); + if (!CollectionUtils.isEmpty(common)) { + log.info("自检完成,库位:" + common + "存在任务,但库位未锁定"); + String msg = "库位:" + common + "存在任务,但库位未锁定"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } else { + log.info("自检完成,库位:" + locationList + "存在任务,但库位未锁定"); + String msg = "库位:" + locationList + "存在任务,但库位未锁定"; + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); + } + } + } + Timestamp timestamp1 = DateUtils.getTimestamp(); + log.info(String.format("自检完成,开始时间:" + timestamp)); + log.info(String.format("自检完成,结束时间:" + timestamp1)); + } +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java index 28d1302..7b89e83 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java @@ -1,6 +1,7 @@ package org.jeecg.modules.wms.receipt.receiptContainerHeader.controller; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -14,6 +15,7 @@ import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.vo.LoginUser; @@ -45,6 +47,7 @@ import org.springframework.web.servlet.ModelAndView; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; @@ -357,6 +360,33 @@ public class ReceiptContainerHeaderController extends JeecgController<ReceiptCon @ResponseBody public Result createReceiptBatchTask(@RequestBody List<ReceiptContainerHeader> receiptContainerHeaderList, HttpServletRequest req) { String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); + if (CollectionUtils.isEmpty(receiptContainerHeaderList)) { + return Result.error("批量创建入库任务失败,没有组盘明细"); + } + String toPort = receiptContainerHeaderList.get(0).getToPort(); + if (StringUtils.isEmpty(toPort)) { + return Result.error("批量创建入库任务失败,没有去向"); + } + List<ReceiptContainerHeader> removeList = new ArrayList<>(); + for (ReceiptContainerHeader receiptContainerHeader : receiptContainerHeaderList) { + String fromLocationCode = receiptContainerHeader.getFromLocationCode(); + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); + if (fromLocation == null) { + throw new JeecgBootException("批量创建入库任务失败,没有找到库位" + fromLocationCode); + } + int roadWay = fromLocation.getRoadWay(); + String zoneCode = fromLocation.getZoneCode(); + List<Port> portList = portService.getPortListByType(QuantityConstant.PORT_TYPE_PICK, roadWay, zoneCode, warehouseCode); + if (CollectionUtils.isEmpty(portList)) { + removeList.add(receiptContainerHeader); + continue; + } + List<String> portCodeList = portList.stream().map(Port::getCode).collect(Collectors.toList()); + if (!portCodeList.contains(toPort)) { + removeList.add(receiptContainerHeader); + } + } + receiptContainerHeaderList.removeAll(removeList); for (ReceiptContainerHeader receiptContainerHeader : receiptContainerHeaderList) { Result result = huahengMultiHandlerService.createReceiptTask(receiptContainerHeader, warehouseCode); if (!result.isSuccess()) { 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 9bc451a..96611c4 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 @@ -15,6 +15,8 @@ import org.jeecg.modules.wms.config.container.entity.Container; import org.jeecg.modules.wms.config.container.service.IContainerService; import org.jeecg.modules.wms.config.location.service.ILocationService; import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; +import org.jeecg.modules.wms.config.zone.entity.Zone; +import org.jeecg.modules.wms.config.zone.service.IZoneService; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; import org.jeecg.modules.wms.lockStation.service.ILockStationService; import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; @@ -94,6 +96,8 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai @Resource private ILockStationService lockStationService; + @Resource + private IZoneService zoneService; @Override @Transactional @@ -146,6 +150,10 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai if (StringUtils.isEmpty(zoneCode)) { return Result.error("容器没有配置库区,请配置!"); } + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); + if (zone == null) { + return Result.error("库区:" + zoneCode + " 信息为空"); + } boolean success = false; List<ReceiptContainerDetail> receiptContainerDetailList = receiptContainerDetailService.getReceiptContainerDetailListByHeaderId(receiptContainerHeader.getId()); @@ -185,6 +193,11 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai taskHeader.setWarehouseCode(warehouseCode); taskHeader.setZoneCode(zoneCode); taskHeader.setToPortCode(toPort); + if (StringUtils.isNotEmpty(zone.getType())) { + if (zone.getType().equals(QuantityConstant.ZONE_TYPE_AGV)) { + taskHeader.setToWcs(QuantityConstant.NOT_TO_WCS); + } + } success = taskHeaderService.save(taskHeader); if (!success) { throw new JeecgBootException("创建入库任务, 任务生成失败"); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java index 26fbd57..1abaaa8 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java @@ -223,7 +223,6 @@ public class ReceiveController extends HuahengBaseController { @Override public Result<?> doProcess() { Result result = receiveService.receivingAndCreateTask(receiveList, warehouseCode); - return result; } }); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java index 766c63e..53a256e 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java @@ -1,13 +1,16 @@ package org.jeecg.modules.wms.shipment.shipmentCombination.controller; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.wms.config.location.entity.Location; import org.jeecg.modules.wms.config.location.service.ILocationService; import org.jeecg.modules.wms.config.port.entity.Port; @@ -33,6 +36,7 @@ import org.jeecg.utils.constant.QuantityConstant; import org.springframework.web.bind.annotation.*; 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; @@ -133,6 +137,38 @@ public class ShipmentCombinationController extends HuahengBaseController { @ResponseBody public Result createShipmentBatchTask(@RequestBody List<ShipmentContainerHeader> shipmentContainerHeaderList, HttpServletRequest req) { String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); + if (CollectionUtils.isEmpty(shipmentContainerHeaderList)) { + return Result.error("批量创建出库任务失败,没有组盘明细"); + } + String toPort = shipmentContainerHeaderList.get(0).getToPort(); + if (StringUtils.isEmpty(toPort)) { + return Result.error("批量创建出库任务失败,没有去向"); + } + List<ShipmentContainerHeader> removeList = new ArrayList<>(); + for (ShipmentContainerHeader shipmentContainerHeader : shipmentContainerHeaderList) { + String fromLocationCode = shipmentContainerHeader.getFromLocationCode(); + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); + if (fromLocation == null) { + throw new JeecgBootException("批量创建出库任务失败,没有找到库位" + fromLocationCode); + } + int roadWay = fromLocation.getRoadWay(); + String zoneCode = fromLocation.getZoneCode(); + int taskType = shipmentContainerHeader.getTaskType(); + int portType = QuantityConstant.PORT_TYPE_PICK; + if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { + portType = QuantityConstant.PORT_TYPE_OUT; + } + List<Port> portList = portService.getPortListByType(portType, roadWay, zoneCode, warehouseCode); + if (CollectionUtils.isEmpty(portList)) { + removeList.add(shipmentContainerHeader); + continue; + } + List<String> portCodeList = portList.stream().map(Port::getCode).collect(Collectors.toList()); + if (!portCodeList.contains(toPort)) { + removeList.add(shipmentContainerHeader); + } + } + shipmentContainerHeaderList.removeAll(removeList); for (ShipmentContainerHeader shipmentContainerHeader : shipmentContainerHeaderList) { Result result = huahengMultiHandlerService.createShipmentTask(shipmentContainerHeader, warehouseCode, 0, 0, 0); if (!result.isSuccess()) { diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java index 4086e2f..1cdc327 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java @@ -437,4 +437,9 @@ public interface ITaskHeaderService extends IService<TaskHeader> { */ Result qualityRegister(int id, BigDecimal qualityfiedQty, BigDecimal unqualityfiedQty, String remark); + /** + * 自检数据 + */ + List<String> findCommonData(List<String> dataList1, List<String> dataList2, boolean flag); + } 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 19d0f69..628b5b6 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 @@ -356,6 +356,19 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (StringUtils.isEmpty(containerCode)) { return Result.error("创建出库查看任务时,容器编码为空"); } + + //创建出库查看任务时,库存不能被冻结 + LambdaQueryWrapper<InventoryDetail> inventoryDetailWrapper = Wrappers.lambdaQuery(); + inventoryDetailWrapper.eq(InventoryDetail::getContainerCode,containerCode); + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailWrapper); + if (StringUtils.isEmpty(inventoryDetailList)) { + return Result.error("创建出库查看任务时,库存详情为空"); + } + List<Integer> enableList = inventoryDetailList.stream().map(InventoryDetail::getEnable).distinct().collect(Collectors.toList()); + if (enableList.contains(QuantityConstant.INVENTORY_DETAIL_STATUS_CONTAINER)) { + return Result.error("创建出库查看任务时,库存详情被冻结"); + } + if (StringUtils.isEmpty(toPortCode)) { return Result.error("创建出库查看任务时,目标站台号为空"); } @@ -450,7 +463,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea } TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); String zoneCode = taskLockEntity.getZoneCode(); - Port port = portService.getPortByCode(toPortCode, zoneCode, warehouseCode); + Port port = portService.getPortByCode(toPortCode, QuantityConstant.PORT_TYPE_PICK, zoneCode, warehouseCode); if (port == null) { throw new JeecgBootException("创建质检任务失败,没有找到出库口:" + toPortCode); } @@ -476,24 +489,30 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); List<TaskDetail> taskDetailList = new ArrayList<>(); if (inventoryDetailList.size() != 0) { + List<Integer> enableList = inventoryDetailList.stream().map(InventoryDetail::getEnable).distinct().collect(Collectors.toList()); + if (!enableList.contains(QuantityConstant.INVENTORY_DETAIL_STATUS_ENABLE)) { + return Result.error("没有正常状态的库存详情"); + } for (InventoryDetail inventoryDetail : inventoryDetailList) { - TaskDetail taskDetail = new TaskDetail(); - taskDetail.setTaskHeaderId(taskHeader.getId()); - taskDetail.setTaskType(QuantityConstant.TASK_TYPE_QUALITY); - taskDetail.setWarehouseCode(warehouseCode); - taskDetail.setCompanyCode(inventoryDetail.getCompanyCode()); - taskDetail.setMaterialCode(inventoryDetail.getMaterialCode()); - taskDetail.setMaterialName(inventoryDetail.getMaterialName()); - taskDetail.setMaterialSpec(inventoryDetail.getMaterialSpec()); - taskDetail.setMaterialUnit(inventoryDetail.getMaterialUnit()); - taskDetail.setFromInventoryDetailId(inventoryDetail.getId()); - taskDetail.setInventoryStatus(inventoryDetail.getInventoryStatus()); - taskDetail.setQty(inventoryDetail.getQty()); - taskDetail.setBatch(inventoryDetail.getBatch()); - taskDetail.setLot(inventoryDetail.getLot()); - taskDetail.setProject(inventoryDetail.getProject()); - taskDetail.setReceiveTime(inventoryDetail.getReceiveTime()); - taskDetailList.add(taskDetail); + if (inventoryDetail.getEnable() == QuantityConstant.INVENTORY_DETAIL_STATUS_ENABLE) { + TaskDetail taskDetail = new TaskDetail(); + taskDetail.setTaskHeaderId(taskHeader.getId()); + taskDetail.setTaskType(QuantityConstant.TASK_TYPE_QUALITY); + taskDetail.setWarehouseCode(warehouseCode); + taskDetail.setCompanyCode(inventoryDetail.getCompanyCode()); + taskDetail.setMaterialCode(inventoryDetail.getMaterialCode()); + taskDetail.setMaterialName(inventoryDetail.getMaterialName()); + taskDetail.setMaterialSpec(inventoryDetail.getMaterialSpec()); + taskDetail.setMaterialUnit(inventoryDetail.getMaterialUnit()); + taskDetail.setFromInventoryDetailId(inventoryDetail.getId()); + taskDetail.setInventoryStatus(inventoryDetail.getInventoryStatus()); + taskDetail.setQty(inventoryDetail.getQty()); + taskDetail.setBatch(inventoryDetail.getBatch()); + taskDetail.setLot(inventoryDetail.getLot()); + taskDetail.setProject(inventoryDetail.getProject()); + taskDetail.setReceiveTime(inventoryDetail.getReceiveTime()); + taskDetailList.add(taskDetail); + } } success = taskDetailService.saveBatch(taskDetailList); if (!success) { @@ -1041,10 +1060,13 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea break; } taskHeaderService.cancelLocationAndContainerStatus(taskHeader); - if (taskHeader.getStatus().intValue() > QuantityConstant.TASK_STATUS_BUILD) { - result = wcsService.cancelWcsTask(taskHeader); - if (!result.isSuccess()) { - throw new JeecgBootException(result.getMessage()); + int toWcs = taskHeader.getToWcs(); + if (toWcs == QuantityConstant.TO_WCS) { + if (taskHeader.getStatus().intValue() > QuantityConstant.TASK_STATUS_BUILD) { + result = wcsService.cancelWcsTask(taskHeader); + if (!result.isSuccess()) { + throw new JeecgBootException(result.getMessage()); + } } } if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(taskHeader.getContainerCode(), taskHeader.getWarehouseCode())) { @@ -1076,9 +1098,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (taskHeader.getStatus() >= QuantityConstant.TASK_STATUS_RELEASE) { return Result.error("下发wcs任务时, 任务" + taskId + "已经下发,请不要重复下发,操作中止"); } - Result result = wcsService.wcsTaskAssign(taskHeader); - if (!result.isSuccess()) { - return Result.error(result.getMessage()); + int toWcs = taskHeader.getToWcs(); + if (toWcs == QuantityConstant.TO_WCS) { + Result result = wcsService.wcsTaskAssign(taskHeader); + if (!result.isSuccess()) { + return Result.error(result.getMessage()); + } } taskHeader.setStatus(QuantityConstant.TASK_STATUS_RELEASE); boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_RELEASE, taskHeader.getId()); @@ -2332,6 +2357,26 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea return Result.ok("质检登记成功"); } + @Override + public List<String> findCommonData(List<String> dataList1, List<String> dataList2, boolean flag) { + Set<String> dataSet1 = new HashSet<>(dataList1); + List<String> commonData = new ArrayList<>(); + if (flag) { + for (String obj : dataList2) { + if (!dataSet1.contains(obj)) { + commonData.add(obj); + } + } + } else { + for (String obj : dataList2) { + if (dataSet1.contains(obj)) { + commonData.add(obj); + } + } + } + return commonData; + } + /** * 完成空托盘入库任务 * @param taskHeader 任务 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 7eb79ec..e15eb92 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 @@ -568,6 +568,9 @@ public class QuantityConstant { /** 定时任务执行消息通知配置 */ public static final String RULE_TASK_RUN_NOTICE_CLASS_NAME = "taskRunNoticeClassName"; + /** 自检到异常通知配置 */ + public static final String SELF_CHECK_INFORM = "selfCheckInform"; + public static final int RULE_TASK_NOT_CLEAR = 0; public static final int RULE_TASK_AllOW_CLEAR = 1; diff --git a/huaheng-wms-core/src/main/java/org/jeecg/utils/support/SystemSync.java b/huaheng-wms-core/src/main/java/org/jeecg/utils/support/SystemSync.java index 2cb9be6..149d2b3 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/utils/support/SystemSync.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/utils/support/SystemSync.java @@ -7,18 +7,23 @@ import java.util.concurrent.Future; import javax.annotation.Resource; +import cn.hutool.core.text.StrSpliter; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.WebsocketConst; import org.jeecg.modules.message.websocket.WebSocket; import org.jeecg.modules.system.entity.SysAnnouncement; import org.jeecg.modules.system.entity.SysAnnouncementSend; import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.system.service.impl.SysAnnouncementServiceImpl; +import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; import org.jeecg.utils.HuahengRedisUtil; +import org.jeecg.utils.constant.QuantityConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.AsyncResult; @@ -50,6 +55,12 @@ public class SystemSync { @Autowired private HuahengRedisUtil huahengRedisUtil; + @Resource + private IParameterConfigurationService parameterConfigurationService; + + @Resource + private ISysUserService sysUserService; + /** * 达到累计次数,发送系统消息 * @param userOrRoleList 目标角色或用户ID @@ -70,6 +81,19 @@ public class SystemSync { sysAnnouncementService.quickAnnouncementToUserOrRole(userOrRoleList, title, msg, endTime, level); } + @Async("asyncPoolTaskExecutor") + public void selfCheckData(List<SysUser> userOrRoleList, String title, String msg, Date endTime, String level) { + String userOrRoleString = parameterConfigurationService.getValueByCode(QuantityConstant.SELF_CHECK_INFORM); + List<String> userOrRoles = StrSpliter.split(userOrRoleString, ",", true, true); + LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = Wrappers.lambdaQuery(); + sysUserLambdaQueryWrapper.in(SysUser::getUsername, userOrRoles); + userOrRoleList = sysUserService.list(sysUserLambdaQueryWrapper); + if (CollectionUtils.isEmpty(userOrRoleList)) { + return; + } + sysAnnouncementService.quickAnnouncementToUser(userOrRoleList, title, msg, endTime, level); + } + /** * 登录弹框后发送未读消息 * @param sysUser