打印
库存回传 入库扫描逻辑 添加物料二维码和唯一码对应表
This commit is contained in:
1 parent
f9bf7be066
commit
da78422528
19 files changed
+1684
-115
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
@@ -45,7 +46,7 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult GenCode(string code)
|
||||
public ActionResult GenCode(string code, int num = 1)
|
||||
{
|
||||
var material = _unitwork.FindSingle<Material>(x => x.QRCode.Equals(code));
|
||||
if (material == null)
|
||||
@@ -54,20 +55,23 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(material.UniqueCode))
|
||||
var materialQrList = new List<MaterialQr>();
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
var prefix = code.Split("@")[1].Substring(2);
|
||||
var unique = _unitwork.GetSerialNumber(prefix, 8);
|
||||
var uniqueCode = prefix + unique;
|
||||
var uniqueCode = _unitwork.GetSerialNumber(prefix, length: 8);
|
||||
//var uniqueCode = prefix + unique;
|
||||
|
||||
material.UniqueCode = uniqueCode;
|
||||
_unitwork.Update(material);
|
||||
return JsonMore(uniqueCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
return JsonMore(material.UniqueCode);
|
||||
materialQrList.Add(new MaterialQr
|
||||
{
|
||||
QRCode = code,
|
||||
UniqueCode = uniqueCode,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateBy = Wtm.LoginUserInfo.ITCode
|
||||
});
|
||||
}
|
||||
_unitwork.BatchAdd(materialQrList.ToArray());
|
||||
return JsonMore(materialQrList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace HHWMS.Web
|
||||
protected override IEnumerable<IGridColumn<Material_View>> InitGridHeader()
|
||||
{
|
||||
return new List<GridColumn<Material_View>>{
|
||||
this.MakeGridHeader(x => x.UniqueCode).SetWidth(220),
|
||||
this.MakeGridHeader(x => x.UniqueCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.QRCode),
|
||||
this.MakeGridHeader(x => x.SourceCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialCode),
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
<el-row id="print">
|
||||
<el-row>
|
||||
<el-col :span="16">
|
||||
<el-col :span="12">
|
||||
<el-input v-model="qrcode"
|
||||
placeholder="请扫描二维码"
|
||||
@@change="scanCode" ref="QrCode">
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-input v-model.number="num"
|
||||
placeholder="请输入数量">
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button type="primary" @@click="genCode">生成</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -28,6 +33,7 @@
|
||||
printData:[],
|
||||
gendCode: '',
|
||||
qrcode: '',
|
||||
num: 1,
|
||||
template: {
|
||||
"panels": [
|
||||
{
|
||||
@@ -80,38 +86,6 @@
|
||||
duration: "10000",
|
||||
});
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { code: _this.qrcode },
|
||||
url: "/configs/Print/GenCode",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: "生成失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
return;
|
||||
}
|
||||
else {
|
||||
_this.gendCode += json.Data + '\n';
|
||||
_this.printData.push({ uniqueCode: json.Data });
|
||||
//清空
|
||||
_this.qrcode = '';
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "生成失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
@@ -124,11 +98,27 @@
|
||||
},
|
||||
genCode() {
|
||||
var _this = this;
|
||||
if (_this.qrcode == "") {
|
||||
_this.$message({
|
||||
message: "请扫描二维码后再操作!",
|
||||
type: "warning",
|
||||
duration: "500",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (_this.num == "") {
|
||||
_this.$message({
|
||||
message: "请输入数量后再操作!",
|
||||
type: "warning",
|
||||
duration: "500",
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 调用后台方法,生成唯一码,(流水号)
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { code: _this.qrcode },
|
||||
data: { code: _this.qrcode, num: _this.num },
|
||||
url: "/configs/Print/GenCode",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
@@ -140,8 +130,12 @@
|
||||
return;
|
||||
}
|
||||
else{
|
||||
_this.gendCode += json.Data + '\n';
|
||||
_this.printData.push({ uniqueCode: json.Data });
|
||||
console.log(json);
|
||||
json.Data.forEach(function (item) {
|
||||
_this.gendCode += item.UniqueCode + '\n';
|
||||
_this.printData.push({ uniqueCode: item.UniqueCode });
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
@@ -152,8 +146,7 @@
|
||||
});
|
||||
},
|
||||
});
|
||||
//清空
|
||||
_this.qrcode = '';
|
||||
_this.unm = 1;
|
||||
},
|
||||
print() {
|
||||
var _this = this;
|
||||
@@ -164,6 +157,9 @@
|
||||
})
|
||||
hiprintTemplate.print(this.printData);
|
||||
_this.printData = [];
|
||||
//清空
|
||||
_this.qrcode = '';
|
||||
_this.unm = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user