diff --git a/pages/common/mater-list.vue b/pages/common/mater-list.vue
index be3ea43..e318ca3 100644
--- a/pages/common/mater-list.vue
+++ b/pages/common/mater-list.vue
@@ -61,7 +61,7 @@
title: '',
val1: '',
dataList: [],
- // dataList: [{material_name: 'name1', checked: false, qty:1, pcsn:'p001'},{material_name: 'name2', checked: false},{material_name: 'name3', checked: false}],
+ // dataList: [{material_id: 'n1', material_name: 'name1', checked: false, qty:1, pcsn:'p001'},{material_id: 'n2', material_name: 'name2', qty:2, checked: false},{material_id: 'n3', material_name: 'name3', qty:1, checked: false}],
pkId: '',
pkObj: {},
allCheck: false,
@@ -92,10 +92,10 @@
e.qty = e.qty.replace(/^0+/, '') || '0'
}
} else {
- uni.showToast({
- title: '数量必填',
- icon: 'none'
- })
+ // uni.showToast({
+ // title: '数量必填',
+ // icon: 'none'
+ // })
}
},
searchList () {
@@ -154,16 +154,8 @@
if (!this.checkedArr.length) {
return
}
- const allValid = this.checkedArr.every(item => item.qty !== '');
- if (allValid) {
- this.$store.dispatch('setPublicArr', this.checkedArr)
- uni.navigateBack()
- } else {
- uni.showToast({
- title: '数量必填',
- icon: 'none'
- })
- }
+ this.$store.dispatch('setPublicArr', this.checkedArr)
+ uni.navigateBack()
}
}
}
diff --git a/pages/entry/groupplate-instore.vue b/pages/entry/groupplate-instore.vue
index f171ee2..7aee03a 100644
--- a/pages/entry/groupplate-instore.vue
+++ b/pages/entry/groupplate-instore.vue
@@ -4,6 +4,16 @@
+
+
+ 站点信息
+
+
+
+
+
载具编码
@@ -49,7 +59,7 @@
-
+
@@ -67,6 +77,7 @@
return {
title: '',
val1: '',
+ val2: '',
// options: [{text:'堆叠托盘', value:'11111111'},{text:'料箱',value: '22222222'},{text:'白色EPH',value: '33333333'}],
options: [],
index: '',
@@ -105,7 +116,7 @@
try {
let res = await getVehicleMaterial(this.val1, this.val2, this.index)
if (res) {
- this.dataList = res.data
+ this.dataList = res
} else {
this.dataList = []
}
@@ -115,18 +126,19 @@
},
clearUp () {
this.val1 = ''
+ this.val2 = ''
this.index = ''
this.disabled = false
this.dataList = []
},
async _confirmIn () {
this.disabled = true
- if (!this.val1 || !this.index) {
+ if (!this.val1 || !this.val2 || !this.index) {
this.disabled = false
return
}
try {
- let res = await confirmIn(this.val1, this.index)
+ let res = await confirmIn(this.val1, this.val2, this.index)
if (res.code === '200') {
uni.showToast({
title: res.message,
diff --git a/pages/entry/mater-group.vue b/pages/entry/mater-group.vue
index 63e3b2c..daca5fd 100644
--- a/pages/entry/mater-group.vue
+++ b/pages/entry/mater-group.vue
@@ -44,7 +44,8 @@
| {{e.material_name}} |
{{e.material_code}} |
- {{e.qty}} |
+
+ |
{{e.pcsn}} |
@@ -78,6 +79,7 @@
val3: '',
wlxxtext: '',
dataList: [],
+ curList: [],
disabled: false
};
},
@@ -86,10 +88,56 @@
},
onShow() {
if (this.$store.getters.publicArr.length) {
- this.dataList = this.$store.getters.publicArr
+ // this.dataList = [...this.dataList, ...this.$store.getters.publicArr]
+ this.dataList = this.mergeArrays(this.dataList, this.$store.getters.publicArr)
}
},
methods: {
+ mergeArrays (arr1, arr2) {
+ // 创建Map存储结果,以material_id为键
+ const resultMap = new Map();
+
+ // 先添加arr1的所有记录
+ arr1.forEach(item => {
+ resultMap.set(item.material_id, { ...item });
+ });
+
+ // 合并arr2的记录
+ arr2.forEach(item => {
+ const materialId = item.material_id;
+ if (resultMap.has(materialId)) {
+ // 存在相同material_id:更新qty为arr2的值
+ const existing = resultMap.get(materialId);
+ resultMap.set(materialId, {
+ ...existing, // 保留原有字段
+ qty: item.qty, // 使用arr2的qty值
+ // 如果arr2有pcsn则更新,否则保留原来的pcsn
+ ...(item.pcsn !== undefined && { pcsn: item.pcsn })
+ });
+ } else {
+ // 不存在相同material_id:直接添加新记录
+ resultMap.set(materialId, { ...item });
+ }
+ });
+
+ // 将Map的值转为数组
+ return Array.from(resultMap.values());
+ },
+ handleBlur (e) {
+ if (e.qty) {
+ if (e.qty < 0) {
+ e.qty = 0
+ } else {
+ e.qty = e.qty.replace(/[^0-9]/g, '')
+ e.qty = e.qty.replace(/^0+/, '') || '0'
+ }
+ } else {
+ // uni.showToast({
+ // title: '数量必填',
+ // icon: 'none'
+ // })
+ }
+ },
toJump () {
uni.navigateTo({
url: '/pages/common/mater-list?title=查询物料'
@@ -107,6 +155,17 @@
this.disabled = false
return
}
+ let allValid = this.dataList.every(item => item.qty !== '');
+ console.log(allValid, 666)
+ console.log(this.dataList, 666)
+ if (!allValid) {
+ uni.showToast({
+ title: '数量必填',
+ icon: 'none'
+ })
+ this.disabled = false
+ return
+ }
try {
let res = await groupPlate(this.dataList, this.val2, this.val1)
if (res.code === '200') {