Commit 8245f706e89643ac6350e018fa1d8699cc1e842f
Merge remote-tracking branch 'origin/develop' into develop
Showing
14 changed files
with
316 additions
and
47 deletions
src/main/java/com/huaheng/pc/inventory/adjustDetail/controller/adjustDetailController.java
... | ... | @@ -9,6 +9,7 @@ import com.huaheng.common.utils.security.ShiroUtils; |
9 | 9 | import com.huaheng.framework.aspectj.lang.annotation.Log; |
10 | 10 | import com.huaheng.framework.aspectj.lang.constant.BusinessType; |
11 | 11 | import com.huaheng.framework.web.controller.BaseController; |
12 | +import com.huaheng.framework.web.domain.AjaxResult; | |
12 | 13 | import com.huaheng.framework.web.page.PageDomain; |
13 | 14 | import com.huaheng.framework.web.page.TableDataInfo; |
14 | 15 | import com.huaheng.framework.web.page.TableSupport; |
... | ... | @@ -16,6 +17,7 @@ import com.huaheng.pc.inventory.adjustDetail.domain.AdjustDetail; |
16 | 17 | import com.huaheng.pc.inventory.adjustDetail.service.AdjustDetailService; |
17 | 18 | import com.huaheng.pc.inventory.adjustHeader.service.AdjustHeaderService; |
18 | 19 | import org.springframework.stereotype.Controller; |
20 | +import org.springframework.ui.ModelMap; | |
19 | 21 | import org.springframework.web.bind.annotation.GetMapping; |
20 | 22 | import org.springframework.web.bind.annotation.PostMapping; |
21 | 23 | import org.springframework.web.bind.annotation.RequestMapping; |
... | ... | @@ -96,7 +98,36 @@ public class adjustDetailController extends BaseController { |
96 | 98 | } |
97 | 99 | } |
98 | 100 | |
101 | + /** | |
102 | + * 只调整数量 | |
103 | + * 修改 | |
104 | + */ | |
105 | + @GetMapping("/adjustEdit") | |
106 | + public String editAdjust(Integer id, ModelMap mmap) | |
107 | + { | |
108 | + AdjustDetail adjustDetailEdit = adjustDetailService.getById(id); | |
109 | + mmap.put("adjustDetailEdit", adjustDetailEdit); | |
110 | + return prefix + "/adjustEdit"; | |
111 | + } | |
99 | 112 | |
113 | + /** | |
114 | + * 修改保存调整数量 | |
115 | + */ | |
116 | + //@RequiresPermissions("inventory:cyclecountAdjustDetail:addAdjust") | |
117 | + @Log(title = "库存-调整单", operating = "调整单调整库存差异,调整数量", action = BusinessType.UPDATE) | |
118 | + @PostMapping("/editAdjustSave") | |
119 | + @ResponseBody | |
120 | + public AjaxResult editAdjustSave(AdjustDetail adjustDetail) | |
121 | + { | |
122 | + //未上传不允许进行明细差异调整 | |
123 | +// CyclecountAdjust cyclecountAdjust = cycleconutAdjustService.selectEntityById(cyclecountAdjustDetail.getCyclecountAdjustId()); | |
124 | +// if(cyclecountAdjust.getStatus() != 30 ){ | |
125 | +// return AjaxResult.error("单据未上传,没有调整单下发,不允许差异调整!!"); | |
126 | +// //throw new ServiceException("单据未上传,没有调整单下发,不允许差异调整!"); | |
127 | +// } | |
128 | + AjaxResult result = adjustDetailService.updateAdjustDetail(adjustDetail); | |
129 | + return result; | |
130 | + } | |
100 | 131 | |
101 | 132 | |
102 | 133 | |
... | ... |
src/main/java/com/huaheng/pc/inventory/adjustDetail/domain/AdjustDetail.java
... | ... | @@ -34,6 +34,13 @@ public class AdjustDetail implements Serializable { |
34 | 34 | private String cycleCountCode; |
35 | 35 | |
36 | 36 | /** |
37 | + * 库存明细ID | |
38 | + */ | |
39 | + @TableField(value = "inventoryDetailId") | |
40 | + @ApiModelProperty(value = "库存明细ID") | |
41 | + private Integer inventoryDetailId; | |
42 | + | |
43 | + /** | |
37 | 44 | * 盘点单号行号 |
38 | 45 | */ |
39 | 46 | @TableField(value = "cycleDetailId") |
... | ... | @@ -249,6 +256,18 @@ public class AdjustDetail implements Serializable { |
249 | 256 | @TableField(value = "containerCode") |
250 | 257 | @ApiModelProperty(value = "容器编码") |
251 | 258 | private String containerCode; |
259 | + /** | |
260 | + * 更新人 | |
261 | + * */ | |
262 | + @TableField(value = "lastUpdatedBy") | |
263 | + @ApiModelProperty(value = "更新人") | |
264 | + private String lastUpdatedBy; | |
265 | + /** | |
266 | + * 更新时间 | |
267 | + */ | |
268 | + @TableField(value = "lastUpdated") | |
269 | + @ApiModelProperty(value = "更新时间") | |
270 | + private Date lastUpdated; | |
252 | 271 | |
253 | 272 | |
254 | 273 | private static final long serialVersionUID = 1L; |
... | ... |
src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailService.java
1 | 1 | package com.huaheng.pc.inventory.adjustDetail.service; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | +import com.huaheng.framework.web.domain.AjaxResult; | |
4 | 5 | import com.huaheng.pc.inventory.adjustDetail.domain.AdjustDetail; |
5 | 6 | |
6 | 7 | |
7 | 8 | |
8 | 9 | public interface AdjustDetailService extends IService<AdjustDetail> { |
9 | 10 | |
10 | - | |
11 | + AjaxResult updateAdjustDetail(AdjustDetail adjustDetail); | |
11 | 12 | |
12 | 13 | } |
13 | 14 | |
... | ... |
src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java
1 | 1 | package com.huaheng.pc.inventory.adjustDetail.service; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
5 | +import com.huaheng.common.utils.security.ShiroUtils; | |
6 | +import com.huaheng.framework.web.domain.AjaxResult; | |
7 | +import com.huaheng.pc.config.container.service.ContainerService; | |
8 | +import com.huaheng.pc.config.location.service.LocationService; | |
9 | +import com.huaheng.pc.inventory.adjustHeader.domain.AdjustHeader; | |
10 | +import com.huaheng.pc.inventory.adjustHeader.service.AdjustHeaderService; | |
11 | +import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService; | |
12 | +import com.huaheng.pc.inventory.cycleCountHeader.service.CycleCountHeaderService; | |
13 | +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; | |
14 | +import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; | |
15 | +import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader; | |
16 | +import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService; | |
17 | +import com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction; | |
18 | +import com.huaheng.pc.inventory.inventoryTransaction.service.InventoryTransactionService; | |
19 | +import io.swagger.models.auth.In; | |
3 | 20 | import org.springframework.stereotype.Service; |
4 | 21 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
5 | 22 | import com.huaheng.pc.inventory.adjustDetail.domain.AdjustDetail; |
6 | 23 | import com.huaheng.pc.inventory.adjustDetail.mapper.AdjustDetailMapper; |
24 | +import org.springframework.transaction.annotation.Transactional; | |
25 | + | |
26 | +import javax.annotation.Resource; | |
27 | +import java.math.BigDecimal; | |
28 | +import java.net.CacheResponse; | |
29 | +import java.util.Date; | |
30 | +import java.util.List; | |
31 | +import java.util.WeakHashMap; | |
32 | + | |
7 | 33 | @Service |
8 | 34 | public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, AdjustDetail> implements AdjustDetailService { |
9 | 35 | |
36 | + | |
37 | + @Resource | |
38 | + private AdjustHeaderService adjustHeaderService; | |
39 | + @Resource | |
40 | + private CycleCountHeaderService cycleCountHeaderService; | |
41 | + @Resource | |
42 | + private CycleCountDetailService cycleCountDetailService; | |
43 | + @Resource | |
44 | + private InventoryHeaderService inventoryHeaderService; | |
45 | + @Resource | |
46 | + private InventoryDetailService inventoryDetailService; | |
47 | + @Resource | |
48 | + private InventoryTransactionService inventoryTransactionService; | |
49 | + @Resource | |
50 | + private LocationService locationService; | |
51 | + @Resource | |
52 | + private ContainerService containerService; | |
53 | + | |
54 | + | |
55 | + | |
56 | + | |
57 | + | |
58 | + | |
59 | + | |
60 | + /** | |
61 | + * 调整库存数量 | |
62 | + * @param adjustDetail | |
63 | + * @return | |
64 | + */ | |
65 | + @Transactional | |
66 | + @Override | |
67 | + public AjaxResult updateAdjustDetail(AdjustDetail adjustDetail) { | |
68 | + /*修改库存数量,调整单据状态,写入库存交易*/ | |
69 | + | |
70 | + //已调整过不允许修改。 | |
71 | + if(adjustDetail.getStatus() == 1){ | |
72 | + AjaxResult.error("该单据已调整,不允许再次调整!" ); | |
73 | + } | |
74 | + //查询调整的库存明细 | |
75 | + InventoryDetail inventoryDetail = inventoryDetailService.getById(adjustDetail.getInventoryDetailId()); | |
76 | + /*调整后的数量写入库存*/ | |
77 | + //比较大小可以用 .compareTo()返回值 -1 小于 0 等于 1 大于 | |
78 | + //Bigdecimal 自带运算方法.add加法 .subtract减法 | |
79 | + | |
80 | + if(adjustDetail.getToQty().compareTo(BigDecimal.ZERO) == 0){ | |
81 | + //当调整后数量为0时,直接删除该条库存,并写入库存交易 | |
82 | + //删除库存,并查询当前库位还有没有其他物料,没有则删除库存头,恢复容器和库位状态 | |
83 | + InventoryDetail inv = new InventoryDetail(); | |
84 | + inv.setInventoryHeaderId(inventoryDetail.getInventoryHeaderId()); | |
85 | + inv.setLocationCode(inventoryDetail.getLocationCode()); | |
86 | + inv.setContainerCode(inventoryDetail.getContainerCode()); | |
87 | + LambdaQueryWrapper<InventoryDetail> lamdDetail = Wrappers.lambdaQuery(inv); | |
88 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(lamdDetail); | |
89 | + inventoryDetailService.removeById(adjustDetail.getInventoryDetailId());//删除实际库存数量为0的库存明细 | |
90 | + if(inventoryDetailList.size() == 0){ | |
91 | + //恢复库位和容器状态,删除库存头 | |
92 | + inventoryHeaderService.removeById(inventoryDetail.getInventoryHeaderId()); | |
93 | + locationService.updateContainerCodeAndStatus(inventoryDetail.getLocationCode(),"","empty"); | |
94 | + containerService.updateLocationCodeAndStatus(inventoryDetail.getContainerCode(),"","empty"); | |
95 | + } | |
96 | + }else{ | |
97 | + //修改库存 | |
98 | + //BigDecimal temp =(adjustDetail.getFromQty()).add(adjustDetail.getGapQty()); | |
99 | + inventoryDetail.setQty(adjustDetail.getToQty());//调整后的数量 | |
100 | + inventoryDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
101 | + inventoryDetail.setLastUpdated(new Date()); | |
102 | + inventoryDetailService.saveOrUpdate(inventoryDetail); | |
103 | + | |
104 | + } | |
105 | + //写入库存交易记录 | |
106 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
107 | + inventoryTransaction.setWarehouseCode(inventoryDetail.getWarehouseCode()); | |
108 | + inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); | |
109 | + inventoryTransaction.setLocationCode(inventoryDetail.getLocationCode()); | |
110 | + inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode()); | |
111 | + inventoryTransaction.setTransactionType(40); | |
112 | + inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); | |
113 | + inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); | |
114 | + inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); | |
115 | + inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit()); | |
116 | + inventoryTransaction.setTaskQty(inventoryDetail.getTaskQty()); | |
117 | + inventoryTransaction.setInventorySts(inventoryDetail.getInventorySts()); | |
118 | + inventoryTransaction.setReferCode(inventoryDetail.getReferCode()); | |
119 | + inventoryTransaction.setReferDetailId(inventoryDetail.getReferDetailId()); | |
120 | + inventoryTransaction.setBatch(inventoryDetail.getBatch()); | |
121 | + inventoryTransaction.setLot(inventoryDetail.getLot()); | |
122 | + inventoryTransaction.setProjectNo(inventoryDetail.getProjectNo()); | |
123 | + inventoryTransaction.setQcCheck(inventoryDetail.getQcCheck()); | |
124 | + inventoryTransaction.setWeight(inventoryDetail.getWeight()); | |
125 | + inventoryTransaction.setManufactureDate(inventoryDetail.getManufactureDate()); | |
126 | + inventoryTransaction.setExpirationDate(inventoryDetail.getExpirationDate()); | |
127 | + inventoryTransaction.setAgingDate(inventoryDetail.getCreated()); | |
128 | + inventoryTransaction.setAttributeId(inventoryDetail.getAttributeId()); | |
129 | + inventoryTransaction.setAttribute1(inventoryDetail.getAttribute1()); | |
130 | + inventoryTransaction.setAttribute2(inventoryDetail.getAttribute2()); | |
131 | + inventoryTransaction.setAttribute3(inventoryDetail.getAttribute3()); | |
132 | +// inventoryTransaction.setLockCode(inventoryDetail.getLockCode());//交易锁 | |
133 | + inventoryTransaction.setCreated(new Date()); | |
134 | + inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName()); | |
135 | +// inventoryTransaction.setVersion(); | |
136 | +// inventoryTransaction.setUserDef1(); | |
137 | +// inventoryTransaction.setUserDef2(); | |
138 | +// inventoryTransaction.setUserDef3(); | |
139 | +// inventoryTransaction.setProcessStamp(); | |
140 | +// inventoryTransaction.setBillCode(); | |
141 | + inventoryTransaction.setBillDetailId(inventoryDetail.getReceiptDetailId()); | |
142 | + inventoryTransaction.setSupplierCode(inventoryDetail.getSupplierCode()); | |
143 | + inventoryTransactionService.saveOrUpdate(inventoryTransaction); | |
144 | + | |
145 | + //修改调整单明细状态 | |
146 | + adjustDetail.setStatus(1); | |
147 | + adjustDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
148 | + adjustDetail.setLastUpdated(new Date()); | |
149 | + this.saveOrUpdate(adjustDetail); | |
150 | + | |
151 | + return AjaxResult.success("调整库存数量成功!"); | |
152 | + } | |
153 | + | |
154 | + | |
155 | + | |
156 | + | |
157 | + | |
158 | + | |
159 | + | |
160 | + | |
161 | + | |
162 | + | |
163 | + | |
164 | + | |
165 | + | |
166 | + | |
10 | 167 | } |
... | ... |
src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java
... | ... | @@ -205,6 +205,7 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap |
205 | 205 | adjustDetail.setAdjustCode(adjustHeader.getCode()); |
206 | 206 | adjustDetail.setWarehouseCode(adjustHeader.getWarehouseCode()); |
207 | 207 | adjustDetail.setCompanyCode(adjustHeader.getCompanyCode()); |
208 | + adjustDetail.setInventoryDetailId(item.getInventoryDetailId());//库存明细 | |
208 | 209 | adjustDetail.setLocationCode(item.getLocationCode()); |
209 | 210 | adjustDetail.setContainerCode(item.getContainerCode()); |
210 | 211 | adjustDetail.setCycleCountCode(cyclecountHeader.getCode()); |
... | ... | @@ -217,7 +218,8 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap |
217 | 218 | adjustDetail.setToInventorySts(item.getInventorySts());//盘点不涉及属性 |
218 | 219 | adjustDetail.setFromInventorySts(item.getInventorySts()); |
219 | 220 | adjustDetail.setFromQty(item.getSystemQty());//调整前数量 |
220 | - adjustDetail.setToQty(null);//调整后数量 | |
221 | + BigDecimal toqty = item.getSystemQty().add(item.getGapQty());//调整后数量 | |
222 | + adjustDetail.setToQty(toqty); | |
221 | 223 | adjustDetail.setGapQty(item.getGapQty());//调整数量 |
222 | 224 | adjustDetail.setCreated(new Date()); |
223 | 225 | adjustDetail.setCreatedBy(ShiroUtils.getLoginName()); |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryTransaction/domain/InventoryTransaction.java
... | ... | @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName; |
7 | 7 | import io.swagger.annotations.ApiModel; |
8 | 8 | import io.swagger.annotations.ApiModelProperty; |
9 | 9 | import java.io.Serializable; |
10 | +import java.math.BigDecimal; | |
10 | 11 | import java.util.Date; |
11 | 12 | import lombok.Data; |
12 | 13 | |
... | ... | @@ -93,7 +94,7 @@ public class InventoryTransaction implements Serializable { |
93 | 94 | */ |
94 | 95 | @TableField(value = "taskQty") |
95 | 96 | @ApiModelProperty(value="任务数量") |
96 | - private Integer taskQty; | |
97 | + private BigDecimal taskQty; | |
97 | 98 | |
98 | 99 | /** |
99 | 100 | * 库存状态 |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderService.java
... | ... | @@ -5,6 +5,7 @@ import com.huaheng.pc.shipment.shipmentContainerDetail.domain.ShipmentContainerD |
5 | 5 | import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentCombinationModel; |
6 | 6 | import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader; |
7 | 7 | import com.baomidou.mybatisplus.extension.service.IService; |
8 | +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | |
8 | 9 | import org.apache.ibatis.annotations.Param; |
9 | 10 | |
10 | 11 | import java.util.List; |
... | ... | @@ -28,6 +29,8 @@ public interface ShipmentContainerHeaderService extends IService<ShipmentContain |
28 | 29 | |
29 | 30 | AjaxResult autoCombination(String shipmentCode); |
30 | 31 | |
32 | + AjaxResult autoCombination(List<ShipmentDetail> shipmentDetailList); | |
33 | + | |
31 | 34 | AjaxResult checkForCancelCombination(List<Integer> shipmentContainerIds); |
32 | 35 | |
33 | 36 | AjaxResult createTask(List<Integer> idList); |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderServiceImpl.java
... | ... | @@ -387,16 +387,21 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
387 | 387 | @Override |
388 | 388 | @Transactional |
389 | 389 | public AjaxResult autoCombination(String shipmentCode) { |
390 | - int num=0; | |
391 | - AjaxResult ajaxResult=new AjaxResult(); | |
392 | - | |
393 | - LambdaQueryWrapper<ShipmentDetail> lambdaQueryWrapper=Wrappers.lambdaQuery(); | |
394 | - lambdaQueryWrapper.eq(ShipmentDetail::getShipmentCode,shipmentCode) | |
395 | - .eq(ShipmentDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()); | |
390 | + LambdaQueryWrapper<ShipmentDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
391 | + lambdaQueryWrapper.eq(ShipmentDetail::getShipmentCode, shipmentCode) | |
392 | + .eq(ShipmentDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
396 | 393 | List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(lambdaQueryWrapper); |
397 | - if(shipmentDetailList.size()<1 || shipmentDetailList==null){ | |
394 | + if (shipmentDetailList.size() < 1 || shipmentDetailList == null) { | |
398 | 395 | return AjaxResult.error("找不到子单链"); |
399 | 396 | } |
397 | + return this.autoCombination(shipmentDetailList); | |
398 | + } | |
399 | + | |
400 | + | |
401 | + //出库自动组盘 | |
402 | + public AjaxResult autoCombination(List<ShipmentDetail> shipmentDetailList){ | |
403 | + int num = 0; | |
404 | + List<Integer> list=new ArrayList<>(); | |
400 | 405 | for (ShipmentDetail item : shipmentDetailList) { |
401 | 406 | //获取需要出库数量 |
402 | 407 | BigDecimal shipmentQty = item.getShipQty().subtract(item.getRequestQty()); |
... | ... | @@ -412,6 +417,9 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
412 | 417 | // search.setInventorySts(item.getInventorySts()); //物料状态 |
413 | 418 | |
414 | 419 | List<InventoryDetail> inventoryList = shippingCombinationService.getInventorys(item); |
420 | + if(inventoryList.size() < 1 && item.getWaveId() != 0){ | |
421 | + return AjaxResult.error("主单为"+item.getShipmentCode()+"子单id为"+item.getId() + "的单据没有库存,波次失败"); | |
422 | + } | |
415 | 423 | if (inventoryList.size() < 1) { |
416 | 424 | num = num + 1; |
417 | 425 | } else { |
... | ... | @@ -426,11 +434,12 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
426 | 434 | shipmentCombination.setInventoryDetailId(inventory.getId()); |
427 | 435 | shipmentCombination.setShipmentDetailId(item.getId()); |
428 | 436 | shipmentCombination.setType((short) 300); |
429 | - List<Integer> list=new ArrayList<>(); | |
437 | + | |
430 | 438 | //如果库存数 >= 待出库数,组盘数就是待出库数并且结束组盘,否则组盘数就是库存数 |
431 | 439 | if (inventoryQty.compareTo(shipmentQty) > -1) { |
432 | 440 | shipmentCombination.setShipQty(shipmentQty); |
433 | 441 | ShipmentContainerHeader shipmentContainerHeader=this.combination(shipmentCombination); |
442 | + list.add(shipmentContainerHeader.getId()); | |
434 | 443 | } else { |
435 | 444 | shipmentCombination.setShipQty(inventoryQty); |
436 | 445 | ShipmentContainerHeader shipmentContainerHeader=this.combination(shipmentCombination); |
... | ... | @@ -443,7 +452,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
443 | 452 | if(num==shipmentDetailList.size()){ |
444 | 453 | throw new ServiceException("单据物料在此库区没有库存,无法出库"); |
445 | 454 | } |
446 | - return AjaxResult.success("成功"); | |
455 | + return AjaxResult.success("成功",list); | |
447 | 456 | } |
448 | 457 | |
449 | 458 | /** |
... | ... |
src/main/java/com/huaheng/pc/shipment/wave/controller/WaveController.java
... | ... | @@ -165,9 +165,12 @@ public class WaveController extends BaseController { |
165 | 165 | @Log(title = "出库-波次", operating = "开始波次", action = BusinessType.UPDATE) |
166 | 166 | @PostMapping("/startWave") |
167 | 167 | @ResponseBody |
168 | - public AjaxResult editSave(Wave wave) { | |
169 | - wave.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
170 | - return toAjax(waveService.updateById(wave)); | |
168 | + public AjaxResult starWave(String ids) { | |
169 | + if (StringUtils.isEmpty(ids)){ | |
170 | + return AjaxResult.error("id不能为空"); | |
171 | + } | |
172 | + AjaxResult result=waveService.startWave(ids); | |
173 | + return result; | |
171 | 174 | } |
172 | 175 | |
173 | 176 | } |
... | ... |
src/main/java/com/huaheng/pc/shipment/wave/service/WaveService.java
1 | 1 | package com.huaheng.pc.shipment.wave.service; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
3 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
6 | +import com.huaheng.common.support.Convert; | |
7 | +import com.huaheng.common.utils.security.ShiroUtils; | |
8 | +import com.huaheng.framework.web.domain.AjaxResult; | |
9 | +import com.huaheng.pc.shipment.shipmentContainerHeader.service.ShipmentContainerHeaderService; | |
10 | +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | |
11 | +import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService; | |
4 | 12 | import com.huaheng.pc.shipment.wave.domain.Wave; |
5 | 13 | import com.huaheng.pc.shipment.wave.mapper.WaveMapper; |
14 | +import org.springframework.beans.factory.annotation.Autowired; | |
6 | 15 | import org.springframework.stereotype.Service; |
16 | +import org.springframework.transaction.annotation.Transactional; | |
17 | + | |
18 | +import java.util.ArrayList; | |
19 | +import java.util.Arrays; | |
20 | +import java.util.List; | |
7 | 21 | |
8 | 22 | @Service |
9 | 23 | public class WaveService extends ServiceImpl<WaveMapper, Wave> { |
10 | 24 | |
25 | + | |
26 | + @Autowired | |
27 | + private ShipmentDetailService shipmentDetailService; | |
28 | + @Autowired | |
29 | + private ShipmentContainerHeaderService shipmentContainerHeaderService; | |
30 | + | |
31 | + //开始波次,对带有此波次号的单据进行后续的后台操作 | |
32 | + | |
33 | + @Transactional | |
34 | + public AjaxResult startWave(String ids) { | |
35 | + List<ShipmentDetail> list = new ArrayList<>(); | |
36 | + for (Integer id : Convert.toIntArray(ids)) { | |
37 | + //找到此波次的单据 | |
38 | + LambdaQueryWrapper<ShipmentDetail> lam = Wrappers.lambdaQuery(); | |
39 | + lam.eq(ShipmentDetail::getWaveId,id) | |
40 | + .eq(ShipmentDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
41 | + List<ShipmentDetail> shipmentDetails=shipmentDetailService.list(lam); | |
42 | + | |
43 | + //整合所有加入波次的单据 | |
44 | + if(shipmentDetails != null){ | |
45 | + list.addAll(shipmentDetails); | |
46 | + } | |
47 | + } | |
48 | + | |
49 | + //自动组盘 | |
50 | + AjaxResult ajaxResult=shipmentContainerHeaderService.autoCombination(list); | |
51 | + if(ajaxResult.getData() != null){ | |
52 | + //生成任务 | |
53 | + shipmentContainerHeaderService.createTask(Arrays.asList(Convert.toIntArray(ajaxResult.getData().toString()))); | |
54 | + } | |
55 | + return AjaxResult.success("波次运行成功"); | |
56 | + } | |
11 | 57 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -502,6 +502,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
502 | 502 | detail.setMaterialCode(DataUtils.getString(map.get("materialCode")));//物料号 |
503 | 503 | detail.setMaterialName(DataUtils.getString(map.get("materialName")));//物料名称 |
504 | 504 | detail.setMaterialSpec(DataUtils.getString(map.get("materialSpec")));//物料规格 |
505 | + detail.setMaterialUnit(DataUtils.getString(map.get("materialUnit")));//物料单位 | |
505 | 506 | detail.setReceiptCode(DataUtils.getString(map.get("receiptCode")));//入库单编码 |
506 | 507 | detail.setReceiptDetailId(DataUtils.getInteger(map.get("receiptDetailId")));//入库单明细ID |
507 | 508 | detail.setBatch(DataUtils.getString(map.get("batch")));//批次 |
... | ... | @@ -534,6 +535,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
534 | 535 | inventoryTransaction.setContainerCode(DataUtils.getString(map.get("containerCode"))); |
535 | 536 | inventoryTransaction.setMaterialCode(DataUtils.getString(map.get("materialCode"))); |
536 | 537 | inventoryTransaction.setMaterialName(DataUtils.getString(map.get("materialName"))); |
538 | + inventoryTransaction.setMaterialSpec(DataUtils.getString(map.get("materialSpec")));//物料规格 | |
539 | + inventoryTransaction.setMaterialUnit(DataUtils.getString(map.get("materialUnit")));//物料单位 | |
537 | 540 | inventoryTransaction.setBillCode(DataUtils.getString(map.get("receiptCode"))); |
538 | 541 | inventoryTransaction.setBillDetailId(DataUtils.getInteger(map.get("receiptDetailId"))); |
539 | 542 | inventoryTransaction.setBatch(DataUtils.getString(map.get("batch"))); |
... | ... | @@ -541,7 +544,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
541 | 544 | // inventoryTransaction.setManufactureDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("manufactureDate").toString()));//生产日期 |
542 | 545 | // inventoryTransaction.setExpirationDate(DataUtils.getDateTime(map.get("expirationDate"))); |
543 | 546 | inventoryTransaction.setInventorySts(DataUtils.getString((map.get("inventorySts")))); |
544 | - inventoryTransaction.setTaskQty(DataUtils.getInteger(map.get("qty"))); | |
547 | + inventoryTransaction.setTaskQty(DataUtils.getBigDecimal(map.get("qty"))); | |
545 | 548 | inventoryTransaction.setCreated(new Date()); |
546 | 549 | inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName()); |
547 | 550 | if (!inventoryTransactionService.save(inventoryTransaction)) |
... | ... | @@ -774,7 +777,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
774 | 777 | inventoryTransaction.setMaterialName(item.getMaterialName()); |
775 | 778 | inventoryTransaction.setMaterialSpec(item.getMaterialSpec()); |
776 | 779 | inventoryTransaction.setMaterialUnit(item.getMaterialUnit()); |
777 | - inventoryTransaction.setTaskQty(0); | |
780 | + inventoryTransaction.setTaskQty(BigDecimal.ZERO); | |
778 | 781 | inventoryTransaction.setInventorySts(item.getInventorySts()); |
779 | 782 | //inventoryTransaction.setReferCode(); |
780 | 783 | //inventoryTransaction.setQcCheck(); |
... | ... | @@ -1229,7 +1232,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1229 | 1232 | inventoryTransaction.setExpirationDate(shipmentDetail.getExpirationDate()); |
1230 | 1233 | inventoryTransaction.setInventorySts(inventoryDetail.getInventorySts()); |
1231 | 1234 | //这里取反,更符合出库的语义,同时方便对记录进行统计 |
1232 | - inventoryTransaction.setTaskQty(taskDetail.getQty().intValue()); | |
1235 | + inventoryTransaction.setTaskQty(taskDetail.getQty()); | |
1233 | 1236 | // inventoryTransaction.setCostPrice(shipmentDetail.); |
1234 | 1237 | inventoryTransaction.setCreated(null); |
1235 | 1238 | inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName()); |
... | ... | @@ -1293,8 +1296,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1293 | 1296 | shipmentContainerHeaderLambdaUpdateWrapper.eq(ShipmentContainerHeader::getId,task.getAllocationHeadId()); |
1294 | 1297 | if (! shipmentContainerHeaderService.update(shipmentContainerHeader, shipmentContainerHeaderLambdaUpdateWrapper)) |
1295 | 1298 | throw new ServiceException("更新组盘头状态失败"); |
1296 | - | |
1297 | - | |
1298 | 1299 | //修改出库单状态 |
1299 | 1300 | LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); |
1300 | 1301 | taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskId,task.getId()); |
... | ... |
src/main/resources/mybatis/inventory/AdjustDetailMapper.xml
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | <id column="id" jdbcType="INTEGER" property="id" /> |
7 | 7 | <result column="adjustCode" jdbcType="VARCHAR" property="adjustCode" /> |
8 | 8 | <result column="cycleCountCode" jdbcType="VARCHAR" property="cycleCountCode" /> |
9 | + <result column="inventoryDetailId" jdbcType="INTEGER" property="inventoryDetailId" /> | |
9 | 10 | <result column="cycleDetailId" jdbcType="INTEGER" property="cycleDetailId" /> |
10 | 11 | <result column="checkCode" jdbcType="VARCHAR" property="checkCode" /> |
11 | 12 | <result column="checkDetailId" jdbcType="VARCHAR" property="checkDetailId" /> |
... | ... | @@ -29,6 +30,8 @@ |
29 | 30 | <result column="status" jdbcType="INTEGER" property="status" /> |
30 | 31 | <result column="createdBy" jdbcType="VARCHAR" property="createdBy" /> |
31 | 32 | <result column="created" jdbcType="TIMESTAMP" property="created" /> |
33 | + <result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" /> | |
34 | + <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" /> | |
32 | 35 | <result column="agreeBy" jdbcType="VARCHAR" property="agreeBy" /> |
33 | 36 | <result column="agreeTime" jdbcType="TIMESTAMP" property="agreeTime" /> |
34 | 37 | <result column="Remark" jdbcType="VARCHAR" property="remark" /> |
... | ... | @@ -40,10 +43,10 @@ |
40 | 43 | </resultMap> |
41 | 44 | <sql id="Base_Column_List"> |
42 | 45 | <!--@mbg.generated--> |
43 | - id, adjustCode, cycleCountCode, cycleDetailId, checkCode, checkDetailId, referCode, | |
46 | + id, adjustCode, cycleCountCode, inventoryDetailId, cycleDetailId, checkCode, checkDetailId, referCode, | |
44 | 47 | referDetailId, warehouseCode, companyCode, containerCode, locationCode ,materialCode, materialName, |
45 | 48 | materialSpec, materialUnit, problemType, attributeId, fromInventorySts, toInventorySts, |
46 | - fromQty, toQty, gapQty, `status`, created, createdBy, agreeTime, Remark, | |
49 | + fromQty, toQty, gapQty, `status`, created, createdBy,lastUpdatedBy,lastUpdated, agreeTime, Remark, | |
47 | 50 | version, userDef1, userDef2, userDef3, processStamp |
48 | 51 | </sql> |
49 | 52 | </mapper> |
50 | 53 | \ No newline at end of file |
... | ... |
src/main/resources/mybatis/inventory/InventoryTransactionMapper.xml
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | <result column="materialName" jdbcType="VARCHAR" property="materialName" /> |
14 | 14 | <result column="materialSpec" jdbcType="VARCHAR" property="materialSpec" /> |
15 | 15 | <result column="materialUnit" jdbcType="VARCHAR" property="materialUnit" /> |
16 | - <result column="taskQty" jdbcType="INTEGER" property="taskQty" /> | |
16 | + <result column="taskQty" jdbcType="DECIMAL" property="taskQty" /> | |
17 | 17 | <result column="inventorySts" jdbcType="VARCHAR" property="inventorySts" /> |
18 | 18 | <result column="referCode" jdbcType="VARCHAR" property="referCode" /> |
19 | 19 | <result column="referDetailId" jdbcType="VARCHAR" property="referDetailId" /> |
... | ... |
src/main/resources/templates/inventory/adjustDetail/adjustDetail.html
... | ... | @@ -94,18 +94,13 @@ |
94 | 94 | <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()"> |
95 | 95 | <i class="fa fa-plus"></i> 新增 |
96 | 96 | </a> |
97 | - <!--<a class="btn btn-outline btn-danger btn-rounded" onclick="addAdjust()"/> | |
98 | - <!–shiro:hasPermission="inventory:cyclecountAdjustDetail:addAdjust"–> | |
97 | + <a class="btn btn-outline btn-primary btn-rounded" onclick=""> | |
98 | + <i class="fa fa-edit"></i> 审核 | |
99 | + </a> | |
100 | + <a class="btn btn-outline btn-danger btn-rounded" onclick="addAdjust()"/> | |
101 | + <!--shiro:hasPermission="inventory:cyclecountAdjustDetail:addAdjust"--> | |
99 | 102 | <i class="fa fa-vcard"></i>调整 |
100 | - </a>--> | |
101 | - <!--<a class="btn btn-outline btn-danger btn-rounded" onclick="createCyclecountWithGapQty()" | |
102 | - shiro:hasPermission="inventoryHeader:cycleCountDetail:cyclecountRepeat"> | |
103 | - <i class="fa fa-vcard"></i> 差异复盘 | |
104 | - </a>--> | |
105 | - <!--<a class="btn btn-outline btn-danger btn-rounded" onclick="adjust()" | |
106 | - shiro:hasPermission="inventoryHeader:cycleCountDetail:adjust"> | |
107 | - <i class="fa fa-vcard"></i> 差异库存调整 | |
108 | - </a>--> | |
103 | + </a> | |
109 | 104 | <!--<a class="btn btn-outline btn-success btn-rounded" onclick="$.table.refresh()"> |
110 | 105 | <i class="fa fa-refresh"></i> 刷新 |
111 | 106 | </a>--> |
... | ... | @@ -138,15 +133,15 @@ |
138 | 133 | { |
139 | 134 | radio: true |
140 | 135 | }, |
141 | - { | |
136 | + /*{ | |
142 | 137 | title: '调整操作', |
143 | 138 | align: 'center', |
144 | 139 | formatter: function (value, row, index) { |
145 | 140 | var actions = []; |
146 | - actions.push('<a class="btn btn-warning btn-xs " href="#" onclick="$.operate.addAdjust()"><i class="fa fa-trash-o"></i>调整</a> '); | |
141 | + actions.push('<a class="btn btn-warning btn-xs " href="#" onclick="addAdjust(\'' + row.id + '\')"><i class="fa fa-send"></i> 调整</a> '); | |
147 | 142 | return actions.join(''); |
148 | 143 | } |
149 | - }, | |
144 | + },*/ | |
150 | 145 | { |
151 | 146 | field: 'id', |
152 | 147 | title: '明细id', |
... | ... | @@ -158,6 +153,12 @@ |
158 | 153 | visible: true |
159 | 154 | }, |
160 | 155 | { |
156 | + field: 'inventoryDetailId', | |
157 | + title: '库存明细', | |
158 | + visible: true | |
159 | + }, | |
160 | + | |
161 | + { | |
161 | 162 | field: 'warehouseCode', |
162 | 163 | title: '仓库', |
163 | 164 | visible: false |
... | ... | @@ -380,21 +381,13 @@ |
380 | 381 | |
381 | 382 | $.modal.confirm("注意:该操作将更改库存,当实盘数量为0且库位上只剩空容器时,请手动执行空托出库任务,容器上有货则无需其他操作!", |
382 | 383 | function () { |
383 | - var cyclecountAdjustId = $('#cyclecountAdjustId').val(); | |
384 | - var companyCode = $('#companyCode').val(); | |
385 | - var code = $('#code').val(); | |
386 | - var cyclecountHeadCode = $('#sourceCode').val(); | |
387 | - //判断有没有选取明细条目,进的页面不同 | |
388 | - if (row.length !== 0) { | |
389 | 384 | /*判断是否已经调整过*/ |
390 | - if (row[0].status == 40) { | |
385 | + if (row[0].status == 2) { | |
391 | 386 | $.modal.msg('该条明细已调整,请勿重复调整!') |
392 | 387 | } else { |
393 | 388 | $.modal.open("差异调整单", prefix + "/adjustEdit?id=" + row[0].id) |
394 | 389 | } |
395 | - } else { | |
396 | - $.modal.open("调整单", prefix + "/addAdjust?cyclecountAdjustId=" + cyclecountAdjustId + "&companyCode=" + companyCode + "&code=" + code + "&cyclecountHeadCode=" + cyclecountHeadCode); | |
397 | - } | |
390 | + | |
398 | 391 | }); |
399 | 392 | } |
400 | 393 | |
... | ... |