|
|
@@ -564,11 +564,11 @@ namespace Business.ResourceExamineManagement
|
|
|
return "订单数据不存在";
|
|
|
}
|
|
|
}
|
|
|
- input.tenantId = sorders[0].tenant_id;
|
|
|
+ input.company_id = sorders[0].company_id;
|
|
|
input.factoryId = sorders[0].factory_id.GetValueOrDefault();
|
|
|
|
|
|
//资源检查入参全局变量赋值
|
|
|
- param.tenantId = input.tenantId;
|
|
|
+ param.company_id = input.company_id;
|
|
|
param.factoryId = input.factoryId;
|
|
|
param.checkflag = true;
|
|
|
|
|
|
@@ -588,7 +588,7 @@ namespace Business.ResourceExamineManagement
|
|
|
await DeleteMySqlOldData(sentrys);
|
|
|
|
|
|
//通过订单行的产品代码获取物料BOM数据
|
|
|
- List<mo_ic_bom> boms = _ic_bom.GetListAsync(p => sentrys.Select(m => m.item_number).Contains(p.item_number) && p.factory_id == input.factoryId && p.tenant_id == input.tenantId && !p.IsDeleted).Result.ToList();
|
|
|
+ List<mo_ic_bom> boms = _ic_bom.GetListAsync(p => sentrys.Select(m => m.item_number).Contains(p.item_number) && p.factory_id == input.factoryId && p.company_id == input.company_id && !p.IsDeleted).Result.ToList();
|
|
|
//物料信息
|
|
|
List<mo_ic_item> icitemlist = new List<mo_ic_item>();
|
|
|
//物料库存表
|
|
|
@@ -612,7 +612,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
|
|
|
//数据库快照-同步mysql库数据到mongoDB中
|
|
|
- await DbSnapShot(input.tenantId, input.factoryId, bangid, pretreatments);
|
|
|
+ await DbSnapShot(input.company_id, input.factoryId, bangid, pretreatments);
|
|
|
|
|
|
//记录订单行的物料齐套时间
|
|
|
List<KittingTimeDto> kittingTimes = new List<KittingTimeDto>();
|
|
|
@@ -620,7 +620,7 @@ namespace Business.ResourceExamineManagement
|
|
|
foreach (var sorder in sorders)
|
|
|
{
|
|
|
param.sorderId = sorder.Id;
|
|
|
- param.tenantId = input.tenantId;
|
|
|
+ param.company_id = input.company_id;
|
|
|
param.factoryId = input.factoryId;
|
|
|
//param.checkflag = true;
|
|
|
_morderAppService.param = param;
|
|
|
@@ -744,7 +744,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
if (_CalcBomViewAppService.mooccupyAllInsertList.Any())
|
|
|
{
|
|
|
- _CalcBomViewAppService.mooccupyAllInsertList.ForEach(s => { s.tenant_id = param.tenantId; s.factory_id = param.factoryId; });
|
|
|
+ _CalcBomViewAppService.mooccupyAllInsertList.ForEach(s => { s.company_id = param.company_id; s.factory_id = param.factoryId; });
|
|
|
await _mes_mooccupy.InsertManyAsync(_CalcBomViewAppService.mooccupyAllInsertList);
|
|
|
/*var moOccupy = ObjectMapper.Map<List<mo_mes_mooccupy>, List<mes_mooccupy>>(_CalcBomViewAppService.mooccupyAllInsertList);
|
|
|
_businessDbContext.BulkInsert(moOccupy);*/
|
|
|
@@ -752,14 +752,14 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
if (_CalcBomViewAppService.moentriesInsertList.Any())
|
|
|
{
|
|
|
- _CalcBomViewAppService.moentriesInsertList.ForEach(s => { s.tenant_id = param.tenantId; s.factory_id = param.factoryId; });
|
|
|
+ _CalcBomViewAppService.moentriesInsertList.ForEach(s => { s.company_id = param.company_id; s.factory_id = param.factoryId; });
|
|
|
await _mes_moentry.InsertManyAsync(_CalcBomViewAppService.moentriesInsertList);
|
|
|
/*var mesmoentrys = ObjectMapper.Map<List<mo_mes_moentry>, List<mes_moentry>>(_CalcBomViewAppService.moentriesInsertList);
|
|
|
_businessDbContext.BulkInsert(mesmoentrys);*/
|
|
|
}
|
|
|
if (_CalcBomViewAppService.orderList.Any())
|
|
|
{
|
|
|
- _CalcBomViewAppService.orderList.ForEach(s => { s.tenant_id = param.tenantId; s.factory_id = param.factoryId; });
|
|
|
+ _CalcBomViewAppService.orderList.ForEach(s => { s.company_id = param.company_id; s.factory_id = param.factoryId; });
|
|
|
await _mes_oorder.InsertManyAsync(_CalcBomViewAppService.orderList);
|
|
|
/*var ooders = ObjectMapper.Map<List<mo_mes_oorder>, List<mes_oorder>>(_CalcBomViewAppService.orderList);
|
|
|
_businessDbContext.BulkInsert(ooders);*/
|
|
|
@@ -767,12 +767,12 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
if (_CalcBomViewAppService.newStockOccList.Any())
|
|
|
{
|
|
|
- _CalcBomViewAppService.newStockOccList.ForEach(s => {s.GenerateNewId(help.NextId()); s.tenant_id = param.tenantId; s.factory_id = param.factoryId; });
|
|
|
+ _CalcBomViewAppService.newStockOccList.ForEach(s => {s.GenerateNewId(help.NextId()); s.company_id = param.company_id; s.factory_id = param.factoryId; });
|
|
|
await _ic_item_stockoccupy.InsertManyAsync(_CalcBomViewAppService.newStockOccList);
|
|
|
}
|
|
|
if (_CalcBomViewAppService.srm_Po_OccupiesInsert.Any())
|
|
|
{
|
|
|
- _CalcBomViewAppService.srm_Po_OccupiesInsert.ForEach(s => { s.tenant_id = param.tenantId; s.factory_id = param.factoryId; });
|
|
|
+ _CalcBomViewAppService.srm_Po_OccupiesInsert.ForEach(s => { s.company_id = param.company_id; s.factory_id = param.factoryId; });
|
|
|
await _srm_po_occupy.InsertManyAsync(_CalcBomViewAppService.srm_Po_OccupiesInsert);
|
|
|
/*var poOccupies = ObjectMapper.Map<List<mo_srm_po_occupy>, List<srm_po_occupy>>(_CalcBomViewAppService.srm_Po_OccupiesInsert);
|
|
|
_businessDbContext.BulkInsert(poOccupies);*/
|
|
|
@@ -818,7 +818,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
}
|
|
|
b_ex.create_time = DateTime.Now;
|
|
|
- b_ex.tenant_id = param.tenantId;
|
|
|
+ b_ex.company_id = param.company_id;
|
|
|
b_ex.factory_id = param.factoryId;
|
|
|
examineList.Add(b_ex);
|
|
|
ex.BomChildExamineList.ForEach(s =>
|
|
|
@@ -826,7 +826,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var bc_ex = ObjectMapper.Map<BomChildExamineDto, b_bom_child_examine>(s);
|
|
|
bc_ex.GenerateNewId(help.NextId());
|
|
|
bc_ex.examine_id = b_ex.Id;
|
|
|
- bc_ex.tenant_id = param.tenantId;
|
|
|
+ bc_ex.company_id = param.company_id;
|
|
|
bc_ex.factory_id = param.factoryId;
|
|
|
bc_ex.create_time = DateTime.Now;
|
|
|
bomExamineList.Add(bc_ex);
|
|
|
@@ -836,7 +836,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var olist = ObjectMapper.Map<List<mo_occupy>, List<b_mo_occupy>>(s.mo_occupy_list);
|
|
|
olist.ForEach(o =>
|
|
|
{
|
|
|
- o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.bom_child_examine_id = bc_ex.Id; o.company_id = param.company_id;
|
|
|
o.factory_id = param.factoryId;
|
|
|
});
|
|
|
mooccupyList.AddRange(olist);
|
|
|
@@ -846,7 +846,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var mlist = ObjectMapper.Map<List<moorder>, List<b_mo_order>>(s.make_list);
|
|
|
mlist.ForEach(o =>
|
|
|
{
|
|
|
- o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.bom_child_examine_id = bc_ex.Id; o.company_id = param.company_id;
|
|
|
o.factory_id = param.factoryId;
|
|
|
});
|
|
|
moorderList.AddRange(mlist);
|
|
|
@@ -856,7 +856,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var slist = ObjectMapper.Map<List<ooder>, List<b_ooder>>(s.subcontracting_list);
|
|
|
slist.ForEach(o =>
|
|
|
{
|
|
|
- o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.bom_child_examine_id = bc_ex.Id; o.company_id = param.company_id;
|
|
|
o.factory_id = param.factoryId;
|
|
|
});
|
|
|
ooderList.AddRange(slist);
|
|
|
@@ -866,7 +866,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var plist = ObjectMapper.Map<List<purchase>, List<b_purchase>>(s.purchase_list);
|
|
|
plist.ForEach(o =>
|
|
|
{
|
|
|
- o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.bom_child_examine_id = bc_ex.Id; o.company_id = param.company_id;
|
|
|
o.factory_id = param.factoryId;
|
|
|
});
|
|
|
purchaseList.AddRange(plist);
|
|
|
@@ -876,7 +876,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var purlist = ObjectMapper.Map<List<purchase_occupy>, List<b_purchase_occupy>>(s.purchase_occupy_list);
|
|
|
purlist.ForEach(o =>
|
|
|
{
|
|
|
- o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.bom_child_examine_id = bc_ex.Id; o.company_id = param.company_id;
|
|
|
o.factory_id = param.factoryId;
|
|
|
});
|
|
|
purchaseoccupyList.AddRange(purlist);
|
|
|
@@ -1241,7 +1241,7 @@ namespace Business.ResourceExamineManagement
|
|
|
List<srm_supplier> itemsupplierList = _mysql_srm_supplier.GetListAsync(s => prlist.Select(c => c.pr_purchaseid).Contains(s.Id)).Result;
|
|
|
List<ic_item> ic_Items = _mysql_ic_item.GetListAsync(s => prlist.Select(c => c.icitem_id).Contains(s.Id)).Result;
|
|
|
PoActionListDto poaction = new PoActionListDto();
|
|
|
- param.tenantId = prlist[0].tenant_id;
|
|
|
+ param.company_id = prlist[0].company_id;
|
|
|
param.factoryId = prlist[0].factory_id.GetValueOrDefault();
|
|
|
AutoCreatePOFromPR(prlist, ic_Items, itemsupplierList, purchaselist, poaction);
|
|
|
using (var unitOfWork = _unitOfWorkManager.Begin(false, true))
|
|
|
@@ -1322,7 +1322,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
List<ic_item> ic_Items = _mysql_ic_item.GetListAsync(s => prlist.Select(c => c.icitem_id).Contains(s.Id)).Result;
|
|
|
PoActionListDto poaction = new PoActionListDto();
|
|
|
- param.tenantId = prlist[0].tenant_id;
|
|
|
+ param.company_id = prlist[0].company_id;
|
|
|
param.factoryId = prlist[0].factory_id.GetValueOrDefault();
|
|
|
AutoCreatePOFromPR(prlist, ic_Items, itemsupplierList, purchaselist, poaction);
|
|
|
using (var unitOfWork = _unitOfWorkManager.Begin(false, true))
|
|
|
@@ -1636,7 +1636,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
//获取物料bom明细数据
|
|
|
//List<mo_ic_bom_child> childList = _ic_bom_child.GetManyByCondition(p => icBoms.Select(m => m.mysql_id).Contains(p.bom_id) && p.use_status == 1 && p.tenant_id == param.tenantId && p.factory_id == param.factoryId && !p.IsDeleted).Result.ToList();
|
|
|
- List<mo_ic_bom_child> childList = _ic_bom_child.GetListAsync(p => icBoms.Select(m => m.mysql_id).Contains(p.bom_id) && p.tenant_id == param.tenantId && p.factory_id == param.factoryId && !p.IsDeleted).Result.ToList();
|
|
|
+ List<mo_ic_bom_child> childList = _ic_bom_child.GetListAsync(p => icBoms.Select(m => m.mysql_id).Contains(p.bom_id) && p.company_id == param.company_id && p.factory_id == param.factoryId && !p.IsDeleted).Result.ToList();
|
|
|
//没有明细数据,终止
|
|
|
if (childList.Count == 0)
|
|
|
{
|
|
|
@@ -1650,7 +1650,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
}
|
|
|
//通过物料bom明细数据反查物料bom数据
|
|
|
- var boms = _ic_bom.GetListAsync(p => childList.Select(m => m.icitem_id).ToList().Contains(p.icitem_id) && p.use_status == 1 && p.tenant_id == param.tenantId && p.factory_id == param.factoryId && !p.IsDeleted).Result.ToList();
|
|
|
+ var boms = _ic_bom.GetListAsync(p => childList.Select(m => m.icitem_id).ToList().Contains(p.icitem_id) && p.use_status == 1 && p.company_id == param.company_id && p.factory_id == param.factoryId && !p.IsDeleted).Result.ToList();
|
|
|
foreach (var chd in childList)
|
|
|
{
|
|
|
var curBoms = boms.Where(p => p.icitem_id == chd.icitem_id).ToList();
|
|
|
@@ -1726,7 +1726,7 @@ namespace Business.ResourceExamineManagement
|
|
|
await _ic_item_stock.InsertManyAsync(moIcitemStokc);
|
|
|
}
|
|
|
//在制工单占用记录表
|
|
|
- var mes_mooccupy = _mysql_mes_mooccupy.GetListAsync(x => x.tenant_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
+ var mes_mooccupy = _mysql_mes_mooccupy.GetListAsync(x => x.company_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
if (mes_mooccupy.Count > 0)
|
|
|
{
|
|
|
mes_mooccupy.ForEach(item => { item.bang_id = bangid; });
|
|
|
@@ -1735,7 +1735,7 @@ namespace Business.ResourceExamineManagement
|
|
|
await _mes_mooccupy.InsertManyAsync(moMes_mooccupy);
|
|
|
}
|
|
|
//工单主表
|
|
|
- var mes_morder = _mysql_mes_morder.GetListAsync(x => x.tenant_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
+ var mes_morder = _mysql_mes_morder.GetListAsync(x => x.company_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
if (mes_morder.Count > 0)
|
|
|
{
|
|
|
mes_morder.ForEach(item => { item.bang_id = bangid; });
|
|
|
@@ -1744,7 +1744,7 @@ namespace Business.ResourceExamineManagement
|
|
|
await _mes_morder.InsertManyAsync(moMes_morder);
|
|
|
}
|
|
|
//工单子表
|
|
|
- var mes_moentry = _mysql_mes_moentry.GetListAsync(x => x.tenant_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
+ var mes_moentry = _mysql_mes_moentry.GetListAsync(x => x.company_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
if (mes_moentry.Count > 0)
|
|
|
{
|
|
|
mes_moentry.ForEach(item => { item.bang_id = bangid; });
|
|
|
@@ -1755,7 +1755,7 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
//TODO:要不要根据某些条件只同步有效的数据
|
|
|
//采购订单
|
|
|
- var srm_po_main = _mysql_srm_po_main.GetListAsync(x => x.tenant_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
+ var srm_po_main = _mysql_srm_po_main.GetListAsync(x => x.company_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
if (srm_po_main.Count > 0)
|
|
|
{
|
|
|
srm_po_main.ForEach(item => { item.bang_id = bangid; });
|
|
|
@@ -1765,7 +1765,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
|
|
|
//采购订单明细
|
|
|
- var srm_po_list = _mysql_srm_po_list.GetListAsync(x => x.tenant_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
+ var srm_po_list = _mysql_srm_po_list.GetListAsync(x => x.company_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
if (srm_po_list.Count > 0)
|
|
|
{
|
|
|
srm_po_list.ForEach(item => { item.bang_id = bangid; });
|
|
|
@@ -1775,7 +1775,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
|
|
|
//采购订单占用详情
|
|
|
- var srm_po_occupy = _mysql_srm_po_occupy.GetListAsync(x => x.tenant_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
+ var srm_po_occupy = _mysql_srm_po_occupy.GetListAsync(x => x.company_id == tenantId && x.factory_id == factoryId).Result;
|
|
|
if (srm_po_occupy.Count > 0)
|
|
|
{
|
|
|
srm_po_occupy.ForEach(item => { item.bang_id = bangid; });
|
|
|
@@ -1822,7 +1822,7 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <returns></returns>
|
|
|
private List<ICItemLeadTimeDto> GetLeadTime(List<mo_ic_item> icItemIds, long tenantId, long factoryid)
|
|
|
{
|
|
|
- return icItemIds.Where(p => p.factory_id == factoryid && p.tenant_id == tenantId && !p.IsDeleted).
|
|
|
+ return icItemIds.Where(p => p.factory_id == factoryid && p.company_id == tenantId && !p.IsDeleted).
|
|
|
Select(x => new ICItemLeadTimeDto
|
|
|
{
|
|
|
item_id = x.mysql_id,
|
|
|
@@ -1840,7 +1840,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//根据物料id获取物料供应商
|
|
|
private List<mo_srm_purchase> GetSupplier(List<long> icItemIds, long tenantId, long factoryid)
|
|
|
{
|
|
|
- return _srm_purchase.GetListAsync(p => icItemIds.Contains(p.icitem_id) && p.tenant_id == tenantId && p.factory_id == factoryid && !p.IsDeleted).Result;
|
|
|
+ return _srm_purchase.GetListAsync(p => icItemIds.Contains(p.icitem_id) && p.company_id == tenantId && p.factory_id == factoryid && !p.IsDeleted).Result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -1973,7 +1973,7 @@ namespace Business.ResourceExamineManagement
|
|
|
podetail.currencytype = item.currencytype;
|
|
|
podetail.create_time = DateTime.Now;
|
|
|
podetail.factory_id = param.factoryId;
|
|
|
- podetail.tenant_id = param.tenantId;
|
|
|
+ podetail.company_id = param.company_id;
|
|
|
podetail.stock_id = 1;
|
|
|
podetaillist.Add(podetail);
|
|
|
poDto.polist.Add(podetail);
|
|
|
@@ -2011,7 +2011,7 @@ namespace Business.ResourceExamineManagement
|
|
|
po_Main.financialstate = 0;
|
|
|
po_Main.create_time = DateTime.Now;
|
|
|
po_Main.factory_id = param.factoryId;
|
|
|
- po_Main.tenant_id = param.tenantId;
|
|
|
+ po_Main.company_id = param.company_id;
|
|
|
po_Main.po_delivery = 1;
|
|
|
polist.Add(po_Main);
|
|
|
|
|
|
@@ -2039,7 +2039,7 @@ namespace Business.ResourceExamineManagement
|
|
|
srm_Po_Occupy.stime = p.create_time;
|
|
|
srm_Po_Occupy.etime = p.rarrdate;
|
|
|
srm_Po_Occupy.state = 1;
|
|
|
- srm_Po_Occupy.tenant_id = param.tenantId;//取销售子表企业ID
|
|
|
+ srm_Po_Occupy.company_id = param.company_id;//取销售子表企业ID
|
|
|
srm_Po_Occupy.factory_id = param.factoryId;
|
|
|
srm_Po_Occupy.create_time = DateTime.Now;
|
|
|
srm_Po_Occupy.create_by_name = "admin";
|
|
|
@@ -2232,7 +2232,7 @@ namespace Business.ResourceExamineManagement
|
|
|
examine.GenerateNewId(help.NextId());
|
|
|
examine.type = type;
|
|
|
examine.create_time = DateTime.Now;
|
|
|
- examine.tenant_id = param.tenantId;
|
|
|
+ examine.company_id = param.company_id;
|
|
|
examine.factory_id = param.factoryId;
|
|
|
examine.create_time = DateTime.Now;
|
|
|
examineList.Add(examine);
|
|
|
@@ -2242,7 +2242,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var detail = ObjectMapper.Map<OrderItemDto, b_order_detail>(s);
|
|
|
detail.GenerateNewId(help.NextId());
|
|
|
detail.order_examine_id = examine.Id;
|
|
|
- detail.tenant_id = param.tenantId;
|
|
|
+ detail.company_id = param.company_id;
|
|
|
detail.factory_id = param.factoryId;
|
|
|
detail.create_time = DateTime.Now;
|
|
|
orderDetails.Add(detail);
|
|
|
@@ -2255,7 +2255,7 @@ namespace Business.ResourceExamineManagement
|
|
|
detail.GenerateNewId(help.NextId());
|
|
|
detail.type = type;
|
|
|
detail.create_time = DateTime.Now;
|
|
|
- detail.tenant_id = param.tenantId;
|
|
|
+ detail.company_id = param.company_id;
|
|
|
detail.factory_id = param.factoryId;
|
|
|
daybulletinboards.Add(detail);
|
|
|
}
|
|
|
@@ -2405,11 +2405,11 @@ namespace Business.ResourceExamineManagement
|
|
|
OrderCheckDto input = new OrderCheckDto();
|
|
|
if (mo_Mes_Morders.Any())
|
|
|
{
|
|
|
- input.tenantId = mo_Mes_Morders[0].tenant_id;
|
|
|
+ input.company_id = mo_Mes_Morders[0].company_id;
|
|
|
input.factoryId = mo_Mes_Morders[0].factory_id.GetValueOrDefault();
|
|
|
}
|
|
|
//资源检查入参全局变量赋值
|
|
|
- param.tenantId = input.tenantId;
|
|
|
+ param.company_id = input.company_id;
|
|
|
param.factoryId = input.factoryId;
|
|
|
param.checkflag = false;
|
|
|
param.checkPlan = planCheck;
|
|
|
@@ -2427,12 +2427,12 @@ namespace Business.ResourceExamineManagement
|
|
|
List<mes_moentry> mo_Mes_Moentries = _mysql_mes_moentry.GetListAsync(x => mo_Mes_Morders.Select(s => s.Id).Contains(x.moentry_moid.Value)).Result;
|
|
|
|
|
|
//获取订单行数据
|
|
|
- List<crm_seorderentry> sentrys = _mysql_crm_seorderentry.GetListAsync(p => p.tenant_id == input.tenantId && p.factory_id == input.factoryId && !p.IsDeleted && mo_Mes_Moentries.Select(x => x.soentry_id).Contains(p.Id)).Result;
|
|
|
+ List<crm_seorderentry> sentrys = _mysql_crm_seorderentry.GetListAsync(p => p.company_id == input.company_id && p.factory_id == input.factoryId && !p.IsDeleted && mo_Mes_Moentries.Select(x => x.soentry_id).Contains(p.Id)).Result;
|
|
|
|
|
|
//删除同步Mysql后旧数据
|
|
|
await DeleteMySqlOldData(sentrys);
|
|
|
|
|
|
- List<mo_ic_bom> boms = _ic_bom.GetListAsync(p => mo_Mes_Morders.Select(m => m.bom_number).Contains(p.bom_number) && p.factory_id == input.factoryId && p.tenant_id == input.tenantId && !p.IsDeleted).Result.ToList();
|
|
|
+ List<mo_ic_bom> boms = _ic_bom.GetListAsync(p => mo_Mes_Morders.Select(m => m.bom_number).Contains(p.bom_number) && p.factory_id == input.factoryId && p.company_id == input.company_id && !p.IsDeleted).Result.ToList();
|
|
|
|
|
|
//物料bom
|
|
|
List<mo_ic_bom> bomlist = new List<mo_ic_bom>();
|
|
|
@@ -2466,7 +2466,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
|
|
|
//数据库快照-同步mysql库数据到mongoDB中
|
|
|
- await DbSnapShot(input.tenantId, input.factoryId, bangid, pretreatments);
|
|
|
+ await DbSnapShot(input.company_id, input.factoryId, bangid, pretreatments);
|
|
|
|
|
|
DataInitialization(boms, bangid, icitemlist, stocklist, pretreatments);
|
|
|
_morderAppService.param = param;
|
|
|
@@ -2549,8 +2549,8 @@ namespace Business.ResourceExamineManagement
|
|
|
//获取工单数据
|
|
|
var workOrdMasters = _workOrdMaster.Select(p => mo_Mes_Morders.Select(c=>c.morder_no).Contains(p.WorkOrd));
|
|
|
workOrdMasters.ForEach(s => {
|
|
|
- s.OrdDate = DateTime.Now.Date.AddDays(7);//锁定期
|
|
|
- s.DueDate = DateTime.Now.Date.AddDays(7);
|
|
|
+ s.OrdDate = DateTime.Now.Date.AddDays(14);//锁定期
|
|
|
+ s.DueDate = DateTime.Now.Date.AddDays(14);
|
|
|
});
|
|
|
//优先级排序
|
|
|
workOrdMasters = workOrdMasters.OrderBy(s => s.OrdDate).ToList();
|
|
|
@@ -2564,6 +2564,7 @@ namespace Business.ResourceExamineManagement
|
|
|
morder.moentry_sys_etime = wod.DueDate;
|
|
|
|
|
|
var exa = rtn.examines.Find(s => s.morder_no == wod.WorkOrd);
|
|
|
+ exa.latest_times = morder.moentry_sys_etime.GetValueOrDefault().Date.AddDays(1);
|
|
|
//根据排产后得日期,反推PR。
|
|
|
var wkordPrList = prmainlist.Where(s => s.pr_mono == wod.WorkOrd).ToList();
|
|
|
|
|
|
@@ -2577,9 +2578,9 @@ namespace Business.ResourceExamineManagement
|
|
|
var bce = exa.BomChildExamineList.Find(s => s.item_id == pr.icitem_id && s.num == pr.num);
|
|
|
pr.pr_sarrive_date = morder.moentry_sys_stime.Value.AddDays((double)(0 - bce.pre_time.GetValueOrDefault() - 1 - icitem.clean_leadtime.GetValueOrDefault()));//到货还需要向前推 物料的预处理时间。到货日期必须提前一天到
|
|
|
pr.pr_ssend_date = pr.pr_sarrive_date.GetValueOrDefault().AddDays(0 - ts.Value.Days);
|
|
|
- if (pr.pr_ssend_date > DateTime.Now)
|
|
|
+ if (pr.pr_ssend_date < DateTime.Now.Date.AddDays(1))
|
|
|
{
|
|
|
- pr.pr_ssend_date = DateTime.Now;
|
|
|
+ pr.pr_ssend_date = DateTime.Now.Date.AddDays(1);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -2597,7 +2598,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
if (_CalcBomViewAppService.srm_Po_OccupiesInsert.Any())
|
|
|
{
|
|
|
- _CalcBomViewAppService.srm_Po_OccupiesInsert.ForEach(s => { s.tenant_id = param.tenantId; s.factory_id = param.factoryId; });
|
|
|
+ _CalcBomViewAppService.srm_Po_OccupiesInsert.ForEach(s => { s.company_id = param.company_id; s.factory_id = param.factoryId; });
|
|
|
await _srm_po_occupy.InsertManyAsync(_CalcBomViewAppService.srm_Po_OccupiesInsert);
|
|
|
}
|
|
|
await unitOfWork.CompleteAsync();
|
|
|
@@ -2637,7 +2638,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
}
|
|
|
b_ex.create_time = DateTime.Now;
|
|
|
- b_ex.tenant_id = param.tenantId;
|
|
|
+ b_ex.company_id = param.company_id;
|
|
|
b_ex.factory_id = param.factoryId;
|
|
|
examineList.Add(b_ex);
|
|
|
ex.BomChildExamineList.ForEach(s =>
|
|
|
@@ -2645,7 +2646,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var bc_ex = ObjectMapper.Map<BomChildExamineDto, b_bom_child_examine>(s);
|
|
|
bc_ex.GenerateNewId(help.NextId());
|
|
|
bc_ex.examine_id = b_ex.Id;
|
|
|
- bc_ex.tenant_id = param.tenantId;
|
|
|
+ bc_ex.company_id = param.company_id;
|
|
|
bc_ex.factory_id = param.factoryId;
|
|
|
bc_ex.create_time = DateTime.Now;
|
|
|
bomExamineList.Add(bc_ex);
|
|
|
@@ -2655,7 +2656,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var olist = ObjectMapper.Map<List<mo_occupy>, List<b_mo_occupy>>(s.mo_occupy_list);
|
|
|
olist.ForEach(o =>
|
|
|
{
|
|
|
- o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.bom_child_examine_id = bc_ex.Id; o.company_id = param.company_id;
|
|
|
o.factory_id = param.factoryId;
|
|
|
});
|
|
|
mooccupyList.AddRange(olist);
|
|
|
@@ -2665,7 +2666,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var mlist = ObjectMapper.Map<List<moorder>, List<b_mo_order>>(s.make_list);
|
|
|
mlist.ForEach(o =>
|
|
|
{
|
|
|
- o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.bom_child_examine_id = bc_ex.Id; o.company_id = param.company_id;
|
|
|
o.factory_id = param.factoryId;
|
|
|
});
|
|
|
moorderList.AddRange(mlist);
|
|
|
@@ -2675,7 +2676,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var slist = ObjectMapper.Map<List<ooder>, List<b_ooder>>(s.subcontracting_list);
|
|
|
slist.ForEach(o =>
|
|
|
{
|
|
|
- o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.bom_child_examine_id = bc_ex.Id; o.company_id = param.company_id;
|
|
|
o.factory_id = param.factoryId;
|
|
|
});
|
|
|
ooderList.AddRange(slist);
|
|
|
@@ -2685,7 +2686,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var plist = ObjectMapper.Map<List<purchase>, List<b_purchase>>(s.purchase_list);
|
|
|
plist.ForEach(o =>
|
|
|
{
|
|
|
- o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.bom_child_examine_id = bc_ex.Id; o.company_id = param.company_id;
|
|
|
o.factory_id = param.factoryId;
|
|
|
});
|
|
|
purchaseList.AddRange(plist);
|
|
|
@@ -2695,7 +2696,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var purlist = ObjectMapper.Map<List<purchase_occupy>, List<b_purchase_occupy>>(s.purchase_occupy_list);
|
|
|
purlist.ForEach(o =>
|
|
|
{
|
|
|
- o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.bom_child_examine_id = bc_ex.Id; o.company_id = param.company_id;
|
|
|
o.factory_id = param.factoryId;
|
|
|
});
|
|
|
purchaseoccupyList.AddRange(purlist);
|
|
|
@@ -2786,11 +2787,11 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
//主工单
|
|
|
List<mo_mes_morder> mo_Mes_Morders = _mes_morder.GetListAsync(x => boms.Select(p => p.bom_number).Contains(x.bom_number) && (x.morder_state != MorderEnum.Accomplish_state || x.morder_state != MorderEnum.Close_state
|
|
|
- && x.morder_icitem_type != MorderEnum.XgwyMorder) && x.tenant_id == param.tenantId && x.bang_id == bangid).Result;
|
|
|
+ && x.morder_icitem_type != MorderEnum.XgwyMorder) && x.company_id == param.company_id && x.bang_id == bangid).Result;
|
|
|
List<long> moids = mo_Mes_Morders.Select(p => p.mysql_id).ToList();
|
|
|
List<mo_mes_moentry> mo_Mes_Moentry = _mes_moentry.GetListAsync(x => moids.Contains(x.moentry_moid)).Result;
|
|
|
//工单占用表
|
|
|
- List<mo_mes_mooccupy> mes_mooccupyList = _mes_mooccupy.GetListAsync(x => x.moo_state == 1 && !x.IsDeleted && x.tenant_id == param.tenantId
|
|
|
+ List<mo_mes_mooccupy> mes_mooccupyList = _mes_mooccupy.GetListAsync(x => x.moo_state == 1 && !x.IsDeleted && x.company_id == param.company_id
|
|
|
&& boms.Select(p => p.item_number).Contains(x.fitem_number) && x.bang_id == bangid).Result;
|
|
|
|
|
|
//物料采购订单明细
|
|
|
@@ -2805,8 +2806,8 @@ namespace Business.ResourceExamineManagement
|
|
|
stocklist.AddRange(_ic_item_stock.GetListAsync(p => p.factory_id == param.factoryId && p.bang_id == bangid && itemIds.Contains(p.icitem_id)).Result);
|
|
|
|
|
|
//物料提前期
|
|
|
- leadTimeList = GetLeadTime(icitemlist, param.tenantId, param.factoryId);//提前期列表
|
|
|
- supplierList = GetSupplier(itemIds, param.tenantId, param.factoryId);//供应商列表
|
|
|
+ leadTimeList = GetLeadTime(icitemlist, param.company_id, param.factoryId);//提前期列表
|
|
|
+ supplierList = GetSupplier(itemIds, param.company_id, param.factoryId);//供应商列表
|
|
|
|
|
|
_CalcBomViewAppService.leadTimeList = leadTimeList;
|
|
|
_CalcBomViewAppService.supplierList = supplierList;
|
|
|
@@ -2877,7 +2878,7 @@ namespace Business.ResourceExamineManagement
|
|
|
/// </summary>
|
|
|
public void AutoCreateBomBill(List<mo_ic_bom> ic_Boms = null)
|
|
|
{
|
|
|
- ic_Boms ??= _ic_bom.GetListAsync(p => p.factory_id == 10101 && p.tenant_id == 101 && !p.IsDeleted).Result.ToList();
|
|
|
+ ic_Boms ??= _ic_bom.GetListAsync(p => p.factory_id == 10101 && p.company_id == 101 && !p.IsDeleted).Result.ToList();
|
|
|
var pretreatment = _mysql_b_bom_pretreatment.GetListAsync(s => ic_Boms.Select(c => c.mysql_id).ToList().Contains(s.sourceid)).Result;
|
|
|
|
|
|
//物料bom
|
|
|
@@ -3037,9 +3038,6 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
});
|
|
|
List<string> itemKeys = dictItemQty.Keys.ToList();
|
|
|
- //var items = _mysql_ic_item.GetListAsync(a => itemKeys.Contains(a.number) && a.factory_id == 1001 && a.tenant_id == 1000).Result;
|
|
|
- //var itemIds = items.Select(b => b.Id).ToList();
|
|
|
- //var leadTimes = GetLeadTime(itemIds, 1000, 1001).Max(a=>a.ordissu_days.GetValueOrDefault());
|
|
|
decimal leadTimes = itemLocList.Select(a => a.MFGMTTR).Max();
|
|
|
//没有维护备料提前期,默认取7天
|
|
|
if (leadTimes > 0)
|
|
|
@@ -3078,14 +3076,14 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
itemChildList.AddRange(GetChildItemNumber(a, new List<string>()));
|
|
|
});
|
|
|
- var stockList = _locationDetail.Select(a => a.Domain == "1001" && a.IsActive && itemChildList.Distinct().Contains(a.ItemNum));
|
|
|
+ var stockList = _locationDetail.Select(a => a.Domain == param.factoryId.ToString() && a.IsActive && itemChildList.Distinct().Contains(a.ItemNum));
|
|
|
var groupList = stockList.
|
|
|
GroupBy(m => new { m.ItemNum }).
|
|
|
Select(a => new { ItemNum = a.Key.ItemNum, Qty = a.Sum(c => c.QtyOnHand) }).ToList();
|
|
|
var itemNums = groupList.Select(b => b.ItemNum).ToList();//需要处理的dop物料编码集合
|
|
|
- var items = _mysql_ic_item.GetListAsync(a => itemNums.Contains(a.number) && a.factory_id == 1001 && a.tenant_id == 1000).Result;
|
|
|
+ var items = _mysql_ic_item.GetListAsync(a => itemNums.Contains(a.number) && a.factory_id == param.factoryId && a.company_id == param.company_id).Result;
|
|
|
var itemIds = items.Select(b => b.Id).ToList();//需要处理的dop物料id集合
|
|
|
- List<ic_item_stock> mysqlStock = _mysql_ic_item_stock.GetListAsync(a => itemIds.Contains(a.Id) && a.factory_id == 1001 && a.tenant_id == 1000).Result;
|
|
|
+ List<ic_item_stock> mysqlStock = _mysql_ic_item_stock.GetListAsync(a => itemIds.Contains(a.Id) && a.factory_id == param.factoryId && a.company_id == param.company_id).Result;
|
|
|
List<ic_item_stock> needAddList = new List<ic_item_stock>();
|
|
|
|
|
|
foreach (var stockWMS in groupList)
|
|
|
@@ -3103,8 +3101,8 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
ic_item_stock stock = new ic_item_stock();
|
|
|
stock.GenerateNewId(help.NextId());
|
|
|
- stock.factory_id = 1001;
|
|
|
- stock.tenant_id = 1000;
|
|
|
+ stock.factory_id = param.factoryId;
|
|
|
+ stock.company_id = param.company_id;
|
|
|
stock.icitem_id = num.Id;
|
|
|
stock.icitem_name = num.name;
|
|
|
stock.sqty = groupList.First(a => a.ItemNum == num.number).Qty;
|