diff --git a/PDA/PDA/components/Card.vue b/PDA/PDA/components/Card.vue index afb814a..6716565 100644 --- a/PDA/PDA/components/Card.vue +++ b/PDA/PDA/components/Card.vue @@ -16,6 +16,10 @@ 数量: {{item.matQty}} + + 盘点数量: + {{item.stocktakingQty}} + 库位: diff --git a/PDA/PDA/components/StocktakingCard.vue b/PDA/PDA/components/StocktakingCard.vue new file mode 100644 index 0000000..41e8fb1 --- /dev/null +++ b/PDA/PDA/components/StocktakingCard.vue @@ -0,0 +1,95 @@ + + + + + \ No newline at end of file diff --git a/PDA/PDA/pages/bind/bind.vue b/PDA/PDA/pages/bind/bind.vue index a765eb0..65f495c 100644 --- a/PDA/PDA/pages/bind/bind.vue +++ b/PDA/PDA/pages/bind/bind.vue @@ -102,7 +102,8 @@ - + + @@ -173,20 +174,20 @@ analysisScanCode: function(encodedString) { // 去除末尾的逗号和"..."(如果有的话) encodedString = encodedString.replace(/,\s*\.\.\.$/, ''); - // 分割字符串并转换为字节数组 - let byteStrings = encodedString.split(','); - let byteArray = []; - for (let byteString of byteStrings) { - byteArray.push(parseInt(byteString, 10)); // 将字符串转换为十进制整数 - } - // 将字节数组转换为UTF-8字符串 - // 注意:这里使用了一个简单的循环来构建字符串,因为String.fromCharCode.apply可能在大数据上性能不佳 - let originalString = ''; - for (let i = 0; i < byteArray.length; i++) { - // 对于每个字节,使用fromCharCode转换为对应的字符 - // 注意:这里假设你的字节数组已经是正确的UTF-8编码,并且不需要额外的处理来组合多字节字符 - originalString += String.fromCharCode(byteArray[i]); - } + // // 分割字符串并转换为字节数组 + // let byteStrings = encodedString.split(','); + // let byteArray = []; + // for (let byteString of byteStrings) { + // byteArray.push(parseInt(byteString, 10)); // 将字符串转换为十进制整数 + // } + // // 将字节数组转换为UTF-8字符串 + // // 注意:这里使用了一个简单的循环来构建字符串,因为String.fromCharCode.apply可能在大数据上性能不佳 + // let originalString = ''; + // for (let i = 0; i < byteArray.length; i++) { + // // 对于每个字节,使用fromCharCode转换为对应的字符 + // // 注意:这里假设你的字节数组已经是正确的UTF-8编码,并且不需要额外的处理来组合多字节字符 + // originalString += String.fromCharCode(byteArray[i]); + // } this.locationCode = encodedString; //调用接口获取当前工位信息 当前工位是否有货架 var serverIPAndPort = getServerIPAndPort(); diff --git a/PDA/PDA/pages/stockTaking/stockTaking.vue b/PDA/PDA/pages/stockTaking/stockTaking.vue index ad63337..16de872 100644 --- a/PDA/PDA/pages/stockTaking/stockTaking.vue +++ b/PDA/PDA/pages/stockTaking/stockTaking.vue @@ -14,13 +14,17 @@ {{fixedInfo.matSpec}} - + + {{fixedInfo.matQty}} + + + - + @@ -44,7 +48,7 @@ - + @@ -69,13 +73,13 @@ - - + + - @@ -102,43 +106,48 @@ getServerIPAndPort } from '@/config.js'; - import Card from '@/components/Card.vue'; + import StocktakingCard from '@/components/StocktakingCard.vue'; import { ref, + onMounted, nextTick } from 'vue'; import uniPopup from '@/node_modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup'; - + import { + getCurrentInstance + } from 'vue'; export default { components: { uniPopup, - Card + StocktakingCard }, setup() { + const { + proxy + } = getCurrentInstance(); // 不能修改的信息 - const fixedInfo = { + const fixedInfo = ref({ infoId: 0, matCode: '示例名称', matName: '这是一段示例描述', matSpec: '', matQty: 0, - }; + stocktakingQty: 0, + }); const popup = ref(null); const inputValue = ref(''); - const showPopup = (info) => { fixedInfo.infoId = info.id; - fixedInfo.matCode = info.matCode; - fixedInfo.matName = info.matName; - fixedInfo.matSpec = info.matSpec; - fixedInfo.matQty = info.matQty; - inputValue.value = info.matQty; + fixedInfo.value.matName = info.matName; + fixedInfo.value.matCode = info.matCode; + fixedInfo.value.matSpec = info.matSpec; + fixedInfo.value.matQty = info.matQty; + fixedInfo.value.stocktakingQty = info.stocktakingQty; + + inputValue.value = info.stocktakingQty == -1 ? info.matQty : info.stocktakingQty; popup.value.open(); - // nextTick(() => { - // inputRef.value.focus(); - // }); }; const hidePopup = () => { @@ -146,7 +155,20 @@ }; const saveData = () => { - if (inputValue.value == fixedInfo.matQty) { + // console.log('fixedInfo.stocktakingQty' + fixedInfo.value.stocktakingQty); + // console.log('inputValue.value' + inputValue.value); + // console.log('fixedInfo.matQty' + fixedInfo.value.matQty); + + // if (fixedInfo.value.stocktakingQty == -1 && inputValue.value == fixedInfo.value.matQty) { + // uni.showToast({ + // title: '本次修改未修改数量', + // icon: 'none', + // duration: 1500 + // }); + // hidePopup(); + // return; + // } + if (fixedInfo.value.stocktakingQty != -1 && inputValue.value == fixedInfo.value.stocktakingQty) { uni.showToast({ title: '本次修改未修改数量', icon: 'none', @@ -157,15 +179,7 @@ } if (inputValue.value < 0) { uni.showToast({ - title: '您所输入的数量应该大于0!', - icon: 'none', - duration: 1500 - }); - return; - } - if (inputValue.value == 0) { - uni.showToast({ - title: '数量为0,请使用删除功能!', + title: '您所输入的数量应该大于等于0!', icon: 'none', duration: 1500 }); @@ -175,10 +189,11 @@ //调用接口进行数量的修改 uni.request({ - url: 'http://' + serverIPAndPort +'/matDetailCurrenInfo/updateMatDetailCurrentInfoById', // 请求的接口地址 + url: 'http://' + serverIPAndPort + + '/pdaStocktaking/stockTakingById', // 请求的接口地址 method: 'POST', // 设置请求方式为 POST data: { - "matQty": inputValue.value, + "stocktakingQty": inputValue.value, "matDetailCurrentInfoId": fixedInfo.infoId, "userName": getConfig('userName', 'admin'), "deviceType": "PDA" @@ -191,16 +206,17 @@ if (res.statusCode === 200) { //接口返回数据为200 表示获取成功! if (res.data.code == 200) { - uni.showToast({ - title: '修改成功!', + title: '成功!', icon: 'none', duration: 1200 }); hidePopup(); + + proxy.refreshData(); } else { uni.showToast({ - title: '修改失败:' + res.data.message, + title: '失败:' + res.data.message, icon: 'none', duration: 2500 }); @@ -229,10 +245,6 @@ } }); - - - - }; return { @@ -244,6 +256,7 @@ saveData }; }, + data() { return { locationId: null, @@ -257,6 +270,11 @@ placeholderText: '请先扫描货架码', matCodeCondition: '', //物料编码搜索条件 cardData: null, + + //监控滑动的位置 + touchStartX: 0, + touchStartY: 0, + isMove: false, //滑动标识 是否滑动 } }, onShow: function() { @@ -271,37 +289,28 @@ }); }, methods: { + refreshData: function() { + this.analysisScanCode(this.shelfCode); + }, + cardClass: function(item) { + return item.stocktakingQty == -1 ? 'cardNoStocktaking' : 'cardYesStocktaking'; + }, analysisScanCode: function(encodedString) { // 去除末尾的逗号和"..."(如果有的话) encodedString = encodedString.replace(/,\s*\.\.\.$/, ''); - // 分割字符串并转换为字节数组 - let byteStrings = encodedString.split(','); - let byteArray = []; - for (let byteString of byteStrings) { - byteArray.push(parseInt(byteString, 10)); // 将字符串转换为十进制整数 - } - // 将字节数组转换为UTF-8字符串 - // 注意:这里使用了一个简单的循环来构建字符串,因为String.fromCharCode.apply可能在大数据上性能不佳 - let originalString = ''; - for (let i = 0; i < byteArray.length; i++) { - // 对于每个字节,使用fromCharCode转换为对应的字符 - // 注意:这里假设你的字节数组已经是正确的UTF-8编码,并且不需要额外的处理来组合多字节字符 - originalString += String.fromCharCode(byteArray[i]); - } - this.shelfCode = originalString; + this.shelfCode = encodedString; //调用接口获取当前工位信息 当前工位是否有货架 var serverIPAndPort = getServerIPAndPort(); uni.request({ url: 'http://' + serverIPAndPort + - '/matDetailCurrenInfo/getMatDetailCurrentInfos', // 请求的接口地址 + '/pdaStocktaking/getStocktakingInfosByShelfCode', // 请求的接口地址 method: 'POST', // 设置请求方式为 POST data: { "shelfCode": this.shelfCode, - "matCode": '', "userName": this.userName, "deviceType": "PDA", "pageNumber": 1, - "pageSize": 100 + "pageSize": 1000 }, header: { 'Content-Type': 'application/json', // 如果需要以JSON格式发送数据 @@ -362,95 +371,6 @@ console.log('请求完成', event); } }); - - - }, - - queryMatList: function() { - if (this.shelfCode == null || this.shelfCode == '') { - uni.showToast({ - title: '请先扫描货架码!', - icon: 'none', - duration: 1000 - }); - return; - } - - - var serverIPAndPort = getServerIPAndPort(); - uni.request({ - url: 'http://' + serverIPAndPort + - '/matDetailCurrenInfo/getMatDetailCurrentInfos', // 请求的接口地址 - method: 'POST', // 设置请求方式为 POST - data: { - "shelfCode": this.shelfCode, - "matCode": this.matCodeCondition, - "userName": this.userName, - "deviceType": "PDA", - "pageNumber": 1, - "pageSize": 100 - }, - header: { - 'Content-Type': 'application/json', // 如果需要以JSON格式发送数据 - }, - success: (res) => { - // 请求成功的回调函数 - if (res.statusCode === 200) { - //接口返回数据为200 表示获取成功! - if (res.data.code == 200) { - //未查询到信息 - if (res.data.data == null || res.data.data.count == 0) { - uni.showToast({ - title: '该货架不存在绑定的物料信息!', - icon: 'none', - duration: 1500 - }); - return; - } - //有物料信息 - this.cardData = res.data.data.lists; - this.recordCount = res.data.data.count; - uni.showToast({ - title: '获取成功!', - icon: 'none', - duration: 100 - }); - - } else { - uni.showToast({ - title: '获取失败:' + res.data.message, - icon: 'none', - duration: 3500 - }); - this.clear(); - } - - } else { - uni.showToast({ - title: '服务器返回错误状态码' + res.statusCode, - icon: 'none', - duration: 3000 - }); - this.clear(); - } - }, - fail: (err) => { - // 请求失败的回调函数 - uni.showToast({ - title: '请求失败' + err, - icon: 'none', - duration: 3000 - }); - - this.clear(); - }, - complete: (event) => { - // 请求完成的回调函数(无论成功或失败都会调用) - console.log('请求完成', event); - } - }); - - }, //清空当前界面所有内容 @@ -460,9 +380,24 @@ this.recordCount = 0; }, + //解决长按和滑动冲突的问题 + cardTouchStart(e) { + this.isMove = false; + this.touchStartX = e.touches[0].clientX; + this.touchStartY = e.touches[0].clientY; + }, + cardTouchMove(e) { + var deltaX = e.changedTouches[0].clientX - this.touchStartX; + var deltaY = e.changedTouches[0].clientY - this.touchStartY; + if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) { + this.isMove = true; + } + }, //长按 longpress(item) { - this.showPopup(item); + if (this.isMove == false) { + this.showPopup(item); + } }, } } @@ -567,4 +502,21 @@ color: #fff; cursor: pointer; } + + + .cardNoStocktaking { + border: 3rpx solid black; + border-radius: 15rpx; + margin: 8rpx; + padding: 8rpx; + background-color: beige; + } + + .cardYesStocktaking { + border: 3rpx solid black; + border-radius: 15rpx; + margin: 8rpx; + padding: 8rpx; + background-color: seagreen; + } \ No newline at end of file diff --git a/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js b/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js index 9f5168d..416ad8d 100644 --- a/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js +++ b/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js @@ -151,7 +151,7 @@ if (uni.restoreGlobal) { } return target; }; - const _sfc_main$b = { + const _sfc_main$c = { data() { return { title: "登录", @@ -227,7 +227,7 @@ if (uni.restoreGlobal) { } } }; - function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) { + function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [ vue.createElementVNode("navigator", { url: "../config/config", @@ -313,8 +313,8 @@ if (uni.restoreGlobal) { ]) ]); } - const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$a], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/index/index.vue"]]); - const _sfc_main$a = { + const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$b], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/index/index.vue"]]); + const _sfc_main$b = { data() { return { serverIP: "", @@ -336,7 +336,7 @@ if (uni.restoreGlobal) { } } }; - function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) { + function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "container" }, [ vue.createElementVNode("view", null, [ vue.createElementVNode("label", null, "服务器IP:"), @@ -373,7 +373,7 @@ if (uni.restoreGlobal) { }, "保存配置") ]); } - const PagesConfigConfig = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$9], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/config/config.vue"]]); + const PagesConfigConfig = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$a], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/config/config.vue"]]); const _imports_0$1 = "/static/logOut.png"; const _imports_1 = "/static/bind.png"; const _imports_2 = "/static/bindQuery.png"; @@ -381,13 +381,13 @@ if (uni.restoreGlobal) { const _imports_4 = "/static/callOut.png"; const _imports_5 = "/static/stockTaking.png"; const _imports_6 = "/static/task.png"; - const _sfc_main$9 = { + const _sfc_main$a = { data() { return {}; }, methods: {} }; - function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) { + function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [ vue.createElementVNode("view", null, [ vue.createElementVNode("navigator", { @@ -523,8 +523,8 @@ if (uni.restoreGlobal) { ]) ]); } - const PagesMainMain = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$8], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/main/main.vue"]]); - const _sfc_main$8 = { + const PagesMainMain = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$9], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/main/main.vue"]]); + const _sfc_main$9 = { data() { return { visible: false, @@ -610,7 +610,7 @@ if (uni.restoreGlobal) { } } }; - function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) { + function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) { return $data.visible ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "popup-container" @@ -641,9 +641,9 @@ if (uni.restoreGlobal) { ]) ])) : vue.createCommentVNode("v-if", true); } - const PagesBindSelectMatBindSelectMat = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$7], ["__scopeId", "data-v-68e7b952"], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/bindSelectMat/bindSelectMat.vue"]]); + const PagesBindSelectMatBindSelectMat = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$8], ["__scopeId", "data-v-68e7b952"], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/bindSelectMat/bindSelectMat.vue"]]); const _imports_0 = "/static/scan.png"; - const _sfc_main$7 = { + const _sfc_main$8 = { components: { bindSelectMat: PagesBindSelectMatBindSelectMat }, @@ -673,18 +673,15 @@ if (uni.restoreGlobal) { this.userName = getConfig("userName", "admin"); const self = this; recive(function(res) { - formatAppLog("log", "at pages/bind/bind.vue:166", "Success:" + res.data); + formatAppLog("log", "at pages/bind/bind.vue:167", "Success:" + res.data); self.analysisScanCode(res.data); }, function(err) { - formatAppLog("log", "at pages/bind/bind.vue:169", "Error:", JSON.stringify(err)); + formatAppLog("log", "at pages/bind/bind.vue:170", "Error:", JSON.stringify(err)); }); }, methods: { analysisScanCode: function(encodedString) { encodedString = encodedString.replace(/,\s*\.\.\.$/, ""); - let byteStrings = encodedString.split(","); - for (let byteString of byteStrings) { - } this.locationCode = encodedString; var serverIPAndPort = getServerIPAndPort(); uni.request({ @@ -748,12 +745,12 @@ if (uni.restoreGlobal) { this.clear(); }, complete: (event) => { - formatAppLog("log", "at pages/bind/bind.vue:260", "请求完成", event); + formatAppLog("log", "at pages/bind/bind.vue:263", "请求完成", event); } }); }, bindSelectedMat: function(item) { - formatAppLog("log", "at pages/bind/bind.vue:267", "用户选择了项目:", item); + formatAppLog("log", "at pages/bind/bind.vue:270", "用户选择了项目:", item); this.matCode = item.matCode; this.matName = item.matName; this.matSpec = item.matSpec; @@ -816,7 +813,7 @@ if (uni.restoreGlobal) { }); }, complete: (event) => { - formatAppLog("log", "at pages/bind/bind.vue:334", "请求完成", event); + formatAppLog("log", "at pages/bind/bind.vue:337", "请求完成", event); } }); }, @@ -866,11 +863,11 @@ if (uni.restoreGlobal) { this.matSpec = ""; }, handlePopupClose() { - formatAppLog("log", "at pages/bind/bind.vue:388", "弹出层已关闭"); + formatAppLog("log", "at pages/bind/bind.vue:391", "弹出层已关闭"); } } }; - function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { + function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) { const _component_bindSelectMat = vue.resolveComponent("bindSelectMat"); return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [ vue.createVNode(_component_bindSelectMat, { @@ -1039,7 +1036,11 @@ if (uni.restoreGlobal) { vue.createElementVNode("view", { style: { "flex": "1" } }, [ vue.createElementVNode("view", { style: { "flex": "40", "text-align": "center" } }, [ vue.createElementVNode("button", { - style: { "margin": "50rpx" }, + style: { "margin": "50rpx", "font-size": "40rpx" }, + size: "mini" + }, "送货架"), + vue.createElementVNode("button", { + style: { "margin": "50rpx", "font-size": "40rpx" }, size: "mini" }, "送货架") ]) @@ -1047,7 +1048,7 @@ if (uni.restoreGlobal) { ]) ]); } - const PagesBindBind = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$6], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/bind/bind.vue"]]); + const PagesBindBind = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$7], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/bind/bind.vue"]]); class MPAnimation { constructor(options, _this) { this.options = options; @@ -1158,7 +1159,7 @@ if (uni.restoreGlobal) { clearTimeout(_this.timer); return new MPAnimation(option, _this); } - const _sfc_main$6 = { + const _sfc_main$7 = { name: "uniTransition", emits: ["click", "change"], props: { @@ -1405,7 +1406,7 @@ if (uni.restoreGlobal) { } } }; - function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) { + function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { return $data.isShow ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, ref: "ani", @@ -1417,8 +1418,8 @@ if (uni.restoreGlobal) { vue.renderSlot(_ctx.$slots, "default") ], 14, ["animation"])) : vue.createCommentVNode("v-if", true); } - const __easycom_0$1 = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$5], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/uni_modules/uni-transition/components/uni-transition/uni-transition.vue"]]); - const _sfc_main$5 = { + const __easycom_0$1 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$6], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/uni_modules/uni-transition/components/uni-transition/uni-transition.vue"]]); + const _sfc_main$6 = { name: "uniPopup", components: {}, emits: ["change", "maskClick"], @@ -1746,7 +1747,7 @@ if (uni.restoreGlobal) { } } }; - function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { + function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) { const _component_uni_transition = resolveEasycom(vue.resolveDynamicComponent("uni-transition"), __easycom_0$1); return $data.showPopup ? (vue.openBlock(), vue.createElementBlock( "view", @@ -1806,8 +1807,8 @@ if (uni.restoreGlobal) { /* CLASS */ )) : vue.createCommentVNode("v-if", true); } - const __easycom_0 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4], ["__scopeId", "data-v-4dd3c44b"], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/uni_modules/uni-popup/components/uni-popup/uni-popup.vue"]]); - const _sfc_main$4 = { + const __easycom_0 = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$5], ["__scopeId", "data-v-4dd3c44b"], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/uni_modules/uni-popup/components/uni-popup/uni-popup.vue"]]); + const _sfc_main$5 = { __name: "Card", props: { item: { @@ -1831,7 +1832,7 @@ if (uni.restoreGlobal) { return __returned__; } }; - function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) { + function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "card" }, [ vue.createElementVNode("view", { class: "card-header" }, [ vue.createElementVNode( @@ -1876,6 +1877,19 @@ if (uni.restoreGlobal) { /* TEXT */ ) ]), + vue.createElementVNode("view", { + class: "content-item", + style: { "font-weight": "600" } + }, [ + vue.createElementVNode("text", null, "盘点数量:"), + vue.createElementVNode( + "text", + null, + vue.toDisplayString($props.item.stocktakingQty), + 1 + /* TEXT */ + ) + ]), vue.createElementVNode("view", { class: "content-combined" }, [ vue.createElementVNode("view", { class: "content-item", @@ -1932,8 +1946,8 @@ if (uni.restoreGlobal) { ]) ]); } - const Card = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3], ["__scopeId", "data-v-29c414df"], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/components/Card.vue"]]); - const _sfc_main$3 = { + const Card = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4], ["__scopeId", "data-v-29c414df"], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/components/Card.vue"]]); + const _sfc_main$4 = { name: "uniPopup", components: {}, emits: ["change", "maskClick"], @@ -2286,7 +2300,7 @@ if (uni.restoreGlobal) { } } }; - function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) { + function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) { const _component_uni_transition = resolveEasycom(vue.resolveDynamicComponent("uni-transition"), __easycom_0$1); return $data.showPopup ? (vue.openBlock(), vue.createElementBlock( "view", @@ -2346,8 +2360,8 @@ if (uni.restoreGlobal) { /* CLASS */ )) : vue.createCommentVNode("v-if", true); } - const uniPopup = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__scopeId", "data-v-7db519c7"], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/node_modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup.vue"]]); - const _sfc_main$2 = { + const uniPopup = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3], ["__scopeId", "data-v-7db519c7"], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/node_modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup.vue"]]); + const _sfc_main$3 = { components: { uniPopup, Card @@ -2652,7 +2666,7 @@ if (uni.restoreGlobal) { } } }; - function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { + function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) { const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_0); const _component_Card = vue.resolveComponent("Card"); return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [ @@ -2831,36 +2845,180 @@ if (uni.restoreGlobal) { ]) ]); } - const PagesQueryBindListQueryBindList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/queryBindList/queryBindList.vue"]]); + const PagesQueryBindListQueryBindList = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/pages/queryBindList/queryBindList.vue"]]); + const _sfc_main$2 = { + __name: "StocktakingCard", + props: { + item: { + type: Object, + required: true + }, + currentIndex: { + type: Number, + required: true + }, + cardData: { + type: Array, + required: true + } + }, + setup(__props, { expose: __expose }) { + __expose(); + const props = __props; + const __returned__ = { props, ref: vue.ref }; + Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true }); + return __returned__; + } + }; + function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { + return vue.openBlock(), vue.createElementBlock("view", null, [ + vue.createElementVNode("view", { class: "card-header" }, [ + vue.createElementVNode( + "text", + null, + vue.toDisplayString($props.item.matCode) + "  " + vue.toDisplayString($props.currentIndex + 1) + "/" + vue.toDisplayString($props.cardData.length), + 1 + /* TEXT */ + ) + ]), + vue.createElementVNode("view", { class: "card-content" }, [ + vue.createElementVNode("view", { class: "content-item" }, [ + vue.createElementVNode("text", null, "名称:"), + vue.createElementVNode( + "text", + null, + vue.toDisplayString($props.item.matName), + 1 + /* TEXT */ + ) + ]), + vue.createElementVNode("view", { class: "content-item" }, [ + vue.createElementVNode("text", null, "规格:"), + vue.createElementVNode( + "text", + null, + vue.toDisplayString($props.item.matSpec), + 1 + /* TEXT */ + ) + ]), + vue.createElementVNode("view", { + class: "content-item", + style: { "font-weight": "600" } + }, [ + vue.createElementVNode("text", null, "数量:"), + vue.createElementVNode( + "text", + null, + vue.toDisplayString($props.item.matQty), + 1 + /* TEXT */ + ) + ]), + vue.createElementVNode("view", { + class: "content-item", + style: { "font-weight": "600" } + }, [ + vue.createElementVNode("text", null, "盘点数量:"), + $props.item.stocktakingQty !== -1 ? (vue.openBlock(), vue.createElementBlock( + "text", + { key: 0 }, + vue.toDisplayString($props.item.stocktakingQty), + 1 + /* TEXT */ + )) : (vue.openBlock(), vue.createElementBlock("text", { key: 1 }, "未盘点")) + ]), + vue.createElementVNode("view", { class: "content-combined" }, [ + vue.createElementVNode("view", { + class: "content-item", + style: { "font-weight": "600", "color": "firebrick" } + }, [ + vue.createElementVNode("text", null, "库位:"), + vue.createElementVNode( + "text", + null, + vue.toDisplayString($props.item.locationCode), + 1 + /* TEXT */ + ) + ]), + vue.createElementVNode("view", { + class: "content-item", + style: { "font-weight": "600", "color": "firebrick" } + }, [ + vue.createElementVNode("text", null, "货架编码:"), + vue.createElementVNode( + "text", + null, + vue.toDisplayString($props.item.shelfCode), + 1 + /* TEXT */ + ) + ]) + ]), + vue.createElementVNode("view", { class: "content-combined" }, [ + vue.createElementVNode("view", { + class: "content-item", + style: { "font-weight": "600", "color": "violet" } + }, [ + vue.createElementVNode("text", null, "人员:"), + vue.createElementVNode( + "text", + null, + vue.toDisplayString($props.item.modifyUser), + 1 + /* TEXT */ + ) + ]), + vue.createElementVNode("view", { class: "content-time" }, [ + vue.createElementVNode("text", null, "绑定时间:"), + vue.createElementVNode( + "text", + null, + vue.toDisplayString($props.item.modifyTime), + 1 + /* TEXT */ + ) + ]) + ]) + ]) + ]); + } + const StocktakingCard = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__scopeId", "data-v-e2c0cdac"], ["__file", "E:/代码/赛特制冷WCS/wcs/PDA/PDA/components/StocktakingCard.vue"]]); const _sfc_main$1 = { components: { uniPopup, - Card + StocktakingCard }, setup() { - const fixedInfo = { + const { + proxy + } = vue.getCurrentInstance(); + const fixedInfo = vue.ref({ infoId: 0, matCode: "示例名称", matName: "这是一段示例描述", matSpec: "", - matQty: 0 - }; + matQty: 0, + stocktakingQty: 0 + }); const popup = vue.ref(null); const inputValue = vue.ref(""); const showPopup = (info) => { fixedInfo.infoId = info.id; - fixedInfo.matCode = info.matCode; - fixedInfo.matName = info.matName; - fixedInfo.matSpec = info.matSpec; - fixedInfo.matQty = info.matQty; - inputValue.value = info.matQty; + fixedInfo.value.matName = info.matName; + fixedInfo.value.matCode = info.matCode; + fixedInfo.value.matSpec = info.matSpec; + fixedInfo.value.matQty = info.matQty; + fixedInfo.value.stocktakingQty = info.stocktakingQty; + inputValue.value = info.stocktakingQty == -1 ? info.matQty : info.stocktakingQty; popup.value.open(); }; const hidePopup = () => { popup.value.close(); }; const saveData = () => { - if (inputValue.value == fixedInfo.matQty) { + if (fixedInfo.value.stocktakingQty != -1 && inputValue.value == fixedInfo.value.stocktakingQty) { uni.showToast({ title: "本次修改未修改数量", icon: "none", @@ -2871,15 +3029,7 @@ if (uni.restoreGlobal) { } if (inputValue.value < 0) { uni.showToast({ - title: "您所输入的数量应该大于0!", - icon: "none", - duration: 1500 - }); - return; - } - if (inputValue.value == 0) { - uni.showToast({ - title: "数量为0,请使用删除功能!", + title: "您所输入的数量应该大于等于0!", icon: "none", duration: 1500 }); @@ -2887,12 +3037,12 @@ if (uni.restoreGlobal) { } var serverIPAndPort = getServerIPAndPort(); uni.request({ - url: "http://" + serverIPAndPort + "/matDetailCurrenInfo/updateMatDetailCurrentInfoById", + url: "http://" + serverIPAndPort + "/pdaStocktaking/stockTakingById", // 请求的接口地址 method: "POST", // 设置请求方式为 POST data: { - "matQty": inputValue.value, + "stocktakingQty": inputValue.value, "matDetailCurrentInfoId": fixedInfo.infoId, "userName": getConfig("userName", "admin"), "deviceType": "PDA" @@ -2905,14 +3055,15 @@ if (uni.restoreGlobal) { if (res.statusCode === 200) { if (res.data.code == 200) { uni.showToast({ - title: "修改成功!", + title: "成功!", icon: "none", duration: 1200 }); hidePopup(); + proxy.refreshData(); } else { uni.showToast({ - title: "修改失败:" + res.data.message, + title: "失败:" + res.data.message, icon: "none", duration: 2500 }); @@ -2958,45 +3109,46 @@ if (uni.restoreGlobal) { placeholderText: "请先扫描货架码", matCodeCondition: "", //物料编码搜索条件 - cardData: null + cardData: null, + //监控滑动的位置 + touchStartX: 0, + touchStartY: 0, + isMove: false + //滑动标识 是否滑动 }; }, onShow: function() { this.userName = getConfig("userName", "admin"); const self = this; recive(function(res) { - formatAppLog("log", "at pages/stockTaking/stockTaking.vue:267", "Success:" + res.data); + formatAppLog("log", "at pages/stockTaking/stockTaking.vue:285", "Success:" + res.data); self.analysisScanCode(res.data); }, function(err) { - formatAppLog("log", "at pages/stockTaking/stockTaking.vue:270", "Error:", JSON.stringify(err)); + formatAppLog("log", "at pages/stockTaking/stockTaking.vue:288", "Error:", JSON.stringify(err)); }); }, methods: { + refreshData: function() { + this.analysisScanCode(this.shelfCode); + }, + cardClass: function(item) { + return item.stocktakingQty == -1 ? "cardNoStocktaking" : "cardYesStocktaking"; + }, analysisScanCode: function(encodedString) { encodedString = encodedString.replace(/,\s*\.\.\.$/, ""); - let byteStrings = encodedString.split(","); - let byteArray = []; - for (let byteString of byteStrings) { - byteArray.push(parseInt(byteString, 10)); - } - let originalString = ""; - for (let i = 0; i < byteArray.length; i++) { - originalString += String.fromCharCode(byteArray[i]); - } - this.shelfCode = originalString; + this.shelfCode = encodedString; var serverIPAndPort = getServerIPAndPort(); uni.request({ - url: "http://" + serverIPAndPort + "/matDetailCurrenInfo/getMatDetailCurrentInfos", + url: "http://" + serverIPAndPort + "/pdaStocktaking/getStocktakingInfosByShelfCode", // 请求的接口地址 method: "POST", // 设置请求方式为 POST data: { "shelfCode": this.shelfCode, - "matCode": "", "userName": this.userName, "deviceType": "PDA", "pageNumber": 1, - "pageSize": 100 + "pageSize": 1e3 }, header: { "Content-Type": "application/json" @@ -3046,82 +3198,7 @@ if (uni.restoreGlobal) { this.clear(); }, complete: (event) => { - formatAppLog("log", "at pages/stockTaking/stockTaking.vue:362", "请求完成", event); - } - }); - }, - queryMatList: function() { - if (this.shelfCode == null || this.shelfCode == "") { - uni.showToast({ - title: "请先扫描货架码!", - icon: "none", - duration: 1e3 - }); - return; - } - var serverIPAndPort = getServerIPAndPort(); - uni.request({ - url: "http://" + serverIPAndPort + "/matDetailCurrenInfo/getMatDetailCurrentInfos", - // 请求的接口地址 - method: "POST", - // 设置请求方式为 POST - data: { - "shelfCode": this.shelfCode, - "matCode": this.matCodeCondition, - "userName": this.userName, - "deviceType": "PDA", - "pageNumber": 1, - "pageSize": 100 - }, - header: { - "Content-Type": "application/json" - // 如果需要以JSON格式发送数据 - }, - success: (res) => { - if (res.statusCode === 200) { - if (res.data.code == 200) { - if (res.data.data == null || res.data.data.count == 0) { - uni.showToast({ - title: "该货架不存在绑定的物料信息!", - icon: "none", - duration: 1500 - }); - return; - } - this.cardData = res.data.data.lists; - this.recordCount = res.data.data.count; - uni.showToast({ - title: "获取成功!", - icon: "none", - duration: 100 - }); - } else { - uni.showToast({ - title: "获取失败:" + res.data.message, - icon: "none", - duration: 3500 - }); - this.clear(); - } - } else { - uni.showToast({ - title: "服务器返回错误状态码" + res.statusCode, - icon: "none", - duration: 3e3 - }); - this.clear(); - } - }, - fail: (err) => { - uni.showToast({ - title: "请求失败" + err, - icon: "none", - duration: 3e3 - }); - this.clear(); - }, - complete: (event) => { - formatAppLog("log", "at pages/stockTaking/stockTaking.vue:449", "请求完成", event); + formatAppLog("log", "at pages/stockTaking/stockTaking.vue:371", "请求完成", event); } }); }, @@ -3131,15 +3208,30 @@ if (uni.restoreGlobal) { this.cardData = null; this.recordCount = 0; }, + //解决长按和滑动冲突的问题 + cardTouchStart(e) { + this.isMove = false; + this.touchStartX = e.touches[0].clientX; + this.touchStartY = e.touches[0].clientY; + }, + cardTouchMove(e) { + var deltaX = e.changedTouches[0].clientX - this.touchStartX; + var deltaY = e.changedTouches[0].clientY - this.touchStartY; + if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) { + this.isMove = true; + } + }, //长按 longpress(item) { - this.showPopup(item); + if (this.isMove == false) { + this.showPopup(item); + } } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_0); - const _component_Card = vue.resolveComponent("Card"); + const _component_StocktakingCard = vue.resolveComponent("StocktakingCard"); return vue.openBlock(), vue.createElementBlock("view", { class: "bg-image" }, [ vue.createVNode( _component_uni_popup, @@ -3180,11 +3272,21 @@ if (uni.restoreGlobal) { /* TEXT */ ) ]), + vue.createElementVNode("view", { class: "info-item" }, [ + vue.createElementVNode("label", null, "数量:"), + vue.createElementVNode( + "text", + null, + vue.toDisplayString($setup.fixedInfo.matQty), + 1 + /* TEXT */ + ) + ]), vue.createElementVNode("view", { class: "input-item", style: { "background-color": "wheat" } }, [ - vue.createElementVNode("label", null, "数量:"), + vue.createElementVNode("label", null, "盘点数量:"), vue.withDirectives(vue.createElementVNode( "input", { @@ -3210,7 +3312,7 @@ if (uni.restoreGlobal) { onClick: _cache[1] || (_cache[1] = (...args) => $setup.hidePopup && $setup.hidePopup(...args)) }, "取消"), vue.createElementVNode("button", { - onClick: _cache[2] || (_cache[2] = (...args) => $setup.saveData && $setup.saveData(...args)) + onClick: _cache[2] || (_cache[2] = ($event) => $setup.saveData($setup.fixedInfo)) }, "保存") ]) ]) @@ -3246,7 +3348,7 @@ if (uni.restoreGlobal) { style: { "font-size": "50rpx", "padding": "10rpx" }, placeholder: $data.placeholderText, "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.matCodeCondition = $event), - onBlur: _cache[4] || (_cache[4] = (...args) => $options.queryMatList && $options.queryMatList(...args)) + onBlur: _cache[4] || (_cache[4] = (...args) => _ctx.queryMatList && _ctx.queryMatList(...args)) }, null, 40, ["placeholder"]), [ [vue.vModelText, $data.matCodeCondition] ]) @@ -3254,7 +3356,7 @@ if (uni.restoreGlobal) { vue.createElementVNode("view", { style: { "flex": "3" } }), vue.createElementVNode("view", { style: { "flex": "30" } }, [ vue.createElementVNode("button", { - onClick: _cache[5] || (_cache[5] = (...args) => $options.queryMatList && $options.queryMatList(...args)) + onClick: _cache[5] || (_cache[5] = ($event) => $options.analysisScanCode(this.shelfCode)) }, "查询") ]) ]) @@ -3300,13 +3402,16 @@ if (uni.restoreGlobal) { vue.renderList($data.cardData, (item, index) => { return vue.openBlock(), vue.createElementBlock("view", { key: index, + onTouchstart: _cache[6] || (_cache[6] = (...args) => $options.cardTouchStart && $options.cardTouchStart(...args)), + onTouchmove: _cache[7] || (_cache[7] = (...args) => $options.cardTouchMove && $options.cardTouchMove(...args)), onLongpress: ($event) => $options.longpress(item) }, [ - vue.createVNode(_component_Card, { + vue.createVNode(_component_StocktakingCard, { + class: vue.normalizeClass($options.cardClass(item)), item, currentIndex: index, cardData: $data.cardData - }, null, 8, ["item", "currentIndex", "cardData"]) + }, null, 8, ["class", "item", "currentIndex", "cardData"]) ], 40, ["onLongpress"]); }), 128 diff --git a/WCS.BLL/DbModels/STZL/MatDetailCurrentInfo.cs b/WCS.BLL/DbModels/STZL/MatDetailCurrentInfo.cs index be92e82..5cf491f 100644 --- a/WCS.BLL/DbModels/STZL/MatDetailCurrentInfo.cs +++ b/WCS.BLL/DbModels/STZL/MatDetailCurrentInfo.cs @@ -25,7 +25,7 @@ namespace WCS.BLL.DbModels /// 货架ID /// [SugarColumn(ColumnName = "shelf_id", IsNullable = false, ColumnDescription = "货架ID")] - public int ShlefId { get; set; } + public int ShelfId { get; set; } /// /// 货架编码 对应二维码 diff --git a/WCS.BLL/Services/IService/IStockTakingService.cs b/WCS.BLL/Services/IService/IStockTakingService.cs index e02dc44..ed70413 100644 --- a/WCS.BLL/Services/IService/IStockTakingService.cs +++ b/WCS.BLL/Services/IService/IStockTakingService.cs @@ -41,6 +41,8 @@ namespace WCS.BLL.Services.IService public Task> getStocktakingInfos(GetStocktakingInfosRequest request); + public Task> getStocktakingInfosByShelfCode(GetStocktakingInfosByShelfCodeRequest request); + public Task> updateStocktakingInfo(UpdateStocktakingInfoRequest request); public Task> deleteStocktakingInfos(DeleteInfosRequest request); diff --git a/WCS.BLL/Services/Service/BatchBindMatDetailService.cs b/WCS.BLL/Services/Service/BatchBindMatDetailService.cs index 358bb47..6560565 100644 --- a/WCS.BLL/Services/Service/BatchBindMatDetailService.cs +++ b/WCS.BLL/Services/Service/BatchBindMatDetailService.cs @@ -37,7 +37,7 @@ namespace WCS.BLL.Services.Service try { var recordsQueryable = DbHelp.db.Queryable() - .LeftJoin((mci, si) => mci.ShlefId == si.Id) + .LeftJoin((mci, si) => mci.ShelfId == si.Id) .LeftJoin((mci, si, li) => (si.TransStatus == TransStatusEnum.静止 && si.CurrentLocationId == li.Id) || (si.TransStatus == TransStatusEnum.运输中 && si.DestinationLocationId == li.Id)) .WhereIF(request.OrderTypeId != null && request.OrderTypeId != 0, (mci, si, li) => mci.OrderTypeId == request.OrderTypeId) @@ -46,7 +46,7 @@ namespace WCS.BLL.Services.Service .Select((mci, si, li) => new MatDetailCurrentInfoModel() { Id = mci.Id, - ShlefId = mci.ShlefId, + ShelfId = mci.ShelfId, ShelfCode = mci.ShelfCode, ShelfType = mci.ShelfType, @@ -329,7 +329,7 @@ namespace WCS.BLL.Services.Service var matDetailCurrentInfo = new MatDetailCurrentInfo() { - ShlefId = shelfInfo.Id, + ShelfId = shelfInfo.Id, ShelfCode = shelfInfo.ShelfCode, ShelfType = shelfInfo.ShelfTypeName, diff --git a/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs b/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs index 3fbbbf2..d103bfa 100644 --- a/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs +++ b/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs @@ -32,7 +32,7 @@ namespace WCS.BLL.Services.Service try { var recordsQueryable = DbHelp.db.Queryable() - .LeftJoin((mci, si) => mci.ShlefId == si.Id) + .LeftJoin((mci, si) => mci.ShelfId == si.Id) .LeftJoin((mci, si, li) => (si.TransStatus == TransStatusEnum.静止 && si.CurrentLocationId == li.Id) || (si.TransStatus == TransStatusEnum.运输中 && si.DestinationLocationId == li.Id)) .WhereIF(request.LocationAreaId != null && request.LocationAreaId != 0, (mci, si, li) => li.LocationAreaId == request.LocationAreaId) @@ -44,7 +44,7 @@ namespace WCS.BLL.Services.Service .Select((mci, si, li) => new MatDetailCurrentInfoModel() { Id = mci.Id, - ShlefId = mci.ShlefId, + ShelfId = mci.ShelfId, ShelfCode = mci.ShelfCode, ShelfType = mci.ShelfType, diff --git a/WCS.BLL/Services/Service/StockTakingService.cs b/WCS.BLL/Services/Service/StockTakingService.cs index ca7886d..392ee0e 100644 --- a/WCS.BLL/Services/Service/StockTakingService.cs +++ b/WCS.BLL/Services/Service/StockTakingService.cs @@ -7,6 +7,7 @@ using WCS.DAL.DbModels; using WCS.Model; using WCS.Model.ApiModel.InOutRecord; using WCS.Model.ApiModel.MatBaseInfo; +using WCS.Model.ApiModel.MatDetailCurrentInfo; using WCS.Model.ApiModel.Stocktaking; using WCS.Model.WebSocketModel; @@ -1076,7 +1077,7 @@ namespace WCS.BLL.Services.Service stocktakingInfo = new MatDetailStocktakingInfo() { MatDetailCurrentId = matDetailCurrentInfo.Id, - ShlefId = matDetailCurrentInfo.ShlefId, + ShlefId = matDetailCurrentInfo.ShelfId, ShelfCode = matDetailCurrentInfo.ShelfCode, ShelfType = matDetailCurrentInfo.ShelfType, ShelfArea = "", @@ -1169,6 +1170,105 @@ namespace WCS.BLL.Services.Service } } + public async Task> getStocktakingInfosByShelfCode(GetStocktakingInfosByShelfCodeRequest request) + { + try + { + //获取货架是否存在 + var shelf = await DbHelp.db.Queryable() + .Where(t => t.ShelfCode == request.ShelfCode && t.IsEnable == true) + .FirstAsync(); + if (shelf == null) + { + return new PageQueryResponse() + { + Code = 201, + Message = $"货架[{request.ShelfCode}]不存在或已被禁用!", + Data = null + }; + } + + //获取当前的未提交的盘点数据 + var stockTaking = DbHelp.db.Queryable() + .Where(t => t.ShlefId == shelf.Id) + .Where(t => t.StocktakingStatus == StocktakingStatusEnum.未提交) + .ToList(); + //获取当前货架绑定的库存数据 + var matDetailCurrentInfo = DbHelp.db.Queryable() + .Where(t => t.ShelfId == shelf.Id) + .ToList(); + + var recordsQueryable = DbHelp.db.Queryable() + .LeftJoin((mci, si) => mci.ShelfId == si.Id) + .LeftJoin((mci, si, li) => (si.TransStatus == TransStatusEnum.静止 && si.CurrentLocationId == li.Id) + || (si.TransStatus == TransStatusEnum.运输中 && si.DestinationLocationId == li.Id)) + .Where((mci, si, li) => mci.ShelfId == shelf.Id) + .Select((mci, si, li) => new MatDetailCurrentInfoModel() + { + Id = mci.Id, + ShelfId = mci.ShelfId, + ShelfCode = mci.ShelfCode, + ShelfType = mci.ShelfType, + + LocationArea = li.LocationArea, + LocationCode = li.LocationCode, + + MatCode = mci.MatCode, + MatName = mci.MatName, + MatSpec = mci.MatSpec, + MatUnit = mci.MatUnit, + MatCustomer = mci.MatCustomer, + MatQty = mci.MatQty, + MatSupplier = mci.MatSupplier, + + StationCode = mci.StationCode, + ModifyUser = mci.ModifyUser, + ModifyTime = mci.ModifyTime + }); + + //分页 + var totalCount = await recordsQueryable.CountAsync(); + var records = await recordsQueryable + .OrderByDescending(mci => mci.Id) + .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) + .ToListAsync(); + //生成序号 + for (int i = 0; i < records.Count; i++) + { + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; + var stockTakingRecord = stockTaking.Where(t => t.MatDetailCurrentId == records[i].Id) + .FirstOrDefault(); + if (stockTakingRecord != null) + { + records[i].StocktakingQty = stockTakingRecord.StocktakingQty; + } + } + //按盘点状态排序(未盘点的为-1) + //records = records.OrderBy(t => t.StocktakingQty) + // .ThenBy(t => t.Id) + // .ToList(); + return new PageQueryResponse() + { + Code = 200, + Message = $"success", + Data = new PageQueryResponseData() + { + TotalCount = totalCount, + MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize), + Count = records.Count, + Lists = records.ToList() + } + }; + } + catch (Exception ex) + { + return new PageQueryResponse() + { + Code = 300, + Message = $"操作失败:{ex.Message}", + }; + } + } /// /// 更新盘点数据的数量 /// diff --git a/WCS.Model/ApiModel/MatDetailCurrentInfo/MatDetailCurrentInfo.cs b/WCS.Model/ApiModel/MatDetailCurrentInfo/MatDetailCurrentInfo.cs index 943f2ff..a0cc98c 100644 --- a/WCS.Model/ApiModel/MatDetailCurrentInfo/MatDetailCurrentInfo.cs +++ b/WCS.Model/ApiModel/MatDetailCurrentInfo/MatDetailCurrentInfo.cs @@ -10,7 +10,7 @@ namespace WCS.Model.ApiModel.MatDetailCurrentInfo public int Id { get; set; } #region 货架属性 - public int? ShlefId { get; set; } + public int? ShelfId { get; set; } public string? ShelfCode { get; set; } = string.Empty; public string? ShelfType { get; set; } = string.Empty; //货架位置的区域 @@ -52,6 +52,10 @@ namespace WCS.Model.ApiModel.MatDetailCurrentInfo public DateTime? ModifyTime { get; set; } = DateTime.Now; + #region 盘点数量 + public int StocktakingQty { get; set; } = -1; + #endregion + public int RowNumber { get; set; } public bool IsSelected diff --git a/WCS.Model/ApiModel/Stocktaking/GetStocktakingInfosByShelfCodeRequest.cs b/WCS.Model/ApiModel/Stocktaking/GetStocktakingInfosByShelfCodeRequest.cs new file mode 100644 index 0000000..1160c9d --- /dev/null +++ b/WCS.Model/ApiModel/Stocktaking/GetStocktakingInfosByShelfCodeRequest.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WCS.Model.ApiModel.Stocktaking +{ + public class GetStocktakingInfosByShelfCodeRequest : PageQueryRequestBase + { + public string ShelfCode { get; set; } + } +} diff --git a/WCS.WebApi/Controllers/PDAMatBindController.cs b/WCS.WebApi/Controllers/PDAMatBindController.cs index 0d875aa..49210b4 100644 --- a/WCS.WebApi/Controllers/PDAMatBindController.cs +++ b/WCS.WebApi/Controllers/PDAMatBindController.cs @@ -233,7 +233,7 @@ namespace WCS.WebApi.Controllers //校验合格 进行保存 var matDetailCurrentInfo = new MatDetailCurrentInfo() { - ShlefId = shelf.Id, + ShelfId = shelf.Id, ShelfCode = shelf.ShelfCode, ShelfType = shelf.ShelfTypeName, //ShelfArea = shelf.ShelfArea, diff --git a/WCS.WebApi/Controllers/PDAStocktakingController.cs b/WCS.WebApi/Controllers/PDAStocktakingController.cs index fcda727..4570884 100644 --- a/WCS.WebApi/Controllers/PDAStocktakingController.cs +++ b/WCS.WebApi/Controllers/PDAStocktakingController.cs @@ -81,6 +81,25 @@ namespace WCS.WebApi.Controllers } } + [Route("getStocktakingInfosByShelfCode")] + [HttpPost(Name = "getStocktakingInfosByShelfCode")] + public async Task getStocktakingInfosByShelfCode(GetStocktakingInfosByShelfCodeRequest request) + { + try + { + return await _stockTakingService.getStocktakingInfosByShelfCode(request); + } + catch (Exception ex) + { + return new ResponseCommon() + { + Code = 201, + Message = ex.Message, + Data = null, + }; + } + } + [HttpPost("updateStocktakingInfos")] public async Task> updateStocktakingInfos(UpdateStocktakingInfoRequest request) { diff --git a/WCS.WebApi/Controllers/StockTakingController.cs b/WCS.WebApi/Controllers/StockTakingController.cs index e947bea..af5de3f 100644 --- a/WCS.WebApi/Controllers/StockTakingController.cs +++ b/WCS.WebApi/Controllers/StockTakingController.cs @@ -8,9 +8,6 @@ using WCS.Model.ApiModel.User; namespace WCS.WebApi.Controllers { - /// - /// 权限/用户界面的接口 - /// [ApiController] [Route("[controller]")] public class StockTakingController : ControllerBase