diff --git a/DOAN.Admin.WebApi/Controllers/MES/ERP/BaseInteractERP.cs b/DOAN.Admin.WebApi/Controllers/MES/ERP/BaseInteractERP.cs
index 95a0cae..d483321 100644
--- a/DOAN.Admin.WebApi/Controllers/MES/ERP/BaseInteractERP.cs
+++ b/DOAN.Admin.WebApi/Controllers/MES/ERP/BaseInteractERP.cs
@@ -32,6 +32,16 @@ namespace DOAN.Admin.WebApi.Controllers
}
+ //TODO 同步供应商档案
+
+ [HttpGet("synch_ERP_Vendor")]
+ public IActionResult SynchERPVendor()
+ {
+ var response = interactERPService.SynchERPVendor();
+
+ return SUCCESS(response);
+
+ }
}
diff --git a/DOAN.Model/MES/base/BaseSupplier.cs b/DOAN.Model/MES/base/BaseSupplier.cs
index d4f258c..d694850 100644
--- a/DOAN.Model/MES/base/BaseSupplier.cs
+++ b/DOAN.Model/MES/base/BaseSupplier.cs
@@ -25,6 +25,14 @@ namespace DOAN.Model.MES.base_
[SugarColumn(ColumnName = "supplier_name")]
public string SupplierName { get; set; }
+
+
+ ///
+ /// 供应商简称
+ ///
+ [SugarColumn(ColumnName = "supplier_add_name")]
+ public string SupplierAddName { get; set; }
+
///
/// 供应商地址
///
diff --git a/DOAN.Model/MES/base/Dto/BaseSupplierDto.cs b/DOAN.Model/MES/base/Dto/BaseSupplierDto.cs
index fe02f48..ddfb9a2 100644
--- a/DOAN.Model/MES/base/Dto/BaseSupplierDto.cs
+++ b/DOAN.Model/MES/base/Dto/BaseSupplierDto.cs
@@ -28,6 +28,11 @@ namespace DOAN.Model.MES.base_.Dto
public string SupplierAddress { get; set; }
+ ///
+ /// 供应商简称
+ ///
+ public string SupplierAddName { get; set; }
+
public string SupplierLiaison { get; set; }
public string SupplierPhone { get; set; }
diff --git a/DOAN.Service/MES/ERP/IService/IInteractERPService.cs b/DOAN.Service/MES/ERP/IService/IInteractERPService.cs
index 2f7e2ed..530ab61 100644
--- a/DOAN.Service/MES/ERP/IService/IInteractERPService.cs
+++ b/DOAN.Service/MES/ERP/IService/IInteractERPService.cs
@@ -10,5 +10,7 @@ namespace DOAN.Service.MES.ERP.IService
{
int SynhERPCustom();
+
+ int SynchERPVendor();
}
}
diff --git a/DOAN.Service/MES/ERP/InteractERPService.cs b/DOAN.Service/MES/ERP/InteractERPService.cs
index 57b4bc1..2930e70 100644
--- a/DOAN.Service/MES/ERP/InteractERPService.cs
+++ b/DOAN.Service/MES/ERP/InteractERPService.cs
@@ -11,6 +11,7 @@ using System.Linq;
using Mapster;
using DOAN.Service.MES.ERP.IService;
using DOAN.Model.MES.ERP;
+using MimeKit.Tnef;
namespace DOAN.Service.MES.ERP
{
@@ -41,7 +42,7 @@ namespace DOAN.Service.MES.ERP
custom.CustomNo = costomerERP.CusCode;
custom.CustomName = costomerERP.CusName;
custom.CustomAddName = costomerERP.CusAbbName;
- result += Context.AsTenant().UpdateableWithAttr(custom).ExecuteCommand();
+ result += Context.AsTenant().UpdateableWithAttr(custom).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
}
else
{
@@ -59,7 +60,42 @@ namespace DOAN.Service.MES.ERP
}
+ ///
+ /// 同步供应商
+ ///
+ ///
+ public int SynchERPVendor()
+ {
+ int result = 0;
+ List vendor_ERP_List = Context.Queryable().ToList();
+ if (vendor_ERP_List != null && vendor_ERP_List.Count > 0)
+ {
+ foreach (var vendorERP in vendor_ERP_List)
+ {
+ BaseSupplier supplier = Context.AsTenant().QueryableWithAttr()
+ .Where(it => it.SupplierNo == vendorERP.VenCode).First();
+ if (supplier != null)
+ {
+ supplier.SupplierNo = vendorERP.VenCode;
+ supplier.SupplierName = vendorERP.VenName;
+ supplier.SupplierAddName = vendorERP.VenAbbName;
+ result += Context.AsTenant().UpdateableWithAttr(supplier).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
+ }
+ else
+ {
+ BaseSupplier supplier_insert = new BaseSupplier();
+ supplier_insert.SupplierNo = vendorERP.VenCode;
+ supplier_insert.SupplierName = vendorERP.VenName;
+ supplier_insert.SupplierAddName = vendorERP.VenAbbName;
+ result += Context.AsTenant().InsertableWithAttr(supplier_insert).ExecuteCommand();
+ }
+ }
+
+ }
+ return result;
+
+ }
}
}