Commit 97effe71d022e805c0838c17d575e06c32a104c9

Authored by 李泰瑜
1 parent f6986465

优化盘点 明细子表内添加字段记录任务子表 任务增加实盘调整

ant-design-vue-jeecg/src/views/system/stocktaking/modules/AdjustmentDocModal.vue
... ... @@ -33,6 +33,7 @@ export default {
33 33 components: {},
34 34 props: {
35 35 id: "",
  36 + taskHeaderId:"",
36 37 },
37 38 data() {
38 39 return {
... ... @@ -42,6 +43,7 @@ export default {
42 43 model: {
43 44 id:this.id,
44 45 countedQty:'',
  46 + state:this.taskHeaderId,
45 47 },
46 48 labelCol: {
47 49 xs: {span: 24},
... ...
ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue
... ... @@ -69,6 +69,9 @@
69 69 </template>
70 70  
71 71 <span slot="action" slot-scope="text, record">
  72 + <adjustment-doc-modal ref="adjustmentModal" @ok="modalFormOk" :id="record.id" :taskHeaderId="record.taskHeaderId"/>
  73 + <a @click="createMany(record)">实盘登记</a>
  74 + <a-divider type="vertical"/>
72 75 <a v-has="'taskDetail:edit'" @click="handleEdit(record)">编辑</a>
73 76 <a-divider type="vertical"/>
74 77 <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
... ... @@ -87,11 +90,12 @@
87 90  
88 91 import {JeecgListMixin} from '@/mixins/JeecgListMixin'
89 92 import TaskDetailModal from './modules/TaskDetailModal'
  93 +import AdjustmentDocModal from "../stocktaking/modules/AdjustmentDocModal";
90 94  
91 95 export default {
92 96 name: "TaskDetailList",
93 97 mixins: [JeecgListMixin],
94   - components: {TaskDetailModal},
  98 + components: {TaskDetailModal,AdjustmentDocModal},
95 99 props: {
96 100 mainId: {
97 101 type: String,
... ... @@ -219,7 +223,11 @@ export default {
219 223 this.dataSource = []
220 224 this.selectedRowKeys = []
221 225 this.ipagination.current = 1
222   - }
  226 + },
  227 + createMany() {
  228 + this.$refs.adjustmentModal.edit();
  229 + this.$refs.adjustmentModal.title = "实盘登记";
  230 + },
223 231  
224 232 }
225 233 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java
... ... @@ -285,7 +285,8 @@ public class CycleCountDetailController extends HuahengBaseController {
285 285 public Result confirmGapQty(@RequestBody Map<String,String> map){
286 286 String id = map.get("id");
287 287 String countedQty = map.get("countedQty");
288   - return cycleCountDetailChildService.confirmGapQty(id,countedQty);
  288 + String state = map.get("state");
  289 + return cycleCountDetailChildService.confirmGapQty(id,countedQty,state);
289 290 }
290 291  
291 292 /**
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java
... ... @@ -43,10 +43,6 @@ public class CycleCountDetail implements Serializable {
43 43 @Excel(name = "任务表头", width = 15)
44 44 @ApiModelProperty(value = "任务表头")
45 45 private Integer taskHeaderId;
46   - /**任务明细头*/
47   - @Excel(name = "任务明细头", width = 15)
48   - @ApiModelProperty(value = "任务明细头")
49   - private Integer taskDetailId;
50 46 /**仓库*/
51 47 @Excel(name = "仓库", width = 15)
52 48 @ApiModelProperty(value = "仓库")
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetailChild.java
... ... @@ -68,6 +68,10 @@ public class CycleCountDetailChild implements Serializable {
68 68 @Excel(name = "物料单位", width = 15)
69 69 @ApiModelProperty(value = "物料单位")
70 70 private String materialUnit;
  71 + /**任务明细头*/
  72 + @Excel(name = "任务明细头", width = 15)
  73 + @ApiModelProperty(value = "任务明细头")
  74 + private Integer taskDetailId;
71 75 /**系统数量*/
72 76 @Excel(name = "系统数量", width = 15)
73 77 @ApiModelProperty(value = "系统数量")
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java
... ... @@ -14,5 +14,5 @@ import java.util.List;
14 14 public interface ICycleCountDetailChildService extends IService<CycleCountDetailChild> {
15 15  
16 16  
17   - Result confirmGapQty(String id, String countedQty);
  17 + Result confirmGapQty(String id, String countedQty,String state);
18 18 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java
... ... @@ -42,22 +42,35 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl&lt;CycleCountDeta
42 42  
43 43  
44 44 @Override
45   - public Result confirmGapQty(String id, String countedQty) {
  45 + public Result confirmGapQty(String id, String countedQty,String state) {
46 46 //接收子单ID和实盘数量
47 47 //任务未完成可多次登记。
  48 + CycleCountDetailChild detailChild=new CycleCountDetailChild();
  49 + if (StringUtils.isNotEmpty(state))
  50 + {
  51 + LambdaQueryWrapper<CycleCountDetailChild> queryWrapper = new LambdaQueryWrapper<>();
  52 + queryWrapper.eq(CycleCountDetailChild::getTaskDetailId,id);
  53 + detailChild = this.getOne(queryWrapper);
  54 + }else
  55 + {
  56 + //明细子单据
  57 + detailChild = this.getById(Integer.valueOf(id));
  58 + }
  59 +
  60 + if(StringUtils.isNull(detailChild)){
  61 + return Result.error("明细子单不存在!");
  62 + }
  63 +
  64 +
48 65 BigDecimal qty=new BigDecimal(countedQty);
49 66 if(qty.compareTo(BigDecimal.ZERO) == -1){
50 67 return Result.error("实盘登记数不能小于0");
51 68 }
52   - //明细子单据
53   - CycleCountDetailChild countDetailChild = this.getById(Integer.valueOf(id));
54   - if(StringUtils.isNull(countDetailChild)){
55   - return Result.error("明细子单不存在!");
56   - }
57 69  
58 70  
59 71  
60   - CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(countDetailChild.getCycleCountDetailid());
  72 +
  73 + CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(detailChild.getCycleCountDetailid());
61 74 if(StringUtils.isNull(cycleCountDetail)){
62 75 return Result.error("盘点明细不存在。");
63 76 }
... ... @@ -66,17 +79,17 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl&lt;CycleCountDeta
66 79 // return AjaxResult.error("盘点任务未执行不能登记数量!");
67 80 // }
68 81  
69   - if(countDetailChild.getChildStatus() >= QuantityConstant.CYCLECOUNT_STATUS_COMPLETED){
  82 + if(detailChild.getChildStatus() >= QuantityConstant.CYCLECOUNT_STATUS_COMPLETED){
70 83 return Result.error("盘点任务完成后不能再登记数量!");
71 84 }
72 85  
73 86  
74 87 //实盘登记后差异数量
75   - BigDecimal adjQty = qty.subtract(countDetailChild.getSystemQty());
76   - countDetailChild.setGapQty(adjQty);
77   - countDetailChild.setCountedQty(qty);
78   - countDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED);
79   - this.updateById(countDetailChild);
  88 + BigDecimal adjQty = qty.subtract(detailChild.getSystemQty());
  89 + detailChild.setGapQty(adjQty);
  90 + detailChild.setCountedQty(qty);
  91 + detailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED);
  92 + this.updateById(detailChild);
80 93  
81 94  
82 95  
... ... @@ -103,7 +116,7 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl&lt;CycleCountDeta
103 116 LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
104 117 //修改主单状态
105 118 CycleCountHeader tmp = new CycleCountHeader();
106   - tmp.setCode(countDetailChild.getCyclecountheadcode());
  119 + tmp.setCode(detailChild.getCyclecountheadcode());
107 120 tmp.setWarehouseCode(cycleCountDetail.getWarehouseCode());
108 121 LambdaQueryWrapper<CycleCountHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(tmp);
109 122 CycleCountHeader cycleCountHeader = cycleCountHeaderService.getOne(lambdaQueryWrapper);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
... ... @@ -284,6 +284,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
284 284 }
285 285 // 修改子单状态
286 286 item.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK);
  287 + item.setTaskDetailId(taskDetail.getId());
287 288 cycleCountDetailChildServiceImpl.updateById(item);
288 289 }
289 290  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... ... @@ -1563,6 +1563,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1563 1563  
1564 1564 for (CycleCountDetailChild child : children)
1565 1565 {
  1566 + if (!child.getChildStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED))
  1567 + {
  1568 + throw new ServiceException("当前任务里面还有没有进行登记的数据,不能完成让我");
  1569 + }
1566 1570 InventoryDetail inventoryDetail = inventoryDetailService.getById(child.getInventoryDetaiId());
1567 1571 if (inventoryDetail==null)
1568 1572 {
... ...