生产工单 任务单 提报表 相关数量的类型 int 改成 decimal

This commit is contained in:
2024-09-20 10:20:48 +08:00
parent 28742d05d0
commit ab4eddc079
24 changed files with 85 additions and 73 deletions

View File

@@ -6,7 +6,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
public string mo_task_code { get; set; }
public string material_id { get; set; }
public string material_code { get; set; }
public int? num { get; set; }
public decimal? num { get; set; }
public List<MaterialPreparationPlanDOutput> children { get; set; } = new List<MaterialPreparationPlanDOutput>();
}

View File

@@ -40,9 +40,9 @@
// /// </summary>
// public string progress_bar { get; set; }
public int? complete_qty { get; set; }
public decimal? complete_qty { get; set; }
public int? scheduled_qty { get; set; }
public decimal? scheduled_qty { get; set; }
/// <summary>
/// 领用设备

View File

@@ -50,24 +50,24 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// <summary>
/// 已完工数量
/// </summary>
public int? complete_qty { get; set; }
public decimal? complete_qty { get; set; }
/// <summary>
/// 报废数量
/// </summary>
public int? scrap_qty { get; set; }
public decimal? scrap_qty { get; set; }
/// <summary>
/// 已排产数量
/// </summary>
public int? scheduled_qty { get; set; }
public decimal? scheduled_qty { get; set; }
/// <summary>
/// 排产类型:1、注塑、挤出2、组装、包装
/// </summary>
public int? schedule_type { get; set; }
public int? reported_work_qty { get; set; }
public decimal? reported_work_qty { get; set; }
/// <summary>
/// 计划开始时间

View File

@@ -44,19 +44,19 @@
/// <summary>
/// 生产任务数量
/// </summary>
public int? scheduled_qty { get; set; }
public decimal? scheduled_qty { get; set; }
/// <summary>
/// 计划数量
/// </summary>
public int? plan_qty { get; set; }
public decimal? plan_qty { get; set; }
/// <summary>
/// 已完成数量
/// </summary>
public int? complete_qty { get; set; }
public decimal? complete_qty { get; set; }
/// <summary>
/// 工序任务量
/// </summary>
public int? process_task_qty { get; set; }
public decimal? process_task_qty { get; set; }
/// <summary>
/// bom_id
/// </summary>

View File

@@ -11,7 +11,7 @@ namespace Tnb.ProductionMgr.Entities.Dto
public string plan_start_date { get; set; }
public string plan_end_date { get; set; }
public string material_id { get; set; }
public int? plan_qty { get; set; }
public decimal? plan_qty { get; set; }
public string unit_id { get; set; }
public string mo_status { get; set; }
public string ebom_version { get; set; }

View File

@@ -8,8 +8,8 @@ namespace Tnb.ProductionMgr.Entities.Dto
public string mold_id { get; set; }
public string eqp_id { get; set; }
public string mo_task_status { get; set; }
public int? plan_qty { get; set; }
public int? scheduled_qty { get; set; }
public decimal? plan_qty { get; set; }
public decimal? scheduled_qty { get; set; }
public string create_time { get; set; }
public string workstation_id { get; set; }
public string worker_id { get; set; }

View File

@@ -55,12 +55,12 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// <summary>
/// 完成数量
/// </summary>
public int? complete_qty { get; set; }
public decimal? complete_qty { get; set; }
/// <summary>
/// 计划生产数量
/// </summary>
public int? plan_qty { get; set; }
public int? scheduled_qty { get; set; }
public decimal? plan_qty { get; set; }
public decimal? scheduled_qty { get; set; }
/// <summary>
/// 预计开工时间

View File

@@ -9,8 +9,8 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
public string eqp_id { get; set; } = string.Empty;
public string plan_start_date { get; set; } = string.Empty;
public string plan_end_date { get; set; } = string.Empty;
public int? plan_qty { get; set; }
public int? complete_qty { get; set; }
public decimal? plan_qty { get; set; }
public decimal? complete_qty { get; set; }
public string? mo_task_status { get; set; } = string.Empty;
public string? schedule_type { get; set; } = string.Empty;
}

View File

@@ -25,11 +25,11 @@
/// <summary>
/// 计划生产量
/// </summary>
public int? plan_qty { get; set; }
public decimal? plan_qty { get; set; }
/// <summary>
/// 已完工数量
/// </summary>
public int? comple_qty { get; set; }
public decimal? comple_qty { get; set; }
/// <summary>
/// 产品名称
/// </summary>

View File

@@ -10,10 +10,10 @@ namespace Tnb.ProductionMgr.Entities.Dto
public string? mo_task_id_id { get; set; } = string.Empty;
public string? mo_task_type { get; set; } = string.Empty;
public string? plan_end_date { get; set; } = string.Empty;
public int? plan_qty { get; set; }
public int? completed_qty { get; set; }
public decimal? plan_qty { get; set; }
public decimal? completed_qty { get; set; }
public string? plan_start_date { get; set; } = string.Empty;
public int? reported_work_qty { get; set; }
public decimal? reported_work_qty { get; set; }
public string? status { get; set; } = string.Empty;
public string mo_code { get; set; }
@@ -24,7 +24,7 @@ namespace Tnb.ProductionMgr.Entities.Dto
public class ReportRecordListChildrenOutput
{
public int? reported_qty { get; set; }
public decimal? reported_qty { get; set; }
public string? create_id { get; set; } = string.Empty;
public string? create_id_id { get; set; } = string.Empty;

View File

@@ -12,9 +12,9 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
public string material_id_id { get; set; }
public string mold_id { get; set; }
public string mold_id_id { get; set; }
public int? plan_qty { get; set; }
public int? complete_qty { get; set; }
public int? scheduled_qty { get; set; }
public decimal? plan_qty { get; set; }
public decimal? complete_qty { get; set; }
public decimal? scheduled_qty { get; set; }
public string workline_id { get; set; }
public string worker_id { get; set; }
public string workline_id_id { get; set; }

View File

@@ -24,10 +24,10 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
public string material_name { get; set; }
public string workline_name { get; set; }
public string report_type { get; set; }
public int qty { get; set; }
public decimal qty { get; set; }
public string repoter_name { get; set; }
public int plan_qty { get; set; }
public int remain_plan_qty { get; set; }
public decimal plan_qty { get; set; }
public decimal remain_plan_qty { get; set; }
public string report_time { get; set; }
}

View File

@@ -20,9 +20,9 @@ namespace Tnb.ProductionMgr.Entities
public string process_id_id { get; set; }
public string process_code { get; set; }
public string mbom_process_id { get; set; }
public int? scheduled_qty { get; set; }
public int? reported_work_qty { get; set; }
public int? scrap_qty { get; set; }
public decimal? scheduled_qty { get; set; }
public decimal? reported_work_qty { get; set; }
public decimal? scrap_qty { get; set; }
public string plan_start_date { get; set; }

View File

@@ -42,27 +42,27 @@ public partial class PrdMo : BaseEntity<string>
/// <summary>
/// 计划生产数量
/// </summary>
public int? plan_qty { get; set; }
public decimal? plan_qty { get; set; }
/// <summary>
/// 已投入数量
/// </summary>
public int? input_qty { get; set; }
public decimal? input_qty { get; set; }
/// <summary>
/// 已完工数量
/// </summary>
public int? complete_qty { get; set; }
public decimal? complete_qty { get; set; }
/// <summary>
/// 已报工数量
/// </summary>
public int? reported_work_qty { get; set; }
public decimal? reported_work_qty { get; set; }
/// <summary>
/// 报废数量
/// </summary>
public int? scrap_qty { get; set; }
public decimal? scrap_qty { get; set; }
/// <summary>
/// 计划开始时间
@@ -227,7 +227,7 @@ public partial class PrdMo : BaseEntity<string>
/// <summary>
/// 已排产数量
/// </summary>
public int? scheduled_qty { get; set; }
public decimal? scheduled_qty { get; set; }
/// <summary>
/// 父工单id
/// </summary>

View File

@@ -67,32 +67,32 @@ public partial class PrdMoTask : BaseEntity<string>
/// <summary>
/// 计划数量
/// </summary>
public int? plan_qty { get; set; }
public decimal? plan_qty { get; set; }
/// <summary>
/// 已投入数量
/// </summary>
public int? input_qty { get; set; }
public decimal? input_qty { get; set; }
/// <summary>
/// 已完工数量
/// </summary>
public int? complete_qty { get; set; }
public decimal? complete_qty { get; set; }
/// <summary>
/// 已报工数量
/// </summary>
public int? reported_work_qty { get; set; }
public decimal? reported_work_qty { get; set; }
/// <summary>
/// 报废数量
/// </summary>
public int? scrap_qty { get; set; }
public decimal? scrap_qty { get; set; }
/// <summary>
/// 已排产数量
/// </summary>
public int? scheduled_qty { get; set; }
public decimal? scheduled_qty { get; set; }
/// <summary>
/// 排产类型:1、注塑、挤出2、组装、包装
@@ -172,7 +172,7 @@ public partial class PrdMoTask : BaseEntity<string>
/// <summary>
/// 工序任务量
/// </summary>
public int? process_task_qty { get; set; }
public decimal? process_task_qty { get; set; }
/// <summary>
/// 工序id
/// </summary>

View File

@@ -47,12 +47,12 @@ public partial class PrdMoTaskDefectRecord : BaseEntity<string>
/// <summary>
/// 计划生产数量
/// </summary>
public int? plan_qty { get; set; }
public decimal? plan_qty { get; set; }
/// <summary>
/// 报废数量
/// </summary>
public int scrap_qty { get; set; }
public decimal scrap_qty { get; set; }
/// <summary>
/// 生产任务单状态

View File

@@ -62,17 +62,17 @@ public partial class PrdReport : BaseEntity<string>
/// <summary>
/// 生产数量
/// </summary>
public int? prd_qty { get; set; }
public decimal? prd_qty { get; set; }
/// <summary>
/// 已报工数量
/// </summary>
public int? reported_work_qty { get; set; }
public decimal? reported_work_qty { get; set; }
/// <summary>
/// 报工数量
/// </summary>
public int? reported_qty { get; set; }
public decimal? reported_qty { get; set; }
/// <summary>
/// 生产任务编码
@@ -97,7 +97,7 @@ public partial class PrdReport : BaseEntity<string>
/// <summary>
/// 条码数量
/// </summary>
public int barqty { get; set; }
public decimal barqty { get; set; }
/// <summary>

View File

@@ -42,12 +42,12 @@ public partial class PrdReportRecord : BaseEntity<string>
/// <summary>
/// 计划生产数量
/// </summary>
public int? plan_qty { get; set; }
public decimal? plan_qty { get; set; }
/// <summary>
/// 完成数量
/// </summary>
public int completed_qty { get; set; }
public decimal completed_qty { get; set; }
/// <summary>
/// 任务单号
@@ -68,7 +68,7 @@ public partial class PrdReportRecord : BaseEntity<string>
/// <summary>
/// 已报工数量
/// </summary>
public int reported_work_qty { get; set; }
public decimal reported_work_qty { get; set; }
/// <summary>
/// 工单号

View File

@@ -44,28 +44,28 @@ namespace Tnb.ProductionMgr
string monthStr = dayStr.Substring(0, 7);
ZhuSuBiOutput output = new ZhuSuBiOutput();
output.day_month_yield = new DayMonthYieldOutput();
int? monthQualifiedQty = await _db.Queryable<PrdReport>()
decimal? monthQualifiedQty = await _db.Queryable<PrdReport>()
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
.Where((a, b) => a.create_time.ToString("yyyy-MM") == monthStr && b.category_id.Contains("ZSJ"))
.GroupBy((a, b) => a.org_id)
.Select((a, b) => SqlFunc.AggregateSum(a.reported_qty))
.FirstAsync();
int? monthUnQualifiedQty = await _db.Queryable<PrdMoTaskDefect>()
decimal? monthUnQualifiedQty = await _db.Queryable<PrdMoTaskDefect>()
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
.Where((a, b) => a.create_time.ToString("yyyy-MM") == monthStr && b.category_id.Contains("ZSJ"))
.GroupBy((a, b) => a.org_id)
.Select((a, b) => SqlFunc.AggregateSum(a.scrap_qty))
.FirstAsync();
int? dayQualifiedQty = await _db.Queryable<PrdReport>()
decimal? dayQualifiedQty = await _db.Queryable<PrdReport>()
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
.Where((a, b) => a.create_time.ToString("yyyy-MM-dd") == monthStr && b.category_id.Contains("ZSJ"))
.GroupBy((a, b) => a.org_id)
.Select((a, b) => SqlFunc.AggregateSum(a.reported_qty))
.FirstAsync();
int? dayUnQualifiedQty = await _db.Queryable<PrdMoTaskDefect>()
decimal? dayUnQualifiedQty = await _db.Queryable<PrdMoTaskDefect>()
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
.Where((a, b) => a.create_time.ToString("yyyy-MM-dd") == monthStr && b.category_id.Contains("ZSJ"))
.GroupBy((a, b) => a.org_id)

View File

@@ -57,6 +57,7 @@ namespace Tnb.ProductionMgr
Log.Information($"生产工单接收参数:{JsonConvert.SerializeObject(input)}");
List<PrdMo> moList = new List<PrdMo>();
List<string> deleteMoList = new List<string>();
List<ErpExtendField> extendFieldList = new List<ErpExtendField>();
foreach (var item in input)
{
@@ -146,6 +147,11 @@ namespace Tnb.ProductionMgr
Log.Error($"【SavePrdMo】生产工单{mocode}状态不是待下发无法覆盖");
throw Oops.Bah($"【SavePrdMo】生产工单{mocode}状态不是待下发无法覆盖");
}
if (existMo != null)
{
deleteMoList.Add(mocode);
}
item.id = SnowflakeIdHelper.NextId();
item.material_id = basMaterial.id;
@@ -165,6 +171,10 @@ namespace Tnb.ProductionMgr
}
DbResult<bool> result = await _db.Ado.UseTranAsync(async () =>
{
if (!deleteMoList.IsEmpty())
{
await _db.Deleteable<PrdMo>(x => deleteMoList.Contains(x.mo_code)).ExecuteCommandAsync();
}
await _db.Insertable(moList).ExecuteCommandAsync();
});
if (result.IsSuccess)

View File

@@ -752,7 +752,7 @@ namespace Tnb.ProductionMgr
{
PrdReport prdReport = await _db.Queryable<PrdReport>().Where(x => x.barcode == barcode).FirstAsync();
List<PrdReport> prdReports = await _db.Queryable<PrdReport>().Where(x => x.create_time <= prdReport.create_time && x.barcode != barcode && x.mo_task_id == mo_task_id).ToListAsync();
int? beforeReportNum = prdReports.Sum(x => x.reported_qty);
decimal? beforeReportNum = prdReports.Sum(x => x.reported_qty);
List<string> prdFeedingIds = new();
if (prdMoTask.schedule_type == 1)
{

View File

@@ -802,7 +802,7 @@ namespace Tnb.ProductionMgr
// await _qcCheckPlanService.CreateTask(entity);
#endregion
//根据工单号获取当前工单包含的已排产数
int? schedQty = db.Queryable<PrdMoTask>().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty);
decimal? schedQty = db.Queryable<PrdMoTask>().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty);
if (mo != null)
{//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产
@@ -982,7 +982,7 @@ namespace Tnb.ProductionMgr
//await db.Insertable(sacipRecord).ExecuteCommandAsync();
//根据工单号获取当前工单包含的已排产数
int? schedQty = _db.Queryable<PrdMoTask>().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty);
decimal? schedQty = _db.Queryable<PrdMoTask>().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty);
// if (mo != null)
// {//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产
// if (schedQty.HasValue && schedQty.Value >= mo.plan_qty)
@@ -2131,8 +2131,8 @@ namespace Tnb.ProductionMgr
plan_check_type = WmsWareHouseConst.LINGBUJIANZUIZHONGJIANYAN_ID,
};
int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
decimal? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
decimal? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
entity.oldpronum = reported + scrap;
entity.newpronum = input.reported_qty;
// entity.triggerevent = EnumTriggerEvent.生产检定量;
@@ -2342,9 +2342,11 @@ namespace Tnb.ProductionMgr
// }
// }
if(!isCheckFlag){
if(!isCheckFlag)
{
int takeNum = (int)report.reported_qty.Value;
List<PrdVisionResultRecord> prdVisionResultRecords = await _db.Queryable<PrdVisionResultRecord>()
.Where(x => x.status == 0 && x.result.ToUpper()=="OK").OrderByDescending(x => x.create_time).Take(report.reported_qty.Value).ToListAsync();
.Where(x => x.status == 0 && x.result.ToUpper()=="OK").OrderByDescending(x => x.create_time).Take(takeNum).ToListAsync();
List<string> ids = prdVisionResultRecords.Select(x => x.id).ToList();
@@ -2759,8 +2761,8 @@ namespace Tnb.ProductionMgr
processid = prdMoTask.process_id,
workid = prdMoTask.workstation_id
};
int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
decimal? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
decimal? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
entity.oldpronum = reported + scrap;
entity.newpronum = input.scrap_qty;
entity.triggerevent = EnumTriggerEvent.;

View File

@@ -35,15 +35,15 @@ namespace Tnb.QcMgr.Entities
/// <summary>
/// 原先生产数量
/// </summary>
public int? oldpronum { get; set; }
public decimal? oldpronum { get; set; }
/// <summary>
/// 新生产数量
/// </summary>
public int? newpronum { get; set; }
public decimal? newpronum { get; set; }
/// <summary>
/// 生产次数
/// </summary>
public int? pronum { get; set; }
public decimal? pronum { get; set; }
public string mo_task_code { get; set; }

View File

@@ -384,7 +384,7 @@ namespace Tnb.QcMgr
}else if (QcCheckExecH.checktype == WmsWareHouseConst.LINGBUJIANZUIZHONGJIANYAN_ID)
{
PrdReport prdReport = await db.Queryable<PrdReport>().SingleAsync(x=>x.id==QcCheckExecH.report_id);
int pqty = prdReport.reported_qty.Value - rqty;
decimal pqty = prdReport.reported_qty.Value - rqty;
if (rqty > Decimal.Parse(QcCheckExecH.checknum))
{
throw Oops.Bah("不合格数不能大于抽样数");