挤出批号修改 erp接口另起线程调用
This commit is contained in:
@@ -2092,22 +2092,12 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
}else if (mo.mo_type == DictConst.PrdMoTypeJC)
|
||||
{
|
||||
if (changeBatchFlag)
|
||||
{
|
||||
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)}{prdMoTask.act_start_date.Value.ToString("yyMMdd")}";
|
||||
await db.Updateable<PrdMoTask>()
|
||||
.SetColumns(x => x.batch == batch)
|
||||
.SetColumns(x=>x.change_batch_count_by_day==changeCountNumByDay)
|
||||
.SetColumns(x=>x.change_batch_count_by_qty==changeCountNumByQty)
|
||||
.Where(x => x.id == prdMoTask.id)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
batch = prdMoTask.batch;
|
||||
}
|
||||
ToolMolds toolMolds = await _db.Queryable<ToolMolds>().SingleAsync(x => x.id == prdMoTask.mold_id);
|
||||
batch = $"6{toolMolds.mold_code.Substring(toolMolds.mold_code.Length - 4, 2)}{DateTime.Now.ToString("yyMMdd")}";
|
||||
await db.Updateable<PrdMoTask>()
|
||||
.SetColumns(x => x.batch == batch)
|
||||
.Where(x => x.id == prdMoTask.id)
|
||||
.ExecuteCommandAsync();
|
||||
}else
|
||||
{
|
||||
// OrganizeEntity organizeEntity = await _db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == prdMoTask.workline_id);
|
||||
@@ -2496,6 +2486,12 @@ namespace Tnb.ProductionMgr
|
||||
throw Oops.Bah(result1.msg);
|
||||
}
|
||||
|
||||
await _db.Updateable<PrdReport>()
|
||||
.SetColumns(x => x.pqty == input.pqty)
|
||||
.SetColumns(x => x.rqty == input.rqty)
|
||||
.Where(x => x.id == report.id)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
WmsPrdInstockInput wmsPrdInstockInput = new WmsPrdInstockInput();
|
||||
wmsPrdInstockInput.prd_bill_code = prdMo.mo_code;
|
||||
wmsPrdInstockInput.material_id = prdMoTask.material_id;
|
||||
@@ -2627,8 +2623,8 @@ namespace Tnb.ProductionMgr
|
||||
// ["cbastunitid"] = erpExtendFields.Find(x=>x.table_id==report.unit_id)?.cunitid ?? "",
|
||||
["cbunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == report.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||
["cbastunitid"] = erpExtendFields.Find(x =>x.table_id == (unitDatas.Find(x => x.EnCode == report.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||
["nbplanwrnum"] = report.reported_qty,
|
||||
["nbwrnum"] = report.reported_qty,
|
||||
["nbplanwrnum"] = input.pqty,
|
||||
["nbwrnum"] = input.pqty,
|
||||
["tbendtime"] = nowStr,
|
||||
["tbstarttime"] = prdMoTask.act_start_date != null ? prdMoTask.act_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
|
||||
["vbinbatchcode"] = report.batch,
|
||||
@@ -2751,6 +2747,29 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> DelPrdReport(string id)
|
||||
{
|
||||
PrdReport prdReport = await _db.Queryable<PrdReport>().SingleAsync(x => x.id == id);
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdReport.mo_task_id);
|
||||
DbResult<bool> result = await _db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _db.Updateable<PrdMoTask>()
|
||||
.SetColumns(x => x.reported_work_qty == x.reported_work_qty - prdReport.reported_qty)
|
||||
.Where(x => x.id == prdMoTask.id)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
await _db.Updateable<PrdMo>()
|
||||
.SetColumns(x => x.reported_work_qty == x.reported_work_qty - prdReport.reported_qty)
|
||||
.Where(x => x.id == prdMoTask.mo_id)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
await _db.Deleteable<PrdReport>().Where(x => x.id == id).ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "保存成功" : result.ErrorMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自检报废提交
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user