同步供应商
This commit is contained in:
parent
599c94b1c3
commit
ad3fbbcf4a
@ -32,6 +32,16 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
|
||||
}
|
||||
|
||||
//TODO 同步供应商档案
|
||||
|
||||
[HttpGet("synch_ERP_Vendor")]
|
||||
public IActionResult SynchERPVendor()
|
||||
{
|
||||
var response = interactERPService.SynchERPVendor();
|
||||
|
||||
return SUCCESS(response);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,14 @@ namespace DOAN.Model.MES.base_
|
||||
[SugarColumn(ColumnName = "supplier_name")]
|
||||
public string SupplierName { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 供应商简称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "supplier_add_name")]
|
||||
public string SupplierAddName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商地址
|
||||
/// </summary>
|
||||
|
||||
@ -28,6 +28,11 @@ namespace DOAN.Model.MES.base_.Dto
|
||||
|
||||
public string SupplierAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商简称
|
||||
/// </summary>
|
||||
public string SupplierAddName { get; set; }
|
||||
|
||||
public string SupplierLiaison { get; set; }
|
||||
|
||||
public string SupplierPhone { get; set; }
|
||||
|
||||
@ -10,5 +10,7 @@ namespace DOAN.Service.MES.ERP.IService
|
||||
{
|
||||
|
||||
int SynhERPCustom();
|
||||
|
||||
int SynchERPVendor();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 同步供应商
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int SynchERPVendor()
|
||||
{
|
||||
int result = 0;
|
||||
List<CustDevMesVendor> vendor_ERP_List = Context.Queryable<CustDevMesVendor>().ToList();
|
||||
if (vendor_ERP_List != null && vendor_ERP_List.Count > 0)
|
||||
{
|
||||
foreach (var vendorERP in vendor_ERP_List)
|
||||
{
|
||||
BaseSupplier supplier = Context.AsTenant().QueryableWithAttr<BaseSupplier>()
|
||||
.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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user