|
|
@@ -47,9 +47,9 @@ namespace Business.ResourceExamineManagement
|
|
|
public DateTime quarter_endtime;
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 是否倒排
|
|
|
+ /// 是否正排
|
|
|
/// </summary>
|
|
|
- public bool IsInverted = false;
|
|
|
+ public bool IsStraight = false;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 工单类型
|
|
|
@@ -435,6 +435,12 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
mes_Morders.moentry_sys_stime = mes_Morders.moentry_sys_etime.GetValueOrDefault().AddDays(-(make_time - 1));
|
|
|
MatterTileDevelop(level1Dto, childList, returnlist, sklist, bangid, mes_Morders.moentry_sys_stime, sentrys, icitemlist);
|
|
|
+ if (IsStraight)
|
|
|
+ {
|
|
|
+ //正排
|
|
|
+ mes_Morders.moentry_sys_stime = childList.Max(s => s.kitting_time.GetValueOrDefault()).AddDays(1).Date;//数据齐套完成后隔天开始生产;
|
|
|
+ mes_Morders.moentry_sys_etime = mes_Morders.moentry_sys_stime.GetValueOrDefault().AddDays(make_time);
|
|
|
+ }
|
|
|
if (!string.IsNullOrEmpty(mes_Morders.bom_number))
|
|
|
{
|
|
|
mes_Morders.mat_start_date = childList.Max(s => s.kitting_time.GetValueOrDefault()).AddDays(1).Date;//数据齐套完成后隔天开始生产;
|
|
|
@@ -694,11 +700,12 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
decimal moo_qty = mooccupylist.Sum(s => s.moo_qty.GetValueOrDefault());
|
|
|
item.mo_qty = moo_qty;
|
|
|
-
|
|
|
+ item.kitting_time = DateTime.Now;
|
|
|
if (mooccupylist.Any())
|
|
|
{
|
|
|
mooccupyAllList.AddRange(mooccupylist);
|
|
|
mooccupyAllInsertList.AddRange(mooccupylist);
|
|
|
+ item.kitting_time = mooccupylist[0].moo_etime;
|
|
|
//在制占用明细
|
|
|
item.mo_occupy_list = new List<mo_occupy>();
|
|
|
mooccupylist.ForEach(s =>
|
|
|
@@ -716,15 +723,11 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
//在制完全足够
|
|
|
item.lack_qty = 0;
|
|
|
- //item.kitting_time = mooccupylist[0].moo_etime;
|
|
|
- item.kitting_time = DateTime.Now;
|
|
|
item.stock_state = 1;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
item.lack_qty -= moo_qty;
|
|
|
- item.kitting_time = DateTime.Now;
|
|
|
- //TODO:需要按标准UPH来计算生产时长
|
|
|
//生成主工单
|
|
|
GenerateMorderDto generateMorderDto = new GenerateMorderDto()
|
|
|
{
|
|
|
@@ -766,7 +769,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var generateMooccupy = _morderAppService.GetMooccupies(sentrys, ic_item, mes_Morders, item.lack_qty, bangid);
|
|
|
mooccupyAllList.Add(generateMooccupy);
|
|
|
mooccupyAllInsertList.Add(generateMooccupy);
|
|
|
-
|
|
|
+
|
|
|
//子工单生成的检查明细,还是挂接到主工单上。
|
|
|
mes_Morders.moentry_sys_etime = plan_date.GetValueOrDefault().AddDays(-1);
|
|
|
mes_Morders.moentry_sys_stime = mes_Morders.moentry_sys_etime.GetValueOrDefault().AddDays(-(make - 1));
|
|
|
@@ -794,16 +797,25 @@ namespace Business.ResourceExamineManagement
|
|
|
mordersInsertList.AddRange(mes_MorderDto.mes_Morders);
|
|
|
moentriesList.AddRange(mes_MorderDto.mes_Moentries);
|
|
|
moentriesInsertList.AddRange(mes_MorderDto.mes_Moentries);
|
|
|
- //先计算末级数据的齐套时间。
|
|
|
+
|
|
|
+ mes_Morders.mat_start_date = item.kitting_time.GetValueOrDefault().AddDays(1).Date;//数据齐套完成后隔天开始生产;
|
|
|
+ //先计算末级数据的齐套时间。
|
|
|
if (cilList.Count > 0)
|
|
|
{
|
|
|
CalcIcitem(cilList, returnlist, bangid, sklist, mes_Morders.moentry_sys_stime, icitemlist, sentrys, childidList);
|
|
|
-
|
|
|
- item.kitting_time = cilList.Max(s => s.kitting_time);
|
|
|
+ mes_Morders.mat_start_date = cilList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(1).Date;
|
|
|
+ mes_Morders.mat_end_date = mes_Morders.mat_start_date.GetValueOrDefault().AddDays(make);
|
|
|
+ if (item.kitting_time < mes_Morders.mat_end_date)
|
|
|
+ {
|
|
|
+ item.kitting_time = mes_Morders.mat_end_date;
|
|
|
+ }
|
|
|
+ if (IsStraight)
|
|
|
+ {
|
|
|
+ //正排
|
|
|
+ mes_Morders.moentry_sys_stime = item.kitting_time.GetValueOrDefault().AddDays(1).Date;//数据齐套完成后隔天开始生产;
|
|
|
+ mes_Morders.moentry_sys_etime = mes_Morders.moentry_sys_stime.GetValueOrDefault().AddDays(make);
|
|
|
+ }
|
|
|
}
|
|
|
- mes_Morders.mat_start_date = item.kitting_time.GetValueOrDefault().AddDays(1).Date;//数据齐套完成后隔天开始生产;
|
|
|
- mes_Morders.mat_end_date = mes_Morders.mat_start_date.GetValueOrDefault().AddDays(make);
|
|
|
- item.kitting_time = mes_Morders.mat_end_date;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -839,7 +851,16 @@ namespace Business.ResourceExamineManagement
|
|
|
if (cilList.Count > 0)
|
|
|
{
|
|
|
CalcIcitem(cilList, returnlist, bangid, sklist, mesorder.ooentry_stime, icitemlist, sentrys, childidList);
|
|
|
- item.kitting_time = cilList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(srmprDto.totalLeadTime.GetValueOrDefault());//加上物料的采购提前期
|
|
|
+ var itemTime = cilList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(srmprDto.totalLeadTime.GetValueOrDefault());//加上物料的采购提前期
|
|
|
+ if (itemTime > item.kitting_time)
|
|
|
+ {
|
|
|
+ item.kitting_time = itemTime;
|
|
|
+ }
|
|
|
+ if (IsStraight)
|
|
|
+ {
|
|
|
+ mesorder.ooentry_stime = cilList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(1);
|
|
|
+ mesorder.ooentry_etime = mesorder.ooentry_stime.GetValueOrDefault().AddDays(srmprDto.totalLeadTime.GetValueOrDefault());
|
|
|
+ }
|
|
|
}
|
|
|
item.subcontracting_qty = item.lack_qty;
|
|
|
item.subcontracting_list = new List<ooder>();
|
|
|
@@ -1219,11 +1240,12 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
decimal moo_qty = mooccupylist.Sum(s => s.moo_qty.GetValueOrDefault());
|
|
|
sct.mo_qty = moo_qty;
|
|
|
-
|
|
|
+ sct.kitting_time = DateTime.Now;
|
|
|
if (mooccupylist.Any())
|
|
|
{
|
|
|
mooccupyAllList.AddRange(mooccupylist);
|
|
|
mooccupyAllInsertList.AddRange(mooccupylist);
|
|
|
+ sct.kitting_time = mooccupylist[0].moo_etime;
|
|
|
//在制占用明细
|
|
|
sct.mo_occupy_list = new List<mo_occupy>();
|
|
|
mooccupylist.ForEach(s =>
|
|
|
@@ -1241,13 +1263,10 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
//在制完全足够
|
|
|
sct.lack_qty = 0;
|
|
|
- //item.kitting_time = mooccupylist[0].moo_etime;
|
|
|
- sct.kitting_time = DateTime.Now;
|
|
|
sct.stock_state = 1;
|
|
|
}
|
|
|
else {
|
|
|
sct.lack_qty -= moo_qty;
|
|
|
- sct.kitting_time = DateTime.Now;
|
|
|
//TODO:需要按标准UPH来计算生产时长
|
|
|
//生成主工单
|
|
|
GenerateMorderDto generateMorderDto = new GenerateMorderDto()
|
|
|
@@ -1286,7 +1305,6 @@ namespace Business.ResourceExamineManagement
|
|
|
var mes_Morders = mes_MorderDto.mes_Morders.FirstOrDefault();
|
|
|
if (mes_Morders != null)
|
|
|
{
|
|
|
-
|
|
|
var generateMooccupy = _morderAppService.GetMooccupies(sentrys, ic_item, mes_Morders, sct.lack_qty, bangid);
|
|
|
mooccupyAllList.Add(generateMooccupy);
|
|
|
mooccupyAllInsertList.Add(generateMooccupy);
|
|
|
@@ -1319,19 +1337,27 @@ namespace Business.ResourceExamineManagement
|
|
|
mordersInsertList.AddRange(mes_MorderDto.mes_Morders);
|
|
|
moentriesList.AddRange(mes_MorderDto.mes_Moentries);
|
|
|
moentriesInsertList.AddRange(mes_MorderDto.mes_Moentries);
|
|
|
-
|
|
|
+
|
|
|
+ mes_Morders.mat_start_date = sct.kitting_time.GetValueOrDefault().AddDays(1).Date;//数据齐套完成后隔天开始生产;
|
|
|
//先计算末级数据的齐套时间。
|
|
|
if (cilList.Count > 0)
|
|
|
{
|
|
|
CalcIcitem(cilList, returnlist, bangid, sklist, mes_Morders.moentry_sys_stime, icitemlist, sentrys, childidList);
|
|
|
- sct.kitting_time = cilList.Max(s => s.kitting_time);
|
|
|
+ mes_Morders.mat_start_date = cilList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(1).Date;
|
|
|
+ mes_Morders.mat_end_date = mes_Morders.mat_start_date.GetValueOrDefault().AddDays(make);
|
|
|
+ if (sct.kitting_time < mes_Morders.mat_end_date)
|
|
|
+ {
|
|
|
+ sct.kitting_time = mes_Morders.mat_end_date;
|
|
|
+ }
|
|
|
+ if (IsStraight)
|
|
|
+ {
|
|
|
+ //正排
|
|
|
+ mes_Morders.moentry_sys_stime = sct.kitting_time.GetValueOrDefault().AddDays(1).Date;//数据齐套完成后隔天开始生产;
|
|
|
+ mes_Morders.moentry_sys_etime = mes_Morders.moentry_sys_stime.GetValueOrDefault().AddDays(make);
|
|
|
+ }
|
|
|
}
|
|
|
- mes_Morders.mat_start_date = sct.kitting_time.GetValueOrDefault().AddDays(1).Date;//数据齐套完成后隔天开始生产;
|
|
|
- mes_Morders.mat_end_date = mes_Morders.mat_start_date.GetValueOrDefault().AddDays(make);
|
|
|
- sct.kitting_time = mes_Morders.mat_end_date;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
else if (sct.erp_cls == 3)
|
|
|
@@ -1546,7 +1572,7 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
srm_Pr.pr_order_type = 1;//单据类型
|
|
|
|
|
|
- if (plan_date != null)
|
|
|
+ if (plan_date != null && !IsStraight)
|
|
|
{
|
|
|
//-1为提前一天准备
|
|
|
srm_Pr.pr_sarrive_date = plan_date.GetValueOrDefault().AddDays(-1 - (int)(Math.Ceiling(plan.clean_leadtime.GetValueOrDefault())));
|
|
|
@@ -1769,7 +1795,10 @@ namespace Business.ResourceExamineManagement
|
|
|
item.purchase_qty = item.lack_qty;
|
|
|
item.purchase_list = new List<purchase>();
|
|
|
}
|
|
|
- item.kitting_time = SRMPRDto.lastStartTmie;
|
|
|
+ if (SRMPRDto.lastStartTmie > item.kitting_time)
|
|
|
+ {
|
|
|
+ item.kitting_time = SRMPRDto.lastStartTmie;
|
|
|
+ }
|
|
|
SRMPRDtoList.Add(SRMPRDto);
|
|
|
return SRMPRDto;
|
|
|
}
|