teat:禅道416

This commit is contained in:
shijing 2026-05-20 14:52:58 +08:00
parent 15bb2a55ec
commit a10f797569
2 changed files with 54 additions and 11 deletions

View File

@ -154,6 +154,7 @@ export default {
}, },
route_code:"", route_code:"",
batchOrign:{}, batchOrign:{},
preselected:[],
wprOptions: [], wprOptions: [],
materialOptions: [], materialOptions: [],
loading: false, loading: false,
@ -179,6 +180,7 @@ export default {
that.$API.wpm.wpr.list.req({page:0,wm:id}).then((res) => { that.$API.wpm.wpr.list.req({page:0,wm:id}).then((res) => {
res.forEach(item=>{ res.forEach(item=>{
item.checked = false; item.checked = false;
item.disabled = that.preselected.some(r => r.id === item.id);
}) })
that.wprOptions = res; that.wprOptions = res;
}); });
@ -197,17 +199,22 @@ export default {
obj.wm = that.batchOrign.id; obj.wm = that.batchOrign.id;
obj.batch = that.batchOrign.batch+"-"+that.addBactchNum; obj.batch = that.batchOrign.batch+"-"+that.addBactchNum;
that.addBactchNum++; that.addBactchNum++;
obj.count = 0;
obj.wm_in = ""; obj.wm_in = "";
obj.handoverbw=[]; obj.handoverbw = that.preselected.map(r => ({ number: r.number, wpr: r.id }));
obj.count = obj.handoverbw.length;
that.form.handoverb.push(obj); that.form.handoverb.push(obj);
}) })
}, },
// //
open(mode = "add",data,mtype) { open(mode = "add", data, mtype, preselected = []) {
this.mode = mode; this.mode = mode;
this.form.mtype = mtype; this.form.mtype = mtype;
this.batchOrign = data; this.batchOrign = data;
this.preselected = preselected;
this.form.handoverb = [];
this.wprOptions = [];
this.lastBatchNum = 1;
this.addBactchNum = 1;
this.getWpr(data.id); this.getWpr(data.id);
this.getNum(data.batch); this.getNum(data.batch);
this.visible = true; this.visible = true;

View File

@ -9,12 +9,19 @@
<h4>关联产品</h4> <h4>关联产品</h4>
<el-button v-if="mode=='out'" type="primary" @click="wprNumberChange">发货编号</el-button> <el-button v-if="mode=='out'" type="primary" @click="wprNumberChange">发货编号</el-button>
<el-button v-if="mode=='out'" type="warning" @click="wprNumberClear">清空编号</el-button> <el-button v-if="mode=='out'" type="warning" @click="wprNumberClear">清空编号</el-button>
<el-button type="primary" @click="openSplit">拆批</el-button>
<el-button <el-button
type="warning" type="warning"
:disabled="selectedRows.length === 0" :disabled="selectedRows.length === 0"
:loading="batchCoderLoading" :loading="batchCoderLoading"
@click="batchSendToCoder" @click="batchSendToCoder"
>批量喷码</el-button> >批量喷数字码</el-button>
<el-button
type="warning"
:disabled="selectedRows.length === 0"
:loading="batchCoderLoading2"
@click="batchSendToCoder2"
>批量喷二维码</el-button>
<el-input <el-input
style="margin-right: 5px;width: 200px;" style="margin-right: 5px;width: 200px;"
v-model="search" v-model="search"
@ -57,12 +64,13 @@
label="操作" label="操作"
fixed="right" fixed="right"
align="center" align="center"
width="200" width="220"
> >
<template #default="scope"> <template #default="scope">
<el-button v-if="mode=='ins'&&mgroupName=='毛坯检测后打码'" @click="QRCode(scope.row)" type="success">二维码</el-button> <el-button v-if="mode=='ins'&&mgroupName=='毛坯检测后打码'" @click="QRCode(scope.row)" type="success">二维码</el-button>
<el-button @click="printMaterial(scope.row)" type="primary">打签</el-button> <el-button @click="printMaterial(scope.row)" type="primary">打签</el-button>
<el-button @click="sendToCoder(scope.row)" type="warning" :loading="!!coderLoadingIds[scope.row.id]" :disabled="!!coderLoadingIds[scope.row.id]">喷码</el-button> <el-button @click="sendToCoder(scope.row,'coder_field')" type="warning" :loading="!!coderLoadingIds[scope.row.id]" :disabled="!!coderLoadingIds[scope.row.id]">喷码</el-button>
<el-button @click="sendToCoder(scope.row,'coder_field2')" type="warning" :loading="!!coderLoadingIds[scope.row.id]" :disabled="!!coderLoadingIds[scope.row.id]">喷码</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -75,6 +83,12 @@
</el-main> </el-main>
</el-container> </el-container>
</el-dialog> </el-dialog>
<handover-form2
ref="splitDialog"
:mgroupId="mgroupId"
:process="process"
@success="getRowWpr"
></handover-form2>
<el-dialog title="设置发货编号" v-model="showBatch"> <el-dialog title="设置发货编号" v-model="showBatch">
<el-form :model="wprParams" label-width="80px"> <el-form :model="wprParams" label-width="80px">
<el-form-item label="编号前缀"> <el-form-item label="编号前缀">
@ -100,8 +114,10 @@
</template> </template>
<script> <script>
import { wmState } from "@/utils/enum.js"; import { wmState } from "@/utils/enum.js";
import handoverForm2 from "./handover_form2.vue";
export default { export default {
name: "inm_record", name: "inm_record",
components: { handoverForm2 },
props: { props: {
wm: { type: String, default: "" }, wm: { type: String, default: "" },
mgroupId: { type: String, default: "" }, mgroupId: { type: String, default: "" },
@ -131,6 +147,7 @@ export default {
wprList:[], wprList:[],
selectedRows:[], selectedRows:[],
batchCoderLoading: false, batchCoderLoading: false,
batchCoderLoading2: false,
digitNum:3, digitNum:3,
wprTableHeight:500, wprTableHeight:500,
printer_name:localStorage.getItem("printer_name"), printer_name:localStorage.getItem("printer_name"),
@ -355,7 +372,7 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
}; };
}, },
//: 1 //: 1
sendToCoder(row){ sendToCoder(row, coderFieldKey = 'coder_field'){
let that = this; let that = this;
if (that.coderLoadingIds[row.id]) return; if (that.coderLoadingIds[row.id]) return;
let release = () => { let release = () => {
@ -364,7 +381,7 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
that.coderLoadingIds = map; that.coderLoadingIds = map;
}; };
that.coderLoadingIds = { ...that.coderLoadingIds, [row.id]: true }; that.coderLoadingIds = { ...that.coderLoadingIds, [row.id]: true };
that._postCoder([that.rowToTdata(row)]) that._postCoder([that.rowToTdata(row)],coderFieldKey)
.then(() => that.$message.success("喷码下发成功")) .then(() => that.$message.success("喷码下发成功"))
.finally(release); .finally(release);
}, },
@ -377,16 +394,26 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
if (!that.selectedRows.length || that.batchCoderLoading) return; if (!that.selectedRows.length || that.batchCoderLoading) return;
let tdataList = that.selectedRows.map(r => that.rowToTdata(r)); let tdataList = that.selectedRows.map(r => that.rowToTdata(r));
that.batchCoderLoading = true; that.batchCoderLoading = true;
that._postCoder(tdataList) that._postCoder(tdataList, 'coder_field')
.then(() => that.$message.success(`已入队 ${tdataList.length}`)) .then(() => that.$message.success(`已入队 ${tdataList.length}`))
.finally(() => { that.batchCoderLoading = false; }); .finally(() => { that.batchCoderLoading = false; });
}, },
//2: 使 coder_field2
batchSendToCoder2(){
let that = this;
if (!that.selectedRows.length || that.batchCoderLoading2) return;
let tdataList = that.selectedRows.map(r => that.rowToTdata(r));
that.batchCoderLoading2 = true;
that._postCoder(tdataList, 'coder_field2')
.then(() => that.$message.success(`已入队 ${tdataList.length}`))
.finally(() => { that.batchCoderLoading2 = false; });
},
//: + body + //: + body +
_postCoder(tdataList){ _postCoder(tdataList, coderFieldKey = 'coder_field'){
let that = this; let that = this;
let coder_ip = localStorage.getItem('coder_ip') || ''; let coder_ip = localStorage.getItem('coder_ip') || '';
let coder_port = localStorage.getItem('coder_port') || ''; let coder_port = localStorage.getItem('coder_port') || '';
let coder_field = localStorage.getItem('coder_field') || ''; let coder_field = localStorage.getItem(coderFieldKey) || '';
if (!coder_ip) { if (!coder_ip) {
that.$message.error('请先在右上角"喷码设置"配置喷码IP'); that.$message.error('请先在右上角"喷码设置"配置喷码IP');
return Promise.reject(new Error('no coder_ip')); return Promise.reject(new Error('no coder_ip'));
@ -405,6 +432,15 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => {
return that.$API.cm.labeltemplate.sendToCoder.req(template.id, body); return that.$API.cm.labeltemplate.sendToCoder.req(template.id, body);
}); });
}, },
openSplit() {
let that = this;
let data = {
id: that.wm,
batch: that.ofromBatch,
count: that.wprList.length,
};
that.$refs.splitDialog.open("add", data, 20, that.selectedRows);
},
// //
handleSaveSuccess() { handleSaveSuccess() {
this.$refs.tables.refresh(); this.$refs.tables.refresh();