|
|
@@ -504,6 +504,8 @@ namespace Business.ResourceExamineManagement
|
|
|
dtl.entry_seq = item.entry_seq;
|
|
|
//TODO:最早开始时间默认3天后(后期调整)
|
|
|
dtl.earliest_times = DateTime.Now.Date.AddDays(3);
|
|
|
+ dtl.need_qty = item.qty.GetValueOrDefault();
|
|
|
+ dtl.bom_number = item.bom_number;
|
|
|
|
|
|
//获取当前物料bom数据
|
|
|
var childBom = boms.Where(p => p.item_number == item.item_number).FirstOrDefault();
|
|
|
@@ -512,11 +514,13 @@ namespace Business.ResourceExamineManagement
|
|
|
//bom替代关系组装
|
|
|
_pretreatmentAppService.BomSubstitute(getBomList, bomlist, bomchildlist, icitemlist, sublist, suballlist, subdtllist);
|
|
|
|
|
|
+ GenerateSort(getBomList);
|
|
|
+
|
|
|
getBomList.ForEach(s => s.sentry_id = item.Id);
|
|
|
//库存初始化
|
|
|
_CalcBomViewAppService.BomStock(getBomList, stocklist, bangid);
|
|
|
//计算
|
|
|
- _CalcBomViewAppService.CalcView(getBomList, bangid, item.qty.Value, item.plan_date, sklist, item, icitemlist);
|
|
|
+ _CalcBomViewAppService.CalcView(getBomList, bangid, item.qty.GetValueOrDefault(), item.plan_date, sklist, item, icitemlist);
|
|
|
|
|
|
//TODO:最晚开始时间
|
|
|
var curFacDtl = leadTimeList.FirstOrDefault(p => p.item_id == childBom.icitem_id);
|
|
|
@@ -580,41 +584,56 @@ namespace Business.ResourceExamineManagement
|
|
|
foreach (var ex in rtn.examines)
|
|
|
{
|
|
|
var b_ex = ObjectMapper.Map<ExamineResult, b_examine_result>(ex);
|
|
|
+ b_ex.GenerateNewId();// = help.NextId();
|
|
|
+ b_ex.create_time = DateTime.Now;
|
|
|
+ b_ex.tenant_id = param.tenantId;
|
|
|
+ b_ex.factory_id = param.factoryId;
|
|
|
examineList.Add(b_ex);
|
|
|
ex.BomChildExamineList.ForEach(s => {
|
|
|
var bc_ex = ObjectMapper.Map<BomChildExamineDto, b_bom_child_examine>(s);
|
|
|
- b_ex.GenerateNewId();// = help.NextId();
|
|
|
bc_ex.examine_id = b_ex.Id;
|
|
|
+ bc_ex.tenant_id = param.tenantId;
|
|
|
+ bc_ex.factory_id = param.factoryId;
|
|
|
bomExamineList.Add(bc_ex);
|
|
|
|
|
|
if(s.mo_occupy_list != null)
|
|
|
{
|
|
|
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; });
|
|
|
+ olist.ForEach(o => { o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.factory_id = param.factoryId;
|
|
|
+ });
|
|
|
mooccupyList.AddRange(olist);
|
|
|
}
|
|
|
if (s.make_list != null)
|
|
|
{
|
|
|
var mlist = ObjectMapper.Map<List<moorder>, List<b_mo_order>>(s.make_list);
|
|
|
- mlist.ForEach(o => { o.bom_child_examine_id = bc_ex.Id; });
|
|
|
+ mlist.ForEach(o => { o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.factory_id = param.factoryId;
|
|
|
+ });
|
|
|
moorderList.AddRange(mlist);
|
|
|
}
|
|
|
if (s.subcontracting_list != null)
|
|
|
{
|
|
|
var slist = ObjectMapper.Map<List<ooder>, List<b_ooder>>(s.subcontracting_list);
|
|
|
- slist.ForEach(o => { o.bom_child_examine_id = bc_ex.Id; });
|
|
|
+ slist.ForEach(o => { o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.factory_id = param.factoryId;
|
|
|
+ });
|
|
|
ooderList.AddRange(slist);
|
|
|
}
|
|
|
if (s.purchase_list != null)
|
|
|
{
|
|
|
var plist = ObjectMapper.Map<List<purchase>, List<b_purchase>>(s.purchase_list);
|
|
|
- plist.ForEach(o => { o.bom_child_examine_id = bc_ex.Id; });
|
|
|
+ plist.ForEach(o => { o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.factory_id = param.factoryId;
|
|
|
+ });
|
|
|
purchaseList.AddRange(plist);
|
|
|
}
|
|
|
if (s.purchase_occupy_list != null)
|
|
|
{
|
|
|
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; });
|
|
|
+ purlist.ForEach(o => { o.bom_child_examine_id = bc_ex.Id; o.tenant_id = param.tenantId;
|
|
|
+ o.factory_id = param.factoryId;
|
|
|
+ });
|
|
|
purchaseoccupyList.AddRange(purlist);
|
|
|
}
|
|
|
/*s.mo_occupy_list.ForEach(o => {
|
|
|
@@ -1403,6 +1422,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var getBomList = _pretreatmentAppService.BomPretreatment(childBom.mysql_id, bomlist, bomchildlist, icitemlist);
|
|
|
//bom替代关系组装
|
|
|
_pretreatmentAppService.BomSubstitute(getBomList, bomlist, bomchildlist, icitemlist, sublist, suballlist, subdtllist);
|
|
|
+ GenerateSort(getBomList);
|
|
|
if (sentry != null)
|
|
|
{
|
|
|
dtl.sentry_id = sentry.Id;
|
|
|
@@ -1525,5 +1545,17 @@ namespace Business.ResourceExamineManagement
|
|
|
_CalcBomViewAppService.srm_Po_Lists = poDetailList; //采购明细
|
|
|
_CalcBomViewAppService.srm_Po_Occupies = poOccupys; //采购占用表
|
|
|
}
|
|
|
+
|
|
|
+ public void GenerateSort(List<BomChildExamineDto> returnlist)
|
|
|
+ {
|
|
|
+ int level = returnlist.Max(s => s.level);
|
|
|
+ returnlist.ForEach(s => {
|
|
|
+ int num = level - s.level;
|
|
|
+ if (num > 0)
|
|
|
+ {
|
|
|
+ s.num_order = long.Parse((s.num_order * Math.Pow(1000, num)).ToString());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|