diff --git a/HHWMS.Web/Areas/Configs/Views/Print4/Index.cshtml b/HHWMS.Web/Areas/Configs/Views/Print4/Index.cshtml index b622f88..a88b406 100644 --- a/HHWMS.Web/Areas/Configs/Views/Print4/Index.cshtml +++ b/HHWMS.Web/Areas/Configs/Views/Print4/Index.cshtml @@ -1,63 +1,68 @@
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + 生成卷号 + + + + + + @* + + + *@ + + + + + + + + + + + + + + + + + + + + + + - 创建入库单 + 创建入库单 - - 打印 + + 打印 - + + + + - - - + + + + + + + + +
@@ -88,7 +110,7 @@ len: '', jh: '', sn: '', - ph:'' + ph: '' }, ckList: [ @@ -105,7 +127,7 @@ printData: [], gendCode: '', 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 () { @@ -116,184 +138,241 @@ // this.lotList = JSON.parse(window.localStorage.getItem("lot")); }, methods: { - // 拆解卷号 - splitJH() { + createjh() { var _this = this; - - if (this.form.jh != "") { - var list = this.form.jh.split(" "); - var num = list.length; - if (num > 0) { - if (this.tableData.length > 0) { - this.tableData = []; - } - while (num > 0) { - if (list[list.length - num] != "") { - this.tableData.push(JSON.parse(JSON.stringify({ - "Ware": this.ckList.filter(function (item) { - return item.value == _this.form.ck; - })[0].label, - "CJ": this.form.cj, - "JH": list[list.length - num], - "Qty": "", - "Len": "", - "Lot": "", - "Sn": "", - "PH":"", - "RQ": new Date().toLocaleDateString() - }))); + _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: "创建成功!" + }); } - num--; - } - } - } - }, - // 拆解重量 - splitQty() { - var _this = this; - if (this.form.qty != "") { - var list = this.form.qty.split(" "); - if (list.length == this.tableData.length) { - var nn = list.length - 1; - while (nn >= 0) { - _this.tableData[nn].Qty = list[nn]; - nn--; - } - } else { - layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); - } - } - }, - // 拆解米数 - splitLen() { - var _this = this; - if (this.form.len != "") { - var list = this.form.len.split(" "); - if (list.length == this.tableData.length) { - var nn = list.length - 1; - while (nn >= 0) { - _this.tableData[nn].Len = list[nn]; - nn--; - } - } else { - layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); - } - } - }, - // 拆解规格 - splitLot() { - var _this = this; - if (this.form.lot != "") { - var list = this.form.lot.split(" "); - if (list.length == this.tableData.length) { - var nn = list.length - 1; - while (nn >= 0) { - _this.tableData[nn].Lot = list[nn]; - nn--; - } - } else { - layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); - } - } - }, - // 拆解规格 - splitSn() { - var _this = this; - if (this.form.sn != "") { - var list = this.form.sn.split(" "); - if (list.length == this.tableData.length) { - var nn = list.length - 1; - while (nn >= 0) { - _this.tableData[nn].Sn = list[nn]; - nn--; - } - } else { - layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); - } - } - }, - // 拆解片厚 - splitPh() { - var _this = this; - if (this.form.ph != "") { - console.log(this.form.ph); - var list = this.form.ph.split(" "); - if (list.length == this.tableData.length) { - var nn = list.length - 1; - while (nn >= 0) { - _this.tableData[nn].PH = list[nn]; - nn--; - } - } else { - layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); - } - } - }, - create() { - var _this = this; - if (_this.tableData.length == 0) { - _this.$message({ - message: "当前无数据!!", - type: "warning", - duration: "500", - }); - return; - } - - // 调用后台方法,判断是否在物料表内 - $.ajax({ - type: "post", - dataType: "json", - data: { data: _this.tableData }, - url: "/xwms/ReceiptHeader2/CreateDetail4", - success: function (json) { - if (json.Code != 200) { + }, + error: function (json) { _this.$message({ - message: "创建失败!" + json.Msg, - type: "warning", + message: "创建失败!", + type: "error", duration: "10000", }); - return; - } else { - _this.$message({ - message: "创建成功!" - }); - } - }, - error: function (json) { - _this.$message({ - message: "创建失败!", - type: "error", - duration: "10000", - }); - }, - }); - }, - - print() { - var _this = this; - _this.printData = []; - _this.tableData.forEach(function (item) { - _this.printData.push({ - ck:item.Ware, - cj: item.CJ, - lot: item.Lot, - rq:item.RQ, - qty:item.Qty, - len : item.Len, - jh: item.JH, - sn: item.Sn, - qrcode: item.JH + }, + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '取消输入' }); }); + }, + // 拆解卷号 + splitJH() { + var _this = this; - hiprint.init(); - var hiprintTemplate = new hiprint.PrintTemplate({ - template: this.template - }) - hiprintTemplate.print(this.printData); - }, - } - }); + if (this.form.jh != "") { + var list = this.form.jh.trim().split(/\s+/); + var num = list.length; + if (num > 0) { + if (this.tableData.length > 0) { + this.tableData = []; + } + while (num > 0) { + if (list[list.length - num] != "") { + this.tableData.push(JSON.parse(JSON.stringify({ + "Ware": this.ckList.filter(function (item) { + return item.value == _this.form.ck; + })[0].label, + "CJ": this.form.cj, + "JH": list[list.length - num], + "Qty": "", + "Len": "", + "Lot": "", + "Sn": "", + "PH": "", + "RQ": new Date().toLocaleDateString() + }))); + } + num--; + } + } + } + }, + // 拆解重量 + splitQty() { + var _this = this; + if (this.form.qty != "") { + var list = this.form.qty.trim().split(/\s+/); + if (list.length == this.tableData.length) { + var nn = list.length - 1; + while (nn >= 0) { + _this.tableData[nn].Qty = list[nn]; + nn--; + } + } else { + layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); + } + } + }, + // 拆解米数 + splitLen() { + var _this = this; + _this.tableData.forEach(function (item) { + item.Len = _this.form.len; + }) + // if (this.form.len != "") { + // var list = this.form.len.trim().split(/\s+/); + // if (list.length == this.tableData.length) { + // var nn = list.length - 1; + // while (nn >= 0) { + // _this.tableData[nn].Len = list[nn]; + // nn--; + // } + // } else { + // layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); + // } + // } + }, + // 拆解规格 + splitLot() { + var _this = this; + if (this.form.lot != "") { + var list = this.form.lot.trim().split(/\s+/); + if (list.length == this.tableData.length) { + var nn = list.length - 1; + while (nn >= 0) { + _this.tableData[nn].Lot = list[nn]; + nn--; + } + } else { + layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); + } + } + }, + // 拆解铁损 + splitSn() { + var _this = this; + _this.tableData.forEach(function (item) { + item.Sn = _this.form.sn; + }) + // if (this.form.sn != "") { + // var list = this.form.sn.trim().split(/\s+/); + // if (list.length == this.tableData.length) { + // var nn = list.length - 1; + // while (nn >= 0) { + // _this.tableData[nn].Sn = list[nn]; + // nn--; + // } + // } else { + // layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); + // } + // } + }, + // 拆解片厚 + splitPh() { + var _this = this; + _this.tableData.forEach(function (item) { + item.PH = _this.form.ph; + }) + // if (this.form.ph != "") { + // var list = this.form.ph.trim().split(/\s+/); + // if (list.length == this.tableData.length) { + // var nn = list.length - 1; + // while (nn >= 0) { + // _this.tableData[nn].PH = list[nn]; + // nn--; + // } + // } else { + // layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); + // } + // } + }, + splitCJ() { + var _this = this; + _this.tableData.forEach(function (item) { + item.CJ = _this.form.cj; + }); + }, + create() { + var _this = this; + if (_this.tableData.length == 0) { + _this.$message({ + message: "当前无数据!!", + type: "warning", + duration: "500", + }); + return; + } + + // 调用后台方法,判断是否在物料表内 + $.ajax({ + type: "post", + dataType: "json", + data: { data: _this.tableData }, + url: "/xwms/ReceiptHeader2/CreateDetail4", + success: function (json) { + if (json.Code != 200) { + _this.$message({ + message: "创建失败!" + json.Msg, + type: "warning", + duration: "10000", + }); + return; + } else { + _this.$message({ + message: "创建成功!" + }); + } + }, + error: function (json) { + _this.$message({ + message: "创建失败!", + type: "error", + duration: "10000", + }); + }, + }); + }, + + print() { + var _this = this; + _this.printData = []; + _this.tableData.forEach(function (item) { + _this.printData.push({ + ck: item.Ware, + cj: item.CJ, + lot: item.Lot, + rq: item.RQ, + qty: item.Qty, + len: item.Len, + jh: item.JH, + sn: item.Sn, + qrcode: item.JH, + PH: item.PH + }); + }); + + hiprint.init(); + var hiprintTemplate = new hiprint.PrintTemplate({ + template: this.template + }) + hiprintTemplate.print(this.printData); + }, + } + }); diff --git a/HHWMS.Web/Areas/XWMS/Controllers/ReceiptHeader2Controller.cs b/HHWMS.Web/Areas/XWMS/Controllers/ReceiptHeader2Controller.cs index b24dbce..27e48f6 100644 --- a/HHWMS.Web/Areas/XWMS/Controllers/ReceiptHeader2Controller.cs +++ b/HHWMS.Web/Areas/XWMS/Controllers/ReceiptHeader2Controller.cs @@ -439,6 +439,23 @@ namespace HHWMS.Web.Controllers } 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