|
@@ -48,13 +48,11 @@
|
|
|
icon="el-icon-search"
|
|
|
size="mini"
|
|
|
@click="handleQuery"
|
|
|
- >搜索
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >搜索
|
|
|
+ </el-button>
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
|
- >重置
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >重置
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
@@ -67,9 +65,8 @@
|
|
|
size="mini"
|
|
|
@click="printHandler"
|
|
|
v-hasPermi="['system:productCodeList:add']"
|
|
|
- >打印
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >打印
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -80,9 +77,8 @@
|
|
|
:disabled="single"
|
|
|
@click="handleUpdate"
|
|
|
v-hasPermi="['system:productCodeList:edit']"
|
|
|
- >修改
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >修改
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -93,9 +89,8 @@
|
|
|
:disabled="multiple"
|
|
|
@click="handleDelete"
|
|
|
v-hasPermi="['system:productCodeList:remove']"
|
|
|
- >删除
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -105,9 +100,8 @@
|
|
|
size="mini"
|
|
|
@click="handleExport"
|
|
|
v-hasPermi="['system:productCodeList:export']"
|
|
|
- >导出
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >导出
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
|
<right-toolbar
|
|
|
:showSearch.sync="showSearch"
|
|
@@ -120,22 +114,22 @@
|
|
|
:data="productCodeListList"
|
|
|
@selection-change="handleSelectionChange"
|
|
|
>
|
|
|
- <el-table-column type="selection" width="55" align="center"/>
|
|
|
- <el-table-column label="码单号" align="center" prop="qrCode"/>
|
|
|
- <el-table-column label="品名" align="center" prop="productName"/>
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="码单号" align="center" prop="qrCode" />
|
|
|
+ <el-table-column label="品名" align="center" prop="productName" />
|
|
|
<el-table-column
|
|
|
label="规格"
|
|
|
align="center"
|
|
|
prop="productSpecifications"
|
|
|
/>
|
|
|
- <el-table-column label="批号" align="center" prop="lotNum"/>
|
|
|
- <el-table-column label="色泽" align="center" prop="productColor"/>
|
|
|
+ <el-table-column label="批号" align="center" prop="lotNum" />
|
|
|
+ <el-table-column label="色泽" align="center" prop="productColor" />
|
|
|
<!-- <el-table-column label="货品编号" align="center" prop="productId" /> -->
|
|
|
- <el-table-column label="等级" align="center" prop="levels"/>
|
|
|
- <el-table-column label="筒数" align="center" prop="totalCanisterNum"/>
|
|
|
- <el-table-column label="箱数" align="center" prop="totalBoxNum"/>
|
|
|
- <el-table-column label="净重" align="center" prop="totalSuttle"/>
|
|
|
- <el-table-column label="备注" align="center" prop="remark"/>
|
|
|
+ <el-table-column label="等级" align="center" prop="levels" />
|
|
|
+ <el-table-column label="筒数" align="center" prop="totalCanisterNum" />
|
|
|
+ <el-table-column label="箱数" align="center" prop="totalBoxNum" />
|
|
|
+ <el-table-column label="净重" align="center" prop="totalSuttle" />
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" />
|
|
|
<el-table-column
|
|
|
label="操作"
|
|
|
align="center"
|
|
@@ -154,9 +148,8 @@
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
v-hasPermi="['system:productCodeList:edit']"
|
|
|
- >修改
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >修改
|
|
|
+ </el-button>
|
|
|
</el-dropdown-item>
|
|
|
<el-dropdown-item>
|
|
|
<el-button
|
|
@@ -164,9 +157,8 @@
|
|
|
type="text"
|
|
|
icon="el-icon-circle-plus-outline"
|
|
|
@click="supplementCode(scope.row)"
|
|
|
- >补码
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >补码
|
|
|
+ </el-button>
|
|
|
</el-dropdown-item>
|
|
|
<el-dropdown-item>
|
|
|
<el-button
|
|
@@ -175,9 +167,8 @@
|
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
v-hasPermi="['system:productCodeList:remove']"
|
|
|
- >删除
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
@@ -200,28 +191,27 @@
|
|
|
width="500px"
|
|
|
append-to-body
|
|
|
>
|
|
|
-
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-form-item label="码单号" prop="qrCode">
|
|
|
- <el-input v-model="form.qrCode" placeholder="请输入码单号"/>
|
|
|
+ <el-input v-model="form.qrCode" placeholder="请输入码单号" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="批号" prop="lotNum">
|
|
|
- <el-input v-model="form.lotNum" placeholder="请输入批号"/>
|
|
|
+ <el-input v-model="form.lotNum" placeholder="请输入批号" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="货品编号" prop="productId">
|
|
|
- <el-input v-model="form.productId" placeholder="请输入货品编号"/>
|
|
|
+ <el-input v-model="form.productId" placeholder="请输入货品编号" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="等级" prop="levels">
|
|
|
- <el-input v-model="form.levels" placeholder="请输入等级"/>
|
|
|
+ <el-input v-model="form.levels" placeholder="请输入等级" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="筒数" prop="canisterNum">
|
|
|
- <el-input v-model="form.canisterNum" placeholder="请输入筒数"/>
|
|
|
+ <el-input v-model="form.canisterNum" placeholder="请输入筒数" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="箱数" prop="boxNum">
|
|
|
- <el-input v-model="form.boxNum" placeholder="请输入箱数"/>
|
|
|
+ <el-input v-model="form.boxNum" placeholder="请输入箱数" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="净重" prop="suttle">
|
|
|
- <el-input v-model="form.suttle" placeholder="请输入净重"/>
|
|
|
+ <el-input v-model="form.suttle" placeholder="请输入净重" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="生产日期" prop="productionDate">
|
|
|
<el-date-picker
|
|
@@ -234,16 +224,16 @@
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="机台" prop="machineTool">
|
|
|
- <el-input v-model="form.machineTool" placeholder="请输入机台"/>
|
|
|
+ <el-input v-model="form.machineTool" placeholder="请输入机台" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="毛重" prop="grossWeight">
|
|
|
- <el-input v-model="form.grossWeight" placeholder="请输入毛重"/>
|
|
|
+ <el-input v-model="form.grossWeight" placeholder="请输入毛重" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="包装" prop="packaging">
|
|
|
- <el-input v-model="form.packaging" placeholder="请输入包装"/>
|
|
|
+ <el-input v-model="form.packaging" placeholder="请输入包装" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="班次" prop="workShifts">
|
|
|
- <el-input v-model="form.workShifts" placeholder="请输入班次"/>
|
|
|
+ <el-input v-model="form.workShifts" placeholder="请输入班次" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="外贸号" prop="foreignTradeNumber">
|
|
|
<el-input
|
|
@@ -252,22 +242,22 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="筒重" prop="canisterWeight">
|
|
|
- <el-input v-model="form.canisterWeight" placeholder="请输入筒重"/>
|
|
|
+ <el-input v-model="form.canisterWeight" placeholder="请输入筒重" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="箱重/车重" prop="boxWeight">
|
|
|
- <el-input v-model="form.boxWeight" placeholder="请输入箱重/车重"/>
|
|
|
+ <el-input v-model="form.boxWeight" placeholder="请输入箱重/车重" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="管色" prop="tubeColor">
|
|
|
- <el-input v-model="form.tubeColor" placeholder="请输入管色"/>
|
|
|
+ <el-input v-model="form.tubeColor" placeholder="请输入管色" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="端口" prop="comPort">
|
|
|
- <el-input v-model="form.comPort" placeholder="请输入端口"/>
|
|
|
+ <el-input v-model="form.comPort" placeholder="请输入端口" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="打印格式" prop="printFormat">
|
|
|
- <el-input v-model="form.printFormat" placeholder="请输入打印格式"/>
|
|
|
+ <el-input v-model="form.printFormat" placeholder="请输入打印格式" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="库位" prop="storageLocation">
|
|
|
- <el-input v-model="form.storageLocation" placeholder="请输入库位"/>
|
|
|
+ <el-input v-model="form.storageLocation" placeholder="请输入库位" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="区域编号" prop="warehouseregionId">
|
|
|
<el-input
|
|
@@ -283,7 +273,7 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="删除标志" prop="delFlag">
|
|
|
- <el-input v-model="form.delFlag" placeholder="请输入删除标志"/>
|
|
|
+ <el-input v-model="form.delFlag" placeholder="请输入删除标志" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="创建者编号" prop="createById">
|
|
|
<el-input
|
|
@@ -318,32 +308,41 @@
|
|
|
<!-- <el-button type="primary" size="mini" @click="printConfirmHandler"
|
|
|
>打印</el-button
|
|
|
> -->
|
|
|
- <el-button
|
|
|
- v-if="excuteType == 2"
|
|
|
- :disabled="tableData.length != 1"
|
|
|
- type="primary"
|
|
|
- size="mini"
|
|
|
- @click="updateOrderData"
|
|
|
- >保存修改
|
|
|
- </el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- :disabled="tableData.length != 1"
|
|
|
- type="primary"
|
|
|
- size="mini"
|
|
|
- @click="getOrderData"
|
|
|
- >箱单
|
|
|
- </el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- :disabled="tableData.length < 2"
|
|
|
- v-if="excuteType == 1"
|
|
|
- type="primary"
|
|
|
- size="mini"
|
|
|
- @click="chooseOneToPrint"
|
|
|
- >{{ chooseState ? "退出批箱单" : "批箱单" }}
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ <div class="btnWrap">
|
|
|
+ <el-button
|
|
|
+ v-if="excuteType == 2"
|
|
|
+ :disabled="tableData.length != 1"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ @click="updateOrderData"
|
|
|
+ >保存修改
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ :disabled="tableData.length != 1"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ @click="getOrderData"
|
|
|
+ >箱单
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ :disabled="tableData.length < 2"
|
|
|
+ v-if="excuteType == 1"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ @click="chooseOneToPrint"
|
|
|
+ >{{ chooseState ? "退出批箱单" : "批箱单" }}
|
|
|
+ </el-button>
|
|
|
+ <el-switch
|
|
|
+ class="ml10"
|
|
|
+ v-model="printAuto"
|
|
|
+ active-text="自动打印"
|
|
|
+ inactive-text="手动打印"
|
|
|
+ >
|
|
|
+ </el-switch>
|
|
|
+ </div>
|
|
|
+ <div class="weightWrap">
|
|
|
+ <h1>实时重量:{{ nowWeight }}</h1>
|
|
|
+ </div>
|
|
|
<!-- <el-button
|
|
|
:disabled="tableData.length != 1"
|
|
|
type="primary"
|
|
@@ -414,9 +413,8 @@
|
|
|
size="mini"
|
|
|
:disabled="chooseState"
|
|
|
@click="handleDeleteOne(scope.$index)"
|
|
|
- >删除
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -680,7 +678,6 @@
|
|
|
</el-form>
|
|
|
</el-row>
|
|
|
<div class="queryForm">
|
|
|
- <h1>实时重量:{{ nowWright }}</h1>
|
|
|
<span class="label">批号过滤 :</span>
|
|
|
<el-input
|
|
|
v-model="batchNum"
|
|
@@ -697,9 +694,8 @@
|
|
|
size="mini"
|
|
|
:disabled="!currentRow.lotNum || isDisabled"
|
|
|
@click="addProductHandler"
|
|
|
- >添加
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >添加
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
<div class="table-wrap">
|
|
|
<el-table
|
|
@@ -746,15 +742,20 @@ import {
|
|
|
getPrintData,
|
|
|
updateProductCodeList,
|
|
|
getQrCode,
|
|
|
+ AutoPrinting,
|
|
|
} from "@/api/codeListManage/productCodeList";
|
|
|
import codeListPrint from "@/utils/print/codeListPrint";
|
|
|
+import { getServerPrintData } from "@/utils/print/printUtils";
|
|
|
+import { v4 as uuidv4 } from "uuid";
|
|
|
|
|
|
export default {
|
|
|
name: "ProductCodeList",
|
|
|
dicts: ["packaging_type", "port", "coding_list_format", "direction_of_twist"],
|
|
|
data() {
|
|
|
return {
|
|
|
- nowWright: 0,
|
|
|
+ printAuto: true, //是否自动打印
|
|
|
+ timer: null, //定时器
|
|
|
+ nowWeight: 0,
|
|
|
websocket: null,
|
|
|
// 自定义数据 start
|
|
|
printTableData: [], //需要打印的数据
|
|
@@ -807,33 +808,33 @@ export default {
|
|
|
},
|
|
|
rules: {
|
|
|
packaging: [
|
|
|
- {required: true, message: "请选择包装", trigger: "change"},
|
|
|
+ { required: true, message: "请选择包装", trigger: "change" },
|
|
|
],
|
|
|
machineTool: [
|
|
|
- {required: true, message: "请选择机台", trigger: "change"},
|
|
|
+ { required: true, message: "请选择机台", trigger: "change" },
|
|
|
],
|
|
|
workShifts: [
|
|
|
- {required: true, message: "请选择班次", trigger: "change"},
|
|
|
+ { required: true, message: "请选择班次", trigger: "change" },
|
|
|
],
|
|
|
productionDate: [
|
|
|
- {required: true, message: "请选择生产日期", trigger: "change"},
|
|
|
+ { required: true, message: "请选择生产日期", trigger: "change" },
|
|
|
],
|
|
|
- levels: [{required: true, message: "请选择等级", trigger: "change"}],
|
|
|
+ levels: [{ required: true, message: "请选择等级", trigger: "change" }],
|
|
|
// foreignTradeNumber: [
|
|
|
// { required: true, message: "请输入外贸号", trigger: "blur" },
|
|
|
// ],
|
|
|
canisterWeight: [
|
|
|
- {required: true, message: "请选择筒重", trigger: "change"},
|
|
|
+ { required: true, message: "请选择筒重", trigger: "change" },
|
|
|
],
|
|
|
boxWeight: [
|
|
|
- {required: true, message: "请选择箱重/车重", trigger: "change"},
|
|
|
+ { required: true, message: "请选择箱重/车重", trigger: "change" },
|
|
|
],
|
|
|
tubeColor: [
|
|
|
- {required: true, message: "请选择管色", trigger: "change"},
|
|
|
+ { required: true, message: "请选择管色", trigger: "change" },
|
|
|
],
|
|
|
- comPort: [{required: true, message: "请选择端口", trigger: "change"}],
|
|
|
+ comPort: [{ required: true, message: "请选择端口", trigger: "change" }],
|
|
|
printFormat: [
|
|
|
- {required: true, message: "请选择格式", trigger: "change"},
|
|
|
+ { required: true, message: "请选择格式", trigger: "change" },
|
|
|
],
|
|
|
},
|
|
|
dropDownData: {},
|
|
@@ -941,36 +942,190 @@ export default {
|
|
|
|
|
|
methods: {
|
|
|
initWebSocket() {
|
|
|
- const wsUrl = 'ws://localhost:8721/ws';
|
|
|
+ console.log("开始连接ws", process.env.VUE_APP_BASE_WS_API);
|
|
|
+ const wsUrl = "ws:" + process.env.VUE_APP_BASE_WS_API + "/currentWeight";
|
|
|
this.websocket = new WebSocket(wsUrl);
|
|
|
- this.websocket.addEventListener('open', (event) => {
|
|
|
- console.log('建立WebSocket连接');
|
|
|
+ this.websocket.addEventListener("open", (event) => {
|
|
|
+ console.log("建立WebSocket连接");
|
|
|
});
|
|
|
|
|
|
- this.websocket.addEventListener('message', (event) => {
|
|
|
- console.log(event)
|
|
|
+ this.websocket.addEventListener("message", async (event) => {
|
|
|
+ console.log(event);
|
|
|
const weight = JSON.parse(event.data).weight;
|
|
|
- this.nowWright = weight;
|
|
|
+ this.nowWeight = weight;
|
|
|
+ if (weight != 0) {
|
|
|
+ //有效重量
|
|
|
+ // if (this.nowWeight != weight) {
|
|
|
+ if (true) {
|
|
|
+ //新的重量
|
|
|
+ if (this.timer) {
|
|
|
+ clearTimeout(this.timer);
|
|
|
+ }
|
|
|
+ // 判断是否可以新增
|
|
|
+ let isValidate = await this.addIsValidate();
|
|
|
+ console.log("isValidate", isValidate);
|
|
|
+ if (isValidate) {
|
|
|
+ //可以新增
|
|
|
+ this.timer = setTimeout(() => {
|
|
|
+ this.setWeight(weight);
|
|
|
+ }, 3000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
- this.websocket.addEventListener('error', (event) => {
|
|
|
- console.error('WebSocket错误:', event);
|
|
|
+ this.websocket.addEventListener("error", (event) => {
|
|
|
+ console.error("WebSocket错误:", event);
|
|
|
});
|
|
|
|
|
|
- this.websocket.addEventListener('close', (event) => {
|
|
|
- console.log('关闭WebSocket连接');
|
|
|
+ this.websocket.addEventListener("close", (event) => {
|
|
|
+ console.log("关闭WebSocket连接");
|
|
|
});
|
|
|
},
|
|
|
+ // 开始设置新的重量
|
|
|
+ async setWeight(weight) {
|
|
|
+ console.log("设置新的重量", weight);
|
|
|
+ let newData = {};
|
|
|
+ let {
|
|
|
+ machineTool,
|
|
|
+ packaging,
|
|
|
+ boxWeight,
|
|
|
+ canisterWeight,
|
|
|
+ canisterNum,
|
|
|
+ grossWeight,
|
|
|
+ suttle, //净重
|
|
|
+ workShifts, //班次
|
|
|
+ tubeColor,
|
|
|
+ productionDate,
|
|
|
+ printFormat,
|
|
|
+ levels,
|
|
|
+ remark,
|
|
|
+ } = this.form;
|
|
|
+ console.log(this.currentRow);
|
|
|
+ let {
|
|
|
+ productName,
|
|
|
+ productSpecifications,
|
|
|
+ productColor,
|
|
|
+ lotNum,
|
|
|
+ directionOfTwist,
|
|
|
+ productId,
|
|
|
+ } = this.currentRow;
|
|
|
+ let directionOfTwistLabel = this.dict.type.direction_of_twist.find(
|
|
|
+ (item) => item.value == directionOfTwist
|
|
|
+ )?.label;
|
|
|
+ let res = await getQrCode();
|
|
|
+ let qrCode = "";
|
|
|
+ if (res.code == 200) {
|
|
|
+ qrCode = res.msg;
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
+ newData = {
|
|
|
+ // qrCode: this.getBoxOrderNum(), //箱单号
|
|
|
+ packaging, //包装方式 1:车丝 2:小包装 3:大包装
|
|
|
+ qrCode, //箱单号
|
|
|
+ levels,
|
|
|
+ machineTool,
|
|
|
+ boxWeight,
|
|
|
+ canisterWeight,
|
|
|
+ canisterNum,
|
|
|
+ workShifts,
|
|
|
+ tubeColor,
|
|
|
+ grossWeight: this.nowWeight, //毛重
|
|
|
+ // suttle: this.getSuttle(), //净重
|
|
|
+ suttle: 0, //净重
|
|
|
+ boxNum: this.tableData.length + 1, //序号
|
|
|
+ productionDate, //日期
|
|
|
+ printFormat, //格式
|
|
|
+ productName,
|
|
|
+ productSpecifications,
|
|
|
+ productColor,
|
|
|
+ lotNum,
|
|
|
+ directionOfTwist, //捻向
|
|
|
+ directionOfTwistLabel, //捻向label
|
|
|
+ remark,
|
|
|
+ productId,
|
|
|
+ };
|
|
|
+ // this.newPrintHandler(newData);
|
|
|
+ this.getOrderData(newData);
|
|
|
+ },
|
|
|
+ // 校验是否可以新增
|
|
|
+ addIsValidate() {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ if (!this.currentRow.lotNum || this.isDisabled) {
|
|
|
+ resolve(false);
|
|
|
+ }
|
|
|
+ this.$refs.form.validate(
|
|
|
+ (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ resolve(true);
|
|
|
+ } else {
|
|
|
+ resolve(false);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (error) => {
|
|
|
+ console.log(error);
|
|
|
+ resolve(false);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 新的后端打印逻辑
|
|
|
+ async newPrintHandler() {
|
|
|
+ console.log("newPrintHandler");
|
|
|
+ let printRow = this.printTableData[0];
|
|
|
+ let payload = {
|
|
|
+ qrCodeVal: "",
|
|
|
+ mapList: [],
|
|
|
+ remark: "无",
|
|
|
+ printType: "",
|
|
|
+ };
|
|
|
+ let {
|
|
|
+ id, //id
|
|
|
+ qrCode, //序号
|
|
|
+ canisterNum, //筒数
|
|
|
+ grossWeight, //毛重
|
|
|
+ suttle, //净重
|
|
|
+ remark, //备注
|
|
|
+ printFormat,
|
|
|
+ } = printRow;
|
|
|
+ let uuid = uuidv4();
|
|
|
+ let temp =
|
|
|
+ id +
|
|
|
+ "@" +
|
|
|
+ uuid +
|
|
|
+ "@" +
|
|
|
+ canisterNum +
|
|
|
+ "@" +
|
|
|
+ suttle +
|
|
|
+ "@" +
|
|
|
+ grossWeight +
|
|
|
+ "@" +
|
|
|
+ qrCode;
|
|
|
+ payload.qrCodeVal = encodeURIComponent(temp);
|
|
|
+ payload.remark = remark || "暂无";
|
|
|
+ payload.mapList = getServerPrintData(printRow);
|
|
|
+ payload.printType = printFormat == 3 ? "export" : "normal";
|
|
|
+ try {
|
|
|
+ let res = await AutoPrinting(payload);
|
|
|
+ console.log(res);
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
closeWebSocket() {
|
|
|
- if (this.websocket !== null && this.websocket.readyState !== WebSocket.CLOSED) {
|
|
|
+ if (
|
|
|
+ this.websocket !== null &&
|
|
|
+ this.websocket.readyState !== WebSocket.CLOSED
|
|
|
+ ) {
|
|
|
this.websocket.close();
|
|
|
}
|
|
|
},
|
|
|
// 毛重改变回调
|
|
|
changeGrossWeight(row) {
|
|
|
console.log(row);
|
|
|
- let {boxWeight, grossWeight, canisterWeight, canisterNum} = row;
|
|
|
+ let { boxWeight, grossWeight, canisterWeight, canisterNum } = row;
|
|
|
if (!Number(grossWeight)) return;
|
|
|
row.suttle = (
|
|
|
Number(grossWeight) -
|
|
@@ -984,16 +1139,20 @@ export default {
|
|
|
},
|
|
|
// 确认打印回调
|
|
|
printConfirmHandler(printData) {
|
|
|
- if (this.tableData.length == 0) {
|
|
|
- this.$message.warning("请添加打印的数据");
|
|
|
- return;
|
|
|
- }
|
|
|
+ // if (this.tableData.length == 0) {
|
|
|
+ // this.$message.warning("请添加打印的数据");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
|
|
|
console.log("打印", this.printTableData);
|
|
|
this.printTableData.forEach((item) => {
|
|
|
item.qrCodeData = printData + "-" + item.boxNum;
|
|
|
});
|
|
|
- codeListPrint(this.printTableData, "printDom");
|
|
|
+ // 前端打印
|
|
|
+ // codeListPrint(this.printTableData, "printDom");
|
|
|
+ // 后端打印
|
|
|
+ console.log("newPrintHandler");
|
|
|
+ this.newPrintHandler();
|
|
|
},
|
|
|
// 获取机台选项数据
|
|
|
async getLineOptionLsit() {
|
|
@@ -1013,13 +1172,13 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 获取箱单数据
|
|
|
- async getOrderData() {
|
|
|
+ async getOrderData(newData) {
|
|
|
this.$refs.form.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
try {
|
|
|
- let {sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight} =
|
|
|
+ let { sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight } =
|
|
|
this.count;
|
|
|
- let rowData = JSON.parse(JSON.stringify(this.tableData[0]));
|
|
|
+ let rowData = JSON.parse(JSON.stringify(newData));
|
|
|
console.log(rowData);
|
|
|
this.printTableData = [rowData];
|
|
|
let payLoad = {
|
|
@@ -1052,8 +1211,9 @@ export default {
|
|
|
// this.getList();
|
|
|
// return;
|
|
|
// }
|
|
|
- this.tableData[0].id = res.data;
|
|
|
+ // this.tableData[0].id = res.data;
|
|
|
this.printTableData[0].id = res.data;
|
|
|
+ console.log("printConfirmHandler");
|
|
|
this.printConfirmHandler(res.data);
|
|
|
} else {
|
|
|
console.log(res);
|
|
@@ -1070,7 +1230,7 @@ export default {
|
|
|
this.$refs.form.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
try {
|
|
|
- let {sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight} =
|
|
|
+ let { sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight } =
|
|
|
this.count;
|
|
|
let rowData = JSON.parse(JSON.stringify(this.tableData[0]));
|
|
|
this.printTableData = [rowData];
|
|
@@ -1214,7 +1374,7 @@ export default {
|
|
|
},
|
|
|
// 计算净重
|
|
|
getSuttle() {
|
|
|
- let {boxWeight, canisterWeight, canisterNum} = this.form;
|
|
|
+ let { boxWeight, canisterWeight, canisterNum } = this.form;
|
|
|
return (Number(boxWeight) - canisterWeight * canisterNum).toFixed(2);
|
|
|
},
|
|
|
// 表格点击回调
|
|
@@ -1234,7 +1394,7 @@ export default {
|
|
|
this.$refs.form.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
try {
|
|
|
- let {sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight} =
|
|
|
+ let { sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight } =
|
|
|
this.count;
|
|
|
let rowData = JSON.parse(JSON.stringify(row));
|
|
|
this.printTableData = [rowData];
|
|
@@ -1313,8 +1473,7 @@ export default {
|
|
|
if (res.code == 200) {
|
|
|
this.dropDownData = res.data;
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
- }
|
|
|
+ } catch (error) {}
|
|
|
},
|
|
|
/** 查询产品码单列表 */
|
|
|
getList() {
|
|
@@ -1509,8 +1668,7 @@ export default {
|
|
|
this.getList();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
})
|
|
|
- .catch(() => {
|
|
|
- });
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
@@ -1545,6 +1703,11 @@ export default {
|
|
|
font-size: 16px;
|
|
|
font-weight: 700;
|
|
|
}
|
|
|
+ .btn-list {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.count-area {
|