DEVELOP\15850 пре 1 година
родитељ
комит
999e19ec20

+ 19 - 0
MicroServices/Business/Business.Application/SystemJobManagement/SystemJobAppService.cs

@@ -410,6 +410,7 @@ namespace Business.SystemJobManagement
             List<SuppMaster> custList = _suppMaster.Select(a => a.IsActive);
             var addressList = _consigneeAddressMaster.Select(a => a.Typed == "Supp" && a.IsActive);
             List<srm_supplier> ItemsAdd = new List<srm_supplier>();
+            List<srm_supplier> ItemsUpd = new List<srm_supplier>();
             if (custList != null && custList.Count > 0)
             {
                 for (int i = 0; i < custList.Count; i++)
@@ -444,8 +445,26 @@ namespace Business.SystemJobManagement
                         supplier.GenerateNewId(help.NextId());
                         ItemsAdd.Add(supplier);
                     }
+                    else
+                    {
+                        ConsigneeAddressMaster address = addressList.Find(a => a.Address == custList[i].Supp);
+                        supp.supplier_name = address is not null ? address.Name : "";
+                        supp.supplier_short_name = custList[i].SortName;
+                        supp.country = address is not null ? address.Country : "";
+                        supp.state = address is not null ? address.State : "";
+                        supp.region = address is not null ? address.City : "";
+                        supp.contact = address is not null ? address.Attention1 : "";
+                        supp.telephone = address is not null ? address.Telephone : "";
+                        supp.post_code = address is not null ? address.Post : "";
+                        supp.email = address is not null ? address.AttentionEmail : "";
+                        supp.currency = custList[i].Curr;
+                        supp.supply_type = custList[i].Type;
+                        supp.settlement = custList[i].CrTerms;
+                        ItemsUpd.Add(supp);
+                    }
                 }
                 _businessDbContext.BulkInsert(ItemsAdd);
+                _businessDbContext.srm_supplier.UpdateRange(ItemsUpd);
             }
         }
         //////同步销售订单