feat(wms): 添加PDA毛坯入库功能及标签解析
- 在ResultionPackageCodeDto中添加BlankNumber字段用于存储毛坯号 - 新增IWmBlankInventoryService接口方法PDABlankWarehousing和ResolutionPackage - 实现毛坯标签解析逻辑ResolutionPackagecode4 - 添加BlankInventoryWarehousingDto用于毛坯入库数据传输 - 在WmBlankInventoryController中新增PDA入库和标签解析API - 实现WmBlankInventoryService中PDA入库核心逻辑
This commit is contained in:
@@ -64,6 +64,18 @@ namespace ZR.Service.Utils
|
||||
{
|
||||
return ResolutionPackagecode3(code);
|
||||
}
|
||||
// 毛坯标签
|
||||
if (code.Contains('/'))
|
||||
{
|
||||
// 初步进行解析检测,增加解析成功率
|
||||
string[] splitstr = code.Split('/');
|
||||
if (splitstr.Length < 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return ResolutionPackagecode4(code);
|
||||
}
|
||||
// 成品标签
|
||||
if (code.Contains('^'))
|
||||
{
|
||||
// 初步进行解析检测,增加解析成功率
|
||||
@@ -302,5 +314,70 @@ namespace ZR.Service.Utils
|
||||
throw new Exception("解析失败" + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 4-解析毛坯标签码
|
||||
/// </summary>
|
||||
/// <param name="packagecode"></param>
|
||||
/// <returns></returns>
|
||||
private ResultionPackageCodeDto ResolutionPackagecode4(string packagecode)
|
||||
{
|
||||
ResultionPackageCodeDto resultionPackageCode = new ResultionPackageCodeDto();
|
||||
try
|
||||
{
|
||||
resultionPackageCode.originalCode = packagecode;
|
||||
// 解析外箱标签码
|
||||
string[] splitstr = packagecode.Split('/');
|
||||
// 解析批次号
|
||||
resultionPackageCode.PatchCode = splitstr[1];
|
||||
// 解析零件号
|
||||
string partnumber = splitstr[0];
|
||||
// 零件号
|
||||
resultionPackageCode.PartNumner = partnumber;
|
||||
// 毛坯号
|
||||
string _blankNumber = splitstr[5];
|
||||
// 去掉毛坯号中带横杠的后缀(如-M2)
|
||||
if (!string.IsNullOrEmpty(_blankNumber) && _blankNumber.Contains('-'))
|
||||
{
|
||||
_blankNumber = _blankNumber.Split('-')[0];
|
||||
}
|
||||
|
||||
resultionPackageCode.BlankNumber = _blankNumber;
|
||||
// 解析工单号 工单号会带个W,需要去掉
|
||||
string workoderidid = "";
|
||||
resultionPackageCode.WorkoderID = "";
|
||||
// 解析生产时间 工单号生产时间提取
|
||||
resultionPackageCode.ProductionTime = splitstr[1];
|
||||
// 解析箱子中产品数量
|
||||
string product_num = splitstr[4];
|
||||
resultionPackageCode.Quantity = int.Parse(product_num);
|
||||
// 解析产品描述 partnumber 从物料列表抓取数据
|
||||
WmMaterial material = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(it => it.Partnumber == partnumber)
|
||||
.First();
|
||||
if (material == null)
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = "物料记录未录入此零件号信息!";
|
||||
return resultionPackageCode;
|
||||
}
|
||||
string des1 = material.Description;
|
||||
string des2 = material.ProductName;
|
||||
if (!string.IsNullOrEmpty(des1))
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = des1;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(des2))
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = des2;
|
||||
}
|
||||
return resultionPackageCode;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error($"外箱标签码,解析失败 {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user