Commit 58872808a82b899a43ca7a98d7c86ec199d46150
Merge branch 'develop' of http://172.16.29.40:8010/wms/wms4 into develop
# Conflicts: # huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
Showing
12 changed files
with
605 additions
and
41 deletions
ant-design-vue-jeecg/src/views/system/config/modules/MaterialMultipleForm.vue
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | /> |
15 | 15 | </a-form-model-item> |
16 | 16 | </a-col> |
17 | - <a-col :span="24"> | |
17 | + <!-- <a-col :span="24"> | |
18 | 18 | <a-form-model-item label="基准单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unit1"> |
19 | 19 | <j-dict-select-tag |
20 | 20 | type="list" |
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | placeholder="请选择基准单位" |
24 | 24 | /> |
25 | 25 | </a-form-model-item> |
26 | - </a-col> | |
26 | + </a-col> --> | |
27 | 27 | <a-col :span="24"> |
28 | 28 | <a-form-model-item label="转换单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unit2"> |
29 | 29 | <j-dict-select-tag |
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | </a-col> |
37 | 37 | <a-col :span="24"> |
38 | 38 | <a-form-model-item label="转换比率" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="multiple"> |
39 | - <a-input-number v-model="model.multiple" placeholder="请输入单位1转单位2换算倍数" style="width: 100%"/> | |
39 | + <a-input-number v-model="model.multiple" placeholder="转换比率" style="width: 100%"/> | |
40 | 40 | </a-form-model-item> |
41 | 41 | </a-col> |
42 | 42 | </a-row> |
... | ... | @@ -77,14 +77,11 @@ export default { |
77 | 77 | materialCode: [ |
78 | 78 | {required: true, message: '请输入物料编码!'}, |
79 | 79 | ], |
80 | - unit1: [ | |
81 | - {required: true, message: '请输入单位1!'}, | |
82 | - ], | |
83 | 80 | unit2: [ |
84 | - {required: true, message: '请输入单位2!'}, | |
81 | + {required: true, message: '请输入转换单位!'}, | |
85 | 82 | ], |
86 | 83 | multiple: [ |
87 | - {required: true, message: '请输入单位1转单位2换算倍数!'}, | |
84 | + {required: true, message: '请输入转换比率!'}, | |
88 | 85 | ], |
89 | 86 | }, |
90 | 87 | url: { |
... | ... |
ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailEditModal.vue
... | ... | @@ -28,7 +28,12 @@ |
28 | 28 | </a-col> |
29 | 29 | <a-col :span="24"> |
30 | 30 | <a-form-model-item label="物料单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit"> |
31 | - <a-input v-model="model.materialUnit" placeholder="请输入物料单位" style="width: 100%"/> | |
31 | + <j-dict-select-tag | |
32 | + type="list" | |
33 | + v-model="model.materialUnit" | |
34 | + dictCode="material_unit" | |
35 | + placeholder="请选择物料单位" | |
36 | + /> | |
32 | 37 | </a-form-model-item> |
33 | 38 | </a-col> |
34 | 39 | <a-col :span="24"> |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/materialMultiple/controller/MaterialMultipleController.java
... | ... | @@ -102,6 +102,7 @@ public class MaterialMultipleController extends JeecgController<MaterialMultiple |
102 | 102 | materialMultiple.setMaterialName(material.getName()); |
103 | 103 | materialMultiple.setCompanyCode(material.getCompanyCode()); |
104 | 104 | materialMultiple.setMaterialSpec(material.getSpec()); |
105 | + materialMultiple.setUnit1(material.getUnit()); | |
105 | 106 | materialMultipleService.save(materialMultiple); |
106 | 107 | return Result.OK("添加成功!"); |
107 | 108 | } |
... | ... | @@ -123,6 +124,7 @@ public class MaterialMultipleController extends JeecgController<MaterialMultiple |
123 | 124 | materialMultiple.setMaterialName(material.getName()); |
124 | 125 | materialMultiple.setCompanyCode(material.getCompanyCode()); |
125 | 126 | materialMultiple.setMaterialSpec(material.getSpec()); |
127 | + materialMultiple.setUnit1(material.getUnit()); | |
126 | 128 | materialMultipleService.updateById(materialMultiple); |
127 | 129 | return Result.OK("编辑成功!"); |
128 | 130 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/materialMultiple/entity/MaterialMultiple.java
... | ... | @@ -35,59 +35,74 @@ public class MaterialMultiple implements Serializable { |
35 | 35 | @TableId(type = IdType.AUTO) |
36 | 36 | @ApiModelProperty(value = "主键") |
37 | 37 | private Integer id; |
38 | + | |
38 | 39 | /** 物料编码 */ |
39 | 40 | @Excel(name = "物料编码", width = 15) |
40 | 41 | @ApiModelProperty(value = "物料编码") |
41 | 42 | private String materialCode; |
43 | + | |
42 | 44 | /** 物料名称 */ |
43 | 45 | @Excel(name = "物料名称", width = 15) |
44 | 46 | @ApiModelProperty(value = "物料名称") |
45 | 47 | private String materialName; |
48 | + | |
46 | 49 | /** 物料规格 */ |
47 | 50 | @Excel(name = "物料规格", width = 15) |
48 | 51 | @ApiModelProperty(value = "物料规格") |
49 | 52 | private String materialSpec; |
53 | + | |
50 | 54 | /** 仓库编码 */ |
51 | 55 | @Excel(name = "仓库编码", width = 15) |
52 | 56 | @ApiModelProperty(value = "仓库编码") |
53 | 57 | private String warehouseCode; |
58 | + | |
54 | 59 | /** 货主编码 */ |
55 | 60 | @Excel(name = "货主编码", width = 15) |
56 | 61 | @ApiModelProperty(value = "货主编码") |
57 | 62 | private String companyCode; |
63 | + | |
58 | 64 | /** 基准单位 */ |
59 | 65 | @Excel(name = "基准单位", width = 15) |
60 | 66 | @ApiModelProperty(value = "基准单位") |
61 | 67 | private String unit1; |
68 | + | |
62 | 69 | /** 转换单位 */ |
63 | 70 | @Excel(name = "转换单位", width = 15) |
64 | 71 | @ApiModelProperty(value = "转换单位") |
65 | 72 | private String unit2; |
73 | + | |
66 | 74 | /** 转换比率 */ |
67 | 75 | @Excel(name = "转换比率", width = 15) |
68 | 76 | @ApiModelProperty(value = "转换比率") |
69 | - private Double multiple; | |
77 | + private BigDecimal multiple; | |
78 | + | |
70 | 79 | /** 备用字段1 */ |
71 | 80 | @Excel(name = "备用字段1", width = 15) |
72 | 81 | @ApiModelProperty(value = "备用字段1") |
73 | 82 | private String userdef1; |
83 | + | |
74 | 84 | /** 备用字段2 */ |
75 | 85 | @Excel(name = "备用字段2", width = 15) |
76 | 86 | @ApiModelProperty(value = "备用字段2") |
77 | 87 | private String userdef2; |
88 | + | |
78 | 89 | /** 备用字段3 */ |
79 | 90 | @Excel(name = "备用字段3", width = 15) |
80 | 91 | @ApiModelProperty(value = "备用字段3") |
81 | 92 | private String userdef3; |
93 | + | |
82 | 94 | /** 创建人 */ |
83 | 95 | @ApiModelProperty(value = "创建人") |
84 | 96 | private String createBy; |
97 | + | |
85 | 98 | /** 创建日期 */ |
86 | 99 | @ApiModelProperty(value = "创建日期") |
87 | 100 | private Date createTime; |
101 | + | |
88 | 102 | /** 更新人 */ |
89 | 103 | @ApiModelProperty(value = "更新人") |
90 | 104 | private String updateBy; |
105 | + | |
91 | 106 | /** 更新日期 */ |
92 | 107 | @ApiModelProperty(value = "更新日期") |
93 | 108 | private Date updateTime; |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/materialMultiple/service/IMaterialMultipleService.java
... | ... | @@ -2,6 +2,7 @@ package org.jeecg.modules.wms.config.materialMultiple.service; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | 4 | import org.jeecg.modules.wms.config.materialMultiple.entity.MaterialMultiple; |
5 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail; | |
5 | 6 | |
6 | 7 | /** |
7 | 8 | * @Description: 物料单位换算 |
... | ... | @@ -11,4 +12,8 @@ import org.jeecg.modules.wms.config.materialMultiple.entity.MaterialMultiple; |
11 | 12 | */ |
12 | 13 | public interface IMaterialMultipleService extends IService<MaterialMultiple> { |
13 | 14 | |
15 | + void materialMultiple(TaskDetail taskDetail); | |
16 | + | |
17 | + MaterialMultiple getMaterialMultiple(String materialCode, String materialUnit); | |
18 | + | |
14 | 19 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/materialMultiple/service/impl/MaterialMultipleServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.config.materialMultiple.service.impl; |
2 | 2 | |
3 | +import java.util.List; | |
4 | + | |
5 | +import javax.annotation.Resource; | |
6 | + | |
3 | 7 | import org.jeecg.modules.wms.config.materialMultiple.entity.MaterialMultiple; |
4 | 8 | import org.jeecg.modules.wms.config.materialMultiple.mapper.MaterialMultipleMapper; |
5 | 9 | import org.jeecg.modules.wms.config.materialMultiple.service.IMaterialMultipleService; |
10 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail; | |
11 | +import org.springframework.cache.annotation.Cacheable; | |
6 | 12 | import org.springframework.stereotype.Service; |
7 | 13 | |
14 | +import com.aliyuncs.utils.StringUtils; | |
15 | +import com.baomidou.mybatisplus.core.conditions.Wrapper; | |
16 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
17 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
8 | 18 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
9 | 19 | |
10 | 20 | /** |
... | ... | @@ -16,4 +26,38 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
16 | 26 | @Service |
17 | 27 | public class MaterialMultipleServiceImpl extends ServiceImpl<MaterialMultipleMapper, MaterialMultiple> implements IMaterialMultipleService { |
18 | 28 | |
29 | + @Resource | |
30 | + private IMaterialMultipleService materialMultipleService; | |
31 | + | |
32 | + /** | |
33 | + * 计算换算单位数量 | |
34 | + */ | |
35 | + @Override | |
36 | + public void materialMultiple(TaskDetail taskDetail) { | |
37 | + if (StringUtils.isEmpty(taskDetail.getMaterialCode()) || StringUtils.isEmpty(taskDetail.getMaterialUnit())) { | |
38 | + return; | |
39 | + } | |
40 | + MaterialMultiple materialMultiple = materialMultipleService.getMaterialMultiple(taskDetail.getMaterialCode(), taskDetail.getMaterialUnit()); | |
41 | + if (materialMultiple == null) { | |
42 | + return; | |
43 | + } | |
44 | + taskDetail.setMaterialUnit(materialMultiple.getUnit1()); | |
45 | + taskDetail.setQty(taskDetail.getQty().multiply(materialMultiple.getMultiple())); | |
46 | + } | |
47 | + | |
48 | + @Override | |
49 | + @Cacheable(value = "materialMultipleService#1", key = "#root.methodName + '_' + #materialCode + '_' + #materialUnit") | |
50 | + public MaterialMultiple getMaterialMultiple(String materialCode, String materialUnit) { | |
51 | + // TODO Auto-generated method stub | |
52 | + LambdaQueryWrapper<MaterialMultiple> queryWrapper = Wrappers.lambdaQuery(); | |
53 | + queryWrapper.eq(MaterialMultiple::getMaterialCode, materialCode); | |
54 | + queryWrapper.eq(MaterialMultiple::getUnit2, materialUnit); | |
55 | + queryWrapper.orderByDesc(MaterialMultiple::getId); | |
56 | + List<MaterialMultiple> materialMultipleList = this.list(queryWrapper); | |
57 | + if (materialMultipleList != null && !materialMultipleList.isEmpty()) { | |
58 | + return materialMultipleList.get(0); | |
59 | + } | |
60 | + return null; | |
61 | + } | |
62 | + | |
19 | 63 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java
... | ... | @@ -525,6 +525,14 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
525 | 525 | |
526 | 526 | List<String> containerCodeList = inventoryDetailList.stream().map(InventoryDetail::getContainerCode).collect(Collectors.toList()); |
527 | 527 | for (String containerCode : containerCodeList) { |
528 | + //存在冻结状态的库存详情就不能创建质检任务 | |
529 | + LambdaQueryWrapper<InventoryDetail> inventoryDetailWrapper = Wrappers.lambdaQuery(); | |
530 | + inventoryDetailWrapper.eq(InventoryDetail::getContainerCode,containerCode); | |
531 | + List<InventoryDetail> inventoryDetailList1 = inventoryDetailService.list(inventoryDetailWrapper); | |
532 | + List<Integer> enableList = inventoryDetailList1.stream().map(InventoryDetail::getEnable).distinct().collect(Collectors.toList()); | |
533 | + if (enableList.contains(QuantityConstant.INVENTORY_DETAIL_STATUS_CONTAINER)) { | |
534 | + return Result.error("质检库存详情失败,托盘" + containerCode + "存在冻结的库存详情"); | |
535 | + } | |
528 | 536 | Result result = taskHeaderService.createQualityTask(containerCode, toPortCode, warehouseCode); |
529 | 537 | if (!result.isSuccess()) { |
530 | 538 | throw new JeecgBootException(result.getMessage()); |
... | ... |
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, false); | |
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/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
... | ... | @@ -21,6 +21,7 @@ import org.jeecg.modules.wms.config.locationType.entity.LocationType; |
21 | 21 | import org.jeecg.modules.wms.config.locationType.service.ILocationTypeService; |
22 | 22 | import org.jeecg.modules.wms.config.material.entity.Material; |
23 | 23 | import org.jeecg.modules.wms.config.material.service.IMaterialService; |
24 | +import org.jeecg.modules.wms.config.materialMultiple.service.IMaterialMultipleService; | |
24 | 25 | import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; |
25 | 26 | import org.jeecg.modules.wms.config.port.entity.Port; |
26 | 27 | import org.jeecg.modules.wms.config.port.service.IPortService; |
... | ... | @@ -97,71 +98,106 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
97 | 98 | |
98 | 99 | @Autowired |
99 | 100 | private TaskHeaderMapper taskHeaderMapper; |
101 | + | |
100 | 102 | @Autowired |
101 | 103 | private TaskDetailMapper taskDetailMapper; |
104 | + | |
102 | 105 | @Resource |
103 | 106 | private ILocationService locationService; |
107 | + | |
104 | 108 | @Resource |
105 | 109 | private ITaskHeaderService taskHeaderService; |
110 | + | |
106 | 111 | @Resource |
107 | 112 | private ITaskDetailService taskDetailService; |
113 | + | |
108 | 114 | @Resource |
109 | 115 | private IContainerService containerService; |
116 | + | |
110 | 117 | @Resource |
111 | 118 | private IInventoryHeaderService inventoryHeaderService; |
119 | + | |
112 | 120 | @Resource |
113 | 121 | private IInventoryDetailService inventoryDetailService; |
122 | + | |
114 | 123 | @Resource |
115 | 124 | private IInventoryTransactionService inventoryTransactionService; |
125 | + | |
116 | 126 | @Resource |
117 | 127 | private IReceiptDetailService receiptDetailService; |
128 | + | |
118 | 129 | @Resource |
119 | 130 | private IReceiptHeaderService receiptHeaderService; |
131 | + | |
120 | 132 | @Resource |
121 | 133 | private IReceiptContainerHeaderService receiptContainerHeaderService; |
134 | + | |
122 | 135 | @Resource |
123 | 136 | private IShipmentContainerDetailService shipmentContainerDetailService; |
137 | + | |
124 | 138 | @Resource |
125 | 139 | private IShipmentContainerHeaderService shipmentContainerHeaderService; |
140 | + | |
126 | 141 | @Resource |
127 | 142 | private IShipmentHeaderService shipmentHeaderService; |
143 | + | |
128 | 144 | @Resource |
129 | 145 | private IShipmentDetailService shipmentDetailService; |
146 | + | |
130 | 147 | @Resource |
131 | 148 | private CycleCountDetailServiceImpl cycleCountDetailService; |
149 | + | |
132 | 150 | @Resource |
133 | 151 | private WcsService wcsService; |
152 | + | |
134 | 153 | @Resource |
135 | 154 | private IPortService portService; |
155 | + | |
136 | 156 | @Resource |
137 | 157 | private IParameterConfigurationService parameterConfigurationService; |
158 | + | |
138 | 159 | @Resource |
139 | 160 | private IZoneService zoneService; |
161 | + | |
140 | 162 | @Resource |
141 | 163 | private ILocationTypeService locationTypeService; |
164 | + | |
142 | 165 | @Resource |
143 | 166 | private ILocationHighService locationHighService; |
167 | + | |
144 | 168 | @Resource |
145 | 169 | private LocationAllocationService allocationService; |
170 | + | |
146 | 171 | @Resource |
147 | 172 | private CycleCountDetailChildServiceImpl cycleCountDetailChildService; |
173 | + | |
148 | 174 | @Resource |
149 | 175 | private CycleCountHeaderServiceImpl cycleCountHeaderService; |
176 | + | |
150 | 177 | @Resource |
151 | 178 | private IMaterialService materialService; |
179 | + | |
152 | 180 | @Resource |
153 | 181 | private IReceiveService receiveService; |
182 | + | |
154 | 183 | @Resource |
155 | 184 | private ITaskHeaderHistoryService taskHeaderHistoryService; |
185 | + | |
156 | 186 | @Resource |
157 | 187 | private IShipmentCombinationService shipmentCombinationService; |
188 | + | |
158 | 189 | @Resource |
159 | 190 | private ILockStationService lockStationService; |
191 | + | |
160 | 192 | @Resource |
161 | 193 | private IQualityDetailService qualityDetailService; |
194 | + | |
162 | 195 | @Resource |
163 | 196 | private IShipmentContainerAdviceService shipmentContainerAdviceService; |
164 | 197 | |
198 | + @Resource | |
199 | + private IMaterialMultipleService materialMultipleService; | |
200 | + | |
165 | 201 | @Override |
166 | 202 | @Transactional |
167 | 203 | public void delMain(String id) { |
... | ... | @@ -458,25 +494,44 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
458 | 494 | return Result.error("没有正常状态的库存详情"); |
459 | 495 | } |
460 | 496 | for (InventoryDetail inventoryDetail : inventoryDetailList) { |
461 | - if (inventoryDetail.getEnable() == QuantityConstant.INVENTORY_DETAIL_STATUS_ENABLE) { | |
462 | - TaskDetail taskDetail = new TaskDetail(); | |
463 | - taskDetail.setTaskHeaderId(taskHeader.getId()); | |
464 | - taskDetail.setTaskType(QuantityConstant.TASK_TYPE_QUALITY); | |
465 | - taskDetail.setWarehouseCode(warehouseCode); | |
466 | - taskDetail.setCompanyCode(inventoryDetail.getCompanyCode()); | |
467 | - taskDetail.setMaterialCode(inventoryDetail.getMaterialCode()); | |
468 | - taskDetail.setMaterialName(inventoryDetail.getMaterialName()); | |
469 | - taskDetail.setMaterialSpec(inventoryDetail.getMaterialSpec()); | |
470 | - taskDetail.setMaterialUnit(inventoryDetail.getMaterialUnit()); | |
471 | - taskDetail.setFromInventoryDetailId(inventoryDetail.getId()); | |
472 | - taskDetail.setInventoryStatus(inventoryDetail.getInventoryStatus()); | |
473 | - taskDetail.setQty(inventoryDetail.getQty()); | |
474 | - taskDetail.setBatch(inventoryDetail.getBatch()); | |
475 | - taskDetail.setLot(inventoryDetail.getLot()); | |
476 | - taskDetail.setProject(inventoryDetail.getProject()); | |
477 | - taskDetail.setReceiveTime(inventoryDetail.getReceiveTime()); | |
478 | - taskDetailList.add(taskDetail); | |
479 | - } | |
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 | + } | |
516 | + TaskDetail taskDetail = new TaskDetail(); | |
517 | + taskDetail.setTaskHeaderId(taskHeader.getId()); | |
518 | + taskDetail.setTaskType(QuantityConstant.TASK_TYPE_QUALITY); | |
519 | + taskDetail.setWarehouseCode(warehouseCode); | |
520 | + taskDetail.setCompanyCode(inventoryDetail.getCompanyCode()); | |
521 | + taskDetail.setMaterialCode(inventoryDetail.getMaterialCode()); | |
522 | + taskDetail.setMaterialName(inventoryDetail.getMaterialName()); | |
523 | + taskDetail.setMaterialSpec(inventoryDetail.getMaterialSpec()); | |
524 | + taskDetail.setMaterialUnit(inventoryDetail.getMaterialUnit()); | |
525 | + taskDetail.setFromInventoryDetailId(inventoryDetail.getId()); | |
526 | + taskDetail.setInventoryStatus(inventoryDetail.getInventoryStatus()); | |
527 | + taskDetail.setQty(inventoryDetail.getQty()); | |
528 | + taskDetail.setBatch(inventoryDetail.getBatch()); | |
529 | + taskDetail.setLot(inventoryDetail.getLot()); | |
530 | + taskDetail.setProject(inventoryDetail.getProject()); | |
531 | + taskDetail.setReceiveTime(inventoryDetail.getReceiveTime()); | |
532 | + taskDetailList.add(taskDetail); | |
533 | + | |
534 | + | |
480 | 535 | } |
481 | 536 | success = taskDetailService.saveBatch(taskDetailList); |
482 | 537 | if (!success) { |
... | ... | @@ -1267,29 +1322,33 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1267 | 1322 | if (receiptHeader == null) { |
1268 | 1323 | throw new JeecgBootException("未找到ID:" + receiptDetail.getReceiptId() + "入库单头"); |
1269 | 1324 | } |
1325 | + | |
1270 | 1326 | // 操作记录统计用 |
1271 | 1327 | taskDetail.setReceiptCode(receiptDetail.getReceiptCode()); |
1272 | - BigDecimal taskQty = receiptDetail.getTaskQty(); | |
1273 | 1328 | BigDecimal qty = receiptDetail.getQty(); |
1274 | 1329 | BigDecimal receiptDetailReceiptQty = receiptDetail.getReceiptQty(); |
1275 | 1330 | receiptDetailReceiptQty = receiptDetailReceiptQty.add(taskDetail.getQty()); |
1276 | 1331 | int receiptId = receiptDetail.getReceiptId(); |
1277 | - ReceiptDetail receiptDetail1 = new ReceiptDetail(); | |
1278 | - receiptDetail1.setId(receiptDetail.getId()); | |
1279 | - receiptDetail1.setReceiptId(receiptId); | |
1280 | - receiptDetail1.setReceiptQty(receiptDetailReceiptQty); | |
1332 | + ReceiptDetail updateReceiptDetail = new ReceiptDetail(); | |
1333 | + updateReceiptDetail.setId(receiptDetail.getId()); | |
1334 | + updateReceiptDetail.setReceiptId(receiptId); | |
1335 | + updateReceiptDetail.setReceiptQty(receiptDetailReceiptQty); | |
1281 | 1336 | if (receiptDetailReceiptQty.compareTo(qty) >= 0) { |
1282 | - receiptDetail1.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); | |
1337 | + | |
1338 | + updateReceiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); | |
1283 | 1339 | } else { |
1284 | - receiptDetail1.setStatus(QuantityConstant.RECEIPT_HEADER_SHELF); | |
1340 | + | |
1341 | + updateReceiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_SHELF); | |
1285 | 1342 | } |
1286 | - receiptDetaiList.add(receiptDetail1); | |
1287 | 1343 | |
1288 | - if (!receiptDetailService.updateById(receiptDetail1)) { | |
1344 | + receiptDetaiList.add(updateReceiptDetail); | |
1345 | + if (!receiptDetailService.updateById(updateReceiptDetail)) { | |
1289 | 1346 | throw new JeecgBootException("完成入库任务时,更新入库单详情失败"); |
1290 | 1347 | } |
1348 | + | |
1349 | + // 计算换算单位数量 | |
1350 | + materialMultipleService.materialMultiple(taskDetail); | |
1291 | 1351 | |
1292 | - BigDecimal receiptQty = taskDetail.getQty(); | |
1293 | 1352 | InventoryDetail inventoryDetail = new InventoryDetail(); |
1294 | 1353 | inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); |
1295 | 1354 | inventoryDetail.setWarehouseCode(warehouseCode); |
... | ... | @@ -1301,7 +1360,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1301 | 1360 | inventoryDetail.setMaterialName(taskDetail.getMaterialName()); |
1302 | 1361 | inventoryDetail.setMaterialSpec(taskDetail.getMaterialSpec()); |
1303 | 1362 | inventoryDetail.setMaterialUnit(taskDetail.getMaterialUnit()); |
1304 | - inventoryDetail.setQty(receiptQty); | |
1363 | + | |
1305 | 1364 | inventoryDetail.setInventoryStatus(taskDetail.getInventoryStatus()); |
1306 | 1365 | inventoryDetail.setBatch(taskDetail.getBatch()); |
1307 | 1366 | inventoryDetail.setLot(taskDetail.getLot()); |
... | ... | @@ -1332,7 +1391,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1332 | 1391 | inventoryTransaction.setProject(taskDetail.getProject()); |
1333 | 1392 | inventoryTransaction.setSn(taskDetail.getSn()); |
1334 | 1393 | inventoryTransaction.setInventoryStatus(taskDetail.getInventoryStatus()); |
1335 | - inventoryTransaction.setQty(receiptQty); | |
1336 | 1394 | inventoryTransaction.setReceiptQty(receiptQty); |
1337 | 1395 | // 获得库存数量 |
1338 | 1396 | BigDecimal inventoryQty = inventoryDetailService.getInventorySumQty(inventoryDetail); |
... | ... | @@ -2320,6 +2378,26 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2320 | 2378 | return Result.ok("质检登记成功"); |
2321 | 2379 | } |
2322 | 2380 | |
2381 | + @Override | |
2382 | + public List<String> findCommonData(List<String> dataList1, List<String> dataList2, boolean flag) { | |
2383 | + Set<String> dataSet1 = new HashSet<>(dataList1); | |
2384 | + List<String> commonData = new ArrayList<>(); | |
2385 | + if (flag) { | |
2386 | + for (String obj : dataList2) { | |
2387 | + if (!dataSet1.contains(obj)) { | |
2388 | + commonData.add(obj); | |
2389 | + } | |
2390 | + } | |
2391 | + } else { | |
2392 | + for (String obj : dataList2) { | |
2393 | + if (dataSet1.contains(obj)) { | |
2394 | + commonData.add(obj); | |
2395 | + } | |
2396 | + } | |
2397 | + } | |
2398 | + return commonData; | |
2399 | + } | |
2400 | + | |
2323 | 2401 | /** |
2324 | 2402 | * 完成空托盘入库任务 |
2325 | 2403 | * @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 |
... | ... |