调整喷码贴标
This commit is contained in:
@@ -253,5 +253,15 @@ public partial class BasMaterial : BaseEntity<string>
|
||||
/// 是否创建子工单
|
||||
/// </summary>
|
||||
public string? is_create_sub_work_order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保质期
|
||||
/// </summary>
|
||||
public int? quality_guarantee_period { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DI编码
|
||||
/// </summary>
|
||||
public string? di { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -197,5 +197,10 @@ public partial class PrdMoTask : BaseEntity<string>
|
||||
/// 物料清单id
|
||||
/// </summary>
|
||||
public string? ebom_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批号
|
||||
/// </summary>
|
||||
public string? batch { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ public partial class PrdOutPackMarkLabel : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 是否喷码 0 否 1 是
|
||||
/// </summary>
|
||||
public int is_mark { get; set; }
|
||||
public int? is_mark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否贴标 0 否 1 是
|
||||
/// </summary>
|
||||
public int is_label { get; set; }
|
||||
public int? is_label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务单号
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -498,11 +498,12 @@ namespace Tnb.ProductionMgr
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> OutPackMarkCheck(MarkingLabelInput input)
|
||||
{
|
||||
string[] arr = input.mark_code.Split("/");
|
||||
string[] arr = input.mark_code.Split("(10)");
|
||||
if (arr.Length > 1)
|
||||
{
|
||||
string mo_task_code = arr[0];
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.mo_task_code == mo_task_code).FirstAsync();
|
||||
string batch = arr[1];
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.batch == batch).FirstAsync();
|
||||
string mo_task_code = prdMoTask.mo_task_code;
|
||||
if (prdMoTask == null) throw Oops.Bah("未找到对应任务单");
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().Where(x => x.id == prdMoTask.material_id).FirstAsync();
|
||||
DictionaryDataEntity unit = await _db.Queryable<DictionaryTypeEntity>()
|
||||
@@ -567,11 +568,12 @@ namespace Tnb.ProductionMgr
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> OutPackLabelCheck(MarkingLabelInput input)
|
||||
{
|
||||
string[] arr = input.mark_code.Split("/");
|
||||
string[] arr = input.label_code.Split("(10)");
|
||||
if (arr.Length > 1)
|
||||
{
|
||||
string mo_task_code = arr[0];
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.mo_task_code == mo_task_code).FirstAsync();
|
||||
string batch = arr[1];
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.batch == batch).FirstAsync();
|
||||
string mo_task_code = prdMoTask.mo_task_code;
|
||||
if (prdMoTask == null) throw Oops.Bah("未找到对应任务单");
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().Where(x => x.id == prdMoTask.material_id).FirstAsync();
|
||||
DictionaryDataEntity unit = await _db.Queryable<DictionaryTypeEntity>()
|
||||
|
||||
Reference in New Issue
Block a user