diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WMentryWarehousing_productController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WMentryWarehousing_productController.cs index 27cc64cc..8a130d11 100644 --- a/ZR.Admin.WebApi/Controllers/mes/wms/WMentryWarehousing_productController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WMentryWarehousing_productController.cs @@ -159,17 +159,25 @@ namespace ZR.Admin.WebApi.Controllers.mes.wms [HttpGet("resolution_package")] public IActionResult ResolutionPackage(string code = "") { - if (string.IsNullOrEmpty(code)) + try { + if (string.IsNullOrEmpty(code)) + { - return ToResponse(new ApiResult(200, "传入为空", false)); + return ToResponse(new ApiResult(200, "传入为空", false)); + } + ResultionPackageCodeDto data = this.wm_entryWarehousing_productService.ResolutionPackage(code); + if (data == null) + { + return ToResponse(new ApiResult(500, "外标签解析异常", data)); + } + return ToResponse(new ApiResult(200, "success", data)); } - ResultionPackageCodeDto data = this.wm_entryWarehousing_productService.ResolutionPackage(code); - if (data == null) + catch(Exception ex) { - return ToResponse(new ApiResult(500, "外标签解析异常", data)); + return ToResponse(new ApiResult(500, ex.Message, "外标签解析异常")); } - return ToResponse(new ApiResult(200, "success", data)); + ; } /// diff --git a/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-毛坯库存库存变动记录表-0513140439.zip b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-毛坯库存库存变动记录表-0513140439.zip deleted file mode 100644 index 7e132c55..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-毛坯库存库存变动记录表-0513140439.zip and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-毛坯库存表-0513140434.zip b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-毛坯库存表-0513140434.zip deleted file mode 100644 index 864ffebf..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-毛坯库存表-0513140434.zip and /dev/null differ diff --git a/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs b/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs index b454d0e0..822128cd 100644 --- a/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs +++ b/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs @@ -39,7 +39,9 @@ /// public string ProductionDescribe { get; set; } - - + /// + /// 备注 + /// + public string Remark { get; set; } } } diff --git a/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs b/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs index 82d02e0b..6d6cc224 100644 --- a/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs +++ b/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs @@ -20,6 +20,45 @@ namespace ZR.Model.MES.wms.Dto } + /// + /// 拼箱操作Json记录 + /// + public class WmGoodsConsolidationJSON + { + /// + /// 拼箱涉及箱数据 + /// + public List PackageList { get; set; } + /// + /// 拼箱最终工单号 + /// + public string WorkOrderId { get; set; } + /// + /// 拼箱最终零件号 + /// + public string NewPartnumber { get; set; } + /// + /// 拼箱最终生成的批次号 + /// + public string NewPatchCode { get; set; } + /// + /// 拼箱最终生成的流水号 + /// + public string SerialNumber { get; set; } + /// + /// 拼箱最终数量 + /// + public int NewQuantityCount { get; set; } + /// + /// 拼箱班组 + /// + public string Team { get; set; } + /// + /// 拼箱时间 + /// + public DateTime? Time { get; set; } + } + /// /// 拆箱操作 /// @@ -31,4 +70,50 @@ namespace ZR.Model.MES.wms.Dto public string CreateBy { get; set; } } + /// + /// 拆箱操作Json记录 + /// + public class WmGoodsUnpackingJSON + { + /// + /// 拆箱主箱信息 + /// + public ResultionPackageCodeDto MainPackage { get; set; } + /// + /// 零件号 + /// + public string NewPartnumber { get; set; } + /// + /// 新标签1 + /// + public string NewPatchCode1 { get; set; } + /// + /// 新标签2 + /// + public string NewPatchCode2 { get; set; } + /// + /// 新流水号1 + /// + public string SerialNumber1 { get; set; } + /// + /// 新流水号2 + /// + public string SerialNumber2 { get; set; } + /// + /// 拆箱数量1 + /// + public int FirstNum { get; set; } + /// + /// 拆箱数量2 + /// + public int SecondNum { get; set; } + /// + /// 班组 + /// + public string Team { get; set; } + /// + /// 时间 + /// + public DateTime? Time { get; set; } + } } \ No newline at end of file diff --git a/ZR.Service/mes/wms/WMentryWarehousing_productService.cs b/ZR.Service/mes/wms/WMentryWarehousing_productService.cs index 0c2f7962..7ebf917c 100644 --- a/ZR.Service/mes/wms/WMentryWarehousing_productService.cs +++ b/ZR.Service/mes/wms/WMentryWarehousing_productService.cs @@ -1,7 +1,11 @@ using Infrastructure.Attribute; +using MimeKit.Utils; +using Org.BouncyCastle.Utilities.IO.Pem; using SqlSugar; using System; +using System.Collections.Generic; using System.Linq; +using System.Text.Json; using System.Text.RegularExpressions; using ZR.Model.MES.pro; using ZR.Model.MES.wms; @@ -213,8 +217,41 @@ namespace ZR.Service.mes.wms //解析外箱标签码 public ResultionPackageCodeDto ResolutionPackage(string code) { - MaterialUtils materialToos = new MaterialUtils(); - return materialToos.ResolutionPackage(code); + try + { + MaterialUtils materialToos = new MaterialUtils(); + ResultionPackageCodeDto packageCodeDto = materialToos.ResolutionPackage(code); + if(packageCodeDto == null) + { + return null; + } + WmGoodsChangeLog changeLog = Context.Queryable() + .Where(it => it.Description.Contains(packageCodeDto.PatchCode)) + .OrderByDescending(it => it.CreatedTime) + .First(); + if(changeLog != null) + { + // 拼箱 + if(changeLog.Type == 1) + { + var json = JsonSerializer.Deserialize(changeLog.JsonMsg); + packageCodeDto.Remark = "标签涉及拼箱,参考标签:" + json.NewPartnumber; + } + // 拆箱 + else if (changeLog.Type == 2) + { + var json = JsonSerializer.Deserialize(changeLog.JsonMsg); + packageCodeDto.Remark = "标签涉及拆箱参考数据,主箱:" + json.MainPackage.PatchCode + "\n次标签1:"+json.NewPatchCode1 + "\n次标签2:" + json.NewPatchCode2; + } + } + + return packageCodeDto; + } + catch (Exception ex) + { + throw new Exception(ex.Message); + } + /*// 初步进行解析检测,增加解析成功率 string[] splitstr = code.Split('^'); if (splitstr.Length < 1) @@ -342,7 +379,7 @@ namespace ZR.Service.mes.wms } catch (Exception e) { - return "标签存在异常!"; + return "标签存在异常!" + e.Message; } } diff --git a/ZR.Service/mes/wms/WmGoodsNowProductionService.cs b/ZR.Service/mes/wms/WmGoodsNowProductionService.cs index 7d802202..1375279c 100644 --- a/ZR.Service/mes/wms/WmGoodsNowProductionService.cs +++ b/ZR.Service/mes/wms/WmGoodsNowProductionService.cs @@ -148,7 +148,6 @@ namespace ZR.Service.mes.wms int startIndex = (page - 1) * rows; //数据总数 int sum = resultList.Count; - if (startIndex + rows > sum) { resultList = resultList.Skip(startIndex).Take(sum).ToList(); @@ -158,44 +157,6 @@ namespace ZR.Service.mes.wms resultList = resultList.Skip(startIndex).Take(startIndex + rows).ToList(); } return resultList; - /*if (rawdatas != null && rawdatas.Count > 0) - { - //todo 对字段进行拆分 - - List WmGoods_nodeDto_list = rawdatas.Select(p => new WmGoods_nodeDto() - { - Id = p.Id, - PackageCode = p.PackageCode, - PackageCodeClient_short_parent = p.PackageCodeClient.Split("_")[0], - PackageCodeClient_son = p.PackageCodeClient, - PackageCodeOriginal = p.PackageCodeClient, - LocationCode = p.LocationCode, - Partnumber = p.Partnumber, - GoodsNumLogic = p.GoodsNumLogic, - GoodsNumAction = p.GoodsNumAction, - EntryWarehouseTime = p.EntryWarehouseTime, - Remark = p.Remark, - - }).ToList(); - //todo 分组 聚合 生成父节点 - - List WmGoods_nodeDto_list_parent = WmGoods_nodeDto_list.GroupBy(p => p.PackageCodeClient_short_parent) - .Select(group => new WmGoods_nodeDto() - { - PackageCodeClient_short_parent = "", - PackageCodeClient_son = group.Key, - GoodsNumLogic = group.Sum(group => group.GoodsNumLogic), - GoodsNumAction = group.Sum(group => group.GoodsNumAction), - Partnumber = group.Max(group => group.Partnumber), - Pack_num = group.Count() - }).ToList(); - - //todo 合并 - - return WmGoods_nodeDto_list_parent.OrderByDescending(it => it.PackageCodeClient_son).ToList(); - - } - return null;*/ } /// /// 移动端 短批次号详情 @@ -220,6 +181,18 @@ namespace ZR.Service.mes.wms Remark = (!string.IsNullOrEmpty(it.Remark)? it.Remark:"无备注"), }) .ToList(); + foreach (WmGoodsNowProductionDto item in response) + { + WmMaterial material = Context.Queryable() + .Where(it => it.Partnumber == item.Partnumber) + .First(); + if (material == null) + { + item.Description = "此零件号不在物料清单内!"; + continue; + } + item.Description = !string.IsNullOrEmpty(material.Description) ? material.Description : material.ProductName; + } return response; }