|
|
@@ -10,6 +10,8 @@ using Bussiness.MongoModel.MES.IC;
|
|
|
using Bussiness.MongoModel.Production;
|
|
|
using Bussiness.MongoModel.SRM;
|
|
|
using Bussiness.MongoModel.Tech;
|
|
|
+using Spire.Pdf.Exporting.XPS.Schema;
|
|
|
+using Spire.Pdf.General.Render.Decode.Jpeg2000.j2k.wavelet.synthesis;
|
|
|
using System;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
@@ -128,9 +130,9 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="returnlist"></param>
|
|
|
/// <param name="bangid"></param>
|
|
|
/// <param name="count"></param>
|
|
|
- /// <param name="input"></param>
|
|
|
/// <param name="plan_date"></param>
|
|
|
- public void CalcView(List<BomChildExamineDto> returnlist, long bangid, decimal count, SeorderentryDto input, DateTime
|
|
|
+ /// <param name="checkflag">是否生成工单、委外、采购</param>
|
|
|
+ public void CalcView(List<BomChildExamineDto> returnlist, long bangid, decimal count, DateTime
|
|
|
? plan_date, List<mo_ic_item_stockoccupy> sklist, crm_seorderentry sentrys, List<mo_ic_item> icitemlist)
|
|
|
{
|
|
|
//第一级
|
|
|
@@ -145,19 +147,52 @@ namespace Business.ResourceExamineManagement
|
|
|
//先处理下最顶级的产品需要数量
|
|
|
|
|
|
level1Dto.needCount = level1Dto.qty * count;
|
|
|
- level1Dto.lack_qty = level1Dto.needCount - level1Dto.sqty;
|
|
|
+ if (param.checkflag)
|
|
|
+ {
|
|
|
+ //找到当前物料的占用记录
|
|
|
+ var itemSockoccupy = sklist.Where(s => s.icitem_id == level1Dto.item_id && s.bang_id == bangid).ToList();
|
|
|
+ //计算库存减去占用
|
|
|
+ level1Dto.sqty -= itemSockoccupy.Sum(s => s.quantity);
|
|
|
+ level1Dto.sqty = level1Dto.sqty < 0 ? 0 : level1Dto.sqty;
|
|
|
+ level1Dto.lack_qty = level1Dto.needCount - level1Dto.sqty;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ level1Dto.lack_qty = level1Dto.needCount;
|
|
|
+ level1Dto.sqty = 0;
|
|
|
+ }
|
|
|
level1Dto.self_lack_qty = level1Dto.lack_qty;
|
|
|
//平铺需要数量
|
|
|
CaclMaterialShortage(returnlist);
|
|
|
|
|
|
- Mes_MorderDto mes_MorderDto = new Mes_MorderDto();
|
|
|
+ Mes_MorderDto mes_MorderDto = null;
|
|
|
if (level1Dto.lack_qty > 0)
|
|
|
{
|
|
|
+ //直接占用库存,缺料就生成采购
|
|
|
+ mo_ic_item_stockoccupy itemStockoccupyDto = new mo_ic_item_stockoccupy();
|
|
|
+ itemStockoccupyDto.bang_id = bangid;
|
|
|
+ itemStockoccupyDto.icitem_id = level1Dto.item_id;
|
|
|
+ itemStockoccupyDto.item_no = level1Dto.num;
|
|
|
+ if (sentrys != null)
|
|
|
+ {
|
|
|
+ itemStockoccupyDto.orderentry_id = sentrys.Id;
|
|
|
+ }
|
|
|
+ if (level1Dto.sqty != 0 && param.checkflag)
|
|
|
+ {
|
|
|
+ level1Dto.use_qty = level1Dto.sqty;
|
|
|
+ itemStockoccupyDto.quantity = level1Dto.sqty;
|
|
|
+ sklist.Add(itemStockoccupyDto);
|
|
|
+ }
|
|
|
+
|
|
|
//获取物料详情
|
|
|
var ic_item = icitemlist.Find(s => s.mysql_id == level1Dto.item_id);
|
|
|
_morderAppService.mo_Mes_Morders = mordersList;//工单
|
|
|
_morderAppService.mo_Mes_Mooccupies = mooccupyAllList;//工单占用
|
|
|
- var mooccupylist = _morderAppService.CheckMorder(level1Dto.bom_number, level1Dto.lack_qty, plan_date.GetValueOrDefault(), sentrys, ic_item, bangid);
|
|
|
+ List<mo_mes_mooccupy> mooccupylist = new List<mo_mes_mooccupy>();
|
|
|
+ if (param.checkflag)
|
|
|
+ {
|
|
|
+ //顶级无需检查在制
|
|
|
+ mooccupylist = _morderAppService.CheckMorder(level1Dto.bom_number, level1Dto.lack_qty, plan_date.GetValueOrDefault(), sentrys, ic_item, bangid);
|
|
|
+ }
|
|
|
|
|
|
if (mooccupylist.Any())
|
|
|
{
|
|
|
@@ -175,20 +210,10 @@ namespace Business.ResourceExamineManagement
|
|
|
level1Dto.mo_occupy_list.Add(mooc);
|
|
|
});
|
|
|
}
|
|
|
- //直接占用库存,缺料就生成采购
|
|
|
- mo_ic_item_stockoccupy itemStockoccupyDto = new mo_ic_item_stockoccupy();
|
|
|
- itemStockoccupyDto.bang_id = bangid;
|
|
|
- itemStockoccupyDto.icitem_id = level1Dto.item_id;
|
|
|
- itemStockoccupyDto.item_no = level1Dto.num;
|
|
|
- itemStockoccupyDto.orderentry_id = sentrys.Id;
|
|
|
|
|
|
decimal moo_qty = mooccupylist.Sum(s => s.moo_qty.GetValueOrDefault());
|
|
|
level1Dto.mo_qty = moo_qty;
|
|
|
- if (moo_qty != 0)
|
|
|
- {
|
|
|
- itemStockoccupyDto.quantity = moo_qty;
|
|
|
- sklist.Add(itemStockoccupyDto);
|
|
|
- }
|
|
|
+
|
|
|
if (moo_qty == level1Dto.lack_qty)
|
|
|
{
|
|
|
//在制完全足够
|
|
|
@@ -205,44 +230,44 @@ namespace Business.ResourceExamineManagement
|
|
|
//先设定在制的齐套时间
|
|
|
//level1Dto.satisfy_time = mooccupylist[0]?.moo_etime;
|
|
|
level1Dto.stock_state = 0;
|
|
|
- //生成主工单
|
|
|
- GenerateMorderDto generateMorderDto = new GenerateMorderDto()
|
|
|
+ if (param.checkflag)
|
|
|
{
|
|
|
- seorderentry = sentrys,
|
|
|
- seorder = seorder,
|
|
|
- ic_Item = ic_item,
|
|
|
- BomNumber = level1Dto.bom_number,
|
|
|
- version = level1Dto.version,
|
|
|
- number = level1Dto.item_number,
|
|
|
- Quantity = level1Dto.lack_qty,
|
|
|
- morder_type = MorderEnum.XsMorder,
|
|
|
- work_order_type = MorderEnum.CgMorder,
|
|
|
- morder_state = MorderEnum.Initial_state,
|
|
|
- bang_id = bangid,
|
|
|
+ //生成主工单
|
|
|
+ GenerateMorderDto generateMorderDto = new GenerateMorderDto()
|
|
|
+ {
|
|
|
+ seorderentry = sentrys,
|
|
|
+ seorder = seorder,
|
|
|
+ ic_Item = ic_item,
|
|
|
+ BomNumber = level1Dto.bom_number,
|
|
|
+ version = level1Dto.version,
|
|
|
+ number = level1Dto.item_number,
|
|
|
+ Quantity = level1Dto.lack_qty,
|
|
|
+ morder_type = MorderEnum.XsMorder,
|
|
|
+ work_order_type = MorderEnum.CgMorder,
|
|
|
+ morder_state = MorderEnum.Initial_state,
|
|
|
+ bang_id = bangid,
|
|
|
|
|
|
- };
|
|
|
- //生成主工单
|
|
|
- _morderAppService.process = process;
|
|
|
- _morderAppService.techs = techs;
|
|
|
- _morderAppService.tech_Processes = tech_Processes;
|
|
|
- _morderAppService.tech_Proc_Workshops = tech_Proc_Workshops;
|
|
|
- mes_MorderDto = _morderAppService.GenerateMorder(generateMorderDto);
|
|
|
+ };
|
|
|
+ //生成主工单
|
|
|
+ _morderAppService.process = process;
|
|
|
+ _morderAppService.techs = techs;
|
|
|
+ _morderAppService.tech_Processes = tech_Processes;
|
|
|
+ _morderAppService.tech_Proc_Workshops = tech_Proc_Workshops;
|
|
|
+ mes_MorderDto = _morderAppService.GenerateMorder(generateMorderDto);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ level1Dto.is_use= true;
|
|
|
+ level1Dto.kitting_time = DateTime.Now;
|
|
|
+ level1Dto.lack_qty = 0;
|
|
|
level1Dto.satisfy_time = DateTime.Now;
|
|
|
level1Dto.stock_state = 1;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- //这是从上往下展开计算缺料和可制
|
|
|
- CaleLackItem(level1Dto, childList, returnlist, sklist, bangid);
|
|
|
- //level1Dto.kz = childList.Min(s => s.kz);//得到最小可制数量。
|
|
|
- //再加个循环,来根据替代关系里的检查结果,根据规则明确使用和生成占用关系。
|
|
|
- List<long> childidList = new List<long>();
|
|
|
- CalcIcitem(childList, returnlist, bangid, input, sklist, plan_date, icitemlist, sentrys, childidList);
|
|
|
- level1Dto.kitting_time = childList.Max(s => s.kitting_time);
|
|
|
+ MatterTileDevelop(level1Dto, childList, returnlist, sklist, bangid, plan_date, sentrys, icitemlist);
|
|
|
//这里更新产品得满足时间。
|
|
|
if (mes_MorderDto != null)
|
|
|
{
|
|
|
@@ -267,7 +292,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var plan = planList.Find(x => x.icitem_id == level1Dto.item_id);
|
|
|
var ProductiveDate = _productExamineAppService.ProductiveExamine(prodExamine);
|
|
|
var Day = ProductiveDate / (60 * 10); //返回的分钟除以十个小时得出工作天数;
|
|
|
- mes_Morders.moentry_sys_stime = level1Dto.kitting_time.Value.AddDays(1);//数据齐套完成后隔天开始生产;
|
|
|
+ mes_Morders.moentry_sys_stime = childList.Max(s=>s.kitting_time.GetValueOrDefault()).AddDays(1);//数据齐套完成后隔天开始生产;
|
|
|
//结束日期=开始时间+生产时长+自检提前期+入库提前期+发运提前期;
|
|
|
var LeadTime = 0.00m;
|
|
|
if (plan != null)
|
|
|
@@ -309,6 +334,29 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 物料计算
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="level1Dto"></param>
|
|
|
+ /// <param name="childList"></param>
|
|
|
+ /// <param name="returnlist"></param>
|
|
|
+ /// <param name="sklist"></param>
|
|
|
+ /// <param name="bangid"></param>
|
|
|
+ /// <param name="plan_date"></param>
|
|
|
+ /// <param name="sentrys"></param>
|
|
|
+ /// <param name="icitemlist"></param>
|
|
|
+ public void MatterTileDevelop(BomChildExamineDto level1Dto,List<BomChildExamineDto> childList, List<BomChildExamineDto> returnlist, List<mo_ic_item_stockoccupy> sklist,long bangid,DateTime
|
|
|
+ ? plan_date, crm_seorderentry sentrys, List<mo_ic_item> icitemlist)
|
|
|
+ {
|
|
|
+ //这是从上往下展开计算缺料和可制
|
|
|
+ CaleLackItem(level1Dto, childList, returnlist, sklist, bangid);
|
|
|
+ //level1Dto.kz = childList.Min(s => s.kz);//得到最小可制数量。
|
|
|
+ //再加个循环,来根据替代关系里的检查结果,根据规则明确使用和生成占用关系。
|
|
|
+ List<long> childidList = new List<long>();
|
|
|
+ CalcIcitem(childList, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 平铺计算物料情况
|
|
|
/// </summary>
|
|
|
@@ -368,16 +416,17 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
item.stock_state = parent.stock_state;
|
|
|
item.lack_qty = 0;
|
|
|
+ item.self_lack_qty = 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//判断缺料数量
|
|
|
- item.lack_qty = parent.lack_qty * item.qty - item.sqty;
|
|
|
+ item.self_lack_qty = parent.lack_qty * item.qty;
|
|
|
+ item.lack_qty = item.self_lack_qty - item.sqty;
|
|
|
item.lack_qty = item.lack_qty < 0 ? 0 : item.lack_qty;
|
|
|
//判断状态
|
|
|
item.stock_state = item.lack_qty > 0 ? 0 : 1;
|
|
|
}
|
|
|
- item.self_lack_qty = item.lack_qty;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -390,7 +439,7 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="input"></param>
|
|
|
/// <param name="sklist"></param>
|
|
|
/// <param name="plan_date"></param>
|
|
|
- public void CalcIcitem(List<BomChildExamineDto> childList, List<BomChildExamineDto> returnlist, long bangid, SeorderentryDto input, List<mo_ic_item_stockoccupy> sklist, DateTime
|
|
|
+ public void CalcIcitem(List<BomChildExamineDto> childList, List<BomChildExamineDto> returnlist, long bangid, List<mo_ic_item_stockoccupy> sklist, DateTime
|
|
|
? plan_date, List<mo_ic_item> icitemlist, crm_seorderentry sentrys, List<long> childidList)
|
|
|
{
|
|
|
foreach (var item in childList)
|
|
|
@@ -405,10 +454,10 @@ namespace Business.ResourceExamineManagement
|
|
|
if (item.haveicsubs == 1)
|
|
|
{
|
|
|
//如果有替代关系,根据群组来明确使用哪个群组的替代料。按整批和混用逻辑来算
|
|
|
- // 如果有群组替代,就移除掉被检查过的记录 item.icitem_ids
|
|
|
+ //如果有群组替代,就移除掉被检查过的记录 item.icitem_ids
|
|
|
//通过替代群组代码,将替代群组物料进行绑定。
|
|
|
childidList.AddRange(returnlist.Where(s => s.substitute_code == item.substitute_code).Select(d => d.bom_child_id.GetValueOrDefault()));
|
|
|
- CalcStrategy(item, returnlist, bangid, sklist, input, plan_date, icitemlist, sentrys, childidList);
|
|
|
+ CalcStrategy(item, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -421,7 +470,7 @@ namespace Business.ResourceExamineManagement
|
|
|
itemStockoccupyDto.item_no = item.num;
|
|
|
item.kitting_time = DateTime.Now;
|
|
|
item.is_use = true;
|
|
|
- StartProcessing(item, icitemlist, returnlist, plan_date, sentrys, sklist, itemStockoccupyDto, bangid, input, childidList);
|
|
|
+ StartProcessing(item, icitemlist, returnlist, plan_date, sentrys, sklist, itemStockoccupyDto, bangid, childidList);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -440,7 +489,7 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="bangid"></param>
|
|
|
/// <param name="input"></param>
|
|
|
public void StartProcessing(BomChildExamineDto item, List<mo_ic_item> icitemlist, List<BomChildExamineDto> returnlist, DateTime
|
|
|
- ? plan_date, crm_seorderentry sentrys, List<mo_ic_item_stockoccupy> sklist, mo_ic_item_stockoccupy itemStockoccupyDto, long bangid, SeorderentryDto input, List<long> childidList)
|
|
|
+ ? plan_date, crm_seorderentry sentrys, List<mo_ic_item_stockoccupy> sklist, mo_ic_item_stockoccupy itemStockoccupyDto, long bangid, List<long> childidList)
|
|
|
{
|
|
|
var parent = returnlist.Find(s => s.id == item.parent_id);
|
|
|
if (item.lack_qty > 0)
|
|
|
@@ -485,7 +534,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//先计算末级数据的齐套时间。
|
|
|
if (cilList.Count() > 0)
|
|
|
{
|
|
|
- CalcIcitem(cilList, returnlist, bangid, input, sklist, plan_date, icitemlist, sentrys, childidList);
|
|
|
+ CalcIcitem(cilList, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
|
|
|
item.kitting_time = cilList.Max(s => s.kitting_time);
|
|
|
}
|
|
|
item.make_qty = item.lack_qty;
|
|
|
@@ -502,7 +551,10 @@ namespace Business.ResourceExamineManagement
|
|
|
_productExamineAppService.tech_Proc_Workshops = tech_Proc_Workshops;
|
|
|
|
|
|
item.make_qty = item.lack_qty;
|
|
|
- //todo:增加生成子工单后,这里需要加上生成的子工单的明细。
|
|
|
+ /*if (param.checkflag)
|
|
|
+ {
|
|
|
+ //todo:增加生成子工单后,这里需要加上生成的子工单的明细。
|
|
|
+ }*/
|
|
|
item.make_list = new List<moorder>();
|
|
|
var minute = _productExamineAppService.ProductiveExamine(prodExamine);
|
|
|
//系统建议完工日期为 开工日期+产能检查时间=完工日期
|
|
|
@@ -519,7 +571,7 @@ namespace Business.ResourceExamineManagement
|
|
|
if (item.lack_qty > 0)
|
|
|
{
|
|
|
//采购申请
|
|
|
- PackageSRMPR(item, input, bangid, plan_date);
|
|
|
+ PackageSRMPR(item, bangid, plan_date);
|
|
|
}
|
|
|
}
|
|
|
else if (item.erp_cls == 2)
|
|
|
@@ -531,11 +583,11 @@ namespace Business.ResourceExamineManagement
|
|
|
//先计算末级数据的齐套时间。
|
|
|
if (cilList.Count() > 0)
|
|
|
{
|
|
|
- CalcIcitem(cilList, returnlist, bangid, input, sklist, plan_date, icitemlist, sentrys, childidList);
|
|
|
+ CalcIcitem(cilList, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
|
|
|
item.kitting_time = cilList.Max(s => s.kitting_time);
|
|
|
}
|
|
|
//1.先生成委外工单。
|
|
|
- var mesorder = CreateMesOOder(item, input.tenantId, input.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
|
|
|
+ var mesorder = CreateMesOOder(item, param.tenantId, param.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
|
|
|
item.subcontracting_qty = item.lack_qty;
|
|
|
item.subcontracting_list = new List<ooder>();
|
|
|
ooder oo = new ooder();
|
|
|
@@ -552,7 +604,7 @@ namespace Business.ResourceExamineManagement
|
|
|
orderList.Add(mesorder);
|
|
|
//2.生成采购申请
|
|
|
//采购申请
|
|
|
- PackageSRMPR(item, input, bangid, plan_date);
|
|
|
+ PackageSRMPR(item, bangid, plan_date);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -577,7 +629,7 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="sklist"></param>
|
|
|
/// <param name="input"></param>
|
|
|
/// <param name="plan_date"></param>
|
|
|
- public void CalcStrategy(BomChildExamineDto item, List<BomChildExamineDto> returnlist, long bangid, List<mo_ic_item_stockoccupy> sklist, SeorderentryDto input, DateTime
|
|
|
+ public void CalcStrategy(BomChildExamineDto item, List<BomChildExamineDto> returnlist, long bangid, List<mo_ic_item_stockoccupy> sklist, DateTime
|
|
|
? plan_date, List<mo_ic_item> icitemlist, crm_seorderentry sentrys, List<long> childidList)
|
|
|
{
|
|
|
//提取群组关系
|
|
|
@@ -589,22 +641,22 @@ namespace Business.ResourceExamineManagement
|
|
|
case 0://整批
|
|
|
WholeBatchCheck(sublist, returnlist, sklist, select, bangid);
|
|
|
//如果都需要采购的情况下,则默认使用优先级最高的
|
|
|
- WholeBatch(item, sublist, returnlist, sklist, select, bangid, parent, input, plan_date, icitemlist, sentrys, childidList);
|
|
|
+ WholeBatch(item, sublist, returnlist, sklist, select, bangid, parent, plan_date, icitemlist, sentrys, childidList);
|
|
|
break;
|
|
|
case 1://混用
|
|
|
- MixedUse(item, sublist, returnlist, sklist, bangid, parent, input, plan_date, icitemlist, sentrys, childidList);
|
|
|
+ MixedUse(item, sublist, returnlist, sklist, bangid, parent, plan_date, icitemlist, sentrys, childidList);
|
|
|
break;
|
|
|
case 2://整批加混用
|
|
|
WholeBatchCheck(sublist, returnlist, sklist, select, bangid);
|
|
|
if (select.Count() == 0)
|
|
|
{
|
|
|
//走混用
|
|
|
- MixedUse(item, sublist, returnlist, sklist, bangid, parent, input, plan_date, icitemlist, sentrys, childidList);
|
|
|
+ MixedUse(item, sublist, returnlist, sklist, bangid, parent, plan_date, icitemlist, sentrys, childidList);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//走整批
|
|
|
- WholeBatch(item, sublist, returnlist, sklist, select, bangid, parent, input, plan_date, icitemlist, sentrys, childidList);
|
|
|
+ WholeBatch(item, sublist, returnlist, sklist, select, bangid, parent, plan_date, icitemlist, sentrys, childidList);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
@@ -654,9 +706,8 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="select"></param>
|
|
|
/// <param name="bangid"></param>
|
|
|
/// <param name="parent"></param>
|
|
|
- /// <param name="input"></param>
|
|
|
/// <param name="plan_date"></param>
|
|
|
- public void WholeBatch(BomChildExamineDto item, List<BomChildExamineDto> sublist, List<BomChildExamineDto> returnlist, List<mo_ic_item_stockoccupy> sklist, List<BomChildExamineDto> select, long bangid, BomChildExamineDto parent, SeorderentryDto input, DateTime
|
|
|
+ public void WholeBatch(BomChildExamineDto item, List<BomChildExamineDto> sublist, List<BomChildExamineDto> returnlist, List<mo_ic_item_stockoccupy> sklist, List<BomChildExamineDto> select, long bangid, BomChildExamineDto parent, DateTime
|
|
|
? plan_date, List<mo_ic_item> icitemlist, crm_seorderentry sentrys, List<long> childidList)
|
|
|
{
|
|
|
if (select.Count() == 0)
|
|
|
@@ -682,7 +733,7 @@ namespace Business.ResourceExamineManagement
|
|
|
itemStockoccupyDto.icitem_id = slt.item_id;
|
|
|
itemStockoccupyDto.item_no = slt.num;
|
|
|
slt.is_use = true;
|
|
|
- StartProcessing(slt, icitemlist, returnlist, plan_date, sentrys, sklist, itemStockoccupyDto, bangid, input, childidList);
|
|
|
+ StartProcessing(slt, icitemlist, returnlist, plan_date, sentrys, sklist, itemStockoccupyDto, bangid, childidList);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -696,9 +747,8 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="sklist"></param>
|
|
|
/// <param name="bangid"></param>
|
|
|
/// <param name="parent"></param>
|
|
|
- /// <param name="input"></param>
|
|
|
/// <param name="plan_date"></param>
|
|
|
- public void MixedUse(BomChildExamineDto item, List<BomChildExamineDto> sublist, List<BomChildExamineDto> returnlist, List<mo_ic_item_stockoccupy> sklist, long bangid, BomChildExamineDto parent, SeorderentryDto input, DateTime
|
|
|
+ public void MixedUse(BomChildExamineDto item, List<BomChildExamineDto> sublist, List<BomChildExamineDto> returnlist, List<mo_ic_item_stockoccupy> sklist, long bangid, BomChildExamineDto parent, DateTime
|
|
|
? plan_date, List<mo_ic_item> icitemlist, crm_seorderentry sentrys, List<long> childidList)
|
|
|
{
|
|
|
|
|
|
@@ -774,7 +824,10 @@ namespace Business.ResourceExamineManagement
|
|
|
zy.stock_state = 1;
|
|
|
}
|
|
|
mo_ic_item_stockoccupy itemStockoccupyDto = new mo_ic_item_stockoccupy();
|
|
|
- itemStockoccupyDto.orderentry_id = sentrys.Id;
|
|
|
+ if (sentrys != null)
|
|
|
+ {
|
|
|
+ itemStockoccupyDto.orderentry_id = sentrys.Id;
|
|
|
+ }
|
|
|
itemStockoccupyDto.bang_id = bangid;
|
|
|
itemStockoccupyDto.icitem_id = zy.item_id;
|
|
|
/*decimal moo_qty = use_p_num * zy.qty - zy.sqty;
|
|
|
@@ -829,7 +882,10 @@ namespace Business.ResourceExamineManagement
|
|
|
decimal sqty = sct.sqty - sct.use_qty;//这里得出前面混用使用后的库存。
|
|
|
decimal lack_Count = parent_lack * sct.qty;//混用后还缺的部分。
|
|
|
mo_ic_item_stockoccupy itemStockoccupyDto = new mo_ic_item_stockoccupy();
|
|
|
- itemStockoccupyDto.orderentry_id = sentrys.Id;
|
|
|
+ if (sentrys != null)
|
|
|
+ {
|
|
|
+ itemStockoccupyDto.orderentry_id = sentrys.Id;
|
|
|
+ }
|
|
|
itemStockoccupyDto.bang_id = bangid;
|
|
|
itemStockoccupyDto.icitem_id = sct.item_id;
|
|
|
itemStockoccupyDto.item_no = sct.num;
|
|
|
@@ -856,7 +912,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//先计算末级数据的齐套时间。
|
|
|
if (cilList.Count() > 0)
|
|
|
{
|
|
|
- CalcIcitem(cilList, returnlist, bangid, input, sklist, plan_date, icitemlist, sentrys, childidList);
|
|
|
+ CalcIcitem(cilList, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
|
|
|
sct.kitting_time = cilList.Max(s => s.kitting_time);
|
|
|
}
|
|
|
//走自制
|
|
|
@@ -886,7 +942,7 @@ namespace Business.ResourceExamineManagement
|
|
|
if (sct.lack_qty > 0)
|
|
|
{
|
|
|
//采购申请
|
|
|
- PackageSRMPR(sct, input, bangid, plan_date);
|
|
|
+ PackageSRMPR(sct, bangid, plan_date);
|
|
|
}
|
|
|
}
|
|
|
else if (sct.erp_cls == 2)
|
|
|
@@ -898,11 +954,11 @@ namespace Business.ResourceExamineManagement
|
|
|
//先计算末级数据的齐套时间。
|
|
|
if (cilList.Count() > 0)
|
|
|
{
|
|
|
- CalcIcitem(cilList, returnlist, bangid, input, sklist, plan_date, icitemlist, sentrys, childidList);
|
|
|
+ CalcIcitem(cilList, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
|
|
|
sct.kitting_time = cilList.Max(s => s.kitting_time);
|
|
|
}
|
|
|
//1.先生成委外工单。
|
|
|
- var mesorder = CreateMesOOder(sct, input.tenantId, input.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
|
|
|
+ var mesorder = CreateMesOOder(sct, param.tenantId, param.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
|
|
|
sct.subcontracting_qty = sct.lack_qty;
|
|
|
sct.subcontracting_list = new List<ooder>();
|
|
|
ooder oo = new ooder();
|
|
|
@@ -918,7 +974,7 @@ namespace Business.ResourceExamineManagement
|
|
|
sct.kitting_time = mesorder.ooentry_etime;
|
|
|
orderList.Add(mesorder);
|
|
|
//采购申请
|
|
|
- PackageSRMPR(sct, input, bangid, plan_date);
|
|
|
+ PackageSRMPR(sct, bangid, plan_date);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1030,6 +1086,7 @@ namespace Business.ResourceExamineManagement
|
|
|
private mo_mes_oorder CreateMesOOder(BomChildExamineDto returnlist, long tenantId, long factoryid, long bangId, List<ICItemLeadTimeDto> iCItemLeadTimes, List<mo_ic_item_pur> supplierList, DateTime deliveryDate)
|
|
|
{
|
|
|
mo_mes_oorder oOrder = new mo_mes_oorder();
|
|
|
+ oOrder.id = help.NextId();
|
|
|
oOrder.GenerateNewId();
|
|
|
oOrder.oorder_no = getOrderNum("WW");//生产工单编号
|
|
|
oOrder.oorder_type = "委外工单";//生产工单类型
|
|
|
@@ -1105,10 +1162,10 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void PackageSRMPR(BomChildExamineDto item, SeorderentryDto input,long bangid,DateTime? plan_date)
|
|
|
+ public void PackageSRMPR(BomChildExamineDto item,long bangid,DateTime? plan_date)
|
|
|
{
|
|
|
//采购申请
|
|
|
- var SRMPRDto = CreateSRMPR(item, input.tenantId, input.factoryId, bangid, item.erp_cls, leadTimeList, supplierList, planList, plan_date.Value);
|
|
|
+ var SRMPRDto = CreateSRMPR(item, param.tenantId, param.factoryId, bangid, item.erp_cls, leadTimeList, supplierList, planList, plan_date.Value);
|
|
|
item.purchase_qty = item.lack_qty;
|
|
|
item.purchase_list = new List<purchase>();
|
|
|
if (SRMPRDto.srm_Pr_Main != null)
|