|
|
@@ -522,45 +522,97 @@
|
|
|
// }
|
|
|
},
|
|
|
|
|
|
+ // changeInput(item, index) {
|
|
|
+ // if (Number(item.demandQuantity) >= Number(item.availableCountBase)) {
|
|
|
+ // this.$set(
|
|
|
+ // this.workList[0].pickList[index],
|
|
|
+ // 'demandQuantity',
|
|
|
+ // Number(item.availableCountBase)
|
|
|
+ // );
|
|
|
+ // const idsList = [];
|
|
|
+ // item.warehouseList.forEach((it) => {
|
|
|
+ // idsList.push(it.warehouse_id);
|
|
|
+ // });
|
|
|
+ // this.$set(
|
|
|
+ // this.workList[0].pickList[index],
|
|
|
+ // 'warehouseIdList',
|
|
|
+ // idsList
|
|
|
+ // );
|
|
|
+ // } else if (!Number(item.demandQuantity)) {
|
|
|
+ // this.$set(this.workList[0].pickList[index], 'warehouseIdList', []);
|
|
|
+ // } else {
|
|
|
+ // const idsList = [];
|
|
|
+ // let totalNum = 0;
|
|
|
+
|
|
|
+ // for (let i = 0; i < item.warehouseList.length; i++) {
|
|
|
+ // totalNum += Number(item.warehouseList[i].availableCountBase);
|
|
|
+
|
|
|
+ // if (Number(item.demandQuantity) > totalNum) {
|
|
|
+ // idsList.push(item.warehouseList[i].warehouse_id);
|
|
|
+ // } else {
|
|
|
+ // idsList.push(item.warehouseList[i].warehouse_id);
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // this.$set(
|
|
|
+ // this.workList[0].pickList[index],
|
|
|
+ // 'warehouseIdList',
|
|
|
+ // idsList
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+
|
|
|
changeInput(item, index) {
|
|
|
- if (Number(item.demandQuantity) >= Number(item.availableCountBase)) {
|
|
|
- this.$set(
|
|
|
- this.workList[0].pickList[index],
|
|
|
- 'demandQuantity',
|
|
|
- Number(item.availableCountBase)
|
|
|
- );
|
|
|
- const idsList = [];
|
|
|
- item.warehouseList.forEach((it) => {
|
|
|
- idsList.push(it.warehouse_id);
|
|
|
- });
|
|
|
- this.$set(
|
|
|
- this.workList[0].pickList[index],
|
|
|
- 'warehouseIdList',
|
|
|
- idsList
|
|
|
- );
|
|
|
- } else if (!Number(item.demandQuantity)) {
|
|
|
- this.$set(this.workList[0].pickList[index], 'warehouseIdList', []);
|
|
|
- } else {
|
|
|
- const idsList = [];
|
|
|
- let totalNum = 0;
|
|
|
+ const pickItem = this.workList[0].pickList[index];
|
|
|
|
|
|
- for (let i = 0; i < item.warehouseList.length; i++) {
|
|
|
- totalNum += Number(item.warehouseList[i].availableCountBase);
|
|
|
+ let value = String(item.demandQuantity ?? '');
|
|
|
|
|
|
- if (Number(item.demandQuantity) > totalNum) {
|
|
|
- idsList.push(item.warehouseList[i].warehouse_id);
|
|
|
- } else {
|
|
|
- idsList.push(item.warehouseList[i].warehouse_id);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ value = value.replace(/[^\d.]/g, '');
|
|
|
+
|
|
|
+ value = value
|
|
|
+ .replace(/\.{2,}/g, '.')
|
|
|
+ .replace('.', '$#$')
|
|
|
+ .replace(/\./g, '')
|
|
|
+ .replace('$#$', '.');
|
|
|
+
|
|
|
+ if (value.includes('.')) {
|
|
|
+ const [intPart, decPart] = value.split('.');
|
|
|
+ value = `${intPart}.${decPart.slice(0, 4)}`;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$set(pickItem, 'demandQuantity', value);
|
|
|
+
|
|
|
+ const demandQty = Number(value);
|
|
|
+ const maxQty = Number(item.availableCountBase) || 0;
|
|
|
+
|
|
|
+ if (!demandQty) {
|
|
|
+ this.$set(pickItem, 'warehouseIdList', []);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (demandQty >= maxQty) {
|
|
|
+ this.$set(pickItem, 'demandQuantity', maxQty);
|
|
|
|
|
|
this.$set(
|
|
|
- this.workList[0].pickList[index],
|
|
|
+ pickItem,
|
|
|
'warehouseIdList',
|
|
|
- idsList
|
|
|
+ item.warehouseList.map((w) => w.warehouse_id)
|
|
|
);
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
+ let total = 0;
|
|
|
+ const idsList = [];
|
|
|
+
|
|
|
+ for (const w of item.warehouseList) {
|
|
|
+ total += Number(w.availableCountBase) || 0;
|
|
|
+ idsList.push(w.warehouse_id);
|
|
|
+
|
|
|
+ if (total >= demandQty) break;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$set(pickItem, 'warehouseIdList', idsList);
|
|
|
},
|
|
|
|
|
|
detailData(data, dimension, index) {
|
|
|
@@ -678,7 +730,6 @@
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
- console.log('cashasisasa', res);
|
|
|
},
|
|
|
|
|
|
async getOrderCode() {
|