Commit 00e623a96272f6859d74ef17207d845079077c27

Authored by 李泰瑜
1 parent b6ccee18

盘点优化第三层窗口刷新,第三层调整库存窗口 后端添加

Showing 16 changed files with 466 additions and 177 deletions
ant-design-vue-jeecg/src/api/api.js
... ... @@ -155,8 +155,12 @@ export const createCheckOutTask = (params) => postAction('/task/taskHeader/creat
155 155 export const selectPort = (params) => postAction('/task/taskHeader/selectPort', params);
156 156 //创建跨站任务
157 157 export const createOverStationTask = (params) => postAction('/task/taskHeader/createOverStationTask', params);
  158 +//盘点任务创建
  159 +export const stockTakeTask = (params,headerId,code) => postAction('/cycleCountDetail/cycleCountDetail/stockTakeTask?ids='+params+'&headerId='+headerId+'&code='+code, code);
158 160 //盘点任务生成
159   -export const stockTakeTask = (params) => postAction('/cycleCountDetail/cycleCountDetail/stockTakeTask?ids='+params, params);
  161 +export const createCycleCoutTaskByDetailId = (params) => postAction('/cycleCountDetail/cycleCountDetail/createCycleCoutTaskByDetailId?cycleId='+params, params);
  162 +//盘点确定实盘数量
  163 +export const confirmGapQty = (params) => postAction('/cycleCountDetail/cycleCountDetail/confirmGapQty', params);
160 164 //创建空托盘组入库任务
161 165 export const createManyEmptyIn = (params) => postAction('/task/taskHeader/createManyEmptyIn', params);
162 166 //创建空托盘组出库任务
... ...
ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizComponentModal.vue
... ... @@ -68,6 +68,7 @@ import {pushIfNotExist} from '@/utils/util'
68 68 import JSelectBizQueryItem from './JSelectBizQueryItem'
69 69 import {cloneDeep} from 'lodash'
70 70 import {stockTakeTask} from "../../../api/api";
  71 +import Utils from './util.js';
71 72  
72 73 export default {
73 74 name: 'JSelectBizComponentModal',
... ... @@ -133,6 +134,8 @@ export default {
133 134 type: Array,
134 135 default: () => []
135 136 },
  137 + testConfig: "",
  138 + headerCode:"",
136 139 rowKey: {
137 140 type: String,
138 141 default: 'id'
... ... @@ -321,31 +324,26 @@ export default {
321 324 /** 完成选择 */
322 325 handleOk() {
323 326 let value = this.selectedTable.dataSource.map(data => data[this.valueKey])
324   - // this.$emit('input', value)
325   -
326 327 if (value.length>=1)
327 328 {
328   - stockTakeTask(value).then((res) => {
  329 + stockTakeTask(value,this.testConfig,this.headerCode).then((res) => {
329 330 if (res.success) {
330   - that.$message.success(res.message);
331   - that.$emit('ok');
332   - that.model.containerCode = '';
333   - that.model.toPortCode = '';
334   - that.close();
  331 + this.$message.success(res.message)
  332 + this.$emit('ok')
  333 + this.close()
  334 + Utils.$emit('methodB',"123");
335 335 } else {
336   - that.$message.warning(res.message);
  336 + this.$message.warning(res.message);
337 337 }
338 338 }).finally(() => {
339   - that.confirmLoading = false;
340   - that.close();
  339 + this.confirmLoading = false;
  340 + this.close()
341 341 })
342 342 }else
343 343 {
344 344 alert("至少选择一项")
345 345 }
346   -
347   - //
348   - // this.close()
  346 + Utils.$emit('methodB',"123");
349 347 },
350 348 /** 删除已选择的 */
351 349 handleDeleteSelected(record, index) {
... ...
ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/index.vue
1 1 <template>
2 2 <a class="j-select-biz-component-box" type="flex" :gutter="8">
3   - <a-button type="primary" icon="plus" :disabled="disabled" @click="visible=true">{{ selectButtonText }}
4   - </a-button>
  3 + <a :disabled="disabled" @click="visible=true">{{ selectButtonText }}
  4 + </a>
5 5 <j-select-biz-component-modal
6 6 v-model="selectValue"
7 7 :visible.sync="visible"
... ...
ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/util.js 0 → 100644
  1 +import Vue from 'vue'
  2 +export default new Vue
0 3 \ No newline at end of file
... ...
ant-design-vue-jeecg/src/components/jeecgbiz/JSelectMultiCycleCount.vue
... ... @@ -20,6 +20,8 @@ export default {
20 20 components: {JDate, JSelectBizComponent},
21 21 props: {
22 22 value: null, // any type
  23 + testConfig: "",
  24 + headerCode:"",
23 25 queryConfig: {
24 26 type: Array,
25 27 default: () => []
... ... @@ -59,7 +61,9 @@ export default {
59 61 computed: {
60 62 attrs() {
61 63 return Object.assign(this.default, this.$attrs, {
62   - queryConfig: this.queryConfigDefault.concat(this.queryConfig)
  64 + queryConfig: this.queryConfigDefault.concat(this.queryConfig),
  65 + testConfig : this.testConfig,
  66 + headerCode : this.headerCode,
63 67 })
64 68 }
65 69 }
... ...
ant-design-vue-jeecg/src/mixins/JeecgListMixin.js
... ... @@ -99,6 +99,29 @@ export const JeecgListMixin = {
99 99 this.loading = false
100 100 })
101 101 },
  102 + loadDataList() {
  103 + if (!this.url.list) {
  104 + this.$message.error("请设置url.list属性!")
  105 + return
  106 + }
  107 + var params = this.getQueryParams();//查询条件
  108 + getAction(this.url.list, params).then((res) => {
  109 + if (res.success) {
  110 + //update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
  111 + this.dataSource = res.result.records || res.result;
  112 + if (res.result.total) {
  113 + this.ipagination.total = res.result.total;
  114 + } else {
  115 + this.ipagination.total = 0;
  116 + }
  117 + //update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
  118 + } else {
  119 + this.$message.warning(res.message)
  120 + }
  121 + }).finally(() => {
  122 + })
  123 + },
  124 +
102 125 initDictConfig() {
103 126 console.log("--这是一个假的方法!")
104 127 },
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue
... ... @@ -12,7 +12,6 @@
12 12  
13 13 <!-- 操作按钮区域 begin -->
14 14 <div class="table-operator">
15   - <j-select-multi-cycle-count :query-config="selectUserQueryConfig"/>
16 15 <a-button type="primary" icon="download" @click="handleExportXls('盘点明细表')">导出</a-button>
17 16 <!-- 高级查询区域 -->
18 17  
... ... @@ -76,7 +75,9 @@
76 75 </template>
77 76  
78 77 <template slot="action" slot-scope="text, record">
79   - <a @click="handleEdit(record)">生成盘点任务</a>
  78 + <a v-if="record.enableStatus === 1" @click="generateCount(record.id)">生成盘点任务</a>
  79 + <a-divider v-if="record.enableStatus === 1" type="vertical"/>
  80 + <a @click="loadData()"><a-icon type="sync"/>刷新</a>
80 81 <a-divider type="vertical"/>
81 82 <a-popconfirm title="确定删除吗?" @confirm="handleDelete(record.id)">
82 83 <a>删除</a>
... ... @@ -100,30 +101,36 @@
100 101 import CycleCountDetailModal from './modules/CycleCountDetailModal'
101 102 import CycleCountDetailChildSubTable from './subTables/CycleCountDetailChildSubTable'
102 103 import '@/assets/less/TableExpand.less'
  104 + import {createCycleCoutTaskByDetailId, stockTakeTask} from "../../../api/api";
  105 + import Utils from "../../../components/jeecgbiz/JButtonBizComponent/util.js"
103 106  
104 107 export default {
105 108 name: 'CycleCountDetailList',
  109 + cycleCountDetailId:'',
106 110 mixins: [JeecgListMixin],
107 111 components: {
108 112 CycleCountDetailModal,
109 113 CycleCountDetailChildSubTable,
110 114 },
  115 + props: {
  116 + isLoad: {
  117 + type: Boolean,
  118 + default: false,
  119 + }
  120 + },
111 121 data() {
112 122 return {
113   - // 选择用户查询条件配置
114   - selectUserQueryConfig: [
115   - {key: 'locationCode', label: '库位'},
116   - ],
  123 +
117 124 description: '盘点明细表列表管理页面',
118 125 // 表头
119 126 columns: [
120   - {
121   - title: 'ID',
122   - key: 'rowIndex',
123   - width: 60,
124   - align: 'center',
125   - customRender: (t, r, index) => parseInt(index) + 1
126   - },
  127 + // {
  128 + // title: 'ID',
  129 + // key: 'rowIndex',
  130 + // width: 60,
  131 + // align: 'center',
  132 + // customRender: (t, r, index) => parseInt(index) + 1
  133 + // },
127 134 // {
128 135 // title: '盘点主单id',
129 136 // align: 'center',
... ... @@ -229,20 +236,58 @@
229 236 importExcelUrl: '/cycleCountDetail/cycleCountDetail/importExcel',
230 237 },
231 238 superFieldList:[],
  239 +
232 240 }
233 241 },
234 242 created() {
235 243 this.getSuperFieldList();
236 244 },
  245 + mounted() {
  246 + let _this = this;
  247 + Utils.$on('methodB',(data)=> {
  248 + _this.methodB(data);
  249 + })
  250 + // var _this = this;
  251 + // setInterval(function () {
  252 + // if(_this.isLoad) {
  253 + // _this.loadDataList();
  254 + // }
  255 + // },1000)
  256 + },
237 257 computed: {
238 258 importExcelUrl() {
239 259 return window._CONFIG['domianURL'] + this.url.importExcelUrl
240 260 }
241 261 },
242 262 methods: {
  263 + // testaa(){
  264 + // alert("刷新了")
  265 + // var _this = this;
  266 + // _this.loadDataList();
  267 + // },
  268 + methodB(data) {
  269 + var _this = this;
  270 + _this.loadDataList();
  271 + },
243 272 initDictConfig() {
244 273 },
  274 + generateCount(id){
  275 + createCycleCoutTaskByDetailId(id).then((res) => {
  276 + // alert("请求成功")
  277 + if (res.success) {
  278 + this.$message.success(res.message)
  279 + this.$emit('ok')
  280 + var _this = this;
  281 + _this.loadData();
  282 + } else {
  283 + this.$message.warning(res.message);
  284 + }
  285 + }).finally(() => {
  286 + this.confirmLoading = false;
  287 + this.close()
  288 + })
245 289  
  290 + },
246 291 handleExpand(expanded, record) {
247 292 this.expandedRowKeys = []
248 293 if (expanded === true) {
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountHeaderList.vue
... ... @@ -46,15 +46,19 @@
46 46 :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
47 47 class="j-table-force-nowrap"
48 48 @change="handleTableChange">
  49 +
  50 +
49 51 <!-- 内嵌table区域 begin -->
50 52 <template slot="expandedRowRender" slot-scope="record">
51 53 <a-tabs tabPosition="top">
52   - <a-tab-pane tab="盘点明细" key="cycleCountHetailChild" forceRender>
53   - <cycle-count-detail-list :record="record"/>
  54 + <a-tab-pane tab="盘点明细" key="cycleCountDetailId" forceRender>
  55 + <cycle-count-detail-list :record="record" :isLoad="true"/>
54 56 </a-tab-pane>
55 57 </a-tabs>
56 58 </template>
57 59 <!-- 内嵌table区域 end -->
  60 +
  61 +
58 62 <span slot="companyCode" slot-scope="companyCode">
59 63 <a-tag :key="companyCode" color=blue>
60 64 {{ solutionCompany(companyCode) }}
... ... @@ -87,15 +91,19 @@
87 91 下载
88 92 </a-button>
89 93 </template>
90   -
91 94 <span slot="action" slot-scope="text, record">
92   - <a @click="handleEdit(record)">编辑</a>
93   -
  95 + <j-select-multi-cycle-count :query-config="selectUserQueryConfig" :test-config="record.id" :header-code="record.code"/>
94 96 <a-divider type="vertical" />
95 97 <a-dropdown>
96 98 <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
97 99 <a-menu slot="overlay">
98 100 <a-menu-item>
  101 + <a @click="loadDataaa()"><a-icon type="sync"/>刷新</a>
  102 + </a-menu-item>
  103 + <a-menu-item>
  104 + <a @click="handleEdit(record)">编辑</a>
  105 + </a-menu-item>
  106 + <a-menu-item>
99 107 <a @click="handleDetail(record)">详情</a>
100 108 </a-menu-item>
101 109 <a-menu-item>
... ... @@ -106,11 +114,11 @@
106 114 </a-menu>
107 115 </a-dropdown>
108 116 </span>
109   -
110 117 </a-table>
111 118 </div>
112 119  
113 120 <cycle-count-header-modal ref="modalForm" @ok="modalFormOk"></cycle-count-header-modal>
  121 +
114 122 </a-card>
115 123 </template>
116 124  
... ... @@ -133,6 +141,10 @@
133 141 },
134 142 data () {
135 143 return {
  144 + // 选择用户查询条件配置
  145 + selectUserQueryConfig: [
  146 + {key: 'locationCode', label: '库位'},
  147 + ],
136 148 description: '盘点主表管理页面',
137 149 companyList: [],
138 150 CountTypeList:[],
... ... @@ -281,6 +293,11 @@
281 293 }
282 294 });
283 295 },
  296 +
  297 + loadDataaa(){
  298 + var _this = this;
  299 + _this.testaa();
  300 + },
284 301 solutionCompany(value) {
285 302 var actions = []
286 303 Object.keys(this.companyList).some((key) => {
... ... @@ -303,6 +320,7 @@
303 320 return actions.join('')
304 321 },
305 322  
  323 +
306 324 }
307 325 }
308 326 </script>
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/modules/AdjustmentDocModal.vue 0 → 100644
  1 +<template>
  2 + <j-modal
  3 + :title="title"
  4 + :width="width"
  5 + :visible="visible"
  6 + :confirmLoading="confirmLoading"
  7 + switchFullscreen
  8 + @ok="handleOk"
  9 + @cancel="handleCancel"
  10 + cancelText="关闭">
  11 + <a-spin :spinning="confirmLoading">
  12 + <a-form-model ref="form" :model="model" :rules="validatorRules">
  13 + <a-row>
  14 + <a-col :xs="24">
  15 + <a-form-model-item label="实盘数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="countedQty">
  16 + <a-input v-model="model.countedQty" placeholder="请输入实盘数量"></a-input>
  17 + </a-form-model-item>
  18 + </a-col>
  19 + </a-row>
  20 + </a-form-model>
  21 + </a-spin>
  22 + </j-modal>
  23 +</template>
  24 +
  25 +<script>
  26 +
  27 +import {createManyEmptyIn} from '@/api/api'
  28 +import {confirmGapQty} from "../../../../api/api";
  29 +
  30 +export default {
  31 + name: "AdjustmentDocModal",
  32 + components: {},
  33 + props: {
  34 + id: "",
  35 + },
  36 + data() {
  37 + return {
  38 + title: "操作",
  39 + width: 500,
  40 + visible: false,
  41 + model: {
  42 + id:this.id,
  43 + countedQty:'',
  44 + },
  45 + labelCol: {
  46 + xs: {span: 24},
  47 + sm: {span: 5},
  48 + },
  49 + wrapperCol: {
  50 + xs: {span: 24},
  51 + sm: {span: 16},
  52 + },
  53 +
  54 + confirmLoading: false,
  55 + validatorRules: {
  56 + countedQty: [
  57 + {required: true, message: '请输入实盘数量!'},
  58 + ],
  59 + },
  60 + url: {
  61 + add: "/cycleCountDetail/cycleCountDetail/confirmGapQty",
  62 + }
  63 +
  64 + }
  65 + },
  66 +
  67 +
  68 + created() {
  69 + //备份model原始值
  70 + this.modelDefault = JSON.parse(JSON.stringify(this.model));
  71 + },
  72 +
  73 + methods: {
  74 +
  75 + add() {
  76 + this.edit(this.modelDefault);
  77 + },
  78 + edit() {
  79 + this.visible = true;
  80 + },
  81 + close() {
  82 + this.$emit('close');
  83 + this.visible = false;
  84 + this.$refs.form.clearValidate();
  85 + },
  86 + handleOk() {
  87 + const that = this;
  88 + // 触发表单验证
  89 + this.$refs.form.validate(valid => {
  90 + if (valid) {
  91 + that.confirmLoading = true;
  92 + confirmGapQty(this.model).then((res) => {
  93 + if (res.success) {
  94 + that.$message.success(res.message);
  95 + that.$emit('ok');
  96 + that.model.containerCode = '';
  97 + that.model.toLocationCode = '';
  98 + } else {
  99 + that.$message.warning(res.message);
  100 + }
  101 + }).finally(() => {
  102 + that.confirmLoading = false;
  103 + that.close();
  104 + })
  105 + } else {
  106 + return false
  107 + }
  108 + })
  109 + },
  110 + handleCancel() {
  111 + this.close()
  112 + },
  113 +
  114 +
  115 + }
  116 +}
  117 +</script>
0 118 \ No newline at end of file
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/subTables/CycleCountDetailChildSubTable.vue
1 1 <template>
  2 + <a-card :bordered="false">
2 3 <a-table
3 4 rowKey="id"
4 5 size="middle"
... ... @@ -20,6 +21,11 @@
20 21 </div>
21 22 </template>
22 23  
  24 + <template slot="action" slot-scope="text, record">
  25 + <adjustment-doc-modal ref="adjustmentModal" @ok="modalFormOk" :id="record.id"/>
  26 + <a @click="createMany(record)"><a-icon />实盘登记</a>
  27 + </template>
  28 +
23 29 <template slot="fileSlot" slot-scope="text">
24 30 <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
25 31 <a-button
... ... @@ -33,17 +39,22 @@
33 39 <span>下载</span>
34 40 </a-button>
35 41 </template>
36   -
37 42 </a-table>
  43 + </a-card>
38 44 </template>
39 45  
40 46 <script>
41 47 import { getAction } from '@api/manage'
42 48 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  49 + import AdjustmentDocModal from "../modules/AdjustmentDocModal";
  50 +
43 51  
44 52 export default {
45 53 name: 'CycleCountDetailChildSubTable',
46 54 mixins: [JeecgListMixin],
  55 + components: {
  56 + AdjustmentDocModal,
  57 + },
47 58 props: {
48 59 record: {
49 60 type: Object,
... ... @@ -122,6 +133,13 @@
122 133 align: 'center',
123 134 dataIndex: 'inventoryDetaiId',
124 135 },
  136 + {
  137 + title: '操作',
  138 + dataIndex: 'action',
  139 + align: 'center',
  140 + width:147,
  141 + scopedSlots: { customRender: 'action' },
  142 + },
125 143 ],
126 144 url: {
127 145 listByMainId: '/cycleCountDetail/cycleCountDetail/queryCycleCountDetailChildByMainId',
... ... @@ -153,6 +171,10 @@
153 171 this.loading = false
154 172 })
155 173 },
  174 + createMany() {
  175 + this.$refs.adjustmentModal.edit();
  176 + this.$refs.adjustmentModal.title = "实盘登记";
  177 + },
156 178  
157 179 },
158 180 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java
... ... @@ -2,6 +2,7 @@ package org.jeecg.modules.wms.stocktaking.cycleCountDetail.controller;
2 2  
3 3 import java.io.UnsupportedEncodingException;
4 4 import java.io.IOException;
  5 +import java.math.BigDecimal;
5 6 import java.net.URLDecoder;
6 7 import java.util.ArrayList;
7 8 import java.util.Arrays;
... ... @@ -183,12 +184,12 @@ public class CycleCountDetailController extends HuahengBaseController {
183 184 @AutoLog(value = "生成单条盘点任务")
184 185 @ApiOperation(value="生成单条盘点任务", notes="生成单条盘点任务")
185 186 @PostMapping(value = "/createCycleCoutTaskByDetailId")
186   - public Result createCycleCoutTaskByDetailId(Integer cycleCoutdetailId, HttpServletRequest req){
187   - if(cycleCoutdetailId ==null){
  187 + public Result createCycleCoutTaskByDetailId(@RequestParam(name = "cycleId") Integer cycleId, HttpServletRequest req){
  188 + if(cycleId ==null){
188 189 return Result.error("生成盘点任务时盘点明细ID不能为空!");
189 190 }
190 191 String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req);
191   - return cycleCountDetailService.createCycleCoutTaskByDetailId(cycleCoutdetailId,warehouseCode);
  192 + return cycleCountDetailService.createCycleCoutTaskByDetailId(cycleId,warehouseCode);
192 193 }
193 194  
194 195  
... ... @@ -199,7 +200,7 @@ public class CycleCountDetailController extends HuahengBaseController {
199 200 @AutoLog(value = "盘点添加")
200 201 @ApiOperation(value="盘点添加", notes="盘点添加")
201 202 @PostMapping(value = "/stockTakeTask")
202   - public Result<String> stockTakeTask(@RequestParam(name = "ids", required = true) String ids) {
  203 + public Result<String> stockTakeTask(@RequestParam(name = "ids") String ids,@RequestParam(name = "headerId") int headerId,@RequestParam(name = "code") String code) {
203 204 if (StringUtils.isEmpty(ids)) {
204 205 return Result.error("taskId不能为空");
205 206 }
... ... @@ -209,7 +210,7 @@ public class CycleCountDetailController extends HuahengBaseController {
209 210 result = handleMultiProcess("cancelTask", new HuahengBaseController.MultiProcessListener() {
210 211 @Override
211 212 public Result doProcess() {
212   - Result result = cycleCountDetailService.stockDetailAdd(taskId);
  213 + Result result = cycleCountDetailService.stockDetailAdd(taskId,headerId,code);
213 214 return result;
214 215 }
215 216 });
... ... @@ -218,6 +219,19 @@ public class CycleCountDetailController extends HuahengBaseController {
218 219  
219 220 }
220 221  
  222 +
  223 + /**
  224 + *实盘登记
  225 + * @return
  226 + */
  227 + @PostMapping("/confirmGapQty")
  228 + @ResponseBody
  229 + public Result confirmGapQty(@RequestBody Map<String,String> map){
  230 + String id = map.get("id");
  231 + String countedQty = map.get("countedQty");
  232 + return cycleCountDetailChildService.confirmGapQty(id,countedQty);
  233 + }
  234 +
221 235 /**
222 236 * 通过id查询
223 237 *
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java
... ... @@ -33,7 +33,7 @@ public class CycleCountDetail implements Serializable {
33 33 /**盘点主单id*/
34 34 @Excel(name = "盘点主单id", width = 15)
35 35 @ApiModelProperty(value = "盘点主单id")
36   - private String cycleCountHeadId;
  36 + private Integer cycleCountHeadId;
37 37 /**盘点主单code*/
38 38 @Excel(name = "盘点主单code", width = 15)
39 39 @ApiModelProperty(value = "盘点主单code")
... ... @@ -41,7 +41,7 @@ public class CycleCountDetail implements Serializable {
41 41 /**任务表头*/
42 42 @Excel(name = "任务表头", width = 15)
43 43 @ApiModelProperty(value = "任务表头")
44   - private String taskHeaderId;
  44 + private Integer taskHeaderId;
45 45 /**任务明细头*/
46 46 @Excel(name = "任务明细头", width = 15)
47 47 @ApiModelProperty(value = "任务明细头")
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java
1 1 package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service;
2 2  
  3 +import org.jeecg.common.api.vo.Result;
3 4 import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild;
4 5 import com.baomidou.mybatisplus.extension.service.IService;
5 6 import java.util.List;
... ... @@ -13,4 +14,5 @@ import java.util.List;
13 14 public interface ICycleCountDetailChildService extends IService<CycleCountDetailChild> {
14 15  
15 16  
  17 + Result confirmGapQty(String id, String countedQty);
16 18 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailService.java
... ... @@ -38,7 +38,7 @@ public interface ICycleCountDetailService extends IService&lt;CycleCountDetail&gt; {
38 38 */
39 39 public void delBatchMain (Collection<? extends Serializable> idList);
40 40  
41   - Result stockDetailAdd(int taskId);
  41 + Result stockDetailAdd(int taskId,int headerId,String code);
42 42  
43 43 Result createCycleCoutTaskByDetailId(Integer cycleCoutdetailId,String warehouseCode);
44 44  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java
1 1 package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl;
2 2  
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import org.jeecg.common.api.vo.Result;
  6 +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail;
3 7 import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild;
4 8 import org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper.CycleCountDetailChildMapper;
5 9 import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.ICycleCountDetailChildService;
  10 +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.entity.CycleCountHeader;
  11 +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.impl.CycleCountHeaderServiceImpl;
  12 +import org.jeecg.utils.StringUtils;
  13 +import org.jeecg.utils.constant.QuantityConstant;
6 14 import org.springframework.stereotype.Service;
  15 +
  16 +import java.math.BigDecimal;
7 17 import java.util.List;
8 18 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 19 import org.springframework.beans.factory.annotation.Autowired;
10 20  
  21 +import javax.annotation.Resource;
  22 +
11 23 /**
12 24 * @Description: 盘点容器明细表
13 25 * @Author: jeecg-boot
... ... @@ -19,5 +31,58 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl&lt;CycleCountDeta
19 31  
20 32 @Autowired
21 33 private CycleCountDetailChildMapper cycleCountDetailChildMapper;
  34 + @Resource
  35 + private CycleCountDetailServiceImpl cycleCountDetailService;
  36 + @Resource
  37 + private CycleCountHeaderServiceImpl cycleCountHeaderService;
  38 +
  39 +
  40 +
  41 + @Override
  42 + public Result confirmGapQty(String id, String countedQty) {
  43 + //接收子单ID和实盘数量
  44 + //任务未完成可多次登记。
  45 + int qty=Integer.valueOf(id);
  46 + if(qty < 0){
  47 + return Result.error("实盘登记数不能小于0");
  48 + }
  49 + //明细子单据
  50 + CycleCountDetailChild countDetailChild = this.getById(Integer.valueOf(id));
  51 + if(StringUtils.isNull(countDetailChild)){
  52 + return Result.error("明细子单不存在!");
  53 + }
  54 + CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(countDetailChild.getCycleCountDetailid());
  55 + if(StringUtils.isNull(cycleCountDetail)){
  56 + return Result.error("盘点明细不存在。");
  57 + }
  58 + //任务完成后再实盘登记
  59 + /* if(countDetailChild.getChildStatus() < QuantityConstant.CYCLECOUNT_STATUS_EXECUTING){
  60 + return AjaxResult.error("盘点任务未执行不能登记数量!");
  61 + }*/
  62 +
  63 + if(countDetailChild.getChildStatus() >= QuantityConstant.CYCLECOUNT_STATUS_COMPLETED){
  64 + return Result.error("盘点任务完成后不能再登记数量!");
  65 + }
  66 + //实盘登记后差异数量
  67 + int adjQty = qty-countDetailChild.getSystemQty();
  68 + countDetailChild.setGapQty(adjQty);
  69 + countDetailChild.setCountedQty(qty);
  70 + countDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED);
  71 +// countDetailChild.setCountedBy(ShiroUtils.getLoginName());
  72 + this.updateById(countDetailChild);
  73 + //修改明细单状态
  74 + cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED);
  75 + cycleCountDetailService.updateById(cycleCountDetail);
  76 +
  77 + //修改主单状态
  78 + CycleCountHeader tmp = new CycleCountHeader();
  79 + tmp.setCode(countDetailChild.getCyclecountheadcode());
  80 + tmp.setWarehouseCode(cycleCountDetail.getWarehouseCode());
  81 + LambdaQueryWrapper<CycleCountHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(tmp);
  82 + CycleCountHeader cycleCountHeader = cycleCountHeaderService.getOne(lambdaQueryWrapper);
  83 + cycleCountHeader.setStatusCyc(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED);
  84 +// cycleCountHeaderService.updataHeaderStatus(cycleCountHeader.getCode());
22 85  
  86 + return Result.ok("调整成功");
  87 + }
23 88 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
... ... @@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
28 28  
29 29 import javax.annotation.Resource;
30 30 import java.io.Serializable;
  31 +import java.math.BigDecimal;
31 32 import java.util.Date;
32 33 import java.util.List;
33 34 import java.util.Collection;
... ... @@ -113,12 +114,14 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
113 114 }
114 115  
115 116 @Override
116   - public Result stockDetailAdd(int taskId) {
  117 + public Result stockDetailAdd(int taskId,int headerId,String code) {
117 118 LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
118 119 inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getInventoryHeaderId,taskId);
119 120 List<InventoryDetail> inventoryDetails = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper);
120 121  
121 122 CycleCountDetail cycleCountDetail = new CycleCountDetail();
  123 + cycleCountDetail.setInventoryHeaderId(headerId);
  124 + cycleCountDetail.setCycleCountHeadCode(code);
122 125 cycleCountDetail.setCompanyCode(inventoryDetails.get(0).getCompanyCode());
123 126 cycleCountDetail.setInventoryHeaderId(inventoryDetails.get(0).getInventoryHeaderId());
124 127 cycleCountDetail.setLocationCode(inventoryDetails.get(0).getLocationCode());
... ... @@ -135,6 +138,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
135 138 {
136 139 // cycleCountDetailChild.setCyclecountheadcode();
137 140 cycleCountDetailChild.setCycleCountDetailid(cycleCountDetail.getId());
  141 + cycleCountDetailChild.setCyclecountheadcode(code);
138 142 cycleCountDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILD);
139 143 cycleCountDetailChild.setLocationCode(inventoryDetail.getLocationCode());
140 144 cycleCountDetailChild.setContainerCode(inventoryDetail.getContainerCode());
... ... @@ -149,7 +153,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
149 153 cycleCountDetailChildServiceImpl.save(cycleCountDetailChild);
150 154 }
151 155  
152   - return Result.OK();
  156 + return Result.OK("生成完成");
153 157 }
154 158  
155 159  
... ... @@ -163,139 +167,110 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
163 167 public Result createCycleCoutTaskByDetailId(Integer cycleCoutDetailId,String warehouseCode) {
164 168 /*任务主表中存在库位,在盘点明细中生成任务时,不同的容器生成不同的主任务*/
165 169 //校验有没有相同容器正在执行任务.
166   -// CycleCountDetail cycleCountDetail = this.getById(cycleCoutDetailId);
167   -// if(StringUtils.isNull(cycleCountDetail)){
168   -// return Result.error("盘点明细ID错误,没有该条明细");
169   -// }
170   -// //查出明细的子单
171   -// CycleCountDetailChild child = new CycleCountDetailChild();
172   -// child.setCyclecountheadcode(cycleCountDetail.getCycleCountHeadCode());
173   -// child.setCycleCountDetailid(cycleCountDetail.getId());
174   -// LambdaQueryWrapper<CycleCountDetailChild> childLambdaQueryWrapper = Wrappers.lambdaQuery(child);
175   -// List<CycleCountDetailChild> childList = cycleCountDetailChildServiceImpl.list(childLambdaQueryWrapper);
176   -// if(childList.size() < 1){
177   -// return Result.error("盘点明细没有子单");
178   -// }
179   -// Location location = locationService.getLocationByCode(
180   -// cycleCountDetail.getLocationCode(), warehouseCode);
181   -// /*if(!loc.getStatus().equals(QuantityConstant.STATUS_EMPTY)){
182   -// return AjaxResult.error(cycleCountDetail.getLocationCode() + "库位不在空闲状态,请先完成其他任务,操作失败!");
183   -// }*/
184   -// if(StringUtils.isEmpty(location.getContainerCode())){
185   -// return Result.error(cycleCountDetail.getLocationCode() + "库位中没有容器,操作失败!");
186   -// }
187   -// //生成任务同时锁定库位
188   -// locationService.updateStatus(location.getCode(), QuantityConstant.STATUS_LOCATION_LOCK);
189   -// //每个明细单生成一张主任务,子单就是任务明细。
190   -// TaskHeader task = new TaskHeader();
191   -// task.setWarehouseCode(warehouseCode);
192   -// task.setCompanyCode(cycleCountDetail.getCompanyCode());
193   -// task.setAllocationHeadId(cycleCountDetail.getId());//明细ID写入主任务
194   -// if(location != null) {
195   -// task.setZoneCode(location.getZoneCode());
196   -// }
197   -// task.setReferenceCode(cycleCountDetail.getCycleCountHeadCode()); //写入盘点主单号
198   -// task.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_CYCLECOUNT);
199   -// task.setTaskType(QuantityConstant.TASK_TYPE_CYCLECOUNT);
200   -// task.setContainerCode(cycleCountDetail.getContainerCode());
201   -// task.setStatus(QuantityConstant.TASK_STATUS_BUILD);
202   -// task.setFromLocation(cycleCountDetail.getLocationCode());
203   -// task.setPortGroup("P10");
204   -// task.setBack(1);
205   -// task.setSequenceNumber(1);
206   -// task.setSequence(1);
207   -// task.setShipmentOrder(System.currentTimeMillis());
208   -//
209   -// task.setToLocation(cycleCountDetail.getLocationCode());
210   -// task.setCreated(new Date());
211   -// task.setCreatedBy(ShiroUtils.getLoginName());
212   -// task.setLastUpdatedBy(ShiroUtils.getLoginName());
213   -// task.setLastUpdated(new Date());
214   -// if(taskHeaderService.save(task)){
215   -// //锁定库位状态
216   -// locationService.updateStatus(location.getContainerCode(), QuantityConstant.STATUS_LOCATION_LOCK);
217   -// cycleCountDetail.setTaskHeaderId(task.getId()); //盘点明细修改状态task数据源
218   -// }else{
219   -// throw new ServiceException("盘点任务主表生成失败!");
220   -// }
221   -//
222   -// //写入任务细表
223   -// TaskDetail taskDetail = new TaskDetail();
224   -// for(CycleCountDetailChild item: childList){
225   -//
226   -// taskDetail.setTaskId(task.getId());//主单ID
227   -// taskDetail.setTaskType(task.getTaskType());
228   -// taskDetail.setFromLocation(task.getFromLocation());
229   -// taskDetail.setToLocation(task.getToLocation());
230   -// taskDetail.setContainerCode(task.getContainerCode());
231   -// taskDetail.setInternalTaskType(task.getTaskType());
232   -// taskDetail.setWarehouseCode(task.getWarehouseCode());
233   -// taskDetail.setBillCode(item.getCycleCountHeadCode());
234   -// taskDetail.setBoxCode(item.getBoxCode());
235   -// taskDetail.setBillDetailId(item.getCycleCountDetailId());
236   -// taskDetail.setMaterialCode(item.getMaterialCode());
237   -// taskDetail.setMaterialName(item.getMaterialName());
238   -// taskDetail.setMaterialSpec(item.getMaterialSpec());
239   -// taskDetail.setMaterialUnit(item.getMaterialUnit());
240   -// taskDetail.setQty(item.getSystemQty());
241   -// //taskDetail.setBatch(cycleCountDetail.getBatch());
242   -// //taskDetail.setFromInventoryId(cycleCountDetail.getInventoryDetailId());
243   -// //taskDetail.setLot(cycleCountDetail.getLot());
244   -// //taskDetail.setProjectNo(cycleCountDetail.getProjectNo());
245   -// taskDetail.setCompanyCode(cycleCountDetail.getCompanyCode());
246   -// taskDetail.setCreated(new Date());
247   -// taskDetail.setCreatedBy(ShiroUtils.getLoginName());
248   -// taskDetail.setLastUpdated(new Date());
249   -// taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
250   -// if(taskDetailService.save(taskDetail) == false){
251   -// throw new ServiceException("盘点任务明细生成失败!");
252   -// }
253   -// // 修改子单状态
254   -// item.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK);
255   -// cycleCountDetailChildServiceImpl.updateById(item);
256   -// }
257   -//
258   -// //修改细单状态
259   -// cycleCountDetail.setTaskHeaderId(task.getId()); //盘点明细修改状态task数据源
260   -// cycleCountDetail.setLastUpdated(new Date());
261   -// cycleCountDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
262   -// cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK);
263   -// cycleCountDetail.setTaskHeaderId(task.getId());
264   -// //cycleCountDetail.setTaskDetailId(taskDetail.getId());
265   -// this.updateById(cycleCountDetail);
266   -// //修改主单状态
267   -// CycleCountHeader cycleCountHeader = new CycleCountHeader();
268   -// cycleCountHeader.setCode(cycleCountDetail.getCycleCountHeadCode());
269   -// cycleCountHeader.setWarehouseCode(cycleCountDetail.getWarehouseCode());
270   -// //cycleCountHeader.setCompanyCode(cycleCountDetail.getCompanyCode());
271   -// LambdaQueryWrapper<CycleCountHeader> lamb = Wrappers.lambdaQuery(cycleCountHeader);
272   -// cycleCountHeader = cycleCountHeaderService.getOne(lamb);
273   -// cycleCountHeader.setStatusCyc(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK);
274   -// cycleCountHeaderService.updateById(cycleCountHeader);
275   -//
276   -//
277   -//
278   -// LambdaQueryWrapper<InventoryDetail> lambdaQueryWrapper = Wrappers.lambdaQuery();
279   -// lambdaQueryWrapper.eq(InventoryDetail::getContainerCode,task.getContainerCode());
280   -// List<InventoryDetail> inventoryDetails = inventoryDetailService.list(lambdaQueryWrapper);
281   -//
282   -// for (InventoryDetail inventoryDetail:inventoryDetails)
283   -// {
284   -//
285   -// if (StringUtils.isNotEmpty(inventoryDetail.getChipCode2()))
286   -// {
287   -// if (inventoryDetail.getChipCode2().equals("盘盈片码"))
288   -// {
289   -// inventoryDetail.setChipCode2("");
290   -// inventoryDetailService.updateById(inventoryDetail);
291   -// }
292   -// }
293   -// }
294   -//
  170 + CycleCountDetail cycleCountDetail = this.getById(cycleCoutDetailId);
  171 + if(StringUtils.isNull(cycleCountDetail)){
  172 + return Result.error("盘点明细ID错误,没有该条明细");
  173 + }
  174 + //查出明细的子单
  175 + CycleCountDetailChild child = new CycleCountDetailChild();
  176 + child.setCyclecountheadcode(cycleCountDetail.getCycleCountHeadCode());
  177 + child.setCycleCountDetailid(cycleCountDetail.getId());
  178 + LambdaQueryWrapper<CycleCountDetailChild> childLambdaQueryWrapper = Wrappers.lambdaQuery(child);
  179 + List<CycleCountDetailChild> childList = cycleCountDetailChildServiceImpl.list(childLambdaQueryWrapper);
  180 + if(childList.size() < 1){
  181 + return Result.error("盘点明细没有子单");
  182 + }
  183 + Location location = locationService.getLocationByCode(
  184 + cycleCountDetail.getLocationCode(), warehouseCode);
  185 + /*if(!loc.getStatus().equals(QuantityConstant.STATUS_EMPTY)){
  186 + return AjaxResult.error(cycleCountDetail.getLocationCode() + "库位不在空闲状态,请先完成其他任务,操作失败!");
  187 + }*/
  188 + if(StringUtils.isEmpty(location.getContainerCode())){
  189 + return Result.error(cycleCountDetail.getLocationCode() + "库位中没有容器,操作失败!");
  190 + }
  191 + //生成任务同时锁定库位
  192 + locationService.updateStatus(location.getCode(), QuantityConstant.STATUS_LOCATION_LOCK,warehouseCode);
  193 + //每个明细单生成一张主任务,子单就是任务明细。
  194 + TaskHeader task = new TaskHeader();
  195 + task.setWarehouseCode(warehouseCode);
  196 + task.setCompanyCode(cycleCountDetail.getCompanyCode());
  197 + task.setShipmentContainerHeaderId(cycleCountDetail.getId());//明细ID写入主任务
  198 + if(location != null) {
  199 + task.setZoneCode(location.getZoneCode());
  200 + }
  201 + task.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_CYCLECOUNT);
  202 + task.setTaskType(QuantityConstant.TASK_TYPE_CYCLECOUNT);
  203 + task.setContainerCode(cycleCountDetail.getContainerCode());
  204 + task.setStatus(QuantityConstant.TASK_STATUS_BUILD);
  205 + task.setFromLocationCode(cycleCountDetail.getLocationCode());
  206 + task.setToPortCode("P10");
  207 + task.setSequenceNumber(1);
  208 + task.setSequence(1);
  209 + task.setShipmentOrder(System.currentTimeMillis());
  210 +
  211 + task.setToLocationCode(cycleCountDetail.getLocationCode());
  212 + if(taskHeaderService.save(task)){
  213 + //锁定库位状态
  214 + locationService.updateStatus(location.getContainerCode(), QuantityConstant.STATUS_LOCATION_LOCK,warehouseCode);
  215 + cycleCountDetail.setTaskHeaderId(task.getId()); //盘点明细修改状态task数据源
  216 + }else{
  217 + throw new ServiceException("盘点任务主表生成失败!");
  218 + }
  219 +
  220 + //写入任务细表
  221 + TaskDetail taskDetail = new TaskDetail();
  222 + for(CycleCountDetailChild item: childList){
  223 + //主单ID
  224 + taskDetail.setTaskHeaderId(task.getId());
  225 + taskDetail.setTaskType(task.getTaskType());
  226 +
  227 +
  228 + taskDetail.setTaskType(task.getTaskType());
  229 + taskDetail.setWarehouseCode(task.getWarehouseCode());
  230 + taskDetail.setMaterialCode(item.getMaterialCode());
  231 + taskDetail.setMaterialName(item.getMaterialName());
  232 + taskDetail.setMaterialSpec(item.getMaterialSpec());
  233 + taskDetail.setMaterialUnit(item.getMaterialUnit());
  234 + taskDetail.setQty(new BigDecimal(item.getSystemQty()));
  235 + //taskDetail.setBatch(cycleCountDetail.getBatch());
  236 + //taskDetail.setFromInventoryId(cycleCountDetail.getInventoryDetailId());
  237 + //taskDetail.setLot(cycleCountDetail.getLot());
  238 + //taskDetail.setProjectNo(cycleCountDetail.getProjectNo());
  239 + taskDetail.setCompanyCode(cycleCountDetail.getCompanyCode());
  240 + if(taskDetailService.save(taskDetail) == false){
  241 + throw new ServiceException("盘点任务明细生成失败!");
  242 + }
  243 + // 修改子单状态
  244 + item.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK);
  245 + cycleCountDetailChildServiceImpl.updateById(item);
  246 + }
  247 +
  248 + //修改细单状态
  249 + cycleCountDetail.setTaskHeaderId(task.getId()); //盘点明细修改状态task数据源
  250 + cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK);
  251 + cycleCountDetail.setTaskHeaderId(task.getId());
  252 + //cycleCountDetail.setTaskDetailId(taskDetail.getId());
  253 + this.updateById(cycleCountDetail);
  254 + //修改主单状态
  255 + CycleCountHeader cycleCountHeader = new CycleCountHeader();
  256 + cycleCountHeader.setCode(cycleCountDetail.getCycleCountHeadCode());
  257 + cycleCountHeader.setWarehouseCode(cycleCountDetail.getWarehouseCode());
  258 + //cycleCountHeader.setCompanyCode(cycleCountDetail.getCompanyCode());
  259 + LambdaQueryWrapper<CycleCountHeader> lamb = Wrappers.lambdaQuery(cycleCountHeader);
  260 + cycleCountHeader = cycleCountHeaderService.getOne(lamb);
  261 + cycleCountHeader.setStatusCyc(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK);
  262 + cycleCountHeaderService.updateById(cycleCountHeader);
  263 +
  264 +
  265 +
  266 + LambdaQueryWrapper<InventoryDetail> lambdaQueryWrapper = Wrappers.lambdaQuery();
  267 + lambdaQueryWrapper.eq(InventoryDetail::getContainerCode,task.getContainerCode());
  268 + List<InventoryDetail> inventoryDetails = inventoryDetailService.list(lambdaQueryWrapper);
295 269  
296 270  
297 271  
298 272 return Result.ok("盘点任务生成成功");
299 273 }
300 274  
  275 +
301 276 }
... ...