卷料打印修改

This commit is contained in:
zgf committed 2024-02-02 12:46:16 +08:00
1 parent 1aa74f29a2
commit c1bc3d927f
2 files changed
+156 -60

No files matched your search

+139 -60
View File
@@ -1,7 +1,8 @@
<div id="print4"> <div id="print4">
<el-form ref="form" :model="form" size="mini" label-width="100px"> <el-form ref="form" :inline="true" :model="form" size="mini" label-width="100px">
<el-row> <el-row>
<el-col :span="24">
<el-form-item label="仓库"> <el-form-item label="仓库">
<el-select v-model="form.ck" :popper-append-to-body="false" placeholder="仓库"> <el-select v-model="form.ck" :popper-append-to-body="false" placeholder="仓库">
<el-option v-for="item in ckList" <el-option v-for="item in ckList"
@@ -11,15 +12,17 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-button type="primary" size="small" @@click="createjh">生成卷号</el-button>
<el-col :span="24">
<el-form-item label="厂家"> <el-form-item label="厂家">
<el-input v-model="form.cj" placeholder="厂家"> <el-input v-model="form.cj" placeholder="厂家" @@keyup.enter.native="splitCJ()">
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="卷号"> @* <el-form-item label="卷号">
<el-input v-model="form.jh" @@keyup.enter.native="splitJH()" <el-input v-model="form.jh" @@keyup.enter.native="splitJH()"
placeholder="卷号"> placeholder="卷号">
</el-input> </el-input>
</el-form-item> </el-form-item> *@
<el-form-item label="规格"> <el-form-item label="规格">
<el-input v-model="form.lot" @@keyup.enter.native="splitLot()" <el-input v-model="form.lot" @@keyup.enter.native="splitLot()"
placeholder="规格"> placeholder="规格">
@@ -30,6 +33,7 @@
placeholder="重量"> placeholder="重量">
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-col :span="24">
<el-form-item label="米数"> <el-form-item label="米数">
<el-input v-model="form.len" @@keyup.enter.native="splitLen()" <el-input v-model="form.len" @@keyup.enter.native="splitLen()"
placeholder="米数"> placeholder="米数">
@@ -45,19 +49,20 @@
placeholder="片厚"> placeholder="片厚">
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-col :span="4"> <el-col :span="4">
<el-button type="primary" @@click="create">创建入库单</el-button> <el-button type="primary" @@click="create">创建入库单</el-button>
</el-col> </el-col>
<el-col :span="20"> <el-col :span="4">
<el-button style="float: right" type="primary" @@click="print">打印</el-button> <el-button type="success" @@click="print">打印</el-button>
</el-col> </el-col>
<el-table :data="tableData" <el-table :data="tableData"
max-height="300" stripe border max-height="600" stripe border
style="width: 100%" style="width: 100%"
ref="tableData"> ref="tableData">
<el-table-column type="index" <el-table-column type="index"
@@ -67,11 +72,28 @@
<el-table-column label="厂家" width="150" align="center" prop="CJ"></el-table-column> <el-table-column label="厂家" width="150" align="center" prop="CJ"></el-table-column>
<el-table-column label="日期" width="150" align="center" prop="RQ"></el-table-column> <el-table-column label="日期" width="150" align="center" prop="RQ"></el-table-column>
<el-table-column label="卷号" width="150" align="center" prop="JH"></el-table-column> <el-table-column label="卷号" width="150" align="center" prop="JH"></el-table-column>
<el-table-column label="规格" width="150" align="center" prop="Lot"></el-table-column>
<el-table-column label="规格" width="150" align="center" prop="Lot">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.Lot"></el-input>
</template>
</el-table-column>
<el-table-column label="重量" width="150" align="center" prop="Qty"></el-table-column> <el-table-column label="重量" width="150" align="center" prop="Qty"></el-table-column>
<el-table-column label="米数" width="150" align="center" prop="Len"></el-table-column> <el-table-column label="米数" width="150" align="center" prop="Len">
<el-table-column label="铁损" width="150" align="center" prop="Sn"></el-table-column> <template slot-scope="scope">
<el-table-column label="片厚" width="150" align="center" prop="PH"></el-table-column> <el-input size="small" v-model="scope.row.Len"></el-input>
</template>
</el-table-column>
<el-table-column label="铁损" width="150" align="center" prop="Sn">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.Sn"></el-input>
</template>
</el-table-column>
<el-table-column label="片厚" width="150" align="center" prop="PH">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.PH"></el-input>
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
@@ -88,7 +110,7 @@
len: '', len: '',
jh: '', jh: '',
sn: '', sn: '',
ph:'' ph: ''
}, },
ckList: [ ckList: [
@@ -105,7 +127,7 @@
printData: [], printData: [],
gendCode: '', gendCode: '',
clear: false, clear: false,
template: { "panels": [{ "index": 0, "height": 50, "width": 80, "paperHeader": 49.5, "paperFooter": 141.73228346456693, "printElements": [{ "options": { "left": 18, "top": 6, "height": 20, "width": 182, "title": "厂家", "field": "cj", "textContentVerticalAlign": "middle" }, "printElementType": { "type": "text" } }, { "options": { "left": 120, "top": 25.5, "height": 20, "width": 80, "title": "规格", "textContentVerticalAlign": "middle", "field": "lot" }, "printElementType": { "type": "text" } }, { "options": { "left": 18, "top": 25.5, "height": 20, "width": 80, "title": "仓库", "textContentVerticalAlign": "middle", "field": "ck" }, "printElementType": { "type": "text" } }, { "options": { "left": 120, "top": 46.5, "height": 20, "width": 80, "title": "铁损", "textContentVerticalAlign": "middle", "field": "sn" }, "printElementType": { "type": "text" } }, { "options": { "left": 18, "top": 46.5, "height": 20, "width": 80, "title": "米数", "textContentVerticalAlign": "middle", "field": "len" }, "printElementType": { "type": "text" } }, { "options": { "left": 120, "top": 66, "height": 20, "width": 80, "title": "重量", "textContentVerticalAlign": "middle", "field": "qty" }, "printElementType": { "type": "text" } }, { "options": { "left": 18, "top": 66, "height": 20, "width": 80, "title": "日期", "textContentVerticalAlign": "middle", "field": "rq" }, "printElementType": { "type": "text" } }, { "options": { "left": 18, "top": 85.5, "height": 20, "width": 80, "title": "卷号", "textContentVerticalAlign": "middle", "field": "jh" }, "printElementType": { "type": "text" } }, { "options": { "left": 120, "top": 85.5, "height": 50, "width": 50, "title": "123123123", "textType": "qrcode" }, "printElementType": { "type": "text" } }], "paperNumberLeft": 196.5, "paperNumberTop": 118.5, "paperNumberDisabled": true }] } template: { "panels": [{ "index": 0, "height": 50, "width": 80, "paperHeader": 49.5, "paperFooter": 141.73228346456693, "printElements": [{ "options": { "left": 18, "top": 6, "height": 20, "width": 182, "title": "厂家", "field": "cj", "textContentVerticalAlign": "middle" }, "printElementType": { "type": "text" } }, { "options": { "left": 120, "top": 25.5, "height": 20, "width": 80, "title": "规格", "textContentVerticalAlign": "middle", "field": "lot" }, "printElementType": { "type": "text" } }, { "options": { "left": 18, "top": 25.5, "height": 20, "width": 80, "title": "仓库", "textContentVerticalAlign": "middle", "field": "ck" }, "printElementType": { "type": "text" } }, { "options": { "left": 120, "top": 46.5, "height": 20, "width": 80, "title": "铁损", "textContentVerticalAlign": "middle", "field": "sn" }, "printElementType": { "type": "text" } }, { "options": { "left": 18, "top": 46.5, "height": 20, "width": 80, "title": "米数", "textContentVerticalAlign": "middle", "field": "len" }, "printElementType": { "type": "text" } }, { "options": { "left": 120, "top": 66, "height": 20, "width": 80, "title": "重量", "textContentVerticalAlign": "middle", "field": "qty" }, "printElementType": { "type": "text" } }, { "options": { "left": 18, "top": 66, "height": 20, "width": 80, "title": "日期", "textContentVerticalAlign": "middle", "field": "rq" }, "printElementType": { "type": "text" } }, { "options": { "left": 18, "top": 85.5, "height": 20, "width": 80, "title": "卷号", "textContentVerticalAlign": "middle", "field": "jh" }, "printElementType": { "type": "text" } }, { "options": { "left": 120, "top": 85.5, "height": 50, "width": 50, "title": "123123123", "textType": "qrcode" }, "printElementType": { "type": "text" } }, { "options": { "left": 18, "top": 105, "height": 20, "width": 80, "title": "片厚", "field": "PH", "textContentVerticalAlign": "middle" }, "printElementType": { "type": "text" } }], "paperNumberLeft": 196.5, "paperNumberTop": 118.5, "paperNumberDisabled": true }] }
} }
}, },
mounted: function () { mounted: function () {
@@ -116,12 +138,54 @@
// this.lotList = JSON.parse(window.localStorage.getItem("lot")); // this.lotList = JSON.parse(window.localStorage.getItem("lot"));
}, },
methods: { methods: {
createjh() {
var _this = this;
_this.$prompt('请输入生成数量', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
$.ajax({
type: "post",
dataType: "json",
data: { data: value },
url: "/xwms/ReceiptHeader2/Createjh",
success: function (json) {
if (json.Code != 200) {
_this.$message({
message: "生成失败!" + json.Msg,
type: "warning",
duration: "10000",
});
return;
} else {
_this.form.jh = json.Data;
_this.splitJH();
_this.$message({
message: "创建成功!"
});
}
},
error: function (json) {
_this.$message({
message: "创建失败!",
type: "error",
duration: "10000",
});
},
});
}).catch(() => {
this.$message({
type: 'info',
message: '取消输入'
});
});
},
// 拆解卷号 // 拆解卷号
splitJH() { splitJH() {
var _this = this; var _this = this;
if (this.form.jh != "") { if (this.form.jh != "") {
var list = this.form.jh.split(" "); var list = this.form.jh.trim().split(/\s+/);
var num = list.length; var num = list.length;
if (num > 0) { if (num > 0) {
if (this.tableData.length > 0) { if (this.tableData.length > 0) {
@@ -139,7 +203,7 @@
"Len": "", "Len": "",
"Lot": "", "Lot": "",
"Sn": "", "Sn": "",
"PH":"", "PH": "",
"RQ": new Date().toLocaleDateString() "RQ": new Date().toLocaleDateString()
}))); })));
} }
@@ -152,7 +216,7 @@
splitQty() { splitQty() {
var _this = this; var _this = this;
if (this.form.qty != "") { if (this.form.qty != "") {
var list = this.form.qty.split(" "); var list = this.form.qty.trim().split(/\s+/);
if (list.length == this.tableData.length) { if (list.length == this.tableData.length) {
var nn = list.length - 1; var nn = list.length - 1;
while (nn >= 0) { while (nn >= 0) {
@@ -167,24 +231,27 @@
// 拆解米数 // 拆解米数
splitLen() { splitLen() {
var _this = this; var _this = this;
if (this.form.len != "") { _this.tableData.forEach(function (item) {
var list = this.form.len.split(" "); item.Len = _this.form.len;
if (list.length == this.tableData.length) { })
var nn = list.length - 1; // if (this.form.len != "") {
while (nn >= 0) { // var list = this.form.len.trim().split(/\s+/);
_this.tableData[nn].Len = list[nn]; // if (list.length == this.tableData.length) {
nn--; // var nn = list.length - 1;
} // while (nn >= 0) {
} else { // _this.tableData[nn].Len = list[nn];
layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); // nn--;
} // }
} // } else {
// layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// }
// }
}, },
// 拆解规格 // 拆解规格
splitLot() { splitLot() {
var _this = this; var _this = this;
if (this.form.lot != "") { if (this.form.lot != "") {
var list = this.form.lot.split(" "); var list = this.form.lot.trim().split(/\s+/);
if (list.length == this.tableData.length) { if (list.length == this.tableData.length) {
var nn = list.length - 1; var nn = list.length - 1;
while (nn >= 0) { while (nn >= 0) {
@@ -196,38 +263,49 @@
} }
} }
}, },
// 拆解规格 // 拆解铁损
splitSn() { splitSn() {
var _this = this; var _this = this;
if (this.form.sn != "") { _this.tableData.forEach(function (item) {
var list = this.form.sn.split(" "); item.Sn = _this.form.sn;
if (list.length == this.tableData.length) { })
var nn = list.length - 1; // if (this.form.sn != "") {
while (nn >= 0) { // var list = this.form.sn.trim().split(/\s+/);
_this.tableData[nn].Sn = list[nn]; // if (list.length == this.tableData.length) {
nn--; // var nn = list.length - 1;
} // while (nn >= 0) {
} else { // _this.tableData[nn].Sn = list[nn];
layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); // nn--;
} // }
} // } else {
// layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// }
// }
}, },
// 拆解片厚 // 拆解片厚
splitPh() { splitPh() {
var _this = this; var _this = this;
if (this.form.ph != "") { _this.tableData.forEach(function (item) {
console.log(this.form.ph); item.PH = _this.form.ph;
var list = this.form.ph.split(" "); })
if (list.length == this.tableData.length) { // if (this.form.ph != "") {
var nn = list.length - 1; // var list = this.form.ph.trim().split(/\s+/);
while (nn >= 0) { // if (list.length == this.tableData.length) {
_this.tableData[nn].PH = list[nn]; // var nn = list.length - 1;
nn--; // while (nn >= 0) {
} // _this.tableData[nn].PH = list[nn];
} else { // nn--;
layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); // }
} // } else {
} // layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// }
// }
},
splitCJ() {
var _this = this;
_this.tableData.forEach(function (item) {
item.CJ = _this.form.cj;
});
}, },
create() { create() {
var _this = this; var _this = this;
@@ -275,15 +353,16 @@
_this.printData = []; _this.printData = [];
_this.tableData.forEach(function (item) { _this.tableData.forEach(function (item) {
_this.printData.push({ _this.printData.push({
ck:item.Ware, ck: item.Ware,
cj: item.CJ, cj: item.CJ,
lot: item.Lot, lot: item.Lot,
rq:item.RQ, rq: item.RQ,
qty:item.Qty, qty: item.Qty,
len : item.Len, len: item.Len,
jh: item.JH, jh: item.JH,
sn: item.Sn, sn: item.Sn,
qrcode: item.JH qrcode: item.JH,
PH: item.PH
}); });
}); });
@@ -439,6 +439,23 @@ namespace HHWMS.Web.Controllers
} }
return JsonMore(null); return JsonMore(null);
} }
[HttpPost]
[ActionDescription("Sys.Createjh")]
[FixConnection(CsName = "hangyong")]
public ActionResult Createjh(int data)
{
var dc = Wtm.CreateDC(cskey: "hangyong");
Wtm.DC = dc;
var str = "";
while(data > 0)
{
var jh = _unitwork.GetSerialNumber("JH");
str += jh + " ";
data--;
}
return JsonMore(str);
}
} }
public class receipt4 public class receipt4