优化调整
This commit is contained in:
@@ -2784,6 +2784,35 @@ namespace Tnb.ProductionMgr
|
||||
return prdMoTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据chanxian 获取进行中的任务单信息
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PrdMoTask> GetPrdMoTaskInfoByWorklineId(Dictionary<string, string> dic)
|
||||
{
|
||||
string workline_id = dic.ContainsKey("workline_id") ? dic["workline_id"] : "";
|
||||
if (string.IsNullOrEmpty(workline_id))
|
||||
{
|
||||
throw Oops.Bah("产线错误");
|
||||
}
|
||||
|
||||
PrdMoTask? prdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.workline_id == workline_id && x.parent_id == null && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync();
|
||||
PrdMoTask? childPrdMoTask = null;
|
||||
if (prdMoTask != null)
|
||||
{
|
||||
childPrdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.parent_id == prdMoTask.id && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync();
|
||||
if (childPrdMoTask != null)
|
||||
{
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdMoTask.material_id);
|
||||
childPrdMoTask.material_name = basMaterial.name;
|
||||
}
|
||||
}
|
||||
|
||||
return childPrdMoTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工位获取进行中待开工暂停的任务单信息
|
||||
/// </summary>
|
||||
@@ -2910,12 +2939,59 @@ namespace Tnb.ProductionMgr
|
||||
public async Task<dynamic> GetLabelInfo(MarkingLabelInput input)
|
||||
{
|
||||
Log.Information($"获取喷码贴标信息参数:{JsonConvert.SerializeObject(input)}");
|
||||
Dictionary<String, String> dic = new Dictionary<string, string>()
|
||||
{
|
||||
["WBZX1"] = "30019971917589",//血路管自动生产线1线
|
||||
["WBZX2"] = "123",
|
||||
["WBZX3"] = "123",
|
||||
};
|
||||
if (dic.TryGetValue(input.result, out string worklineId))
|
||||
{
|
||||
if (worklineId != null && !worklineId.IsEmpty())
|
||||
{
|
||||
PrdMoTask prdMoTask = await GetPrdMoTaskInfoByWorklineId(new Dictionary<string, string>()
|
||||
{
|
||||
{ "workline_id", worklineId }
|
||||
});
|
||||
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
|
||||
|
||||
return "(01)16945155732691(11)240510(17)270510(10)24053026#TX-JB-12*24053026*202405*1020270510RJ-A1F3NC2";
|
||||
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())
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
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 ?? ""}(11){DateTime.Now.ToString("yyMMdd")}(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}(10){parent.batch??""}#{basMaterial.material_standard}*{DateTime.Now.ToString("yyyyMMdd")}*{DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.container_no}";
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
// return "(01)16945155732691(11)240510(17)270510(10)24053026#TX-JB-12*24053026*202405*1020270510RJ-A1F3NC2";
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 觉设备判定
|
||||
/// 视觉设备判定
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
|
||||
Reference in New Issue
Block a user