调整喷码贴标

This commit is contained in:
2023-11-09 16:00:05 +08:00
parent fa292dea76
commit 753e24741b
5 changed files with 77 additions and 27 deletions

View File

@@ -2753,18 +2753,35 @@ namespace Tnb.ProductionMgr
});
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
if (await _db.Queryable<PrdOutPackMarkLabel>().Where(x =>
x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 && x.is_mark==null).AnyAsync())
{
is_mark = 0,
is_label = 0,
mo_task_code = prdMoTask.mo_task_code,
material_code = prdMoTask.material_code,
create_time = DateTime.Now,
};
await _db.Updateable<PrdOutPackMarkLabel>()
.SetColumns(x => x.is_mark == 0)
.Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 &&
x.is_mark == null)
.ExecuteCommandAsync();
}
else
{
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
{
is_mark = 0,
is_label = null,
mo_task_code = prdMoTask.mo_task_code,
material_code = prdMoTask.material_code,
create_time = DateTime.Now,
};
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
}
PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id);
string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch??""}";
return prdMoTask.mo_task_code + "/" + prdMoTask.material_code;
return code;
}
/// <summary>
@@ -2781,19 +2798,35 @@ namespace Tnb.ProductionMgr
});
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
if (await _db.Queryable<PrdOutPackMarkLabel>().Where(x =>
x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null && x.is_mark==0).AnyAsync())
{
is_mark = 0,
is_label = 0,
mo_task_code = prdMoTask.mo_task_code,
material_code = prdMoTask.material_code,
create_time = DateTime.Now,
station_id = input.station_id,
};
await _db.Updateable<PrdOutPackMarkLabel>()
.SetColumns(x => x.is_label == 0)
.Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null &&
x.is_mark == 0)
.ExecuteCommandAsync();
}
else
{
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
{
is_mark = null,
is_label = 0,
mo_task_code = prdMoTask.mo_task_code,
material_code = prdMoTask.material_code,
create_time = DateTime.Now,
};
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
}
return prdMoTask.mo_task_code + "/" + prdMoTask.material_code;
PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id);
string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch??""}";
return code;
}
}