零部件最终检验

This commit is contained in:
2024-08-12 11:50:34 +08:00
parent 3c47cd5450
commit 4a88b242bb
6 changed files with 62 additions and 53 deletions

View File

@@ -51,7 +51,7 @@ namespace Tnb.ProductionMgr.Interfaces
/// <returns></returns> /// <returns></returns>
Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input); Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input);
Task<dynamic> PrdReport(PrdReportCrInput input); Task<string> PrdReport(PrdReportCrInput input);
} }
} }

View File

@@ -1621,7 +1621,7 @@ namespace Tnb.ProductionMgr
/// <br/>} /// <br/>}
/// </remarks> /// </remarks>
[HttpPost] [HttpPost]
public async Task<dynamic> PrdReport(PrdReportCrInput input) public async Task<string> PrdReport(PrdReportCrInput input)
{ {
await prdreportSemaphore.WaitAsync(); await prdreportSemaphore.WaitAsync();
try try
@@ -1723,21 +1723,8 @@ namespace Tnb.ProductionMgr
report.material_box_code = input.material_box_code; report.material_box_code = input.material_box_code;
if (prdMoTask.schedule_type == 2) if (prdMoTask.schedule_type == 2)
{ {
// if (dic.TryGetValue(prdMoTask.workline_id, out string value)) report.material_box_code = input.material_box_code;
// {
// materialBoxCode = await _redisData.GetHash("value", "WBZX_x1_take_tp");
// if (materialBoxCode == null || materialBoxCode.IsEmpty())
// {
// throw Oops.Bah("托盘条码信息未空");
// }
report.material_box_code = input.material_box_code;
// }
// else
// {
// throw Oops.Bah("未找到对应产线");
// }
// report.warehouse_id = WmsWareHouseConst.WAREHOUSE_JXK_ID;
report.warehouse_id = WmsWareHouseConst.WAREHOUSE_DMJC_ID; report.warehouse_id = WmsWareHouseConst.WAREHOUSE_DMJC_ID;
Dictionary<string, string> worklineWarehouseDic = new Dictionary<string, string>() Dictionary<string, string> worklineWarehouseDic = new Dictionary<string, string>()
{ {
@@ -1804,22 +1791,52 @@ namespace Tnb.ProductionMgr
report.unit_id = prdMoTask.unit_id; report.unit_id = prdMoTask.unit_id;
report.process_id = mbomProcess?.process_id ?? ""; report.process_id = mbomProcess?.process_id ?? "";
row = await db.Insertable(report).ExecuteCommandAsync();
WmsCarryH wmsCarryH = await db.Queryable<WmsCarryH>().SingleAsync((x => x.carry_code == materialBoxCode));
if (wmsCarryH == null)
throw Oops.Bah($"未找到{materialBoxCode}载具");
if (wmsCarryH.carry_status == ((int)EnumCarryStatus.).ToString())
{
throw Oops.Bah($"提报失败,载具已绑定");
}
List<WmsCarryCode> wmsCarryCodes = await db.Queryable<WmsCarryCode>().Where(x=>x.carry_id==wmsCarryH.id).ToListAsync();
if (wmsCarryCodes != null && wmsCarryCodes.Count > 0)
{
Log.Error($"载具{materialBoxCode}状态为{wmsCarryH.carry_status},但有条码{JsonConvert.SerializeObject(wmsCarryCodes)}");
throw Oops.Bah($"提报失败,载具异常");
}
#region #region
//质检模块 //质检模块
// TriggerPlanEntity entity = new()
// { if (wmsCarryH.is_check == 0)
// materialid = prdMoTask.material_id, {
// processid = prdMoTask.process_id, TriggerPlanEntity entity = new()
// workid = prdMoTask.workstation_id {
// }; materialid = prdMoTask.material_id,
// int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty; processid = prdMoTask.process_id,
// int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty; workid = prdMoTask.workstation_id
// entity.oldpronum = reported + scrap; };
// entity.newpronum = input.reported_qty; int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
// entity.triggerevent = EnumTriggerEvent.生产检定量; int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
// await _qcCheckPlanService.CreateTask(entity); entity.oldpronum = reported + scrap;
entity.newpronum = input.reported_qty;
// entity.triggerevent = EnumTriggerEvent.生产检定量;
entity.triggerevent = EnumTriggerEvent.;
await _qcCheckPlanService.CreateTask(entity);
await _db.Ado.CommitTranAsync();
return "生成质检任务";
}else if (wmsCarryH.is_check==1)
{
return "检验中,请稍后提报";
}
else
{
row = await db.Insertable(report).ExecuteCommandAsync();
}
#endregion #endregion
_ = prdMoTask.reported_work_qty == null _ = prdMoTask.reported_work_qty == null
? await db.Updateable<PrdMoTask>() ? await db.Updateable<PrdMoTask>()
@@ -2012,24 +2029,6 @@ namespace Tnb.ProductionMgr
// Dictionary<string, object> header = new()
// {
// ["Authorization"] = App.HttpContext != null ? App.HttpContext.Request.Headers["Authorization"] : ""
// };
// BasFactoryConfig config = await _repository.AsSugarClient().Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
WmsCarryH wmsCarryH = await db.Queryable<WmsCarryH>().SingleAsync((x => x.carry_code == materialBoxCode));
if (wmsCarryH == null)
throw Oops.Bah($"未找到{materialBoxCode}载具");
if (wmsCarryH.carry_status == ((int)EnumCarryStatus.).ToString())
{
throw Oops.Bah($"提报失败,载具已绑定");
}
List<WmsCarryCode> wmsCarryCodes = await db.Queryable<WmsCarryCode>().Where(x=>x.carry_id==wmsCarryH.id).ToListAsync();
if (wmsCarryCodes != null && wmsCarryCodes.Count > 0)
{
Log.Error($"载具{materialBoxCode}状态为{wmsCarryH.carry_status},但有条码{JsonConvert.SerializeObject(wmsCarryCodes)}");
throw Oops.Bah($"提报失败,载具异常");
}
BindCarryCodeInput bindCarryCodeInput = new BindCarryCodeInput(); BindCarryCodeInput bindCarryCodeInput = new BindCarryCodeInput();
bindCarryCodeInput.carry_id = wmsCarryH.id; bindCarryCodeInput.carry_id = wmsCarryH.id;
@@ -2299,7 +2298,7 @@ namespace Tnb.ProductionMgr
// //
// } // }
return true; return "提报成功";
} }
/// <summary> /// <summary>

View File

@@ -675,8 +675,8 @@ namespace Tnb.ProductionMgr
input.reported_qty = num; input.reported_qty = num;
input.station = ""; input.station = "";
input.material_box_code = carryCode; input.material_box_code = carryCode;
await _prdMoTaskService.PrdReport(input);
return "true"; return await _prdMoTaskService.PrdReport(input);
} }
[HttpGet] [HttpGet]
@@ -704,7 +704,7 @@ namespace Tnb.ProductionMgr
input.station = ""; input.station = "";
input.material_box_code = carryCode; input.material_box_code = carryCode;
await _prdMoTaskService.PrdReport(input); await _prdMoTaskService.PrdReport(input);
return "true"; return await _prdMoTaskService.PrdReport(input);
} }
[HttpGet] [HttpGet]

View File

@@ -35,7 +35,9 @@ namespace Tnb.QcMgr.Entities.Enums
[Remark("生产检", "固定次数")] [Remark("生产检", "固定次数")]
= 12, = 12,
[Remark("生产检", "按流转卡")] [Remark("生产检", "按流转卡")]
= 13 = 13,
[Remark("零部件最终检验", "零部件最终检验事件")]
= 14
} }
public class RemarkAttribute : Attribute public class RemarkAttribute : Attribute
{ {

View File

@@ -512,6 +512,14 @@ namespace Tnb.QcMgr
removePlanHs.Add(plan); removePlanHs.Add(plan);
} }
} }
if (enumTriggerEvent == EnumTriggerEvent.)
{
int? number = _repository.AsSugarClient().Queryable<QcCheckPlanAdd>().Where(p => p.mainid == plan.id).First().number;
if ((entity.newpronum + (entity.oldpronum / number)) <= (entity.oldpronum / number))
{
removePlanHs.Add(plan);
}
}
if (enumTriggerEvent == EnumTriggerEvent.) if (enumTriggerEvent == EnumTriggerEvent.)
{ {

View File

@@ -72,7 +72,7 @@ public partial class WmsCarryH : BaseEntity<string>
public string out_status { get; set; } public string out_status { get; set; }
/// <summary> /// <summary>
/// 是否检验 /// 检验状态 0 未检验 1 检验中 2 合格 3 不合格
/// </summary> /// </summary>
public int is_check { get; set; } public int is_check { get; set; }