|
@@ -1,6 +1,7 @@
|
|
|
using Business.Core.Enum;
|
|
using Business.Core.Enum;
|
|
|
using Business.Core.MongoDBHelper;
|
|
using Business.Core.MongoDBHelper;
|
|
|
using Business.Core.Utilities;
|
|
using Business.Core.Utilities;
|
|
|
|
|
+using Business.EntityFrameworkCore;
|
|
|
using Business.ResourceExamineManagement.Dto;
|
|
using Business.ResourceExamineManagement.Dto;
|
|
|
using Bussiness.Model.Bang;
|
|
using Bussiness.Model.Bang;
|
|
|
using Bussiness.Model.MES.IC;
|
|
using Bussiness.Model.MES.IC;
|
|
@@ -27,6 +28,7 @@ using Volo.Abp.DependencyInjection;
|
|
|
using Volo.Abp.Domain.Repositories;
|
|
using Volo.Abp.Domain.Repositories;
|
|
|
using Volo.Abp.MultiTenancy;
|
|
using Volo.Abp.MultiTenancy;
|
|
|
using Volo.Abp.ObjectMapping;
|
|
using Volo.Abp.ObjectMapping;
|
|
|
|
|
+using ZstdSharp.Unsafe;
|
|
|
|
|
|
|
|
namespace Business.ResourceExamineManagement
|
|
namespace Business.ResourceExamineManagement
|
|
|
{
|
|
{
|
|
@@ -226,6 +228,8 @@ namespace Business.ResourceExamineManagement
|
|
|
private List<mo_ic_item_pur> supplierList;
|
|
private List<mo_ic_item_pur> supplierList;
|
|
|
|
|
|
|
|
private List<mo_ic_plan> planList;
|
|
private List<mo_ic_plan> planList;
|
|
|
|
|
+
|
|
|
|
|
+ private readonly BusinessBangDbContext _businessBangDbContext;
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#region 构造函数
|
|
#region 构造函数
|
|
@@ -524,8 +528,8 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
|
|
//TODO:最晚开始时间
|
|
//TODO:最晚开始时间
|
|
|
var curFacDtl = leadTimeList.FirstOrDefault(p => p.item_id == childBom.icitem_id);
|
|
var curFacDtl = leadTimeList.FirstOrDefault(p => p.item_id == childBom.icitem_id);
|
|
|
- //最晚开工时间=订单行客户要求交期-运输提前期-库存提前期-生产提前期-下单提前期
|
|
|
|
|
- dtl.latest_times = item.plan_date.GetValueOrDefault().AddDays(-Convert.ToDouble(curFacDtl?.transportation_leadtime.GetValueOrDefault() + curFacDtl?.stock_leadtime.GetValueOrDefault() + curFacDtl?.production_leadtime.GetValueOrDefault() + curFacDtl?.order_leadtime.GetValueOrDefault()));
|
|
|
|
|
|
|
+ //最晚开工时间=订单行客户要求交期-运输提前期-库存提前期-生产提前期-下单提前期-生产时间
|
|
|
|
|
+ dtl.latest_times = item.plan_date.GetValueOrDefault().AddDays(-Convert.ToDouble(curFacDtl?.transportation_leadtime.GetValueOrDefault() + curFacDtl?.stock_leadtime.GetValueOrDefault() + curFacDtl?.production_leadtime.GetValueOrDefault() + curFacDtl?.order_leadtime.GetValueOrDefault() + _CalcBomViewAppService.ProductionTimeDay));
|
|
|
//物料齐套时间
|
|
//物料齐套时间
|
|
|
dtl.kitting_times = getBomList.Where(p => p.is_use).OrderByDescending(m => m.kitting_time).First().kitting_time.GetValueOrDefault();
|
|
dtl.kitting_times = getBomList.Where(p => p.is_use).OrderByDescending(m => m.kitting_time).First().kitting_time.GetValueOrDefault();
|
|
|
//替代关系展开list
|
|
//替代关系展开list
|
|
@@ -701,8 +705,8 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
}
|
|
|
//清空快照数据
|
|
//清空快照数据
|
|
|
await ClearSnapShot(bangid);
|
|
await ClearSnapShot(bangid);
|
|
|
- return JsonConvert.SerializeObject(rtn);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ //return JsonConvert.SerializeObject(rtn);
|
|
|
|
|
+ return JsonConvert.SerializeObject("ok");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -1273,6 +1277,38 @@ namespace Business.ResourceExamineManagement
|
|
|
var result = await OrderKittingCheck(input);
|
|
var result = await OrderKittingCheck(input);
|
|
|
OrderResourceViewDto rtn = DataPackage(result);
|
|
OrderResourceViewDto rtn = DataPackage(result);
|
|
|
rtn.DayBulletinBoardList = rtn.DayBulletinBoardList.OrderByDescending(d => d.day).ToList();
|
|
rtn.DayBulletinBoardList = rtn.DayBulletinBoardList.OrderByDescending(d => d.day).ToList();
|
|
|
|
|
+
|
|
|
|
|
+ //检查结果写入数据库
|
|
|
|
|
+ List<b_order_examine_result> examineList = new List<b_order_examine_result>();
|
|
|
|
|
+ List<b_order_detail> orderDetails = new List<b_order_detail>();
|
|
|
|
|
+
|
|
|
|
|
+ foreach (var ex in rtn.KittingCheckResultList)
|
|
|
|
|
+ {
|
|
|
|
|
+ var examine = ObjectMapper.Map<OrderResourceDto, b_order_examine_result>(ex);
|
|
|
|
|
+ examine.GenerateNewId();
|
|
|
|
|
+ examine.create_time = DateTime.Now;
|
|
|
|
|
+ examine.tenant_id = param.tenantId;
|
|
|
|
|
+ examine.factory_id = param.factoryId;
|
|
|
|
|
+ examineList.Add(examine);
|
|
|
|
|
+
|
|
|
|
|
+ ex.order_item_list.ForEach(s => {
|
|
|
|
|
+ var detail = ObjectMapper.Map<OrderItemDto, b_order_detail>(s);
|
|
|
|
|
+ detail.GenerateNewId();
|
|
|
|
|
+ detail.order_examine_id = examine.Id;
|
|
|
|
|
+ detail.tenant_id = param.tenantId;
|
|
|
|
|
+ detail.factory_id = param.factoryId;
|
|
|
|
|
+ orderDetails.Add(detail);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ if (examineList.Any())
|
|
|
|
|
+ {
|
|
|
|
|
+ await _businessBangDbContext.b_order_examine_result.BulkInsertAsync(examineList,options=>options.AutoMapOutputDirection = false);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (orderDetails.Any())
|
|
|
|
|
+ {
|
|
|
|
|
+ await _businessBangDbContext.b_order_detail.BulkInsertAsync(orderDetails, options => options.AutoMapOutputDirection = false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return JsonConvert.SerializeObject(rtn);
|
|
return JsonConvert.SerializeObject(rtn);
|
|
|
}
|
|
}
|
|
|
|
|
|