批次调整
This commit is contained in:
@@ -1665,11 +1665,29 @@ namespace Tnb.ProductionMgr
|
|||||||
report.location_code = location.location_code;
|
report.location_code = location.location_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string batch = "";
|
||||||
|
|
||||||
|
PrdMo mo = await _db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
|
||||||
|
if (mo.mo_type == DictConst.PrdMoTypeZS)
|
||||||
|
{
|
||||||
|
EqpEquipment equipment = await _db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
|
||||||
|
batch = $"{equipment.code.Substring(equipment.code.Length - 2, 2)}{DateTime.Now.ToString("yyMMdd")}";
|
||||||
|
}else if (mo.mo_type == DictConst.PrdMoTypeJC)
|
||||||
|
{
|
||||||
|
EqpEquipment equipment = await _db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
|
||||||
|
ToolMolds toolMolds = await _db.Queryable<ToolMolds>().SingleAsync(x => x.id == prdMoTask.mold_id);
|
||||||
|
batch = $"{toolMolds.mold_code.Substring(toolMolds.mold_code.Length - 2, 2)}{equipment.code.Substring(equipment.code.Length - 2, 2)}{DateTime.Now.ToString("yyMMdd")}";
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
OrganizeEntity organizeEntity = await _db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == prdMoTask.workline_id);
|
||||||
|
batch = $"{organizeEntity.EnCode.Substring(organizeEntity.EnCode.Length - 2, 2)}{DateTime.Now.ToString("yyMMdd")}";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// report.location_code = input.location_code;
|
// report.location_code = input.location_code;
|
||||||
report.create_id = _userManager.UserId;
|
report.create_id = _userManager.UserId;
|
||||||
report.create_time = DateTime.Now;
|
report.create_time = DateTime.Now;
|
||||||
// report.batch = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
|
report.batch = batch;
|
||||||
report.barcode = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
|
report.barcode = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
|
||||||
report.barqty = mbom.full_qty;
|
report.barqty = mbom.full_qty;
|
||||||
// report.barcode = input.mo_task_code+"0001";
|
// report.barcode = input.mo_task_code+"0001";
|
||||||
@@ -1938,7 +1956,7 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
planqty = prdMoTask.scheduled_qty.Value,
|
planqty = prdMoTask.scheduled_qty.Value,
|
||||||
pqty = input.reported_qty,
|
pqty = input.reported_qty,
|
||||||
code_batch = prdMoTask.batch,
|
code_batch = batch,
|
||||||
code = report.barcode,
|
code = report.barcode,
|
||||||
unit_id = prdMoTask.unit_id,
|
unit_id = prdMoTask.unit_id,
|
||||||
carry_id = wmsCarryH.id,
|
carry_id = wmsCarryH.id,
|
||||||
@@ -3227,44 +3245,46 @@ namespace Tnb.ProductionMgr
|
|||||||
if (mo.mo_type == DictConst.PrdMoTypeZS)
|
if (mo.mo_type == DictConst.PrdMoTypeZS)
|
||||||
{
|
{
|
||||||
EqpEquipment equipment = await _db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
|
EqpEquipment equipment = await _db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
|
||||||
batch = $"{equipment.code}{DateTime.Now.ToString("yyMMdd")}";
|
batch = $"{equipment.code.Substring(equipment.code.Length - 2, 2)}{DateTime.Now.ToString("yyMMdd")}";
|
||||||
}else if (mo.mo_type == DictConst.PrdMoTypeJC)
|
}else if (mo.mo_type == DictConst.PrdMoTypeJC)
|
||||||
{
|
{
|
||||||
EqpEquipment equipment = await _db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
|
EqpEquipment equipment = await _db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
|
||||||
ToolMolds toolMolds = await _db.Queryable<ToolMolds>().SingleAsync(x => x.id == prdMoTask.mold_id);
|
ToolMolds toolMolds = await _db.Queryable<ToolMolds>().SingleAsync(x => x.id == prdMoTask.mold_id);
|
||||||
batch = $"{toolMolds.mold_code}{equipment.code}{DateTime.Now.ToString("yyMMdd")}";
|
batch = $"{toolMolds.mold_code.Substring(toolMolds.mold_code.Length - 2, 2)}{equipment.code.Substring(equipment.code.Length - 2, 2)}{DateTime.Now.ToString("yyMMdd")}";
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
LableRecord lableRecord = await _db.Queryable<LableRecord>().FirstAsync();
|
// LableRecord lableRecord = await _db.Queryable<LableRecord>().FirstAsync();
|
||||||
if (lableRecord == null)
|
// if (lableRecord == null)
|
||||||
{
|
// {
|
||||||
batch = $"{DateTime.Now.ToString("yyMMdd")}5{"1".PadLeft(3,'0')}";
|
// batch = $"{DateTime.Now.ToString("yyMMdd")}5{"1".PadLeft(3,'0')}";
|
||||||
await _db.Insertable(new LableRecord()
|
// await _db.Insertable(new LableRecord()
|
||||||
{
|
// {
|
||||||
id = SnowflakeIdHelper.NextId(),
|
// id = SnowflakeIdHelper.NextId(),
|
||||||
last_day = DateTime.Now.ToString("yyyyMMdd"),
|
// last_day = DateTime.Now.ToString("yyyyMMdd"),
|
||||||
num = 1
|
// num = 1
|
||||||
}).ExecuteCommandAsync();
|
// }).ExecuteCommandAsync();
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
int num = 1;
|
// int num = 1;
|
||||||
if(DateTime.Now.ToString("yyyyMMdd") == lableRecord.last_day)
|
// if(DateTime.Now.ToString("yyyyMMdd") == lableRecord.last_day)
|
||||||
{
|
// {
|
||||||
num = lableRecord.num+1;
|
// num = lableRecord.num+1;
|
||||||
batch = $"{DateTime.Now.ToString("yyMMdd")}5{(lableRecord.num+1).ToString().PadLeft(3,'0')}";
|
// batch = $"{DateTime.Now.ToString("yyMMdd")}5{(lableRecord.num+1).ToString().PadLeft(3,'0')}";
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
batch = $"{DateTime.Now.ToString("yyMMdd")}5{"1".PadLeft(3,'0')}";
|
// batch = $"{DateTime.Now.ToString("yyMMdd")}5{"1".PadLeft(3,'0')}";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
await _db.Updateable<LableRecord>()
|
// await _db.Updateable<LableRecord>()
|
||||||
.SetColumns(x=>x.last_day==DateTime.Now.ToString("yyyyMMdd"))
|
// .SetColumns(x=>x.last_day==DateTime.Now.ToString("yyyyMMdd"))
|
||||||
.SetColumns(x=>x.num==num)
|
// .SetColumns(x=>x.num==num)
|
||||||
.Where(x=>x.id==lableRecord.id)
|
// .Where(x=>x.id==lableRecord.id)
|
||||||
.ExecuteCommandAsync();
|
// .ExecuteCommandAsync();
|
||||||
}
|
// }
|
||||||
|
OrganizeEntity organizeEntity = await _db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == prdMoTask.workline_id);
|
||||||
|
batch = $"{organizeEntity.EnCode.Substring(organizeEntity.EnCode.Length - 2, 2)}{DateTime.Now.ToString("yyMMdd")}";
|
||||||
}
|
}
|
||||||
|
|
||||||
string code = $"(01){basMaterial.di ?? ""}*(11){DateTime.Now.ToString("yyMMdd")}*(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}*(10){batch}#{basMaterial.material_specification}*{batch}*{DateTime.Now.ToString("yyyyMMdd")}*{DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.container_no}";
|
string code = $"(01){basMaterial.di ?? ""}*(11){DateTime.Now.ToString("yyMMdd")}*(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}*(10){batch}#{basMaterial.material_specification}*{batch}*{DateTime.Now.ToString("yyyyMMdd")}*{DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.container_no}";
|
||||||
|
|||||||
Reference in New Issue
Block a user