|
|
@@ -327,6 +327,10 @@ namespace Business.ResourceExamineManagement
|
|
|
//获取订单行数据
|
|
|
List<crm_seorderentry> sentrys = await _mysql_crm_seorderentry.GetListAsync(p => p.tenant_id == input.tenantId && p.factory_id == input.factoryId && p.seorder_id == input.sorderId && !p.IsDeleted);
|
|
|
|
|
|
+ //删除同步Mysql后旧数据
|
|
|
+ await DeleteMySqlOldData(sentrys);
|
|
|
+
|
|
|
+
|
|
|
//数据库快照-同步mysql库数据到mongoDB中
|
|
|
await DbSnapShot(input.tenantId, input.factoryId, bangid);
|
|
|
|
|
|
@@ -396,7 +400,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//计算
|
|
|
_CalcBomViewAppService.CalcView(getBomList, bangid, item.qty.Value, input, item.plan_date, sklist, item, icitemlist);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
//TODO:最晚开始时间
|
|
|
var curFacDtl = leadTimeList.FirstOrDefault(p => p.item_id == childBom.icitem_id);
|
|
|
@@ -408,8 +412,6 @@ namespace Business.ResourceExamineManagement
|
|
|
dtl.substitutes = getBomList;
|
|
|
//添加订单行开工信息
|
|
|
examines.Add(dtl);
|
|
|
- //生成工单 TODO:0=产品数量
|
|
|
- //GenerateMorder(o, 0);
|
|
|
}
|
|
|
if (_CalcBomViewAppService.mooccupyAllList.Any())
|
|
|
{
|
|
|
@@ -430,6 +432,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//清空快照数据
|
|
|
await ClearSnapShot(bangid);
|
|
|
return JsonConvert.SerializeObject(rtn);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -469,17 +472,21 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="factoryId"></param>
|
|
|
/// <param name="soentry_id"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task DeleteMySqlOldData(long soentry_id)
|
|
|
+ public async Task DeleteMySqlOldData(List<crm_seorderentry> soentry_id)
|
|
|
{
|
|
|
//删除工单相关表数据
|
|
|
- var mes_moentry = _mysql_mes_moentry.GetListAsync(x => x.Id == soentry_id).Result;
|
|
|
+ var mes_moentry = _mysql_mes_moentry.GetListAsync(x => soentry_id.Select(p => p.Id).Contains(x.soentry_id.Value)).Result;
|
|
|
+
|
|
|
var mes_morder = _mysql_mes_morder.GetListAsync(x => mes_moentry.Select(p => p.moentry_moid).ToList().Contains(x.Id)).Result;
|
|
|
if (mes_moentry.Count > 0)
|
|
|
{
|
|
|
await _mysql_mes_moentry.DeleteManyAsync(mes_moentry);
|
|
|
+ }
|
|
|
+ if (mes_morder.Count > 0)
|
|
|
+ {
|
|
|
await _mysql_mes_morder.DeleteManyAsync(mes_morder);
|
|
|
}
|
|
|
- var mysql_mes_mooccupy = _mysql_mes_mooccupy.GetListAsync(x => x.moo_id_billid == soentry_id).Result;
|
|
|
+ var mysql_mes_mooccupy = _mysql_mes_mooccupy.GetListAsync(x => soentry_id.Select(p => p.Id).Contains(x.moo_id_billid.Value)).Result;
|
|
|
if (mysql_mes_mooccupy.Count > 0)
|
|
|
{
|
|
|
await _mysql_mes_mooccupy.DeleteManyAsync(mysql_mes_mooccupy);
|
|
|
@@ -603,10 +610,16 @@ namespace Business.ResourceExamineManagement
|
|
|
ProjectionDefinitionBuilder<mo_ic_factory_details> project = new ProjectionDefinitionBuilder<mo_ic_factory_details>();
|
|
|
return _ic_factory_details.Find(p => icItemIds.Contains(p.icitem_id) && p.factory_id == factoryid && p.tenant_id == tenantId && !p.IsDeleted,
|
|
|
project.Include(p => p.icitem_id).Include(p => p.production_leadtime).Include(p => p.stock_leadtime).
|
|
|
- Include(p => p.transportation_leadtime).Include(p => p.order_leadtime).Include(p=>p.minorderqty)).Result.
|
|
|
- Select(x => new ICItemLeadTimeDto { item_id = x.icitem_id, transportation_leadtime = x.transportation_leadtime,
|
|
|
- stock_leadtime = x.stock_leadtime, production_leadtime = x.production_leadtime,
|
|
|
- order_leadtime = x.order_leadtime,minorderqty=x.minorderqty }).AsQueryable<ICItemLeadTimeDto>().ToList();
|
|
|
+ Include(p => p.transportation_leadtime).Include(p => p.order_leadtime).Include(p => p.minorderqty)).Result.
|
|
|
+ Select(x => new ICItemLeadTimeDto
|
|
|
+ {
|
|
|
+ item_id = x.icitem_id,
|
|
|
+ transportation_leadtime = x.transportation_leadtime,
|
|
|
+ stock_leadtime = x.stock_leadtime,
|
|
|
+ production_leadtime = x.production_leadtime,
|
|
|
+ order_leadtime = x.order_leadtime,
|
|
|
+ minorderqty = x.minorderqty
|
|
|
+ }).AsQueryable<ICItemLeadTimeDto>().ToList();
|
|
|
}
|
|
|
|
|
|
//根据物料id获取物料供应商
|