|
@@ -138,6 +138,7 @@
|
|
|
<el-select
|
|
<el-select
|
|
|
v-model="attributeData.deliveryMethod"
|
|
v-model="attributeData.deliveryMethod"
|
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
|
|
|
+ @change="changeMethod"
|
|
|
>
|
|
>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in deliveryMethodTypeList"
|
|
v-for="item in deliveryMethodTypeList"
|
|
@@ -388,13 +389,19 @@
|
|
|
v-if="item.isDemandQuantity && clientEnvironmentId != 2"
|
|
v-if="item.isDemandQuantity && clientEnvironmentId != 2"
|
|
|
style="width: 15%"
|
|
style="width: 15%"
|
|
|
>
|
|
>
|
|
|
- <span>数量</span
|
|
|
|
|
|
|
+ <!-- <span>数量</span
|
|
|
>{{
|
|
>{{
|
|
|
checkListLen == 0
|
|
checkListLen == 0
|
|
|
? item.demandQuantity
|
|
? item.demandQuantity
|
|
|
: item.count * (checkListLen || 1)
|
|
: item.count * (checkListLen || 1)
|
|
|
}}
|
|
}}
|
|
|
- {{ item.unit }}
|
|
|
|
|
|
|
+ {{ item.unit }} -->
|
|
|
|
|
+ <span>数量</span>
|
|
|
|
|
+ <input
|
|
|
|
|
+ style="width: 90% !important"
|
|
|
|
|
+ v-model="item.demandQuantity"
|
|
|
|
|
+ />
|
|
|
|
|
+ {{ item.measuringUnit }}
|
|
|
</div>
|
|
</div>
|
|
|
<div
|
|
<div
|
|
|
class="items content_num"
|
|
class="items content_num"
|
|
@@ -537,7 +544,7 @@
|
|
|
ref="pickOutRefs"
|
|
ref="pickOutRefs"
|
|
|
class="table_content"
|
|
class="table_content"
|
|
|
:max-height="600"
|
|
:max-height="600"
|
|
|
- :data="it.pickoutInList"
|
|
|
|
|
|
|
+ :data="it.pickOutInList"
|
|
|
tooltip-effect="dark"
|
|
tooltip-effect="dark"
|
|
|
style="width: 100%; margin-top: 10px"
|
|
style="width: 100%; margin-top: 10px"
|
|
|
stripe
|
|
stripe
|
|
@@ -878,6 +885,7 @@
|
|
|
} from '@/api/produce/index.js';
|
|
} from '@/api/produce/index.js';
|
|
|
import { contactList } from '@/api/produce/bom.js';
|
|
import { contactList } from '@/api/produce/bom.js';
|
|
|
import { tableHeader } from '@/utils/dict/common.js';
|
|
import { tableHeader } from '@/utils/dict/common.js';
|
|
|
|
|
+ import { batchOutsourcing } from '@/api/outsourcing';
|
|
|
|
|
|
|
|
import pickingList from './pickingList.vue';
|
|
import pickingList from './pickingList.vue';
|
|
|
import timeDialog from './timeDialog.vue';
|
|
import timeDialog from './timeDialog.vue';
|
|
@@ -1349,24 +1357,23 @@
|
|
|
|
|
|
|
|
const batchList = this.timeList
|
|
const batchList = this.timeList
|
|
|
.filter(
|
|
.filter(
|
|
|
- (b) => b.batchNo != '一次性到货' && Array.isArray(b.pickoutInList)
|
|
|
|
|
|
|
+ (b) => b.batchNo != '一次性到货' && Array.isArray(b.pickOutInList)
|
|
|
)
|
|
)
|
|
|
- .flatMap((b) => b.pickoutInList);
|
|
|
|
|
|
|
+ .flatMap((b) => b.pickOutInList);
|
|
|
|
|
|
|
|
const checkedList = [...this.pickOutInListSelect, ...batchList];
|
|
const checkedList = [...this.pickOutInListSelect, ...batchList];
|
|
|
const batchTimeList = this.timeList.filter(
|
|
const batchTimeList = this.timeList.filter(
|
|
|
(b) => b.batchNo != '一次性到货'
|
|
(b) => b.batchNo != '一次性到货'
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- console.log(checkedList, 'checkedListcheckedList');
|
|
|
|
|
-
|
|
|
|
|
this.$refs.timeDialogRef.open(
|
|
this.$refs.timeDialogRef.open(
|
|
|
this.attributeData,
|
|
this.attributeData,
|
|
|
null,
|
|
null,
|
|
|
false,
|
|
false,
|
|
|
checkedList,
|
|
checkedList,
|
|
|
this.workData.list[0],
|
|
this.workData.list[0],
|
|
|
- batchTimeList
|
|
|
|
|
|
|
+ batchTimeList,
|
|
|
|
|
+ this.pickOutInList
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -1374,7 +1381,21 @@
|
|
|
this.$emit('outScucc');
|
|
this.$emit('outScucc');
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- removeTab() {},
|
|
|
|
|
|
|
+ changeMethod(e) {
|
|
|
|
|
+ if (e == 1) {
|
|
|
|
|
+ this.timeList = [];
|
|
|
|
|
+ this.attributeData.formedNumLast = 0;
|
|
|
|
|
+ this.pickOutInListSelect = [];
|
|
|
|
|
+
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ if (this.$refs.pickOutRef) {
|
|
|
|
|
+ this.$refs.pickOutRef.clearSelection();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
async save() {
|
|
async save() {
|
|
|
const valid = await this.$refs.form.validate().catch(() => false);
|
|
const valid = await this.$refs.form.validate().catch(() => false);
|
|
@@ -1468,12 +1489,14 @@
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- this.timeList = clonedTimeList.map((item) => item);
|
|
|
|
|
-
|
|
|
|
|
- if (this.workData.list[0].singleReport == 1) {
|
|
|
|
|
|
|
+ if (
|
|
|
|
|
+ this.workData.list[0].singleReport == 1 ||
|
|
|
|
|
+ this.pickOutInList.length > 1
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.timeList = clonedTimeList.map((item) => item);
|
|
|
const selectedIds = new Set();
|
|
const selectedIds = new Set();
|
|
|
for (let item of this.timeList) {
|
|
for (let item of this.timeList) {
|
|
|
- for (let it of item.pickoutInList) {
|
|
|
|
|
|
|
+ for (let it of item.pickOutInList) {
|
|
|
selectedIds.add(it.id);
|
|
selectedIds.add(it.id);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1496,13 +1519,19 @@
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if (unassignedList.length > 0) {
|
|
if (unassignedList.length > 0) {
|
|
|
|
|
+ const number = unassignedList.reduce(
|
|
|
|
|
+ (sum, item) => sum + Number(item.feedQuantity || 0),
|
|
|
|
|
+ 0
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
const data = {
|
|
const data = {
|
|
|
batchNo: '一次性到货',
|
|
batchNo: '一次性到货',
|
|
|
requireDeliveryTime: null,
|
|
requireDeliveryTime: null,
|
|
|
- purchaseQuantity: unassignedList.length,
|
|
|
|
|
- pickoutInList: unassignedList,
|
|
|
|
|
|
|
+ purchaseQuantity: number,
|
|
|
|
|
+ pickOutInList: unassignedList,
|
|
|
bomMaterialList: [],
|
|
bomMaterialList: [],
|
|
|
- standardOutputList: []
|
|
|
|
|
|
|
+ standardOutputList: [],
|
|
|
|
|
+ isParent: 1
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const exists = this.timeList.some((t) => t.batchNo == '一次性到货');
|
|
const exists = this.timeList.some((t) => t.batchNo == '一次性到货');
|
|
@@ -1558,8 +1587,110 @@
|
|
|
this.timeList[0].innerActive = '0';
|
|
this.timeList[0].innerActive = '0';
|
|
|
this.activeBatch = this.timeList[0].batchNo;
|
|
this.activeBatch = this.timeList[0].batchNo;
|
|
|
this.pickOutInListSelect = [];
|
|
this.pickOutInListSelect = [];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (this.pickOutInList.length == 1) {
|
|
|
|
|
+ this.timeList = clonedTimeList.map((item) => {
|
|
|
|
|
+ item.pickOutInList = [this.deepCopy(this.pickOutInListSelect[0])];
|
|
|
|
|
|
|
|
- console.log(this.timeList, '8285');
|
|
|
|
|
|
|
+ return item;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ this.attributeData.formedNumLast = this.timeList.reduce(
|
|
|
|
|
+ (acc, pro) => {
|
|
|
|
|
+ const num = parseFloat(pro.purchaseQuantity);
|
|
|
|
|
+ return acc + (isNaN(num) ? 0 : num);
|
|
|
|
|
+ },
|
|
|
|
|
+ 0
|
|
|
|
|
+ );
|
|
|
|
|
+ const totalNum = this.pickOutInList.reduce(
|
|
|
|
|
+ (sum, item) => sum + Number(item.feedQuantity || 0),
|
|
|
|
|
+ 0
|
|
|
|
|
+ );
|
|
|
|
|
+ const batchNum = this.timeList.reduce(
|
|
|
|
|
+ (sum, item) => sum + Number(item.purchaseQuantity || 0),
|
|
|
|
|
+ 0
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ let singleWeight = 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (
|
|
|
|
|
+ this.pickOutInList[0].newWeight ||
|
|
|
|
|
+ this.pickOutInList[0].newWeight == 0
|
|
|
|
|
+ ) {
|
|
|
|
|
+ singleWeight = this.div(
|
|
|
|
|
+ this.pickOutInList[0].newWeight,
|
|
|
|
|
+ totalNum
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ const remainderNum = this.sub(totalNum, batchNum);
|
|
|
|
|
+ if (remainderNum != 0) {
|
|
|
|
|
+ const data = {
|
|
|
|
|
+ batchNo: '一次性到货',
|
|
|
|
|
+ requireDeliveryTime: null,
|
|
|
|
|
+ purchaseQuantity: remainderNum,
|
|
|
|
|
+ pickOutInList: [this.deepCopy(this.pickOutInListSelect[0])],
|
|
|
|
|
+ bomMaterialList: [],
|
|
|
|
|
+ standardOutputList: [],
|
|
|
|
|
+ isParent: 1
|
|
|
|
|
+ };
|
|
|
|
|
+ const exists = this.timeList.some(
|
|
|
|
|
+ (t) => t.batchNo == '一次性到货'
|
|
|
|
|
+ );
|
|
|
|
|
+ if (!exists) {
|
|
|
|
|
+ this.timeList.unshift(data);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const index = this.timeList.findIndex(
|
|
|
|
|
+ (t) => t.batchNo == '一次性到货'
|
|
|
|
|
+ );
|
|
|
|
|
+ this.timeList.splice(index, 1, data);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.bomMaterialList.length != 0) {
|
|
|
|
|
+ for (let item of this.bomMaterialList) {
|
|
|
|
|
+ for (let it of this.timeList) {
|
|
|
|
|
+ const proportion = this.div(it.purchaseQuantity, totalNum);
|
|
|
|
|
+ const allocatedQuantity = this.mul(
|
|
|
|
|
+ proportion,
|
|
|
|
|
+ item.demandQuantity
|
|
|
|
|
+ );
|
|
|
|
|
+ const materialItem = {
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ demandQuantity: allocatedQuantity
|
|
|
|
|
+ };
|
|
|
|
|
+ it.bomMaterialList.push(materialItem);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.standardOutputList.length != 0) {
|
|
|
|
|
+ for (let item of this.standardOutputList) {
|
|
|
|
|
+ for (let it of this.timeList) {
|
|
|
|
|
+ const proportion = this.div(it.purchaseQuantity, totalNum);
|
|
|
|
|
+ const allocatedQuantity = this.mul(
|
|
|
|
|
+ proportion,
|
|
|
|
|
+ item.demandQuantity
|
|
|
|
|
+ );
|
|
|
|
|
+ const materialItem = {
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ demandQuantity: allocatedQuantity
|
|
|
|
|
+ };
|
|
|
|
|
+ it.standardOutputList.push(materialItem);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.timeList = this.timeList.map((it) => {
|
|
|
|
|
+ it.pickOutInList.forEach((item) => {
|
|
|
|
|
+ item.feedQuantity = it.purchaseQuantity;
|
|
|
|
|
+ item.newWeight = this.mul(singleWeight, it.purchaseQuantity);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ return it;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ this.timeList[0].innerActive = '0';
|
|
|
|
|
+ this.activeBatch = this.timeList[0].batchNo;
|
|
|
|
|
+ this.pickOutInListSelect = [];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|