质量
This commit is contained in:
@@ -14,6 +14,11 @@
|
||||
public string? tasktime { get; set; }
|
||||
public string? exectime { get; set; }
|
||||
public string? execuser { get; set; }
|
||||
|
||||
public string mo_task_code { get; set; }
|
||||
public string batch { get; set; }
|
||||
public int? qty { get; set; }
|
||||
public string bill_code { get; set; }
|
||||
|
||||
}
|
||||
public class CheckTaskOut
|
||||
@@ -23,6 +28,15 @@
|
||||
public string? workname { get; set; }
|
||||
public string? wareid { get; set; }
|
||||
public string? status { get; set; }
|
||||
public string mo_task_code { get; set; }
|
||||
public string material_id { get; set; }
|
||||
public string material_code { get; set; }
|
||||
public string material_name { get; set; }
|
||||
public int checknum { get; set; }
|
||||
|
||||
public string worker_name { get; set; }
|
||||
public string bill_code { get; set; }
|
||||
public string carry_code { get; set; }
|
||||
public List<CheckExecTypeOut>? checktypes { get; set; }
|
||||
}
|
||||
public class CheckExecTypeOut
|
||||
|
||||
@@ -44,6 +44,17 @@ namespace Tnb.QcMgr.Entities
|
||||
/// 生产次数
|
||||
/// </summary>
|
||||
public int? pronum { get; set; }
|
||||
|
||||
public string mo_task_code { get; set; }
|
||||
|
||||
public string carry_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提报记录id
|
||||
/// </summary>
|
||||
public string report_id { get; set; }
|
||||
public string check_type { get; set; }
|
||||
public string batch { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -106,7 +106,10 @@ namespace Tnb.QcMgr.Entities
|
||||
/// </summary>
|
||||
public string? checkindex { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 不合格数量
|
||||
/// </summary>
|
||||
public int qty { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,11 @@ namespace Tnb.QcMgr.Entities
|
||||
/// 抽样数
|
||||
/// </summary>
|
||||
public string? checknum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 合格数
|
||||
/// </summary>
|
||||
public int? qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
@@ -93,5 +98,36 @@ namespace Tnb.QcMgr.Entities
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单据编号
|
||||
/// </summary>
|
||||
public string bill_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生产任务单编号
|
||||
/// </summary>
|
||||
public string mo_task_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具编号
|
||||
/// </summary>
|
||||
public string carry_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提报记录id
|
||||
/// </summary>
|
||||
public string report_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 抽样方式
|
||||
/// </summary>
|
||||
public string check_type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string remark { get; set; }
|
||||
public string batch { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,12 @@ namespace Tnb.QcMgr.Entities.Enums
|
||||
生产检固定次数 = 12,
|
||||
[Remark("生产检", "按流转卡")]
|
||||
生产检按流转卡 = 13,
|
||||
[Remark("零部件最终检验", "零部件最终检验事件")]
|
||||
零部件最终检验事件 = 14
|
||||
[Remark("零部件最终检验", "零部件最终检验")]
|
||||
零部件最终检验 = 14,
|
||||
[Remark("首检", "开工检")]
|
||||
开工首件检 = 15,
|
||||
[Remark("末检", "末检触发事件")]
|
||||
末检质检方案 = 16
|
||||
}
|
||||
public class RemarkAttribute : Attribute
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.JsonSerialization;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.TaskScheduler;
|
||||
using JNPF.TaskScheduler.Entitys.Dto.TaskScheduler;
|
||||
using JNPF.TaskScheduler.Entitys.Model;
|
||||
@@ -16,6 +17,8 @@ using Tnb.QcMgr.Entities;
|
||||
using Tnb.QcMgr.Entities.Entity;
|
||||
using Tnb.QcMgr.Entities.Enums;
|
||||
using Tnb.QcMgr.Interfaces;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.BasicData;
|
||||
|
||||
namespace Tnb.QcMgr
|
||||
{
|
||||
@@ -31,11 +34,24 @@ namespace Tnb.QcMgr
|
||||
private readonly ISqlSugarRepository<QcCheckPlanH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly TimeTaskService _timeTaskService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public QcCheckPlanService(ISqlSugarRepository<QcCheckPlanH> repository, IUserManager userManager, TimeTaskService timeTaskService)
|
||||
|
||||
private static Dictionary<string, string> _dicBillCodes = new Dictionary<string, string>()
|
||||
{
|
||||
[WmsWareHouseConst.SHOUJIAN_ID] = CodeTemplateConst.SHOUJIAN_CODE,
|
||||
[WmsWareHouseConst.XUNJIAN_ID] = CodeTemplateConst.XUNJIAN_CODE,
|
||||
[WmsWareHouseConst.MOJIAN_ID] = CodeTemplateConst.MOJIAN_CODE,
|
||||
[WmsWareHouseConst.LINGBUJIANZUIZHONGJIANYAN_ID] = CodeTemplateConst.LINGBUJIANZUIZHONGJIANYAN_CODE,
|
||||
[WmsWareHouseConst.CHENGPINJIANYAN_ID] = CodeTemplateConst.CHENGPINJIANYAN_CODE,
|
||||
};
|
||||
public QcCheckPlanService(ISqlSugarRepository<QcCheckPlanH> repository,
|
||||
IBillRullService billRullService,
|
||||
IUserManager userManager, TimeTaskService timeTaskService)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
_timeTaskService = timeTaskService;
|
||||
OverideFuncs.DeleteAsync = Delete;
|
||||
}
|
||||
@@ -512,13 +528,17 @@ namespace Tnb.QcMgr
|
||||
removePlanHs.Add(plan);
|
||||
}
|
||||
}
|
||||
if (enumTriggerEvent == EnumTriggerEvent.零部件最终检验事件)
|
||||
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.生产检定码)
|
||||
{
|
||||
@@ -552,9 +572,11 @@ namespace Tnb.QcMgr
|
||||
foreach (QcCheckPlanH planh in planhs)
|
||||
{
|
||||
DateTime time = DateTime.Now;
|
||||
string billCode = await _billRullService.GetBillNumber(_dicBillCodes[planh.checktype]);
|
||||
QcCheckExecH qcCheckExecH = new()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
bill_code = billCode,
|
||||
checktype = planh.checktype,
|
||||
status = DictionaryData.Id,
|
||||
tasktime = time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
@@ -562,8 +584,17 @@ namespace Tnb.QcMgr
|
||||
processid = entity.processid,
|
||||
workid = entity.workid,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = time
|
||||
create_time = time,
|
||||
mo_task_code = entity.mo_task_code,
|
||||
carry_code = entity.carry_code,
|
||||
report_id = entity.report_id,
|
||||
check_type = entity.check_type,
|
||||
batch = entity.batch
|
||||
};
|
||||
if (entity.triggerevent == EnumTriggerEvent.零部件最终检验)
|
||||
{
|
||||
qcCheckExecH.checknum = entity.newpronum.ToString();
|
||||
}
|
||||
List<QcCheckExecD> ExecDs = new();
|
||||
foreach (QcCheckPlanD? pland in plands.Where(p => p.mainid == planh.id).ToList())
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Tnb.QcMgr
|
||||
{
|
||||
{ "ok", "合格" },
|
||||
{ "no", "不合格" },
|
||||
{ "barelyok", "让步合格" },
|
||||
{ "barelyok", "让步接收" },
|
||||
{ "await", "待检" },
|
||||
{ "temporarily", "暂控" }
|
||||
};
|
||||
@@ -93,7 +93,7 @@ namespace Tnb.QcMgr
|
||||
{
|
||||
{ "ok", "合格" },
|
||||
{ "no", "不合格" },
|
||||
{ "barelyOk", "让步合格" },
|
||||
{ "barelyOk", "让步接收" },
|
||||
{ "await", "待检" },
|
||||
{ "temporarily", "暂控" }
|
||||
};
|
||||
@@ -120,6 +120,7 @@ namespace Tnb.QcMgr
|
||||
.Select((a, b, c, d, e) => new QcCheckExecHOut
|
||||
{
|
||||
id = a.id,
|
||||
bill_code = a.bill_code,
|
||||
materialid = b.name,
|
||||
checktype = a.checktype,
|
||||
workid = d.FullName,
|
||||
|
||||
@@ -5,6 +5,7 @@ using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.JsonSerialization;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.VisualDev;
|
||||
@@ -13,10 +14,17 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using Tnb.QcMgr.Entities;
|
||||
using Tnb.QcMgr.Interfaces;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
|
||||
namespace Tnb.QcMgr
|
||||
{
|
||||
@@ -33,13 +41,19 @@ namespace Tnb.QcMgr
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IWmsSaleService _wmsSaleService;
|
||||
private readonly IWmsPurchaseService _wmsPurchaseService;
|
||||
private readonly IPrdMoTaskService _prdMoTaskService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public QcCheckTaskService(ISqlSugarRepository<QcCheckExecH> repository, IUserManager userManager, IWmsSaleService wmsSaleService, IWmsPurchaseService wmsPurchaseService)
|
||||
public QcCheckTaskService(ISqlSugarRepository<QcCheckExecH> repository,
|
||||
IUserManager userManager,
|
||||
IWmsSaleService wmsSaleService,
|
||||
IPrdMoTaskService prdMoTaskService,
|
||||
IWmsPurchaseService wmsPurchaseService)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
OverideFuncs.GetListAsync = GetListAsync;
|
||||
_wmsSaleService= wmsSaleService;
|
||||
_prdMoTaskService = prdMoTaskService;
|
||||
_wmsPurchaseService= wmsPurchaseService;
|
||||
}
|
||||
|
||||
@@ -50,7 +64,7 @@ namespace Tnb.QcMgr
|
||||
{
|
||||
{ "ok", "合格" },
|
||||
{ "no", "不合格" },
|
||||
{ "barelyOk", "让步合格" },
|
||||
{ "barelyOk", "让步接收" },
|
||||
{ "await", "待检" },
|
||||
{ "temporarily", "暂控" }
|
||||
};
|
||||
@@ -67,11 +81,12 @@ namespace Tnb.QcMgr
|
||||
.LeftJoin<BasProcess>((a, b, c) => a.processid == c.id)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c, d) => a.workid == d.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d, e) => a.execuser == e.Id)
|
||||
.LeftJoin<PrdReport>((a,b,c,d,e,f)=>a.report_id==f.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d,e) => b.name.Contains(materialid))
|
||||
.WhereIF(!string.IsNullOrEmpty(checktype), (a, b, c, d, e) => a.checktype == checktype)
|
||||
.WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status)
|
||||
.Where((a, b, c, d, e) => a.status == list.Where(p => p.FullName == "待执行").First().Id)
|
||||
.Select((a, b, c, d, e) => new QcCheckExecHOut
|
||||
.Select((a, b, c, d, e,f) => new QcCheckExecHOut
|
||||
{
|
||||
id = a.id,
|
||||
materialid = b.name,
|
||||
@@ -85,6 +100,9 @@ namespace Tnb.QcMgr
|
||||
tasktime = a.tasktime ?? "",
|
||||
exectime = a.exectime ?? "",
|
||||
execuser = e.RealName ?? "",
|
||||
mo_task_code = a.mo_task_code,
|
||||
batch = a.batch,
|
||||
qty = a.qty
|
||||
}).OrderByDescending(a => DateTime.Parse(a.tasktime)).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
foreach (QcCheckExecHOut? item in result.list)
|
||||
{
|
||||
@@ -111,12 +129,33 @@ namespace Tnb.QcMgr
|
||||
List<QcErrorCause> QcErrorCauses = await db.Queryable<QcErrorCause>().ToListAsync();
|
||||
List<QcErrorLevel> QcErrorLevels = await db.Queryable<QcErrorLevel>().ToListAsync();
|
||||
|
||||
PrdMoTask moTask = await db.Queryable<PrdMoTask>().Where(x => x.mo_task_code == QcCheckExecH.mo_task_code).FirstAsync();
|
||||
if (moTask == null)
|
||||
{
|
||||
throw Oops.Bah($"未找到任务单{QcCheckExecH.mo_task_code}");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(QcCheckExecH.report_id))
|
||||
{
|
||||
throw Oops.Bah($"未找到提报记录{QcCheckExecH.report_id}");
|
||||
}
|
||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().Where(x=>x.id==moTask.material_id).FirstAsync();
|
||||
PrdReport prdReport = await db.Queryable<PrdReport>().SingleAsync(x => x.id == QcCheckExecH.report_id);
|
||||
UserEntity userEntity = await db.Queryable<UserEntity>().SingleAsync(x => x.Id == prdReport.create_id);
|
||||
CheckTaskOut CheckTaskOut = new()
|
||||
{
|
||||
mainid = id,
|
||||
wareid = QcCheckExecH.wareid!,
|
||||
workid = QcCheckExecH.workid!,
|
||||
status = QcCheckExecH.status!
|
||||
status = QcCheckExecH.status!,
|
||||
mo_task_code = QcCheckExecH.mo_task_code,
|
||||
material_id = moTask.material_id,
|
||||
material_code = basMaterial.code,
|
||||
material_name = basMaterial.name,
|
||||
checknum = !string.IsNullOrEmpty(QcCheckExecH.checknum) ? int.Parse(QcCheckExecH.checknum) : 0,
|
||||
worker_name = userEntity?.RealName ?? "",
|
||||
bill_code = QcCheckExecH.bill_code,
|
||||
carry_code = prdReport.material_box_code,
|
||||
};
|
||||
if (!string.IsNullOrEmpty(CheckTaskOut.workid))
|
||||
{
|
||||
@@ -204,13 +243,14 @@ namespace Tnb.QcMgr
|
||||
try
|
||||
{
|
||||
Dictionary<string, int> dic = new()
|
||||
{
|
||||
{ "ok", 1 },
|
||||
{ "no", 2 },
|
||||
{ "barelyOk", 4 },
|
||||
{ "await", 8 },
|
||||
{ "temporarily", 16 }
|
||||
};
|
||||
{
|
||||
{ "ok", 1 },
|
||||
{ "no", 2 },
|
||||
{ "barelyOk", 4 },
|
||||
{ "await", 8 },
|
||||
{ "temporarily", 16 },
|
||||
{ "checking", 32 },
|
||||
};
|
||||
QcCheckExecH QcCheckExecH = await db.Queryable<QcCheckExecH>().Where(p => p.id == CheckTaskInput.mainid).FirstAsync();
|
||||
DictionaryTypeEntity DictionaryType = await db.Queryable<DictionaryTypeEntity>().Where(p => p.FullName == "质检状态").FirstAsync();
|
||||
DictionaryDataEntity DictionaryData = await db.Queryable<DictionaryDataEntity>().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "已完成").FirstAsync();
|
||||
@@ -219,7 +259,11 @@ namespace Tnb.QcMgr
|
||||
QcCheckExecH.result = CheckTaskInput.result;
|
||||
QcCheckExecH.execuser = _userManager.UserId;
|
||||
QcCheckExecH.exectime = DateTime.Now.ToString();
|
||||
QcCheckExecH.check_type = CheckTaskInput.check_type;
|
||||
QcCheckExecH.remark = CheckTaskInput.remark;
|
||||
List<QcCheckExecD> QcCheckExecDs = await db.Queryable<QcCheckExecD>().Where(p => p.mainid == CheckTaskInput.mainid).ToListAsync();
|
||||
|
||||
int rqty = 0;
|
||||
List<QcCheckExecD> QcCheckExecDdel = new();
|
||||
List<QcCheckExecD> QcCheckExecDinsert = new();
|
||||
if (CheckTaskInput.checktypes?.Count > 0)
|
||||
@@ -268,9 +312,12 @@ namespace Tnb.QcMgr
|
||||
create_time = QcCheckExecD.create_time,
|
||||
postdata = item.postItemForm,
|
||||
result = item.result,
|
||||
checkindex = (i + 1).ToString()
|
||||
checkindex = (i + 1).ToString(),
|
||||
qty = item.qty
|
||||
};
|
||||
QcCheckExecDinsert.Add(insert);
|
||||
|
||||
rqty += item.qty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -278,6 +325,7 @@ namespace Tnb.QcMgr
|
||||
}
|
||||
}
|
||||
await db.Ado.BeginTranAsync();
|
||||
QcCheckExecH.qty = int.Parse(CheckTaskInput.checknum) - rqty;
|
||||
_ = await db.Updateable(QcCheckExecH).ExecuteCommandAsync();
|
||||
_ = await db.Deleteable(QcCheckExecDdel).ExecuteCommandAsync();
|
||||
_ = await db.Insertable(QcCheckExecDinsert).ExecuteCommandAsync();
|
||||
@@ -296,12 +344,39 @@ namespace Tnb.QcMgr
|
||||
mesCheckdCallbackUpinput.maintableid = QcCheckExecH.extras;
|
||||
mesCheckdCallbackUpinput.check_conclusion = dic.Where(p => p.Key == CheckTaskInput.result).Any() ? dic.Where(p => p.Key == CheckTaskInput.result).First().Value : 0;
|
||||
await _wmsPurchaseService.MesCheckdPurchaseCallback(mesCheckdCallbackUpinput);
|
||||
}else if (QcCheckExecH.checktype == WmsWareHouseConst.LINGBUJIANZUIZHONGJIANYAN_ID)
|
||||
{
|
||||
PrdReport prdReport = await db.Queryable<PrdReport>().SingleAsync(x=>x.id==QcCheckExecH.report_id);
|
||||
int pqty = prdReport.reported_qty.Value - rqty;
|
||||
if (rqty > Decimal.Parse(QcCheckExecH.checknum))
|
||||
{
|
||||
throw Oops.Bah("不合格数不能大于抽样数");
|
||||
}
|
||||
|
||||
if (CheckTaskInput.result != "await")
|
||||
{
|
||||
string isCheck = dic[CheckTaskInput.result].ToString();
|
||||
await db.Updateable<WmsCarryH>()
|
||||
.SetColumns(x => x.is_check == isCheck)
|
||||
.Where(x => x.carry_code == prdReport.material_box_code)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
_prdMoTaskService.ReportInstock(new CheckCompleteInput()
|
||||
{
|
||||
report_id = QcCheckExecH.report_id,
|
||||
pqty = pqty,
|
||||
rqty = rqty,
|
||||
check_result = ((EnumCheckConclusion)dic[CheckTaskInput.result]).ToString(),
|
||||
});
|
||||
}
|
||||
}
|
||||
await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception e)
|
||||
{
|
||||
throw Oops.Oh("执行失败");
|
||||
await db.Ado.RollbackTranAsync();
|
||||
Log.Error(e.Message,e);
|
||||
throw Oops.Oh("执行失败:"+e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ProductionMgr\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Interfaces\Tnb.WarehouseMgr.Interfaces.csproj" />
|
||||
|
||||
Reference in New Issue
Block a user