|
|
@@ -330,10 +330,24 @@
|
|
|
v-if="
|
|
|
row.feedQuantity > 1 &&
|
|
|
item.currentTaskDiagram.isFirstTask != 1 &&
|
|
|
- row.isAllPackageData != 1
|
|
|
+ row.isAllPackageData != 1 &&
|
|
|
+ !row.extInfo.isLoss
|
|
|
"
|
|
|
>拆批</el-link
|
|
|
>
|
|
|
+
|
|
|
+ <el-link
|
|
|
+ type="text"
|
|
|
+ style="color: orange"
|
|
|
+ @click="openLoss(row, $index)"
|
|
|
+ v-if="
|
|
|
+ ![2, 3, 6].includes(Number(item.currentTaskDiagram.type)) &&
|
|
|
+ !row.extInfo.isLoss &&
|
|
|
+ item.currentTaskDiagram.isFirstTask != 1
|
|
|
+ "
|
|
|
+ >损耗</el-link
|
|
|
+ >
|
|
|
+
|
|
|
<el-link
|
|
|
type="success"
|
|
|
@click="getOk($index)"
|
|
|
@@ -615,6 +629,34 @@
|
|
|
<el-button type="primary" @click="getQualityParam">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ title="损耗数"
|
|
|
+ :visible.sync="lossVisible"
|
|
|
+ v-if="lossVisible"
|
|
|
+ width="30%"
|
|
|
+ :before-close="handleClose"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ ref="form"
|
|
|
+ :model="lossForm"
|
|
|
+ label-width="120px"
|
|
|
+ label-position="right"
|
|
|
+ >
|
|
|
+ <el-form-item label="批次号">
|
|
|
+ <el-input v-model="lossForm.batchNo" style="width: 220px"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="损耗数">
|
|
|
+ <el-input v-model="lossForm.quantity" style="width: 220px"></el-input>
|
|
|
+ {{ lossForm.unit }}
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="lossVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="getLossParam">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -1000,6 +1042,18 @@
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true
|
|
|
},
|
|
|
+ {
|
|
|
+ minWidth: 100,
|
|
|
+ prop: 'extInfo.isLoss',
|
|
|
+ label: '是否损耗',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ formatter: (row) => {
|
|
|
+ return row.extInfo.isLoss && row.extInfo.isLoss == 1
|
|
|
+ ? '是'
|
|
|
+ : '否';
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
columnKey: 'action',
|
|
|
label: '操作',
|
|
|
@@ -1130,24 +1184,63 @@
|
|
|
isQualified: 1,
|
|
|
notType: '',
|
|
|
notReason: '',
|
|
|
- unit: ''
|
|
|
+ unit: '',
|
|
|
+ isLoss: 0
|
|
|
},
|
|
|
itemData: {},
|
|
|
itemIndex: '',
|
|
|
printData: {},
|
|
|
- printStyle: ''
|
|
|
+ printStyle: '',
|
|
|
+ lossForm: {
|
|
|
+ batchNo: '',
|
|
|
+ quantity: '',
|
|
|
+ unit: '',
|
|
|
+ isLoss: 1
|
|
|
+ },
|
|
|
+ lossVisible: false,
|
|
|
+ lossData: {},
|
|
|
+ lossIndex: ''
|
|
|
};
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
sunTj() {
|
|
|
if (this.item.workReportInfo && this.item.singleReport == 1) {
|
|
|
- this.item.workReportInfo.formedNum = this.newList.filter(
|
|
|
+ const formedNumList = this.newList.filter(
|
|
|
(v) => v.extInfo.isQualified == 1
|
|
|
- ).length;
|
|
|
- this.item.workReportInfo.notFormedNum = this.newList.filter(
|
|
|
+ );
|
|
|
+
|
|
|
+ const notFormedNumList = this.newList.filter(
|
|
|
(v) => v.extInfo.isQualified !== 1
|
|
|
- ).length;
|
|
|
+ );
|
|
|
+
|
|
|
+ if (formedNumList.length != 0) {
|
|
|
+ this.item.workReportInfo.formedNum = formedNumList.reduce(
|
|
|
+ (acc, pro) => {
|
|
|
+ return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
|
|
|
+ },
|
|
|
+ 0
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.item.workReportInfo.formedNum = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (notFormedNumList.length != 0) {
|
|
|
+ this.item.workReportInfo.notFormedNum = notFormedNumList.reduce(
|
|
|
+ (acc, pro) => {
|
|
|
+ return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
|
|
|
+ },
|
|
|
+ 0
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.item.workReportInfo.notFormedNum = 0;
|
|
|
+ }
|
|
|
+ // this.item.workReportInfo.formedNum = this.newList.filter(
|
|
|
+ // (v) => v.extInfo.isQualified == 1
|
|
|
+ // ).length;
|
|
|
+ // this.item.workReportInfo.notFormedNum = this.newList.filter(
|
|
|
+ // (v) => v.extInfo.isQualified !== 1
|
|
|
+ // ).length;
|
|
|
}
|
|
|
},
|
|
|
sumweight(arr) {
|
|
|
@@ -1248,6 +1341,7 @@
|
|
|
this.dialogVisible = false;
|
|
|
this.dialogEngrave = false;
|
|
|
this.batchVisible = false;
|
|
|
+ this.lossVisible = false;
|
|
|
},
|
|
|
|
|
|
batchEngrave() {
|
|
|
@@ -1298,7 +1392,6 @@
|
|
|
},
|
|
|
|
|
|
openBatch(item, index) {
|
|
|
- console.log(item, '需要拆批的数据');
|
|
|
this.batchForm.quantity = '';
|
|
|
this.batchForm.unit = '';
|
|
|
this.batchForm.batchNo = '';
|
|
|
@@ -1320,7 +1413,7 @@
|
|
|
}
|
|
|
|
|
|
if (this.itemData.feedQuantity <= this.batchForm.quantity) {
|
|
|
- this.$message.warning('拆批数不能大于数量');
|
|
|
+ this.$message.warning('拆批数不能大于或者等于数量');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -1336,13 +1429,16 @@
|
|
|
batchNo: this.batchForm.batchNo,
|
|
|
isQualified: this.batchForm.isQualified,
|
|
|
notType: this.batchForm.notType,
|
|
|
- notReason: this.batchForm.notReason
|
|
|
+ notReason: this.batchForm.notReason,
|
|
|
+ isLoss: 0
|
|
|
}).then((res) => {
|
|
|
res.forEach((item) => {
|
|
|
dataList.push(this.deepCopy(item));
|
|
|
});
|
|
|
|
|
|
- this.refreshData(dataList);
|
|
|
+ if (dataList.length != 0) {
|
|
|
+ this.refreshData(dataList);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
this.batchVisible = false;
|
|
|
@@ -1364,10 +1460,6 @@
|
|
|
});
|
|
|
let _arr = [...this.list, ...list];
|
|
|
|
|
|
- console.log(this.list, '拆批的数据');
|
|
|
-
|
|
|
- // this.list = _arr;
|
|
|
-
|
|
|
this.$set(this.item, 'product', _arr);
|
|
|
},
|
|
|
|
|
|
@@ -1387,6 +1479,74 @@
|
|
|
}, result);
|
|
|
},
|
|
|
|
|
|
+ openLoss(item, index) {
|
|
|
+ this.lossForm.quantity = '';
|
|
|
+ this.lossForm.unit = '';
|
|
|
+ this.lossForm.batchNo = '';
|
|
|
+ this.lossData = item;
|
|
|
+ this.lossIndex = index;
|
|
|
+ this.lossForm.batchNo = item.batchNo;
|
|
|
+ this.lossForm.unit = item.unit;
|
|
|
+ this.lossVisible = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ async getLossParam() {
|
|
|
+ if (this.lossForm.quantity && this.lossForm.batchNo) {
|
|
|
+ if (
|
|
|
+ Number(this.lossData.feedQuantity) < Number(this.lossForm.quantity)
|
|
|
+ ) {
|
|
|
+ this.$message.warning('损耗数不能大于数量');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ let dataList = [];
|
|
|
+ await splitBatch({
|
|
|
+ product: this.lossData,
|
|
|
+ splitQt: Number(this.lossForm.quantity),
|
|
|
+ batchNo: this.lossForm.batchNo,
|
|
|
+ isLoss: 1
|
|
|
+ }).then((res) => {
|
|
|
+ res.forEach((item) => {
|
|
|
+ dataList.push(this.deepCopy(item));
|
|
|
+ });
|
|
|
+
|
|
|
+ if (dataList.length != 0) {
|
|
|
+ this.refreshLossData(dataList);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.lossVisible = false;
|
|
|
+ },
|
|
|
+
|
|
|
+ refreshLossData(list) {
|
|
|
+ const number =
|
|
|
+ Number(this.list[this.lossIndex].feedQuantity) -
|
|
|
+ Number(this.lossForm.quantity);
|
|
|
+ this.list[this.lossIndex].extInfo.sourceQuantity = number;
|
|
|
+ this.list[this.lossIndex].feedQuantity = number;
|
|
|
+ this.list[this.lossIndex].extInfo.newWeight =
|
|
|
+ (Number(this.list[this.lossIndex].extInfo.newWeight) * 100000) /
|
|
|
+ 100000 -
|
|
|
+ (Number(list[0].extInfo.newWeight) * 100000) / 100000;
|
|
|
+
|
|
|
+ list.forEach((item) => {
|
|
|
+ item.childBatch = 1;
|
|
|
+ });
|
|
|
+
|
|
|
+ const newList = this.list.filter((item) => item.feedQuantity != 0);
|
|
|
+ console.log(newList, 'newList新数据');
|
|
|
+
|
|
|
+ // this.$set(
|
|
|
+ // this.item,
|
|
|
+ // 'product',
|
|
|
+ // this.list.filter((item) => item.feedQuantity != 0)
|
|
|
+ // );
|
|
|
+
|
|
|
+ let _arr = [...newList, ...list];
|
|
|
+
|
|
|
+ this.$set(this.item, 'product', _arr);
|
|
|
+ },
|
|
|
+
|
|
|
// changeHeatNumber() {
|
|
|
// if (this.deviceList.length > 0) {
|
|
|
// const device = this.deviceList[0];
|