|
@@ -15,7 +15,7 @@
|
|
type="primary"
|
|
type="primary"
|
|
size="mini"
|
|
size="mini"
|
|
@click="updateOrderData"
|
|
@click="updateOrderData"
|
|
- >保存修改
|
|
|
|
|
|
+ >保存修改
|
|
</el-button>
|
|
</el-button>
|
|
<!-- <el-button
|
|
<!-- <el-button
|
|
:disabled="tableData.length != 1"
|
|
:disabled="tableData.length != 1"
|
|
@@ -40,14 +40,14 @@
|
|
>
|
|
>
|
|
</el-switch>
|
|
</el-switch>
|
|
<el-button type="primary" size="mini" @click="readStateChange"
|
|
<el-button type="primary" size="mini" @click="readStateChange"
|
|
- >{{ isStartReadNum ? "停止读数" : "开始读数" }}
|
|
|
|
|
|
+ >{{ isStartReadNum ? "停止读数" : "开始读数" }}
|
|
</el-button>
|
|
</el-button>
|
|
<el-button
|
|
<el-button
|
|
v-show="!printAuto"
|
|
v-show="!printAuto"
|
|
type="success"
|
|
type="success"
|
|
size="mini"
|
|
size="mini"
|
|
@click="printBtnHandler"
|
|
@click="printBtnHandler"
|
|
- >打印
|
|
|
|
|
|
+ >打印
|
|
</el-button>
|
|
</el-button>
|
|
</div>
|
|
</div>
|
|
<div class="weightWrap" v-show="excuteType == 1">
|
|
<div class="weightWrap" v-show="excuteType == 1">
|
|
@@ -83,7 +83,7 @@
|
|
width="50"
|
|
width="50"
|
|
label="序号"
|
|
label="序号"
|
|
></el-table-column>
|
|
></el-table-column>
|
|
- <el-table-column prop="machineTool" label="机台"> </el-table-column>
|
|
|
|
|
|
+ <el-table-column prop="machineTool" label="机台"></el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
prop="boxNum"
|
|
prop="boxNum"
|
|
:label="`${tempStr}号`"
|
|
:label="`${tempStr}号`"
|
|
@@ -121,7 +121,7 @@
|
|
size="mini"
|
|
size="mini"
|
|
:disabled="chooseState"
|
|
:disabled="chooseState"
|
|
@click="handleSaveOne(scope.row)"
|
|
@click="handleSaveOne(scope.row)"
|
|
- >保存修改
|
|
|
|
|
|
+ >保存修改
|
|
</el-button>
|
|
</el-button>
|
|
<el-button
|
|
<el-button
|
|
v-else-if="excuteType == 3"
|
|
v-else-if="excuteType == 3"
|
|
@@ -129,7 +129,7 @@
|
|
size="mini"
|
|
size="mini"
|
|
:disabled="chooseState"
|
|
:disabled="chooseState"
|
|
@click="handleSuppleOne(scope.row)"
|
|
@click="handleSuppleOne(scope.row)"
|
|
- >打印
|
|
|
|
|
|
+ >打印
|
|
</el-button>
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
<el-button
|
|
@@ -138,7 +138,7 @@
|
|
size="mini"
|
|
size="mini"
|
|
:disabled="chooseState"
|
|
:disabled="chooseState"
|
|
@click="handleDeleteOne(scope.$index, scope.row)"
|
|
@click="handleDeleteOne(scope.$index, scope.row)"
|
|
- >删除
|
|
|
|
|
|
+ >删除
|
|
</el-button>
|
|
</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -224,11 +224,11 @@
|
|
:value="item.id"
|
|
:value="item.id"
|
|
>
|
|
>
|
|
<span class="discribe" style="float: left">{{
|
|
<span class="discribe" style="float: left">{{
|
|
- item.productionLineName
|
|
|
|
- }}</span>
|
|
|
|
|
|
+ item.productionLineName
|
|
|
|
+ }}</span>
|
|
<span
|
|
<span
|
|
style="float: right; color: #8492a6; font-size: 13px"
|
|
style="float: right; color: #8492a6; font-size: 13px"
|
|
- >{{ item.productionLineDepartment }}</span
|
|
|
|
|
|
+ >{{ item.productionLineDepartment }}</span
|
|
>
|
|
>
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
@@ -489,8 +489,8 @@ import {
|
|
removeProductCodeASInventory,
|
|
removeProductCodeASInventory,
|
|
} from "@/api/codeListManage/productCodeList";
|
|
} from "@/api/codeListManage/productCodeList";
|
|
import codeListPrint from "@/utils/print/codeListPrint";
|
|
import codeListPrint from "@/utils/print/codeListPrint";
|
|
-import { getServerPrintData } from "@/utils/print/printUtils";
|
|
|
|
-import { v4 as uuidv4 } from "uuid";
|
|
|
|
|
|
+import {getServerPrintData} from "@/utils/print/printUtils";
|
|
|
|
+import {v4 as uuidv4} from "uuid";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "ProductCodeList",
|
|
name: "ProductCodeList",
|
|
@@ -562,36 +562,36 @@ export default {
|
|
},
|
|
},
|
|
rules: {
|
|
rules: {
|
|
grossWeight: [
|
|
grossWeight: [
|
|
- { required: true, message: "请输入重量", trigger: "change" },
|
|
|
|
|
|
+ {required: true, message: "请输入重量", trigger: "change"},
|
|
],
|
|
],
|
|
packaging: [
|
|
packaging: [
|
|
- { required: true, message: "请选择包装", trigger: "change" },
|
|
|
|
|
|
+ {required: true, message: "请选择包装", trigger: "change"},
|
|
],
|
|
],
|
|
machineTool: [
|
|
machineTool: [
|
|
- { required: true, message: "请选择机台", trigger: "change" },
|
|
|
|
|
|
+ {required: true, message: "请选择机台", trigger: "change"},
|
|
],
|
|
],
|
|
workShifts: [
|
|
workShifts: [
|
|
- { required: true, message: "请选择班次", trigger: "change" },
|
|
|
|
|
|
+ {required: true, message: "请选择班次", trigger: "change"},
|
|
],
|
|
],
|
|
productionDate: [
|
|
productionDate: [
|
|
- { required: true, message: "请选择生产日期", trigger: "change" },
|
|
|
|
|
|
+ {required: true, message: "请选择生产日期", trigger: "change"},
|
|
],
|
|
],
|
|
- levels: [{ required: true, message: "请选择等级", trigger: "change" }],
|
|
|
|
|
|
+ levels: [{required: true, message: "请选择等级", trigger: "change"}],
|
|
// foreignTradeNumber: [
|
|
// foreignTradeNumber: [
|
|
// { required: true, message: "请输入外贸号", trigger: "blur" },
|
|
// { required: true, message: "请输入外贸号", trigger: "blur" },
|
|
// ],
|
|
// ],
|
|
canisterWeight: [
|
|
canisterWeight: [
|
|
- { required: true, message: "请选择筒重", trigger: "change" },
|
|
|
|
|
|
+ {required: true, message: "请选择筒重", trigger: "change"},
|
|
],
|
|
],
|
|
boxWeight: [
|
|
boxWeight: [
|
|
- { required: true, message: "请选择箱重/车重", trigger: "change" },
|
|
|
|
|
|
+ {required: true, message: "请选择箱重/车重", trigger: "change"},
|
|
],
|
|
],
|
|
tubeColor: [
|
|
tubeColor: [
|
|
- { required: true, message: "请选择管色", trigger: "change" },
|
|
|
|
|
|
+ {required: true, message: "请选择管色", trigger: "change"},
|
|
],
|
|
],
|
|
- comPort: [{ required: true, message: "请选择端口", trigger: "change" }],
|
|
|
|
|
|
+ comPort: [{required: true, message: "请选择端口", trigger: "change"}],
|
|
printFormat: [
|
|
printFormat: [
|
|
- { required: true, message: "请选择格式", trigger: "change" },
|
|
|
|
|
|
+ {required: true, message: "请选择格式", trigger: "change"},
|
|
],
|
|
],
|
|
},
|
|
},
|
|
dropDownData: {},
|
|
dropDownData: {},
|
|
@@ -654,6 +654,7 @@ export default {
|
|
suttle: null,
|
|
suttle: null,
|
|
},
|
|
},
|
|
waiting: 0, // 等待次数 不论时间
|
|
waiting: 0, // 等待次数 不论时间
|
|
|
|
+ confirmPrinting: false,// 确认打印
|
|
lastWeight: 0, // 上次得到的重量
|
|
lastWeight: 0, // 上次得到的重量
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -693,7 +694,7 @@ export default {
|
|
mounted() {
|
|
mounted() {
|
|
// console.log(this.dict.type.packaging_type);
|
|
// console.log(this.dict.type.packaging_type);
|
|
console.log("mounted");
|
|
console.log("mounted");
|
|
- let { excuteType, qrCode } = this.$route.query;
|
|
|
|
|
|
+ let {excuteType, qrCode} = this.$route.query;
|
|
if (excuteType == 2) {
|
|
if (excuteType == 2) {
|
|
//修改
|
|
//修改
|
|
this.handleUpdate(qrCode);
|
|
this.handleUpdate(qrCode);
|
|
@@ -734,9 +735,11 @@ export default {
|
|
},
|
|
},
|
|
async readStateChange() {
|
|
async readStateChange() {
|
|
if (this.isStartReadNum) {
|
|
if (this.isStartReadNum) {
|
|
|
|
+ console.log("当前等待次数:", this.waiting);
|
|
//正在读
|
|
//正在读
|
|
this.closeWebSocket();
|
|
this.closeWebSocket();
|
|
this.isStartReadNum = false;
|
|
this.isStartReadNum = false;
|
|
|
|
+ this.waiting = 0; //
|
|
this.$message.success("已关闭读数");
|
|
this.$message.success("已关闭读数");
|
|
} else {
|
|
} else {
|
|
// 开启读数时 先获取码单号
|
|
// 开启读数时 先获取码单号
|
|
@@ -754,42 +757,33 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
initWebSocket() {
|
|
initWebSocket() {
|
|
- // console.log("开始连接ws", process.env.VUE_APP_BASE_WS_API);
|
|
|
|
- let automatis_printing = this.dict.type.automatic_printing;
|
|
|
|
- let frequency = automatis_printing.find(
|
|
|
|
- // 等到稳定次数
|
|
|
|
- (item) => item.label == "frequency"
|
|
|
|
- )?.value;
|
|
|
|
- if (frequency == undefined) {
|
|
|
|
- frequency = 30;
|
|
|
|
- }
|
|
|
|
- let minimumWeight = automatis_printing.find(
|
|
|
|
- // 打印最小值
|
|
|
|
- (item) => item.label == "minimumWeight"
|
|
|
|
- )?.value;
|
|
|
|
- if (minimumWeight == undefined) {
|
|
|
|
- minimumWeight = 5;
|
|
|
|
- }
|
|
|
|
- let antishake = automatis_printing.find(
|
|
|
|
- // 防抖
|
|
|
|
- (item) => item.label == "antishake"
|
|
|
|
- )?.value;
|
|
|
|
- if (antishake == undefined) {
|
|
|
|
- antishake = 3;
|
|
|
|
- }
|
|
|
|
- const wsUrl = "ws:" + process.env.VUE_APP_BASE_WS_API + "/currentWeight";
|
|
|
|
|
|
+ const getConfigValue = (label, defaultValue) => {
|
|
|
|
+ let value = this.dict.type.automatic_printing.find(
|
|
|
|
+ (item) => item.label === label
|
|
|
|
+ )?.value;
|
|
|
|
+ return value !== undefined ? value : defaultValue;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ let frequency = getConfigValue("frequency", 30);
|
|
|
|
+ let minimumWeight = getConfigValue("minimumWeight", 5);
|
|
|
|
+ let antishake = getConfigValue("antishake", 3);
|
|
|
|
+
|
|
|
|
+ const wsUrl = `ws:${process.env.VUE_APP_BASE_WS_API}/currentWeight`;
|
|
this.websocket = new WebSocket(wsUrl);
|
|
this.websocket = new WebSocket(wsUrl);
|
|
this.websocket.addEventListener("open", (event) => {
|
|
this.websocket.addEventListener("open", (event) => {
|
|
console.log("建立WebSocket连接");
|
|
console.log("建立WebSocket连接");
|
|
this.isStartReadNum = true;
|
|
this.isStartReadNum = true;
|
|
this.$message.success("已开启读数");
|
|
this.$message.success("已开启读数");
|
|
});
|
|
});
|
|
|
|
+
|
|
let initialWeight = null; // 初始化基准重量
|
|
let initialWeight = null; // 初始化基准重量
|
|
- const weightChangeThreshold = antishake; // 定义重量变化阈值x
|
|
|
|
|
|
+ const weightChangeThreshold = antishake; // 定义重量变化阈值
|
|
let shouldPrint = false; // 用于控制是否应该打印
|
|
let shouldPrint = false; // 用于控制是否应该打印
|
|
|
|
+
|
|
this.websocket.addEventListener("message", async (event) => {
|
|
this.websocket.addEventListener("message", async (event) => {
|
|
console.log(event);
|
|
console.log(event);
|
|
if (!this.printAuto) return;
|
|
if (!this.printAuto) return;
|
|
|
|
+
|
|
const weightData = JSON.parse(event.data);
|
|
const weightData = JSON.parse(event.data);
|
|
const weight = weightData.weight;
|
|
const weight = weightData.weight;
|
|
this.nowWeight = weight;
|
|
this.nowWeight = weight;
|
|
@@ -803,6 +797,7 @@ export default {
|
|
if (weight <= minimumWeight) {
|
|
if (weight <= minimumWeight) {
|
|
this.resetWeightStatus();
|
|
this.resetWeightStatus();
|
|
shouldPrint = false; // 重量未满足打印条件,重置打印标志
|
|
shouldPrint = false; // 重量未满足打印条件,重置打印标志
|
|
|
|
+ this.confirmPrinting = true;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -811,6 +806,8 @@ export default {
|
|
shouldPrint = true; // 第一次有效重量,允许打印
|
|
shouldPrint = true; // 第一次有效重量,允许打印
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
const weightDifference = Math.abs(weight - initialWeight);
|
|
const weightDifference = Math.abs(weight - initialWeight);
|
|
if (weightDifference > weightChangeThreshold) {
|
|
if (weightDifference > weightChangeThreshold) {
|
|
initialWeight = weight;
|
|
initialWeight = weight;
|
|
@@ -818,9 +815,10 @@ export default {
|
|
shouldPrint = true;
|
|
shouldPrint = true;
|
|
} else {
|
|
} else {
|
|
this.waiting++;
|
|
this.waiting++;
|
|
- if (this.waiting == frequency && shouldPrint) {
|
|
|
|
- // 只有在应该打印且等待计数达标时才打印
|
|
|
|
|
|
+ if (this.waiting == frequency && shouldPrint && this.confirmPrinting) {
|
|
|
|
+ // 只有在应该打印且等待计数达标时才打印qwe
|
|
this.waiting = 0;
|
|
this.waiting = 0;
|
|
|
|
+ this.confirmPrinting = false;
|
|
shouldPrint = false; // 打印后禁止下一次打印,直到重量再次变化
|
|
shouldPrint = false; // 打印后禁止下一次打印,直到重量再次变化
|
|
const isValidate = await this.validateAndPrint(weight);
|
|
const isValidate = await this.validateAndPrint(weight);
|
|
}
|
|
}
|
|
@@ -832,10 +830,10 @@ export default {
|
|
});
|
|
});
|
|
this.websocket.addEventListener("error", (event) => {
|
|
this.websocket.addEventListener("error", (event) => {
|
|
console.error("WebSocket错误:", event);
|
|
console.error("WebSocket错误:", event);
|
|
- this.$message.error("WebSocket错误,请重试");
|
|
|
|
|
|
+ this.$message.error("WebSocket错误,请重试");
|
|
});
|
|
});
|
|
|
|
|
|
- this.websocket.addEventListener("close", (event) => {
|
|
|
|
|
|
+ this.websocket.addEventListener("close", () => {
|
|
console.log("关闭WebSocket连接");
|
|
console.log("关闭WebSocket连接");
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -850,10 +848,11 @@ export default {
|
|
if (isValidate) {
|
|
if (isValidate) {
|
|
this.setWeight(weight);
|
|
this.setWeight(weight);
|
|
} else {
|
|
} else {
|
|
- // this.$message.warning("请完善表单数据");
|
|
|
|
|
|
+ this.$message.warning("请完善表单数据");
|
|
}
|
|
}
|
|
return isValidate;
|
|
return isValidate;
|
|
},
|
|
},
|
|
|
|
+
|
|
// 表单重量改变回调
|
|
// 表单重量改变回调
|
|
changeGrossWeightForm(val) {
|
|
changeGrossWeightForm(val) {
|
|
// console.log(val);
|
|
// console.log(val);
|
|
@@ -1012,7 +1011,7 @@ export default {
|
|
// 毛重改变回调
|
|
// 毛重改变回调
|
|
changeGrossWeight(row) {
|
|
changeGrossWeight(row) {
|
|
console.log(row);
|
|
console.log(row);
|
|
- let { boxWeight, grossWeight, canisterWeight, canisterNum } = row;
|
|
|
|
|
|
+ let {boxWeight, grossWeight, canisterWeight, canisterNum} = row;
|
|
if (!Number(grossWeight)) {
|
|
if (!Number(grossWeight)) {
|
|
row.suttle = 0;
|
|
row.suttle = 0;
|
|
return;
|
|
return;
|
|
@@ -1048,7 +1047,7 @@ export default {
|
|
// 确认保存修改一条数据
|
|
// 确认保存修改一条数据
|
|
async handleSaveOne(row) {
|
|
async handleSaveOne(row) {
|
|
try {
|
|
try {
|
|
- let { sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight } =
|
|
|
|
|
|
+ let {sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight} =
|
|
this.count;
|
|
this.count;
|
|
let rowData = JSON.parse(JSON.stringify(row));
|
|
let rowData = JSON.parse(JSON.stringify(row));
|
|
|
|
|
|
@@ -1131,7 +1130,7 @@ export default {
|
|
this.$refs.form.validate(async (valid) => {
|
|
this.$refs.form.validate(async (valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
try {
|
|
try {
|
|
- let { sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight } =
|
|
|
|
|
|
+ let {sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight} =
|
|
this.count;
|
|
this.count;
|
|
let rowData = newData.machineTool
|
|
let rowData = newData.machineTool
|
|
? JSON.parse(JSON.stringify(newData))
|
|
? JSON.parse(JSON.stringify(newData))
|
|
@@ -1189,7 +1188,7 @@ export default {
|
|
this.$refs.form.validate(async (valid) => {
|
|
this.$refs.form.validate(async (valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
try {
|
|
try {
|
|
- let { sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight } =
|
|
|
|
|
|
+ let {sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight} =
|
|
this.count;
|
|
this.count;
|
|
let rowData = JSON.parse(JSON.stringify(this.tableData[0]));
|
|
let rowData = JSON.parse(JSON.stringify(this.tableData[0]));
|
|
this.printTableData = [rowData];
|
|
this.printTableData = [rowData];
|
|
@@ -1333,7 +1332,7 @@ export default {
|
|
},
|
|
},
|
|
// 计算净重
|
|
// 计算净重
|
|
getSuttle() {
|
|
getSuttle() {
|
|
- let { boxWeight, canisterWeight, canisterNum } = this.form;
|
|
|
|
|
|
+ let {boxWeight, canisterWeight, canisterNum} = this.form;
|
|
return (Number(boxWeight) - canisterWeight * canisterNum).toFixed(2);
|
|
return (Number(boxWeight) - canisterWeight * canisterNum).toFixed(2);
|
|
},
|
|
},
|
|
// 表格点击回调
|
|
// 表格点击回调
|
|
@@ -1376,7 +1375,7 @@ export default {
|
|
this.$refs.form.validate(async (valid) => {
|
|
this.$refs.form.validate(async (valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
try {
|
|
try {
|
|
- let { sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight } =
|
|
|
|
|
|
+ let {sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight} =
|
|
this.count;
|
|
this.count;
|
|
let rowData = JSON.parse(JSON.stringify(row));
|
|
let rowData = JSON.parse(JSON.stringify(row));
|
|
this.printTableData = [rowData];
|
|
this.printTableData = [rowData];
|
|
@@ -1428,7 +1427,7 @@ export default {
|
|
// 获取所有批次数据
|
|
// 获取所有批次数据
|
|
async getAllBatchData(id) {
|
|
async getAllBatchData(id) {
|
|
try {
|
|
try {
|
|
- let payload = { machineTool: id };
|
|
|
|
|
|
+ let payload = {machineTool: id};
|
|
let res = await finishedProductList(payload);
|
|
let res = await finishedProductList(payload);
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
this.batchData = res.data;
|
|
this.batchData = res.data;
|
|
@@ -1457,7 +1456,8 @@ export default {
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
this.dropDownData = res.data;
|
|
this.dropDownData = res.data;
|
|
}
|
|
}
|
|
- } catch (error) {}
|
|
|
|
|
|
+ } catch (error) {
|
|
|
|
+ }
|
|
},
|
|
},
|
|
/** 查询产品码单列表 */
|
|
/** 查询产品码单列表 */
|
|
getList() {
|
|
getList() {
|
|
@@ -1658,7 +1658,8 @@ export default {
|
|
this.getList();
|
|
this.getList();
|
|
this.$modal.msgSuccess("删除成功");
|
|
this.$modal.msgSuccess("删除成功");
|
|
})
|
|
})
|
|
- .catch(() => {});
|
|
|
|
|
|
+ .catch(() => {
|
|
|
|
+ });
|
|
},
|
|
},
|
|
/** 导出按钮操作 */
|
|
/** 导出按钮操作 */
|
|
handleExport() {
|
|
handleExport() {
|
|
@@ -1752,6 +1753,7 @@ export default {
|
|
::v-deep .el-table .current-row {
|
|
::v-deep .el-table .current-row {
|
|
background-color: #55e905 !important;
|
|
background-color: #55e905 !important;
|
|
}
|
|
}
|
|
|
|
+
|
|
::v-deep .el-table__body tr.current-row > td.el-table__cell {
|
|
::v-deep .el-table__body tr.current-row > td.el-table__cell {
|
|
background-color: #55e905 !important;
|
|
background-color: #55e905 !important;
|
|
}
|
|
}
|