散料出入库扫描 站台,系统匹配料盒

This commit is contained in:
zgf committed 2023-11-22 11:22:01 +08:00
1 parent b833415dbf
commit b864a80e29
10 files changed
+140 -61

No files matched your search

@@ -26,10 +26,61 @@ namespace HHWMS.Web
var _unitwork = new UnitWork(Wtm);
List<Inventory> inventories = _unitwork.Find<Inventory>(x => x.Status == "0").ToList();
var Invs = inventories.Take(5).ToList();
foreach (var Inv in Invs)
{
var bizData = new InStore
{
INWMS = new INWMS
{
INITEMS = new INITEMS
{
INITEM = new List<INITEMItem>()
{
}
}
}
};
foreach (var inv in Invs)
{
//var inv = _unitwork.FindById<Inventory>(int.Parse(id));
var qr = _unitwork.FindSingle<MaterialQr>(x => x.UniqueCode.Equals(inv.UniqueCode))?.QRCode;
bizData.INWMS.INITEMS.INITEM.Add(
new INITEMItem()
{
ERPSN = qr,
WMSSN = inv?.UniqueCode,
QTY = ((int?)inv?.Qty).ToString(),
TYPE = "2"
});
}
var str = JsonConvert.SerializeObject(bizData);
var request = new ServiceReference1.bizOperationV1Request
{
fromUnit = "8357S",
toUnit = "8357TEST",
fromSys = "WMSTEST",
toSys = "MES",
bizOperation = "InStore",
bizData = str
};
var client = new ServiceReference1.portTypeClient();
var result = client.bizOperationV1Async(request).Result;
if (result.Status == "Y")
{
_unitwork.BatchUpdate<Inventory>(x => Invs.Select(y => y.ID).Contains(x.ID), x => new Inventory
{
Status = "1",
UpdateBy = "invjob",
UpdateTime = DateTime.Now
});
Wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: JsonConvert.SerializeObject(request), result: "success");
//return FFResult().Message("库存回传成功").RefreshGrid();
}
else
{
Wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: JsonConvert.SerializeObject(request), result: "error");
//return FFResult().Message($"{result.Message}").RefreshGrid();
}
#region 更新时间
var job = _unitwork.FindSingle<SysJob>(x => x.JobName == context.JobDetail.Key.Name);
@@ -214,11 +214,13 @@ namespace HHWMS.Web
.FirstOrDefault();
container = _unitwork.Find<Location>(x => x.Row == station.Row
&& x.Type == LocationTypeEnum.盘料库位
&& (x.Status == LocationStatus.有货 || x.Status == LocationStatus.空容器)
&& x.Length == Length
&& !x.IsStop)
.OrderByDescending(x => x.Length - x.Width)
&& x.Type == LocationTypeEnum.盘料库位
&& (x.Status == LocationStatus.有货 || x.Status == LocationStatus.空容器)
&& x.Length == Length
&& !x.IsStop)
.OrderByDescending(x => x.Length - x.Width)
.ThenBy(x => x.Layer)
.ThenByDescending(x => x.Line)
.FirstOrDefault();
}