库存回传
入库扫描逻辑
添加物料二维码和唯一码对应表
This commit is contained in:
zgf committed 2023-11-09 17:17:05 +08:00
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);
}
}
}