bom中数量变成分子分母2个字段
This commit is contained in:
@@ -28,5 +28,14 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
public string material_code { get; set; }
|
||||
public string category_id { get; set; }
|
||||
public decimal? num { get; set; }
|
||||
/// <summary>
|
||||
/// 比列分子
|
||||
/// </summary>
|
||||
public int molecule { get; set; }
|
||||
/// <summary>
|
||||
/// 比列分母
|
||||
/// </summary>
|
||||
public int denominator { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -944,6 +944,8 @@ namespace Tnb.ProductionMgr
|
||||
process_id = b.process_id,
|
||||
material_id = SqlFunc.Subqueryable<BasMaterial>().Where(it => it.id == e.material_id).Select(it => it.id),
|
||||
num = e.num,
|
||||
molecule = e.molecule,
|
||||
denominator = e.denominator,
|
||||
ordinal = d.ordinal,
|
||||
mbom_process_id = b.id,
|
||||
})
|
||||
@@ -2715,7 +2717,9 @@ namespace Tnb.ProductionMgr
|
||||
material_id = x.material_id,
|
||||
material_code = y.code,
|
||||
category_id = y.category_id,
|
||||
num = x.num
|
||||
num = x.num,
|
||||
molecule = x.molecule,
|
||||
denominator = x.denominator,
|
||||
})
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
Reference in New Issue
Block a user