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