|
|
@@ -385,7 +385,8 @@ namespace Business.ResourceExamineManagement
|
|
|
//await _ic_item_stock.DeleteAll();
|
|
|
}
|
|
|
|
|
|
- public void GetMongoDb(ic_bom bom,List<ic_bom> bomlist,List<ic_bom_child> bomchildlist,List<ic_item> icitemlist) {
|
|
|
+ public void GetMongoDb(ic_bom bom, List<ic_bom> bomlist, List<ic_bom_child> bomchildlist, List<ic_item> icitemlist)
|
|
|
+ {
|
|
|
|
|
|
if (bom != null)
|
|
|
{
|
|
|
@@ -466,7 +467,7 @@ namespace Business.ResourceExamineManagement
|
|
|
BomSubstitute(getBomList, bomlist, bomchildlist, icitemlist);
|
|
|
//库存初始化
|
|
|
BomStock(getBomList, bangid, input.factoryId);
|
|
|
- //
|
|
|
+ //计算
|
|
|
calcTest(getBomList, bangid, o.Id, o.qty.Value, input, o.plan_date);
|
|
|
|
|
|
//最晚开工时间
|
|
|
@@ -954,7 +955,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//TODO:入参异常;
|
|
|
throw new NotImplementedException("BOM编码或需求数量不能为空!");
|
|
|
}
|
|
|
- var Number = 0; //1,满足,2数量满足,时间不满足,3不满足
|
|
|
+ var Number = 3; //1,满足,2数量满足,时间不满足,3不满足
|
|
|
//获取销售订单信息
|
|
|
//var seorder = await _crm_seorder.FindAsync(x => x.Id == OrderId);
|
|
|
//var seorderentry = await _mysql_crm_seorderentry.FindAsync(x => x.Id == seorderentry_id);
|
|
|
@@ -982,7 +983,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var mooccupies = mes_mooccupyList.Where(x => x.moo_moid == morder.Id).ToList();
|
|
|
var mes_Mooccupy = GetMooccupies(seorderentry, ic_item, morder, mooccupies);
|
|
|
await _mes_mooccupy.InsertOne(mes_Mooccupy);
|
|
|
- return Number = 1;
|
|
|
+ Number = 1;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1006,17 +1007,18 @@ namespace Business.ResourceExamineManagement
|
|
|
(x.morder_production_number - x.inventory_number) > Quantity).ToList();
|
|
|
if (number > 0)
|
|
|
{
|
|
|
- return Number = 3;
|
|
|
+ Number = 3;
|
|
|
}
|
|
|
if (morderDatas.Count > 0)
|
|
|
{
|
|
|
- return Number = 2;
|
|
|
+ Number = 2;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return Number = 1;
|
|
|
+ Number = 1;
|
|
|
}
|
|
|
}
|
|
|
+ return Number;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 拼接工单占用表
|
|
|
@@ -1376,7 +1378,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
|
|
|
//计算库存
|
|
|
- public void calcTest(List<BomChildExamineDto> returnlist, long bangid, long orderid,decimal count, SeorderentryDto input,DateTime
|
|
|
+ public void calcTest(List<BomChildExamineDto> returnlist, long bangid, long orderid, decimal count, SeorderentryDto input, DateTime
|
|
|
? plan_date)
|
|
|
{
|
|
|
//占用情况
|
|
|
@@ -1392,18 +1394,13 @@ namespace Business.ResourceExamineManagement
|
|
|
List<long> calcIds = new List<long>();
|
|
|
//先处理下最顶级的产品需要数量
|
|
|
returnlist[0].needCount = returnlist[0].qty * count;
|
|
|
- //returnlist[0].satisfyNum = returnlist[0].sqty;
|
|
|
returnlist[0].lack_qty = returnlist[0].needCount - returnlist[0].sqty;
|
|
|
- /*if (returnlist[0].lack_qty < 0)
|
|
|
+ if (returnlist[0].lack_qty > 0)
|
|
|
{
|
|
|
- //库存满足
|
|
|
- returnlist[0].stock_state = 1;
|
|
|
- returnlist[0].lack_qty = 0;
|
|
|
+ var seorderentry = _mysql_crm_seorderentry.FindAsync(x => x.Id == orderid).Result;
|
|
|
+ //生成自制工单
|
|
|
+ GenerateMorder(seorderentry, returnlist[0].lack_qty);
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- returnlist[0].stock_state = 0;
|
|
|
- }*/
|
|
|
foreach (var item in returnlist)
|
|
|
{
|
|
|
if (item.level == 1)
|
|
|
@@ -1503,22 +1500,22 @@ namespace Business.ResourceExamineManagement
|
|
|
case 0://整批
|
|
|
WholeBatchCheck(sublist, returnlist, sklist, select);
|
|
|
//如果都需要采购的情况下,则默认使用优先级最高的
|
|
|
- WholeBatch(item,sublist, returnlist, sklist, select, bangid, parent, input, plan_date);
|
|
|
+ WholeBatch(item, sublist, returnlist, sklist, select, bangid, parent, input, plan_date);
|
|
|
break;
|
|
|
case 1://混用
|
|
|
- MixedUse(item,sublist, returnlist, sklist, bangid, parent, input, plan_date);
|
|
|
+ MixedUse(item, sublist, returnlist, sklist, bangid, parent, input, plan_date);
|
|
|
break;
|
|
|
case 2://整批加混用
|
|
|
WholeBatchCheck(sublist, returnlist, sklist, select);
|
|
|
if (select.Count() == 0)
|
|
|
{
|
|
|
//走混用
|
|
|
- MixedUse(item,sublist, returnlist, sklist, bangid, parent, input, plan_date);
|
|
|
+ MixedUse(item, sublist, returnlist, sklist, bangid, parent, input, plan_date);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//走整批
|
|
|
- WholeBatch(item,sublist, returnlist, sklist, select, bangid, parent, input, plan_date);
|
|
|
+ WholeBatch(item, sublist, returnlist, sklist, select, bangid, parent, input, plan_date);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
@@ -1553,7 +1550,8 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
//整批占用
|
|
|
public void WholeBatch(BomChildExamineDto item, List<BomChildExamineDto> sublist, List<BomChildExamineDto> returnlist, List<ic_item_stockoccupy> sklist, List<BomChildExamineDto> select, long bangid, BomChildExamineDto parent, SeorderentryDto input, DateTime
|
|
|
- ? plan_date) {
|
|
|
+ ? plan_date)
|
|
|
+ {
|
|
|
if (select.Count() == 0)
|
|
|
{
|
|
|
//如果为空,则默认使用优先级为0的集合作为替代关系
|
|
|
@@ -1619,7 +1617,8 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
//混用占用数据
|
|
|
public void MixedUse(BomChildExamineDto item, List<BomChildExamineDto> sublist, List<BomChildExamineDto> returnlist, List<ic_item_stockoccupy> sklist, long bangid, BomChildExamineDto parent, SeorderentryDto input, DateTime
|
|
|
- ? plan_date) {
|
|
|
+ ? plan_date)
|
|
|
+ {
|
|
|
|
|
|
decimal parent_lack = 0;
|
|
|
if (parent != null)
|