|
|
@@ -292,6 +292,7 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
private readonly ISqlRepository<rf_serialnumber> _rf_serialnumber;
|
|
|
private readonly ISqlRepository<LocationDetail> _locationDetail;
|
|
|
+ private readonly ISqlRepository<ConfigurationItem> _configurationItem;
|
|
|
/// <summary>
|
|
|
/// 资源检查入参
|
|
|
/// </summary>
|
|
|
@@ -480,6 +481,7 @@ namespace Business.ResourceExamineManagement
|
|
|
ProductExamineAppService productExamineAppService,
|
|
|
ISqlRepository<rf_serialnumber> rf_serialnumber,
|
|
|
ISqlRepository<LocationDetail> locationDetail,
|
|
|
+ ISqlRepository<ConfigurationItem> configurationItem,
|
|
|
ISqlRepository<ItemPackMaster> itemPackMaster,
|
|
|
ISqlRepository<GeneralizedCodeMaster> generalizedCodeMaster,
|
|
|
ISqlRepository<ScheduleResultOpMaster> scheduleResultOpMaster,
|
|
|
@@ -583,6 +585,7 @@ namespace Business.ResourceExamineManagement
|
|
|
_holidayMaster = holidayMaster;
|
|
|
_productExamineAppService = productExamineAppService;
|
|
|
_locationDetail = locationDetail;
|
|
|
+ _configurationItem = configurationItem;
|
|
|
_itemPackMaster = itemPackMaster;
|
|
|
_generalizedCodeMaster = generalizedCodeMaster;
|
|
|
_unitOfWorkManager = unitOfWorkManager;
|
|
|
@@ -1960,7 +1963,13 @@ namespace Business.ResourceExamineManagement
|
|
|
if (icitemStokc.Count > 0)
|
|
|
{
|
|
|
List<string> numbers = pretreatments.Select(s => s.item_number).ToList();
|
|
|
- List<string> locationList = new List<string> { "1000", "1001", "5008","8000","8001" };
|
|
|
+ var locationRange = _configurationItem.Select(x => x.FldName == "MRPLocationRange" && x.Domain == companyId.ToString()).FirstOrDefault();
|
|
|
+
|
|
|
+ List<string> locationList = new List<string> { "1000", "1001", "5008", "8000", "8001" };
|
|
|
+ if (locationRange != null && locationRange.Val != null)
|
|
|
+ {
|
|
|
+ locationList = locationRange.Val.SplitToArray(",").ToList();
|
|
|
+ }
|
|
|
var locStock = _invMaster.Select(a => numbers.Contains(a.ItemNum) && a.IsActive && a.Domain == factoryId.ToString() && locationList.Contains(a.Location));
|
|
|
//设置当前计算bangid
|
|
|
icitemStokc.ForEach(item => {
|
|
|
@@ -1973,7 +1982,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var moIcitemStokc = ObjectMapper.Map<List<ic_item_stock>, List<mo_ic_item_stock>>(icitemStokc);
|
|
|
moIcitemStokc.ForEach(item => { item.GenerateNewId(help.NextId()); });
|
|
|
//插入数据
|
|
|
- await _ic_item_stock.InsertManyAsync(moIcitemStokc);
|
|
|
+ await MongoHelper<mo_ic_item_stock>.InsertManyAsync(moIcitemStokc);
|
|
|
}
|
|
|
|
|
|
var workordmsters = _workOrdMaster.Select(s => s.Domain == factoryId.ToString() && string.IsNullOrEmpty(s.Status) != true && s.Status.ToLower() != "c");
|
|
|
@@ -2012,7 +2021,7 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
var mo_item_occupy = ObjectMapper.Map<List<ic_item_stockoccupy>, List<mo_ic_item_stockoccupy>>(item_occupy);
|
|
|
mo_item_occupy.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
|
|
|
- await _ic_item_stockoccupy.InsertManyAsync(mo_item_occupy);
|
|
|
+ await MongoHelper<mo_ic_item_stockoccupy>.InsertManyAsync(mo_item_occupy);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2023,7 +2032,7 @@ namespace Business.ResourceExamineManagement
|
|
|
mes_morder.ForEach(item => { item.bang_id = bangid; });
|
|
|
var moMes_morder = ObjectMapper.Map<List<mes_morder>, List<mo_mes_morder>>(mes_morder);
|
|
|
moMes_morder.ForEach(item => { item.GenerateNewId(help.NextId()); });
|
|
|
- await _mes_morder.InsertManyAsync(moMes_morder);
|
|
|
+ await MongoHelper<mo_mes_morder>.InsertManyAsync(moMes_morder);
|
|
|
}
|
|
|
//工单子表
|
|
|
var mes_moentry = _mysql_mes_moentry.GetListAsync(x => x.company_id == companyId && x.factory_id == factoryId).Result;
|
|
|
@@ -2032,7 +2041,7 @@ namespace Business.ResourceExamineManagement
|
|
|
mes_moentry.ForEach(item => { item.bang_id = bangid; });
|
|
|
var moMes_moentry = ObjectMapper.Map<List<mes_moentry>, List<mo_mes_moentry>>(mes_moentry);
|
|
|
moMes_moentry.ForEach(item => { item.GenerateNewId(help.NextId()); });
|
|
|
- await _mes_moentry.InsertManyAsync(moMes_moentry);
|
|
|
+ await MongoHelper<mo_mes_moentry>.InsertManyAsync(moMes_moentry);
|
|
|
}
|
|
|
|
|
|
//在制工单占用记录表
|
|
|
@@ -2041,7 +2050,7 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
var moMes_mooccupy = ObjectMapper.Map<List<mes_mooccupy>, List<mo_mes_mooccupy>>(mes_mooccupy);
|
|
|
moMes_mooccupy.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
|
|
|
- await _mes_mooccupy.InsertManyAsync(moMes_mooccupy);
|
|
|
+ await MongoHelper<mo_mes_mooccupy>.InsertManyAsync(moMes_mooccupy);
|
|
|
}
|
|
|
}
|
|
|
//根据物料信息,只同步在途未关闭的采购订单和采购申请
|
|
|
@@ -2056,13 +2065,13 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
var moSrm_po_main = ObjectMapper.Map<List<srm_po_main>, List<mo_srm_po_main>>(srm_po_main);
|
|
|
moSrm_po_main.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
|
|
|
- await _srm_po_main.InsertManyAsync(moSrm_po_main);
|
|
|
+ await MongoHelper<mo_srm_po_main>.InsertManyAsync(moSrm_po_main);
|
|
|
|
|
|
//订单明细--根据在途PO过滤出有效的Po_list
|
|
|
srm_po_list = srm_po_list.Where(s => srm_po_main.Select(x => x.Id).Contains(s.po_id.GetValueOrDefault())).ToList();
|
|
|
var moSrm_po_list = ObjectMapper.Map<List<srm_po_list>, List<mo_srm_po_list>>(srm_po_list);
|
|
|
moSrm_po_list.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
|
|
|
- await _srm_po_list.InsertManyAsync(moSrm_po_list);
|
|
|
+ await MongoHelper<mo_srm_po_list>.InsertManyAsync(moSrm_po_list);
|
|
|
}
|
|
|
//采购订单明细占用详情
|
|
|
var srm_po_occupy = _mysql_srm_po_occupy.GetListAsync(x => x.company_id == companyId && x.factory_id == factoryId && srm_po_list.Select(c => c.Id).Contains(x.polist_id.GetValueOrDefault())).Result;
|
|
|
@@ -2070,7 +2079,7 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
var moSrm_po_occupy = ObjectMapper.Map<List<srm_po_occupy>, List<mo_srm_po_occupy>>(srm_po_occupy);
|
|
|
moSrm_po_occupy.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
|
|
|
- await _srm_po_occupy.InsertManyAsync(moSrm_po_occupy);
|
|
|
+ await MongoHelper<mo_srm_po_occupy>.InsertManyAsync(moSrm_po_occupy);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2080,7 +2089,7 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
var moSrm_pr_main = ObjectMapper.Map<List<srm_pr_main>, List<mo_srm_pr_main>>(srm_pr_main);
|
|
|
moSrm_pr_main.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
|
|
|
- await _srm_pr_main.InsertManyAsync(moSrm_pr_main);
|
|
|
+ await MongoHelper<mo_srm_pr_main>.InsertManyAsync(moSrm_pr_main);
|
|
|
|
|
|
//采购申请占用详情
|
|
|
var srm_pr_occupy = _mysql_srm_po_occupy.GetListAsync(x => x.company_id == companyId && x.factory_id == factoryId && srm_pr_main.Select(c => c.Id).Contains(x.polist_id.GetValueOrDefault())).Result;
|
|
|
@@ -2088,7 +2097,7 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
var moSrm_pr_occupy = ObjectMapper.Map<List<srm_po_occupy>, List<mo_srm_po_occupy>>(srm_pr_occupy);
|
|
|
moSrm_pr_occupy.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
|
|
|
- await _srm_po_occupy.InsertManyAsync(moSrm_pr_occupy);
|
|
|
+ await MongoHelper<mo_srm_po_occupy>.InsertManyAsync(moSrm_pr_occupy);
|
|
|
}
|
|
|
}
|
|
|
}
|