U8对接WMS出入库(001:包含PDA入库,PDA出库,web批量出库,web单次出库)

This commit is contained in:
2025-06-09 18:14:52 +08:00
parent 0d9571a5b7
commit 88589fc6dc
4 changed files with 217 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ using ZR.Model.MES.wms;
using ZR.Model.MES.wms.Dto;
using ZR.Repository;
using ZR.Service.mes.wms.IService;
using ZR.Service.mes.wms_u8;
using ZR.Service.Utils;
namespace ZR.Service.mes.wms
@@ -578,6 +579,55 @@ namespace ZR.Service.mes.wms
Context.Ado.RollbackTran();
throw new Exception("记录插入失败");
}
// 出库信息转发U8
//1.构建信息
List<ERP_WMS_interactiveModelQuery> u8PackageList = new();
foreach (var item in insertList)
{
string dateString = DateTime.Now.ToString("yyyyMMdd");
// 使用正则表达式匹配日期模式
string pattern = @"(\d{2})(\d{2})(\d{2})";
Match match = Regex.Match(item.PackageCodeClient, pattern);
if (match.Success)
{
// 提取匹配的年份、月份和日期
string year = match.Groups[1].Value;
string month = match.Groups[2].Value;
string day = match.Groups[3].Value;
// 转换为四位数年份假设2000年代
string fullYear = "20" + year;
// 组合为yyyyMMdd格式
dateString = fullYear + month + day;
}
else
{
logger.Warn($"未找到匹配的日期模式:{item.PackageCodeClient}");
}
ERP_WMS_interactiveModelQuery u8PackageItem =
new()
{
materialCode = item.Partnumber,
location = item.LocationCode,
Qty = item.GoodsNumLogic.ToString(),
// 批次号
LotNo = dateString,
createTime = DateTime.Now,
userID = Createby,
guid = Guid.NewGuid().ToString(),
lineno = "涂装生产线"
};
u8PackageList.Add(u8PackageItem);
}
string urlBase = "http://gam.com.cn:8054/";
ERP_WMS_interactiveService _eRP_WMS_InteractiveService = new();
ERP_WMS_interactiveModelResult u8ErpResult = _eRP_WMS_InteractiveService.outbounded(
urlBase,
u8PackageList
);
//TODO 对U8返回结果进行解析
logger.Warn(u8ErpResult);
Context.Ado.CommitTran();
return (sum_delete, sum_insert);
}