From 88d83e46d3ebd4b19bd4f5c98572c238909372ba Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Thu, 10 Oct 2024 15:59:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E4=BF=9D=E8=B4=A8=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/ErpEntity/ErpBdMaterial.cs | 4 ++++ .../Tnb.ProductionMgr/TimeWorkService.cs | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMaterial.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMaterial.cs index 0b2065d6..d7c935fd 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMaterial.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMaterial.cs @@ -63,5 +63,9 @@ namespace Tnb.ProductionMgr.Entities.Entity.ErpEntity public string DEFNAME { get; set; } public string UDI { get; set; } + /// + /// 保质期 年 + /// + public string QUALITYNUM { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs index cf03f7a9..5a19c624 100644 --- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs @@ -867,6 +867,18 @@ namespace Tnb.ProductionMgr foreach (ErpBdMaterial erpBdMaterial in list) { string categoryId = "[\"CGJCJ\"]"; + int qualitynum = 0; + int quality_guarantee_period = 0; + bool qualityFlag = true; + try + { + qualitynum = int.Parse(erpBdMaterial.QUALITYNUM); + quality_guarantee_period = qualitynum * 12; + } + catch (Exception e) + { + qualityFlag = false; + } if (erpBdMaterial.CODE.StartsWith("0401")) { string str = ""; @@ -930,6 +942,7 @@ namespace Tnb.ProductionMgr di = erpBdMaterial.UDI, create_time = DateTime.Now }; + if (qualityFlag) basMaterial.quality_guarantee_period = quality_guarantee_period; insertMaterial.Add(basMaterial); ErpExtendField erpExtendField = new ErpExtendField() @@ -978,6 +991,7 @@ namespace Tnb.ProductionMgr .SetColumns(x => x.unit_id == unitId) .SetColumns(x => x.name == erpBdMaterial.NAME) .SetColumns(x => x.di == erpBdMaterial.UDI) + .SetColumnsIF(qualityFlag,x => x.quality_guarantee_period == quality_guarantee_period) .Where(x => x.id == materialId) .ExecuteCommandAsync(); @@ -1516,7 +1530,7 @@ namespace Tnb.ProductionMgr { if ((person.TYPE=="1" && erpExtendFields.All(x => x.person_id != person.PERSON_ID)) || (person.TYPE=="2" && erpExtendFields.All(x => x.user_id != person.USER_ID))) { - if (person.TYPE == "2" && insertErpExtendFields.FindIndex(x=>x.person_id==person.PERSON_ID)!=-1) + if (person.TYPE == "2" && insertErpExtendFields.FindIndex(x=>x.person_id==person.PERSON_ID)!=-1 && person.PERSON_ID!="~") { ErpExtendField eef = insertErpExtendFields.Find(x => x.person_id == person.PERSON_ID); eef.user_id = person.USER_ID;