Commit 8b024bf187fe8d4196e74caddc2871adaf0e1f0b

Authored by 唐高鑫
2 parents 468304e1 03fe24a4

Merge remote-tracking branch 'origin/develop' into develop

Showing 17 changed files with 183 additions and 50 deletions
ant-design-vue-jeecg/src/views/system/config/modules/LocationHighForm.vue
... ... @@ -15,7 +15,11 @@
15 15 </a-col>
16 16 <a-col :span="24">
17 17 <a-form-model-item label="库位类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationTypeCode">
18   - <a-input v-model="model.locationTypeCode" placeholder="请输入库位类型"></a-input>
  18 + <a-select
  19 + v-model="model.locationTypeCode"
  20 + :options="locationTypeList"
  21 + placeholder="请选择库位类型">
  22 + </a-select>
19 23 </a-form-model-item>
20 24 </a-col>
21 25 <a-col :span="24">
... ... @@ -52,7 +56,7 @@
52 56  
53 57 import {httpAction, getAction} from '@/api/manage'
54 58 import {validateDuplicateValue} from '@/utils/util'
55   -import {getContainerTypeList, getZoneList} from "@api/api";
  59 +import {getContainerTypeList, getLocationTypeList, getZoneList} from "@api/api";
56 60  
57 61 export default {
58 62 name: 'LocationHighForm',
... ... @@ -69,6 +73,7 @@ export default {
69 73 return {
70 74 model: {},
71 75 zoneList: [],
  76 + locationTypeList: [],
72 77 labelCol: {
73 78 xs: {span: 24},
74 79 sm: {span: 5},
... ... @@ -86,7 +91,10 @@ export default {
86 91 {required: true, message: '请输入名称!'},
87 92 ],
88 93 locationTypeCode: [
89   - {required: true, message: '请输入库位类型!'},
  94 + {required: true, message: '请选择库位类型!'},
  95 + ],
  96 + zoneCode: [
  97 + {required: true, message: '请选择库区!'},
90 98 ],
91 99 high: [
92 100 {required: true, message: '请输入高度值!'},
... ... @@ -123,6 +131,13 @@ export default {
123 131 this.zoneList = res.result
124 132 }
125 133 });
  134 + getLocationTypeList().then((res) => {
  135 + if (res.success) {
  136 + this.locationTypeList = res.result.map((item, index, arr) => {
  137 + return {label: item.name, value: item.code}
  138 + })
  139 + }
  140 + });
126 141 },
127 142 submitForm() {
128 143 const that = this;
... ...
ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue
... ... @@ -79,8 +79,8 @@
79 79  
80 80 <span slot="action" slot-scope="text, record">
81 81 <a v-has="'inventoryDetail:edit'" @click="handleEdit(record)">编辑<a-divider type="vertical"/></a>
82   - <a v-has="'inventoryDetail:addInventoryDetail'" @click="addInventoryDetail(record)">新增数量<a-divider type="vertical"/></a>
83   - <a v-has="'inventoryDetail:reduceInventoryDetail'" @click="reduceInventoryDetail(record)">减少数量<a-divider type="vertical"/></a>
  82 + <a v-has="'inventoryDetail:addInventoryDetail'" v-if="(record.containerStatus == 'lock')" @click="addInventoryDetail(record)">新增数量<a-divider type="vertical"/></a>
  83 + <a v-has="'inventoryDetail:reduceInventoryDetail'" v-if="(record.containerStatus == 'lock')" @click="reduceInventoryDetail(record)">减少数量<a-divider type="vertical"/></a>
84 84 <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
85 85 <a v-has="'inventoryDetail:delete'">删除</a>
86 86 </a-popconfirm>
... ...
ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue
... ... @@ -61,15 +61,15 @@
61 61 </a-form-item>
62 62 </a-col>
63 63 <a-col :xl="6" :lg="7" :md="8" :sm="24">
64   - <a-form-item label="库存状态">
65   - <j-dict-select-tag placeholder="请选择库存状态" v-model="queryParam.inventoryStatus"
66   - dictCode="inventory_status"/>
  64 + <a-form-item label="物料编码">
  65 + <a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input>
67 66 </a-form-item>
68 67 </a-col>
69 68 <template v-if="toggleSearchStatus">
70 69 <a-col :xl="6" :lg="7" :md="8" :sm="24">
71   - <a-form-item label="物料编码">
72   - <a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input>
  70 + <a-form-item label="库存状态">
  71 + <j-dict-select-tag placeholder="请选择库存状态" v-model="queryParam.inventoryStatus"
  72 + dictCode="inventory_status"/>
73 73 </a-form-item>
74 74 </a-col>
75 75 <a-col :xl="6" :lg="7" :md="8" :sm="24">
... ... @@ -93,6 +93,11 @@
93 93 </a-form-item>
94 94 </a-col>
95 95 <a-col :xl="6" :lg="7" :md="8" :sm="24">
  96 + <a-form-item label="序列号">
  97 + <a-input placeholder="请输入序列号" v-model="queryParam.sn"></a-input>
  98 + </a-form-item>
  99 + </a-col>
  100 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
96 101 <a-form-item label="创建人">
97 102 <a-input placeholder="请输入创建人" v-model="queryParam.createBy"></a-input>
98 103 </a-form-item>
... ... @@ -306,6 +311,11 @@ export default {
306 311 dataIndex: 'materialUnit'
307 312 },
308 313 {
  314 + title: '序列号',
  315 + align: "center",
  316 + dataIndex: 'sn'
  317 + },
  318 + {
309 319 title: '库存状态',
310 320 align: "center",
311 321 dataIndex: 'inventoryStatus_dictText',
... ... @@ -327,7 +337,7 @@ export default {
327 337 dataIndex: 'shipmentQty'
328 338 },
329 339 {
330   - title: '库存数量',
  340 + title: '库存总数',
331 341 align: "center",
332 342 dataIndex: 'inventoryQty'
333 343 },
... ...
ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryDetailModifyModal.vue
... ... @@ -41,7 +41,7 @@ export default {
41 41 data() {
42 42 return {
43 43 title: "操作",
44   - width: 800,
  44 + width: 400,
45 45 visible: false,
46 46 model: {},
47 47 flag: 0,
... ...
ant-design-vue-jeecg/src/views/system/task/ReceiptTaskHeaderList.vue
... ... @@ -56,6 +56,11 @@
56 56 <a-input placeholder="请输入目标出入口" v-model="queryParam.toPortCode"></a-input>
57 57 </a-form-item>
58 58 </a-col>
  59 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  60 + <a-form-item label="入库单ID">
  61 + <a-input placeholder="请输入入库单ID" v-model="queryParam.receiptId"></a-input>
  62 + </a-form-item>
  63 + </a-col>
59 64 <a-col :xl="12" :lg="14" :md="16" :sm="24">
60 65 <a-form-item label="创建日期">
61 66 <j-date :show-date="true" date-format="YYYY-MM-DD" placeholder="请选择开始时间"
... ...
ant-design-vue-jeecg/src/views/system/task/ShipmentTaskHeaderList.vue
... ... @@ -56,6 +56,11 @@
56 56 <a-input placeholder="请输入目标出入口" v-model="queryParam.toPortCode"></a-input>
57 57 </a-form-item>
58 58 </a-col>
  59 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  60 + <a-form-item label="出库单ID">
  61 + <a-input placeholder="请输入出库单ID" v-model="queryParam.shipmentId"></a-input>
  62 + </a-form-item>
  63 + </a-col>
59 64 <a-col :xl="12" :lg="14" :md="16" :sm="24">
60 65 <a-form-item label="创建日期">
61 66 <j-date :show-date="true" date-format="YYYY-MM-DD" placeholder="请选择开始时间"
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationService.java
... ... @@ -5,14 +5,20 @@ import java.util.List;
5 5 public interface LocationAllocationService {
6 6  
7 7 /**
8   - * 获得库位分配的库位
  8 + * 库位分配
9 9 */
10 10 String allocation(int locationRule, List<String> locationTypeCodeList, int high, String zoneCode, List<Integer> raodWays, String warehouseCode,
11 11 String containerCode, String materialAreaCode, String materialCode, boolean bypass);
12 12  
  13 + /**
  14 + * 双伸位库位分配
  15 + */
13 16 String doubleRk(String zoneCode, List<Integer> roadWays, int high, String warehouseCode, List<String> locationTypeCodeList, String materialAreaCode,
14 17 String materialCode, boolean bypass);
15 18  
  19 + /**
  20 + * 单伸位库位分配
  21 + */
16 22 String singleRk(String zoneCode, List<Integer> roadWays, int high, String warehouseCode, List<String> locationTypeCodeList, String materialAreaCode,
17 23 String materialCode);
18 24  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
... ... @@ -28,10 +28,10 @@ import org.jeecg.utils.StringUtils;
28 28 import org.jeecg.utils.constant.QuantityConstant;
29 29 import org.springframework.stereotype.Service;
30 30 import org.springframework.transaction.annotation.Transactional;
31   -import org.springframework.util.CollectionUtils;
32 31  
33 32 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
34 33 import com.baomidou.mybatisplus.core.metadata.IPage;
  34 +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
35 35 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
36 36 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
37 37  
... ... @@ -93,7 +93,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
93 93 case QuantityConstant.SINGLE_FORK:
94 94 return locationAllocationService.singleRk(zoneCode, raodWays, high, warehouseCode, mergelocationTypeCodeList, materialAreaCode, materialCode);
95 95 }
96   - return null;
  96 + throw new JeecgBootException("分配库位时, 没有找到分配规则");
97 97 }
98 98  
99 99 /**
... ... @@ -103,7 +103,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
103 103 @Transactional(rollbackFor = Exception.class)
104 104 public String doubleRk(String zoneCode, List<Integer> roadWays, int high, String warehouseCode, List<String> locationTypeCodeList, String materialAreaCode,
105 105 String materialCode, boolean bypass) {
106   - if (roadWays == null || roadWays.size() < 1) {
  106 + if (CollectionUtils.isEmpty(roadWays)) {
107 107 roadWays = locationService.getRoadWayByZoneCode(zoneCode, warehouseCode);
108 108 }
109 109 String value = parameterConfigurationService.getValueByCode(QuantityConstant.DOUBLE_FORK_RESERVE_LOCATION);
... ... @@ -128,7 +128,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
128 128 LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
129 129 locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay)
130 130 .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE)
131   - .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode)
132 131 .in(Location::getLocationTypeCode, locationTypeCodeList).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING)
133 132 .orderByAsc(true, Location::getHigh).orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId);
134 133 Page<Location> page = new Page<Location>(1, searchNumber, false);
... ... @@ -154,7 +153,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
154 153 IPage iPage = locationService.page(page, locationLambda);
155 154 List<Location> locationList = iPage.getRecords();
156 155 List<Location> removeLocaationList = new ArrayList<>();
157   - if (locationList.size() > 0) {
  156 + if (CollectionUtils.isNotEmpty(locationList)) {
158 157 for (Location location1 : locationList) {
159 158 // 旁边有任务的库位,不能用来分配库位
160 159 if (taskHeaderService.haveUncompleteTaskInNear(location1)) {
... ... @@ -163,7 +162,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
163 162 }
164 163 }
165 164 locationList.removeAll(removeLocaationList);
166   - if (locationList.size() == 0) {
  165 + if (CollectionUtils.isEmpty(locationList)) {
167 166 locationLambda = Wrappers.lambdaQuery();
168 167 locationLambda.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay)
169 168 .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE)
... ... @@ -174,7 +173,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
174 173 iPage = locationService.page(page, locationLambda);
175 174 locationList = iPage.getRecords();
176 175 removeLocaationList = new ArrayList<>();
177   - if (locationList != null && locationList.size() > 0) {
  176 + if (CollectionUtils.isNotEmpty(locationList)) {
178 177 for (Location location1 : locationList) {
179 178 if (taskHeaderService.haveUncompleteTaskInNear(location1)) {
180 179 removeLocaationList.add(location1);
... ... @@ -183,8 +182,8 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
183 182 }
184 183 locationList.removeAll(removeLocaationList);
185 184 }
186   - if (locationList == null || locationList.size() == 0) {
187   - return null;
  185 + if (CollectionUtils.isEmpty(locationList)) {
  186 + throw new JeecgBootException("分配库位时,没有高度值" + high + "的库位可分配");
188 187 }
189 188 Location location = locationList.stream().findFirst().orElse(null);
190 189 return location.getCode();
... ... @@ -197,7 +196,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
197 196 @Transactional(rollbackFor = Exception.class)
198 197 public String singleRk(String zoneCode, List<Integer> roadWays, int high, String warehouseCode, List<String> locationTypeCodeList, String materialAreaCode,
199 198 String materialCode) {
200   - if (roadWays == null || roadWays.size() < 1) {
  199 + if (CollectionUtils.isEmpty(roadWays)) {
201 200 roadWays = locationService.getRoadWayByZoneCode(zoneCode, warehouseCode);
202 201 }
203 202 List<Integer> removeRoadWays = new ArrayList<>();
... ... @@ -212,12 +211,12 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
212 211 Page<Location> page = new Page<Location>(1, 10, false);
213 212 IPage page1 = locationService.page(page, locationLambdaQueryWrapper);
214 213 List<Location> totalLocationList = page1.getRecords();
215   - if (totalLocationList.size() <= 0) {
  214 + if (CollectionUtils.isEmpty(totalLocationList)) {
216 215 removeRoadWays.add(roadWay);
217 216 }
218 217 }
219 218 roadWays.removeAll(removeRoadWays);
220   - if (roadWays == null || roadWays.size() == 0) {
  219 + if (CollectionUtils.isEmpty(roadWays)) {
221 220 throw new JeecgBootException("分配库位时, 可用巷道为空");
222 221 }
223 222 Integer roadWay = locationAllocationService.getRoadWay(roadWays, materialCode, zoneCode, warehouseCode);
... ... @@ -231,8 +230,8 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
231 230 Page page = new Page<Location>(1, 1, 1, false);
232 231 IPage iPage = locationService.page(page, locationLambdaQueryWrapper);
233 232 List<Location> locationList = iPage.getRecords();
234   - if (locationList == null || locationList.size() == 0) {
235   - return null;
  233 + if (CollectionUtils.isEmpty(locationList)) {
  234 + throw new JeecgBootException("分配库位时,没有高度值" + high + "的库位可分配");
236 235 }
237 236 Location location = locationList.stream().findFirst().orElse(null);
238 237 return location.getCode();
... ... @@ -302,7 +301,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
302 301 taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED).eq(TaskHeader::getZoneCode, zoneCode)
303 302 .ne(TaskHeader::getToLocationCode, QuantityConstant.EMPTY_STRING);
304 303 List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper);
305   - if (taskHeaderList.size() != 0) {
  304 + if (CollectionUtils.isNotEmpty(taskHeaderList)) {
306 305 List<Integer> roadWayList = taskHeaderList.stream().map(TaskHeader::getRoadWay).collect(toList());
307 306 List<Integer> removeRoadWayList = new ArrayList<>();
308 307 for (Integer roadWay : roadWays) {
... ... @@ -319,7 +318,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
319 318  
320 319 @Override
321 320 public Integer getRoadWayByMinMaterial(List<Integer> roadWays, String materialCode, String zoneCode, String warehouseCode) {
322   - if (roadWays == null || roadWays.size() == 0) {
  321 + if (CollectionUtils.isEmpty(roadWays)) {
323 322 throw new JeecgBootException("分配库位时, 巷道为空");
324 323 }
325 324 Collections.shuffle(roadWays);// 打乱巷道排序
... ... @@ -329,7 +328,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
329 328 }
330 329 int min = Integer.MAX_VALUE;
331 330 List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByMaterialCodeAndZoneCode(materialCode, zoneCode, warehouseCode);
332   - if (inventoryDetailList.size() != 0) {
  331 + if (CollectionUtils.isNotEmpty(inventoryDetailList)) {
333 332 List<Integer> roadWayList = inventoryDetailList.stream().map(InventoryDetail::getRoadWay).collect(toList());
334 333 roadWayList.removeAll(Collections.singleton(null));
335 334 for (Integer road : roadWays) {
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
... ... @@ -263,17 +263,17 @@ public class WcsServiceImpl implements WcsService {
263 263 if (StringUtils.isNotEmpty(insideLocation.getContainerCode())) {
264 264 Location destinationLocation = locationService.getEmptyLocation(insideLocation);
265 265 if (destinationLocation == null) {
266   - throw new JeecgBootException("创建移库任务失败, 目标库位为空");
  266 + throw new JeecgBootException("分配库位时,创建移库任务失败目标库位为空");
267 267 }
268 268 Result<TaskHeader> result = taskHeaderService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode(), warehouseCode);
269 269 if (!result.isSuccess()) {
270   - throw new JeecgBootException("创建移库任务失败");
  270 + throw new JeecgBootException("分配库位时,创建移库任务失败");
271 271 }
272 272 preTaskNo = result.getResult().getId();
273 273 taskHeader.setPreTaskNo(preTaskNo);
274 274 success = taskHeaderService.updatePreTaskNoById(preTaskNo, taskHeader.getId());
275 275 if (!success) {
276   - throw new JeecgBootException("更新任务状态失败");
  276 + throw new JeecgBootException("分配库位时,更新任务状态失败");
277 277 }
278 278 }
279 279 } else {
... ... @@ -297,7 +297,7 @@ public class WcsServiceImpl implements WcsService {
297 297 taskHeader.setWeight(Integer.parseInt(warecellDomain.getWeight()));
298 298 taskHeader.setToLocationCode(locationCode);
299 299 if (!taskHeaderService.updateById(taskHeader)) {
300   - throw new JeecgBootException("更新任务头表目标库位失败");
  300 + throw new JeecgBootException("分配库位时,更新任务头表目标库位失败");
301 301 }
302 302 WcsTask wcsTask = new WcsTask();
303 303 wcsTask.setToLocationCode(locationCode);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java
... ... @@ -38,6 +38,9 @@ public interface IInventoryDetailService extends IService&lt;InventoryDetail&gt; {
38 38 // 求一种物料的库存之和(总数)
39 39 BigDecimal getInventorySumQty(InventoryDetail inventoryDetail);
40 40  
  41 + // 求一种物料的托盘库存之和(总数)
  42 + BigDecimal getContainerInventorySumQty(InventoryDetail inventoryDetail);
  43 +
41 44 // 求一种物料的库存之和(扣除了配盘数量)
42 45 BigDecimal getSumQty(InventoryDetail inventoryDetail);
43 46  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java
... ... @@ -170,6 +170,21 @@ public class InventoryDetailServiceImpl extends ServiceImpl&lt;InventoryDetailMappe
170 170 }
171 171  
172 172 @Override
  173 + public BigDecimal getContainerInventorySumQty(InventoryDetail inventoryDetail) {
  174 + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
  175 + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getInventoryStatus, inventoryDetail.getInventoryStatus())
  176 + .eq(InventoryDetail::getMaterialCode, inventoryDetail.getMaterialCode()).eq(InventoryDetail::getWarehouseCode, inventoryDetail.getWarehouseCode())
  177 + .eq(InventoryDetail::getContainerCode, inventoryDetail.getContainerCode());
  178 +
  179 + List<InventoryDetail> inventoryDetailList = list(inventoryDetailLambdaQueryWrapper);
  180 + if (inventoryDetailList.size() == 0) {
  181 + return BigDecimal.ZERO;
  182 + }
  183 + BigDecimal totalQty = inventoryDetailList.stream().map(InventoryDetail::getQty).reduce(BigDecimal.ZERO, BigDecimal::add);
  184 + return totalQty;
  185 + }
  186 +
  187 + @Override
173 188 public BigDecimal getSumQty(InventoryDetail inventoryDetail) {
174 189 LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
175 190 inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getInventoryStatus, inventoryDetail.getInventoryStatus())
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/entity/InventoryTransaction.java
... ... @@ -137,9 +137,13 @@ public class InventoryTransaction implements Serializable {
137 137 @Excel(name = "出库数量", width = 15)
138 138 @ApiModelProperty(value = "出库数量")
139 139 private BigDecimal shipmentQty;
140   - /** 库存数量 */
141   - @Excel(name = "库存数量", width = 15)
142   - @ApiModelProperty(value = "库存数量")
  140 + /** 托盘库存数量 */
  141 + @Excel(name = "托盘库存数量", width = 15)
  142 + @ApiModelProperty(value = "托盘库存数量")
  143 + private BigDecimal containerInventoryQty;
  144 + /** 库存总数 */
  145 + @Excel(name = "库存总数", width = 15)
  146 + @ApiModelProperty(value = "库存总数")
143 147 private BigDecimal inventoryQty;
144 148 /** 批次, 批次主要用于成品,比如以生产日期为批次 */
145 149 @Excel(name = "批次", width = 15)
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java
... ... @@ -53,6 +53,7 @@ import org.springframework.web.servlet.ModelAndView;
53 53 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
54 54 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
55 55 import com.baomidou.mybatisplus.core.metadata.IPage;
  56 +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
56 57 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
57 58 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
58 59  
... ... @@ -106,6 +107,28 @@ public class TaskHeaderController extends HuahengBaseController {
106 107 HuahengJwtUtil.setWarehouseCode(req, taskHeader);
107 108 QueryWrapper<TaskHeader> queryWrapper = QueryGenerator.initQueryWrapper(taskHeader, req.getParameterMap());
108 109 queryWrapper.orderByDesc("id");
  110 + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = queryWrapper.lambda();
  111 + Integer shipmentId = taskHeader.getShipmentId();
  112 + Integer receiptId = taskHeader.getReceiptId();
  113 + if (shipmentId != null) {
  114 + List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByShipmentId(shipmentId);
  115 + if (CollectionUtils.isNotEmpty(taskDetailList)) {
  116 + List<Integer> taskHeaderIdList = taskDetailList.stream().distinct().map(TaskDetail::getTaskHeaderId).collect(Collectors.toList());
  117 + if (CollectionUtils.isNotEmpty(taskHeaderIdList)) {
  118 + taskHeaderLambdaQueryWrapper.in(TaskHeader::getId, taskHeaderIdList);
  119 + }
  120 + }
  121 + }
  122 + if (receiptId != null) {
  123 + List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByReceiptId(receiptId);
  124 + if (CollectionUtils.isNotEmpty(taskDetailList)) {
  125 + List<Integer> taskHeaderIdList = taskDetailList.stream().distinct().map(TaskDetail::getTaskHeaderId).collect(Collectors.toList());
  126 + if (CollectionUtils.isNotEmpty(taskHeaderIdList)) {
  127 + taskHeaderLambdaQueryWrapper.in(TaskHeader::getId, taskHeaderIdList);
  128 + }
  129 + }
  130 + }
  131 +
109 132 Page<TaskHeader> page = new Page<TaskHeader>(pageNo, pageSize);
110 133 IPage<TaskHeader> pageList = taskHeaderService.page(page, queryWrapper);
111 134 return Result.OK(pageList);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/entity/TaskHeader.java
... ... @@ -9,6 +9,7 @@ import org.jeecg.common.aspect.annotation.Dict;
9 9 import org.jeecgframework.poi.excel.annotation.Excel;
10 10  
11 11 import com.baomidou.mybatisplus.annotation.IdType;
  12 +import com.baomidou.mybatisplus.annotation.TableField;
12 13 import com.baomidou.mybatisplus.annotation.TableId;
13 14 import com.baomidou.mybatisplus.annotation.TableName;
14 15  
... ... @@ -190,4 +191,12 @@ public class TaskHeader implements Serializable {
190 191 /** 完成时间(完成任务时间) */
191 192 @ApiModelProperty(value = "完成时间")
192 193 private Date completeTime;
  194 + /** 出库单ID */
  195 + @TableField(exist = false)
  196 + @ApiModelProperty(value = "出库单ID")
  197 + private Integer shipmentId;
  198 + /** 入库单ID */
  199 + @TableField(exist = false)
  200 + @ApiModelProperty(value = "入库单ID")
  201 + private Integer receiptId;
193 202 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskDetailService.java
1 1 package org.jeecg.modules.wms.task.taskHeader.service;
2 2  
3   -import com.baomidou.mybatisplus.extension.service.IService;
4   -import org.jeecg.modules.wms.config.location.entity.Location;
  3 +import java.util.List;
  4 +
5 5 import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail;
6 6  
7   -import java.util.List;
  7 +import com.baomidou.mybatisplus.extension.service.IService;
8 8  
9 9 /**
10 10 * @Description: 任务详情
... ... @@ -22,4 +22,18 @@ public interface ITaskDetailService extends IService&lt;TaskDetail&gt; {
22 22 * @return
23 23 */
24 24 List<TaskDetail> getTaskDetailListByTaskId(Integer id);
  25 +
  26 + /**
  27 + * 根据出库单ID查询任务明细
  28 + * @param shipmentId
  29 + * @return
  30 + */
  31 + List<TaskDetail> getTaskDetailListByShipmentId(Integer shipmentId);
  32 +
  33 + /**
  34 + * 根据出库单ID查询任务明细
  35 + * @param receiptId
  36 + * @return
  37 + */
  38 + List<TaskDetail> getTaskDetailListByReceiptId(Integer receiptId);
25 39 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskDetailServiceImpl.java
1 1 package org.jeecg.modules.wms.task.taskHeader.service.impl;
2 2  
3   -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4   -import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5   -import org.jeecg.modules.wms.config.location.entity.Location;
  3 +import java.util.List;
  4 +
  5 +import javax.annotation.Resource;
  6 +
6 7 import org.jeecg.modules.wms.config.location.service.ILocationService;
7 8 import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail;
8   -import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader;
9 9 import org.jeecg.modules.wms.task.taskHeader.mapper.TaskDetailMapper;
10 10 import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService;
11 11 import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService;
12   -import org.jeecg.utils.constant.QuantityConstant;
13   -import org.springframework.stereotype.Service;
14   -import java.util.List;
15   -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
16 12 import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Service;
17 14  
18   -import javax.annotation.Resource;
  15 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  16 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  17 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
19 18  
20 19 /**
21 20 * @Description: 任务详情
... ... @@ -46,4 +45,20 @@ public class TaskDetailServiceImpl extends ServiceImpl&lt;TaskDetailMapper, TaskDet
46 45 return taskDetailList;
47 46 }
48 47  
  48 + @Override
  49 + public List<TaskDetail> getTaskDetailListByShipmentId(Integer shipmentId) {
  50 + LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
  51 + taskDetailLambdaQueryWrapper.eq(TaskDetail::getShipmentId, shipmentId);
  52 + List<TaskDetail> taskDetailList = list(taskDetailLambdaQueryWrapper);
  53 + return taskDetailList;
  54 + }
  55 +
  56 + @Override
  57 + public List<TaskDetail> getTaskDetailListByReceiptId(Integer receiptId) {
  58 + LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
  59 + taskDetailLambdaQueryWrapper.eq(TaskDetail::getReceiptId, receiptId);
  60 + List<TaskDetail> taskDetailList = list(taskDetailLambdaQueryWrapper);
  61 + return taskDetailList;
  62 + }
  63 +
49 64 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... ... @@ -1386,10 +1386,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1386 1386 inventoryTransaction.setInventoryStatus(taskDetail.getInventoryStatus());
1387 1387 inventoryTransaction.setReceiptQty(taskDetail.getQty());
1388 1388 inventoryTransaction.setQty(taskDetail.getQty());
1389   - // 获得库存数量
  1389 + // 获得库存总数
1390 1390 BigDecimal inventoryQty = inventoryDetailService.getInventorySumQty(inventoryDetail);
  1391 + // 获得物料在这个托盘上的库存数
  1392 + BigDecimal containerInventoryQty = inventoryDetailService.getContainerInventorySumQty(inventoryDetail);
1391 1393 inventoryQty = inventoryQty.add(taskDetail.getQty());
  1394 + containerInventoryQty = containerInventoryQty.add(taskDetail.getQty());
1392 1395 inventoryTransaction.setInventoryQty(inventoryQty);
  1396 + inventoryTransaction.setContainerInventoryQty(containerInventoryQty);
1393 1397 inventoryTransactionList.add(inventoryTransaction);
1394 1398 }
1395 1399  
... ... @@ -1620,7 +1624,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1620 1624 inventoryTransaction.setQty(taskDetail.getQty());
1621 1625 inventoryTransaction.setShipmentQty(taskDetail.getQty());
1622 1626 BigDecimal inventoryQty = inventoryDetailService.getInventorySumQty(inventoryDetail);
  1627 + // 获得物料在这个托盘上的库存数
  1628 + BigDecimal containerInventoryQty = inventoryDetailService.getContainerInventorySumQty(inventoryDetail);
1623 1629 inventoryTransaction.setInventoryQty(inventoryQty);
  1630 + inventoryTransaction.setContainerInventoryQty(containerInventoryQty);
1624 1631 inventoryTransactionList.add(inventoryTransaction);
1625 1632 shipmentIdList.add(taskDetail.getShipmentId());
1626 1633 }
... ... @@ -1714,7 +1721,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1714 1721 inventoryTransaction.setQty(inventoryDetail.getQty());
1715 1722 inventoryTransaction.setShipmentQty(inventoryDetail.getQty());
1716 1723 BigDecimal inventoryQty = inventoryDetailService.getInventorySumQty(inventoryDetail);
  1724 + // 获得物料在这个托盘上的库存数
  1725 + BigDecimal containerInventoryQty = inventoryDetailService.getContainerInventorySumQty(inventoryDetail);
1717 1726 inventoryTransaction.setInventoryQty(inventoryQty);
  1727 + inventoryTransaction.setContainerInventoryQty(containerInventoryQty);
1718 1728 inventoryTransactionList.add(inventoryTransaction);
1719 1729 if (!inventoryDetailService.removeById(inventoryDetail)) {
1720 1730 throw new JeecgBootException("完成整盘出库任务,删除库存详情失败" + inventoryDetail.getId());
... ...