Commit 7d9280104e7f069c2202b6e7d7c1c8bb10fdd6f3

Authored by pengyongcheng
1 parent f8fdad9f

fix: 盘点-调整 BUG修复

src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailService.java
... ... @@ -3,10 +3,17 @@ package com.huaheng.pc.inventory.adjustDetail.service;
3 3 import com.baomidou.mybatisplus.extension.service.IService;
4 4 import com.huaheng.framework.web.domain.AjaxResult;
5 5 import com.huaheng.pc.inventory.adjustDetail.domain.AdjustDetail;
  6 +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail;
6 7  
7 8  
8 9 public interface AdjustDetailService extends IService<AdjustDetail> {
9 10  
  11 + /**
  12 + * 新增调整明细
  13 + *
  14 + * @param adjustDetail 调整单明细
  15 + * @return 新增结果
  16 + */
10 17 AjaxResult addDetails(AdjustDetail adjustDetail);
11 18  
12 19 AjaxResult updateAdjustDetail(AdjustDetail adjustDetail);
... ... @@ -15,6 +22,25 @@ public interface AdjustDetailService extends IService&lt;AdjustDetail&gt; {
15 22  
16 23 AjaxResult editSave(AdjustDetail adjustDetail);
17 24  
  25 + /**
  26 + * 调整数量
  27 + * @param adjustDetail 调整单明细
  28 + * @param inventoryDetail 库存明细
  29 + */
  30 + void updateAdjustDetailNumber(AdjustDetail adjustDetail, InventoryDetail inventoryDetail);
  31 +
  32 + /**
  33 + * 调整属性
  34 + * @param adjustDetail 调整单明细
  35 + * @param inventoryDetail 库存明细
  36 + */
  37 + void updateAdjustDetailState(AdjustDetail adjustDetail, InventoryDetail inventoryDetail);
  38 +
  39 + /**
  40 + * 调整插入库存
  41 + * @param adjustDetail 调整单明细
  42 + */
  43 + void updateAdjustDetailInsert(AdjustDetail adjustDetail);
18 44 }
19 45  
20 46  
... ...
src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java
... ... @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6 import com.huaheng.common.constant.QuantityConstant;
7 7 import com.huaheng.common.exception.service.ServiceException;
8 8 import com.huaheng.common.utils.StringUtils;
  9 +import com.huaheng.common.utils.bean.BeanUtils;
9 10 import com.huaheng.common.utils.security.ShiroUtils;
10 11 import com.huaheng.framework.web.domain.AjaxResult;
11 12 import com.huaheng.pc.check.checkDetail.domain.CheckDetail;
... ... @@ -38,7 +39,8 @@ import java.util.List;
38 39 @Service
39 40 public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, AdjustDetail> implements AdjustDetailService {
40 41  
41   -
  42 + @Resource
  43 + private AdjustDetailService adjustDetailService;
42 44 @Resource
43 45 private CycleCountDetailService cycleCountDetailService;
44 46 @Resource
... ... @@ -58,14 +60,7 @@ public class AdjustDetailServiceImpl extends ServiceImpl&lt;AdjustDetailMapper, Adj
58 60 @Resource
59 61 private ContainerService containerService;
60 62  
61   -
62   - /**
63   - * 新增调整明细
64   - *
65   - * @param adjustDetail
66   - * @return
67   - */
68   - @Transactional
  63 + @Transactional(rollbackFor = Exception.class)
69 64 @Override
70 65 public AjaxResult addDetails(AdjustDetail adjustDetail) {
71 66  
... ... @@ -92,7 +87,7 @@ public class AdjustDetailServiceImpl extends ServiceImpl&lt;AdjustDetailMapper, Adj
92 87 if (StringUtils.isNotEmpty(adjustDetail.getCycleCountHeaderCode())) {
93 88 CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(adjustDetail.getCheckDetailId());
94 89 if (cycleCountDetail == null || !cycleCountDetail.getCycleCountHeadCode().equals(adjustDetail.getCycleCountHeaderCode())) {
95   - return AjaxResult.error("盘点单错误,请核对盘点单据");
  90 + return AjaxResult.error("盘点单错误,请核对盘点单据");
96 91 }
97 92 }
98 93 //检查质检单
... ... @@ -106,24 +101,26 @@ public class AdjustDetailServiceImpl extends ServiceImpl&lt;AdjustDetailMapper, Adj
106 101 Material material = materialService.getMaterialByCode(adjustDetail.getMaterialCode());
107 102 if (material != null) {
108 103 if (!material.getName().equals(adjustDetail.getMaterialName())) {
109   - return AjaxResult.error("物料名称错误");
  104 + return AjaxResult.error("物料名称错误");
110 105 }
111 106 } else {
112   - return AjaxResult.error("物料编码错误");
  107 + return AjaxResult.error("物料编码错误");
113 108 }
114 109 //调整数量
115 110 BigDecimal gapQty = adjustDetail.getToQty().subtract(adjustDetail.getFromQty());
116 111 adjustDetail.setGapQty(gapQty);
117   - adjustDetail.setProblemType(adjustHeader.getProblemType());//调整类型
  112 + adjustDetail.setProblemType(adjustHeader.getProblemType());
118 113 adjustDetail.setMaterialUnit(material.getUnit());
119 114 adjustDetail.setMaterialSpec(material.getSpec());
120 115 adjustDetail.setCreated(new Date());
121 116 adjustDetail.setCreatedBy(ShiroUtils.getLoginName());
122 117 adjustDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
123 118 adjustDetail.setLastUpdated(new Date());
124   - this.saveOrUpdate(adjustDetail);
125   -
126   - return AjaxResult.success("新增调整明细成功!");
  119 + boolean success = adjustDetailService.save(adjustDetail);
  120 + if (!success) {
  121 + throw new ServiceException("新增调整明细失败,保存调整明细失败");
  122 + }
  123 + return AjaxResult.success("新增调整明细成功");
127 124 }
128 125  
129 126 /**
... ... @@ -144,9 +141,11 @@ public class AdjustDetailServiceImpl extends ServiceImpl&lt;AdjustDetailMapper, Adj
144 141 adjustDetail.setStatus(1);
145 142 adjustDetail.setLastUpdated(new Date());
146 143 adjustDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
147   - this.saveOrUpdate(adjustDetail);
148   -
149   - return AjaxResult.success("审批完成!");
  144 + boolean success = adjustDetailService.saveOrUpdate(adjustDetail);
  145 + if (!success) {
  146 + return AjaxResult.error("审批失败,更新调整单明细失败");
  147 + }
  148 + return AjaxResult.success("审批完成");
150 149 }
151 150  
152 151 /**
... ... @@ -158,8 +157,8 @@ public class AdjustDetailServiceImpl extends ServiceImpl&lt;AdjustDetailMapper, Adj
158 157 //根据ID修改
159 158 BigDecimal t = adjustDetail.getToQty().subtract(adjustDetail.getFromQty());
160 159 adjustDetail.setGapQty(t);
161   - Boolean j = this.updateById(adjustDetail);
162   - if (!j) {
  160 + boolean success = this.updateById(adjustDetail);
  161 + if (!success) {
163 162 throw new ServiceException("修改调账明细失败!");
164 163 }
165 164 return AjaxResult.success("修改成功");
... ... @@ -200,41 +199,36 @@ public class AdjustDetailServiceImpl extends ServiceImpl&lt;AdjustDetailMapper, Adj
200 199 //判断调整库存状态还是数量
201 200 if (adjustDetail.getToQty() != null || adjustDetail.getGapQty() != null) {
202 201 //调整数量
203   - this.updateAdjustDetailNumber(adjustDetail, inventoryDetail);
  202 + adjustDetailService.updateAdjustDetailNumber(adjustDetail, inventoryDetail);
204 203 }
205 204 if (!adjustDetail.getFromInventorySts().equals(adjustDetail.getToInventorySts())) {
206 205 //调整库存状态
207   - this.updateAdjustDetailState(adjustDetail, inventoryDetail);
  206 + adjustDetailService.updateAdjustDetailState(adjustDetail, inventoryDetail);
208 207 }
209 208 } else {
210   - String fromQtyString = adjustDetail.getFromQty().toString(); //调整前库存数量
  209 + //调整前库存数量
  210 + String fromQtyString = adjustDetail.getFromQty().toString();
211 211 if (StringUtils.isNotEmpty(fromQtyString)) {
212 212 //调整插入库存
213   - updateAdjustDetailInsert(adjustDetail);
  213 + adjustDetailService.updateAdjustDetailInsert(adjustDetail);
214 214 }
215 215 }
216 216 //修改调整单明细状态
217 217 adjustDetail.setStatus(3);
218 218 adjustDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
219 219 adjustDetail.setLastUpdated(new Date());
220   - this.saveOrUpdate(adjustDetail);
  220 + adjustDetailService.saveOrUpdate(adjustDetail);
221 221  
222 222 return AjaxResult.success("调整库存成功!");
223 223 }
224 224  
225   -
226   - /**
227   - * 调整修改库存数量
228   - *
229   - * @param adjustDetail
230   - */
231   - @Transactional
  225 + @Override
  226 + @Transactional(rollbackFor = Exception.class)
232 227 public void updateAdjustDetailNumber(AdjustDetail adjustDetail, InventoryDetail inventoryDetail) {
233   - /*修改库存数量,调整单据状态,写入库存交易*/
234   -
235   - /*调整后的数量写入库存*/
236   - //比较大小可以用 .compareTo()返回值 -1 小于 0 等于 1 大于
237   - //Bigdecimal 自带运算方法.add加法 .subtract减法
  228 + // 修改库存数量,调整单据状态,写入库存交易
  229 + // 调整后的数量写入库存
  230 + // 比较大小可以用 .compareTo()返回值 -1 小于 0 等于 1 大于
  231 + // Bigdecimal 自带运算方法.add加法 .subtract减法
238 232 if (adjustDetail.getToQty().compareTo(BigDecimal.ZERO) == 0) {
239 233 //当调整后数量为0时,直接删除该条库存,并写入库存交易
240 234 //删除库存,并查询当前库位还有没有其他物料,没有则删除库存头,恢复容器和库位状态
... ... @@ -242,10 +236,14 @@ public class AdjustDetailServiceImpl extends ServiceImpl&lt;AdjustDetailMapper, Adj
242 236 inv.setInventoryHeaderId(inventoryDetail.getInventoryHeaderId());
243 237 inv.setLocationCode(inventoryDetail.getLocationCode());
244 238 inv.setContainerCode(inventoryDetail.getContainerCode());
245   - LambdaQueryWrapper<InventoryDetail> lamdDetail = Wrappers.lambdaQuery(inv);
246   - List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(lamdDetail);
247   - inventoryDetailService.removeById(adjustDetail.getInventoryDetailId());//删除实际库存数量为0的库存明细
248   - if (inventoryDetailList.size() == 0) {
  239 + LambdaQueryWrapper<InventoryDetail> inventoryDetailQueryWrapper = Wrappers.lambdaQuery(inv);
  240 + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailQueryWrapper);
  241 + //删除实际库存数量为0的库存明细
  242 + boolean success = inventoryDetailService.removeById(adjustDetail.getInventoryDetailId());
  243 + if (!success) {
  244 + throw new ServiceException("更新");
  245 + }
  246 + if (inventoryDetailList.isEmpty()) {
249 247 //恢复库位和容器状态,删除库存头
250 248 inventoryHeaderService.removeById(inventoryDetail.getInventoryHeaderId());
251 249 locationService.updateContainerCodeAndStatus(inventoryDetail.getLocationCode(),
... ... @@ -255,146 +253,89 @@ public class AdjustDetailServiceImpl extends ServiceImpl&lt;AdjustDetailMapper, Adj
255 253 }
256 254 } else {
257 255 //修改库存
258   - //BigDecimal temp =(adjustDetail.getFromQty()).add(adjustDetail.getGapQty());
259   - inventoryDetail.setQty(adjustDetail.getToQty());//调整后的数量
  256 + //调整后的数量
  257 + inventoryDetail.setQty(adjustDetail.getToQty());
260 258 inventoryDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
261 259 inventoryDetail.setLastUpdated(new Date());
262   - Boolean j = inventoryDetailService.saveOrUpdate(inventoryDetail);
263   - if (j == false) {
264   - throw new SecurityException("调整修改库存失败!");
  260 + boolean success = inventoryDetailService.saveOrUpdate(inventoryDetail);
  261 + if (!success) {
  262 + throw new SecurityException("调整修改库存失败");
265 263 }
266 264 }
267 265 //写入库存交易记录
268 266 InventoryTransaction inventoryTransaction = new InventoryTransaction();
269   - inventoryTransaction.setWarehouseCode(inventoryDetail.getWarehouseCode());
270   - inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode());
271   - inventoryTransaction.setLocationCode(inventoryDetail.getLocationCode());
272   - inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode());
  267 + BeanUtils.copyBeanProp(inventoryTransaction, inventoryDetail);
273 268 inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_ADJUSTOUT);
274   - inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode());
275   - inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName());
276   - inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec());
277   - inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit());
278 269 inventoryTransaction.setTaskQty(adjustDetail.getGapQty());
279   - inventoryTransaction.setInventorySts(inventoryDetail.getInventorySts());
280 270 inventoryTransaction.setReferCode(adjustDetail.getAdjustCode());
281 271 inventoryTransaction.setReferDetailId(adjustDetail.getId().toString());
282   - inventoryTransaction.setBatch(inventoryDetail.getBatch());
283   - inventoryTransaction.setLot(inventoryDetail.getLot());
284   - inventoryTransaction.setProjectNo(inventoryDetail.getProjectNo());
285   - inventoryTransaction.setQcCheck(inventoryDetail.getQcCheck());
286   - inventoryTransaction.setWeight(inventoryDetail.getWeight());
287   - inventoryTransaction.setManufactureDate(inventoryDetail.getManufactureDate());
288   - inventoryTransaction.setExpirationDate(inventoryDetail.getExpirationDate());
289 272 inventoryTransaction.setAgingDate(inventoryDetail.getCreated());
290   - inventoryTransaction.setAttributeId(inventoryDetail.getAttributeId());
291   - inventoryTransaction.setAttribute1(inventoryDetail.getAttribute1());
292   - inventoryTransaction.setAttribute2(inventoryDetail.getAttribute2());
293   - inventoryTransaction.setAttribute3(inventoryDetail.getAttribute3());
294 273 inventoryTransaction.setCreated(new Date());
295 274 inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName());
296 275 inventoryTransaction.setBillDetailId(inventoryDetail.getReceiptDetailId());
297   - inventoryTransaction.setSupplierCode(inventoryDetail.getSupplierCode());
298   - Boolean k = inventoryTransactionService.saveOrUpdate(inventoryTransaction);
299   - if (k == false) {
  276 + boolean success = inventoryTransactionService.saveOrUpdate(inventoryTransaction);
  277 + if (!success) {
300 278 throw new SecurityException("调整单库存交易生成失败!");
301 279 }
302 280 }
303 281  
304   - /**
305   - * 调整库存属性
306   - *
307   - * @param adjustDetail
308   - */
309   - @Transactional
  282 + @Override
  283 + @Transactional(rollbackFor = Exception.class)
310 284 public void updateAdjustDetailState(AdjustDetail adjustDetail, InventoryDetail inventoryDetail) {
311   - /*不考虑其他只改变库存状态即可,也需要写入库存交易。*/
312   -
313   - //修改库存的状态
314   - inventoryDetail.setInventorySts(adjustDetail.getToInventorySts());//修改为调整库存
315   - inventoryDetail.setExpirationDate(adjustDetail.getExpirationDate());
316   - inventoryDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
317   - inventoryDetail.setLastUpdated(new Date());
318   - inventoryDetailService.saveOrUpdate(inventoryDetail);
  285 + // 不考虑其他只改变库存状态即可,也需要写入库存交易。
319 286  
  287 + // 修改库存的状态
  288 + InventoryDetail updateInventoryDetail = new InventoryDetail();
  289 + updateInventoryDetail.setId(inventoryDetail.getId());
  290 + updateInventoryDetail.setInventorySts(adjustDetail.getToInventorySts());
  291 + updateInventoryDetail.setExpirationDate(adjustDetail.getExpirationDate());
  292 + updateInventoryDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
  293 + updateInventoryDetail.setLastUpdated(new Date());
  294 + boolean success = inventoryDetailService.updateById(updateInventoryDetail);
  295 + if (!success) {
  296 + throw new ServiceException("调整库存属性失败,更新库存明细失败");
  297 + }
320 298  
321 299 //写入库存交易,2条一条出,一条入
322 300 //调整出
323 301 InventoryTransaction inventoryTransaction = new InventoryTransaction();
324   - inventoryTransaction.setWarehouseCode(inventoryDetail.getWarehouseCode());
325   - inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode());
326   - inventoryTransaction.setLocationCode(inventoryDetail.getLocationCode());
327   - inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode());
  302 + BeanUtils.copyBeanProp(inventoryTransaction, inventoryDetail);
328 303 inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_ADJUSTOUT);
329   - inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode());
330   - inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName());
331   - inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec());
332   - inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit());
333   - inventoryTransaction.setTaskQty(BigDecimal.ZERO);//数量不变
334   - inventoryTransaction.setInventorySts(adjustDetail.getFromInventorySts());//状态
  304 + inventoryTransaction.setTaskQty(BigDecimal.ZERO);
  305 + inventoryTransaction.setInventorySts(adjustDetail.getFromInventorySts());
335 306 inventoryTransaction.setReferCode(adjustDetail.getAdjustCode());
336 307 inventoryTransaction.setReferDetailId(adjustDetail.getId().toString());
337   - inventoryTransaction.setBatch(inventoryDetail.getBatch());
338   - inventoryTransaction.setLot(inventoryDetail.getLot());
339   - inventoryTransaction.setProjectNo(inventoryDetail.getProjectNo());
340   - inventoryTransaction.setQcCheck(inventoryDetail.getQcCheck());
341   - inventoryTransaction.setWeight(inventoryDetail.getWeight());
342   - inventoryTransaction.setManufactureDate(inventoryDetail.getManufactureDate());
343   - inventoryTransaction.setExpirationDate(inventoryDetail.getExpirationDate());
344 308 inventoryTransaction.setAgingDate(inventoryDetail.getCreated());
345   - inventoryTransaction.setAttributeId(inventoryDetail.getAttributeId());
346   - inventoryTransaction.setAttribute1(inventoryDetail.getAttribute1());
347   - inventoryTransaction.setAttribute2(inventoryDetail.getAttribute2());
348   - inventoryTransaction.setAttribute3(inventoryDetail.getAttribute3());
349 309 inventoryTransaction.setCreated(new Date());
350 310 inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName());
351 311 inventoryTransaction.setBillDetailId(inventoryDetail.getReceiptDetailId());
352   - inventoryTransaction.setSupplierCode(inventoryDetail.getSupplierCode());
353   - inventoryTransactionService.saveOrUpdate(inventoryTransaction);
  312 + success = inventoryTransactionService.save(inventoryTransaction);
  313 + if (!success) {
  314 + throw new ServiceException("调整库存属性失败,保存调整出交易记录失败");
  315 + }
354 316  
355 317 //调整入
356 318 InventoryTransaction inventoryTransaction2 = new InventoryTransaction();
357   - inventoryTransaction2.setWarehouseCode(inventoryDetail.getWarehouseCode());
358   - inventoryTransaction2.setCompanyCode(inventoryDetail.getCompanyCode());
359   - inventoryTransaction2.setLocationCode(inventoryDetail.getLocationCode());
360   - inventoryTransaction2.setContainerCode(inventoryDetail.getContainerCode());
  319 + BeanUtils.copyBeanProp(inventoryTransaction2, inventoryDetail);
361 320 inventoryTransaction2.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_ADJUSTINTO);
362   - inventoryTransaction2.setMaterialCode(inventoryDetail.getMaterialCode());
363   - inventoryTransaction2.setMaterialName(inventoryDetail.getMaterialName());
364   - inventoryTransaction2.setMaterialSpec(inventoryDetail.getMaterialSpec());
365   - inventoryTransaction2.setMaterialUnit(inventoryDetail.getMaterialUnit());
366   - inventoryTransaction2.setTaskQty(BigDecimal.ZERO);//数量不变
367   - inventoryTransaction2.setInventorySts(inventoryDetail.getInventorySts());//状态
368   - inventoryTransaction.setReferCode(adjustDetail.getAdjustCode());
369   - inventoryTransaction.setReferDetailId(adjustDetail.getId().toString());
370   - inventoryTransaction2.setBatch(inventoryDetail.getBatch());
371   - inventoryTransaction2.setLot(inventoryDetail.getLot());
372   - inventoryTransaction2.setProjectNo(inventoryDetail.getProjectNo());
373   - inventoryTransaction2.setQcCheck(inventoryDetail.getQcCheck());
374   - inventoryTransaction2.setWeight(inventoryDetail.getWeight());
375   - inventoryTransaction2.setManufactureDate(inventoryDetail.getManufactureDate());
376   - inventoryTransaction2.setExpirationDate(inventoryDetail.getExpirationDate());
  321 + inventoryTransaction2.setTaskQty(BigDecimal.ZERO);
  322 + inventoryTransaction2.setInventorySts(inventoryDetail.getInventorySts());
  323 + inventoryTransaction2.setReferCode(adjustDetail.getAdjustCode());
  324 + inventoryTransaction2.setReferDetailId(adjustDetail.getId().toString());
377 325 inventoryTransaction2.setAgingDate(inventoryDetail.getCreated());
378   - inventoryTransaction2.setAttributeId(inventoryDetail.getAttributeId());
379   - inventoryTransaction2.setAttribute1(inventoryDetail.getAttribute1());
380   - inventoryTransaction2.setAttribute2(inventoryDetail.getAttribute2());
381   - inventoryTransaction2.setAttribute3(inventoryDetail.getAttribute3());
382 326 inventoryTransaction2.setCreated(new Date());
383 327 inventoryTransaction2.setCreatedBy(ShiroUtils.getLoginName());
384 328 inventoryTransaction2.setBillDetailId(inventoryDetail.getReceiptDetailId());
385   - inventoryTransaction2.setSupplierCode(inventoryDetail.getSupplierCode());
386   - inventoryTransactionService.saveOrUpdate(inventoryTransaction2);
387   -
  329 + success = inventoryTransactionService.save(inventoryTransaction2);
  330 + if (!success) {
  331 + throw new ServiceException("调整库存属性失败,保存调整入交易记录失败");
  332 + }
388 333 }
389 334  
390   - /**
391   - * 调整插入库存
392   - *
393   - * @param adjustDetail
394   - */
  335 + @Override
395 336 @Transactional(rollbackFor = Exception.class)
396 337 public void updateAdjustDetailInsert(AdjustDetail adjustDetail) {
397   - /*当系统库存为0时,调整单触发插入新库存状态*/
  338 + //当系统库存为0时,调整单触发插入新库存状态
398 339 //新生成库存头时,库位,容器都需要更新数据
399 340  
400 341 //判断是否存在库存头,没有需要生成,有库存头直接插入库存明细即可
... ... @@ -405,20 +346,20 @@ public class AdjustDetailServiceImpl extends ServiceImpl&lt;AdjustDetailMapper, Adj
405 346 LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(ih);
406 347 InventoryHeader inventoryHeader = inventoryHeaderService.getOne(inventoryHeaderLambdaQueryWrapper);
407 348 if (inventoryHeader == null) {
408   - //库存头为空,生成库存头
409 349 InventoryHeader header = new InventoryHeader();
410 350 header.setWarehouseCode(adjustDetail.getWarehouseCode());
411 351 header.setLocationCode(adjustDetail.getLocationCode());
412 352 header.setContainerCode(adjustDetail.getContainerCode());
413 353 header.setContainerStatus("");
414 354 header.setCompanyCode(adjustDetail.getCompanyCode());
415   - header.setMaterialSkuQty("");
416   - header.setTotalWeight("");
417 355 header.setCreated(new Date());
418 356 header.setCreatedBy(ShiroUtils.getLoginName());
419 357 header.setLastUpdated(new Date());
420 358 header.setLastUpdatedBy(ShiroUtils.getLoginName());
421   - inventoryHeaderService.saveOrUpdate(header);
  359 + boolean success = inventoryHeaderService.save(header);
  360 + if (!success) {
  361 + throw new ServiceException("调整新增库存失败,保存库存头表失败");
  362 + }
422 363 //更新库位和容器
423 364 locationService.updateContainerCodeAndStatus(header.getLocationCode(),
424 365 header.getContainerCode(), QuantityConstant.STATUS_LOCATION_EMPTY);
... ... @@ -429,83 +370,46 @@ public class AdjustDetailServiceImpl extends ServiceImpl&lt;AdjustDetailMapper, Adj
429 370 Location location = locationService.getLocationByCode(adjustDetail.getLocationCode(), QuantityConstant.DEFAULT_WAREHOUSE);
430 371 //生成库存明细
431 372 InventoryDetail inventoryDetail = new InventoryDetail();
  373 + BeanUtils.copyBeanProp(inventoryDetail, adjustDetail);
432 374 inventoryDetail.setInventoryHeaderId(inventoryHeader.getId());
433   - inventoryDetail.setWarehouseCode(adjustDetail.getWarehouseCode());
434   - inventoryDetail.setCompanyCode(adjustDetail.getCompanyCode());
435   - inventoryDetail.setLocationCode(adjustDetail.getLocationCode());
436 375 inventoryDetail.setZoneCode(location.getZoneCode());
437   - inventoryDetail.setContainerCode(adjustDetail.getContainerCode());
438   - inventoryDetail.setMaterialCode(adjustDetail.getMaterialCode());
439   - inventoryDetail.setMaterialName(adjustDetail.getMaterialName());
440   - inventoryDetail.setMaterialSpec(adjustDetail.getMaterialSpec());
441   - inventoryDetail.setMaterialUnit(adjustDetail.getMaterialUnit());
442 376 inventoryDetail.setQty(adjustDetail.getToQty());
443 377 inventoryDetail.setTaskQty(BigDecimal.ZERO);
444 378 inventoryDetail.setInventorySts(adjustDetail.getFromInventorySts());
445   - inventoryDetail.setSupplierCode(adjustDetail.getSupplierCode());
446 379 inventoryDetail.setReferCode(adjustDetail.getAdjustCode());
447 380 inventoryDetail.setReferDetailId(adjustDetail.getId().toString());
448   - inventoryDetail.setBatch(adjustDetail.getBatch());
449   - inventoryDetail.setLot(adjustDetail.getLot());
450   - inventoryDetail.setProjectNo(adjustDetail.getProjectNo());
451   - inventoryDetail.setWeight(adjustDetail.getWeight());
452   - inventoryDetail.setManufactureDate(adjustDetail.getManufactureDate());
453   - inventoryDetail.setExpirationDate(adjustDetail.getExpirationDate());
454 381 inventoryDetail.setCreated(new Date());
455 382 inventoryDetail.setCreatedBy(ShiroUtils.getLoginName());
456 383 inventoryDetail.setLastUpdated(new Date());
457 384 inventoryDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
458 385 inventoryDetail.setReceiptCode("");
459 386 inventoryDetail.setReceiptDetailId(0);
460   - inventoryDetail.setLocationNoX(adjustDetail.getLocationNoX());
461   - inventoryDetail.setLocationNoY(adjustDetail.getLocationNoY());
462   - inventoryDetail.setTracingNo(adjustDetail.getTracingNo());
463   -// inventoryDetail.setOrderCode(adju);
464   -// inventoryDetail.setShipmentReferCode("0");
465   - inventoryDetailService.saveOrUpdate(inventoryDetail);
466   -
  387 + boolean success = inventoryDetailService.save(inventoryDetail);
  388 + if (!success) {
  389 + throw new ServiceException("调整新增库存失败,更新库存明细失败");
  390 + }
467 391 // 库存头表 总数和行数 +1
468 392 InventoryHeader inventoryHeaderEdit = new InventoryHeader();
469 393 inventoryHeaderEdit.setId(inventoryHeader.getId());
470 394 inventoryHeaderEdit.setTotalLines(inventoryHeader.getTotalLines() + 1);
471 395 inventoryHeaderEdit.setTotalQty(inventoryHeader.getTotalQty().add(BigDecimal.ONE));
472   -// inventoryHeaderEdit.setTotalWeight();
473   - inventoryHeaderService.updateById(inventoryHeaderEdit);
  396 + success = inventoryHeaderService.updateById(inventoryHeaderEdit);
  397 + if (!success) {
  398 + throw new ServiceException("调整新增库存失败,更新库存头表失败");
  399 + }
474 400 //写入库存交易
475 401 //调整入
476 402 InventoryTransaction inventoryTransaction = new InventoryTransaction();
477   - inventoryTransaction.setWarehouseCode(inventoryDetail.getWarehouseCode());
478   - inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode());
479   - inventoryTransaction.setLocationCode(inventoryDetail.getLocationCode());
480   - inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode());
  403 + BeanUtils.copyBeanProp(inventoryTransaction, inventoryDetail);
481 404 inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_ADJUSTINTO);
482   - inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode());
483   - inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName());
484   - inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec());
485   - inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit());
486 405 inventoryTransaction.setTaskQty(adjustDetail.getToQty());
487   - inventoryTransaction.setInventorySts(inventoryDetail.getInventorySts());//状态
488   - inventoryTransaction.setReferCode(inventoryDetail.getReferCode());
489   - inventoryTransaction.setReferDetailId(inventoryDetail.getReferDetailId());
490   - inventoryTransaction.setBatch(inventoryDetail.getBatch());
491   - inventoryTransaction.setLot(inventoryDetail.getLot());
492   - inventoryTransaction.setProjectNo(inventoryDetail.getProjectNo());
493   - inventoryTransaction.setQcCheck(inventoryDetail.getQcCheck());
494   - inventoryTransaction.setWeight(inventoryDetail.getWeight());
495   - inventoryTransaction.setManufactureDate(inventoryDetail.getManufactureDate());
496   - inventoryTransaction.setExpirationDate(inventoryDetail.getExpirationDate());
497 406 inventoryTransaction.setAgingDate(inventoryDetail.getCreated());
498   - inventoryTransaction.setAttributeId(inventoryDetail.getAttributeId());
499   - inventoryTransaction.setAttribute1(inventoryDetail.getAttribute1());
500   - inventoryTransaction.setAttribute2(inventoryDetail.getAttribute2());
501   - inventoryTransaction.setAttribute3(inventoryDetail.getAttribute3());
502 407 inventoryTransaction.setCreated(new Date());
503 408 inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName());
504 409 inventoryTransaction.setBillDetailId(inventoryDetail.getReceiptDetailId());
505   - inventoryTransaction.setSupplierCode(inventoryDetail.getSupplierCode());
506   - inventoryTransaction.setLocationNoX(inventoryDetail.getLocationNoX());
507   - inventoryTransaction.setLocationNoY(inventoryDetail.getLocationNoY());
508   - inventoryTransaction.setTracingNo(inventoryDetail.getTracingNo());
509   - inventoryTransactionService.saveOrUpdate(inventoryTransaction);
  410 + success = inventoryTransactionService.save(inventoryTransaction);
  411 + if (!success) {
  412 + throw new ServiceException("调整新增库存失败,新增交易记录失败");
  413 + }
510 414 }
511 415 }
... ...
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java
... ... @@ -206,17 +206,14 @@ public class CycleCountDetailController extends BaseController {
206 206 return AjaxResult.success("删除成功!");
207 207 }
208 208  
209   - /**
210   - * 盘点任务完成
211   - */
212   - @RequiresPermissions("inventory:cyclecountDetail:createTask")
  209 +
213 210 @PostMapping("/completeCycleCountTask")
214 211 @ResponseBody
215   - public AjaxResult completeCycleCountTask(Integer cycleCoutdetailId) {
216   - if (cycleCoutdetailId == null) {
  212 + public AjaxResult completeCycleCountTask(Integer cycleCountDetailId) {
  213 + if (cycleCountDetailId == null) {
217 214 return AjaxResult.error("盘点任务完成时明细ID不能为空!");
218 215 }
219   - return cycleCountDetailService.completeCycleCountTask(cycleCoutdetailId);
  216 + return cycleCountDetailService.completeCycleCountTask(cycleCountDetailId);
220 217 }
221 218  
222 219 /**
... ...
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailService.java
... ... @@ -32,7 +32,7 @@ public interface CycleCountDetailService extends IService&lt;CycleCountDetail&gt; {
32 32  
33 33 AjaxResult removeDetail(Integer detailId);
34 34  
35   - AjaxResult completeCycleCountTask(Integer cycleCoutdetailId);
  35 + AjaxResult completeCycleCountTask(Integer cycleCountDetailId);
36 36  
37 37 CycleCountDetail getcode(Integer id);
38 38  
... ...
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java
... ... @@ -598,24 +598,23 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
598 598 * 盘点明细界面盘点完成
599 599 */
600 600 @Override
601   - public AjaxResult completeCycleCountTask(Integer cycleCoutdetailId) {
602   - CycleCountDetail cycleCountDetail = this.getById(cycleCoutdetailId);
  601 + public AjaxResult completeCycleCountTask(Integer cycleCountDetailId) {
  602 + CycleCountDetail cycleCountDetail = this.getById(cycleCountDetailId);
603 603 if (StringUtils.isNull(cycleCountDetail)) {
604   - return AjaxResult.error("明细错误无法完成任务!");
  604 + return AjaxResult.error("盘点明细为空,无法完成任务");
605 605 }
606 606 if (cycleCountDetail.getEnableStatus() >= QuantityConstant.CYCLECOUNT_STATUS_COMPLETED) {
607   - return AjaxResult.error("盘点任务已完成,请勿重复完成");
  607 + return AjaxResult.error("盘点任务已完成,请勿重复完成");
608 608 }
609 609 //必须有实盘登记后的状态
610 610 if (cycleCountDetail.getEnableStatus() < QuantityConstant.CYCLECOUNT_STATUS_REGISTERED) {
611   - return AjaxResult.error("任务完成时必须有实盘登记过程");
  611 + return AjaxResult.error("任务完成时必须有实盘登记过程");
612 612 }
613 613 TaskHeader taskHeader = taskHeaderService.getById(cycleCountDetail.getTaskHeaderId());
614 614 if (StringUtils.isNull(taskHeader)) {
615   - return AjaxResult.error("没有找到对应的盘点任务");
  615 + return AjaxResult.error("没有找到对应的盘点任务");
616 616 }
617   - AjaxResult ajaxResult = cycleCountTaskService.completeCycleCountTask(taskHeader);
618   - return ajaxResult;
  617 + return cycleCountTaskService.completeCycleCountTask(taskHeader);
619 618 }
620 619  
621 620 @Override
... ...
src/main/java/com/huaheng/pc/inventory/cycleCountHeader/controller/CycleCountHeaderController.java
... ... @@ -176,7 +176,6 @@ public class CycleCountHeaderController extends BaseController {
176 176 /**
177 177 * 生成调整单
178 178 */
179   - //@RequiresPermissions("inventory:cyclecountHead:addAdjust")
180 179 @Log(title = "库存-盘点", operating = "新增盘点差异调整单", action = BusinessType.INSERT)
181 180 @PostMapping("/goAdjust")
182 181 @ResponseBody
... ... @@ -188,23 +187,6 @@ public class CycleCountHeaderController extends BaseController {
188 187 }
189 188  
190 189 /**
191   - *
192   - * 生成差异单
193   - * */
194   -/* @RequiresPermissions("inventory:cyclecountHead:addDifference")
195   - @Log(title = "库存-盘点", operating = "新增盘点差异单", action = BusinessType.INSERT)
196   - @PostMapping("/goDifference")
197   - @ResponseBody
198   - public AjaxResult goDifference(Integer differenceHeaderId)
199   - {
200   - if( null == differenceHeaderId || differenceHeaderId < 0){
201   - return AjaxResult.error("盘点头ID数据错误!");
202   - }
203   - return cycleCountHeaderService.insertByDifference(differenceHeaderId);
204   - }*/
205   -
206   -
207   - /**
208 190 * 盘点单报表打印
209 191 *
210 192 * @return
... ... @@ -224,6 +206,4 @@ public class CycleCountHeaderController extends BaseController {
224 206  
225 207 return prefix + "/report";
226 208 }
227   -
228   -
229   -}
  209 +}
230 210 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderService.java
... ... @@ -16,7 +16,12 @@ public interface CycleCountHeaderService extends IService&lt;CycleCountHeader&gt; {
16 16 void updateHeaderStatus(String cycleCountHeaderCode);
17 17  
18 18 String createCode();
19   - //生成调整单
  19 +
  20 + /**
  21 + * 生成调整单
  22 + * @param headId 盘点单头表id
  23 + * @return 操作结果
  24 + */
20 25 AjaxResult insertByAdjust(Integer headId);
21 26  
22 27 AjaxResult delete(Integer id);
... ...
src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java
... ... @@ -127,7 +127,6 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl&lt;CycleCountHeaderMap
127 127 */
128 128 @Override
129 129 public AjaxResult delete(Integer id) {
130   -
131 130 CycleCountHeader cyclecountHeader = this.getById(id);
132 131 if (cyclecountHeader == null) {
133 132 return AjaxResult.error("id为" + id.toString() + "的盘点单不存在出,操作中止");
... ... @@ -157,9 +156,9 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl&lt;CycleCountHeaderMap
157 156 @Transactional(rollbackFor = Exception.class)
158 157 public AjaxResult insertByAdjust(Integer id) {
159 158  
160   - //获取盘点主单ID生成差异调整单,根据主单ID获取明细条目,再根据明细条目差异数量是否为0生成差异调整详单
161   - // 1 根据盘点单ID生成差异调整主单,
162   - // 2 下一步根据盘点主单ID查询盘点明细的条目数据,
  159 + // 获取盘点主单id生成差异调整单,根据盘点主单id获取明细条目,再根据明细条目差异数量是否为0生成差异调整详情
  160 + // 1 根据盘点单id生成差异调整主单,
  161 + // 2 下一步根据盘点主单id查询盘点明细的条目数据,
163 162 // 3 for循环明细条目,同时依据差异数据是否为0来决定是否生成差异单,同步写入调整单详细。
164 163  
165 164 //查询该条盘点单头 id
... ... @@ -178,7 +177,7 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl&lt;CycleCountHeaderMap
178 177 //先创建调整单头
179 178 boolean success = adjustHeaderService.save(adjustHeader);
180 179 if (!success) {
181   - throw new ServiceException("新增盘点调整单失败,创建调整单失败 ");
  180 + throw new ServiceException("新增盘点调整单失败,创建调整单失败");
182 181 }
183 182 //根据盘点子单查询明细并写入调整单
184 183 LambdaQueryWrapper<CycleCountDetailChild> childLambdaQueryWrapper = Wrappers.lambdaQuery();
... ...
src/main/java/com/huaheng/pc/task/taskHeader/service/CycleCountTaskServiceImpl.java
... ... @@ -32,7 +32,6 @@ import java.math.BigDecimal;
32 32 import java.util.ArrayList;
33 33 import java.util.Date;
34 34 import java.util.List;
35   -import java.util.concurrent.CopyOnWriteArrayList;
36 35  
37 36 /**
38 37 * 盘点服务层
... ... @@ -64,15 +63,14 @@ public class CycleCountTaskServiceImpl implements CycleCountTaskService {
64 63 public AjaxResult createCycleCountTaskByDetailId(Integer cycleCountDetailId) {
65 64 CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(cycleCountDetailId);
66 65 if (StringUtils.isNull(cycleCountDetail)) {
67   - return AjaxResult.error(StringUtils.format("生成盘点任务失败,根据盘点明细id:{} 该条明细", cycleCountDetailId));
  66 + return AjaxResult.error(StringUtils.format("生成盘点任务失败,根据盘点明细id:{} 未找到该条明细", cycleCountDetailId));
68 67 }
69 68 //查出明细的子明细
70   - CycleCountDetailChild child = new CycleCountDetailChild();
71   - child.setCycleCountHeadCode(cycleCountDetail.getCycleCountHeadCode());
72   - child.setCycleCountDetailId(cycleCountDetail.getId());
73   - LambdaQueryWrapper<CycleCountDetailChild> childLambdaQueryWrapper = Wrappers.lambdaQuery(child);
74   - List<CycleCountDetailChild> childList = cycleCountDetailChildService.list(childLambdaQueryWrapper);
75   - if (childList.isEmpty()) {
  69 + LambdaQueryWrapper<CycleCountDetailChild> childQueryWrapper = Wrappers.lambdaQuery();
  70 + childQueryWrapper.eq(CycleCountDetailChild::getCycleCountHeadCode, cycleCountDetail.getCycleCountHeadCode())
  71 + .eq(CycleCountDetailChild::getCycleCountDetailId, cycleCountDetail.getId());
  72 + List<CycleCountDetailChild> cycleCountDetailChildList = cycleCountDetailChildService.list(childQueryWrapper);
  73 + if (cycleCountDetailChildList.isEmpty()) {
76 74 return AjaxResult.error("生成盘点任务失败,盘点明细没有子明细");
77 75 }
78 76 Location location = locationService.getLocationByCode(
... ... @@ -97,7 +95,7 @@ public class CycleCountTaskServiceImpl implements CycleCountTaskService {
97 95  
98 96 Vehicle vehicle = vehicleService.getVehicleByCode(cycleCountDetail.getVehicleCode());
99 97 if (vehicle == null) {
100   - throw new ServiceException(StringUtils.format("生成盘点任务失败,根据盛具编码 {} 未找到盛具", cycleCountDetail.getVehicleCode()));
  98 + throw new ServiceException(StringUtils.format("生成盘点任务失败,根据盛具编码{} 未找到盛具", cycleCountDetail.getVehicleCode()));
101 99 }
102 100 taskHeader.setVehicleCode(vehicle.getCode());
103 101 taskHeader.setVehicleType(vehicle.getVehicleType());
... ... @@ -111,7 +109,7 @@ public class CycleCountTaskServiceImpl implements CycleCountTaskService {
111 109  
112 110 //写入任务细表
113 111 TaskDetail taskDetail = new TaskDetail();
114   - for (CycleCountDetailChild item : childList) {
  112 + for (CycleCountDetailChild cycleCountDetailChild: cycleCountDetailChildList) {
115 113 taskDetail.setTaskId(taskHeader.getId());
116 114 taskDetail.setTaskType(taskHeader.getTaskType());
117 115 taskDetail.setFromLocation(taskHeader.getFromLocation());
... ... @@ -120,29 +118,29 @@ public class CycleCountTaskServiceImpl implements CycleCountTaskService {
120 118 taskDetail.setVehicleCode(taskHeader.getVehicleCode());
121 119 taskDetail.setInternalTaskType(taskHeader.getTaskType());
122 120 taskDetail.setWarehouseCode(taskHeader.getWarehouseCode());
123   - taskDetail.setBillCode(item.getCycleCountHeadCode());
124   - taskDetail.setBillDetailId(item.getCycleCountDetailId());
125   - taskDetail.setMaterialCode(item.getMaterialCode());
126   - taskDetail.setMaterialName(item.getMaterialName());
127   - taskDetail.setMaterialSpec(item.getMaterialSpec());
128   - taskDetail.setMaterialUnit(item.getMaterialUnit());
129   - taskDetail.setWeight(item.getWeight());
130   - taskDetail.setSupplierCode(item.getSupplierCode());
131   - taskDetail.setSupplierTracingNo(item.getSupplierTracingNo());
132   - taskDetail.setInventorySts(item.getInventorySts());
133   - taskDetail.setBatch(item.getBatch());
134   - taskDetail.setTracingNo(item.getTracingNo());
135   - taskDetail.setLocationNoX(item.getLocationNoX());
136   - taskDetail.setLocationNoY(item.getLocationNoY());
137   - taskDetail.setIsMaterial(QuantityConstant.INVENTORY_STATUS_OK.equals(item.getInventorySts()));
138   - taskDetail.setQty(item.getSystemQty());
  121 + taskDetail.setBillCode(cycleCountDetailChild.getCycleCountHeadCode());
  122 + taskDetail.setBillDetailId(cycleCountDetailChild.getCycleCountDetailId());
  123 + taskDetail.setMaterialCode(cycleCountDetailChild.getMaterialCode());
  124 + taskDetail.setMaterialName(cycleCountDetailChild.getMaterialName());
  125 + taskDetail.setMaterialSpec(cycleCountDetailChild.getMaterialSpec());
  126 + taskDetail.setMaterialUnit(cycleCountDetailChild.getMaterialUnit());
  127 + taskDetail.setWeight(cycleCountDetailChild.getWeight());
  128 + taskDetail.setSupplierCode(cycleCountDetailChild.getSupplierCode());
  129 + taskDetail.setSupplierTracingNo(cycleCountDetailChild.getSupplierTracingNo());
  130 + taskDetail.setInventorySts(cycleCountDetailChild.getInventorySts());
  131 + taskDetail.setBatch(cycleCountDetailChild.getBatch());
  132 + taskDetail.setTracingNo(cycleCountDetailChild.getTracingNo());
  133 + taskDetail.setLocationNoX(cycleCountDetailChild.getLocationNoX());
  134 + taskDetail.setLocationNoY(cycleCountDetailChild.getLocationNoY());
  135 + taskDetail.setIsMaterial(QuantityConstant.INVENTORY_STATUS_OK.equals(cycleCountDetailChild.getInventorySts()));
  136 + taskDetail.setQty(cycleCountDetailChild.getSystemQty());
139 137 taskDetail.setCompanyCode(cycleCountDetail.getCompanyCode());
140 138 if (!taskDetailService.save(taskDetail)) {
141 139 throw new ServiceException("生成盘点任务失败,新增盘点任务明细失败");
142 140 }
143 141 // 修改子单状态
144   - item.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK);
145   - if (!cycleCountDetailChildService.updateById(item)) {
  142 + cycleCountDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK);
  143 + if (!cycleCountDetailChildService.updateById(cycleCountDetailChild)) {
146 144 throw new ServiceException("生成盘点任务失败,更新盘点明细子表失败");
147 145 }
148 146 }
... ... @@ -179,25 +177,21 @@ public class CycleCountTaskServiceImpl implements CycleCountTaskService {
179 177 public AjaxResult completeCycleCountTask(TaskHeader taskHeader) {
180 178 // 盘点完成,传入任务主单,查出任务明细,通过任务明细查找盘点的明细单,完成任务同时,修改盘点细单和主单的状态,完成后库存锁复位
181 179 // task更新明细单状态
182   - TaskDetail taskDetail = new TaskDetail();
183   - taskDetail.setWarehouseCode(taskHeader.getWarehouseCode());
184   - taskDetail.setTaskType(taskHeader.getTaskType());
185   - taskDetail.setTaskId(taskHeader.getId());
186   - LambdaQueryWrapper<TaskDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(taskDetail);
187   - List<TaskDetail> taskDetailList = taskDetailService.list(lambdaQueryWrapper);
  180 + LambdaQueryWrapper<TaskDetail> taskDetailQueryWrapper = Wrappers.lambdaQuery();
  181 + taskDetailQueryWrapper.eq(TaskDetail::getTaskType, taskHeader.getTaskType())
  182 + .eq(TaskDetail::getTaskId, taskHeader.getId());
  183 + List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailQueryWrapper);
188 184 //盘点明细
189 185 CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(taskHeader.getAllocationHeadId());
190 186 if (cycleCountDetail == null) {
191 187 throw new ServiceException(StringUtils.format("完成盘点任务失败,根据任务未找到盘点明细 任务id:{}", taskHeader.getId()));
192 188 }
193   - List<TaskDetail> list = new CopyOnWriteArrayList<>();
194   - List<CycleCountDetailChild> cycChildList = new ArrayList<>();
  189 + List<CycleCountDetailChild> updateChildList = new ArrayList<>();
195 190 boolean difference = false;
196 191 String warehouseCode = taskHeader.getWarehouseCode();
197 192 //修改任务明细状态的同时查找到盘点明细的条目并修改状态,最后修改主单状态
198   - for (TaskDetail item : taskDetailList) {
199   - item.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
200   - list.add(item);
  193 + for (TaskDetail taskDetail : taskDetailList) {
  194 + taskDetail.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
201 195 //盘点子单状态
202 196 LambdaQueryWrapper<CycleCountDetailChild> childQueryWrapper = Wrappers.lambdaQuery();
203 197 childQueryWrapper.eq(CycleCountDetailChild::getCycleCountHeadCode, cycleCountDetail.getCycleCountHeadCode())
... ... @@ -206,14 +200,16 @@ public class CycleCountTaskServiceImpl implements CycleCountTaskService {
206 200 if (!childList.isEmpty()) {
207 201 for (CycleCountDetailChild child : childList) {
208 202 //判断是否差异状态
  203 + CycleCountDetailChild cycleCountDetailChild = new CycleCountDetailChild();
  204 + cycleCountDetailChild.setId(cycleCountDetailChild.getId());
209 205 if (child.getGapQty().compareTo(BigDecimal.ZERO) != 0) {
210 206 difference = true;
211 207 //有差异
212   - child.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_DIFFERENCE);
  208 + cycleCountDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_DIFFERENCE);
213 209 } else {
214   - child.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED);
  210 + cycleCountDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED);
215 211 }
216   - cycChildList.add(child);
  212 + updateChildList.add(cycleCountDetailChild);
217 213 }
218 214 }
219 215 //取消库存盘点锁
... ... @@ -223,7 +219,10 @@ public class CycleCountTaskServiceImpl implements CycleCountTaskService {
223 219 }
224 220 inventoryHeader.setLocking(1);
225 221 inventoryHeader.setLockRemark("");
226   - inventoryHeaderService.updateById(inventoryHeader);
  222 + boolean success = inventoryHeaderService.updateById(inventoryHeader);
  223 + if (!success) {
  224 + throw new ServiceException("完成盘点任务失败,更新库存头表失败");
  225 + }
227 226 //库存明细最后盘点时间
228 227 LambdaQueryWrapper<InventoryDetail> inventoryDetail = Wrappers.lambdaQuery();
229 228 inventoryDetail.eq(InventoryDetail::getWarehouseCode, inventoryHeader.getWarehouseCode())
... ... @@ -233,7 +232,10 @@ public class CycleCountTaskServiceImpl implements CycleCountTaskService {
233 232 throw new ServiceException("完成盘点任务失败,盘点的库存明细错误");
234 233 }
235 234 inventoryDetailList.forEach(i -> i.setLastCycleCountDate(new Date()));
236   - inventoryDetailService.updateBatchById(inventoryDetailList);
  235 + success = inventoryDetailService.updateBatchById(inventoryDetailList);
  236 + if (!success) {
  237 + throw new ServiceException("完成盘点任务失败,更新库存明细表失败");
  238 + }
237 239 }
238 240 // 修改任务主单状态
239 241 TaskHeader updateHeader = new TaskHeader();
... ... @@ -241,14 +243,12 @@ public class CycleCountTaskServiceImpl implements CycleCountTaskService {
241 243 updateHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
242 244 if (!taskHeaderService.updateById(updateHeader)) {
243 245 throw new ServiceException("完成盘点任务失败,盘点单据更新失败");
244   -
245 246 }
246   - if (!taskDetailService.saveBatch(list)) {
  247 + if (!taskDetailService.updateBatchById(taskDetailList)) {
247 248 throw new ServiceException("盘点任务完成失败,盘点单明细状态更新失败");
248 249 }
249   - if (!cycleCountDetailChildService.saveBatch(cycChildList)) {
  250 + if (!cycleCountDetailChildService.updateBatchById(updateChildList)) {
250 251 throw new ServiceException("盘点任务完成失败,盘点单子明细更新失败");
251   -
252 252 }
253 253  
254 254 //盘点明细状态
... ... @@ -260,13 +260,18 @@ public class CycleCountTaskServiceImpl implements CycleCountTaskService {
260 260 }
261 261 cycleCountDetail.setCompletedBy(taskHeader.getCreatedBy());
262 262 cycleCountDetail.setCompletedAt(new Date());
263   - cycleCountDetailService.updateById(cycleCountDetail);
  263 + boolean success = cycleCountDetailService.updateById(cycleCountDetail);
  264 + if (!success) {
  265 + throw new ServiceException("盘点任务完成失败,更新盘点明细盘点人和盘点时间失败");
  266 + }
264 267 //更新主单状态
265 268 cycleCountHeaderService.updateHeaderStatus(cycleCountDetail.getCycleCountHeadCode());
266 269 //释放库位
267   - locationService.updateStatus(cycleCountDetail.getLocationCode(),
  270 + success = locationService.updateStatus(cycleCountDetail.getLocationCode(),
268 271 QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
269   -
  272 + if (!success) {
  273 + throw new ServiceException("盘点任务完成失败,释放库位失败");
  274 + }
270 275 return AjaxResult.success("完成盘点任务成功!");
271 276 }
272 277 }
... ...
src/main/resources/templates/inventory/cycleCountDetail/add.html
... ... @@ -64,16 +64,15 @@
64 64 <div th:include="include::footer"></div>
65 65 <th:block th:include="include :: select2-js"/>
66 66 <script th:inline="javascript">
67   - var addFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:add')}]];
68   - var prefixDetail = ctx + "inventory/inventoryDetail";
69   - var prefix_cycleDetails = ctx + "inventory/cycleCountDetail";
70   - var prefix = ctx + "inventory/inventoryHeader";
71   - var report = [[${@permission.hasPermi('inventoryHeader:adjustHeader:report')}]];
72   - var datas = [[${@dict.getType('sys_normal_disable')}]];
73   - var inventoryStatus = [[${@dict.getType('inventorySts')}]];
74   - var supplier = [[${@SupplierService.getCode()}]];
  67 + let addFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:add')}]];
  68 + let prefixDetail = ctx + "inventory/inventoryDetail";
  69 + let prefix_cycleDetails = ctx + "inventory/cycleCountDetail";
  70 + let prefix = ctx + "inventory/inventoryHeader";
  71 + let report = [[${@permission.hasPermi('inventoryHeader:adjustHeader:report')}]];
  72 + let inventoryStatus = [[${@dict.getType('inventorySts')}]];
  73 + let supplier = [[${@SupplierService.getCode()}]];
75 74 $(function () {
76   - var options = {
  75 + let options = {
77 76 url: prefix + "/cycleCountInventoryHeader",
78 77 createUrl: prefix + "/add",
79 78 updateUrl: prefix + "/edit/{id}",
... ... @@ -225,19 +224,12 @@
225 224 title: 'y',
226 225 },
227 226 {
228   - field: 'batch',
229   - title: '批次',
230   - visible: true
231   - },
232   - {
233 227 field: 'tracingNo',
234 228 title: '追溯码',
235 229 },
236 230 {
237 231 field: 'receiptCode',
238 232 title: '入库单编码',
239   - visible: true,
240   - width: 150
241 233 },
242 234 /*{
243 235 field: 'companyCode',
... ... @@ -246,8 +238,7 @@
246 238 },*/
247 239 {
248 240 field: 'receiptDetailId',
249   - title: '入库单明细id',
250   - visible: false
  241 + title: '入库单明细id'
251 242 },
252 243 {
253 244 field: 'supplierCode',
... ... @@ -269,48 +260,40 @@
269 260 align: 'center',
270 261 formatter: function (value, row, index) {
271 262 return $.table.selectDictLabel(inventoryStatus, value);
272   - },
273   - visible: false
  263 + }
274 264 },
275 265 {
276 266 field: 'weight',
277   - title: '重量',
278   - visible: false
  267 + title: '药量(克)'
279 268 },
280 269 {
281 270 field: 'created',
282 271 title: '入库日期',
283   - visible: true,
284   - width: 150
285 272 },
286 273 {
287 274 field: 'createdBy',
288   - title: '创建用户',
289   - visible: true,
290   - width: 120
  275 + title: '创建用户'
291 276 },
292 277 {
293 278 field: 'lastUpdated',
294   - title: '最后修改时间',
295   - visible: false
  279 + title: '最后修改时间'
296 280 },
297 281 {
298 282 field: 'lastUpdatedBy',
299   - title: '更新用户',
300   - visible: false
  283 + title: '更新用户'
301 284 },
302 285 ]
303 286 });
304 287 };
305 288  
306 289 function addDetails() {
307   - var rows = $("#bootstrap-table").bootstrapTable('getSelections');
  290 + let rows = $("#bootstrap-table").bootstrapTable('getSelections');
308 291 if (rows.length < 1) {
309 292 $.modal.alertWarning("请选择库存明细!");
310 293 return;
311 294 }
312 295 $.modal.loading("正在处理,请稍后...");
313   - var ids = [];
  296 + let ids = [];
314 297 rows.forEach(function (item) {
315 298 ids.push(item.id);
316 299 });
... ...
src/main/resources/templates/inventory/cycleCountDetail/chooseStation.html
... ... @@ -80,7 +80,6 @@
80 80 }
81 81 })
82 82 })
83   -
84 83 </script>
85 84 </body>
86 85 </html>
87 86 \ No newline at end of file
... ...
src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html
... ... @@ -90,19 +90,19 @@
90 90 </div>
91 91 <div th:include="include :: footer"></div>
92 92 <script th:inline="javascript">
93   - var addChildFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:addChildFlag')}]];
94   - var removeFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:remove')}]];
95   - var confirmFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:confirm')}]];
96   - var createTaskFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:createTask')}]];
97   - var prefix = ctx + "inventory/cycleCountDetail";
98   - var prefix_head = ctx + "inventory/cycleCountHeader";
99   - var remove_url = prefix + "/remove";
100   - var cyclecountStatus = [[${@dict.getType('cyclecountStatus')}]];
101   - var inventoryStatus = [[${@dict.getType('inventorySts')}]];
102   - var warehouse = [[${@WarehouseService.getWarehouse()}]];
  93 + let addChildFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:addChildFlag')}]];
  94 + let removeFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:remove')}]];
  95 + let confirmFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:confirm')}]];
  96 + let createTaskFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:createTask')}]];
  97 + let prefix = ctx + "inventory/cycleCountDetail";
  98 + let prefix_head = ctx + "inventory/cycleCountHeader";
  99 + let remove_url = prefix + "/remove";
  100 + let cyclecountStatus = [[${@dict.getType('cyclecountStatus')}]];
  101 + let inventoryStatus = [[${@dict.getType('inventorySts')}]];
  102 + let warehouse = [[${@WarehouseService.getWarehouse()}]];
103 103  
104 104 $(function () {
105   - var options = {
  105 + let options = {
106 106 url: prefix + "/list",
107 107 createUrl: prefix + "/add",
108 108 updateUrl: prefix + "/edit/{id}",
... ... @@ -219,7 +219,7 @@
219 219 if (row.enableStatus === 5 || row.enableStatus === 10 || row.enableStatus === 15) {
220 220 actions.push(`<a class="btn btn-success btn-xs ${confirmFlag}" href="#"
221 221 onclick="confirmGapQty(${row.id}, '${row.containerCode}')">
222   - <i class="fa fa-comment"></i>实盘登记</a>`);
  222 + <i class="fa fa-comment"></i>实盘登记</a> `);
223 223 }
224 224 if (row.enableStatus >= 15 && row.enableStatus < 100) {
225 225 actions.push('<a class="btn btn-warning btn-xs ' + createTaskFlag + '" href="#" onclick="completeCycleCoutTask(\'' + row.id + '\')"><i class="fa fa-gbp"></i>完成盘点任务</a> ');
... ... @@ -349,7 +349,7 @@
349 349 title: '操作',
350 350 align: 'center',
351 351 formatter: function (value, row, index) {
352   - var actions = [];
  352 + let actions = [];
353 353 if (row.childStatus > 1 && row.childStatus < 100) {
354 354 actions.push('<a class="btn btn-success btn-xs ' + confirmFlag + '" href="#" ' +
355 355 'onclick="confirmGapQty(row.id)">' +
... ... @@ -362,7 +362,7 @@
362 362 title: '操作(是否有料)',
363 363 align: 'center',
364 364 formatter: function (value, row, index) {
365   - var actions = [];
  365 + let actions = [];
366 366 if (row.childStatus > 1 && row.childStatus < 100) {
367 367 actions.push('<input type="checkbox" name="BBB" text="选中" checked>');
368 368 }
... ... @@ -374,7 +374,7 @@
374 374 };
375 375  
376 376 function add() {
377   - var cycleCountHeadCode = $('#cycleCountHeadCode').val();
  377 + let cycleCountHeadCode = $('#cycleCountHeadCode').val();
378 378 if (cycleCountHeadCode != null && cycleCountHeadCode !== "" && cycleCountHeadCode !== undefined) {
379 379 $.modal.openFull("添加盘点明细", prefix + "/add?cycleCountHeadCode=" + cycleCountHeadCode);
380 380 } else {
... ... @@ -384,8 +384,8 @@
384 384  
385 385 function remove(id) {
386 386 $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function () {
387   - var url = $.common.isEmpty(id) ? remove_url : remove_url.replace("{id}", id);
388   - var data = {"ids": id};
  387 + let url = $.common.isEmpty(id) ? remove_url : remove_url.replace("{id}", id);
  388 + let data = {"ids": id};
389 389 $.ajax({
390 390 url: url,
391 391 type: "post",
... ... @@ -437,19 +437,19 @@
437 437  
438 438 /* 批量删除主表 */
439 439 function batRemove() {
440   - var rows = $("#bootstrap-table").bootstrapTable('getSelections');
  440 + let rows = $("#bootstrap-table").bootstrapTable('getSelections');
441 441 if (rows.length === 0) {
442 442 $.modal.alertWarning("请至少选择一条记录");
443 443 return;
444 444 }
445 445 $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function () {
446 446 $.modal.loading("正在处理,请稍后...");
447   - var url = remove_url;
448   - var ids = "";
449   - for (var i = 0; i < rows.length; i++) {
  447 + let url = remove_url;
  448 + let ids = "";
  449 + for (let i = 0; i < rows.length; i++) {
450 450 ids = ids + rows[i].id + ","
451 451 }
452   - var data = {"ids": ids.substring(0, ids.length - 1)};
  452 + let data = {"ids": ids.substring(0, ids.length - 1)};
453 453 $.ajax({
454 454 url: url,
455 455 type: "post",
... ... @@ -497,8 +497,8 @@
497 497 */
498 498 function createCyclecountWithGapQty() {
499 499 $.modal.confirm("确认进行差异复盘么?该操作会将有差异的明细重新生成一个新的盘点单。", function () {
500   - var url = prefix + "/createCyclecountWithGapQty";
501   - var data = {"cycleCountHeadCode": $('#cycleCountHeadCode').val()};
  500 + let url = prefix + "/createCyclecountWithGapQty";
  501 + let data = {"cycleCountHeadCode": $('#cycleCountHeadCode').val()};
502 502 postInner(url, data);
503 503 });
504 504 }
... ... @@ -506,16 +506,16 @@
506 506 //生成所有盘点任务
507 507 function outcheckAll() {
508 508 $.modal.confirm("确认进行盘点任务生成么?注意,这将会使未生成盘点任务的明细生成盘点任务!", function () {
509   - var url = prefix + "/createCycleCountTaskByHeadId";
510   - var data = {"cycleCountHeadCode": $('#cycleCountHeadCode').val()};
  509 + let url = prefix + "/createCycleCountTaskByHeadId";
  510 + let data = {"cycleCountHeadCode": $('#cycleCountHeadCode').val()};
511 511 postInner(url, data);
512 512 });
513 513 }
514 514  
515 515 //完成盘点任务
516 516 function completeCycleCoutTask(id) {
517   - var url = prefix + "/completeCycleCountTask";
518   - var data = {"cycleCoutdetailId": id};
  517 + let url = prefix + "/completeCycleCountTask";
  518 + let data = {"cycleCountDetailId": id};
519 519 postInner(url, data);
520 520 }
521 521  
... ...
src/main/resources/templates/inventory/cycleCountDetail/registration.html
... ... @@ -25,13 +25,13 @@
25 25 <div th:include="include::footer"></div>
26 26 <th:block th:include="include :: select2-js"/>
27 27 <script th:inline="javascript">
28   - var addFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:add')}]];
29   - var cyclecountStatus = [[${@dict.getType('cyclecountStatus')}]];
30   - var prefix = ctx + "inventory/cycleCountDetail";
31   - var inventoryStatus = [[${@dict.getType('inventorySts')}]];
  28 + let addFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:add')}]];
  29 + let cyclecountStatus = [[${@dict.getType('cyclecountStatus')}]];
  30 + let prefix = ctx + "inventory/cycleCountDetail";
  31 + let inventoryStatus = [[${@dict.getType('inventorySts')}]];
32 32  
33 33 $(function () {
34   - var options = {
  34 + let options = {
35 35 url: prefix + "/cycleCountDetailChild",
36 36 queryParams: {
37 37 cycleCountDetailId: $('#cycleCountDetailId').val(),
... ... @@ -49,21 +49,18 @@
49 49 showToggle: false,
50 50 showColumns: false,
51 51 columns: [
52   - {
  52 + /*{
53 53 field: 'locationCode',
54   - title: '库位编号',
55   - visible: false,
  54 + title: '库位编号'
56 55 },
57 56 {
58 57 field: 'containerCode',
59   - title: '载具编码',
60   - visible: false,
  58 + title: '载具编码'
61 59 },
62 60 {
63 61 field: 'vehicleCode',
64   - title: '盛具编码',
65   - visible: false,
66   - },
  62 + title: '盛具编码'
  63 + },*/
67 64 {
68 65 field: 'materialCode',
69 66 title: '物料编码',
... ... @@ -89,10 +86,6 @@
89 86 title: 'Y'
90 87 },
91 88 {
92   - field: 'batch',
93   - title: '批次'
94   - },
95   - {
96 89 field: 'tracingNo',
97 90 title: '追溯码'
98 91 },
... ... @@ -113,32 +106,26 @@
113 106 },
114 107 {
115 108 title: '差异数',
116   - field: 'gapQty',
117   - visible: true
  109 + field: 'gapQty'
118 110 },
119 111 {
120 112 field: 'countedBy',
121   - title: '实盘登记人',
122   - visible: true
  113 + title: '实盘登记人'
123 114 },
124 115 {
125 116 field: 'childStatus',
126 117 title: '子单状态',
127   - visible: true,
128 118 formatter: function (value, row, index) {
129 119 return $.table.selectDictLabel(cyclecountStatus, value);
130 120 },
131 121 },
132 122 {
133 123 field: 'created',
134   - title: '创建时间',
135   - visible: false,
136   -
  124 + title: '创建时间'
137 125 },
138 126 {
139 127 field: 'createdBy',
140   - title: '创建人',
141   - visible: false,
  128 + title: '创建人'
142 129 },
143 130 {
144 131 title: '确认是否有料',
... ... @@ -178,8 +165,6 @@
178 165 function addChildDetails() {
179 166 $.modal.open("添加库存盘点子明细", prefix + "/addCountDetailChild?cycleCountDetailId=" + $("#cycleCountDetailId").val(), 1100, 200);
180 167 }
181   -
182   -
183 168 </script>
184 169 </body>
185 170 </html>
186 171 \ No newline at end of file
... ...
src/main/resources/templates/inventory/cycleCountHeader/cycleCountHeader.html
... ... @@ -45,7 +45,7 @@
45 45 <li>
46 46 <label>盘点单状态:</label>
47 47 <select name="statusCyc"
48   - th:with="lastStatus=${@dict.getType('cyclecountStatus')}">
  48 + th:with="lastStatus=${@dict.getType('cycleCountStatus')}">
49 49 <option value="">所有</option>
50 50 <option th:each="e : ${lastStatus}" th:text="${e['dictLabel']}"
51 51 th:value="${e['dictValue']}">
... ... @@ -95,15 +95,14 @@
95 95 </div>
96 96 <div th:include="include :: footer"></div>
97 97 <script th:inline="javascript">
98   - var removeFlag = [[${@permission.hasPermi('inventory:cycleCount:remove')}]];
99   - var prefix = ctx + "inventory/cycleCountHeader";
100   - var sysNormalDisable = [[${@dict.getType('sys_normal_disable')}]];
101   - var types = [[${@dict.getType('cyclecountType')}]];
102   - var preference = [[${@cycleCountPreferenceService.selectCycleCountPreferenceList()}]];
103   - var cyclecountStatus = [[${@dict.getType('cyclecountStatus')}]];
104   - console.log(cyclecountStatus)
  98 + let removeFlag = [[${@permission.hasPermi('inventory:cycleCount:remove')}]];
  99 + let prefix = ctx + "inventory/cycleCountHeader";
  100 + let sysNormalDisable = [[${@dict.getType('sys_normal_disable')}]];
  101 + let types = [[${@dict.getType('cycleCountType')}]];
  102 + let preference = [[${@cycleCountPreferenceService.selectCycleCountPreferenceList()}]];
  103 + let cycleCountStatus = [[${@dict.getType('cycleCountStatus')}]];
105 104 $(function () {
106   - var options = {
  105 + let options = {
107 106 url: prefix + "/list",
108 107 createUrl: prefix + "/add",
109 108 updateUrl: prefix + "/edit/{id}",
... ... @@ -163,7 +162,7 @@
163 162 field: 'statusCyc',
164 163 title: '盘点单状态',
165 164 formatter: function (value, row, index) {
166   - return $.table.selectDictLabel(cyclecountStatus, value);
  165 + return $.table.selectDictLabel(cycleCountStatus, value);
167 166 }
168 167 },
169 168 {
... ... @@ -210,7 +209,7 @@
210 209 title: '操作',
211 210 align: 'center',
212 211 formatter: function (value, row, index) {
213   - var actions = [];
  212 + let actions = [];
214 213 //actions.push('<a class="btn btn-success btn-xs ' + reportFlag + '" href="#" onclick="cyclecountPrint(\'' + row.id + '\')"><i class="fa fa-print"></i>打印</a> ');
215 214 if (row.statusCyc === 105) {
216 215 actions.push('<a class="btn btn-warning btn-xs " href="#" onclick="goDifference(\'' + row.id + '\')"><i class="fa fa-plus"></i>生成调整单</a> ');
... ... @@ -236,8 +235,8 @@
236 235 }
237 236 $("#tabDetail").children().remove();
238 237 $("#myTab li").removeClass("active");
239   - var height = $(document).height() - 100 + 'px';
240   - var str = '<iframe class="huaheng_iframe" name="iframe" width="100%" height="' + height + '" src="' + url + '" frameborder="0" data-id="' + url + '" seamless></iframe>';
  238 + let height = $(document).height() - 100 + 'px';
  239 + let str = '<iframe class="huaheng_iframe" name="iframe" width="100%" height="' + height + '" src="' + url + '" frameborder="0" data-id="' + url + '" seamless></iframe>';
241 240 $("#tabDetail").empty();
242 241 $("#tabDetail").append(str);
243 242 $(".tab-pane").removeClass("in active");
... ... @@ -247,14 +246,14 @@
247 246  
248 247 //盘点单打印
249 248 function cyclecountPrint(id) {
250   - var url = prefix + "/report/" + id;
  249 + let url = prefix + "/report/" + id;
251 250 $.modal.open("盘点单打印", url);
252 251 }
253 252  
254 253 //生成差异调整单
255 254 function goDifference(id) {
256   - var url = prefix + "/goAdjust";
257   - var data = {"id": id};
  255 + let url = prefix + "/goAdjust";
  256 + let data = {"id": id};
258 257 postInner(url, data);
259 258 }
260 259  
... ...