零部件最终检验
This commit is contained in:
@@ -51,7 +51,7 @@ namespace Tnb.ProductionMgr.Interfaces
|
||||
/// <returns></returns>
|
||||
Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input);
|
||||
|
||||
Task<dynamic> PrdReport(PrdReportCrInput input);
|
||||
Task<string> PrdReport(PrdReportCrInput input);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1621,7 +1621,7 @@ namespace Tnb.ProductionMgr
|
||||
/// <br/>}
|
||||
/// </remarks>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PrdReport(PrdReportCrInput input)
|
||||
public async Task<string> PrdReport(PrdReportCrInput input)
|
||||
{
|
||||
await prdreportSemaphore.WaitAsync();
|
||||
try
|
||||
@@ -1723,21 +1723,8 @@ namespace Tnb.ProductionMgr
|
||||
report.material_box_code = input.material_box_code;
|
||||
if (prdMoTask.schedule_type == 2)
|
||||
{
|
||||
// if (dic.TryGetValue(prdMoTask.workline_id, out string value))
|
||||
// {
|
||||
// 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.material_box_code = input.material_box_code;
|
||||
|
||||
// report.warehouse_id = WmsWareHouseConst.WAREHOUSE_JXK_ID;
|
||||
report.warehouse_id = WmsWareHouseConst.WAREHOUSE_DMJC_ID;
|
||||
Dictionary<string, string> worklineWarehouseDic = new Dictionary<string, string>()
|
||||
{
|
||||
@@ -1804,22 +1791,52 @@ namespace Tnb.ProductionMgr
|
||||
report.unit_id = prdMoTask.unit_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 质检模块
|
||||
//质检模块
|
||||
// TriggerPlanEntity entity = new()
|
||||
// {
|
||||
// materialid = prdMoTask.material_id,
|
||||
// processid = prdMoTask.process_id,
|
||||
// workid = prdMoTask.workstation_id
|
||||
// };
|
||||
// int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
|
||||
// int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
|
||||
// entity.oldpronum = reported + scrap;
|
||||
// entity.newpronum = input.reported_qty;
|
||||
// entity.triggerevent = EnumTriggerEvent.生产检定量;
|
||||
// await _qcCheckPlanService.CreateTask(entity);
|
||||
|
||||
if (wmsCarryH.is_check == 0)
|
||||
{
|
||||
TriggerPlanEntity entity = new()
|
||||
{
|
||||
materialid = prdMoTask.material_id,
|
||||
processid = prdMoTask.process_id,
|
||||
workid = prdMoTask.workstation_id
|
||||
};
|
||||
int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
|
||||
int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
|
||||
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
|
||||
_ = prdMoTask.reported_work_qty == null
|
||||
? 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.carry_id = wmsCarryH.id;
|
||||
@@ -2299,7 +2298,7 @@ namespace Tnb.ProductionMgr
|
||||
//
|
||||
// }
|
||||
|
||||
return true;
|
||||
return "提报成功";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -675,8 +675,8 @@ namespace Tnb.ProductionMgr
|
||||
input.reported_qty = num;
|
||||
input.station = "";
|
||||
input.material_box_code = carryCode;
|
||||
await _prdMoTaskService.PrdReport(input);
|
||||
return "true";
|
||||
|
||||
return await _prdMoTaskService.PrdReport(input);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -704,7 +704,7 @@ namespace Tnb.ProductionMgr
|
||||
input.station = "";
|
||||
input.material_box_code = carryCode;
|
||||
await _prdMoTaskService.PrdReport(input);
|
||||
return "true";
|
||||
return await _prdMoTaskService.PrdReport(input);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
||||
@@ -35,7 +35,9 @@ namespace Tnb.QcMgr.Entities.Enums
|
||||
[Remark("生产检", "固定次数")]
|
||||
生产检固定次数 = 12,
|
||||
[Remark("生产检", "按流转卡")]
|
||||
生产检按流转卡 = 13
|
||||
生产检按流转卡 = 13,
|
||||
[Remark("零部件最终检验", "零部件最终检验事件")]
|
||||
零部件最终检验事件 = 14
|
||||
}
|
||||
public class RemarkAttribute : Attribute
|
||||
{
|
||||
|
||||
@@ -512,6 +512,14 @@ namespace Tnb.QcMgr
|
||||
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.生产检定码)
|
||||
{
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public partial class WmsCarryH : BaseEntity<string>
|
||||
public string out_status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否检验
|
||||
/// 检验状态 0 未检验 1 检验中 2 合格 3 不合格
|
||||
/// </summary>
|
||||
public int is_check { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user