From caef2ecc53766f999da910da01c028b11900d42c Mon Sep 17 00:00:00 2001 From: caill <815519168@qq.com> Date: Wed, 27 Aug 2025 19:48:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=9B=98=E5=85=A5=E5=BA=93=E3=80=81?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=85=A5=E5=BA=93=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/manage/wlzp.vue | 127 +++++++++++++++++++++++++++++++++++++----- pages/manage/zprk.vue | 34 ++++++++++- utils/getData.js | 25 ++++++++- utils/mork.js | 7 +++ 4 files changed, 173 insertions(+), 20 deletions(-) create mode 100644 utils/mork.js diff --git a/pages/manage/wlzp.vue b/pages/manage/wlzp.vue index a48db21..cc90904 100644 --- a/pages/manage/wlzp.vue +++ b/pages/manage/wlzp.vue @@ -38,22 +38,38 @@ - 物料数量 + 物料数量 - + + + + + + + + + + + + + + + + + + + +
料框号数量操作
+
+
- + @@ -73,18 +89,26 @@ return { title: '', val1: '', - qty: null, + totalQty: null, currentData: {}, - disabled: false + disabled: false, + dataList: [] }; }, + watch: { + dataList: { + deep: true, + handler() { + this.updateTotalQty() + } + } + }, onLoad (options) { this.title = options.title }, onShow() { if (this.$store.getters.publicObj !== '') { this.currentData = this.$store.getters.publicObj - this.qty = this.currentData.qty } }, methods: { @@ -93,21 +117,84 @@ url: '/pages/manage/common/cxwl?title=查询物料' }) }, + addmater () { + this.validateMaterFrames() + this.dataList.push({mater_frame: null, qty: 0.000}) + }, + delItem (i) { + this.dataList.splice(i, 1) + this.validateMaterFrames() + }, toEmpty () { this.val1 = '' this.currentData = {} - this.qty = null + this.totalQty = null + this.dataList = [] this.disabled = false this.$store.dispatch('setPublicObj', '') }, + checkMaterFrame (index) { + const { mater_frame } = this.dataList[index] + if (!mater_frame) return + const isDuplicate = this.dataList.some((item, i) => i !== index && item.mater_frame === mater_frame) + if (isDuplicate) { + uni.showToast({ + title: '料框号重复', + icon: 'none' + }) + // 清空当前料框号 + this.dataList[index].mater_frame = '' + } + }, + checkQty (index) { + const { qty } = this.dataList[index] + if (qty < 0) { + uni.showToast({ + title: '数量必须为非负数', + icon: 'none' + }) + // 重置数量为0 + this.dataList[index].qty = 0.000 + } + }, + clearError(index) { + if (this.dataList[index].mater_frame) { + this.$refs.materFrameInputs[index].$el.style.borderColor = '' + } + }, + updateTotalQty() { + this.totalQty = this.dataList.reduce((total, item) => total + parseFloat(item.qty), 0) + }, + validateMaterFrames () { + let isValid = true + for (let i = 0; i < this.dataList.length; i++) { + if (!this.dataList[i].mater_frame) { + this.$refs.materFrameInputs[i].$el.style.borderColor = 'red' + this.scrollToView(this.$refs.materFrameInputs[i]) + isValid = false + } else { + this.$refs.materFrameInputs[i].$el.style.borderColor = '' + } + } + return isValid + }, + scrollToView (element) { + if (element) { + element.$el.scrollIntoView({ behavior: 'smooth', block: 'center' }) + } + }, async _groupPlate () { this.disabled = true - if (JSON.stringify(this.currentData) === '{}' || !this.val1 || !this.qty) { + if (JSON.stringify(this.currentData) === '{}' || !this.val1) { + this.disabled = false + return + } + if (!this.validateMaterFrames()) { this.disabled = false return } try { - let res = await groupPlate(this.currentData.material_id, this.qty, this.val1) + let res = await groupPlate(this.currentData.material_id, this.totalQty, this.val1, this.dataList) uni.showToast({ title: res.message, icon: 'none' @@ -122,5 +209,15 @@ } - diff --git a/pages/manage/zprk.vue b/pages/manage/zprk.vue index cf8231a..523d907 100644 --- a/pages/manage/zprk.vue +++ b/pages/manage/zprk.vue @@ -68,6 +68,24 @@ + + + + + + + + + + + + + + + +
料框号数量
{{e.mater_frame}}{{e.qty}}
+
+
@@ -93,7 +111,8 @@ options: [], index: '', disabled: false, - currentData: {} + currentData: {}, + dataList: [] }; }, onLoad (options) { @@ -128,11 +147,14 @@ let res = await getVehicleMaterial(e) if (res) { this.currentData = res + this.dataList = res.dtlList } else { this.currentData = {} + this.dataList = [] } } catch (e) { this.currentData = {} + this.dataList = [] } }, clearUp () { @@ -141,6 +163,7 @@ this.index = '' this.disabled = false this.currentData = {} + this.dataList = [] }, async _confirmIn () { this.disabled = true @@ -166,6 +189,11 @@ } - diff --git a/utils/getData.js b/utils/getData.js index 1cf2a92..882bc0e 100644 --- a/utils/getData.js +++ b/utils/getData.js @@ -44,9 +44,9 @@ export const getFloor = () => request({ }) // 物料组盘确认 -export const groupPlate = (mid, qty, vcode) => request({ +export const groupPlate = (mid, qty, vcode, dtlList) => request({ url:'api/pda/iosIn/groupPlate', - data: {material_id: mid, qty: qty, vehicle_code: vcode} + data: {material_id: mid, qty: qty, vehicle_code: vcode, dtlList: dtlList} }) // 定点确认 @@ -111,4 +111,25 @@ export const schPointBinding = (code, vcode, data) => request({ export const schPointDissect = (code, vcode, data) => request({ url:'/api/pda/schPoint/dissect', data: {struct_code: code, vehicle_code: vcode, data: data} +}) + +export const addTaskV2 = (Value, point1, point2) => request({ + url:'api/fms/addTaskV2', + data: { + TaskType: '任务11', + Params: [ + { + Key: 'TaskId', + Value: Value + }, + { + Key: 'point1', + Value: point1 + }, + { + Key: 'point2', + Value: point2 + } + ] + } }) \ No newline at end of file diff --git a/utils/mork.js b/utils/mork.js new file mode 100644 index 0000000..f060cc4 --- /dev/null +++ b/utils/mork.js @@ -0,0 +1,7 @@ +export const getMaterialList = (search, page, size) => { + let res = { + totalElements: 100, + content: [{material_name: '00001', material_spec: 'dfjlfjlf', material_code: 'aaaaa1', material_id: '1'}] + } + return res +} \ No newline at end of file