Commit 2ff404644399c9b398893923a8fb64f0bf05ca57
1 parent
7caefe20
1.出库加上出库站台
2.入库一些问题修复
Showing
15 changed files
with
1017 additions
and
97 deletions
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java
... | ... | @@ -101,6 +101,7 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
101 | 101 | wcsTask.setPreTaskNo("0"); |
102 | 102 | wcsTask.setTaskType(taskHeader.getTaskType().toString()); |
103 | 103 | wcsTask.setFromPort("1000"); |
104 | + wcsTask.setToPort(taskHeader.getStationCode()); | |
104 | 105 | |
105 | 106 | wcsTask.setContainerCode(taskHeader.getContainerCode()); |
106 | 107 | Location location; |
... | ... | @@ -112,7 +113,6 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
112 | 113 | |
113 | 114 | wcsTask.setStation(location.getRoadway()); |
114 | 115 | wcsTask.setDestination(location.getRoadway()); |
115 | - wcsTask.setToPort(location.getRoadway()); | |
116 | 116 | if(StringUtils.isEmpty(taskHeader.getFromLocation())){ |
117 | 117 | wcsTask.setFromLocationCode("0"); |
118 | 118 | }else { |
... | ... |
src/main/java/com/huaheng/pc/config/station/controller/stationController.java
... | ... | @@ -14,6 +14,7 @@ import com.huaheng.framework.web.domain.AjaxResult; |
14 | 14 | import com.huaheng.framework.web.page.PageDomain; |
15 | 15 | import com.huaheng.framework.web.page.TableDataInfo; |
16 | 16 | import com.huaheng.framework.web.page.TableSupport; |
17 | +import com.huaheng.pc.config.material.domain.Material; | |
17 | 18 | import com.huaheng.pc.config.station.domain.Station; |
18 | 19 | import com.huaheng.pc.config.station.service.StationService; |
19 | 20 | import io.swagger.annotations.ApiParam; |
... | ... | @@ -23,9 +24,7 @@ import org.springframework.ui.ModelMap; |
23 | 24 | import org.springframework.web.bind.annotation.*; |
24 | 25 | |
25 | 26 | import javax.annotation.Resource; |
26 | -import java.util.ArrayList; | |
27 | -import java.util.Arrays; | |
28 | -import java.util.List; | |
27 | +import java.util.*; | |
29 | 28 | |
30 | 29 | /** |
31 | 30 | * Created by Enzo Cotter on 2019/10/14. |
... | ... | @@ -134,4 +133,21 @@ public class stationController extends BaseController { |
134 | 133 | return toAjax(stationService.removeByIds(list)); |
135 | 134 | } |
136 | 135 | |
136 | + @PostMapping("/getData") | |
137 | + @ResponseBody | |
138 | + public Map<String, Object> getData() { | |
139 | + LambdaQueryWrapper<Station> queryWrapper = Wrappers.lambdaQuery(); | |
140 | + List<Station> stationList = stationService.list(queryWrapper); | |
141 | + | |
142 | + List<Map<String, Object>> list = new ArrayList<>(); | |
143 | + for (Station station : stationList) { | |
144 | + Map<String, Object> resultMap = new HashMap<>(); | |
145 | + resultMap.put("id", station.getCode()); | |
146 | + resultMap.put("text", station.getName()); | |
147 | + list.add(resultMap); | |
148 | + } | |
149 | + Map<String, Object> map = new HashMap<>(); | |
150 | + map.put("results", list); | |
151 | + return map; | |
152 | + } | |
137 | 153 | } |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiving/controller/ReceivingController.java
... | ... | @@ -116,6 +116,9 @@ public class ReceivingController extends BaseController { |
116 | 116 | @ApiParam(name="locationCode",value="库位编码", required = false)String locationCode, |
117 | 117 | @ApiParam(name="qty",value="收货数量") BigDecimal qty, |
118 | 118 | @ApiParam(name="localtionRule",value="定位规则", required = false)String locatingRule){ |
119 | + if(qty.intValue() <= 0) { | |
120 | + return AjaxResult.error("配盘数量必须大于0"); | |
121 | + } | |
119 | 122 | AjaxResult result = receiptContainerHeaderService.saveContainer(receiptCode, containerCode, receiptDetailId, |
120 | 123 | locationCode, qty, locatingRule); |
121 | 124 | return result; |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/domain/ShipmentContainerHeader.java
... | ... | @@ -57,6 +57,13 @@ public class ShipmentContainerHeader implements Serializable { |
57 | 57 | private Integer status; |
58 | 58 | |
59 | 59 | /** |
60 | + * 出库站台 | |
61 | + */ | |
62 | + @TableField(value = "stationCode") | |
63 | + @ApiModelProperty(value="出库站台") | |
64 | + private String stationCode; | |
65 | + | |
66 | + /** | |
60 | 67 | * 父 |
61 | 68 | */ |
62 | 69 | @TableField(value = "parent") |
... | ... | @@ -443,6 +450,14 @@ public class ShipmentContainerHeader implements Serializable { |
443 | 450 | this.status = status; |
444 | 451 | } |
445 | 452 | |
453 | + public String getStationCode() { | |
454 | + return stationCode; | |
455 | + } | |
456 | + | |
457 | + public void setStationCode(String stationCode) { | |
458 | + this.stationCode = stationCode; | |
459 | + } | |
460 | + | |
446 | 461 | /** |
447 | 462 | * 获取父 |
448 | 463 | * |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderServiceImpl.java
... | ... | @@ -211,6 +211,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
211 | 211 | shipmentContainerHeader.setLocationCode(location.getCode()); |
212 | 212 | shipmentContainerHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
213 | 213 | shipmentContainerHeader.setCompanyCode(shipmentDetail.getCompanyCode()); |
214 | + shipmentContainerHeader.setStationCode(shipmentDetail.getStationCode()); | |
214 | 215 | shipmentContainerHeader.setContainerType(container.getContainerType()); |
215 | 216 | shipmentContainerHeader.setStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD); |
216 | 217 | shipmentContainerHeader.setTaskCreated(0); |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/domain/ShipmentDetail.java
... | ... | @@ -188,6 +188,13 @@ public class ShipmentDetail implements Serializable { |
188 | 188 | private String projectNo; |
189 | 189 | |
190 | 190 | /** |
191 | + * 出库站台 | |
192 | + */ | |
193 | + @TableField(value = "stationCode") | |
194 | + @ApiModelProperty(value="出库站台") | |
195 | + private String stationCode; | |
196 | + | |
197 | + /** | |
191 | 198 | * 生产日期 |
192 | 199 | */ |
193 | 200 | @TableField(value = "manufactureDate") |
... | ... | @@ -1009,6 +1016,14 @@ public class ShipmentDetail implements Serializable { |
1009 | 1016 | return processStamp; |
1010 | 1017 | } |
1011 | 1018 | |
1019 | + public String getStationCode() { | |
1020 | + return stationCode; | |
1021 | + } | |
1022 | + | |
1023 | + public void setStationCode(String stationCode) { | |
1024 | + this.stationCode = stationCode; | |
1025 | + } | |
1026 | + | |
1012 | 1027 | /** |
1013 | 1028 | * 设置处理标记 |
1014 | 1029 | * |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/ReceiptTaskService.java
... | ... | @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
5 | 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
6 | 6 | import com.huaheng.common.constant.QuantityConstant; |
7 | 7 | import com.huaheng.common.exception.service.ServiceException; |
8 | +import com.huaheng.common.utils.DataUtils; | |
8 | 9 | import com.huaheng.common.utils.StringUtils; |
9 | 10 | import com.huaheng.common.utils.security.ShiroUtils; |
10 | 11 | import com.huaheng.framework.web.domain.AjaxResult; |
... | ... | @@ -37,12 +38,15 @@ import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; |
37 | 38 | import com.huaheng.pc.task.taskDetail.domain.TaskDetail; |
38 | 39 | import com.huaheng.pc.task.taskDetail.service.TaskDetailService; |
39 | 40 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
41 | +import com.huaheng.pc.task.taskHeader.mapper.TaskHeaderMapper; | |
40 | 42 | import org.springframework.stereotype.Service; |
41 | 43 | import org.springframework.transaction.annotation.Transactional; |
42 | 44 | |
43 | 45 | import javax.annotation.Resource; |
44 | 46 | import java.math.BigDecimal; |
47 | +import java.util.Date; | |
45 | 48 | import java.util.List; |
49 | +import java.util.Map; | |
46 | 50 | |
47 | 51 | /** |
48 | 52 | * 入库任务创建和完成 |
... | ... | @@ -71,6 +75,8 @@ public class ReceiptTaskService { |
71 | 75 | @Resource |
72 | 76 | private ReceiptContainerHeaderService receiptContainerHeaderService; |
73 | 77 | @Resource |
78 | + private TaskHeaderMapper taskHeaderMapper; | |
79 | + @Resource | |
74 | 80 | private ContainerService containerService; |
75 | 81 | @Resource |
76 | 82 | private LocationService locationService; |
... | ... | @@ -186,90 +192,137 @@ public class ReceiptTaskService { |
186 | 192 | |
187 | 193 | /** |
188 | 194 | * 完成入库任务 |
189 | - * | |
190 | - * @param task | |
191 | - * @return | |
192 | 195 | */ |
193 | 196 | @Transactional(rollbackFor = Exception.class) |
194 | 197 | public AjaxResult completeReceiptTask(TaskHeader task) { |
195 | - /* 判断任务状态*/ | |
196 | - if (task.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { | |
197 | - return AjaxResult.error("任务已完成"); | |
198 | + List<Map<String, Object>> taskReceiptContainerDetail = taskHeaderMapper.getReceiptTask(task.getId()); | |
199 | + if (taskReceiptContainerDetail.size() < 1) { | |
200 | + return AjaxResult.success("未找到对应任务的入库单号!!!"); | |
198 | 201 | } |
199 | - BigDecimal totalQty = BigDecimal.ZERO; | |
200 | - List<TaskDetail> taskDetailList = taskDetailService.findByTaskId(task.getId()); | |
201 | - if (taskDetailList.isEmpty()) { | |
202 | - throw new ServiceException("任务明细为空"); | |
202 | + LambdaQueryWrapper<InventoryHeader> inventoryHeaderErapper = Wrappers.lambdaQuery(); | |
203 | + inventoryHeaderErapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
204 | + .eq(InventoryHeader::getLocationCode, task.getToLocation()) | |
205 | + .eq(InventoryHeader::getContainerCode, task.getContainerCode()); | |
206 | + InventoryHeader header = inventoryHeaderService.getOne(inventoryHeaderErapper); | |
207 | + | |
208 | + if(header == null) { | |
209 | + //添加库存单 | |
210 | + header = new InventoryHeader(); | |
211 | + header.setWarehouseCode(task.getWarehouseCode()); | |
212 | + header.setCompanyCode(task.getCompanyCode());//货主 | |
213 | + header.setContainerCode(task.getContainerCode()); | |
214 | + header.setContainerStatus("some"); | |
215 | + header.setLocationCode(task.getToLocation()); | |
216 | + header.setLocking(1); | |
217 | + header.setEnable(1); | |
218 | + header.setTotalQty(new BigDecimal(0)); | |
219 | + header.setTotalWeight(task.getWeight()); | |
220 | + header.setCreatedBy(ShiroUtils.getLoginName()); | |
221 | + header.setCreated(new Date()); | |
222 | + header.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
223 | + header.setLastUpdated(new Date()); | |
224 | + if (!inventoryHeaderService.save(header)) { | |
225 | + throw new ServiceException("添加库存单失败"); | |
226 | + } | |
203 | 227 | } |
204 | - /* 遍历任务明细,修改关联的入库组盘、入库单状态、添加库存*/ | |
205 | - for (TaskDetail taskDetail : taskDetailList) { | |
206 | - if (taskDetail.getStatus() < QuantityConstant.TASK_STATUS_COMPLETED) { | |
207 | - totalQty = totalQty.add(taskDetail.getQty()); | |
208 | - /*查询入库单明细*/ | |
209 | - ReceiptDetail receiptDetail = receiptDetailService.getById(taskDetail.getBillDetailId()); | |
210 | - if (StringUtils.isNotNull(receiptDetail)) { | |
211 | - LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
212 | - inventoryHeaderLambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
213 | - .eq(InventoryHeader::getLocationCode, task.getToLocation()) | |
214 | - .eq(InventoryHeader::getContainerCode, task.getContainerCode()); | |
215 | - InventoryHeader inventoryHeader = inventoryHeaderService.getOne(inventoryHeaderLambdaQueryWrapper); | |
216 | - /* 如果库存 头明细不存在则新增库存头表记录*/ | |
217 | - if (StringUtils.isNull(inventoryHeader)) { | |
218 | - inventoryHeader = new InventoryHeader(); | |
219 | - inventoryHeader.setWarehouseCode(receiptDetail.getWarehouseCode()); | |
220 | - inventoryHeader.setLocationCode(task.getToLocation()); | |
221 | - inventoryHeader.setContainerCode(task.getContainerCode()); | |
222 | - inventoryHeader.setContainerStatus("some"); | |
223 | - inventoryHeader.setCompanyCode(receiptDetail.getCompanyCode()); | |
224 | - inventoryHeader.setTotalWeight(task.getWeight()); | |
225 | - inventoryHeader.setTotalQty(new BigDecimal(0)); | |
226 | - inventoryHeader.setTotalLines(0); | |
227 | - inventoryHeader.setLocking(1); | |
228 | - inventoryHeader.setEnable(1); | |
229 | - if (!inventoryHeaderService.save(inventoryHeader)) { | |
230 | - throw new ServiceException("添加库存单失败"); | |
231 | - } | |
232 | - inventoryHeader = inventoryHeaderService.getOne(inventoryHeaderLambdaQueryWrapper); | |
228 | + for (Map<String, Object> map : taskReceiptContainerDetail) { | |
229 | + //将未完成的任务数量更新到库存表 | |
230 | + if (DataUtils.getInteger(map.get("status")) < QuantityConstant.TASK_STATUS_COMPLETED) { | |
231 | + | |
232 | + LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery(); | |
233 | + inventory.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
234 | + .eq(InventoryDetail::getLocationCode, task.getToLocation()) | |
235 | + .eq(InventoryDetail::getMaterialCode, DataUtils.getString(map.get("materialCode"))) | |
236 | + .eq(InventoryDetail::getContainerCode, DataUtils.getString(map.get("containerCode"))) | |
237 | + .eq(InventoryDetail::getBatch, DataUtils.getString(map.get("batch"))) | |
238 | + .eq(InventoryDetail::getLot, DataUtils.getString(map.get("lot"))) | |
239 | + .eq(InventoryDetail::getProjectNo, DataUtils.getString(map.get("projectNo"))) | |
240 | + .eq(InventoryDetail::getCompanyCode, DataUtils.getString(map.get("companyCode"))); | |
241 | + InventoryDetail detail = inventoryDetailService.getOne(inventory); | |
242 | + if (detail == null) { | |
243 | + //库存明细添加 | |
244 | + detail = new InventoryDetail(); | |
245 | + detail.setInventoryHeaderId(header.getId());//库存头ID | |
246 | + detail.setWarehouseCode(DataUtils.getString(map.get("warehouseCode")));//仓库 | |
247 | + detail.setCompanyCode(task.getCompanyCode());//货主 | |
248 | + detail.setLocationCode(task.getToLocation());//库位号 | |
249 | + detail.setContainerCode(DataUtils.getString(map.get("containerCode")));//容器号 | |
250 | + detail.setMaterialCode(DataUtils.getString(map.get("materialCode")));//物料号 | |
251 | + detail.setMaterialName(DataUtils.getString(map.get("materialName")));//物料名称 | |
252 | + detail.setMaterialSpec(DataUtils.getString(map.get("materialSpec")));//物料规格 | |
253 | + detail.setMaterialUnit(DataUtils.getString(map.get("materialUnit")));//物料单位 | |
254 | + detail.setReceiptCode(DataUtils.getString(map.get("receiptCode")));//入库单编码 | |
255 | + detail.setReceiptDetailId(DataUtils.getInteger(map.get("receiptDetailId")));//入库单明细ID | |
256 | + detail.setBatch(DataUtils.getString(map.get("batch")));//批次 | |
257 | + detail.setLot(DataUtils.getString(map.get("lot")));//批号 | |
258 | + detail.setProjectNo(DataUtils.getString(map.get("projectNo")));//项目号 | |
259 | + detail.setInventorySts(DataUtils.getString(map.get("inventorySts")));//库存状态 | |
260 | +// detail.setManufactureDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("manufactureDate").toString()));//生产日期 | |
261 | +// detail.setExpirationDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("expirationDate").toString()));//失效日期 | |
262 | + detail.setQty(DataUtils.getBigDecimal(map.get("qty")));//数量 | |
263 | + detail.setLockedQty(DataUtils.getBigDecimal(0)); | |
264 | + detail.setTaskQty(DataUtils.getBigDecimal(0)); | |
265 | + detail.setCreatedBy(ShiroUtils.getLoginName());//创建人 | |
266 | + detail.setLastUpdatedBy(ShiroUtils.getLoginName());//创建时间 | |
267 | + if (!inventoryDetailService.save(detail)) { | |
268 | + throw new ServiceException("添加库存明细失败"); | |
233 | 269 | } |
234 | - totalQty = this.addInventoryDetail(taskDetail, receiptDetail, inventoryHeader); | |
235 | - //修改组盘表状态为完成 | |
236 | - ReceiptContainerDetail receiptContainerDetail = new ReceiptContainerDetail(); | |
237 | - receiptContainerDetail.setStatus(QuantityConstant.RECEIPT_CONTAINER_FINISHED); | |
238 | - LambdaUpdateWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
239 | - receiptContainerDetailLambdaUpdateWrapper.eq(ReceiptContainerDetail::getId, taskDetail.getAllocationId()); | |
240 | - if (!receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)){ | |
241 | - throw new ServiceException("更新组盘状态失败"); | |
270 | + } else { | |
271 | + detail.setQty(detail.getQty().add(DataUtils.getBigDecimal(map.get("qty")))); | |
272 | + detail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
273 | + LambdaUpdateWrapper<InventoryDetail> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
274 | + lambdaUpdateWrapper.eq(InventoryDetail::getId, detail.getId()); | |
275 | + if (!inventoryDetailService.update(detail, lambdaUpdateWrapper)){ | |
276 | + throw new ServiceException("更新库存明细失败"); | |
242 | 277 | } |
278 | + } | |
279 | + //记录库存交易记录 | |
280 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
281 | + inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_RECEIPT); | |
282 | + inventoryTransaction.setWarehouseCode(DataUtils.getString(map.get("warehouseCode"))); | |
283 | + inventoryTransaction.setCompanyCode(task.getCompanyCode()); | |
284 | + inventoryTransaction.setLocationCode(task.getToLocation()); | |
285 | + inventoryTransaction.setContainerCode(DataUtils.getString(map.get("containerCode"))); | |
286 | + inventoryTransaction.setMaterialCode(DataUtils.getString(map.get("materialCode"))); | |
287 | + inventoryTransaction.setMaterialName(DataUtils.getString(map.get("materialName"))); | |
288 | + inventoryTransaction.setMaterialSpec(DataUtils.getString(map.get("materialSpec")));//物料规格 | |
289 | + inventoryTransaction.setMaterialUnit(DataUtils.getString(map.get("materialUnit")));//物料单位 | |
290 | + inventoryTransaction.setBillCode(DataUtils.getString(map.get("receiptCode"))); | |
291 | + inventoryTransaction.setBillDetailId(DataUtils.getInteger(map.get("receiptDetailId"))); | |
292 | + inventoryTransaction.setBatch(DataUtils.getString(map.get("batch"))); | |
293 | + inventoryTransaction.setLot(DataUtils.getString(map.get("lot"))); | |
294 | + inventoryTransaction.setInventorySts(DataUtils.getString((map.get("inventorySts")))); | |
295 | + inventoryTransaction.setTaskQty(DataUtils.getBigDecimal(map.get("qty"))); | |
296 | + inventoryTransaction.setCreated(new Date()); | |
297 | + inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName()); | |
298 | + if (!inventoryTransactionService.save(inventoryTransaction)) { | |
299 | + throw new ServiceException("新增库存记录失败"); | |
300 | + } | |
243 | 301 | |
244 | - } else { | |
245 | - throw new ServiceException("未找到id:" + taskDetail.getBillDetailId() + "入库单明细"); | |
302 | + //修改任务明细的状态为完成 | |
303 | + TaskDetail taskDetail = new TaskDetail(); | |
304 | + taskDetail.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
305 | + taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
306 | + taskDetail.setAgingDate(new Date()); //入库时间 | |
307 | + LambdaUpdateWrapper<TaskDetail> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
308 | + lambdaUpdateWrapper.eq(TaskDetail::getTaskId, task.getId()); | |
309 | + taskDetailService.update(taskDetail, lambdaUpdateWrapper); | |
310 | + if (!taskDetailService.update(taskDetail, lambdaUpdateWrapper)) { | |
311 | + throw new ServiceException("修改入库单明细失败"); | |
246 | 312 | } |
247 | - receiptDetail.setProcessStamp(String.valueOf(QuantityConstant.RECEIPT_HEADER_POSTING)); | |
248 | - receiptDetailService.updateById(receiptDetail); | |
249 | - receiptDetailService.updateReceiptHeaderLastStatus(receiptDetail.getReceiptId()); | |
250 | - materialWarningService.materialWarning(taskDetail.getMaterialCode(), taskDetail.getCompanyCode()); | |
313 | + | |
251 | 314 | } |
252 | - } | |
253 | - LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
254 | - inventoryHeaderLambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
255 | - .eq(InventoryHeader::getLocationCode, task.getToLocation()) | |
256 | - .eq(InventoryHeader::getContainerCode, task.getContainerCode()); | |
257 | - InventoryHeader inventoryHeader = inventoryHeaderService.getOne(inventoryHeaderLambdaQueryWrapper); | |
258 | - if (StringUtils.isNull(inventoryHeader)) { | |
259 | - throw new ServiceException("库存添加失败"); | |
260 | - } else { | |
261 | - inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().add(totalQty)); | |
262 | - inventoryHeader.setTotalLines(inventoryHeader.getTotalLines()+taskDetailList.size()); | |
263 | - inventoryHeaderService.updateById(inventoryHeader); | |
315 | + | |
264 | 316 | } |
265 | 317 | //修改任务主表状态,因为立库任务表单头只对应一个货箱,表单详情的任务会同时完成 |
266 | 318 | task.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
319 | + task.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
320 | + task.setLastUpdated(new Date()); | |
267 | 321 | LambdaUpdateWrapper<TaskHeader> taskHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
268 | 322 | taskHeaderLambdaUpdateWrapper.eq(TaskHeader::getId, task.getId()); |
269 | 323 | if (!taskHeaderService.update(task, taskHeaderLambdaUpdateWrapper)){ |
270 | 324 | throw new ServiceException("更新任务主表失败"); |
271 | 325 | } |
272 | - | |
273 | 326 | //修改库位状态和对应的容器 |
274 | 327 | Location location = new Location(); |
275 | 328 | location.setContainerCode(task.getContainerCode()); |
... | ... | @@ -288,15 +341,41 @@ public class ReceiptTaskService { |
288 | 341 | if (!containerService.update(container, containerLambdaUpdateWrapper)) { |
289 | 342 | throw new ServiceException("更新容器失败"); |
290 | 343 | } |
344 | + //修改组盘表状态为20 | |
345 | + ReceiptContainerDetail receiptContainerDetail = new ReceiptContainerDetail(); | |
346 | + receiptContainerDetail.setStatus(QuantityConstant.RECEIPT_CONTAINER_REVIEWSUCCESS); | |
347 | + receiptContainerDetail.setProcessStamp("0"); | |
348 | + receiptContainerDetail.setLastUpdated(new Date()); | |
349 | + receiptContainerDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
350 | + LambdaUpdateWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
351 | + receiptContainerDetailLambdaUpdateWrapper.eq(ReceiptContainerDetail::getReceiptId, DataUtils.getInteger(taskReceiptContainerDetail.get(0).get("receiptId"))); | |
352 | + if (!receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)){ | |
353 | + throw new ServiceException("更新组盘状态失败"); | |
354 | + } | |
291 | 355 | |
292 | 356 | //修改入库组盘头表状态 |
357 | + | |
293 | 358 | ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); |
294 | 359 | receiptContainerHeader.setId(task.getAllocationHeadId()); |
295 | - receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_FINISHED); | |
360 | + receiptContainerHeader.setLastUpdated(new Date()); | |
361 | + receiptContainerHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
362 | + receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_FINISHED.intValue()); | |
296 | 363 | if (!receiptContainerHeaderService.updateById(receiptContainerHeader)) { |
297 | 364 | throw new ServiceException("更新入库组盘头表状态失败"); |
298 | 365 | } |
299 | - return AjaxResult.success(); | |
366 | + | |
367 | + //修改入库单状态 | |
368 | + ReceiptHeader receiptHeader = new ReceiptHeader(); | |
369 | + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_POSTING); | |
370 | + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_POSTING); | |
371 | + receiptHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
372 | + receiptHeader.setLastUpdated(new Date()); | |
373 | + LambdaUpdateWrapper<ReceiptHeader> receiptHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
374 | + receiptHeaderLambdaUpdateWrapper.eq(ReceiptHeader::getId, DataUtils.getInteger(taskReceiptContainerDetail.get(0).get("receiptId"))); | |
375 | + if (!receiptHeaderService.update(receiptHeader, receiptHeaderLambdaUpdateWrapper)) { | |
376 | + throw new ServiceException("更新入库头表状态失败"); | |
377 | + } | |
378 | + return AjaxResult.success("完成入库任务"); | |
300 | 379 | } |
301 | 380 | |
302 | 381 | /** |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/ShipmentTaskService.java
... | ... | @@ -139,6 +139,7 @@ public class ShipmentTaskService { |
139 | 139 | task.setWarehouseCode(shipmentContainerHeader.getWarehouseCode()); |
140 | 140 | task.setAssignedUser(ShiroUtils.getLoginName()); |
141 | 141 | task.setConfirmedBy(ShiroUtils.getLoginName()); |
142 | + task.setStationCode(shipmentContainerHeader.getStationCode()); | |
142 | 143 | task.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
143 | 144 | task.setContainerCode(shipmentContainerHeader.getContainerCode()); |
144 | 145 | if (!taskHeaderService.save(task)){ |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java
... | ... | @@ -56,4 +56,10 @@ public interface TaskHeaderService extends IService<TaskHeader>{ |
56 | 56 | |
57 | 57 | AjaxResult setLocationCode(Integer taskId, Integer high); |
58 | 58 | |
59 | + AjaxResult createTaskFromShipmentContainers(ShipmentTaskCreateModel shipmentTaskCreateModel); | |
60 | + | |
61 | + AjaxResult completeReceiptTask(TaskHeader task); | |
62 | + | |
63 | + AjaxResult createReceiptTask(List<Integer> ids); | |
64 | + | |
59 | 65 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -73,6 +73,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
73 | 73 | @Resource |
74 | 74 | private ShipmentContainerHeaderService shipmentContainerHeaderService; |
75 | 75 | @Resource |
76 | + private ShipmentContainerDetailService shipmentContainerDetailService; | |
77 | + @Resource | |
76 | 78 | private LocationService locationService; |
77 | 79 | @Resource |
78 | 80 | private ContainerService containerService; |
... | ... | @@ -84,12 +86,19 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
84 | 86 | private InventoryHeaderService inventoryHeaderService; |
85 | 87 | @Resource |
86 | 88 | private InventoryDetailService inventoryDetailService; |
87 | - | |
88 | 89 | @Resource |
89 | - private TransferTaskService transferTaskService; | |
90 | + private InventoryTransactionService inventoryTransactionService; | |
91 | + @Resource | |
92 | + private ReceiptHeaderService receiptHeaderService; | |
93 | + @Resource | |
94 | + private ReceiptDetailService receiptDetailService; | |
90 | 95 | @Resource |
91 | 96 | private ReceiptContainerDetailService receiptContainerDetailService; |
92 | 97 | @Resource |
98 | + private ShipmentHeaderService shipmentHeaderService; | |
99 | + @Resource | |
100 | + private ShipmentDetailService shipmentDetailService; | |
101 | + @Resource | |
93 | 102 | private CycleCountDetailService cycleCountDetailService; |
94 | 103 | @Resource |
95 | 104 | private CycleCountHeaderService cycleCountHeaderService; |
... | ... | @@ -97,9 +106,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
97 | 106 | private ReceiptContainerHeaderService receiptContainerHeaderService; |
98 | 107 | @Resource |
99 | 108 | private TaskHeaderMapper taskHeaderMapper; |
100 | - @Resource | |
109 | + @Autowired | |
101 | 110 | private TaskAssignService taskAssignService; |
102 | 111 | @Resource |
112 | + private ContainerCapacityService containerCapacityService; | |
113 | + @Resource | |
114 | + private ConfigWarningService configWarningService; | |
115 | + @Resource | |
116 | + private ReceivingService receivingService; | |
117 | + @Resource | |
103 | 118 | private CreateTaskMessage createTaskMessage; |
104 | 119 | @Resource |
105 | 120 | private ReceiptTaskService receiptTaskService; |
... | ... | @@ -107,6 +122,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
107 | 122 | private ShipmentTaskService shipmentTaskService; |
108 | 123 | @Resource |
109 | 124 | private WorkTaskService workTaskService; |
125 | + @Resource | |
126 | + private TransferTaskService transferTaskService; | |
110 | 127 | |
111 | 128 | /** |
112 | 129 | * 盘点任务首选项 |
... | ... | @@ -153,7 +170,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
153 | 170 | } |
154 | 171 | if(list.get(0).getTaskType()==100 || list.get(0).getTaskType()==200){ |
155 | 172 | //入库任务 |
156 | - return receiptTaskService.completeReceiptTask((list.get(0))); | |
173 | + return completeReceiptTask((list.get(0))); | |
157 | 174 | } else { |
158 | 175 | throw new ServiceException("库位(" + locationCode + ")的任务不是上架,不能完成!"); |
159 | 176 | } |
... | ... | @@ -191,7 +208,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
191 | 208 | } |
192 | 209 | List<Integer> ids = new ArrayList<>(); |
193 | 210 | ids.add(containerHeader.getId()); |
194 | - receiptTaskService.createReceiptTask(ids); | |
211 | + this.createReceiptTask(ids); | |
195 | 212 | return AjaxResult.success("成功!"); |
196 | 213 | } |
197 | 214 | |
... | ... | @@ -321,6 +338,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
321 | 338 | return AjaxResult.success("取消任务成功!"); |
322 | 339 | } |
323 | 340 | |
341 | + | |
324 | 342 | /** |
325 | 343 | * 容器收货上架 |
326 | 344 | * |
... | ... | @@ -356,19 +374,145 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
356 | 374 | if (StringUtils.isEmpty(ids)){ |
357 | 375 | return AjaxResult.error("id不能为空"); |
358 | 376 | } |
359 | - | |
360 | 377 | Integer maxId = idList.stream().max(Comparator.comparing(Integer::intValue)).orElse(null); |
361 | 378 | |
362 | 379 | LambdaQueryWrapper<ReceiptContainerHeader> lambda = Wrappers.lambdaQuery(); |
363 | 380 | lambda.select(ReceiptContainerHeader::getId) |
364 | 381 | .lt(ReceiptContainerHeader::getStatus, 10) |
365 | 382 | .le(ReceiptContainerHeader::getId, maxId); |
366 | - return receiptTaskService.createReceiptTask(idList); | |
383 | + return createReceiptTask(idList); | |
367 | 384 | } |
368 | 385 | return AjaxResult.error("生成入库任务失败"); |
369 | 386 | } |
370 | 387 | |
371 | 388 | /** |
389 | + * 生成出库任务 | |
390 | + * | |
391 | + * @param shipmentTaskCreateModel | |
392 | + * @return | |
393 | + */ | |
394 | + @Override | |
395 | + @Transactional(rollbackFor = Exception.class) | |
396 | + public AjaxResult createTaskFromShipmentContainers(ShipmentTaskCreateModel shipmentTaskCreateModel) { | |
397 | + Boolean flag = true; | |
398 | + Integer shipmentContainerHeaderId = shipmentTaskCreateModel.getShipmentContainerHeaderIds(); | |
399 | + //获取表头 | |
400 | + ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(shipmentContainerHeaderId); | |
401 | + if (shipmentContainerHeader == null) { | |
402 | + return AjaxResult.error("出库货箱" + shipmentContainerHeaderId + "未找到,操作中止"); | |
403 | + } | |
404 | + if (shipmentContainerHeader.getStatus() >= QuantityConstant.SHIPMENT_CONTAINER_TASK) { | |
405 | + return AjaxResult.error("出库货箱" + shipmentContainerHeader.getContainerCode() + "已经生成任务,请不要重复生成,操作中止"); | |
406 | + } | |
407 | + //获取所有子货箱 | |
408 | + LambdaQueryWrapper<ShipmentContainerDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
409 | + lambdaQueryWrapper.eq(ShipmentContainerDetail::getShippingContainerId, shipmentContainerHeader.getId()); | |
410 | + List<ShipmentContainerDetail> shipmentContainerDetails = shipmentContainerDetailService.list(lambdaQueryWrapper); | |
411 | + if (shipmentContainerDetails == null || shipmentContainerDetails.size() == 0) { | |
412 | + return AjaxResult.error("货箱" + shipmentContainerHeader.getContainerCode() + "没有子任务,操作中止"); | |
413 | + } | |
414 | + //检测库位 | |
415 | + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
416 | + locationLambdaQueryWrapper.eq(Location::getCode, shipmentContainerHeader.getLocationCode()) | |
417 | + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
418 | + .eq(Location::getDeleted, false); | |
419 | + Location location = locationService.getOne(locationLambdaQueryWrapper); | |
420 | + if (location == null) { | |
421 | + return AjaxResult.error("库位禁用或不存在!"); | |
422 | + } | |
423 | + //创建任务头 | |
424 | + TaskHeader task = new TaskHeader(); | |
425 | + //分拣出库 | |
426 | + task.setTaskType(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT); | |
427 | + task.setFromLocation(shipmentContainerHeader.getLocationCode()); | |
428 | + task.setToLocation(shipmentContainerHeader.getLocationCode()); | |
429 | + //判断是否整出任务,钱柜和AGV不能整出 | |
430 | + | |
431 | + //表示整出优先 | |
432 | + //判断当前子货箱所有数量是否等于该托盘对应的所有库存的数量, | |
433 | + //这里必须与库存的在库数量对比,后期可能存在一个配盘在执行任务,后一个配盘又在配这个的情况(这个时候不能整出) | |
434 | + // 如果相等,则说明这个货箱包含了所有的数量,则可以整出,否则,创建拣选任务; | |
435 | + //查询所有库存 | |
436 | + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
437 | + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getLocationCode, shipmentContainerHeader.getLocationCode()) | |
438 | + .eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
439 | + List<InventoryDetail> inventories = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); | |
440 | + BigDecimal inventoryTotal = new BigDecimal("0"); | |
441 | + for (InventoryDetail item : inventories) { | |
442 | + inventoryTotal = inventoryTotal.add(item.getQty()); | |
443 | + } | |
444 | + BigDecimal containerTotal = new BigDecimal("0"); | |
445 | + for (ShipmentContainerDetail item : shipmentContainerDetails) { | |
446 | + containerTotal = containerTotal.add(item.getQty()); | |
447 | + } | |
448 | + if (inventoryTotal.compareTo(containerTotal) == 0) { | |
449 | + task.setTaskType(QuantityConstant.TASK_TYPE_WHOLESHIPMENT);//整盘出库 | |
450 | + task.setToLocation(""); | |
451 | + } | |
452 | + | |
453 | + task.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_PICKING); | |
454 | + task.setAllocationHeadId(shipmentContainerHeader.getId()); | |
455 | + task.setWarehouseCode(shipmentContainerHeader.getWarehouseCode()); | |
456 | + task.setCompanyCode(shipmentContainerHeader.getCompanyCode()); | |
457 | + task.setAssignedUser(ShiroUtils.getLoginName()); | |
458 | + task.setConfirmedBy(ShiroUtils.getLoginName()); | |
459 | + task.setStatus(QuantityConstant.TASK_STATUS_BUILD); | |
460 | + task.setContainerCode(shipmentContainerHeader.getContainerCode()); | |
461 | + task.setCreatedBy(ShiroUtils.getLoginName()); | |
462 | + task.setCreated(new Date()); | |
463 | + task.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
464 | + task.setLastUpdated(null); | |
465 | + this.save(task); | |
466 | + //遍历子货箱创建子任务 | |
467 | + for (ShipmentContainerDetail shipmentContainerDetail : shipmentContainerDetails) { | |
468 | + TaskDetail taskDetail = new TaskDetail(); | |
469 | + taskDetail.setTaskId(task.getId()); | |
470 | + taskDetail.setInternalTaskType(task.getInternalTaskType()); | |
471 | + taskDetail.setWarehouseCode(task.getWarehouseCode()); | |
472 | + taskDetail.setCompanyCode(task.getCompanyCode()); | |
473 | + taskDetail.setTaskType(task.getTaskType()); | |
474 | + taskDetail.setToInventoryId(shipmentContainerDetail.getInventoryId()); | |
475 | + taskDetail.setAllocationId(shipmentContainerDetail.getId()); | |
476 | + taskDetail.setBillCode(shipmentContainerDetail.getShipmentCode()); | |
477 | + taskDetail.setBillDetailId(shipmentContainerDetail.getShipmentDetailId()); | |
478 | + taskDetail.setMaterialCode(shipmentContainerDetail.getMaterialCode()); | |
479 | + taskDetail.setMaterialName(shipmentContainerDetail.getMaterialName()); | |
480 | + taskDetail.setMaterialSpec(shipmentContainerDetail.getMaterialSpec()); | |
481 | + taskDetail.setMaterialUnit(shipmentContainerDetail.getMaterialUnit()); | |
482 | + taskDetail.setFromInventoryId(shipmentContainerDetail.getInventoryId()); | |
483 | + taskDetail.setQty(shipmentContainerDetail.getQty()); | |
484 | + taskDetail.setContainerCode(task.getContainerCode()); | |
485 | + taskDetail.setFromLocation(task.getFromLocation()); | |
486 | + taskDetail.setToLocation(task.getToLocation()); | |
487 | + taskDetail.setLot(shipmentContainerDetail.getLot()); | |
488 | + taskDetail.setBatch(shipmentContainerDetail.getBatch()); | |
489 | + taskDetail.setProjectNo(shipmentContainerDetail.getProjectNo()); | |
490 | + taskDetail.setStatus(QuantityConstant.TASK_STATUS_BUILD); | |
491 | + taskDetail.setWaveId(shipmentContainerDetail.getWaveId()); | |
492 | + taskDetail.setInventorySts(shipmentContainerDetail.getInventorySts()); | |
493 | + taskDetail.setCreatedBy(ShiroUtils.getLoginName()); | |
494 | + taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
495 | + flag = taskDetailService.save(taskDetail); | |
496 | + if (flag == false) { | |
497 | + throw new ServiceException("新建任务明细失败,sql报错"); | |
498 | + } | |
499 | + shipmentContainerDetail.setStatus(QuantityConstant.SHIPMENT_CONTAINER_TASK); | |
500 | + } | |
501 | + //更新货位状态 | |
502 | + shipmentContainerHeader.setStatus(QuantityConstant.SHIPMENT_CONTAINER_TASK); | |
503 | + flag = shipmentContainerHeaderService.updateById(shipmentContainerHeader); | |
504 | + if (flag == false) { | |
505 | + throw new ServiceException("修改组盘头状态失败,sql报错"); | |
506 | + } | |
507 | + | |
508 | + flag = shipmentContainerDetailService.updateBatchById(shipmentContainerDetails); | |
509 | + if (flag == false) { | |
510 | + throw new ServiceException("修改组盘明细状态明细失败,sql报错"); | |
511 | + } | |
512 | + return AjaxResult.success(task.getId()); | |
513 | + } | |
514 | + | |
515 | + /** | |
372 | 516 | * 下发WCS执行任务 |
373 | 517 | * 执行任务 |
374 | 518 | */ |
... | ... | @@ -382,9 +526,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
382 | 526 | if (task.getStatus() >= QuantityConstant.TASK_STATUS_RELEASE) { |
383 | 527 | return AjaxResult.error("任务" + taskId + "已经下发,请不要重复下发,操作中止"); |
384 | 528 | } |
385 | - | |
386 | 529 | // 给wcs传递任务 |
387 | - taskAssignService.wcsTaskAssign(task); | |
530 | + try { | |
531 | + createTaskMessage.createTask(task); | |
532 | + } catch (Exception e) { | |
533 | + e.printStackTrace(); | |
534 | + } | |
388 | 535 | |
389 | 536 | //修改任务头表 |
390 | 537 | task.setId(taskId); |
... | ... | @@ -415,12 +562,50 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
415 | 562 | } |
416 | 563 | } |
417 | 564 | |
565 | +// //修改入库明细 | |
566 | +// if (task.getInternalTaskType()==100){ | |
567 | +// ReceiptDetail receiptDetail = receiptDetailService.queryflow(receiptDetailService.getById(record.getId())); | |
568 | +// if (!receiptDetailService.updateById(receiptDetail)){ | |
569 | +// throw new ServiceException("更新状态失败"); | |
570 | +// } | |
571 | +// receiptDetailService.updateReceiptHeaderLastStatus(receiptDetail.getReceiptId()); | |
572 | +// | |
573 | +// //修改组盘表状态为20 | |
574 | +// ReceiptContainerDetail receiptContainerDetail = new ReceiptContainerDetail(); | |
575 | +// receiptContainerDetail.setStatus(20); | |
576 | +// receiptContainerDetail.setLastUpdated(new Date()); | |
577 | +// receiptContainerDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
578 | +// LambdaUpdateWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
579 | +// receiptContainerDetailLambdaUpdateWrapper.eq(ReceiptContainerDetail::getReceiptId,receiptDetail.getReceiptId()); | |
580 | +// if (! receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)) | |
581 | +// throw new ServiceException("更新组盘状态失败"); | |
582 | +// } | |
583 | +// | |
584 | +// //修改出库单状态 | |
585 | +// if (task.getInternalTaskType()==200){ | |
586 | +// LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
587 | +// taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskId,task.getId()); | |
588 | +// List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambdaQueryWrapper); | |
589 | +// | |
590 | +// for (TaskDetail taskDeatails: taskDetailList) { | |
591 | +// LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
592 | +// shipmentDetailLambdaQueryWrapper.eq(ShipmentDetail::getId,taskDeatails.getBillDetailId()); | |
593 | +// | |
594 | +// ShipmentHeader shipmentHeader =new ShipmentHeader(); | |
595 | +// shipmentHeader.setId(shipmentDetailService.getOne(shipmentDetailLambdaQueryWrapper).getShipmentId()); | |
596 | +// shipmentHeader.setFirstStatus(100); | |
597 | +// shipmentHeader.setLastStatus(100); | |
598 | +// shipmentHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
599 | +// shipmentHeader.setLastUpdated(new Date()); | |
600 | +// shipmentHeaderService.updateById(shipmentHeader); | |
601 | +// } | |
602 | +// } | |
603 | + | |
418 | 604 | } |
419 | 605 | return AjaxResult.success("执行下发任务成功", task); |
420 | 606 | } |
421 | 607 | |
422 | 608 | @Override |
423 | - @Transactional(rollbackFor = Exception.class) | |
424 | 609 | public AjaxResult completeTaskByWMS(Integer[] taskIds, String[] weightConvert) { |
425 | 610 | for (int i = 0;i<taskIds.length;i++) { |
426 | 611 | TaskHeader task = taskHeaderService.getById(taskIds[i]); |
... | ... | @@ -444,8 +629,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
444 | 629 | if(task.getTaskType().equals(QuantityConstant.TASK_TYPE_WHOLERECEIPT) || task.getTaskType().equals(QuantityConstant.TASK_TYPE_EMPTYRECEIPT)){ |
445 | 630 | if(StringUtils.isEmpty(task.getToLocation())){ |
446 | 631 | //自动分配库位 |
447 | - // AjaxResult ajaxResult = this.setLocationCode(task.getId(),0 ); | |
448 | - // task.setToLocation((String)ajaxResult.getData()); | |
632 | +// AjaxResult ajaxResult = this.setLocationCode(task.getId(),0 ); | |
633 | +// task.setToLocation((String)ajaxResult.getData()); | |
449 | 634 | } |
450 | 635 | } |
451 | 636 | //如果没有库位不能完成 |
... | ... | @@ -468,6 +653,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
468 | 653 | if (task.getInternalTaskType().equals(QuantityConstant.TASK_INTENERTYPE_SHELF) ) { |
469 | 654 | //入库任务 |
470 | 655 | receiptTaskService.completeReceiptTask(task); |
656 | + combineInventory(task); | |
471 | 657 | } |
472 | 658 | if (task.getInternalTaskType().equals(QuantityConstant.TASK_INTENERTYPE_PICKING) && |
473 | 659 | (task.getTaskType().equals(QuantityConstant.TASK_TYPE_WHOLESHIPMENT) || task.getTaskType().equals(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT))) { |
... | ... | @@ -476,7 +662,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
476 | 662 | } |
477 | 663 | // 900 出库查看,空托出库查看 |
478 | 664 | if (task.getTaskType().equals( QuantityConstant.TASK_TYPE_VIEW)) { |
479 | - workTaskService.completeCheckOutTask(task); | |
665 | + workTaskService.completeCheckOutTask(task); | |
480 | 666 | } |
481 | 667 | // 700 盘点 |
482 | 668 | if (task.getTaskType().equals(QuantityConstant.TASK_TYPE_CYCLECOUNT)) { |
... | ... | @@ -496,6 +682,244 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
496 | 682 | } |
497 | 683 | } |
498 | 684 | |
685 | + | |
686 | + /** | |
687 | + * 完成入库任务 | |
688 | + */ | |
689 | + @Override | |
690 | + @Transactional(rollbackFor = Exception.class) | |
691 | + public AjaxResult completeReceiptTask(TaskHeader task) { | |
692 | + List<Map<String, Object>> taskReceiptContainerDetail = taskHeaderMapper.getReceiptTask(task.getId()); | |
693 | + if (taskReceiptContainerDetail.size() < 1) { | |
694 | + return AjaxResult.success("未找到对应任务的入库单号!!!"); | |
695 | + } | |
696 | + LambdaQueryWrapper<InventoryHeader> inventoryHeaderErapper = Wrappers.lambdaQuery(); | |
697 | + inventoryHeaderErapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
698 | + .eq(InventoryHeader::getLocationCode, task.getToLocation()) | |
699 | + .eq(InventoryHeader::getContainerCode, task.getContainerCode()); | |
700 | + InventoryHeader header = inventoryHeaderService.getOne(inventoryHeaderErapper); | |
701 | + | |
702 | + if(header == null) { | |
703 | + //添加库存单 | |
704 | + header = new InventoryHeader(); | |
705 | + header.setWarehouseCode(task.getWarehouseCode()); | |
706 | + header.setCompanyCode(task.getCompanyCode());//货主 | |
707 | + header.setContainerCode(task.getContainerCode()); | |
708 | + header.setContainerStatus("some"); | |
709 | + header.setLocationCode(task.getToLocation()); | |
710 | + header.setLocking(1); | |
711 | + header.setEnable(1); | |
712 | + header.setTotalQty(new BigDecimal(0)); | |
713 | + header.setTotalWeight(task.getWeight()); | |
714 | + header.setCreatedBy(ShiroUtils.getLoginName()); | |
715 | + header.setCreated(new Date()); | |
716 | + header.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
717 | + header.setLastUpdated(new Date()); | |
718 | + if (!inventoryHeaderService.save(header)) { | |
719 | + throw new ServiceException("添加库存单失败"); | |
720 | + } | |
721 | + } | |
722 | + for (Map<String, Object> map : taskReceiptContainerDetail) { | |
723 | + //将未完成的任务数量更新到库存表 | |
724 | + if (DataUtils.getInteger(map.get("status")) < QuantityConstant.TASK_STATUS_COMPLETED) { | |
725 | + | |
726 | + LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery(); | |
727 | + inventory.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
728 | + .eq(InventoryDetail::getLocationCode, task.getToLocation()) | |
729 | + .eq(InventoryDetail::getMaterialCode, DataUtils.getString(map.get("materialCode"))) | |
730 | + .eq(InventoryDetail::getContainerCode, DataUtils.getString(map.get("containerCode"))) | |
731 | + .eq(InventoryDetail::getBatch, DataUtils.getString(map.get("batch"))) | |
732 | + .eq(InventoryDetail::getLot, DataUtils.getString(map.get("lot"))) | |
733 | + .eq(InventoryDetail::getProjectNo, DataUtils.getString(map.get("projectNo"))) | |
734 | + .eq(InventoryDetail::getCompanyCode, DataUtils.getString(map.get("companyCode"))); | |
735 | + InventoryDetail detail = inventoryDetailService.getOne(inventory); | |
736 | + if (detail == null) { | |
737 | + //库存明细添加 | |
738 | + detail = new InventoryDetail(); | |
739 | + detail.setInventoryHeaderId(header.getId());//库存头ID | |
740 | + detail.setWarehouseCode(DataUtils.getString(map.get("warehouseCode")));//仓库 | |
741 | + detail.setCompanyCode(task.getCompanyCode());//货主 | |
742 | + detail.setLocationCode(task.getToLocation());//库位号 | |
743 | + detail.setContainerCode(DataUtils.getString(map.get("containerCode")));//容器号 | |
744 | + detail.setMaterialCode(DataUtils.getString(map.get("materialCode")));//物料号 | |
745 | + detail.setMaterialName(DataUtils.getString(map.get("materialName")));//物料名称 | |
746 | + detail.setMaterialSpec(DataUtils.getString(map.get("materialSpec")));//物料规格 | |
747 | + detail.setMaterialUnit(DataUtils.getString(map.get("materialUnit")));//物料单位 | |
748 | + detail.setReceiptCode(DataUtils.getString(map.get("receiptCode")));//入库单编码 | |
749 | + detail.setReceiptDetailId(DataUtils.getInteger(map.get("receiptDetailId")));//入库单明细ID | |
750 | + detail.setBatch(DataUtils.getString(map.get("batch")));//批次 | |
751 | + detail.setLot(DataUtils.getString(map.get("lot")));//批号 | |
752 | + detail.setProjectNo(DataUtils.getString(map.get("projectNo")));//项目号 | |
753 | + detail.setInventorySts(DataUtils.getString(map.get("inventorySts")));//库存状态 | |
754 | +// detail.setManufactureDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("manufactureDate").toString()));//生产日期 | |
755 | +// detail.setExpirationDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("expirationDate").toString()));//失效日期 | |
756 | + detail.setQty(DataUtils.getBigDecimal(map.get("qty")));//数量 | |
757 | + detail.setLockedQty(DataUtils.getBigDecimal(0)); | |
758 | + detail.setTaskQty(DataUtils.getBigDecimal(0)); | |
759 | + detail.setCreatedBy(ShiroUtils.getLoginName());//创建人 | |
760 | + detail.setLastUpdatedBy(ShiroUtils.getLoginName());//创建时间 | |
761 | + if (!inventoryDetailService.save(detail)) { | |
762 | + throw new ServiceException("添加库存明细失败"); | |
763 | + } | |
764 | + } else { | |
765 | + detail.setQty(detail.getQty().add(DataUtils.getBigDecimal(map.get("qty")))); | |
766 | + detail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
767 | + LambdaUpdateWrapper<InventoryDetail> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
768 | + lambdaUpdateWrapper.eq(InventoryDetail::getId, detail.getId()); | |
769 | + if (!inventoryDetailService.update(detail, lambdaUpdateWrapper)){ | |
770 | + throw new ServiceException("更新库存明细失败"); | |
771 | + } | |
772 | + } | |
773 | + //记录库存交易记录 | |
774 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
775 | + inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_RECEIPT); | |
776 | + inventoryTransaction.setWarehouseCode(DataUtils.getString(map.get("warehouseCode"))); | |
777 | + inventoryTransaction.setCompanyCode(task.getCompanyCode()); | |
778 | + inventoryTransaction.setLocationCode(task.getToLocation()); | |
779 | + inventoryTransaction.setContainerCode(DataUtils.getString(map.get("containerCode"))); | |
780 | + inventoryTransaction.setMaterialCode(DataUtils.getString(map.get("materialCode"))); | |
781 | + inventoryTransaction.setMaterialName(DataUtils.getString(map.get("materialName"))); | |
782 | + inventoryTransaction.setMaterialSpec(DataUtils.getString(map.get("materialSpec")));//物料规格 | |
783 | + inventoryTransaction.setMaterialUnit(DataUtils.getString(map.get("materialUnit")));//物料单位 | |
784 | + inventoryTransaction.setBillCode(DataUtils.getString(map.get("receiptCode"))); | |
785 | + inventoryTransaction.setBillDetailId(DataUtils.getInteger(map.get("receiptDetailId"))); | |
786 | + inventoryTransaction.setBatch(DataUtils.getString(map.get("batch"))); | |
787 | + inventoryTransaction.setLot(DataUtils.getString(map.get("lot"))); | |
788 | + inventoryTransaction.setInventorySts(DataUtils.getString((map.get("inventorySts")))); | |
789 | + inventoryTransaction.setTaskQty(DataUtils.getBigDecimal(map.get("qty"))); | |
790 | + inventoryTransaction.setCreated(new Date()); | |
791 | + inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName()); | |
792 | + if (!inventoryTransactionService.save(inventoryTransaction)) { | |
793 | + throw new ServiceException("新增库存记录失败"); | |
794 | + } | |
795 | + | |
796 | + //修改任务明细的状态为完成 | |
797 | + TaskDetail taskDetail = new TaskDetail(); | |
798 | + taskDetail.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
799 | + taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
800 | + taskDetail.setAgingDate(new Date()); //入库时间 | |
801 | + LambdaUpdateWrapper<TaskDetail> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
802 | + lambdaUpdateWrapper.eq(TaskDetail::getTaskId, task.getId()); | |
803 | + taskDetailService.update(taskDetail, lambdaUpdateWrapper); | |
804 | + if (!taskDetailService.update(taskDetail, lambdaUpdateWrapper)) { | |
805 | + throw new ServiceException("修改入库单明细失败"); | |
806 | + } | |
807 | + | |
808 | + } | |
809 | + | |
810 | + } | |
811 | + //修改任务主表状态,因为立库任务表单头只对应一个货箱,表单详情的任务会同时完成 | |
812 | + task.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
813 | + task.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
814 | + task.setLastUpdated(new Date()); | |
815 | + LambdaUpdateWrapper<TaskHeader> taskHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
816 | + taskHeaderLambdaUpdateWrapper.eq(TaskHeader::getId, task.getId()); | |
817 | + if (!taskHeaderService.update(task, taskHeaderLambdaUpdateWrapper)){ | |
818 | + throw new ServiceException("更新任务主表失败"); | |
819 | + } | |
820 | + //修改库位状态和对应的容器 | |
821 | + Location location = new Location(); | |
822 | + location.setContainerCode(task.getContainerCode()); | |
823 | + location.setStatus("empty"); | |
824 | + LambdaUpdateWrapper<Location> locationLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
825 | + locationLambdaUpdateWrapper.eq(Location::getCode, task.getToLocation()); | |
826 | + if (!locationService.update(location, locationLambdaUpdateWrapper)){ | |
827 | + throw new ServiceException("更新库位失败"); | |
828 | + } | |
829 | + //修改容器状态和对应的库位 | |
830 | + Container container = new Container(); | |
831 | + container.setLocationCode(task.getToLocation()); | |
832 | + container.setStatus("some"); | |
833 | + LambdaUpdateWrapper<Container> containerLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
834 | + containerLambdaUpdateWrapper.eq(Container::getCode, task.getContainerCode()); | |
835 | + if (!containerService.update(container, containerLambdaUpdateWrapper)) { | |
836 | + throw new ServiceException("更新容器失败"); | |
837 | + } | |
838 | + //修改组盘表状态为20 | |
839 | + ReceiptContainerDetail receiptContainerDetail = new ReceiptContainerDetail(); | |
840 | + receiptContainerDetail.setStatus(QuantityConstant.RECEIPT_CONTAINER_REVIEWSUCCESS); | |
841 | + receiptContainerDetail.setProcessStamp("0"); | |
842 | + receiptContainerDetail.setLastUpdated(new Date()); | |
843 | + receiptContainerDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
844 | + LambdaUpdateWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
845 | + receiptContainerDetailLambdaUpdateWrapper.eq(ReceiptContainerDetail::getReceiptId, DataUtils.getInteger(taskReceiptContainerDetail.get(0).get("receiptId"))); | |
846 | + if (!receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)){ | |
847 | + throw new ServiceException("更新组盘状态失败"); | |
848 | + } | |
849 | + | |
850 | + //修改入库组盘头表状态 | |
851 | + | |
852 | + ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); | |
853 | + receiptContainerHeader.setId(task.getAllocationHeadId()); | |
854 | + receiptContainerHeader.setLastUpdated(new Date()); | |
855 | + receiptContainerHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
856 | + receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_FINISHED.intValue()); | |
857 | + if (!receiptContainerHeaderService.updateById(receiptContainerHeader)) { | |
858 | + throw new ServiceException("更新入库组盘头表状态失败"); | |
859 | + } | |
860 | + | |
861 | + //修改入库单状态 | |
862 | + ReceiptHeader receiptHeader = new ReceiptHeader(); | |
863 | + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_POSTING); | |
864 | + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_POSTING); | |
865 | + receiptHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
866 | + receiptHeader.setLastUpdated(new Date()); | |
867 | + LambdaUpdateWrapper<ReceiptHeader> receiptHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
868 | + receiptHeaderLambdaUpdateWrapper.eq(ReceiptHeader::getId, DataUtils.getInteger(taskReceiptContainerDetail.get(0).get("receiptId"))); | |
869 | + if (!receiptHeaderService.update(receiptHeader, receiptHeaderLambdaUpdateWrapper)) { | |
870 | + throw new ServiceException("更新入库头表状态失败"); | |
871 | + } | |
872 | + return AjaxResult.success("完成入库任务"); | |
873 | + } | |
874 | + | |
875 | + @Transactional(rollbackFor = Exception.class) | |
876 | + public void combineInventory(TaskHeader task) { | |
877 | + LambdaQueryWrapper<InventoryHeader> inventoryHeaderErapper = Wrappers.lambdaQuery(); | |
878 | + inventoryHeaderErapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
879 | + .eq(InventoryHeader::getLocationCode, task.getToLocation()) | |
880 | + .eq(InventoryHeader::getContainerCode, task.getContainerCode()); | |
881 | + InventoryHeader header = inventoryHeaderService.getOne(inventoryHeaderErapper); | |
882 | + if(header != null) { | |
883 | + LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery(); | |
884 | + inventory.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
885 | + .eq(InventoryDetail::getLocationCode, task.getFromLocation()) | |
886 | + .eq(InventoryDetail::getContainerCode, task.getContainerCode()); | |
887 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventory); | |
888 | + for(int i=0; i < inventoryDetailList.size() -1; i++) { | |
889 | + for(int j = inventoryDetailList.size() - 1; j > i; j--) { | |
890 | + InventoryDetail inventoryDetail = inventoryDetailList.get(i); | |
891 | + InventoryDetail inventoryDetail2 = inventoryDetailList.get(j); | |
892 | + if(inventoryDetail.getMaterialCode().equals(inventoryDetail2.getMaterialCode()) | |
893 | + && inventoryDetail.getBatch().equals(inventoryDetail2.getBatch()) | |
894 | + && inventoryDetail.getLot().equals(inventoryDetail2.getLot()) | |
895 | + && inventoryDetail.getProjectNo().equals(inventoryDetail2.getProjectNo())) { | |
896 | + BigDecimal totalQty = inventoryDetailList.get(i).getQty().add(inventoryDetailList.get(j).getQty()); | |
897 | + inventoryDetailList.get(i).setQty(totalQty); | |
898 | + LambdaQueryWrapper<InventoryDetail> wrapper = Wrappers.lambdaQuery(); | |
899 | + wrapper.eq(InventoryDetail::getId, inventoryDetailList.get(i).getId()); | |
900 | + inventoryDetailService.update(inventoryDetailList.get(i), wrapper); | |
901 | + LambdaQueryWrapper<InventoryDetail> wrapper2 = Wrappers.lambdaQuery(); | |
902 | + wrapper2.eq(InventoryDetail::getId, inventoryDetailList.get(j).getId()); | |
903 | + inventoryDetailService.remove(wrapper2); | |
904 | + inventoryDetailList.remove(j); | |
905 | + } | |
906 | + } | |
907 | + } | |
908 | + BigDecimal totalQty = new BigDecimal(0); | |
909 | + int totalLines = 0; | |
910 | + for(InventoryDetail inventoryDetail : inventoryDetailList) { | |
911 | + totalQty = totalQty.add(inventoryDetail.getQty()); | |
912 | + totalLines++; | |
913 | + } | |
914 | + header.setTotalQty(totalQty); | |
915 | + header.setTotalLines(totalLines); | |
916 | + header.setContainerStatus("some"); | |
917 | + LambdaQueryWrapper<InventoryHeader> wrapper = Wrappers.lambdaQuery(); | |
918 | + wrapper.eq(InventoryHeader::getId, header.getId()); | |
919 | + inventoryHeaderService.update(header, wrapper); | |
920 | + } | |
921 | + } | |
922 | + | |
499 | 923 | /** |
500 | 924 | * 移动端创建入库任务 |
501 | 925 | * |
... | ... | @@ -518,11 +942,138 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
518 | 942 | } |
519 | 943 | List<Integer> idList = new ArrayList<>(); |
520 | 944 | idList.add(receiptContainerHeader.getId()); |
521 | - receiptTaskService.createReceiptTask(idList); | |
945 | + createReceiptTask(idList); | |
522 | 946 | |
523 | 947 | return AjaxResult.success(receiptContainerHeader); |
524 | 948 | } |
525 | 949 | |
950 | + | |
951 | + /** | |
952 | + * 完成移库任务 | |
953 | + * | |
954 | + * @param task | |
955 | + */ | |
956 | + @Transactional(rollbackFor = Exception.class) | |
957 | + public void completeTransferTask(TaskHeader task) { | |
958 | + //找到任务明细 | |
959 | + TaskDetail taskDetail = new TaskDetail(); | |
960 | + taskDetail.setTaskId(task.getId()); | |
961 | + taskDetail.setWarehouseCode(task.getWarehouseCode()); | |
962 | + taskDetail.setCompanyCode(task.getCompanyCode()); | |
963 | + taskDetail.setContainerCode(task.getContainerCode()); | |
964 | + LambdaQueryWrapper<TaskDetail> taskDetailLW = Wrappers.lambdaQuery(taskDetail); | |
965 | + taskDetail = taskDetailService.getOne(taskDetailLW); | |
966 | + //更新库存主表和明细的库位,更改更新用户和时间 | |
967 | + InventoryHeader inventoryHeader = new InventoryHeader(); | |
968 | + //主表 | |
969 | + inventoryHeader.setWarehouseCode(taskDetail.getWarehouseCode()); | |
970 | + inventoryHeader.setCompanyCode(taskDetail.getCompanyCode()); | |
971 | + inventoryHeader.setContainerCode(taskDetail.getContainerCode()); | |
972 | + inventoryHeader.setLocationCode(taskDetail.getFromLocation());//通过源库位查找库存 | |
973 | + LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(inventoryHeader); | |
974 | + inventoryHeader = inventoryHeaderService.getOne(inventoryHeaderLambdaQueryWrapper); | |
975 | + if (StringUtils.isNotNull(inventoryHeader)){ | |
976 | + inventoryHeader.setLocationCode(taskDetail.getToLocation());//把目的库位写入库存 | |
977 | + inventoryHeader.setLastUpdated(new Date()); | |
978 | + inventoryHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
979 | + inventoryHeaderService.saveOrUpdate(inventoryHeader);//修改主表库位 | |
980 | + | |
981 | + //明细表 | |
982 | + List<InventoryDetail> inventoryDetails = new ArrayList<>(); | |
983 | + InventoryDetail inventoryDetail = new InventoryDetail(); | |
984 | + inventoryDetail.setWarehouseCode(inventoryHeader.getWarehouseCode()); | |
985 | + inventoryDetail.setCompanyCode(inventoryHeader.getCompanyCode()); | |
986 | + inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); | |
987 | + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(inventoryDetail); | |
988 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); | |
989 | + /*同时写入库存交易表*/ | |
990 | + List<InventoryTransaction> inventoryTransactionList = new ArrayList<>(); | |
991 | + for (InventoryDetail item : inventoryDetailList) { | |
992 | + item.setLocationCode(inventoryHeader.getLocationCode());//修改明细表库位 | |
993 | + item.setLastUpdated(new Date()); | |
994 | + item.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
995 | + inventoryDetails.add(item); | |
996 | + /*----------*/ | |
997 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
998 | + inventoryTransaction.setWarehouseCode(task.getWarehouseCode()); | |
999 | + inventoryTransaction.setLocationCode(taskDetail.getToLocation()); | |
1000 | + inventoryTransaction.setContainerCode(taskDetail.getContainerCode()); | |
1001 | + inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_ADJUSTPROPERTIES); | |
1002 | + inventoryTransaction.setMaterialCode(item.getMaterialCode()); | |
1003 | + inventoryTransaction.setManufactureDate(item.getManufactureDate()); | |
1004 | + inventoryTransaction.setMaterialName(item.getMaterialName()); | |
1005 | + inventoryTransaction.setMaterialSpec(item.getMaterialSpec()); | |
1006 | + inventoryTransaction.setMaterialUnit(item.getMaterialUnit()); | |
1007 | + inventoryTransaction.setTaskQty(BigDecimal.ZERO); | |
1008 | + inventoryTransaction.setInventorySts(item.getInventorySts()); | |
1009 | + inventoryTransaction.setCompanyCode(item.getCompanyCode()); | |
1010 | + inventoryTransaction.setReferDetailId(item.getId().toString()); | |
1011 | + inventoryTransaction.setBatch(item.getBatch()); | |
1012 | + inventoryTransaction.setLot(item.getLot()); | |
1013 | + inventoryTransaction.setProjectNo(item.getProjectNo()); | |
1014 | + inventoryTransaction.setWeight(item.getWeight()); | |
1015 | + inventoryTransaction.setManufactureDate(item.getManufactureDate()); | |
1016 | + inventoryTransaction.setExpirationDate(item.getExpirationDate()); | |
1017 | + inventoryTransaction.setAgingDate(item.getCreated()); | |
1018 | + inventoryTransaction.setAttributeId(item.getAttributeId()); | |
1019 | + inventoryTransaction.setAttribute1(item.getAttribute1()); | |
1020 | + inventoryTransaction.setAttribute2(item.getAttribute2()); | |
1021 | + inventoryTransaction.setAttribute3(item.getAttribute3()); | |
1022 | + inventoryTransaction.setCreated(new Date()); | |
1023 | + inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName()); | |
1024 | + //inventoryTransaction.setLockCode(); | |
1025 | + inventoryTransaction.setBillCode(item.getInventoryHeaderId().toString()); | |
1026 | + inventoryTransaction.setBillDetailId(item.getId()); | |
1027 | + inventoryTransaction.setSupplierCode(item.getSupplierCode()); | |
1028 | + inventoryTransactionList.add(inventoryTransaction); | |
1029 | + } | |
1030 | + if(inventoryDetails != null && inventoryDetails.size() > 0) { | |
1031 | + if (inventoryDetailService.saveOrUpdateBatch(inventoryDetails)) { | |
1032 | + //更新库存明细成功后,写入库存交易 | |
1033 | + inventoryTransactionService.saveBatch(inventoryTransactionList); | |
1034 | + } else { | |
1035 | + throw new ServiceException("库存明细更新错误!"); | |
1036 | + } | |
1037 | + } | |
1038 | + | |
1039 | + } | |
1040 | + //更新托盘、库位状态 | |
1041 | + Location temp1 = new Location(); //源库位 | |
1042 | + temp1.setCode(taskDetail.getFromLocation()); | |
1043 | + temp1.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
1044 | + LambdaQueryWrapper<Location> lambdaQueryWrapper1 = Wrappers.lambdaQuery(temp1); | |
1045 | + Location loc1 = locationService.getOne(lambdaQueryWrapper1); | |
1046 | + | |
1047 | + Location temp2 = new Location();//目的库位 | |
1048 | + temp2.setCode(taskDetail.getToLocation()); | |
1049 | + temp2.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
1050 | + LambdaQueryWrapper<Location> lambdaQueryWrapper2 = Wrappers.lambdaQuery(temp2); | |
1051 | + Location loc2 = locationService.getOne(lambdaQueryWrapper2); | |
1052 | + loc2.setContainerCode(loc1.getContainerCode()); | |
1053 | + loc2.setStatus("empty"); | |
1054 | + loc1.setContainerCode(""); | |
1055 | + loc1.setStatus("empty"); | |
1056 | + locationService.saveOrUpdate(loc1); | |
1057 | + locationService.saveOrUpdate(loc2); | |
1058 | + | |
1059 | + Container container = containerService.findAllByCode(task.getContainerCode()); | |
1060 | + container.setLocationCode(task.getToLocation()); | |
1061 | + if (!containerService.updateById(container)){ | |
1062 | + throw new ServiceException("更新容器失败"); | |
1063 | + } | |
1064 | + | |
1065 | + //更新taskHeader状态 | |
1066 | + task.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
1067 | + task.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
1068 | + task.setLastUpdated(new Date()); | |
1069 | + taskHeaderService.saveOrUpdate(task); | |
1070 | + //更新taskDetail状态 | |
1071 | + taskDetail.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
1072 | + taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
1073 | + taskDetail.setLastUpdated(new Date()); | |
1074 | + taskDetailService.saveOrUpdate(taskDetail); | |
1075 | + } | |
1076 | + | |
526 | 1077 | /** |
527 | 1078 | * 盘点完成 |
528 | 1079 | * |
... | ... | @@ -578,6 +1129,191 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
578 | 1129 | } |
579 | 1130 | |
580 | 1131 | /** |
1132 | + * 完成空托盘入库任务 | |
1133 | + * | |
1134 | + * @param taskHeader | |
1135 | + */ | |
1136 | + @Transactional(rollbackFor = Exception.class) | |
1137 | + public void completeEmptyIn(TaskHeader taskHeader) { | |
1138 | + | |
1139 | + //完成任务,修改主单和明细状态 | |
1140 | + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
1141 | + taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
1142 | + taskHeader.setLastUpdated(new Date()); | |
1143 | + //taskHeaderService.saveOrUpdate(taskHeader); | |
1144 | + //taskDetail更新明细单总的状态 | |
1145 | + TaskDetail taskDetail = new TaskDetail(); | |
1146 | + taskDetail.setWarehouseCode(taskHeader.getWarehouseCode()); | |
1147 | + taskDetail.setTaskType(taskHeader.getTaskType()); | |
1148 | + taskDetail.setTaskId(taskHeader.getId()); | |
1149 | + LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(taskDetail); | |
1150 | + List<TaskDetail> taskDetailList = taskDetailService.list(lambdaQueryWrapper);//查询子单 | |
1151 | + for (TaskDetail item : taskDetailList) { | |
1152 | + item.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
1153 | + item.setLastUpdatedBy(ShiroUtils.getLoginName()); //更新用户 | |
1154 | + item.setLastUpdated(new Date()); //更新时间 | |
1155 | + } | |
1156 | + if (taskDetailService.saveOrUpdateBatch(taskDetailList) == false || | |
1157 | + taskHeaderService.saveOrUpdate(taskHeader) == false) { | |
1158 | + throw new ServiceException("任务单据状态更新失败!"); | |
1159 | + } | |
1160 | + //解锁容器,更新库位 | |
1161 | + containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), taskHeader.getToLocation(), "empty"); | |
1162 | + //解锁库位,更新容器 | |
1163 | + locationService.updateContainerCodeAndStatus(taskHeader.getToLocation(), taskHeader.getContainerCode(), "empty"); | |
1164 | + | |
1165 | + //写入库存头表 | |
1166 | + InventoryHeader inventoryHeader = new InventoryHeader(); | |
1167 | + inventoryHeader.setWarehouseCode(taskHeader.getWarehouseCode()); | |
1168 | + inventoryHeader.setLocationCode(taskHeader.getToLocation()); | |
1169 | + inventoryHeader.setContainerCode(taskHeader.getContainerCode()); | |
1170 | + inventoryHeader.setContainerStatus("empty"); | |
1171 | + inventoryHeader.setCompanyCode(taskHeader.getCompanyCode()); | |
1172 | + inventoryHeader.setMaterialSkuQty("0"); | |
1173 | + inventoryHeader.setTotalWeight("0"); | |
1174 | + inventoryHeader.setTotalQty(new BigDecimal(0)); | |
1175 | + inventoryHeader.setTotalLines(0); | |
1176 | + inventoryHeader.setProjectNos(""); | |
1177 | + inventoryHeader.setBatchs(""); | |
1178 | + inventoryHeader.setLots(""); | |
1179 | + inventoryHeader.setLockRemark(""); | |
1180 | + inventoryHeader.setCreated(new Date()); | |
1181 | + inventoryHeader.setCreatedBy(ShiroUtils.getLoginName()); | |
1182 | + inventoryHeader.setLastUpdated(new Date()); | |
1183 | + inventoryHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
1184 | + Boolean j = inventoryHeaderService.save(inventoryHeader); | |
1185 | + if(!j){ | |
1186 | + throw new ServiceException("新增空托库存头失败!"); | |
1187 | + | |
1188 | + } | |
1189 | + } | |
1190 | + | |
1191 | + /** | |
1192 | + * 创建上架任务 | |
1193 | + * | |
1194 | + * @param ids | |
1195 | + * @return | |
1196 | + */ | |
1197 | + @Override | |
1198 | + @Transactional(rollbackFor = Exception.class) | |
1199 | + public AjaxResult createReceiptTask(List<Integer> ids) { | |
1200 | + for (Integer id : ids) { | |
1201 | + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(id); | |
1202 | + if (receiptContainerHeader == null) { | |
1203 | + throw new ServiceException("任务不存在!"); | |
1204 | + } | |
1205 | + | |
1206 | + if (!receiptContainerHeader.getWarehouseCode().equals(ShiroUtils.getWarehouseCode())) { | |
1207 | + throw new ServiceException("任务不在当前仓库!"); | |
1208 | + } | |
1209 | + | |
1210 | + //锁定容器 | |
1211 | + Container container = new Container(); | |
1212 | + container.setStatus("lock"); | |
1213 | + LambdaUpdateWrapper<Container> containerUpdateWrapper = Wrappers.lambdaUpdate(); | |
1214 | + containerUpdateWrapper.eq(Container::getCode, receiptContainerHeader.getContainerCode()); | |
1215 | + containerService.update(container, containerUpdateWrapper); | |
1216 | + | |
1217 | + //查询入库组盘明细 | |
1218 | + LambdaQueryWrapper<ReceiptContainerDetail> containerDetailLambda = Wrappers.lambdaQuery(); | |
1219 | + containerDetailLambda.eq(ReceiptContainerDetail::getReceiptContainerId, id); | |
1220 | + List<ReceiptContainerDetail> list = receiptContainerDetailService.list(containerDetailLambda); | |
1221 | + | |
1222 | + if (list.size() < 1) { | |
1223 | + throw new ServiceException("没有组盘明细,请先组盘!"); | |
1224 | + } | |
1225 | + if (receiptContainerHeader.getStatus() == QuantityConstant.RECEIPT_CONTAINER_BUILD.intValue()) { | |
1226 | + if (receiptContainerHeader.getStatus().intValue() < QuantityConstant.RECEIPT_CONTAINER_TASK) { | |
1227 | + receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_TASK.intValue()); | |
1228 | + receiptContainerHeaderService.updateById(receiptContainerHeader); | |
1229 | + } | |
1230 | + //添加任务主表 | |
1231 | + TaskHeader task = new TaskHeader(); | |
1232 | + task.setAllocationHeadId(receiptContainerHeader.getId()); | |
1233 | + task.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_SHELF); | |
1234 | + task.setWarehouseCode(receiptContainerHeader.getWarehouseCode()); | |
1235 | + task.setCompanyCode(receiptContainerHeader.getCompanyCode()); | |
1236 | + task.setTaskType(Integer.valueOf(receiptContainerHeader.getTaskType())); | |
1237 | + task.setFromLocation(receiptContainerHeader.getFromLocation()); | |
1238 | + task.setToLocation(receiptContainerHeader.getToLocation()); | |
1239 | + task.setContainerCode(receiptContainerHeader.getContainerCode()); | |
1240 | + task.setRecvDock(receiptContainerHeader.getRecvDock()); | |
1241 | + task.setCreated(new Date()); | |
1242 | + task.setCreatedBy(ShiroUtils.getLoginName()); | |
1243 | + if (this.save(task)) { | |
1244 | + //添加任务明细表 | |
1245 | + int conatinQty = 0; | |
1246 | + for (ReceiptContainerDetail item : list) { | |
1247 | + LambdaQueryWrapper<ContainerCapacity> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
1248 | + String[] containCodeSplit = task.getContainerCode().split("\\D"); | |
1249 | + String containType = containCodeSplit[0]; | |
1250 | + lambdaQueryWrapper.eq(ContainerCapacity::getContainerType, task.getContainerCode()) | |
1251 | + .eq(ContainerCapacity::getMaterialCode, item.getMaterialCode()) | |
1252 | + .eq(ContainerCapacity::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
1253 | + .eq(ContainerCapacity::getEnable, 0); | |
1254 | + ContainerCapacity containerCapacity = containerCapacityService.getOne(lambdaQueryWrapper); | |
1255 | + | |
1256 | + TaskDetail taskDetail = new TaskDetail(); | |
1257 | + taskDetail.setTaskId(task.getId()); | |
1258 | + taskDetail.setTaskType(Integer.valueOf(receiptContainerHeaderService.getById(item.getReceiptContainerId()).getTaskType())); | |
1259 | + taskDetail.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_SHELF); | |
1260 | + taskDetail.setWarehouseCode(task.getWarehouseCode()); | |
1261 | + taskDetail.setAllocationId(item.getId()); | |
1262 | + taskDetail.setCompanyCode(task.getCompanyCode()); | |
1263 | + taskDetail.setCompanyCode(task.getCompanyCode()); | |
1264 | + taskDetail.setMaterialCode(item.getMaterialCode()); | |
1265 | + taskDetail.setMaterialName(item.getMaterialName()); | |
1266 | + taskDetail.setMaterialSpec(item.getMaterialSpec()); | |
1267 | + taskDetail.setMaterialUnit(item.getMaterialUnit()); | |
1268 | + taskDetail.setBillCode(item.getReceiptCode()); | |
1269 | + taskDetail.setBillDetailId(item.getReceiptDetailId()); | |
1270 | + taskDetail.setBillCode(item.getReceiptCode()); | |
1271 | + taskDetail.setQty(item.getQty()); | |
1272 | + taskDetail.setContainerCode(task.getContainerCode()); | |
1273 | + taskDetail.setFromLocation(task.getFromLocation()); | |
1274 | + taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
1275 | + taskDetail.setBatch(item.getBatch()); | |
1276 | + taskDetail.setProjectNo(item.getProjectNo()); | |
1277 | + if (containerCapacity != null) { | |
1278 | + conatinQty += (int) Math.floor(item.getQty().intValue() / containerCapacity.getQty().intValue()); | |
1279 | + taskDetail.setContainQty((int) Math.floor(item.getQty().intValue() / containerCapacity.getQty().intValue())); | |
1280 | + } | |
1281 | + if (!taskDetailService.save(taskDetail)) { | |
1282 | + throw new ServiceException("生成任务明细失败"); | |
1283 | + } | |
1284 | + | |
1285 | + //更新入库组盘明细状态 | |
1286 | + item.setStatus(QuantityConstant.RECEIPT_CONTAINER_TASK); | |
1287 | + if (!receiptContainerDetailService.updateById(item)) { | |
1288 | + throw new ServiceException("更新入库组盘明细状态出错"); | |
1289 | + } | |
1290 | + | |
1291 | + /** | |
1292 | + * 修改明细状态为上架 | |
1293 | + */ | |
1294 | + ReceiptDetail receiptDetail = receiptDetailService.getById(item.getReceiptDetailId()); | |
1295 | + receiptDetail.setProcessStamp(String.valueOf(QuantityConstant.RECEIPT_HEADER_SHELF)); | |
1296 | + if (!receiptDetailService.updateById(receiptDetail)) { | |
1297 | + throw new ServiceException("更新入库单详情失败"); | |
1298 | + } | |
1299 | + //更新头表状态 | |
1300 | + receiptDetailService.updateReceiptHeaderLastStatus(receiptDetail.getReceiptId()); | |
1301 | + | |
1302 | + } | |
1303 | + | |
1304 | + task.setContainQty(conatinQty); | |
1305 | + if (!taskHeaderService.updateById(task)) { | |
1306 | + throw new ServiceException("更新任务头表容器数量失败"); | |
1307 | + } | |
1308 | + } else { | |
1309 | + throw new ServiceException("生成任务头表失败"); | |
1310 | + } | |
1311 | + } | |
1312 | + } | |
1313 | + return AjaxResult.success("生成上架任务成功"); | |
1314 | + } | |
1315 | + | |
1316 | + /** | |
581 | 1317 | * 自动空托出库 |
582 | 1318 | * */ |
583 | 1319 | @Override |
... | ... | @@ -604,7 +1340,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
604 | 1340 | inventoryHeaderService.createEmptyOut(container.getCode(), location.getCode()); |
605 | 1341 | return AjaxResult.success("空容器出库任务已下发!",container.getCode()); |
606 | 1342 | } |
607 | - | |
1343 | + | |
608 | 1344 | /** |
609 | 1345 | * 自动分配库位 |
610 | 1346 | * @param taskId 任务号 |
... | ... | @@ -621,11 +1357,26 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
621 | 1357 | if (StringUtils.isNotEmpty(taskHeader.getToLocation())) { |
622 | 1358 | return AjaxResult.success("任务已经有目的库位,不需要再分配"); |
623 | 1359 | } |
1360 | +// Location location = new Location(); | |
1361 | +// location.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
1362 | +// | |
1363 | +// location.setContainerCode(""); | |
1364 | +// location.setStatus("empty"); | |
1365 | +// location.setDeleted(false); | |
1366 | +// if("M".equals(taskHeader.getContainerCode().substring(0,1))){ | |
1367 | +// if (high.intValue() == 1) { | |
1368 | +// location.setILayer(5); | |
1369 | +// } | |
1370 | +// } | |
624 | 1371 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
625 | 1372 | locationLambdaQueryWrapper.eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode()) |
626 | 1373 | .eq(Location::getContainerCode,"") |
627 | 1374 | .eq(Location::getStatus,"empty") |
628 | 1375 | .eq(Location::getDeleted,false); |
1376 | +// location = locationService.getOne(locationLambdaQueryWrapper); | |
1377 | +// if (location == null) { | |
1378 | +// throw new ServiceException("没有对应库位可以分配给容器了!"); | |
1379 | +// } | |
629 | 1380 | List<Location> locations = locationService.list(locationLambdaQueryWrapper); |
630 | 1381 | if (locations.size() == 0) { |
631 | 1382 | throw new ServiceException("没有空闲库位!"); |
... | ... | @@ -639,6 +1390,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
639 | 1390 | //锁定库位 |
640 | 1391 | locationService.updateStatus(location.getCode(),"lock"); |
641 | 1392 | //给组盘分配库位 |
1393 | + | |
642 | 1394 | int internalTaskType = taskHeader.getInternalTaskType(); |
643 | 1395 | if(internalTaskType == QuantityConstant.TASK_TYPE_WHOLERECEIPT.intValue() || internalTaskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT.intValue() ) { |
644 | 1396 | ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); |
... | ... | @@ -651,14 +1403,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
651 | 1403 | condition.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
652 | 1404 | condition.setTaskId(taskHeader.getId()); |
653 | 1405 | LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(condition); |
654 | - List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambdaQueryWrapper); | |
655 | - if(taskDetailList != null && taskDetailList.size() > 0) { | |
656 | - for(TaskDetail taskDetail : taskDetailList) { | |
657 | - if (taskDetail != null) { | |
658 | - taskDetail.setToLocation(location.getCode()); | |
659 | - taskDetailService.update(taskDetail, taskDetailLambdaQueryWrapper); | |
660 | - } | |
661 | - } | |
1406 | + TaskDetail taskDetail = taskDetailService.getOne(taskDetailLambdaQueryWrapper); | |
1407 | + if (taskDetail != null) { | |
1408 | + taskDetail.setToLocation(location.getCode()); | |
1409 | + taskDetailService.update(taskDetail, taskDetailLambdaQueryWrapper); | |
662 | 1410 | } |
663 | 1411 | } |
664 | 1412 | //给任务分配库位 |
... | ... | @@ -669,4 +1417,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
669 | 1417 | |
670 | 1418 | } |
671 | 1419 | |
1420 | + | |
1421 | + | |
1422 | + | |
1423 | + | |
1424 | + | |
672 | 1425 | } |
673 | 1426 | \ No newline at end of file |
... | ... |
src/main/resources/application-druid.properties
... | ... | @@ -4,12 +4,12 @@ spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver |
4 | 4 | # Ö÷¿â |
5 | 5 | spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8 |
6 | 6 | #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/huahengExample?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false |
7 | -#spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms_v2?characterEncoding=utf8&serverTimezone=GMT%2b8 | |
7 | +#spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms2?characterEncoding=utf8&serverTimezone=GMT%2b8 | |
8 | 8 | |
9 | 9 | spring.datasource.druid.master.username=softhuaheng |
10 | 10 | spring.datasource.druid.master.password=HHrobot123. |
11 | 11 | #spring.datasource.druid.master.username=root |
12 | -#spring.datasource.druid.master.password=123456 | |
12 | +#spring.datasource.druid.master.password=hhsoftware | |
13 | 13 | # ´Ó¿â |
14 | 14 | spring.datasource.druid.slave.open = false |
15 | 15 | spring.datasource.druid.slave.url=jdbc:mysql://199.19.109.117:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false |
... | ... |
src/main/resources/templates/shipment/shipmentContainerHeader/shipmentContainerHeader.html
src/main/resources/templates/shipment/shipmentDetail/add.html
... | ... | @@ -46,6 +46,12 @@ |
46 | 46 | </div> |
47 | 47 | </div> |
48 | 48 | <div class="form-group"> |
49 | + <label class="col-sm-3 control-label">出库站台:</label> | |
50 | + <div class="col-sm-8"> | |
51 | + <select id="stationCode" name="stationCode" class="form-control"></select> | |
52 | + </div> | |
53 | + </div> | |
54 | + <div class="form-group"> | |
49 | 55 | <label class="col-sm-3 control-label">批次:</label> |
50 | 56 | <div class="col-sm-8"> |
51 | 57 | <input id="batch" name="batch" class="form-control" type="text"> |
... | ... | @@ -198,6 +204,19 @@ |
198 | 204 | } |
199 | 205 | } |
200 | 206 | }); |
207 | + $('#stationCode').select2({ | |
208 | + ajax: { | |
209 | + url: ctx+'config/station/getData', | |
210 | + dataType: 'json', | |
211 | + type: 'post', | |
212 | + data: function (params) { | |
213 | + let query = { | |
214 | + code: params.term, | |
215 | + } | |
216 | + return query; | |
217 | + } | |
218 | + } | |
219 | + }); | |
201 | 220 | }) |
202 | 221 | </script> |
203 | 222 | </body> |
... | ... |
src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
src/main/resources/templates/task/taskHeader/taskHeader.html