|
|
@@ -219,7 +219,7 @@
|
|
|
|
|
|
<view class="content content_num">
|
|
|
<view v-if="isDetails">{{ it.feedQuantity }}</view>
|
|
|
- <view>{{ it.feedQuantity }}</view>
|
|
|
+ <input class="uni-input" v-else v-model="it.feedQuantity" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -316,6 +316,16 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="item rx-sc">
|
|
|
+ <view class="rx ww50">
|
|
|
+ <view class="lable lable150 rx-cc">损耗</view>
|
|
|
+ <view class="content content_num">
|
|
|
+ <view v-if="it.extInfo.isLoss && it.extInfo.isLoss == 1">是</view>
|
|
|
+ <view v-else>否</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="item rx-sc" v-if="!isDetails">
|
|
|
<view class="rx">
|
|
|
<view class="lable lable150 rx-cc">操作</view>
|
|
|
<view class="content rx-bc">
|
|
|
@@ -336,6 +346,20 @@
|
|
|
style="margin-left: 20px"
|
|
|
>删除</u-button
|
|
|
>
|
|
|
+
|
|
|
+ <u-button
|
|
|
+ size="small"
|
|
|
+ class="u-reset-button"
|
|
|
+ type="warning"
|
|
|
+ style="margin-left: 20px"
|
|
|
+ @click="openLoss(it, idx)"
|
|
|
+ v-if="
|
|
|
+ ![2, 3, 6].includes(Number(item.currentTaskDiagram.type)) &&
|
|
|
+ !it.extInfo.isLoss &&
|
|
|
+ item.currentTaskDiagram.isFirstTask != 1
|
|
|
+ "
|
|
|
+ >损耗</u-button
|
|
|
+ >
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -641,6 +665,37 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
+
|
|
|
+ <uni-popup ref="lossDialog" type="center" :animation="false">
|
|
|
+ <view class="popup-content">
|
|
|
+ <view style="font-size: 18px; margin-bottom: 10px">损耗数</view>
|
|
|
+ <uni-forms
|
|
|
+ ref="lossForm"
|
|
|
+ :modelValue="lossForm"
|
|
|
+ label-position="left"
|
|
|
+ label-align="center"
|
|
|
+ >
|
|
|
+ <uni-forms-item label="批次号:" label-width="100" prop="batchNo">
|
|
|
+ <uni-easyinput
|
|
|
+ v-model="lossForm.batchNo"
|
|
|
+ placeholder="请输入批次号"
|
|
|
+ />
|
|
|
+ </uni-forms-item>
|
|
|
+
|
|
|
+ <uni-forms-item label="损耗数:" label-width="100" prop="quantity">
|
|
|
+ <uni-easyinput
|
|
|
+ v-model="lossForm.quantity"
|
|
|
+ placeholder="请输入损耗数"
|
|
|
+ />
|
|
|
+ </uni-forms-item>
|
|
|
+ </uni-forms>
|
|
|
+
|
|
|
+ <view class="button-group">
|
|
|
+ <button type="primary" size="mini" @click="handleClose">取消</button>
|
|
|
+ <button type="primary" size="mini" @click="getLossParam">确定</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -794,6 +849,15 @@ export default {
|
|
|
},
|
|
|
bacthData: {},
|
|
|
bacthIndex: "",
|
|
|
+ lossForm: {
|
|
|
+ batchNo: "",
|
|
|
+ quantity: "",
|
|
|
+ unit: "",
|
|
|
+ isLoss: 1,
|
|
|
+ },
|
|
|
+ lossVisible: false,
|
|
|
+ lossData: {},
|
|
|
+ lossIndex: "",
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
@@ -926,14 +990,41 @@ export default {
|
|
|
// console.log('this.list33333',this.list)
|
|
|
},
|
|
|
sumweight(arr) {
|
|
|
+ // let formedWeight = 0;
|
|
|
+ // let noFormedWeight = 0;
|
|
|
+ // arr.map((s, i) => {
|
|
|
+ // if (s.extInfo.reportWeight) {
|
|
|
+ // if (s.extInfo.isQualified == 1) {
|
|
|
+ // formedWeight += s.extInfo.reportWeight * 1;
|
|
|
+ // } else {
|
|
|
+ // noFormedWeight += s.extInfo.reportWeight * 1;
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // s.extInfo.reportWeight = null;
|
|
|
+ // }
|
|
|
+ // this.$set(this.list[i].extInfo, "reportWeight", s.extInfo.reportWeight);
|
|
|
+ // });
|
|
|
+
|
|
|
+ // if (this.item.workReportInfo) {
|
|
|
+ // this.item.workReportInfo.formedWeight = parseFloat(
|
|
|
+ // formedWeight.toFixed(4)
|
|
|
+ // );
|
|
|
+ // this.item.workReportInfo.notFormedWeight = parseFloat(
|
|
|
+ // noFormedWeight.toFixed(4)
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+
|
|
|
let formedWeight = 0;
|
|
|
let noFormedWeight = 0;
|
|
|
+ let lossWeight = 0;
|
|
|
arr.map((s, i) => {
|
|
|
if (s.extInfo.reportWeight) {
|
|
|
- if (s.extInfo.isQualified == 1) {
|
|
|
+ if (s.extInfo.isQualified == 1 && !s.extInfo.isLoss) {
|
|
|
formedWeight += s.extInfo.reportWeight * 1;
|
|
|
- } else {
|
|
|
+ } else if (!s.extInfo.isLoss) {
|
|
|
noFormedWeight += s.extInfo.reportWeight * 1;
|
|
|
+ } else if (s.extInfo.isLoss == 1) {
|
|
|
+ lossWeight += s.extInfo.reportWeight * 1;
|
|
|
}
|
|
|
} else {
|
|
|
s.extInfo.reportWeight = null;
|
|
|
@@ -943,12 +1034,15 @@ export default {
|
|
|
|
|
|
if (this.item.workReportInfo) {
|
|
|
this.item.workReportInfo.formedWeight = parseFloat(
|
|
|
- formedWeight.toFixed(2)
|
|
|
+ formedWeight.toFixed(4)
|
|
|
);
|
|
|
this.item.workReportInfo.notFormedWeight = parseFloat(
|
|
|
- noFormedWeight.toFixed(2)
|
|
|
+ noFormedWeight.toFixed(4)
|
|
|
);
|
|
|
+ this.item.workReportInfo.lossWeight = parseFloat(lossWeight.toFixed(4));
|
|
|
}
|
|
|
+
|
|
|
+ console.log(this.item.workReportInfo, "this.item.workReportInfo");
|
|
|
},
|
|
|
|
|
|
sunTj() {
|
|
|
@@ -962,6 +1056,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ openLoss(item, index) {},
|
|
|
+
|
|
|
+ getLossParam() {},
|
|
|
+
|
|
|
cancel() {
|
|
|
this.show = false;
|
|
|
this.reportWeight = 0;
|
|
|
@@ -1022,7 +1120,9 @@ export default {
|
|
|
|
|
|
handleClose() {
|
|
|
this.$refs.inputDialog.close();
|
|
|
+ this.$refs.lossDialog.close();
|
|
|
},
|
|
|
+
|
|
|
async timeoutCauseConfirm() {
|
|
|
if (!this.batchForm.quantity) {
|
|
|
uni.showToast({
|
|
|
@@ -1103,6 +1203,100 @@ export default {
|
|
|
this.$refs.inputDialog.close();
|
|
|
},
|
|
|
|
|
|
+ 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.$refs.lossDialog.open();
|
|
|
+ },
|
|
|
+
|
|
|
+ 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.$refs.lossDialog.close();
|
|
|
+ },
|
|
|
+
|
|
|
+ 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
|
|
|
+ );
|
|
|
+ },
|
|
|
+
|
|
|
+ getDecimalLength(num) {
|
|
|
+ return (num.toString().split(".")[1] || "").length;
|
|
|
+ },
|
|
|
+
|
|
|
+ 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);
|
|
|
+ let _arr = [...newList, ...list];
|
|
|
+ this.$set(newList, newList.length, ...list);
|
|
|
+ this.$set(this.item, "product", _arr);
|
|
|
+ this.$forceUpdate();
|
|
|
+ this.$refs.inputDialog.close();
|
|
|
+ },
|
|
|
+
|
|
|
isChange(val) {
|
|
|
if (val == "合格") {
|
|
|
this.batchForm.notType = "";
|