diff --git a/ZR.Service/mes/wms/WMentryWarehousing_productService.cs b/ZR.Service/mes/wms/WMentryWarehousing_productService.cs index 18c73cd1..d395e508 100644 --- a/ZR.Service/mes/wms/WMentryWarehousing_productService.cs +++ b/ZR.Service/mes/wms/WMentryWarehousing_productService.cs @@ -20,15 +20,12 @@ namespace ZR.Service.mes.wms public int IntoProductwarehouse(WmgoodsDto wmgoods, string createName) { List preparegoodsList = new List(); - - - if (wmgoods.packagelist != null && wmgoods.packagelist.Count() > 0) { for (int i = 0; i < wmgoods.packagelist.Count(); i++) { - ResultionPackageCodeDto resultionPackage = ResolutionPackagecode(wmgoods.packagelist[i]); + ResultionPackageCodeDto resultionPackage = ResolutionPackage(wmgoods.packagelist[i]); WmGoodsNowProduction wmGood = new WmGoodsNowProduction(); wmGood.Id = SnowFlakeSingle.Instance.NextId().ToString(); @@ -125,7 +122,7 @@ namespace ZR.Service.mes.wms //3 判断箱子是否满 public bool isFullPackage(string production_packcode) { - ResultionPackageCodeDto Identity = ResolutionPackagecode(production_packcode); + ResultionPackageCodeDto Identity = ResolutionPackage(production_packcode); if (Identity == null) { return false; @@ -163,7 +160,7 @@ namespace ZR.Service.mes.wms } - ResultionPackageCodeDto Identity = ResolutionPackagecode(production_packcode); + ResultionPackageCodeDto Identity = ResolutionPackage(production_packcode); if (Identity == null) { return 0; @@ -330,158 +327,5 @@ namespace ZR.Service.mes.wms } - /// - /// 最早版本解析外箱标签码 - /// - /// - /// - private ResultionPackageCodeDto ResolutionPackagecode(string packagecode) - { - ResultionPackageCodeDto resultionPackageCode = new ResultionPackageCodeDto(); - try - { - resultionPackageCode.originalCode = packagecode; - // todo 解析外箱标签码 - string[] splitstr = packagecode.Split('^'); - resultionPackageCode.PatchCode = splitstr[0].Substring(5); - //todo 解析零件号 - string partnumber = splitstr[1].Substring(11); - //int length = lingshi.Length - 2; - //string partnumber = lingshi.Substring(0, length); - resultionPackageCode.PartNumner = partnumber; - //todo 解析工单号 - string workoderidid = splitstr[2].Substring(7); - resultionPackageCode.WorkoderID = workoderidid; - //todo 生产时间 - resultionPackageCode.ProductionTime = "20" + workoderidid.Substring(0, 6); - //todo 解析箱子中产品数量 - string product_num = splitstr[3].Substring(4); - resultionPackageCode.Quantity = int.Parse(product_num); - //todo 产品描述 partnumber - ProWorkorder_v2 workorder = Context.Queryable() - .Where(it => it.FinishedPartNumber == partnumber) - .First(); - if (workorder != null) - { - resultionPackageCode.ProductionDescribe = workorder.ProductDescription; - } - else - { - resultionPackageCode.ProductionDescribe = "生产工单无此零件号"; - } - } - catch (Exception ex) - { - logger.Error($"外箱标签码,解析失败 {ex.Message}"); - return null; - } - - return resultionPackageCode; - } - /// - /// 1-解析鲨鱼鳍外箱标签码 - /// - /// - /// - private ResultionPackageCodeDto ResolutionPackagecode1(string packagecode) - { - ResultionPackageCodeDto resultionPackageCode = new ResultionPackageCodeDto(); - try - { - resultionPackageCode.originalCode = packagecode; - // 解析外箱标签码 - string[] splitstr = packagecode.Split('^'); - // 解析批次号 - resultionPackageCode.PatchCode = splitstr[0].Substring(5); - // 解析零件号 - string partnumber = splitstr[1].Substring(11); - // 有的零件号带了-FL,不是很标准 - resultionPackageCode.PartNumner = partnumber; - // 解析工单号 工单号会带个W,需要去掉 - string workoderidid = splitstr[2].Substring(7); - resultionPackageCode.WorkoderID = workoderidid; - // 解析生产时间 工单号生产时间提取 - resultionPackageCode.ProductionTime = string.Concat("20", workoderidid.AsSpan(0, 6)); - // 解析箱子中产品数量 - string product_num = splitstr[3].Substring(4); - resultionPackageCode.Quantity = int.Parse(product_num); - // 解析产品描述 partnumber 从物料列表抓取数据 - WmMaterial material = Context.Queryable().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; - } - if (string.IsNullOrEmpty(des2)) - { - resultionPackageCode.ProductionDescribe = des2; - } - return resultionPackageCode; - } - catch (Exception ex) - { - logger.Error($"外箱标签码,解析失败 {ex.Message}"); - return null; - } - } - // 2-解析门把手 - private ResultionPackageCodeDto ResolutionPackagecode2(string packagecode) - { - ResultionPackageCodeDto resultionPackageCode = new ResultionPackageCodeDto(); - try - { - // 原始编码 - resultionPackageCode.originalCode = packagecode; - // 解析外箱标签码 - string[] splitstr = packagecode.Split('^'); - // 解析批次号 - resultionPackageCode.PatchCode = splitstr[3].Substring(3); - // 解析零件号 - string partnumber = splitstr[4].Substring(3); - resultionPackageCode.PartNumner = partnumber; - // 解析工单号 - string workoderidid = splitstr[3].Substring(6, 6); - resultionPackageCode.WorkoderID = workoderidid; - // 生产时间 - resultionPackageCode.ProductionTime = "20" + workoderidid.Substring(0, 6); - //todo 解析箱子中产品数量 - string product_num = splitstr[5].Substring(3); - resultionPackageCode.Quantity = int.Parse(product_num); - // 解析产品描述 partnumber 从物料列表抓取数据 - WmMaterial material = Context.Queryable().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; - } - else - { - resultionPackageCode.ProductionDescribe = "物料记录内未填写详情信息!"; - } - return resultionPackageCode; - } - catch (Exception ex) - { - logger.Error($"外箱标签码,解析失败 {ex.Message}"); - return null; - } - } - } }