From 96ee6437185cc02f17a8286967fd0f0eb88d9328 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期一, 15 九月 2025 19:23:46 +0800 Subject: [PATCH] 111 --- MES.Service/service/WomcaaManager.cs | 94 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 81 insertions(+), 13 deletions(-) diff --git a/MES.Service/service/WomcaaManager.cs b/MES.Service/service/WomcaaManager.cs index 1113a5f..62c68a4 100644 --- a/MES.Service/service/WomcaaManager.cs +++ b/MES.Service/service/WomcaaManager.cs @@ -1,4 +1,6 @@ -锘縰sing MES.Service.DB; +锘縰sing System.Globalization; +using Masuit.Tools; +using MES.Service.DB; using MES.Service.Dto.webApi; using MES.Service.Modes; using MES.Service.util; @@ -111,7 +113,6 @@ RoutingId = dto.FRoutingId, /// 宸ヨ壓璺嚎 WorkShopId = dto.FREMWorkShopId, /// 浜х嚎 DepotCode = dto.FStockId, /// 浠撳簱 - CreateDate = dto.FDate, /// 鍗曟嵁鏃ユ湡 Caa004 = dto.FBILLTYPE, /// 鍗曟嵁绫诲瀷 Caa023 = dto.FStatus, /// 鐘舵�� 瀹屽伐锛屾湭瀹屽伐 Caa006 = dto.FMaterialId, /// 浜у搧缂栫爜 @@ -151,9 +152,9 @@ : null, /// ERP婧愬崟琛屽彿 Caa020 = dto.PLAN_NUM, /// ERP婧愬崟鍗曞彿(浠诲姟鍗曞彿) //Caa015 = dto.F_UNW_Text_xsddh, /// 閿�鍞鍗曞彿 - ErpSczz = Convert.ToInt32(dto.FPrdOrgId), /// 鐢熶骇缁勭粐ID - ErpWtzz = Convert.ToInt32(dto.FEnTrustOrgId), /// 濮旀墭缁勭粐ID - Btbz = dto.Btbz, /// 濮旀墭缁勭粐ID + // ErpSczz = Convert.ToInt32(dto.FPrdOrgId), /// 鐢熶骇缁勭粐ID + // ErpWtzz = Convert.ToInt32(dto.FEnTrustOrgId), /// 濮旀墭缁勭粐ID + // Btbz = dto.Btbz, /// 濮旀墭缁勭粐ID //Caa015Head = dto.F_XIFG_Integer_tzk, /// 閿�鍞鍗曡鍙� //MainProductNo = dto.F_XIFG_Base_w5c, /// 涓讳骇鍝佺紪鐮� // MainProductQty = @@ -165,8 +166,7 @@ Caa0111 = dto.FPlanFinishDate, /// 棰勮瀹屽伐鏃堕棿澶囦唤 Typea = dto.TypeA, /// 棰勮瀹屽伐鏃堕棿澶囦唤 //Typeb = dto.TypeB /// 棰勮瀹屽伐鏃堕棿澶囦唤 - SynchronousDate = DateTime.Now, - ZH_XSDD = dto.F_WPVT_TEXT_CA9 + SynchronousDate = DateTime.Now }; @@ -219,6 +219,24 @@ .First(); entity.Caa009 = unit.ToString(); } + + //CreateDate = dto.FDate, /// 鍗曟嵁鏃ユ湡 + if (!dto.FDate.IsNullOrEmpty()) + { + if (!DateTime.TryParseExact(dto.FDate, "yyyy-MM-d H:m:s", + CultureInfo.InvariantCulture, + DateTimeStyles.None, out DateTime createDate)) + { + throw new FormatException( + $"鍒涘缓鏃ユ湡锛團CreateDate锛夎В鏋愬け璐ワ紒鍊硷細銆恵dto.FDate}銆戯紝鏀寔鏍煎紡锛歽yyy-MM-d H:m:s"); + } + + entity.CreateDate = createDate; + } + else + { + entity.CreateDate = null; + } return entity; } @@ -261,14 +279,19 @@ Pid = Convert.ToInt32(dto.PID), /// ERP澶碔D Eid = Convert.ToInt32(dto.Id), /// ERP ID - Scrapqty = dto.FFixScrapQty, /// 鍥哄畾鎹熻�� + Scrapqty = dto.FFixScrapQty, /// 鍥哄畾鎹熻�� Scraprate = dto.FScrapRate, /// 鍙樺姩鎹熻�楃巼 - Freplacegroup = Convert.ToInt32(dto.FReplaceGroup), - UseRate = Convert.ToDecimal(dto.FUseRate), + Freplacegroup = !string.IsNullOrEmpty(dto.FReplaceGroup) + ? Convert.ToInt32(dto.FReplaceGroup) + : 0, + UseRate = !string.IsNullOrEmpty(dto.FUseRate) + ? Convert.ToDecimal(dto.FUseRate) + : 0, MaterialType = dto.FMaterialType, - MustQty = Convert.ToDecimal(dto.FMustQty), - Typeb = dto.TypeB, - LW_WLBGY = dto.F_WPVT_TEXT_RE5 + MustQty = !string.IsNullOrEmpty(dto.FMustQty) + ? Convert.ToDecimal(dto.FMustQty) + : 0, + Typeb = dto.TypeB // Fsaleorderno = dto.FSALEORDERNO, /// 閿�鍞鍗� // // CustomerItemNumber = dto.F_XIFG_Text_re5, /// 瀹㈡埛璐у彿 @@ -283,6 +306,51 @@ .Where(s => s.Eid == womcab.Eid).Single(); if (entity != null) womcab.Guid = entity.Guid; + // CAB003 鏉愭枡缂栫爜 => MES_ITEMS.id + if (!string.IsNullOrEmpty(womcab.Cab003)) + { + var item = Db.Queryable<MesItems>() + .Where(i => i.ItemNo == womcab.Cab003) + .Select(i => i.Id) + .First(); + if (item != null) + { + womcab.Cab003 = item.ToString(); + } + } + + // CAB009 鍗曚綅 => MES_UNIT.id + if (!string.IsNullOrEmpty(womcab.Cab009)) + { + var unit = Db.Queryable<MesUnit>() + .Where(u => u.Fnumber == womcab.Cab009) + .Select(u => u.Id) + .First(); + if (unit != null) + { + womcab.Cab009 = unit.ToString(); + } + } + + // DEPOT_CODE 浠撳簱 => MES_DEPOTS.DEPOT_ID + if (!string.IsNullOrEmpty(womcab.DepotCode)) + { + var depot = Db.Queryable<MesDepots>() + .Where(d => d.DepotCode == womcab.DepotCode) + .Select(d => d.DepotId) + .First(); + if (depot != null) + { + womcab.DepotCode = depot.ToString(); + } + } + + // ISSUING_ORGANIZATION 鍙戞枡缁勭粐 => 1 (鍥哄畾鍊�) + womcab.IssuingOrganization = "1"; + + // SUPPLY_ORGANIZATION 渚涘簲缁勭粐 => 1 (鍥哄畾鍊�) + womcab.SupplyOrganization = "1"; + womcabList.Add(womcab); } -- Gitblit v1.9.3