卷料打印

This commit is contained in:
zgf committed 2024-01-31 10:21:57 +08:00
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>
@@ -8,6 +8,7 @@ using HHWMS.Web.xwms.ViewModels.ReceiptHeader2VMs;
using HHWMS.Web.Models;
using System.Linq;
using System.Collections.Generic;
using NPOI.SS.Formula;
namespace HHWMS.Web.Controllers
{
@@ -319,13 +320,12 @@ namespace HHWMS.Web.Controllers
{
var warehouseId = Wtm.LoginUserInfo.Groups.FirstOrDefault().GroupCode;
var dc = Wtm.CreateDC(cskey: "hangyong");
Wtm.DC = dc;
var _unit = new UnitWork(Wtm);
using (var tran = dc.BeginTransaction())
{
try
{
Wtm.DC = dc;
var _unit = new UnitWork(Wtm);
var receipt = new ReceiptHeader2();
receipt.WarehouseId = int.Parse(warehouseId);
receipt.Code = _unitwork.GetSerialNumber("10");
@@ -368,5 +368,92 @@ namespace HHWMS.Web.Controllers
}
return JsonMore(null);
}
[HttpPost]
[ActionDescription("Sys.Create4")]
[FixConnection(CsName = "hangyong")]
public ActionResult CreateDetail4(List<receipt4> data)
{
var warehouseId = Wtm.LoginUserInfo.Groups.FirstOrDefault().GroupCode;
var dc = Wtm.CreateDC(cskey: "hangyong");
Wtm.DC = dc;
var _unit = new UnitWork(Wtm);
using (var tran = dc.BeginTransaction())
{
try
{
var receipt = new ReceiptHeader2();
receipt.WarehouseId = int.Parse(warehouseId);
receipt.Code = _unitwork.GetSerialNumber("410");
receipt.Type = "10";
receipt.FirstStatus = 0;
receipt.LastStatus = 0;
_unit.Add(receipt);
var detailList = new List<ReceiptDetail2>();
var matList = new List<Material>();
foreach(var item in data)
{
var detail = new ReceiptDetail2();
detail.WarehouseId = receipt.WarehouseId;
detail.ReceiptId = receipt.ID;
detail.ReceiptCode = receipt.Code;
detail.MaterialCode = item.JH;
detail.MaterialName = item.JH;
detail.Lot = item.Lot;
detail.Sn = item.Sn;
detail.Qty = item.Qty;
detail.Project = item.JH;
detail.InventoryStatus = "1";
detail.UserDef1 = item.Lot;
detail.UserDef2 = item.PH;
detail.Status = 0;
detail.CreateTime = DateTime.Now;
detailList.Add(detail);
matList.Add(new Material
{
UniqueCode = item.JH,
MaterialSpec = item.Lot,
MaterialType = item.Sn,
Qty = item.Qty,
Batch = item.PH,
CreateTime = DateTime.Now,
});
}
_unitwork.BatchAdd(matList.ToArray());
_unit.BatchAdd(detailList.ToArray());
receipt.TotalLines = detailList.Count();
receipt.TotalQty = detailList.Sum(x => x.Qty);
_unit.Update(receipt);
tran.Commit();
}
catch (Exception ex)
{
tran.Rollback();
return JsonMore(null, 500, ex.Message);
}
}
return JsonMore(null);
}
}
public class receipt4
{
/// <summary>
/// 卷号
/// </summary>
public string JH { get; set; }
public decimal Qty { get; set; }
public decimal Len { get; set; }
public string Lot { get; set; }
public string Sn { get; set;}
/// <summary>
/// 片厚
/// </summary>
public string PH { get; set; }
}
}
@@ -36,8 +36,8 @@ namespace HHWMS.Web
this.MakeGridHeader(x => x.Type),
this.MakeGridHeader(x => x.Name).SetWidth(150),
this.MakeGridHeader(x => x.MasterUnit),
this.MakeGridHeader(x => x.Specification).SetHide(),
this.MakeGridHeader(x => x.ClassA).SetHide(),
this.MakeGridHeader(x => x.Specification),
this.MakeGridHeader(x => x.ClassA),
this.MakeGridHeaderAction(width: 200)
};
}
@@ -27,7 +27,7 @@
width="50">
</el-table-column>
<el-table-column label="ID" width="150" align="center" prop="Id" v-if="false"></el-table-column>
<el-table-column label="物料编码" width="150" align="center" prop="MaterialCode"></el-table-column>
<el-table-column label="卷号" width="150" align="center" prop="MaterialCode"></el-table-column>
<el-table-column label="物料名称" width="150" align="center" prop="MaterialName"></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="Batch"></el-table-column>
@@ -96,7 +96,7 @@
<el-table-column label="项目名称" width="180" align="center" prop="OPPEXTNUM_0" show-overflow-tooltip></el-table-column>
<el-table-column label="名称序列" width="150" align="center" prop="BOMSEQ_0" show-overflow-tooltip></el-table-column>
<el-table-column label="计划数量" width="150" align="center" prop="EXTQTY_0"></el-table-column>
<el-table-column label="产品备注" width="100" align="center" prop="YITMDES4_0"></el-table-column>
<el-table-column label="产品备注" width="100" align="center" prop="YITMDES4_0" show-overflow-tooltip></el-table-column>
@* <el-table-column label="WMS添加" width="200" align="center" prop="WMD_USEQTY_0"></el-table-column> *@
<el-table-column label="存货追踪模式" width="100" align="center" prop="STOCOD_0"></el-table-column>
+5 -5
View File
@@ -13,7 +13,7 @@ namespace HHWMS.Web.Models
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Display(Name = "Inventory.UniqueCode", Description = "唯一码")]
[Display(Name = "Inventory4.UniqueCode", Description = "唯一码")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string UniqueCode { get; set; }
@@ -29,7 +29,7 @@ namespace HHWMS.Web.Models
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string MaterialCode { get; set; }
[Display(Name = "Inventory.MaterialType", Description = "物料类型")]
[Display(Name = "Inventory4.MaterialType", Description = "物料类型")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string MaterialType { get; set; }
@@ -37,14 +37,14 @@ namespace HHWMS.Web.Models
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string MaterialName { get; set; }
[Display(Name = "Inventory.MaterialSpec", Description = "物料规格")]
[Display(Name = "Inventory4.MaterialSpec", Description = "物料规格")]
public string MaterialSpec { get; set; }
[Display(Name = "Inventory.MaterialUnit", Description = "单位")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string MaterialUnit { get; set; }
[Display(Name = "Inventory.Batch", Description = "批次")]
[Display(Name = "Inventory4.Batch", Description = "批次")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Batch { get; set; }
@@ -60,7 +60,7 @@ namespace HHWMS.Web.Models
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SupplierCode { get; set; }
[Display(Name = "Inventory.Qty", Description = "数量")]
[Display(Name = "Inventory4.Qty", Description = "数量")]
[Column(TypeName = "decimal(12,4)")]
public decimal? Qty { get; set; }
}
+1
View File
@@ -92,6 +92,7 @@ namespace HHWMS.Web.Models
/// 规格
/// </summary>
[Column("specification")]
[Display(Name = "ReceiptDetail2.Lot")]
public string Specification { get; set; }
/// <summary>
/// 品牌
+18
View File
@@ -1497,4 +1497,22 @@
<data name="Bill.Price" xml:space="preserve">
<value>单价</value>
</data>
<data name="Material2.ClassA" xml:space="preserve">
<value>状态</value>
</data>
<data name="Inventory4.Qty" xml:space="preserve">
<value>重量</value>
</data>
<data name="Inventory4.Batch" xml:space="preserve">
<value>片厚</value>
</data>
<data name="Inventory4.MaterialType" xml:space="preserve">
<value>铁损</value>
</data>
<data name="Inventory4.MaterialSpec" xml:space="preserve">
<value>规格</value>
</data>
<data name="Inventory4.UniqueCode" xml:space="preserve">
<value>卷号</value>
</data>
</root>
+1 -1
View File
@@ -12,7 +12,7 @@ namespace HHWMS.Web
public static OracleConnection conn = null;
//user id=guest;password=guest123; data source=202.101.164.132:15555/SAGEX3;
public static string connstr = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.101.164.132)(PORT=15555))(CONNECT_DATA=(SERVICE_NAME=SAGEX3)));User Id=guest;Password=guest123";
public static string connstr = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.101.164.132)(PORT=15555))(CONNECT_DATA=(SERVICE_NAME=SAGEX3)));User Id=QRE;Password=tiger";
public static OracleConnection init()
{