bom中数量变成分子分母2个字段
This commit is contained in:
@@ -78,6 +78,15 @@ namespace Tnb.BasicData.Entities.Dto
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 比列分子
|
||||
/// </summary>
|
||||
public int molecule { get; set; }
|
||||
/// <summary>
|
||||
/// 比列分母
|
||||
/// </summary>
|
||||
public int denominator { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -63,5 +63,14 @@
|
||||
/// 生产bom工序id
|
||||
/// </summary>
|
||||
public string? mbom_process_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 比列分子
|
||||
/// </summary>
|
||||
public int molecule { get; set; }
|
||||
/// <summary>
|
||||
/// 比列分母
|
||||
/// </summary>
|
||||
public int denominator { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,5 +73,13 @@ public partial class BasEbomD : BaseEntity<string>
|
||||
/// 工艺路线名称
|
||||
/// </summary>
|
||||
public string? route_name { get; set; }
|
||||
/// <summary>
|
||||
/// 比列分子
|
||||
/// </summary>
|
||||
public int molecule { get; set; }
|
||||
/// <summary>
|
||||
/// 比列分母
|
||||
/// </summary>
|
||||
public int denominator { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -48,5 +48,14 @@ public partial class BasMbomInput : BaseEntity<string>
|
||||
/// 单位id
|
||||
/// </summary>
|
||||
public string? unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 比列分子
|
||||
/// </summary>
|
||||
public int molecule { get; set; }
|
||||
/// <summary>
|
||||
/// 比列分母
|
||||
/// </summary>
|
||||
public int denominator { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -48,5 +48,14 @@ public partial class BasMbomOutput : BaseEntity<string>
|
||||
/// 单位id
|
||||
/// </summary>
|
||||
public string? unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 比列分子
|
||||
/// </summary>
|
||||
public int molecule { get; set; }
|
||||
/// <summary>
|
||||
/// 比列分母
|
||||
/// </summary>
|
||||
public int denominator { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -104,6 +104,8 @@ namespace Tnb.BasicData
|
||||
feeding_control = a.feeding_control,
|
||||
loss_rate = a.loss_rate,
|
||||
quantity = a.quantity,
|
||||
molecule = a.molecule,
|
||||
denominator = a.denominator,
|
||||
require_weight = a.require_weight,
|
||||
route_name = e.name,
|
||||
version = d.version,
|
||||
@@ -134,6 +136,8 @@ namespace Tnb.BasicData
|
||||
feeding_control = a.feeding_control,
|
||||
loss_rate = a.loss_rate,
|
||||
quantity = a.quantity,
|
||||
molecule = a.molecule,
|
||||
denominator = a.denominator,
|
||||
require_weight = a.require_weight,
|
||||
route_name = e.name,
|
||||
version = d.version,
|
||||
|
||||
@@ -648,6 +648,8 @@ namespace Tnb.BasicData
|
||||
process_id = process?.process_id ?? "",
|
||||
material_id = input.material_id,
|
||||
num = input.num,
|
||||
molecule = input.molecule,
|
||||
denominator = input.denominator,
|
||||
org_id = orgId,
|
||||
unit_id = input.unit_id,
|
||||
});
|
||||
@@ -667,6 +669,8 @@ namespace Tnb.BasicData
|
||||
process_id = process?.process_id ?? "",
|
||||
material_id = output.material_id,
|
||||
num = output.num,
|
||||
molecule = output.molecule,
|
||||
denominator = output.denominator,
|
||||
org_id = orgId,
|
||||
unit_id = output.unit_id,
|
||||
});
|
||||
@@ -765,6 +769,8 @@ namespace Tnb.BasicData
|
||||
process_id = process?.process_id ?? "",
|
||||
material_id = input.material_id,
|
||||
num = input.num,
|
||||
molecule = input.molecule,
|
||||
denominator = input.denominator,
|
||||
org_id = orgId,
|
||||
unit_id = input.unit_id,
|
||||
});
|
||||
@@ -784,6 +790,8 @@ namespace Tnb.BasicData
|
||||
process_id = process?.process_id ?? "",
|
||||
material_id = output.material_id,
|
||||
num = output.num,
|
||||
molecule = output.molecule,
|
||||
denominator = output.denominator,
|
||||
org_id = orgId,
|
||||
unit_id = output.unit_id
|
||||
});
|
||||
|
||||
@@ -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