生产工单 任务单 提报表 相关数量的类型 int 改成 decimal
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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.生产检定量;
|
||||
|
||||
Reference in New Issue
Block a user