卷料打印
This commit is contained in:
1 parent
99bf79a30d
commit
7f5b5bc521
13 files changed
+469
-26
No files matched your search
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
using ICSharpCode.SharpZipLib.Core;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
[Area("configs")]
|
||||
[ActionDescription("卷料库打码")]
|
||||
public partial class Print4Controller : BaseController
|
||||
{
|
||||
private readonly IUnitWork _unitwork;
|
||||
|
||||
public Print4Controller(IUnitWork unitwork)
|
||||
{
|
||||
_unitwork = unitwork;
|
||||
}
|
||||
|
||||
#region Search
|
||||
|
||||
[ActionDescription("Sys.Search")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
var vm = Wtm.CreateVM<ContainerListVM>();
|
||||
return PartialView(vm);
|
||||
}
|
||||
#endregion Search
|
||||
|
||||
}
|
||||
}
|
||||
@@ -32,19 +32,20 @@ namespace HHWMS.Web
|
||||
protected override IEnumerable<IGridColumn<Material_View>> InitGridHeader()
|
||||
{
|
||||
return new List<GridColumn<Material_View>>{
|
||||
this.MakeGridHeader(x => x.UniqueCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.QRCode),
|
||||
this.MakeGridHeader(x => x.SourceCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialCode),
|
||||
this.MakeGridHeader(x => x.UniqueCode),
|
||||
this.MakeGridHeader(x => x.MaterialType),
|
||||
this.MakeGridHeader(x => x.MaterialName),
|
||||
this.MakeGridHeader(x => x.MaterialSpec),
|
||||
this.MakeGridHeader(x => x.MaterialUnit).SetWidth(80),
|
||||
this.MakeGridHeader(x => x.Batch).SetWidth(150),
|
||||
this.MakeGridHeader(x => x.Batch),
|
||||
this.MakeGridHeader(x => x.Qty),
|
||||
this.MakeGridHeader(x => x.CreateTime),
|
||||
this.MakeGridHeader(x => x.QRCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.SourceCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialName).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialUnit).SetHide(),
|
||||
this.MakeGridHeader(x => x.Lot).SetHide(),
|
||||
this.MakeGridHeader(x => x.CompanyCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.SupplierCode),
|
||||
this.MakeGridHeader(x => x.Qty),
|
||||
this.MakeGridHeader(x => x.SupplierCode).SetHide(),
|
||||
this.MakeGridHeaderAction(width: 200)
|
||||
};
|
||||
}
|
||||
@@ -71,6 +72,7 @@ namespace HHWMS.Web
|
||||
CompanyCode = x.CompanyCode,
|
||||
SupplierCode = x.SupplierCode,
|
||||
Qty = x.Qty,
|
||||
CreateTime = x.CreateTime
|
||||
})
|
||||
.OrderBy(x => x.ID);
|
||||
return query;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
@@ -12,7 +12,7 @@ namespace HHWMS.Web
|
||||
{
|
||||
public partial class MaterialSearcher : BaseSearcher
|
||||
{
|
||||
[Display(Name = "Inventory.UniqueCode")]
|
||||
[Display(Name = "Inventory4.UniqueCode")]
|
||||
public String UniqueCode { get; set; }
|
||||
[Display(Name = "Inventory.QRCode")]
|
||||
public String QRCode { get; set; }
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<wt:searchpanel vm="@Model" reset-btn="true">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||
<wt:textbox field="Searcher.UniqueCode" />
|
||||
<wt:textbox field="Searcher.QRCode" />
|
||||
<wt:textbox field="Searcher.MaterialCode" />
|
||||
@* <wt:textbox field="Searcher.QRCode" />
|
||||
<wt:textbox field="Searcher.MaterialCode" /> *@
|
||||
</wt:row>
|
||||
</wt:searchpanel>
|
||||
<wt:grid vm="@Model" url="/configs/Material/Search"/>
|
||||
@@ -0,0 +1,299 @@
|
||||
<div id="print4">
|
||||
|
||||
<el-form ref="form" :model="form" size="mini" label-width="100px">
|
||||
<el-row>
|
||||
<el-form-item label="仓库">
|
||||
<el-select v-model="form.ck" :popper-append-to-body="false" placeholder="仓库">
|
||||
<el-option v-for="item in ckList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家">
|
||||
<el-input v-model="form.cj" placeholder="厂家">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="卷号">
|
||||
<el-input v-model="form.jh" @@keyup.enter.native="splitJH()"
|
||||
placeholder="卷号">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格">
|
||||
<el-input v-model="form.lot" @@keyup.enter.native="splitLot()"
|
||||
placeholder="规格">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="重量">
|
||||
<el-input v-model="form.qty" @@keyup.enter.native="splitQty()"
|
||||
placeholder="重量">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="米数">
|
||||
<el-input v-model="form.len" @@keyup.enter.native="splitLen()"
|
||||
placeholder="米数">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="铁损">
|
||||
<el-input v-model="form.sn" @@keyup.enter.native="splitSn()"
|
||||
placeholder="铁损">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="片厚">
|
||||
<el-input v-model="form.ph" @@keyup.enter.native="splitPh()"
|
||||
placeholder="片厚">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-col :span="4">
|
||||
<el-button type="primary" @@click="create">创建入库单</el-button>
|
||||
</el-col>
|
||||
<el-col :span="20">
|
||||
<el-button style="float: right" type="primary" @@click="print">打印</el-button>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
<el-table :data="tableData"
|
||||
max-height="300" stripe border
|
||||
style="width: 100%"
|
||||
ref="tableData">
|
||||
<el-table-column type="index"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column label="仓库" width="150" align="center" prop="Ware"></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="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="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="Sn"></el-table-column>
|
||||
<el-table-column label="片厚" width="150" align="center" prop="PH"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: "#print4",
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
ck: '1',
|
||||
cj: '',
|
||||
lot: '',
|
||||
qty: '',
|
||||
len: '',
|
||||
jh: '',
|
||||
sn: '',
|
||||
ph:''
|
||||
},
|
||||
|
||||
ckList: [
|
||||
{
|
||||
value: '1',
|
||||
label: '立库'
|
||||
}, {
|
||||
value: '2',
|
||||
label: '地面库'
|
||||
}
|
||||
],
|
||||
tableData: [],
|
||||
lotList: [],
|
||||
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 }] }
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
// var t = window.localStorage.getItem("lot");
|
||||
// if (t == undefined) {
|
||||
// window.localStorage.setItem("lot", JSON.stringify(this.lotList));
|
||||
// }
|
||||
// this.lotList = JSON.parse(window.localStorage.getItem("lot"));
|
||||
},
|
||||
methods: {
|
||||
// 拆解卷号
|
||||
splitJH() {
|
||||
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()
|
||||
})));
|
||||
}
|
||||
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) {
|
||||
_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
|
||||
});
|
||||
});
|
||||
|
||||
hiprint.init();
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({
|
||||
template: this.template
|
||||
})
|
||||
hiprintTemplate.print(this.printData);
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
Reference in new issue
Block a user