Browse Source

北汽接口只创建tavend表数据,停止自动创建账号和绑定关系

master
qian 4 months ago
parent
commit
1d4e10e61b
  1. 72
      北京北汽/Controller/SCP_DC_UNI_CONTROLLER.cs

72
北京北汽/Controller/SCP_DC_UNI_CONTROLLER.cs

@ -431,7 +431,8 @@ namespace CK.SCP.Controller
//EntitiesFactory.SaveDb(db); //EntitiesFactory.SaveDb(db);
//EntitiesFactory.SaveDb(dc); //EntitiesFactory.SaveDb(dc);
//EntitiesFactory.SaveDb(authdb); //EntitiesFactory.SaveDb(authdb);
UpdateSupplierExtend(_supplierlist); //取消自动创建
//UpdateSupplierExtend(_supplierlist);
scope.Complete(); scope.Complete();
break; break;
case "TES_PART_MSTR": case "TES_PART_MSTR":
@ -527,8 +528,8 @@ namespace CK.SCP.Controller
{ {
ScpEntities scpdb = EntitiesFactory.CreateScpInstance(); ScpEntities scpdb = EntitiesFactory.CreateScpInstance();
ExchangeCenterContext db = EntitiesFactory.CreateExchangeCenterInstance(); ExchangeCenterContext db = EntitiesFactory.CreateExchangeCenterInstance();
var _list = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "CDBMPT").OrderBy(p => p.UID).ToList(); var _list = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "BJBMPT").OrderBy(p => p.UID).ToList();
var _list1 = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "CDBMPT" && p.InterfaceType == "Price").OrderBy(p => p.UID).ToList(); var _list1 = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "BJBMPT" && p.InterfaceType == "Price").OrderBy(p => p.UID).ToList();
var apiii = _list1.Count(); var apiii = _list1.Count();
if (apiii > 0) if (apiii > 0)
@ -2074,38 +2075,39 @@ namespace CK.SCP.Controller
_supplier.Remark = supplier.TaskID.ToString();//任务ID _supplier.Remark = supplier.TaskID.ToString();//任务ID
var vendname = string.Format("{0}@{1}", _supplier.VendId.ToUpper(), _supplier.Site.ToUpper()); var vendname = string.Format("{0}@{1}", _supplier.VendId.ToUpper(), _supplier.Site.ToUpper());
var _first = authdb.Users.Where(p => p.Name == vendname).FirstOrDefault(); // 取消自动创建
var _vend = authdb.Roles.Where(p => p.Name == "供应商").FirstOrDefault(); //var _first = authdb.Users.Where(p => p.Name == vendname).FirstOrDefault();
var _factory = authdb.TA_FACTORY.Where(p => p.ErpDomain == _supplier.Site.ToUpper()).FirstOrDefault(); //var _vend = authdb.Roles.Where(p => p.Name == "供应商").FirstOrDefault();
if (_first == null && _vend != null && _factory != null) //var _factory = authdb.TA_FACTORY.Where(p => p.ErpDomain == _supplier.Site.ToUpper()).FirstOrDefault();
{ //if (_first == null && _vend != null && _factory != null)
User _entity = new User(); //{
_entity.Name = vendname; // User _entity = new User();
_entity.Remark = _supplier.Site.ToUpper(); // _entity.Name = vendname;
// 随机密码 // _entity.Remark = _supplier.Site.ToUpper();
_entity.Password = GenerateComplexPassword(); //PasswordUtil.CreateDbPassword("99999999"); // // 随机密码
_entity.ChineseName = _supplier.VendName; // _entity.Password = GenerateComplexPassword(); //PasswordUtil.CreateDbPassword("99999999");
_entity.Email = _supplier.VendId + "@163.com"; // _entity.ChineseName = _supplier.VendName;
_entity.Gender = "男"; // _entity.Email = _supplier.VendId + "@163.com";
_entity.Enabled = true; // _entity.Gender = "男";
_entity.Roles = new List<Role>(); // _entity.Enabled = true;
Role t = authdb.Set<Role>().Local.Where(x => x.ID == _vend.ID).FirstOrDefault(); // _entity.Roles = new List<Role>();
if (t == null) // Role t = authdb.Set<Role>().Local.Where(x => x.ID == _vend.ID).FirstOrDefault();
{ // if (t == null)
t = new Role { ID = _vend.ID }; // {
authdb.Set<Role>().Attach(t); // t = new Role { ID = _vend.ID };
} // authdb.Set<Role>().Attach(t);
_entity.Roles.Add(t); // }
_entity.TA_FACTORY = new List<TA_FACTORY>(); // _entity.Roles.Add(t);
TA_FACTORY f = authdb.Set<TA_FACTORY>().Local.Where(x => x.ID == _factory.ID).FirstOrDefault(); // _entity.TA_FACTORY = new List<TA_FACTORY>();
if (f == null) // TA_FACTORY f = authdb.Set<TA_FACTORY>().Local.Where(x => x.ID == _factory.ID).FirstOrDefault();
{ // if (f == null)
f = new TA_FACTORY { ID = _factory.ID }; // {
authdb.Set<TA_FACTORY>().Attach(f); // f = new TA_FACTORY { ID = _factory.ID };
} // authdb.Set<TA_FACTORY>().Attach(f);
_entity.TA_FACTORY.Add(f); // }
authdb.Users.Add(_entity); // _entity.TA_FACTORY.Add(f);
} // authdb.Users.Add(_entity);
//}
_venderlist.Add(_supplier); _venderlist.Add(_supplier);
} }
} }

Loading…
Cancel
Save