Commit aa5aa59a93c65808eaac6b5e110cbf07e46726ae
Merge branch 'develop' of http://172.16.29.40:8010/wms/wms4.git into develop
Showing
15 changed files
with
576 additions
and
34 deletions
ant-design-vue-jeecg/src/api/api.js
... | ... | @@ -286,6 +286,8 @@ export const createBatchShipmentTaskByAgv = (params) => postAction('/shipment/sh |
286 | 286 | export const createShipmentTaskAndAgvTask = (params) => postAction('/shipment/shipmentCombination/createShipmentTaskAndAgvTask', params); |
287 | 287 | //完成平库出库 |
288 | 288 | export const completeFlatShipment = (params) => postAction('/shipment/shipmentCombination/completeFlatShipment', params); |
289 | +//平库入库 | |
290 | +export const flatReceipt = (params) => postAction('/receipt/receiveHeader/flatReceipt', params); | |
289 | 291 | |
290 | 292 | // 中转HTTP请求 |
291 | 293 | export const transitRESTful = { |
... | ... |
ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue
... | ... | @@ -40,8 +40,13 @@ |
40 | 40 | </a-form-item> |
41 | 41 | </a-col> |
42 | 42 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> |
43 | - <a-form-item label="库位编码"> | |
44 | - <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> | |
43 | + <a-form-item label="起始库位编码"> | |
44 | + <a-input placeholder="请输入起始库位编码" v-model="queryParam.fromLocationCode"></a-input> | |
45 | + </a-form-item> | |
46 | + </a-col> | |
47 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
48 | + <a-form-item label="目标库位编码"> | |
49 | + <a-input placeholder="请输入目标库位编码" v-model="queryParam.toLocationCode"></a-input> | |
45 | 50 | </a-form-item> |
46 | 51 | </a-col> |
47 | 52 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> |
... | ... |
ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue
... | ... | @@ -132,7 +132,7 @@ |
132 | 132 | <!-- <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>--> |
133 | 133 | <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> |
134 | 134 | <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> |
135 | - <a-popconfirm v-if="record.status == 0" v-has="'receiptContainerHeader:delete'" title="确定取消配盘吗?" @confirm="() => handleDelete(record.id)"> | |
135 | + <a-popconfirm v-if="record.status == 0" v-has="'receipatContainerHeader:delete'" title="确定取消配盘吗?" @confirm="() => handleDelete(record.id)"> | |
136 | 136 | <a><a-button type="danger">取消配盘</a-button> <a-divider type="vertical"/></a> |
137 | 137 | </a-popconfirm> |
138 | 138 | |
... | ... |
ant-design-vue-jeecg/src/views/system/shipment/ShipmentContainerHeaderList.vue
... | ... | @@ -130,7 +130,7 @@ |
130 | 130 | <a><a-button type="danger">取消配盘</a-button> <a-divider type="vertical"/></a> |
131 | 131 | </a-popconfirm> |
132 | 132 | <a v-has="'shipmentContainerHeader:edit'" @click="handleEdit(record)"><a-button type="default">编辑</a-button> <a-divider type="vertical"/></a> |
133 | - <a v-if="record.status == 10" v-has="'shipmentContainerHeader:reduceInventoryDetailBySn'" @click="openReduce(record)"><a-button type="primary">扣减库存</a-button></a> | |
133 | + <a v-if="record.status == 10 && record.taskType == 400" v-has="'shipmentContainerHeader:reduceInventoryDetailBySn'" @click="openReduce(record)"><a-button type="primary">扣减库存</a-button></a> | |
134 | 134 | </span> |
135 | 135 | </a-table> |
136 | 136 | </div> |
... | ... |
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> { |
18 | 18 | |
19 | 19 | List<Port> getPortListByType(int type, Integer roadWay, String zoneCode, String warehouseCode); |
20 | 20 | |
21 | - Port getPortByCode(String code, Integer roadWay, String zoneCode, String warehouseCode); | |
21 | +// Port getPortByCode(String code, Integer roadWay, String zoneCode, String warehouseCode); | |
22 | + | |
23 | + Port getPortByCode(String code, Integer type, String zoneCode, String warehouseCode); | |
22 | 24 | |
23 | 25 | Port getPortByCode(String code, String zoneCode, String warehouseCode); |
24 | 26 | |
... | ... |
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 |
42 | 42 | } |
43 | 43 | |
44 | 44 | @Override |
45 | - public Port getPortByCode(String code, Integer roadWay, String zoneCode, String warehouseCode) { | |
45 | + public Port getPortByCode(String code, Integer type, String zoneCode, String warehouseCode) { | |
46 | 46 | LambdaQueryWrapper<Port> portLambdaQueryWrapper = Wrappers.lambdaQuery(); |
47 | - portLambdaQueryWrapper.eq(Port::getCode, code).eq(Port::getZoneCode, zoneCode).eq(Port::getWarehouseCode, warehouseCode).in(roadWay != null, | |
48 | - Port::getRoadWay, roadWay); | |
47 | + portLambdaQueryWrapper.eq(Port::getCode, code).eq(Port::getZoneCode, zoneCode).eq(Port::getWarehouseCode, warehouseCode).in(type != null, Port::getType, | |
48 | + type); | |
49 | 49 | Port port = getOne(portLambdaQueryWrapper); |
50 | 50 | return port; |
51 | 51 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/SelfCheck.java
0 → 100644
1 | +package org.jeecg.modules.wms.monitor.job; | |
2 | + | |
3 | +import cn.hutool.core.date.DateUtil; | |
4 | +import com.baomidou.mybatisplus.core.conditions.Wrapper; | |
5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
6 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
7 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
8 | +import lombok.Data; | |
9 | +import lombok.extern.slf4j.Slf4j; | |
10 | +import org.jeecg.common.util.DateUtils; | |
11 | +import org.jeecg.modules.system.service.impl.SysAnnouncementServiceImpl; | |
12 | +import org.jeecg.modules.wms.config.container.entity.Container; | |
13 | +import org.jeecg.modules.wms.config.container.service.IContainerService; | |
14 | +import org.jeecg.modules.wms.config.location.entity.Location; | |
15 | +import org.jeecg.modules.wms.config.location.service.ILocationService; | |
16 | +import org.jeecg.modules.wms.config.locationHigh.service.ILocationHighService; | |
17 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | |
18 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; | |
19 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | |
20 | +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; | |
21 | +import org.jeecg.utils.StringUtils; | |
22 | +import org.jeecg.utils.constant.QuantityConstant; | |
23 | +import org.jeecg.utils.support.SystemSync; | |
24 | +import org.quartz.*; | |
25 | + | |
26 | +import javax.annotation.Resource; | |
27 | +import java.sql.Timestamp; | |
28 | +import java.util.*; | |
29 | +import java.util.stream.Collectors; | |
30 | + | |
31 | +@Slf4j | |
32 | +@PersistJobDataAfterExecution | |
33 | +@DisallowConcurrentExecution | |
34 | +public class SelfCheck implements Job { | |
35 | + | |
36 | + @Resource | |
37 | + private IContainerService containerService; | |
38 | + | |
39 | + @Resource | |
40 | + private ITaskHeaderService taskHeaderService; | |
41 | + | |
42 | + @Resource | |
43 | + private IInventoryHeaderService inventoryHeaderService; | |
44 | + | |
45 | + @Resource | |
46 | + private ILocationService locationService; | |
47 | + | |
48 | + @Resource | |
49 | + private SysAnnouncementServiceImpl sysAnnouncementService; | |
50 | + | |
51 | + @Resource | |
52 | + SystemSync systemSync; | |
53 | + | |
54 | + @Override | |
55 | + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { | |
56 | + log.info(String.format("开始进行自检,时间:" + DateUtils.getTimestamp())); | |
57 | + Timestamp timestamp = DateUtils.getTimestamp(); | |
58 | + List<Container> containerList = new ArrayList<>(); | |
59 | + List<String> container = new ArrayList<>(); | |
60 | + List<TaskHeader> taskHeaderList = new ArrayList<>(); | |
61 | + List<String> taskContainer = new ArrayList<>(); | |
62 | + List<String> common = new ArrayList<>(); | |
63 | + List<String> inventoryContainer = new ArrayList<>(); | |
64 | + List<Location> locationList = new ArrayList<>(); | |
65 | + List<String> locationContainerCode = new ArrayList<>(); | |
66 | + List<String> location = new ArrayList<>(); | |
67 | + List<String> taskLocation = new ArrayList<>(); | |
68 | + Map<String, String> map = new HashMap<>(); | |
69 | + Map<String, String> map2 = new HashMap<>(); | |
70 | + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
71 | + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
72 | + LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
73 | + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
74 | + // 锁定的容器查看是否有任务 | |
75 | + containerLambdaQueryWrapper.eq(Container::getStatus, QuantityConstant.STATUS_CONTAINER_LOCK); | |
76 | + containerList = containerService.list(containerLambdaQueryWrapper); | |
77 | + if (!CollectionUtils.isEmpty(containerList)) { | |
78 | + container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
79 | + taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); | |
80 | + taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); | |
81 | + // 是否有任务 | |
82 | + if (!CollectionUtils.isEmpty(taskHeaderList)) { | |
83 | + taskContainer = taskHeaderList.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); | |
84 | + common = taskHeaderService.findCommonData(taskContainer, container, true); | |
85 | + if (!CollectionUtils.isEmpty(common)) { | |
86 | + log.info("自检完成,容器:" + common + "已锁定,但不存在任务"); | |
87 | + String msg = "容器:" + common + "已锁定,但不存在任务"; | |
88 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
89 | + } | |
90 | + } else { | |
91 | + log.info("自检完成,容器:" + container + "已锁定,但不存在任务"); | |
92 | + String msg = "容器:" + container + "已锁定,但不存在任务"; | |
93 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
94 | + } | |
95 | + } | |
96 | + // 空闲的容器查看是否有任务 | |
97 | +// containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
98 | +// containerLambdaQueryWrapper.eq(Container::getStatus, QuantityConstant.STATUS_CONTAINER_EMPTY); | |
99 | +// containerList = containerService.list(containerLambdaQueryWrapper); | |
100 | +// if (!CollectionUtils.isEmpty(containerList)) { | |
101 | +// container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
102 | +// taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
103 | +// taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); | |
104 | +// taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); | |
105 | +// taskContainer = taskHeaderList.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); | |
106 | +// common = taskHeaderService.findCommonData(container, taskContainer, false); | |
107 | +// if (!CollectionUtils.isEmpty(common)) { | |
108 | +// log.info("自检完成,容器:" + common + "是空闲,但存在任务"); | |
109 | +// String msg = "容器:" + common + "是空闲,但存在任务"; | |
110 | +// systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
111 | +// } | |
112 | +// } | |
113 | + // 有货或满盘的容器 查看是否有库存 | |
114 | + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
115 | + containerLambdaQueryWrapper.in(Container::getFillStatus, QuantityConstant.STATUS_CONTAINER_FILL_SOME, QuantityConstant.STATUS_CONTAINER_FILL_FULL); | |
116 | + containerList = containerService.list(containerLambdaQueryWrapper); | |
117 | + if (!CollectionUtils.isEmpty(containerList)) { | |
118 | + container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
119 | + List<InventoryHeader> inventoryHeaders = inventoryHeaderService.list(inventoryHeaderLambdaQueryWrapper); | |
120 | + if (!CollectionUtils.isEmpty(inventoryHeaders)) { | |
121 | + inventoryContainer = inventoryHeaders.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); | |
122 | + common = taskHeaderService.findCommonData(inventoryContainer, container, true); | |
123 | + if (!CollectionUtils.isEmpty(common)) { | |
124 | + log.info("自检完成,容器:" + common + "状态是有货,但没有库存"); | |
125 | + String msg = "容器:" + common + "状态是有货,但没有库存"; | |
126 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
127 | + } | |
128 | + } else { | |
129 | + log.info("自检完成,容器:" + container + "状态是有货,但没有库存"); | |
130 | + String msg = "容器:" + container + "状态是有货,但没有库存"; | |
131 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
132 | + } | |
133 | + } | |
134 | + // 空盘容器 是否有库存 | |
135 | + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
136 | + containerLambdaQueryWrapper.in(Container::getFillStatus, QuantityConstant.STATUS_CONTAINER_EMPTY, QuantityConstant.STATUS_CONTAINER_FILL_MANY); | |
137 | + containerList = containerService.list(containerLambdaQueryWrapper); | |
138 | + if (!CollectionUtils.isEmpty(containerList)) { | |
139 | + container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
140 | + List<InventoryHeader> inventoryHeaders = inventoryHeaderService.list(inventoryHeaderLambdaQueryWrapper); | |
141 | + if (!CollectionUtils.isEmpty(inventoryHeaders)) { | |
142 | + inventoryContainer = inventoryHeaders.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); | |
143 | + common = taskHeaderService.findCommonData(container, inventoryContainer, false); | |
144 | + if (!CollectionUtils.isEmpty(common)) { | |
145 | + log.info("自检完成,容器:" + common + "状态是空盘,但存在库存"); | |
146 | + String msg = "容器:" + common + "状态是空盘,但存在库存"; | |
147 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
148 | + } | |
149 | + } | |
150 | + } | |
151 | + // 容器有库位=对应库位有这个容器 | |
152 | + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
153 | + containerLambdaQueryWrapper.ne(Container::getLocationCode, QuantityConstant.EMPTY_STRING); | |
154 | + containerList = containerService.list(containerLambdaQueryWrapper); | |
155 | + if (!CollectionUtils.isEmpty(containerList)) { | |
156 | + common = new ArrayList<>(); | |
157 | + for (Container container1 : containerList) { | |
158 | + map.put(container1.getCode(), container1.getLocationCode()); | |
159 | + } | |
160 | + locationLambdaQueryWrapper.ne(Location::getContainerCode, QuantityConstant.EMPTY_STRING); | |
161 | + locationList = locationService.list(locationLambdaQueryWrapper); | |
162 | + if (!CollectionUtils.isEmpty(locationList)) { | |
163 | + for (Location location1 : locationList) { | |
164 | + map2.put(location1.getContainerCode(), location1.getCode()); | |
165 | + } | |
166 | + for (Map.Entry<String, String> stringStringEntry : map.entrySet()) { | |
167 | + String key = stringStringEntry.getKey(); | |
168 | + if (map2.get(key) == null) { | |
169 | + common.add(key); | |
170 | + } else { | |
171 | + // 如果键存在于map2中,执行相应操作 | |
172 | + String value1 = stringStringEntry.getValue(); | |
173 | + String value2 = map2.get(key); | |
174 | + if (!value1.equals(value2)) { | |
175 | + // 值不相同的处理逻辑 | |
176 | + common.add(key); | |
177 | + } | |
178 | + } | |
179 | + } | |
180 | + if (!CollectionUtils.isEmpty(common)) { | |
181 | + log.info("自检完成,容器:" + common + "对应的库位和库位表中的不一致"); | |
182 | + String msg = "容器:" + common + "对应的库位和库位表中的不一致"; | |
183 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
184 | + } | |
185 | + } else { | |
186 | + container = containerList.stream().map(i ->i.getCode()).collect(Collectors.toList()); | |
187 | + log.info("自检完成,容器:" + container + " 对应的库位和库位表中的不一致"); | |
188 | + String msg = "容器:" + container + " 对应的库位和库位表中的不一致"; | |
189 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
190 | + } | |
191 | + } | |
192 | + // 容器有库位 查看库位是否有容器 | |
193 | +// containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
194 | +// containerLambdaQueryWrapper.ne(Container::getLocationCode, QuantityConstant.EMPTY_STRING); | |
195 | +// containerList = containerService.list(containerLambdaQueryWrapper); | |
196 | +// if (!CollectionUtils.isEmpty(containerList)) { | |
197 | +// container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
198 | +// locationLambdaQueryWrapper.ne(Location::getContainerCode, QuantityConstant.EMPTY_STRING); | |
199 | +// locationList = locationService.list(locationLambdaQueryWrapper); | |
200 | +// if (!CollectionUtils.isEmpty(locationList)) { | |
201 | +// locationContainerCode = locationList.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); | |
202 | +// common = taskHeaderService.findCommonData(locationContainerCode, container, true); | |
203 | +// if (!CollectionUtils.isEmpty(common)) { | |
204 | +// log.info("自检完成,容器:" + common + "有库位信息,但库位没有容器信息"); | |
205 | +// String msg = "容器:" + common + "有库位信息,但库位没有容器信息"; | |
206 | +// systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
207 | +// } | |
208 | +// } else { | |
209 | +// log.info("自检完成,容器:" + container + "有库位信息,但库位没有容器信息"); | |
210 | +// String msg = "容器:" + common + "有库位信息,但库位没有容器信息"; | |
211 | +// systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
212 | +// } | |
213 | +// } | |
214 | + // 容器没库位 查看库位是否有容器 | |
215 | + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
216 | + containerLambdaQueryWrapper.eq(Container::getLocationCode, QuantityConstant.EMPTY_STRING); | |
217 | + containerList = containerService.list(containerLambdaQueryWrapper); | |
218 | + if (!CollectionUtils.isEmpty(containerList)) { | |
219 | + container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
220 | + locationLambdaQueryWrapper.ne(Location::getContainerCode, QuantityConstant.EMPTY_STRING); | |
221 | + locationList = locationService.list(locationLambdaQueryWrapper); | |
222 | + if (!CollectionUtils.isEmpty(locationList)) { | |
223 | + locationContainerCode = locationList.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); | |
224 | + common = taskHeaderService.findCommonData(container, locationContainerCode, false); | |
225 | + if (!CollectionUtils.isEmpty(common)) { | |
226 | + log.info("自检完成,容器:" + common + "没有库位信息,但库位有容器信息"); | |
227 | + String msg = "容器:" + common + "没有库位信息,但库位有容器信息"; | |
228 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
229 | + } | |
230 | + } | |
231 | + } | |
232 | + // 库位空闲,查看是否有任务 | |
233 | +// locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
234 | +// locationLambdaQueryWrapper.eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY); | |
235 | +// locationList = locationService.list(locationLambdaQueryWrapper); | |
236 | +// taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); | |
237 | +// taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); | |
238 | +// // 是否有任务 | |
239 | +// if (!CollectionUtils.isEmpty(taskHeaderList)) { | |
240 | +// if (!CollectionUtils.isEmpty(locationList)) { | |
241 | +// location = locationList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
242 | +// taskLocation = (taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getToLocationCode())).collect(Collectors.toList())).stream() | |
243 | +// .map(t -> t.getToLocationCode()).collect(Collectors.toList()); | |
244 | +// taskLocation.addAll((taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getFromLocationCode())).collect(Collectors.toList())).stream() | |
245 | +// .map(t -> t.getFromLocationCode()).collect(Collectors.toList())); | |
246 | +// common = taskHeaderService.findCommonData(location, taskLocation, false); | |
247 | +// if (!CollectionUtils.isEmpty(common)) { | |
248 | +// log.info("自检完成,库位:" + common + "是空闲,但存在任务"); | |
249 | +// String msg = "库位:" + common + "是空闲,但存在任务"; | |
250 | +// systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
251 | +// } | |
252 | +// } | |
253 | +// } | |
254 | + // 库位锁定,查看是否有任务 | |
255 | + locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
256 | + locationLambdaQueryWrapper.eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_LOCK); | |
257 | + locationList = locationService.list(locationLambdaQueryWrapper); | |
258 | + taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); | |
259 | + taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); | |
260 | + if (!CollectionUtils.isEmpty(locationList)) { | |
261 | + location = locationList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
262 | + if (!CollectionUtils.isEmpty(taskHeaderList)) { | |
263 | + taskLocation = (taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getToLocationCode())).collect(Collectors.toList())).stream() | |
264 | + .map(t -> t.getToLocationCode()).collect(Collectors.toList()); | |
265 | + taskLocation.addAll((taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getFromLocationCode())).collect(Collectors.toList())).stream() | |
266 | + .map(t -> t.getFromLocationCode()).collect(Collectors.toList())); | |
267 | + if (!CollectionUtils.isEmpty(taskLocation)) { | |
268 | + common = taskHeaderService.findCommonData(taskLocation, location, true); | |
269 | + if (!CollectionUtils.isEmpty(common)) { | |
270 | + log.info("自检完成,库位:" + common + "已锁定,但不存在任务"); | |
271 | + String msg = "库位:" + common + "已锁定,但不存在任务"; | |
272 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
273 | + } | |
274 | + } else { | |
275 | + log.info("自检完成,库位:" + location + "已锁定,但不存在任务"); | |
276 | + String msg = "库位:" + location + "已锁定,但不存在任务"; | |
277 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
278 | + } | |
279 | + } else { | |
280 | + log.info("自检完成,库位:" + location + "已锁定,但不存在任务"); | |
281 | + String msg = "库位:" + location + "已锁定,但不存在任务"; | |
282 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
283 | + } | |
284 | + } | |
285 | + // 库位有容器,查看容器是否有库位 | |
286 | + locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
287 | + locationLambdaQueryWrapper.ne(Location::getContainerCode, QuantityConstant.EMPTY_STRING); | |
288 | + locationList = locationService.list(locationLambdaQueryWrapper); | |
289 | + if (!CollectionUtils.isEmpty(locationList)) { | |
290 | + locationContainerCode = locationList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
291 | + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
292 | + containerLambdaQueryWrapper.ne(Container::getLocationCode, QuantityConstant.EMPTY_STRING); | |
293 | + containerList = containerService.list(containerLambdaQueryWrapper); | |
294 | + if (!CollectionUtils.isEmpty(containerList)) { | |
295 | + container = containerList.stream().map(i -> i.getLocationCode()).collect(Collectors.toList()); | |
296 | + common = taskHeaderService.findCommonData(container, locationContainerCode, true); | |
297 | + if (!CollectionUtils.isEmpty(common)) { | |
298 | + log.info("自检完成,库位:" + common + "有容器信息,但容器没有库位信息"); | |
299 | + String msg = "库位:" + common + "有容器信息,但容器没有库位信息"; | |
300 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
301 | + } | |
302 | + } else { | |
303 | + log.info("自检完成,库位:" + locationContainerCode + "有容器信息,但容器没有库位信息"); | |
304 | + String msg = "库位:" + locationContainerCode + "有容器信息,但容器没有库位信息"; | |
305 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
306 | + } | |
307 | + } | |
308 | + // 库位没有容器,查看容器是否有这个库位 | |
309 | + locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
310 | + locationLambdaQueryWrapper.eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING); | |
311 | + locationList = locationService.list(locationLambdaQueryWrapper); | |
312 | + if (!CollectionUtils.isEmpty(locationList)) { | |
313 | + locationContainerCode = locationList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
314 | + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
315 | + containerLambdaQueryWrapper.ne(Container::getLocationCode, QuantityConstant.EMPTY_STRING); | |
316 | + containerList = containerService.list(containerLambdaQueryWrapper); | |
317 | + if (!CollectionUtils.isEmpty(containerList)) { | |
318 | + container = containerList.stream().map(i -> i.getLocationCode()).collect(Collectors.toList()); | |
319 | + common = taskHeaderService.findCommonData(locationContainerCode, container, true); | |
320 | + if (!CollectionUtils.isEmpty(common)) { | |
321 | + log.info("自检完成,库位:" + common + "没有容器信息,但容器有库位信息"); | |
322 | + String msg = "库位:" + common + "没有容器信息,但容器有库位信息"; | |
323 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
324 | + } | |
325 | + } | |
326 | + } | |
327 | + // 存在有任务,查看容器库位是否锁定 | |
328 | + taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
329 | + taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); | |
330 | + taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); | |
331 | + if (!CollectionUtils.isEmpty(taskHeaderList)) { | |
332 | + taskContainer = taskHeaderList.stream().map(i -> i.getContainerCode()).collect(Collectors.toList()); | |
333 | + taskLocation = (taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getToLocationCode())).collect(Collectors.toList())).stream() | |
334 | + .map(t -> t.getToLocationCode()).collect(Collectors.toList()); | |
335 | + taskLocation.addAll((taskHeaderList.stream().filter(i -> StringUtils.isNotEmpty(i.getFromLocationCode())).collect(Collectors.toList())).stream() | |
336 | + .map(t -> t.getFromLocationCode()).collect(Collectors.toList())); | |
337 | + if (!CollectionUtils.isEmpty(taskContainer)) { | |
338 | + containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
339 | + containerLambdaQueryWrapper.eq(Container::getStatus, QuantityConstant.STATUS_CONTAINER_LOCK); | |
340 | + containerList = containerService.list(containerLambdaQueryWrapper); | |
341 | + if (!CollectionUtils.isEmpty(containerList)) { | |
342 | + container = containerList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
343 | + common = taskHeaderService.findCommonData(container, taskContainer, true); | |
344 | + if (!CollectionUtils.isEmpty(common)) { | |
345 | + log.info("自检完成,容器:" + common + "存在任务,但容器未锁定"); | |
346 | + String msg = "容器:" + common + "存在任务,但容器未锁定"; | |
347 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
348 | + } | |
349 | + } else { | |
350 | + log.info("自检完成,容器:" + taskContainer + "存在任务,但容器未锁定"); | |
351 | + String msg = "容器:" + taskContainer + "存在任务,但容器未锁定"; | |
352 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
353 | + } | |
354 | + } | |
355 | + if (!CollectionUtils.isEmpty(taskLocation)) { | |
356 | + locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
357 | + locationLambdaQueryWrapper.eq(Location::getStatus, QuantityConstant.STATUS_CONTAINER_LOCK); | |
358 | + locationList = locationService.list(locationLambdaQueryWrapper); | |
359 | + if (!CollectionUtils.isEmpty(locationList)) { | |
360 | + location = locationList.stream().map(i -> i.getCode()).collect(Collectors.toList()); | |
361 | + common = taskHeaderService.findCommonData(location, taskLocation, true); | |
362 | + if (!CollectionUtils.isEmpty(common)) { | |
363 | + log.info("自检完成,库位:" + common + "存在任务,但库位未锁定"); | |
364 | + String msg = "库位:" + common + "存在任务,但库位未锁定"; | |
365 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
366 | + } | |
367 | + } else { | |
368 | + log.info("自检完成,库位:" + locationList + "存在任务,但库位未锁定"); | |
369 | + String msg = "库位:" + locationList + "存在任务,但库位未锁定"; | |
370 | + systemSync.selfCheckData(null, msg, msg, DateUtil.offsetDay(new Date(), 1), "H"); | |
371 | + } | |
372 | + } | |
373 | + } | |
374 | + Timestamp timestamp1 = DateUtils.getTimestamp(); | |
375 | + log.info(String.format("自检完成,开始时间:" + timestamp)); | |
376 | + log.info(String.format("自检完成,结束时间:" + timestamp1)); | |
377 | + } | |
378 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java
1 | 1 | package org.jeecg.modules.wms.receipt.receiptContainerHeader.controller; |
2 | 2 | |
3 | 3 | import java.io.IOException; |
4 | +import java.util.ArrayList; | |
4 | 5 | import java.util.Arrays; |
5 | 6 | import java.util.List; |
6 | 7 | import java.util.Map; |
... | ... | @@ -14,6 +15,7 @@ import org.apache.shiro.SecurityUtils; |
14 | 15 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
15 | 16 | import org.jeecg.common.api.vo.Result; |
16 | 17 | import org.jeecg.common.aspect.annotation.AutoLog; |
18 | +import org.jeecg.common.exception.JeecgBootException; | |
17 | 19 | import org.jeecg.common.system.base.controller.JeecgController; |
18 | 20 | import org.jeecg.common.system.query.QueryGenerator; |
19 | 21 | import org.jeecg.common.system.vo.LoginUser; |
... | ... | @@ -45,6 +47,7 @@ import org.springframework.web.servlet.ModelAndView; |
45 | 47 | |
46 | 48 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
47 | 49 | import com.baomidou.mybatisplus.core.metadata.IPage; |
50 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
48 | 51 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
49 | 52 | |
50 | 53 | import io.swagger.annotations.Api; |
... | ... | @@ -357,6 +360,33 @@ public class ReceiptContainerHeaderController extends JeecgController<ReceiptCon |
357 | 360 | @ResponseBody |
358 | 361 | public Result createReceiptBatchTask(@RequestBody List<ReceiptContainerHeader> receiptContainerHeaderList, HttpServletRequest req) { |
359 | 362 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); |
363 | + if (CollectionUtils.isEmpty(receiptContainerHeaderList)) { | |
364 | + return Result.error("批量创建入库任务失败,没有组盘明细"); | |
365 | + } | |
366 | + String toPort = receiptContainerHeaderList.get(0).getToPort(); | |
367 | + if (StringUtils.isEmpty(toPort)) { | |
368 | + return Result.error("批量创建入库任务失败,没有去向"); | |
369 | + } | |
370 | + List<ReceiptContainerHeader> removeList = new ArrayList<>(); | |
371 | + for (ReceiptContainerHeader receiptContainerHeader : receiptContainerHeaderList) { | |
372 | + String fromLocationCode = receiptContainerHeader.getFromLocationCode(); | |
373 | + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); | |
374 | + if (fromLocation == null) { | |
375 | + throw new JeecgBootException("批量创建入库任务失败,没有找到库位" + fromLocationCode); | |
376 | + } | |
377 | + int roadWay = fromLocation.getRoadWay(); | |
378 | + String zoneCode = fromLocation.getZoneCode(); | |
379 | + List<Port> portList = portService.getPortListByType(QuantityConstant.PORT_TYPE_PICK, roadWay, zoneCode, warehouseCode); | |
380 | + if (CollectionUtils.isEmpty(portList)) { | |
381 | + removeList.add(receiptContainerHeader); | |
382 | + continue; | |
383 | + } | |
384 | + List<String> portCodeList = portList.stream().map(Port::getCode).collect(Collectors.toList()); | |
385 | + if (!portCodeList.contains(toPort)) { | |
386 | + removeList.add(receiptContainerHeader); | |
387 | + } | |
388 | + } | |
389 | + receiptContainerHeaderList.removeAll(removeList); | |
360 | 390 | for (ReceiptContainerHeader receiptContainerHeader : receiptContainerHeaderList) { |
361 | 391 | Result result = huahengMultiHandlerService.createReceiptTask(receiptContainerHeader, warehouseCode); |
362 | 392 | if (!result.isSuccess()) { |
... | ... |
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; |
15 | 15 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
16 | 16 | import org.jeecg.modules.wms.config.location.service.ILocationService; |
17 | 17 | import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; |
18 | +import org.jeecg.modules.wms.config.zone.entity.Zone; | |
19 | +import org.jeecg.modules.wms.config.zone.service.IZoneService; | |
18 | 20 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; |
19 | 21 | import org.jeecg.modules.wms.lockStation.service.ILockStationService; |
20 | 22 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; |
... | ... | @@ -94,6 +96,8 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
94 | 96 | |
95 | 97 | @Resource |
96 | 98 | private ILockStationService lockStationService; |
99 | + @Resource | |
100 | + private IZoneService zoneService; | |
97 | 101 | |
98 | 102 | @Override |
99 | 103 | @Transactional |
... | ... | @@ -146,6 +150,10 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
146 | 150 | if (StringUtils.isEmpty(zoneCode)) { |
147 | 151 | return Result.error("容器没有配置库区,请配置!"); |
148 | 152 | } |
153 | + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); | |
154 | + if (zone == null) { | |
155 | + return Result.error("库区:" + zoneCode + " 信息为空"); | |
156 | + } | |
149 | 157 | boolean success = false; |
150 | 158 | List<ReceiptContainerDetail> receiptContainerDetailList = |
151 | 159 | receiptContainerDetailService.getReceiptContainerDetailListByHeaderId(receiptContainerHeader.getId()); |
... | ... | @@ -185,6 +193,11 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
185 | 193 | taskHeader.setWarehouseCode(warehouseCode); |
186 | 194 | taskHeader.setZoneCode(zoneCode); |
187 | 195 | taskHeader.setToPortCode(toPort); |
196 | + if (StringUtils.isNotEmpty(zone.getType())) { | |
197 | + if (zone.getType().equals(QuantityConstant.ZONE_TYPE_AGV)) { | |
198 | + taskHeader.setToWcs(QuantityConstant.NOT_TO_WCS); | |
199 | + } | |
200 | + } | |
188 | 201 | success = taskHeaderService.save(taskHeader); |
189 | 202 | if (!success) { |
190 | 203 | throw new JeecgBootException("创建入库任务, 任务生成失败"); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentCombination.controller; |
2 | 2 | |
3 | 3 | import java.math.BigDecimal; |
4 | +import java.util.ArrayList; | |
4 | 5 | import java.util.List; |
6 | +import java.util.stream.Collectors; | |
5 | 7 | |
6 | 8 | import javax.annotation.Resource; |
7 | 9 | import javax.servlet.http.HttpServletRequest; |
8 | 10 | |
9 | 11 | import org.jeecg.common.api.vo.Result; |
10 | 12 | import org.jeecg.common.aspect.annotation.AutoLog; |
13 | +import org.jeecg.common.exception.JeecgBootException; | |
11 | 14 | import org.jeecg.modules.wms.config.location.entity.Location; |
12 | 15 | import org.jeecg.modules.wms.config.location.service.ILocationService; |
13 | 16 | import org.jeecg.modules.wms.config.port.entity.Port; |
... | ... | @@ -33,6 +36,7 @@ import org.jeecg.utils.constant.QuantityConstant; |
33 | 36 | import org.springframework.web.bind.annotation.*; |
34 | 37 | |
35 | 38 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
39 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
36 | 40 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
37 | 41 | |
38 | 42 | import io.swagger.annotations.Api; |
... | ... | @@ -133,6 +137,38 @@ public class ShipmentCombinationController extends HuahengBaseController { |
133 | 137 | @ResponseBody |
134 | 138 | public Result createShipmentBatchTask(@RequestBody List<ShipmentContainerHeader> shipmentContainerHeaderList, HttpServletRequest req) { |
135 | 139 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); |
140 | + if (CollectionUtils.isEmpty(shipmentContainerHeaderList)) { | |
141 | + return Result.error("批量创建出库任务失败,没有组盘明细"); | |
142 | + } | |
143 | + String toPort = shipmentContainerHeaderList.get(0).getToPort(); | |
144 | + if (StringUtils.isEmpty(toPort)) { | |
145 | + return Result.error("批量创建出库任务失败,没有去向"); | |
146 | + } | |
147 | + List<ShipmentContainerHeader> removeList = new ArrayList<>(); | |
148 | + for (ShipmentContainerHeader shipmentContainerHeader : shipmentContainerHeaderList) { | |
149 | + String fromLocationCode = shipmentContainerHeader.getFromLocationCode(); | |
150 | + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); | |
151 | + if (fromLocation == null) { | |
152 | + throw new JeecgBootException("批量创建出库任务失败,没有找到库位" + fromLocationCode); | |
153 | + } | |
154 | + int roadWay = fromLocation.getRoadWay(); | |
155 | + String zoneCode = fromLocation.getZoneCode(); | |
156 | + int taskType = shipmentContainerHeader.getTaskType(); | |
157 | + int portType = QuantityConstant.PORT_TYPE_PICK; | |
158 | + if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { | |
159 | + portType = QuantityConstant.PORT_TYPE_OUT; | |
160 | + } | |
161 | + List<Port> portList = portService.getPortListByType(portType, roadWay, zoneCode, warehouseCode); | |
162 | + if (CollectionUtils.isEmpty(portList)) { | |
163 | + removeList.add(shipmentContainerHeader); | |
164 | + continue; | |
165 | + } | |
166 | + List<String> portCodeList = portList.stream().map(Port::getCode).collect(Collectors.toList()); | |
167 | + if (!portCodeList.contains(toPort)) { | |
168 | + removeList.add(shipmentContainerHeader); | |
169 | + } | |
170 | + } | |
171 | + shipmentContainerHeaderList.removeAll(removeList); | |
136 | 172 | for (ShipmentContainerHeader shipmentContainerHeader : shipmentContainerHeaderList) { |
137 | 173 | Result result = huahengMultiHandlerService.createShipmentTask(shipmentContainerHeader, warehouseCode, 0, 0, 0); |
138 | 174 | if (!result.isSuccess()) { |
... | ... |
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> { |
437 | 437 | */ |
438 | 438 | Result qualityRegister(int id, BigDecimal qualityfiedQty, BigDecimal unqualityfiedQty, String remark); |
439 | 439 | |
440 | + /** | |
441 | + * 自检数据 | |
442 | + */ | |
443 | + List<String> findCommonData(List<String> dataList1, List<String> dataList2, boolean flag); | |
444 | + | |
440 | 445 | } |
... | ... |
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 |
356 | 356 | if (StringUtils.isEmpty(containerCode)) { |
357 | 357 | return Result.error("创建出库查看任务时,容器编码为空"); |
358 | 358 | } |
359 | + | |
360 | + //创建出库查看任务时,库存不能被冻结 | |
361 | + LambdaQueryWrapper<InventoryDetail> inventoryDetailWrapper = Wrappers.lambdaQuery(); | |
362 | + inventoryDetailWrapper.eq(InventoryDetail::getContainerCode,containerCode); | |
363 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailWrapper); | |
364 | + if (StringUtils.isEmpty(inventoryDetailList)) { | |
365 | + return Result.error("创建出库查看任务时,库存详情为空"); | |
366 | + } | |
367 | + List<Integer> enableList = inventoryDetailList.stream().map(InventoryDetail::getEnable).distinct().collect(Collectors.toList()); | |
368 | + if (enableList.contains(QuantityConstant.INVENTORY_DETAIL_STATUS_CONTAINER)) { | |
369 | + return Result.error("创建出库查看任务时,库存详情被冻结"); | |
370 | + } | |
371 | + | |
359 | 372 | if (StringUtils.isEmpty(toPortCode)) { |
360 | 373 | return Result.error("创建出库查看任务时,目标站台号为空"); |
361 | 374 | } |
... | ... | @@ -450,7 +463,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
450 | 463 | } |
451 | 464 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); |
452 | 465 | String zoneCode = taskLockEntity.getZoneCode(); |
453 | - Port port = portService.getPortByCode(toPortCode, zoneCode, warehouseCode); | |
466 | + Port port = portService.getPortByCode(toPortCode, QuantityConstant.PORT_TYPE_PICK, zoneCode, warehouseCode); | |
454 | 467 | if (port == null) { |
455 | 468 | throw new JeecgBootException("创建质检任务失败,没有找到出库口:" + toPortCode); |
456 | 469 | } |
... | ... | @@ -476,24 +489,30 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
476 | 489 | List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); |
477 | 490 | List<TaskDetail> taskDetailList = new ArrayList<>(); |
478 | 491 | if (inventoryDetailList.size() != 0) { |
492 | + List<Integer> enableList = inventoryDetailList.stream().map(InventoryDetail::getEnable).distinct().collect(Collectors.toList()); | |
493 | + if (!enableList.contains(QuantityConstant.INVENTORY_DETAIL_STATUS_ENABLE)) { | |
494 | + return Result.error("没有正常状态的库存详情"); | |
495 | + } | |
479 | 496 | for (InventoryDetail inventoryDetail : inventoryDetailList) { |
480 | - TaskDetail taskDetail = new TaskDetail(); | |
481 | - taskDetail.setTaskHeaderId(taskHeader.getId()); | |
482 | - taskDetail.setTaskType(QuantityConstant.TASK_TYPE_QUALITY); | |
483 | - taskDetail.setWarehouseCode(warehouseCode); | |
484 | - taskDetail.setCompanyCode(inventoryDetail.getCompanyCode()); | |
485 | - taskDetail.setMaterialCode(inventoryDetail.getMaterialCode()); | |
486 | - taskDetail.setMaterialName(inventoryDetail.getMaterialName()); | |
487 | - taskDetail.setMaterialSpec(inventoryDetail.getMaterialSpec()); | |
488 | - taskDetail.setMaterialUnit(inventoryDetail.getMaterialUnit()); | |
489 | - taskDetail.setFromInventoryDetailId(inventoryDetail.getId()); | |
490 | - taskDetail.setInventoryStatus(inventoryDetail.getInventoryStatus()); | |
491 | - taskDetail.setQty(inventoryDetail.getQty()); | |
492 | - taskDetail.setBatch(inventoryDetail.getBatch()); | |
493 | - taskDetail.setLot(inventoryDetail.getLot()); | |
494 | - taskDetail.setProject(inventoryDetail.getProject()); | |
495 | - taskDetail.setReceiveTime(inventoryDetail.getReceiveTime()); | |
496 | - taskDetailList.add(taskDetail); | |
497 | + if (inventoryDetail.getEnable() == QuantityConstant.INVENTORY_DETAIL_STATUS_ENABLE) { | |
498 | + TaskDetail taskDetail = new TaskDetail(); | |
499 | + taskDetail.setTaskHeaderId(taskHeader.getId()); | |
500 | + taskDetail.setTaskType(QuantityConstant.TASK_TYPE_QUALITY); | |
501 | + taskDetail.setWarehouseCode(warehouseCode); | |
502 | + taskDetail.setCompanyCode(inventoryDetail.getCompanyCode()); | |
503 | + taskDetail.setMaterialCode(inventoryDetail.getMaterialCode()); | |
504 | + taskDetail.setMaterialName(inventoryDetail.getMaterialName()); | |
505 | + taskDetail.setMaterialSpec(inventoryDetail.getMaterialSpec()); | |
506 | + taskDetail.setMaterialUnit(inventoryDetail.getMaterialUnit()); | |
507 | + taskDetail.setFromInventoryDetailId(inventoryDetail.getId()); | |
508 | + taskDetail.setInventoryStatus(inventoryDetail.getInventoryStatus()); | |
509 | + taskDetail.setQty(inventoryDetail.getQty()); | |
510 | + taskDetail.setBatch(inventoryDetail.getBatch()); | |
511 | + taskDetail.setLot(inventoryDetail.getLot()); | |
512 | + taskDetail.setProject(inventoryDetail.getProject()); | |
513 | + taskDetail.setReceiveTime(inventoryDetail.getReceiveTime()); | |
514 | + taskDetailList.add(taskDetail); | |
515 | + } | |
497 | 516 | } |
498 | 517 | success = taskDetailService.saveBatch(taskDetailList); |
499 | 518 | if (!success) { |
... | ... | @@ -1041,10 +1060,13 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1041 | 1060 | break; |
1042 | 1061 | } |
1043 | 1062 | taskHeaderService.cancelLocationAndContainerStatus(taskHeader); |
1044 | - if (taskHeader.getStatus().intValue() > QuantityConstant.TASK_STATUS_BUILD) { | |
1045 | - result = wcsService.cancelWcsTask(taskHeader); | |
1046 | - if (!result.isSuccess()) { | |
1047 | - throw new JeecgBootException(result.getMessage()); | |
1063 | + int toWcs = taskHeader.getToWcs(); | |
1064 | + if (toWcs == QuantityConstant.TO_WCS) { | |
1065 | + if (taskHeader.getStatus().intValue() > QuantityConstant.TASK_STATUS_BUILD) { | |
1066 | + result = wcsService.cancelWcsTask(taskHeader); | |
1067 | + if (!result.isSuccess()) { | |
1068 | + throw new JeecgBootException(result.getMessage()); | |
1069 | + } | |
1048 | 1070 | } |
1049 | 1071 | } |
1050 | 1072 | if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(taskHeader.getContainerCode(), taskHeader.getWarehouseCode())) { |
... | ... | @@ -1076,9 +1098,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1076 | 1098 | if (taskHeader.getStatus() >= QuantityConstant.TASK_STATUS_RELEASE) { |
1077 | 1099 | return Result.error("下发wcs任务时, 任务" + taskId + "已经下发,请不要重复下发,操作中止"); |
1078 | 1100 | } |
1079 | - Result result = wcsService.wcsTaskAssign(taskHeader); | |
1080 | - if (!result.isSuccess()) { | |
1081 | - return Result.error(result.getMessage()); | |
1101 | + int toWcs = taskHeader.getToWcs(); | |
1102 | + if (toWcs == QuantityConstant.TO_WCS) { | |
1103 | + Result result = wcsService.wcsTaskAssign(taskHeader); | |
1104 | + if (!result.isSuccess()) { | |
1105 | + return Result.error(result.getMessage()); | |
1106 | + } | |
1082 | 1107 | } |
1083 | 1108 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_RELEASE); |
1084 | 1109 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_RELEASE, taskHeader.getId()); |
... | ... | @@ -2332,6 +2357,26 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2332 | 2357 | return Result.ok("质检登记成功"); |
2333 | 2358 | } |
2334 | 2359 | |
2360 | + @Override | |
2361 | + public List<String> findCommonData(List<String> dataList1, List<String> dataList2, boolean flag) { | |
2362 | + Set<String> dataSet1 = new HashSet<>(dataList1); | |
2363 | + List<String> commonData = new ArrayList<>(); | |
2364 | + if (flag) { | |
2365 | + for (String obj : dataList2) { | |
2366 | + if (!dataSet1.contains(obj)) { | |
2367 | + commonData.add(obj); | |
2368 | + } | |
2369 | + } | |
2370 | + } else { | |
2371 | + for (String obj : dataList2) { | |
2372 | + if (dataSet1.contains(obj)) { | |
2373 | + commonData.add(obj); | |
2374 | + } | |
2375 | + } | |
2376 | + } | |
2377 | + return commonData; | |
2378 | + } | |
2379 | + | |
2335 | 2380 | /** |
2336 | 2381 | * 完成空托盘入库任务 |
2337 | 2382 | * @param taskHeader 任务 |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java
... | ... | @@ -568,6 +568,9 @@ public class QuantityConstant { |
568 | 568 | /** 定时任务执行消息通知配置 */ |
569 | 569 | public static final String RULE_TASK_RUN_NOTICE_CLASS_NAME = "taskRunNoticeClassName"; |
570 | 570 | |
571 | + /** 自检到异常通知配置 */ | |
572 | + public static final String SELF_CHECK_INFORM = "selfCheckInform"; | |
573 | + | |
571 | 574 | public static final int RULE_TASK_NOT_CLEAR = 0; |
572 | 575 | public static final int RULE_TASK_AllOW_CLEAR = 1; |
573 | 576 | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/support/SystemSync.java
... | ... | @@ -7,18 +7,23 @@ import java.util.concurrent.Future; |
7 | 7 | |
8 | 8 | import javax.annotation.Resource; |
9 | 9 | |
10 | +import cn.hutool.core.text.StrSpliter; | |
11 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
10 | 12 | import org.jeecg.common.constant.CommonConstant; |
11 | 13 | import org.jeecg.common.constant.WebsocketConst; |
12 | 14 | import org.jeecg.modules.message.websocket.WebSocket; |
13 | 15 | import org.jeecg.modules.system.entity.SysAnnouncement; |
14 | 16 | import org.jeecg.modules.system.entity.SysAnnouncementSend; |
15 | 17 | import org.jeecg.modules.system.entity.SysUser; |
18 | +import org.jeecg.modules.system.service.ISysUserService; | |
16 | 19 | import org.jeecg.modules.system.service.impl.SysAnnouncementServiceImpl; |
20 | +import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; | |
17 | 21 | import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; |
18 | 22 | import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; |
19 | 23 | import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; |
20 | 24 | import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; |
21 | 25 | import org.jeecg.utils.HuahengRedisUtil; |
26 | +import org.jeecg.utils.constant.QuantityConstant; | |
22 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
23 | 28 | import org.springframework.scheduling.annotation.Async; |
24 | 29 | import org.springframework.scheduling.annotation.AsyncResult; |
... | ... | @@ -50,6 +55,12 @@ public class SystemSync { |
50 | 55 | @Autowired |
51 | 56 | private HuahengRedisUtil huahengRedisUtil; |
52 | 57 | |
58 | + @Resource | |
59 | + private IParameterConfigurationService parameterConfigurationService; | |
60 | + | |
61 | + @Resource | |
62 | + private ISysUserService sysUserService; | |
63 | + | |
53 | 64 | /** |
54 | 65 | * 达到累计次数,发送系统消息 |
55 | 66 | * @param userOrRoleList 目标角色或用户ID |
... | ... | @@ -70,6 +81,19 @@ public class SystemSync { |
70 | 81 | sysAnnouncementService.quickAnnouncementToUserOrRole(userOrRoleList, title, msg, endTime, level); |
71 | 82 | } |
72 | 83 | |
84 | + @Async("asyncPoolTaskExecutor") | |
85 | + public void selfCheckData(List<SysUser> userOrRoleList, String title, String msg, Date endTime, String level) { | |
86 | + String userOrRoleString = parameterConfigurationService.getValueByCode(QuantityConstant.SELF_CHECK_INFORM); | |
87 | + List<String> userOrRoles = StrSpliter.split(userOrRoleString, ",", true, true); | |
88 | + LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
89 | + sysUserLambdaQueryWrapper.in(SysUser::getUsername, userOrRoles); | |
90 | + userOrRoleList = sysUserService.list(sysUserLambdaQueryWrapper); | |
91 | + if (CollectionUtils.isEmpty(userOrRoleList)) { | |
92 | + return; | |
93 | + } | |
94 | + sysAnnouncementService.quickAnnouncementToUser(userOrRoleList, title, msg, endTime, level); | |
95 | + } | |
96 | + | |
73 | 97 | /** |
74 | 98 | * 登录弹框后发送未读消息 |
75 | 99 | * @param sysUser |
... | ... |