From cd7f9ed8e646dbf58d665ccc17afbb6f3edcdecb Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Mon, 4 Nov 2024 17:59:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=8D=95BOM=20=E5=8F=8A=E5=85=B6?= =?UTF-8?q?=E6=89=80=E9=9C=80=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DOAN.Model/MES/product/Dto/ProWorkorderDto.cs | 11 ++- .../quality/IPQC/Dto/QcDefectCollectionDto.cs | 5 +- DOAN.Service/MES/mm/MmRequirePlanService.cs | 5 +- .../MES/product/ProWorkorderService.cs | 68 +++++++++++-------- 4 files changed, 55 insertions(+), 34 deletions(-) diff --git a/DOAN.Model/MES/product/Dto/ProWorkorderDto.cs b/DOAN.Model/MES/product/Dto/ProWorkorderDto.cs index 4717b37..320c6c3 100644 --- a/DOAN.Model/MES/product/Dto/ProWorkorderDto.cs +++ b/DOAN.Model/MES/product/Dto/ProWorkorderDto.cs @@ -278,12 +278,17 @@ namespace DOAN.Model.MES.product.Dto /// public string SubInvName { get; set; } + + /// + /// 单件数量 + /// + public string Iusequantity_Single { get; set; } /// - /// 使用数量 + /// 使用总数量 /// - - public string Iusequantity { get; set; } + + public string Iusequantity_All { get; set; } /// /// BOM版本号 diff --git a/DOAN.Model/MES/quality/IPQC/Dto/QcDefectCollectionDto.cs b/DOAN.Model/MES/quality/IPQC/Dto/QcDefectCollectionDto.cs index 3a396e4..3990138 100644 --- a/DOAN.Model/MES/quality/IPQC/Dto/QcDefectCollectionDto.cs +++ b/DOAN.Model/MES/quality/IPQC/Dto/QcDefectCollectionDto.cs @@ -52,10 +52,11 @@ public class QcDefectCollectionDto /// - /// 供应商编码 + /// 供应商编码 /// public string SupplierCode { get; set; } + public string SupplierName { get; set; } public decimal PlanNum { get; set; } @@ -104,7 +105,7 @@ public class QcDefectCollectionQueryDto2 : PagerInfo /// 供应商名称 /// public string SupplierName { get; set; } - + /// /// 产品编码 /// diff --git a/DOAN.Service/MES/mm/MmRequirePlanService.cs b/DOAN.Service/MES/mm/MmRequirePlanService.cs index 7f0c5a8..9313e04 100644 --- a/DOAN.Service/MES/mm/MmRequirePlanService.cs +++ b/DOAN.Service/MES/mm/MmRequirePlanService.cs @@ -17,6 +17,7 @@ using NPOI; using DOAN.Model.MES.ERP; using Mapster; using Microsoft.AspNetCore.Http.HttpResults; +using Infrastructure.Converter; namespace DOAN.Service.group { @@ -293,7 +294,7 @@ namespace DOAN.Service.group public int GenerateMaterialRequirePlanByline(MmRequirePlanQueryDto2 parm, string CreatedBy) { //查询当日线下所有工单 - parm.RequireDate = parm.RequireDate.ToLocalTime().Date; + parm.RequireDate = DOANConvertDateTime.ConvertLocalDate(parm.RequireDate); int result = 0; @@ -331,6 +332,8 @@ namespace DOAN.Service.group { need_Materials.Add(item.SubInvCode, need_num); } + + if (need_Materials_workOrder.ContainsKey(item.SubInvCode)) { diff --git a/DOAN.Service/MES/product/ProWorkorderService.cs b/DOAN.Service/MES/product/ProWorkorderService.cs index def611a..8b15996 100644 --- a/DOAN.Service/MES/product/ProWorkorderService.cs +++ b/DOAN.Service/MES/product/ProWorkorderService.cs @@ -612,18 +612,18 @@ namespace DOAN.Service.MES.product //存货编码 NPOI.SS.UserModel.ICell currentCell_01 = currentRow.GetCell(0); - + workorder.ProductionCode = currentCell_01?.ToString(); - if(currentCell_01==null||string.IsNullOrEmpty(workorder.ProductionCode)) + if (currentCell_01 == null || string.IsNullOrEmpty(workorder.ProductionCode)) { continue; } //产品名称 NPOI.SS.UserModel.ICell currentCell_02 = currentRow.GetCell(1); - + workorder.ProductionName = currentCell_02?.ToString(); - if (currentCell_02 == null||string.IsNullOrEmpty(workorder.ProductionName)) + if (currentCell_02 == null || string.IsNullOrEmpty(workorder.ProductionName)) { continue; } @@ -632,9 +632,9 @@ namespace DOAN.Service.MES.product //规格型号 NPOI.SS.UserModel.ICell currentCell_04 = currentRow.GetCell(2); - + workorder.Specification = currentCell_04?.ToString(); - if (currentCell_04 == null||string.IsNullOrEmpty(workorder.Specification)) + if (currentCell_04 == null || string.IsNullOrEmpty(workorder.Specification)) { continue; } @@ -780,20 +780,20 @@ namespace DOAN.Service.MES.product }); return result; } - + /// /// 分批导入,追加导入 /// /// /// /// - public int ImportDataAppend(IFormFile formFile, string username) + public int ImportDataAppend(IFormFile formFile, string username) { int result = 0; List workorderList = new(); DateTime dateValue = DateTime.MinValue; - - + + using (var stream = formFile.OpenReadStream()) { try @@ -820,18 +820,18 @@ namespace DOAN.Service.MES.product //存货编码 NPOI.SS.UserModel.ICell currentCell_01 = currentRow.GetCell(0); - + workorder.ProductionCode = currentCell_01?.ToString(); - if(currentCell_01==null||string.IsNullOrEmpty(workorder.ProductionCode)) + if (currentCell_01 == null || string.IsNullOrEmpty(workorder.ProductionCode)) { continue; } //产品名称 NPOI.SS.UserModel.ICell currentCell_02 = currentRow.GetCell(1); - + workorder.ProductionName = currentCell_02?.ToString(); - if (currentCell_02 == null||string.IsNullOrEmpty(workorder.ProductionName)) + if (currentCell_02 == null || string.IsNullOrEmpty(workorder.ProductionName)) { continue; } @@ -840,9 +840,9 @@ namespace DOAN.Service.MES.product //规格型号 NPOI.SS.UserModel.ICell currentCell_04 = currentRow.GetCell(2); - + workorder.Specification = currentCell_04?.ToString(); - if (currentCell_04 == null||string.IsNullOrEmpty(workorder.Specification)) + if (currentCell_04 == null || string.IsNullOrEmpty(workorder.Specification)) { continue; } @@ -965,21 +965,21 @@ namespace DOAN.Service.MES.product workorder.WorkorderDate = dateValue; workorder.Status = 1; //获取当前日期工单序列号 和序号 - DateTime currentDate =dateValue.Date; - var MaxWorkorder= Context.Queryable() + DateTime currentDate = dateValue.Date; + var MaxWorkorder = Context.Queryable() .Where(it => it.WorkorderDate == currentDate) .OrderByDescending(it => it.Sort) - .Select(it => new {it.Workorder,it.Sort}) + .Select(it => new { it.Workorder, it.Sort }) .First(); //工单 2024-9-13-组-线-序号 int index = (row - 2); - int flowNum =index+ + int flowNum = index + Convert.ToInt16(MaxWorkorder.Workorder.Substring(MaxWorkorder.Workorder.Length - 3, 3)); - + workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.GroupCode + "_" + workorder.LineCode + "_" + flowNum.ToString("000"); - - + + workorder.Sort = index * 10 + Convert.ToInt16(MaxWorkorder.Sort); @@ -1004,12 +1004,12 @@ namespace DOAN.Service.MES.product UseTran2(() => { - // Context.Deleteable().Where(it => it.WorkorderDate == dateValue).ExecuteCommand(); + // Context.Deleteable().Where(it => it.WorkorderDate == dateValue).ExecuteCommand(); result = Context.Insertable(workorderList).ExecuteCommand(); }); return result; } - + /// @@ -1123,6 +1123,7 @@ namespace DOAN.Service.MES.product /// public List SearchBOMNum(string workorder_num) { + List workOrderBoms = new List(); List baseMaterialBoms = null; ProWorkorder proworkorder = Context.Queryable().Where(it => it.Workorder == workorder_num).First(); if (proworkorder != null) @@ -1134,15 +1135,26 @@ namespace DOAN.Service.MES.product { foreach (var item in baseMaterialBoms) { - float num = float.Parse(item.Iusequantity) * proworkorder.DeliveryNum.Value; - item.Iusequantity = num.ToString(); + WorkOrderBom objectMaterial = new WorkOrderBom(); + + objectMaterial.SubInvCode=item.SubInvCode; + objectMaterial.SubInvName = item.SubInvName; + objectMaterial.Iusequantity_Single = item.Iusequantity; + float num = float.Parse(item.Iusequantity) * proworkorder.DeliveryNum.Value; + objectMaterial.Iusequantity_All = num.ToString(); + objectMaterial.BOMVersion = item.BOMVersion; + workOrderBoms.Add(objectMaterial); + } } } - return baseMaterialBoms.Adapt>(); + + + + return workOrderBoms; }