|
|
@@ -2,7 +2,7 @@
|
|
|
<!-- 委外下一步 -->
|
|
|
<div class="card">
|
|
|
<div class="c_header_title">
|
|
|
- <div class="c_title">委外记录</div>
|
|
|
+ <div class="c_title">委外请托</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="card_box">
|
|
|
@@ -190,7 +190,7 @@
|
|
|
</el-descriptions-item> -->
|
|
|
<!-- </el-descriptions> -->
|
|
|
|
|
|
- <el-tabs v-model="activeName">
|
|
|
+ <el-tabs v-model="activeName" v-if="timeList.length == 0">
|
|
|
<el-tab-pane label="物品清单" name="0">
|
|
|
<div class="materialList">
|
|
|
<div class="u-reset">
|
|
|
@@ -521,6 +521,316 @@
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
|
|
|
+ <el-tabs v-model="activeBatch" v-else type="card">
|
|
|
+ <el-tab-pane
|
|
|
+ v-for="(it, index) in timeList"
|
|
|
+ :key="it.batchNo"
|
|
|
+ :label="it.batchNo"
|
|
|
+ :name="it.batchNo"
|
|
|
+ >
|
|
|
+ <!-- 内层 Tabs(物品/带料/产出) -->
|
|
|
+ <el-tabs v-model="it.innerActive" type="border-card">
|
|
|
+ <!-- 物品清单 -->
|
|
|
+ <el-tab-pane label="物品清单" name="0">
|
|
|
+ <div class="materialList">
|
|
|
+ <el-table
|
|
|
+ ref="pickOutRefs"
|
|
|
+ class="table_content"
|
|
|
+ :max-height="600"
|
|
|
+ :data="it.pickoutInList"
|
|
|
+ tooltip-effect="dark"
|
|
|
+ style="width: 100%; margin-top: 10px"
|
|
|
+ stripe
|
|
|
+ border
|
|
|
+ @selection-change="selectionPickOut"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ align="center"
|
|
|
+ type="selection"
|
|
|
+ width="55"
|
|
|
+ v-if="it.batchNo == '一次性到货'"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="序号" type="index" width="55">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ $index + 1 }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="编码"
|
|
|
+ type="code"
|
|
|
+ minWidth="110"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ row.categoryCode }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="名称"
|
|
|
+ type="name"
|
|
|
+ minWidth="110"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ row.name }}
|
|
|
+ <!-- ({{
|
|
|
+ row.rootCategoryLevelId == 2
|
|
|
+ ? '在制品'
|
|
|
+ : row.rootCategoryLevelId == 23
|
|
|
+ ? '半成品'
|
|
|
+ : row.rootCategoryLevelId == 9
|
|
|
+ ? '产品'
|
|
|
+ : item.rootCategoryLevelId == 28
|
|
|
+ ? '废品'
|
|
|
+ : ''
|
|
|
+ }}) -->
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="型号"
|
|
|
+ type="modelType"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ row.modelType }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="规格"
|
|
|
+ type="specification"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ row.specification }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="牌号"
|
|
|
+ type="brandNum"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ row.brandNum }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="数量"
|
|
|
+ type="feedQuantity"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ <el-input
|
|
|
+ v-model="row.feedQuantity"
|
|
|
+ v-if="row.isSelection == '1'"
|
|
|
+ @input="inputNum(row, $index)"
|
|
|
+ ></el-input>
|
|
|
+ <span v-else> {{ row.feedQuantity }}</span>
|
|
|
+ </template>
|
|
|
+ <!-- <template slot-scope="{ row, $index }" v-else>
|
|
|
+ {{ row.feedQuantity }}
|
|
|
+ </template> -->
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="重量"
|
|
|
+ type="weightUnit"
|
|
|
+ width="120"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ row.newWeight || 0 }} {{ row.weightUnit }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="刻码"
|
|
|
+ type="engrave"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ row.extInfo.engrave }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="物料代号"
|
|
|
+ type="materielCode"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ row.extInfo.materielCode }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="客户代号"
|
|
|
+ type="clientCode"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ {{ row.extInfo.clientCode }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+
|
|
|
+ <el-tab-pane label="带料清单" name="1">
|
|
|
+ <div class="materialList">
|
|
|
+ <div v-for="(item, index) in it.bomMaterialList" :key="index">
|
|
|
+ <label class="listBox rx-bs">
|
|
|
+ <div class="listBox-con">
|
|
|
+ <div class="listBox-bottom rx">
|
|
|
+ <div class="items">
|
|
|
+ <span>序号</span>{{ index + 1 }}
|
|
|
+ </div>
|
|
|
+ <div class="items" :title="item.name">
|
|
|
+ <span>名称</span>{{ item.name }}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="items" :title="item.code">
|
|
|
+ <span>编码</span>{{ item.code }}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div
|
|
|
+ v-for="(itm, index) in tableH(item.rootCategoryLevelId)"
|
|
|
+ :key="index"
|
|
|
+ class="items"
|
|
|
+ v-if="!itm.formatter"
|
|
|
+ >
|
|
|
+ <span>{{ itm.label }}</span
|
|
|
+ >{{ item[itm.prop] }}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div
|
|
|
+ class="items"
|
|
|
+ v-if="item.isDemandQuantity && clientEnvironmentId != 2"
|
|
|
+ style="width: 15%"
|
|
|
+ >
|
|
|
+ <span>数量</span
|
|
|
+ >{{
|
|
|
+ checkListLen == 0
|
|
|
+ ? item.demandQuantity
|
|
|
+ : item.count * (checkListLen || 1)
|
|
|
+ }}
|
|
|
+ {{ item.unit }}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="items content_num"
|
|
|
+ v-if="
|
|
|
+ !item.isDemandQuantity && clientEnvironmentId != 2
|
|
|
+ "
|
|
|
+ style="width: 15%"
|
|
|
+ >
|
|
|
+ <span>数量</span>
|
|
|
+ <!-- <input
|
|
|
+ style="width: 90% !important"
|
|
|
+ v-model="item.demandQuantity"
|
|
|
+ disabled
|
|
|
+ /> -->
|
|
|
+ {{ item.demandQuantity }}
|
|
|
+ {{ item.measuringUnit }}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div
|
|
|
+ class="items"
|
|
|
+ v-if="item.isDemandQuantity && clientEnvironmentId == 2"
|
|
|
+ style="width: 15%"
|
|
|
+ >
|
|
|
+ <span>数量</span
|
|
|
+ >{{ item.count * (outObj.formedNumLast || 1) }}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="items content_num"
|
|
|
+ v-if="
|
|
|
+ !item.isDemandQuantity && clientEnvironmentId == 2
|
|
|
+ "
|
|
|
+ style="width: 15%"
|
|
|
+ >
|
|
|
+ <span>数量</span>
|
|
|
+ <!-- <input
|
|
|
+ style="width: 90% !important"
|
|
|
+ v-model="item.demandQuantity"
|
|
|
+ disabled
|
|
|
+ /> -->
|
|
|
+ {{ item.demandQuantity }}
|
|
|
+ {{ item.measuringUnit }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+
|
|
|
+ <el-tab-pane label="产出清单" name="2">
|
|
|
+ <div class="materialList">
|
|
|
+ <div class="u-reset"> </div>
|
|
|
+ <div v-for="(item, index) in it.standardOutputList" :key="index">
|
|
|
+ <label class="listBox rx-bs">
|
|
|
+ <div class="listBox-con">
|
|
|
+ <div class="listBox-bottom rx">
|
|
|
+ <div class="items" style="width: 15%">
|
|
|
+ <span>序号</span>{{ index + 1 }}
|
|
|
+ </div>
|
|
|
+ <div class="items">
|
|
|
+ <span>名称</span>{{ item.name }}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="items">
|
|
|
+ <span>编码</span>{{ item.code }}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div
|
|
|
+ v-for="(itm, index) in tableH(item.rootCategoryLevelId)"
|
|
|
+ :key="index"
|
|
|
+ class="items"
|
|
|
+ v-if="!itm.formatter"
|
|
|
+ >
|
|
|
+ <span>{{ itm.label }}</span
|
|
|
+ >{{ item[itm.prop] }}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="items">
|
|
|
+ <span>数量</span>
|
|
|
+ <!-- <input
|
|
|
+ style="width: 30% !important"
|
|
|
+ v-model="item.demandQuantity"
|
|
|
+ disabled
|
|
|
+ /> -->
|
|
|
+ {{ item.demandQuantity }}
|
|
|
+ {{ item.measuringUnit }}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div
|
|
|
+ class="items"
|
|
|
+ v-if="item.isSelection && item.isSelection == '1'"
|
|
|
+ >
|
|
|
+ <span>产出工序</span>
|
|
|
+ <el-select v-model="item.taskId" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in outObj.taskDataList"
|
|
|
+ :key="item.taskId"
|
|
|
+ :label="item.taskTypeName"
|
|
|
+ :value="item.taskId"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+
|
|
|
<div class="operate_box" v-if="isInfo">
|
|
|
<el-button
|
|
|
size="small"
|
|
|
@@ -686,7 +996,12 @@
|
|
|
value: 2
|
|
|
}
|
|
|
],
|
|
|
- isInfo: false
|
|
|
+ isInfo: false,
|
|
|
+
|
|
|
+ activeBatch: '',
|
|
|
+
|
|
|
+ defaultInnerActive: '0',
|
|
|
+ outsourcedQuantity: ''
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -852,34 +1167,6 @@
|
|
|
|
|
|
this.changNumber(this.pickOutInList);
|
|
|
|
|
|
- // let param = {
|
|
|
- // taskId: this.outObj.taskId,
|
|
|
- // taskIds: this.outObj.taskIds,
|
|
|
- // workOrderId: this.outObj.workOrderId
|
|
|
-
|
|
|
- // }
|
|
|
- // checkOutsourceMaterial(param).then(res => {
|
|
|
-
|
|
|
- // let _arr = []
|
|
|
- // _arr = [...res.pickOutInList, ...res.materialList]
|
|
|
- // this.pickOutInList = _arr.reduce((acc, item) => {
|
|
|
- // const existingItem = acc.find(existing => existing.id === item.id);
|
|
|
- // if (!existingItem) {
|
|
|
- // acc.push(item);
|
|
|
- // }
|
|
|
- // return acc;
|
|
|
- // }, []);
|
|
|
-
|
|
|
- // this.bomMaterialList = res.bomMaterialList.map((m) => {
|
|
|
- // return {
|
|
|
- // ...m,
|
|
|
- // isDemandQuantity: true
|
|
|
-
|
|
|
- // }
|
|
|
- // })
|
|
|
- // this.standardOutputList = res.standardOutputList
|
|
|
- // this.$forceUpdate()
|
|
|
- // })
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.pickOutRef.toggleAllSelection();
|
|
|
});
|
|
|
@@ -887,7 +1174,9 @@
|
|
|
|
|
|
changNumber(list) {
|
|
|
let total = 0;
|
|
|
- if (list && list.length != 0) {
|
|
|
+ let batchTotal = 0;
|
|
|
+
|
|
|
+ if (list && list.length !== 0) {
|
|
|
total = list.reduce(
|
|
|
(acc, pro) =>
|
|
|
acc + (pro.checked ? Number(pro.feedQuantity || 0) : 0),
|
|
|
@@ -895,15 +1184,25 @@
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- this.attributeData.formedNumLast = total;
|
|
|
+ if (this.timeList.length !== 0) {
|
|
|
+ for (let item of this.timeList) {
|
|
|
+ if (item.batchNo !== '一次性到货') {
|
|
|
+ batchTotal += Number(item.purchaseQuantity || 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.attributeData.formedNumLast = total + batchTotal;
|
|
|
},
|
|
|
|
|
|
handleRowSelect(selection, row) {
|
|
|
- this.changNumber(selection);
|
|
|
+ // console.log(selection, 'handleRowSelect');
|
|
|
+ // this.changNumber(selection);
|
|
|
},
|
|
|
|
|
|
handleSelectAll(selection) {
|
|
|
- this.changNumber(selection);
|
|
|
+ // console.log(selection, 'handleSelectAll');
|
|
|
+ // this.changNumber(selection);
|
|
|
},
|
|
|
|
|
|
inputNum(item, index) {
|
|
|
@@ -944,43 +1243,7 @@
|
|
|
tableH(type) {
|
|
|
return tableHeader(type);
|
|
|
},
|
|
|
- //勾选
|
|
|
- selectVal(e, val, index) {
|
|
|
- this.$forceUpdate();
|
|
|
- this.pickOutInList[index] = val;
|
|
|
- this.$set(this, 'pickOutInList', this.pickOutInList);
|
|
|
-
|
|
|
- this.checkListLen = this.pickOutInList.filter(
|
|
|
- (f) => f.checked == true
|
|
|
- ).length;
|
|
|
- },
|
|
|
-
|
|
|
- _seletedAll() {
|
|
|
- console.log(this.seletedAll, this.pickOutInList, 'this.seletedAll');
|
|
|
- // this.seletedAll true 是全选
|
|
|
|
|
|
- if (!this.seletedAll) {
|
|
|
- // 非全选
|
|
|
- this.seletedAll = true;
|
|
|
- this.checkListLen = 0;
|
|
|
-
|
|
|
- this.pickOutInList.map((item) => {
|
|
|
- item.checked = false;
|
|
|
- });
|
|
|
-
|
|
|
- this.$set(this, 'pickOutInList', this.pickOutInList);
|
|
|
- } else {
|
|
|
- this.seletedAll = false;
|
|
|
-
|
|
|
- this.pickOutInList.map((item) => {
|
|
|
- item.checked = true;
|
|
|
- });
|
|
|
- this.$set(this, 'pickOutInList', this.pickOutInList);
|
|
|
- }
|
|
|
- this.checkListLen = this.pickOutInList.filter(
|
|
|
- (f) => f.checked == true
|
|
|
- ).length;
|
|
|
- },
|
|
|
selectionPickOut(val) {
|
|
|
this.pickOutInListSelect = val;
|
|
|
this.changNumber(val);
|
|
|
@@ -1077,35 +1340,46 @@
|
|
|
},
|
|
|
|
|
|
setBatchTime() {
|
|
|
- if (this.pickOutInList.length == 0) {
|
|
|
+ if (!this.pickOutInList.length) {
|
|
|
return this.$message.warning('请先添加物料清单!');
|
|
|
}
|
|
|
-
|
|
|
- if (this.attributeData.formedNumLast == 0) {
|
|
|
+ if (!this.pickOutInListSelect.length) {
|
|
|
return this.$message.warning('请先勾选需要分批物料清单');
|
|
|
}
|
|
|
|
|
|
- const checkedList = this.pickOutInList.filter((item) => item.checked);
|
|
|
+ const batchList = this.timeList
|
|
|
+ .filter(
|
|
|
+ (b) => b.batchNo != '一次性到货' && Array.isArray(b.pickoutInList)
|
|
|
+ )
|
|
|
+ .flatMap((b) => b.pickoutInList);
|
|
|
+
|
|
|
+ const checkedList = [...this.pickOutInListSelect, ...batchList];
|
|
|
+ const batchTimeList = this.timeList.filter(
|
|
|
+ (b) => b.batchNo != '一次性到货'
|
|
|
+ );
|
|
|
+
|
|
|
+ console.log(checkedList, 'checkedListcheckedList');
|
|
|
|
|
|
this.$refs.timeDialogRef.open(
|
|
|
this.attributeData,
|
|
|
null,
|
|
|
false,
|
|
|
checkedList,
|
|
|
- this.workData.list[0]
|
|
|
+ this.workData.list[0],
|
|
|
+ batchTimeList
|
|
|
);
|
|
|
- // this.$refs.timeDialogRef.open(this.attributeData, null, false);
|
|
|
},
|
|
|
|
|
|
cancel() {
|
|
|
this.$emit('outScucc');
|
|
|
},
|
|
|
|
|
|
+ removeTab() {},
|
|
|
+
|
|
|
async save() {
|
|
|
const valid = await this.$refs.form.validate().catch(() => false);
|
|
|
if (!valid) return;
|
|
|
|
|
|
- // chooseType = 1 的处理
|
|
|
if (this.chooseType == '1') {
|
|
|
if (this.attributeData.supplierId) {
|
|
|
const obj = this.gysList.find(
|
|
|
@@ -1114,7 +1388,6 @@
|
|
|
this.attributeData.supplierName = obj ? obj.name : '';
|
|
|
}
|
|
|
|
|
|
- // 先清空,避免多次打开叠加
|
|
|
this.attributeData.taskDataList = [];
|
|
|
|
|
|
this.attributeData.taskIdes.forEach((it) => {
|
|
|
@@ -1129,12 +1402,11 @@
|
|
|
taskId: this.attributeData.taskId,
|
|
|
taskIds: this.attributeData.taskIds,
|
|
|
workOrderId: this.attributeData.workOrderId,
|
|
|
- quantity: this.attributeData.formedNumLast
|
|
|
+ quantity: this.attributeData.formedNumLast || 0
|
|
|
};
|
|
|
|
|
|
const res = await checkOutsourceMaterial(req);
|
|
|
|
|
|
- // pickOutInList
|
|
|
this.outObj = this.deepCopy({ ...res.data, ...this.attributeData });
|
|
|
|
|
|
if (this.outObj.pickOutInList.length == 0) {
|
|
|
@@ -1143,7 +1415,6 @@
|
|
|
|
|
|
this.outsourceMaterialFn(this.outObj);
|
|
|
|
|
|
- console.log(this.outObj, 'this.outObjthis.outObj');
|
|
|
this.isInfo = true;
|
|
|
},
|
|
|
|
|
|
@@ -1183,7 +1454,162 @@
|
|
|
},
|
|
|
|
|
|
chooseTime(current, clonedTimeList, currentIndex) {
|
|
|
- this.timeList = clonedTimeList;
|
|
|
+ if (clonedTimeList.length === 0) {
|
|
|
+ this.timeList = [];
|
|
|
+ this.attributeData.formedNumLast = 0;
|
|
|
+ this.pickOutInListSelect = [];
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.$refs.pickOutRef) {
|
|
|
+ this.$refs.pickOutRef.clearSelection();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.timeList = clonedTimeList.map((item) => item);
|
|
|
+
|
|
|
+ if (this.workData.list[0].singleReport == 1) {
|
|
|
+ const selectedIds = new Set();
|
|
|
+ for (let item of this.timeList) {
|
|
|
+ for (let it of item.pickoutInList) {
|
|
|
+ selectedIds.add(it.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.attributeData.formedNumLast = this.timeList.reduce(
|
|
|
+ (acc, pro) => {
|
|
|
+ const num = parseFloat(pro.purchaseQuantity);
|
|
|
+ return acc + (isNaN(num) ? 0 : num);
|
|
|
+ },
|
|
|
+ 0
|
|
|
+ );
|
|
|
+
|
|
|
+ const unassignedList = this.pickOutInList.filter(
|
|
|
+ (item) => !selectedIds.has(item.id)
|
|
|
+ );
|
|
|
+
|
|
|
+ const totalNum = this.pickOutInList.reduce(
|
|
|
+ (sum, item) => sum + Number(item.feedQuantity || 0),
|
|
|
+ 0
|
|
|
+ );
|
|
|
+
|
|
|
+ if (unassignedList.length > 0) {
|
|
|
+ const data = {
|
|
|
+ batchNo: '一次性到货',
|
|
|
+ requireDeliveryTime: null,
|
|
|
+ purchaseQuantity: unassignedList.length,
|
|
|
+ pickoutInList: unassignedList,
|
|
|
+ bomMaterialList: [],
|
|
|
+ standardOutputList: []
|
|
|
+ };
|
|
|
+
|
|
|
+ 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[0].innerActive = '0';
|
|
|
+ this.activeBatch = this.timeList[0].batchNo;
|
|
|
+ this.pickOutInListSelect = [];
|
|
|
+
|
|
|
+ console.log(this.timeList, '8285');
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ getDecimalLength(num) {
|
|
|
+ return (num.toString().split('.')[1] || '').length;
|
|
|
+ },
|
|
|
+
|
|
|
+ toInteger(num) {
|
|
|
+ const len = this.getDecimalLength(num);
|
|
|
+ return {
|
|
|
+ int: Math.round(num * Math.pow(10, len)),
|
|
|
+ factor: Math.pow(10, len)
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ add(a, b) {
|
|
|
+ const { int: aInt, factor: aFactor } = this.toInteger(a);
|
|
|
+ const { int: bInt, factor: bFactor } = this.toInteger(b);
|
|
|
+ const maxFactor = Math.max(aFactor, bFactor);
|
|
|
+ return (
|
|
|
+ (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
|
|
|
+ maxFactor
|
|
|
+ );
|
|
|
+ },
|
|
|
+ sub(a, b) {
|
|
|
+ const { int: aInt, factor: aFactor } = this.toInteger(a);
|
|
|
+ const { int: bInt, factor: bFactor } = this.toInteger(b);
|
|
|
+ const maxFactor = Math.max(aFactor, bFactor);
|
|
|
+ return (
|
|
|
+ (aInt * (maxFactor / aFactor) - bInt * (maxFactor / bFactor)) /
|
|
|
+ maxFactor
|
|
|
+ );
|
|
|
+ },
|
|
|
+ mul(a, b) {
|
|
|
+ const aLen = this.getDecimalLength(a);
|
|
|
+ const bLen = this.getDecimalLength(b);
|
|
|
+ return (
|
|
|
+ (Number(a.toString().replace('.', '')) *
|
|
|
+ Number(b.toString().replace('.', ''))) /
|
|
|
+ Math.pow(10, aLen + bLen)
|
|
|
+ );
|
|
|
+ },
|
|
|
+ div(a, b) {
|
|
|
+ const aLen = this.getDecimalLength(a);
|
|
|
+ const bLen = this.getDecimalLength(b);
|
|
|
+ return (
|
|
|
+ (Number(a.toString().replace('.', '')) /
|
|
|
+ Number(b.toString().replace('.', ''))) *
|
|
|
+ Math.pow(10, bLen - aLen)
|
|
|
+ );
|
|
|
},
|
|
|
|
|
|
handOK(isRelease) {
|
|
|
@@ -1193,12 +1619,14 @@
|
|
|
return this.$message.warning('请选择交付日期!');
|
|
|
}
|
|
|
|
|
|
- // if (this.checkListLen > 0 && !this.outObj.warehouseId) {
|
|
|
- // return this.$message({
|
|
|
- // message: '请选择仓库',
|
|
|
- // type: 'warning'
|
|
|
- // });
|
|
|
- // }
|
|
|
+ if (isRelease == 1) {
|
|
|
+ if (
|
|
|
+ this.timeList.length == 0 &&
|
|
|
+ this.attributeData.deliveryMethod == 2
|
|
|
+ ) {
|
|
|
+ return this.$message.warning('请先分批!');
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 环境判断
|
|
|
let _pickOutInList = [];
|
|
|
@@ -1206,7 +1634,6 @@
|
|
|
if (this.clientEnvironmentId == 2) {
|
|
|
_pickOutInList = this.pickOutInList;
|
|
|
} else {
|
|
|
- // _pickOutInList = this.pickOutInList.filter(f => f.checked == true)
|
|
|
_pickOutInList = this.pickOutInListSelect;
|
|
|
}
|
|
|
|
|
|
@@ -1231,8 +1658,6 @@
|
|
|
|
|
|
this.outObj = this.deepCopy({ ...this.outObj, ...this.attributeData });
|
|
|
|
|
|
- // this.outObj.formedNumLast = this.outsourceData.formedNumLast;
|
|
|
-
|
|
|
let param = {
|
|
|
...this.outObj,
|
|
|
isRelease: isRelease,
|
|
|
@@ -1272,7 +1697,7 @@
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
margin-bottom: 0;
|
|
|
- height: 58px;
|
|
|
+ height: 40px;
|
|
|
margin-bottom: 10px;
|
|
|
box-sizing: border-box;
|
|
|
border-bottom: 1px solid var(--border-color-lighter);
|
|
|
@@ -1293,7 +1718,7 @@
|
|
|
}
|
|
|
|
|
|
.materialList {
|
|
|
- height: 25vh;
|
|
|
+ height: 34vh;
|
|
|
overflow: auto;
|
|
|
}
|
|
|
|
|
|
@@ -1368,7 +1793,7 @@
|
|
|
}
|
|
|
|
|
|
::v-deep .el-form-item {
|
|
|
- margin-bottom: 5px;
|
|
|
+ margin-bottom: 4px;
|
|
|
}
|
|
|
|
|
|
.full {
|