bom中数量变成分子分母2个字段
This commit is contained in:
@@ -752,7 +752,8 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
foreach (BasEbomD item in basEbomDs)
|
||||
{
|
||||
decimal? num1 = beforeReportNum / basEbomH.quantity * item.quantity;
|
||||
// decimal? num1 = beforeReportNum / basEbomH.quantity * item.quantity;
|
||||
decimal? num1 = beforeReportNum / basEbomH.quantity * (item.molecule/item.denominator);
|
||||
List<PrdFeedingD> prdFeedingDs = await _db.Queryable<PrdFeedingD>()
|
||||
.LeftJoin<PrdFeedingH>((a, b) => a.feeding_id == b.id)
|
||||
.Where((a, b) => a.material_id == item.material_id && b.mo_task_id == mo_task_id)
|
||||
@@ -768,7 +769,8 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
decimal? num2 = prdReport.reported_qty / basEbomH.quantity * item.quantity;
|
||||
// decimal? num2 = prdReport.reported_qty / basEbomH.quantity * item.quantity;
|
||||
decimal? num2 = prdReport.reported_qty / basEbomH.quantity * (item.molecule/item.denominator);
|
||||
if (sum2 <= num2)
|
||||
{
|
||||
prdFeedingIds.Add(item.id);
|
||||
@@ -813,7 +815,8 @@ namespace Tnb.ProductionMgr
|
||||
break;
|
||||
}
|
||||
|
||||
decimal? num1 = beforeReportNum / Convert.ToDecimal(basMbomOutput.num) * item.num;
|
||||
// decimal? num1 = beforeReportNum / Convert.ToDecimal(basMbomOutput.num) * item.num;
|
||||
decimal? num1 = beforeReportNum / (basMbomOutput.molecule/basMbomOutput.denominator) * (item.molecule/item.denominator);
|
||||
List<PrdFeedingD> prdFeedingDs = await _db.Queryable<PrdFeedingD>()
|
||||
.LeftJoin<PrdFeedingH>((a, b) => a.feeding_id == b.id)
|
||||
.Where((a, b) => a.material_id == item.material_id && b.mo_task_id == mo_task_id)
|
||||
@@ -851,7 +854,8 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
decimal? num2 = lastPrdReport.reported_qty / Convert.ToDecimal(basMbomOutput.num) * item.num;
|
||||
// decimal? num2 = lastPrdReport.reported_qty / Convert.ToDecimal(basMbomOutput.num) * item.num;
|
||||
decimal? num2 = lastPrdReport.reported_qty / (basMbomOutput.molecule/basMbomOutput.denominator) * (item.molecule/item.denominator);
|
||||
if (sum2 <= num2)
|
||||
{
|
||||
lastPrdReportIds.Add(lastPrdReport.id);
|
||||
@@ -879,7 +883,8 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
decimal? num2 = prdReport.reported_qty / Convert.ToDecimal(basMbomOutput.num) * item.num;
|
||||
// decimal? num2 = prdReport.reported_qty / Convert.ToDecimal(basMbomOutput.num) * item.num;
|
||||
decimal? num2 = prdReport.reported_qty / (basMbomOutput.molecule/basMbomOutput.denominator) * (item.molecule/item.denominator);
|
||||
if (sum2 <= num2)
|
||||
{
|
||||
prdFeedingIds.Add(item.id);
|
||||
@@ -1083,7 +1088,8 @@ namespace Tnb.ProductionMgr
|
||||
decimal residueNeed = 0;
|
||||
foreach (PrdReport prdReport in prdReports)
|
||||
{
|
||||
decimal needNum = (prdReport.reported_qty ?? 0) / basEbomH.quantity * basEbomD.quantity;
|
||||
// decimal needNum = (prdReport.reported_qty ?? 0) / basEbomH.quantity * basEbomD.quantity;
|
||||
decimal needNum = (prdReport.reported_qty ?? 0) / basEbomH.quantity * (basEbomD.molecule/basEbomD.denominator);
|
||||
if (beforeIn - needNum >= 0)
|
||||
{
|
||||
beforeIn -= needNum;
|
||||
@@ -1191,15 +1197,16 @@ namespace Tnb.ProductionMgr
|
||||
BasMbomOutput output = outputList.FirstOrDefault(x => x.mbom_process_id == mbomProcesssIds[i] && x.material_id == tempMaterialId);
|
||||
List<string> inputMaterialIds = inputs.Select(x => x.material_id).ToList();
|
||||
List<BasMbomOutput> lastOutputs = outputList.Where(x => x.mbom_process_id == mbomProcesssIds[i - 1]).ToList();
|
||||
decimal? inputNum = inputs.FirstOrDefault(x => inputMaterialIds.Contains(x.material_id))?.num;
|
||||
if (inputNum == null)
|
||||
// decimal? inputNum = inputs.FirstOrDefault(x => inputMaterialIds.Contains(x.material_id))?.num;
|
||||
BasMbomInput? basMbomInput = inputs.FirstOrDefault(x => inputMaterialIds.Contains(x.material_id));
|
||||
if (basMbomInput == null)
|
||||
{
|
||||
throw new Exception("生产bom投入产出物料配置错误");
|
||||
}
|
||||
else
|
||||
{
|
||||
tempMaterialId = inputs.FirstOrDefault(x => inputMaterialIds.Contains(x.material_id))?.material_id;
|
||||
needNum = needNum / Convert.ToDecimal(output.num) * inputNum;
|
||||
needNum = needNum / (output.molecule/output.denominator) * (basMbomInput.molecule/basMbomInput.denominator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user