Commit cb13fb08ffe45419223fce19eccfdb48036a1f59

Authored by 肖超群
1 parent 7018cfc9

完善实盘登记

ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue
... ... @@ -89,7 +89,7 @@
89 89  
90 90 <!-- 表单区域 -->
91 91  
92   - <cycle-count-select-modal ref="modalForm2"></cycle-count-select-modal>
  92 + <cycle-count-select-modal ref="modalForm2" @ok="modalFormOk"/>
93 93 <cycle-count-detail-modal ref="modalForm" @ok="modalFormOk"/>
94 94 <cycle-count-confirm-modal ref="modalForm3" @ok="modalFormOk"/>
95 95  
... ... @@ -262,6 +262,7 @@
262 262 mounted() {
263 263 let _this = this;
264 264 Utils.$on('methodB',(data)=> {
  265 +
265 266 this.methodB(data);
266 267 this.$emit('ok');
267 268 })
... ... @@ -317,6 +318,7 @@
317 318 },
318 319  
319 320 methodB(data) {
  321 + console.log("methodB" + data);
320 322 var _this = this;
321 323 _this.loadDatas(data);
322 324 },
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountHeaderList.vue
... ... @@ -302,6 +302,7 @@ export default {
302 302 },
303 303 detailModalFormOk(){
304 304 this.loadData();
  305 + // this.searchQuery();
305 306 },
306 307 getStatusColor(status) {
307 308 const colors = {
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountConfirmModal.vue
... ... @@ -41,6 +41,7 @@ import { filterMultiDictText } from &#39;@/components/dict/JDictSelectUtil&#39;
41 41 import { validateDuplicateValue } from '@/utils/util'
42 42 import {listCycleDetailChildByDetailId, queryCycleCountDetailChildByMainId, searchMaterialByCode} from '@/api/api'
43 43 import { listReceiveByReceiveId,ajaxGetDictItems } from '@/api/api'
  44 +import Utils from "@comp/jeecgbiz/JButtonBizComponent/util";
44 45  
45 46 export default {
46 47 name: 'CycleCountConfirmModal',
... ... @@ -208,14 +209,15 @@ export default {
208 209 httpAction(httpurl, this.dataSource, method)
209 210 .then(res => {
210 211 if (res.success) {
211   - that.$message.success(res.message)
  212 + that.$message.success("实盘登记成功")
212 213 that.$emit('ok')
213   - that.close()
  214 + Utils.$emit('methodB',res.result);
214 215 } else {
215 216 that.$message.warning(res.message)
216 217 }
217 218 })
218 219 .finally(() => {
  220 + that.close()
219 221 that.confirmLoading = false
220 222 })
221 223 } else {
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailChiIdModal.vue
... ... @@ -79,9 +79,15 @@ export default {
79 79  
80 80 confirmLoading: false,
81 81 validatorRules: {
  82 + materialCode: [
  83 + {required: true, message: '请输入物料信息!'},
  84 + ],
82 85 countedQty: [
83 86 {required: true, message: '请输入实盘数量!'},
84 87 ],
  88 + inventoryStatus: [
  89 + {required: true, message: '请选择库存状态!'},
  90 + ],
85 91 },
86 92 url: {
87 93 add: "/cycleCountDetail/cycleCountDetail/increaseInInventoryGain",
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/subTables/CycleCountDetailChildSubTable.vue
... ... @@ -23,7 +23,7 @@
23 23  
24 24 <template slot="action" slot-scope="text, record">
25 25 <adjustment-doc-modal ref="adjustmentModal" @ok="modalFormOk"/>
26   - <a v-if="record.childStatus != 1 && record.childStatus != 100" @click="createMany(record)"><a-icon />实盘登记</a>
  26 +<!-- <a v-if="record.childStatus != 1 && record.childStatus != 100" @click="createMany(record)"><a-icon />实盘登记</a>-->
27 27 </template>
28 28  
29 29 <template slot="fileSlot" slot-scope="text">
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java
... ... @@ -33,6 +33,8 @@ import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetai
33 33 import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.ICycleCountDetailChildService;
34 34 import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.ICycleCountDetailService;
35 35 import org.jeecg.modules.wms.stocktaking.cycleCountDetail.vo.CycleCountDetailPage;
  36 +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.entity.CycleCountHeader;
  37 +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.ICycleCountHeaderService;
36 38 import org.jeecg.utils.HuahengJwtUtil;
37 39 import org.jeecg.utils.StringUtils;
38 40 import org.jeecg.utils.constant.QuantityConstant;
... ... @@ -85,6 +87,8 @@ public class CycleCountDetailController extends HuahengBaseController {
85 87 private ZoneServiceImpl zoneService;
86 88 @Resource
87 89 private PortServiceImpl portService;
  90 + @Resource
  91 + private ICycleCountHeaderService cycleCountHeaderService;
88 92  
89 93 /**
90 94 * 分页列表查询
... ... @@ -279,22 +283,29 @@ public class CycleCountDetailController extends HuahengBaseController {
279 283 */
280 284 @PostMapping("/batchConfirmGapQty")
281 285 @ResponseBody
282   - public Result batchConfirmGapQty(@RequestBody List<CycleCountDetail> cycleCountDetailList) {
283   - if (CollectionUtils.isEmpty(cycleCountDetailList)) {
  286 + public Result batchConfirmGapQty(@RequestBody List<CycleCountDetailChild> cycleCountDetailChildList) {
  287 + if (CollectionUtils.isEmpty(cycleCountDetailChildList)) {
284 288 return Result.error("批量实盘登记失败参数为空");
285 289 }
286   - for (CycleCountDetail cycleCountDetail : cycleCountDetailList) {
287   - int id = cycleCountDetail.getId();
288   - BigDecimal countedQty = cycleCountDetail.getCountedQty();
  290 + int headerId = 0;
  291 + for (CycleCountDetailChild cycleCountDetailChild : cycleCountDetailChildList) {
  292 + int id = cycleCountDetailChild.getId();
  293 + String cycleCountCode = cycleCountDetailChild.getCyclecountheadcode();
  294 + CycleCountHeader cycleCountHeader = cycleCountHeaderService.getCycleCountHeaderByCode(cycleCountCode);
  295 + headerId = cycleCountHeader.getId();
  296 + BigDecimal countedQty = cycleCountDetailChild.getCountedQty();
289 297 if (countedQty == null) {
290 298 throw new JeecgBootException("批量实盘登记失败参数为空");
291 299 }
  300 + if (cycleCountDetailChild.getChildStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED)) {
  301 + continue;
  302 + }
292 303 Result result = cycleCountDetailChildService.confirmGapQty(String.valueOf(id), String.valueOf(countedQty), null);
293 304 if (!result.isSuccess()) {
294 305 throw new JeecgBootException(result.getMessage());
295 306 }
296 307 }
297   - return Result.ok("批量实盘登记成功");
  308 + return Result.OK(headerId);
298 309 }
299 310  
300 311 /**
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetailChild.java
... ... @@ -36,12 +36,12 @@ public class CycleCountDetailChild implements Serializable {
36 36 @ApiModelProperty(value = "盘点主单code")
37 37 private String cyclecountheadcode;
38 38 /** 盘点明细ID主id */
39   - @ApiModelProperty(value = "盘点明细ID主id")
  39 + @ApiModelProperty(value = "盘点明细ID")
40 40 private Integer cycleCountDetailid;
41 41 /** 盘点明细子单状态 */
42 42 @Excel(name = "盘点明细子单状态", width = 15)
43 43 @ApiModelProperty(value = "盘点明细子单状态")
44   - @Dict(dicCode = "cyclecount_status")
  44 + @Dict(dicCode = "cycleCount_status")
45 45 private Integer childStatus;
46 46 /** 库区类型 */
47 47 @Excel(name = "库区类型", width = 15)
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java
... ... @@ -237,9 +237,9 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl&lt;CycleCountDeta
237 237 if (child.getCountedQty() == null) {
238 238 continue;
239 239 }
240   - if (child.getCountedQty().compareTo(BigDecimal.ZERO) == 0) {
241   - continue;
242   - }
  240 +// if (child.getCountedQty().compareTo(BigDecimal.ZERO) == 0) {
  241 +// continue;
  242 +// }
243 243 String toLocationCode = inventoryHeader.getLocationCode();
244 244 String warehouseCode = cycleCountHeader.getWarehouseCode();
245 245 String companyCode = cycleCountHeader.getCompanyCode();
... ... @@ -430,10 +430,17 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl&lt;CycleCountDeta
430 430 }
431 431 }
432 432  
433   - if (inventoryHeader.getTotalQty().compareTo(BigDecimal.ZERO) < 1) {
434   - success = inventoryHeaderService.removeById(inventoryHeader.getId());
435   - if (!success) {
436   - throw new JeecgBootException("完成盘点任务时, 删除库存头失败");
  433 + List<InventoryDetail> inventoryDetailList =
  434 + inventoryDetailService.getInventoryDetailListByContainerCode(inventoryHeader.getContainerCode(), inventoryHeader.getWarehouseCode());
  435 + if (inventoryDetailList.size() != 0) {
  436 + if (!taskHeaderService.combineInventoryDetail(inventoryHeader.getContainerCode(), inventoryHeader.getWarehouseCode())) {
  437 + throw new JeecgBootException("扣减库存失败, 合并入库库存失败");
  438 + }
  439 + } else {
  440 + if (inventoryHeader != null) {
  441 + if (!inventoryHeaderService.removeById(inventoryHeader.getId())) {
  442 + throw new JeecgBootException("扣减库存失败, 删除库存失败");
  443 + }
437 444 }
438 445 }
439 446  
... ... @@ -455,9 +462,6 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl&lt;CycleCountDeta
455 462  
456 463 // 更新主单状态
457 464 cycleCountHeaderService.updataHeaderStatus(cycleCountDetail.getCycleCountHeadCode());
458   - if (!taskHeaderService.combineInventoryDetail(inventoryHeader.getContainerCode(), inventoryHeader.getWarehouseCode())) {
459   - throw new JeecgBootException("完成盘点任务时, 更新库存失败");
460   - }
461 465 return Result.ok("完成盘点任务成功");
462 466 }
463 467 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
... ... @@ -424,9 +424,8 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
424 424 if (cycleCountDetail == null) {
425 425 return Result.error("盘点明细不存在");
426 426 }
427   -
  427 + String zoneType = cycleCountDetail.getZoneType();
428 428 if (cycleCountDetail.getEnableStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_BUILD)) {
429   - String zoneType = cycleCountDetail.getZoneType();
430 429 if (!zoneType.equals(QuantityConstant.ZONE_TYPE_FLAT)) {
431 430 return Result.error("当前盘点明细是新建状态 不能调整");
432 431 }
... ... @@ -460,6 +459,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
460 459 cycleCountDetailChild.setSystemQty(BigDecimal.ZERO);
461 460 cycleCountDetailChild.setGapQty(countedQty);
462 461 cycleCountDetailChild.setCountedQty(countedQty);
  462 + cycleCountDetailChild.setZoneType(zoneType);
463 463 cycleCountDetailChildServiceImpl.save(cycleCountDetailChild);
464 464  
465 465 Result<Integer> result = new Result<Integer>();
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/service/ICycleCountHeaderService.java
... ... @@ -18,4 +18,6 @@ public interface ICycleCountHeaderService extends IService&lt;CycleCountHeader&gt; {
18 18 void updataHeaderStatus(String cycleCountHeadCode);
19 19  
20 20 Result cancelCycleHeader(String ids);
  21 +
  22 + CycleCountHeader getCycleCountHeaderByCode(String cycleHeaderCode);
21 23 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/service/impl/CycleCountHeaderServiceImpl.java
... ... @@ -126,6 +126,14 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl&lt;CycleCountHeaderMap
126 126 return Result.ok("删除盘点单成功");
127 127 }
128 128  
  129 + @Override
  130 + public CycleCountHeader getCycleCountHeaderByCode(String cycleHeaderCode) {
  131 + LambdaQueryWrapper<CycleCountHeader> cycleCountHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
  132 + cycleCountHeaderLambdaQueryWrapper.eq(CycleCountHeader::getCode, cycleHeaderCode);
  133 + CycleCountHeader cycleCountHeader = getOne(cycleCountHeaderLambdaQueryWrapper);
  134 + return cycleCountHeader;
  135 + }
  136 +
129 137 @Transactional
130 138 public String createCode(String receiptType) {
131 139 String code = null;
... ...