From 7a8e4311fee9c78c0c6d917d9c93c964f32168b1 Mon Sep 17 00:00:00 2001 From: qian Date: Fri, 20 Oct 2023 08:50:07 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=86=B2=E5=8E=8B=E4=BB=B6=20=E4=BB=8Eorac?= =?UTF-8?q?le=20=E8=AF=BB=E5=8F=96=20=E4=BD=9C=E5=BA=9F=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/CK.SCP.Controller.csproj | 5 +++-- Models/CK.SCP.Models.csproj | 15 +++++++++------ Models/EntitiesFactory.cs | 4 +--- UniApiGroup/CK.SCP.GrupUniApi.csproj | 5 +++-- UniApiGroup/Controller/OdbcApiQadController.cs | 7 ++++--- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Controller/CK.SCP.Controller.csproj b/Controller/CK.SCP.Controller.csproj index 38d55c9..6da1dba 100644 --- a/Controller/CK.SCP.Controller.csproj +++ b/Controller/CK.SCP.Controller.csproj @@ -31,8 +31,9 @@ 4 - - D:\杩炴帴orlcor\ChangKeTec.Utils.dll + + False + bin\Debug\ChangKeTec.Utils.dll ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll diff --git a/Models/CK.SCP.Models.csproj b/Models/CK.SCP.Models.csproj index e6cfa8a..8cd035b 100644 --- a/Models/CK.SCP.Models.csproj +++ b/Models/CK.SCP.Models.csproj @@ -31,6 +31,9 @@ 4 + + ..\Controller\bin\Debug\ChangKeTec.Utils.dll + ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll @@ -768,12 +771,6 @@ - - - {4c6a951d-ad7f-47ce-b2ce-32c205d8d6ba} - CK.SCP.Utils - - TextTemplatingFileGenerator @@ -786,5 +783,11 @@ + + + {4C6A951D-AD7F-47CE-B2CE-32C205D8D6BA} + CK.SCP.Utils + + \ No newline at end of file diff --git a/Models/EntitiesFactory.cs b/Models/EntitiesFactory.cs index 9d0f72f..98b835e 100644 --- a/Models/EntitiesFactory.cs +++ b/Models/EntitiesFactory.cs @@ -1,17 +1,15 @@ using System; using System.Data.Entity; using System.Data.Entity.Core; -using System.Data.Entity.Core.EntityClient; using System.Data.SqlClient; using System.Linq; using System.Text; -using System.Threading.Tasks; using CK.SCP.Models.AppBoxEntity; using CK.SCP.Models.Enums; using CK.SCP.Models.UniApiEntity; -using CK.SCP.Utils; using ChangKeTec.Wms.Models.Wms; using System.ComponentModel; +using CK.SCP.Utils; namespace CK.SCP.Models { diff --git a/UniApiGroup/CK.SCP.GrupUniApi.csproj b/UniApiGroup/CK.SCP.GrupUniApi.csproj index 47b3c46..e3a0b85 100644 --- a/UniApiGroup/CK.SCP.GrupUniApi.csproj +++ b/UniApiGroup/CK.SCP.GrupUniApi.csproj @@ -48,8 +48,9 @@ 4 - - D:\杩炴帴orlcor\ChangKeTec.Utils.dll + + False + ..\Controller\bin\Debug\ChangKeTec.Utils.dll False diff --git a/UniApiGroup/Controller/OdbcApiQadController.cs b/UniApiGroup/Controller/OdbcApiQadController.cs index a3db87c..c22b057 100644 --- a/UniApiGroup/Controller/OdbcApiQadController.cs +++ b/UniApiGroup/Controller/OdbcApiQadController.cs @@ -802,10 +802,10 @@ namespace CK.SCP.GrupUniApi.Controller { var _liii = _lii.ToList(); var _entity = _liii.First(); - var _askdetail = wdb.TB_ASK_DETAIL.Count(p => p.PoBillNum == _entity.purDocNO && p.State > -1); + var _askdetail = wdb.TB_ASK_DETAIL.Count(p => p.PoBillNum == _entity.purDocNO && p.State > -1); if(_askdetail== _liii.Count()) { - var ask = wdb.TB_ASK.FirstOrDefault(p=>p.PoBillNum==_entity.purDocNO); + var ask = wdb.TB_ASK.FirstOrDefault(p=>p.PoBillNum==_entity.purDocNO ); ask.State = -1; ask.IsDeleted = true; wmsAskList.Add(ask); @@ -820,7 +820,8 @@ namespace CK.SCP.GrupUniApi.Controller } else { - var askdetaill = wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO).ToList(); + // 根据 零件号作废 + var askdetaill = wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO && p.PartCode == _entity.mtlNO ).ToList(); askdetaill.ForEach(p => { p.State = -1; From 7646a8cbc9716904efad967c824cd6ff6a15f30a Mon Sep 17 00:00:00 2001 From: qian Date: Fri, 20 Oct 2023 13:56:27 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9C=8B=E6=9D=BF=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/OdbcApiQadController.cs | 264 ++++++++---------- 1 file changed, 122 insertions(+), 142 deletions(-) diff --git a/UniApiGroup/Controller/OdbcApiQadController.cs b/UniApiGroup/Controller/OdbcApiQadController.cs index c22b057..f273099 100644 --- a/UniApiGroup/Controller/OdbcApiQadController.cs +++ b/UniApiGroup/Controller/OdbcApiQadController.cs @@ -55,16 +55,16 @@ namespace CK.SCP.GrupUniApi.Controller var tableNameList = EnumHelper.EnumToList(); //DataTable b = QmStockController.GetInvBatchStock(); // var qadCtrlList = idb.xxqad_ctrl.Where(p => p.xxqad_domain == ScpCache.Config.QAD域 && p.xxqad_scm == "0").ToList(); - var qadCtrlList = idb.xxerp_MaxbatchNO.ToList(); + var qadCtrlList = idb.xxerp_MaxbatchNO.ToList(); foreach (var qadCtrl in qadCtrlList) { - - try + + try + { + ScpEntities wdb = EntitiesFactory.CreateScpInstance(); + var authdb = EntitiesFactory.CreateAppBoxInstance(); + switch (qadCtrl.tablename) { - ScpEntities wdb = EntitiesFactory.CreateScpInstance(); - var authdb = EntitiesFactory.CreateAppBoxInstance(); - switch (qadCtrl.tablename) - { case "part": //物料 if (GlobalVar.ApiConfig.Qad零件) { @@ -143,44 +143,44 @@ namespace CK.SCP.GrupUniApi.Controller continue; break; - - } + } - catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) { - var sb = new StringBuilder(); - foreach (var error in dbEx.EntityValidationErrors.ToList()) + error.ValidationErrors.ToList().ForEach(i => { - error.ValidationErrors.ToList().ForEach(i => - { - sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); - }); - } - //qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString(); - //qadCtrl.xxqad_rmks += " SCM:" + sb.ToString(); - + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); } - catch (OptimisticConcurrencyException ex)//并发冲突异常 - { - //qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString(); - //qadCtrl.xxqad_rmks += " SCM:" + ex.Message+ex.InnerException.Message; + //qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString(); + //qadCtrl.xxqad_rmks += " SCM:" + sb.ToString(); - } - catch (Exception ex) - { - //qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString(); - //qadCtrl.xxqad_rmks += " SCM:" + ex.Message + ex.InnerException.Message; + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + //qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString(); + //qadCtrl.xxqad_rmks += " SCM:" + ex.Message+ex.InnerException.Message; - } - finally - { - EntitiesFactory.SaveDb(idb); - } } + catch (Exception ex) + { + //qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString(); + //qadCtrl.xxqad_rmks += " SCM:" + ex.Message + ex.InnerException.Message; - UpdatePlanToAsk(); + } + finally + { + EntitiesFactory.SaveDb(idb); + } } - + + UpdatePlanToAsk(); + } + private static void UpdatePlanToAsk() { @@ -782,61 +782,41 @@ namespace CK.SCP.GrupUniApi.Controller /// /// private static void UpdatePurchaseOrders(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item) - { + { try { var max = idb.xxDiMaxes_Po.OrderByDescending(r => r.Di_Batchno).FirstOrDefault(); int a = max.Di_Batchno; var FATCTORY = wdb.TB_FACTORY.FirstOrDefault(); DataTable b = PoBillNumcontroller.GetInvBatchStock(a, FATCTORY.FactoryId); - List list = ChangKeTec.Utils.ListHelper.DataTableToList(b); + List list = ChangKeTec.Utils.ListHelper.DataTableToList(b); var wmsPoList = new List(); var wmsPoDetailList = new List(); var wmsAskList = new List(); var wmsAskDetailList = new List(); var xxMaxbath = new List(); - var Dlist = list.Where(p=>p.ctype=="D"); + var Dlist = list.Where(p => p.ctype == "D"); var Ilist = list.Where(p => p.ctype != "D"); - var _li = Dlist.GroupBy(p=>p.purDocNO); + var _li = Dlist.GroupBy(p => p.purDocNO); foreach (var _lii in _li) { var _liii = _lii.ToList(); var _entity = _liii.First(); - var _askdetail = wdb.TB_ASK_DETAIL.Count(p => p.PoBillNum == _entity.purDocNO && p.State > -1); - if(_askdetail== _liii.Count()) + // 根据 零件号作废 + var askdetaill = wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO && p.PartCode == _entity.mtlNO).ToList(); + askdetaill.ForEach(p => { - var ask = wdb.TB_ASK.FirstOrDefault(p=>p.PoBillNum==_entity.purDocNO ); - ask.State = -1; - ask.IsDeleted = true; - wmsAskList.Add(ask); - var askdetaill=wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO).ToList(); - askdetaill.ForEach(p => - { - p.State = -1; - p.IsDeleted = true; - wmsAskDetailList.Add(p); - - }); - } - else - { - // 根据 零件号作废 - var askdetaill = wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO && p.PartCode == _entity.mtlNO ).ToList(); - askdetaill.ForEach(p => - { - p.State = -1; - p.IsDeleted = true; - wmsAskDetailList.Add(p); - - }); - } + p.State = -1; + p.IsDeleted = true; + wmsAskDetailList.Add(p); + }); } foreach (var qadPoNbr in Ilist) - { + { var qadDataList = wmsPoList.Count(p => p.PoBillNum == qadPoNbr.purDocNO); var wmsPo1 = wdb.TB_PO.Count(p => p.PoBillNum == qadPoNbr.purDocNO); - if ( qadDataList == 0&& wmsPo1==0) - { + if (qadDataList == 0 && wmsPo1 == 0) + { TB_PO wmsPo = new TB_PO { PoBillNum = qadPoNbr.purDocNO,//订单号 @@ -860,9 +840,9 @@ namespace CK.SCP.GrupUniApi.Controller var qadAskList = wmsAskList.Count(p => p.PoBillNum == qadPoNbr.purDocNO); var wmsAs1 = wdb.TB_ASK.Count(p => p.PoBillNum == qadPoNbr.purDocNO); - if ( qadAskList == 0&& wmsAs1==0) + if (qadAskList == 0 && wmsAs1 == 0) { - + int cnt = 1; String str = "k"; TB_ASK wmsAs = new TB_ASK @@ -870,8 +850,8 @@ namespace CK.SCP.GrupUniApi.Controller AskBillNum = str + qadPoNbr.purDocNO.Substring(2, 12), PoBillNum = qadPoNbr.purDocNO,//订单号 VendId = qadPoNbr.vendorNO,//供应商编号 - Site = "W21", - + Site = "W21", + CreateTime = qadPoNbr.createdDate == null ? DateTime.Now : (DateTime)qadPoNbr.createdDate,//创建日期 CreateUser = "W21-LIUST",//创建用户 GUID = System.Guid.NewGuid(), @@ -883,7 +863,7 @@ namespace CK.SCP.GrupUniApi.Controller ErpBillNum = qadPoNbr.purDocNO,//订单号 SubSite = "W21", }; - if (qadPoNbr.returnsItem =="Y") + if (qadPoNbr.returnsItem == "Y") { wmsAs.State = -1; } @@ -891,22 +871,22 @@ namespace CK.SCP.GrupUniApi.Controller { wmsAs.State = 1; } - + wmsAskList.Add(wmsAs); } var qadASKList = wmsAskDetailList.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); var wmsAskDetail1 = wdb.TB_ASK_DETAIL.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); - if (qadASKList == 0&& wmsAskDetail1==0) - { + if (qadASKList == 0 && wmsAskDetail1 == 0) + { String str = "k"; TB_ASK_DETAIL wmsAskDetail = new TB_ASK_DETAIL { AskBillNum = str + qadPoNbr.purDocNO.Substring(2, 12), PoBillNum = qadPoNbr.purDocNO,//订单号 PoLine = int.Parse(qadPoNbr.purDocItemNO), - Site = "W21", + Site = "W21", CreateTime = qadPoNbr.createdDate == null ? DateTime.Now : (DateTime)qadPoNbr.createdDate,//创建日期 CreateUser = "W21-LIUST",//创建用户 GUID = System.Guid.NewGuid(), @@ -933,7 +913,7 @@ namespace CK.SCP.GrupUniApi.Controller var maxlist1 = new xxDiMaxes_Po { - Di_Batchno = qadPoNbr.DI_BATCHNO, + Di_Batchno = qadPoNbr.DI_BATCHNO, }; xxMaxbath.Add(maxlist1); @@ -941,10 +921,10 @@ namespace CK.SCP.GrupUniApi.Controller var qadDataList1 = wmsPoDetailList.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); var wmsPoDetail1 = wdb.TB_PO_DETAIL.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); - if ( qadDataList1 == 0&& wmsPoDetail1==0) + if (qadDataList1 == 0 && wmsPoDetail1 == 0) { - - TB_PO_DETAIL wmsPoDetail = new TB_PO_DETAIL + + TB_PO_DETAIL wmsPoDetail = new TB_PO_DETAIL { PoBillNum = qadPoNbr.purDocNO,//订单号 PoLine = int.Parse(qadPoNbr.purDocItemNO), @@ -959,8 +939,8 @@ namespace CK.SCP.GrupUniApi.Controller SubSite = "W21", CreateTime = qadPoNbr.createdDate == null ? DateTime.Now : (DateTime)qadPoNbr.createdDate,//创建日期 CreateUser = qadPoNbr.CREATEDBY,//创建用户 - //if (wmsPoDetail.BillQty != 0 && wmsPoDetail.BillQty <= wmsPoDetail.ReceivedQty) - // wmsPoDetail.State = (int)FormState.关闭; + //if (wmsPoDetail.BillQty != 0 && wmsPoDetail.BillQty <= wmsPoDetail.ReceivedQty) + // wmsPoDetail.State = (int)FormState.关闭; State = (int)FormState.开放, IsDeleted = false, GUID = System.Guid.NewGuid(), @@ -970,7 +950,7 @@ namespace CK.SCP.GrupUniApi.Controller // } - + } //wmsPo.State = qadDataList.All(p => p.xxqad_pod_status == ((int)FormState.关闭).ToString()) @@ -982,23 +962,23 @@ namespace CK.SCP.GrupUniApi.Controller Console.WriteLine("更新 ERP采购订单 数据:" + "无数据"); return; } - - - item.Remark = ((int)UniApiState.成功).ToString(); - //item.MaxdibatchNO = item.MaxdibatchNO + list.Count; - idb.xxDiMaxes_Po.AddOrUpdate(xxMaxbath.ToArray()); - wdb.TB_PO.AddOrUpdate(wmsPoList.ToArray()); - wdb.TB_ASK.AddOrUpdate(wmsAskList.ToArray()); - wdb.TB_PO_DETAIL.AddOrUpdate(wmsPoDetailList.ToArray()); - wdb.TB_ASK_DETAIL.AddOrUpdate(wmsAskDetailList.ToArray()); - Console.WriteLine($"更新 采购订单 数据:{list.Count}"); + + + item.Remark = ((int)UniApiState.成功).ToString(); + //item.MaxdibatchNO = item.MaxdibatchNO + list.Count; + idb.xxDiMaxes_Po.AddOrUpdate(xxMaxbath.ToArray()); + wdb.TB_PO.AddOrUpdate(wmsPoList.ToArray()); + wdb.TB_ASK.AddOrUpdate(wmsAskList.ToArray()); + wdb.TB_PO_DETAIL.AddOrUpdate(wmsPoDetailList.ToArray()); + wdb.TB_ASK_DETAIL.AddOrUpdate(wmsAskDetailList.ToArray()); + Console.WriteLine($"更新 采购订单 数据:{list.Count}"); } catch (Exception ex) { Console.WriteLine(ex.Message); } } - + @@ -1240,7 +1220,7 @@ namespace CK.SCP.GrupUniApi.Controller DataTable b = NetPriceController.GetInvBatchNetPrice(a, FATCTORY.FactoryId); //DataTable b = NetPriceController.GetInvBatchNetPrice(item.MaxdibatchNO); List list = ChangKeTec.Utils.ListHelper.DataTableToList(b); - + var PriceList = new List(); var xxMaxbath = new List(); foreach (var itm in list) @@ -1248,8 +1228,8 @@ namespace CK.SCP.GrupUniApi.Controller var maxlist1 = new xxDiMaxes { Di_Batchno_part = 0, - Di_Batchno=0, - Di_Batchno_price=0, + Di_Batchno = 0, + Di_Batchno_price = 0, Di_Batchno_NETprice = itm.DI_BATCHNO, }; @@ -1278,8 +1258,8 @@ namespace CK.SCP.GrupUniApi.Controller } idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); item.MaxdibatchNO = item.MaxdibatchNO + list.Count; - item.Remark = ((int) UniApiState.失败).ToString(); - scpdb.TB_NetPrice.AddOrUpdate(PriceList.ToArray()); + item.Remark = ((int)UniApiState.失败).ToString(); + scpdb.TB_NetPrice.AddOrUpdate(PriceList.ToArray()); Console.WriteLine($"更新采购净价数据:{PriceList.Count}"); } /// @@ -1293,7 +1273,7 @@ namespace CK.SCP.GrupUniApi.Controller var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno_NETprice).FirstOrDefault(); int a = max.Di_Batchno_price; var FATCTORY = scpdb.TB_FACTORY.FirstOrDefault(); - DataTable b = PriceController.GetInvBatchPrice(a,FATCTORY.FactoryId); + DataTable b = PriceController.GetInvBatchPrice(a, FATCTORY.FactoryId); List list = ChangKeTec.Utils.ListHelper.DataTableToList(b); var xxMaxbath = new List(); var PriceList = new List(); @@ -1304,7 +1284,7 @@ namespace CK.SCP.GrupUniApi.Controller Di_Batchno_part = 0, Di_Batchno = 0, Di_Batchno_price = itm.DI_BATCHNO, - Di_Batchno_NETprice =0, + Di_Batchno_NETprice = 0, }; xxMaxbath.Add(maxlist1); @@ -1318,7 +1298,7 @@ namespace CK.SCP.GrupUniApi.Controller Unit = itm.ordUnit, PartCode = itm.MTLNO, Site = itm.plant, - StartTime =itm.validityStartPeriod, + StartTime = itm.validityStartPeriod, EndTime = itm.validityEndPeriod, }; _price.Amt = decimal.Parse(itm.purchasePrice); @@ -1342,7 +1322,7 @@ namespace CK.SCP.GrupUniApi.Controller /// /// /// - private static void UpdateVendParts(UniApiEntities idb, ScpEntities wdb,xxerp_MaxbatchNO item) + private static void UpdateVendParts(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item) { DataTable b = vendidpartcontroller.GetInvBatchStock(item.MaxdibatchNO.ToString()); List list = ChangKeTec.Utils.ListHelper.DataTableToList(b); @@ -1381,7 +1361,7 @@ namespace CK.SCP.GrupUniApi.Controller //wmsData.VendPackQty = qadData.xxqad_vp_comment; //wmsData.TransportationTime = qadData.xxqad_vp_vend_lead; wmsDataList.Add(wmsData); - item.Remark = ((int)UniApiState.成功).ToString(); + item.Remark = ((int)UniApiState.成功).ToString(); item.MaxdibatchNO = Convert.ToInt32(qadData.DI_BATCHNO); } catch (Exception ex) @@ -1407,7 +1387,7 @@ namespace CK.SCP.GrupUniApi.Controller var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno).FirstOrDefault(); int a = max.Di_Batchno; var FATCTORY = wdb.TB_FACTORY.FirstOrDefault(); - DataTable b = Vendercontroller.GetInvBatchStock(item.MaxdibatchNO, a,FATCTORY.FactoryId); + DataTable b = Vendercontroller.GetInvBatchStock(item.MaxdibatchNO, a, FATCTORY.FactoryId); //DataTable b = Vendercontroller.GetInvBatchStock(item.MaxdibatchNO); List list = ChangKeTec.Utils.ListHelper.DataTableToList(b); var wmsDataList = new List(); @@ -1418,8 +1398,8 @@ namespace CK.SCP.GrupUniApi.Controller { var maxlist1 = new xxDiMaxes { - Di_Batchno_NETprice=0, - Di_Batchno_price=0, + Di_Batchno_NETprice = 0, + Di_Batchno_price = 0, Di_Batchno_part = 0, Di_Batchno = qadData.DI_BATCHNO, @@ -1429,7 +1409,7 @@ namespace CK.SCP.GrupUniApi.Controller new TA_VENDER { VendId = qadData.VENDORNO.ToUpper(), VendAbbCode = "0", State = 1 }; wmsData.VendName = string.IsNullOrEmpty(qadData.NAME1) ? qadData.VENDORNO : qadData.NAME1; wmsData.VendType = qadData.providerType.ToUpper().ToString(); - wmsData.Country = qadData.country; + wmsData.Country = qadData.country; wmsData.Phone = qadData.firstTelNO; wmsData.Fax = qadData.FAXNUMBER; wmsData.Site = ScpCache.Config.QAD域; @@ -1441,7 +1421,7 @@ namespace CK.SCP.GrupUniApi.Controller var _vend = authdb.Roles.Where(p => p.Name == "供应商").FirstOrDefault(); var _factory = authdb.TA_FACTORY.Where(p => p.ErpDomain == ScpCache.Config.QAD域).FirstOrDefault(); //_first == null && _vend != null && - if (_factory != null&& _first==null) + if (_factory != null && _first == null) { User _entity = new User(); _entity.Name = vendname; @@ -1463,7 +1443,7 @@ namespace CK.SCP.GrupUniApi.Controller TA_FACTORY f = authdb.Set().Local.Where(x => x.ID == _factory.ID).FirstOrDefault(); if (f == null) { - f = new TA_FACTORY { ID = _factory.ID }; + f = new TA_FACTORY { ID = _factory.ID }; authdb.Set().Attach(f); } _entity.TA_FACTORY.Add(f); @@ -1485,12 +1465,12 @@ namespace CK.SCP.GrupUniApi.Controller Console.WriteLine("更新 供应商 数据:" + "无数据"); return; } - + wdb.TA_VENDER.AddOrUpdate(p => new { p.VendId, p.Site }, wmsDataList.ToArray()); idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); - item.MaxdibatchNO = item.MaxdibatchNO +list.Count; + item.MaxdibatchNO = item.MaxdibatchNO + list.Count; Console.WriteLine($"更新 供应商 数据:{list.Count}"); - + } @@ -1507,7 +1487,7 @@ namespace CK.SCP.GrupUniApi.Controller private static void UpdateVenderExtend(UniApiEntities idb, ScpEntities wdb, AppBoxContext authdb, List qadDataList) { - + var _ls = new List(); foreach (var qadData in qadDataList) @@ -1554,25 +1534,25 @@ namespace CK.SCP.GrupUniApi.Controller /// /// /// - private static void UpdateParts(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item ) + private static void UpdateParts(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item) { var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno_part).FirstOrDefault(); int a = max.Di_Batchno_part; var FATCTORY = wdb.TB_FACTORY.FirstOrDefault(); - DataTable b = QmStockController.GetInvBatchStock(item.MaxdibatchNO,a, FATCTORY.FactoryId); - List list= ChangKeTec.Utils.ListHelper.DataTableToList(b); - - var wmsDataList = new List(); + DataTable b = QmStockController.GetInvBatchStock(item.MaxdibatchNO, a, FATCTORY.FactoryId); + List list = ChangKeTec.Utils.ListHelper.DataTableToList(b); + + var wmsDataList = new List(); var xxMaxbath = new List(); foreach (var qadData in list) { var maxlist1 = new xxDiMaxes { - Di_Batchno_NETprice=0, - Di_Batchno_price=0, + Di_Batchno_NETprice = 0, + Di_Batchno_price = 0, Di_Batchno_part = qadData.DI_BATCHNO, Di_Batchno = 0 - + }; xxMaxbath.Add(maxlist1); var wmsData = wdb.TA_PART.SingleOrDefault(p => p.ErpPartCode == qadData.MTLNO.ToString() && p.Site == qadData.plant) ?? @@ -1580,21 +1560,21 @@ namespace CK.SCP.GrupUniApi.Controller { PartCode = qadData.MTLNO.ToString(), ErpPartCode = qadData.MTLNO.ToString(), - }; - wmsData.PartDesc1 = qadData.MTLNODES.ToString(); - wmsData.PartDesc2 = qadData.sizes.ToString(); - wmsData.ReceivePort = qadData.grossWeight.ToString(); - wmsData.PalletSize = qadData.netWeight.ToString(); - wmsData.PartGroup = qadData.MTLTYPE.ToString(); - wmsData.ProjectId = qadData.MATBRAND; - wmsData.Unit = !string.IsNullOrEmpty(qadData.MEASUREBASEUNIT) ? qadData.MEASUREBASEUNIT.ToUpper() : "EA"; - wmsData.Remark = qadData.stdPrice.ToString(); - wmsData.ValidityDays = qadData.loadQuantity; - wmsData.State = !string.IsNullOrEmpty(qadData.SpMtlStatus) ? qadData.SpMtlStatus.ToUpper() : "A"; - wmsData.Site = qadData.plant; - wmsDataList.Add(wmsData); + }; + wmsData.PartDesc1 = qadData.MTLNODES.ToString(); + wmsData.PartDesc2 = qadData.sizes.ToString(); + wmsData.ReceivePort = qadData.grossWeight.ToString(); + wmsData.PalletSize = qadData.netWeight.ToString(); + wmsData.PartGroup = qadData.MTLTYPE.ToString(); + wmsData.ProjectId = qadData.MATBRAND; + wmsData.Unit = !string.IsNullOrEmpty(qadData.MEASUREBASEUNIT) ? qadData.MEASUREBASEUNIT.ToUpper() : "EA"; + wmsData.Remark = qadData.stdPrice.ToString(); + wmsData.ValidityDays = qadData.loadQuantity; + wmsData.State = !string.IsNullOrEmpty(qadData.SpMtlStatus) ? qadData.SpMtlStatus.ToUpper() : "A"; + wmsData.Site = qadData.plant; + wmsDataList.Add(wmsData); } - + if (wmsDataList.Count == 0) { Console.WriteLine("更新 零件 数据:" + "无数据"); @@ -1604,10 +1584,10 @@ namespace CK.SCP.GrupUniApi.Controller item.MaxdibatchNO = item.MaxdibatchNO + list.Count; idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); wdb.TA_PART.AddOrUpdate(p => new { p.PartCode, p.Site }, wmsDataList.ToArray()); - Console.WriteLine($"更新 零件信息 数据:{list.Count}"); + Console.WriteLine($"更新 零件信息 数据:{list.Count}"); } } - - } + +} From 095cdd88c77834c8c25fc06c70818b487143520b Mon Sep 17 00:00:00 2001 From: qian Date: Fri, 20 Oct 2023 17:22:57 +0800 Subject: [PATCH 3/4] =?UTF-8?q?DockCode=E7=81=B5=E6=B4=BB=E8=B5=8B?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UniApiGroup/Controller/OdbcApiQadController.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UniApiGroup/Controller/OdbcApiQadController.cs b/UniApiGroup/Controller/OdbcApiQadController.cs index f273099..c31a9a2 100644 --- a/UniApiGroup/Controller/OdbcApiQadController.cs +++ b/UniApiGroup/Controller/OdbcApiQadController.cs @@ -878,6 +878,8 @@ namespace CK.SCP.GrupUniApi.Controller var qadASKList = wmsAskDetailList.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); var wmsAskDetail1 = wdb.TB_ASK_DETAIL.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); + // + var tapart = wdb.TA_PART.Where(q => q.PartCode == qadPoNbr.mtlNO.Trim()).ToList(); if (qadASKList == 0 && wmsAskDetail1 == 0) { String str = "k"; @@ -895,7 +897,7 @@ namespace CK.SCP.GrupUniApi.Controller EndTime = qadPoNbr.itemDeliveryDate,//收货结束时间 Price = 0, AskQty = qadPoNbr.quantity, - DockCode = "YC", + DockCode = tapart.Count()>0 ? tapart.FirstOrDefault().PartGroup:"YC", PoUnit = qadPoNbr.baseUnitMeasure, Currency = qadPoNbr.sizecoL, }; From 317c648e23310c41f02d6882b2e5b5ccc5d6a0e8 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Mon, 23 Oct 2023 11:01:53 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E8=A6=81=E8=B4=A7?= =?UTF-8?q?=E7=9C=8B=E6=9D=BF=E5=8F=91=E8=B4=A7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/SCP_ASN_CONTROLLER.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/SCP_ASN_CONTROLLER.cs b/Controller/SCP_ASN_CONTROLLER.cs index 8146007..5bdd206 100644 --- a/Controller/SCP_ASN_CONTROLLER.cs +++ b/Controller/SCP_ASN_CONTROLLER.cs @@ -3108,7 +3108,7 @@ namespace CK.SCP.Controller } p_entitys.ForEach(itm => { - var askdeail = db.TB_ASK_DETAIL.Where(p => p.AskBillNum == p_asn.AskBillNum && p.PartCode == itm.PartCode && p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.State != -1 && p.IsDeleted == false);//鍒ゆ柇鏄惁浣滃簾 + var askdeail = db.TB_ASK_DETAIL.FirstOrDefault(p => p.AskBillNum == p_asn.AskBillNum && p.PartCode == itm.PartCode && p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.State != -1 && p.IsDeleted == false);//鍒ゆ柇鏄惁浣滃簾 if (askdeail == null) { _ret.MessageList.Add(string.Format("瑕佽揣鐪嬫澘{1}闆朵欢鍙穥0}宸茬粡浣滃簾涓嶈兘鍙戣揣锛岃鑱旂郴閲囪喘鍛樼‘璁わ紒", itm.PartCode, itm.AskBillNum));