1.质检不合格,选择时间区间;2.生产入库记录增加工单类型及物料的查询条件;3.产成品入库同步BIP成功后,相关信息记录到生产入库记录

This commit is contained in:
2024-10-22 13:54:43 +08:00
parent 7c9a64e5eb
commit 48299687c2
7 changed files with 153 additions and 25 deletions

View File

@@ -18,6 +18,8 @@ using Tnb.WarehouseMgr.Entities;
using Tnb.BasicData.Entities.Dto; using Tnb.BasicData.Entities.Dto;
using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities;
using Tnb.BasicData.Interfaces; using Tnb.BasicData.Interfaces;
using Tnb.WarehouseMgr.Entities.Entity;
using JNPF.Common.Security;
namespace Tnb.BasicData namespace Tnb.BasicData
{ {
@@ -367,6 +369,85 @@ namespace Tnb.BasicData
Log.Error($"请求记录{record.id}更新失败"); Log.Error($"请求记录{record.id}更新失败");
} }
} }
//产成品入库的BIP调用完成之后自动新增生产入库记录
if(thirdResult.Code==200 && record.third_name=="BIP" && record.name == "产成品入库")
{
//根据生产提报记录的report_id与生产入库子表中的prd_report_id字段对应找到生产入库子表记录然后根据子表记录找到对应的主表记录
var requestDatas = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(record.request_data);
if (requestDatas == null || requestDatas.Count <= 0)
Log.Error($"产成品入库同步BIP后更新生产入库记录失败,请求数据为空:{record.request_data}");
foreach (var reqData in requestDatas)
{
var report_id = reqData["report_id"].ToString();
if (string.IsNullOrEmpty(report_id))
{
Log.Error($"请求记录id{record.id}生产提报记录id为空");
continue;
}
PrdReport prdReport = await db.Queryable<PrdReport>().SingleAsync(r => r.id == report_id);
#region
var wmsPrdInstockD = await db.Queryable<WmsPrdInstockD>().SingleAsync(r => r.prd_report_id == report_id);
if(wmsPrdInstockD==null)
{
Log.Error($"请求记录id{record.id}提报记录id{report_id}未找到对应的wms_prd_instock_d表中记录");
continue;
}
WmsPrdInstockH wmsPrdInstockH = await db.Queryable<WmsPrdInstockH>().SingleAsync(r => r.id == wmsPrdInstockD.prd_instock_id);
PrdMoTask prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdReport.mo_task_id);
if(prdMoTask==null)
{
Log.Error($"请求记录id{record.id}生产任务id{prdReport.mo_task_id}未找到对应的生产任务信息数据");
continue;
}
var prdInstockH = new PrdInstockH();
prdInstockH.id = SnowflakeIdHelper.NextId();
prdInstockH.bill_type = wmsPrdInstockH.type;
prdInstockH.warehouse_id = wmsPrdInstockD.warehouse_id;
prdInstockH.carry_code = wmsPrdInstockD.carry_id;
prdInstockH.location_code = wmsPrdInstockD.startlocation_id;
prdInstockH.create_id = prdReport?.create_id ?? wmsPrdInstockD.create_id;
prdInstockH.org_id = wmsPrdInstockH.org_id;
prdInstockH.station_id = prdMoTask?.workstation_id;
prdInstockH.workline_id = prdMoTask?.workline_id;
//prdInstockH.workshop_id=
//prdInstockH.is_check=
//prdInstockH.status =
prdInstockH.mo_task_id = prdReport?.mo_task_id;
prdInstockH.code = wmsPrdInstockH.bill_code;
await db.Insertable(prdInstockH).ExecuteCommandAsync();
#endregion
#region
List<WmsPrdInstockCode> allInstockDetails = await db.Queryable<WmsPrdInstockCode>().Where(it => it.prd_instockD_id == wmsPrdInstockD.id).OrderBy(x => x.id).ToListAsync();
if (allInstockDetails == null)
continue;
foreach(var _detail in allInstockDetails)
{
PrdInstockD prdInstockD = new PrdInstockD();
prdInstockD.id = SnowflakeIdHelper.NextId();
prdInstockD.instock_id = prdInstockH.id;
prdInstockD.material_id = wmsPrdInstockH.material_id;
prdInstockD.material_code= wmsPrdInstockH.material_code;
prdInstockD.unit_id = _detail.unit_id;
prdInstockD.quantity = _detail.pqty.HasValue ? Convert.ToInt32(_detail.pqty) : 0;
prdInstockD.code_batch= _detail.code_batch;
prdInstockD.barcode=prdReport.barcode;
prdInstockD.report_id = report_id;
prdInstockD.mo_task_code = prdMoTask?.mo_task_code;
await db.Insertable(prdInstockD).ExecuteCommandAsync();
}
#endregion
}
}
} }
if(tranFlag) await db.Ado.CommitTranAsync(); if(tranFlag) await db.Ado.CommitTranAsync();

View File

@@ -10,6 +10,10 @@ namespace Tnb.ProductionMgr.Entities.Dto
public string workstation_id { get; set; } public string workstation_id { get; set; }
public string workline_id { get; set; } public string workline_id { get; set; }
public string act_start_date { get; set; } public string act_start_date { get; set; }
/// <summary>
/// 创建时间(入库时间)
/// </summary>
public string create_time { get; set; }
public List<PrdInstockRecordUpListChildOutPut> tablefield102 { get; set; } = new List<PrdInstockRecordUpListChildOutPut>(); public List<PrdInstockRecordUpListChildOutPut> tablefield102 { get; set; } = new List<PrdInstockRecordUpListChildOutPut>();
} }
@@ -39,5 +43,10 @@ namespace Tnb.ProductionMgr.Entities.Dto
/// 条码编号 /// 条码编号
/// </summary> /// </summary>
public string barcode { get; set; } = string.Empty; public string barcode { get; set; } = string.Empty;
/// <summary>
/// 物料规格型号
/// </summary>
public string material_standard { get; set; }
} }
} }

View File

@@ -73,6 +73,7 @@ namespace Tnb.ProductionMgr
code_batch = a.code_batch, code_batch = a.code_batch,
barcode = a.barcode, barcode = a.barcode,
quantity = a.quantity.ToString(), quantity = a.quantity.ToString(),
material_standard=b.material_standard
}).ToPagedListAsync(input.currentPage, input.pageSize); }).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<PrdInstockRecordUpListDownOutPut>.SqlSugarPageResult(result); return PageResult<PrdInstockRecordUpListDownOutPut>.SqlSugarPageResult(result);
} }

View File

@@ -51,6 +51,9 @@ namespace Tnb.ProductionMgr
Dictionary<string, object>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>(); Dictionary<string, object>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
string mo_code = queryJson.ContainsKey("mo_id") ? queryJson["mo_id"].ToString() : ""; string mo_code = queryJson.ContainsKey("mo_id") ? queryJson["mo_id"].ToString() : "";
string mo_type = queryJson.ContainsKey("mo_type") ? queryJson["mo_type"].ToString() : "";//工单类型
string name = queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";//物料名称
// string workstation_id_str = queryJson.ContainsKey("workstation_id") ? queryJson["workstation_id"].ToString() : ""; // string workstation_id_str = queryJson.ContainsKey("workstation_id") ? queryJson["workstation_id"].ToString() : "";
// string workstation_id = ""; // string workstation_id = "";
// if (!string.IsNullOrEmpty(workstation_id_str)) // if (!string.IsNullOrEmpty(workstation_id_str))
@@ -81,6 +84,8 @@ namespace Tnb.ProductionMgr
.LeftJoin<OrganizeEntity>((a, b, c, d, e, f) => a.workline_id == f.Id) .LeftJoin<OrganizeEntity>((a, b, c, d, e, f) => a.workline_id == f.Id)
.WhereIF(!string.IsNullOrEmpty(mo_task_code), a => a.mo_task_code.Contains(mo_task_code)) .WhereIF(!string.IsNullOrEmpty(mo_task_code), a => a.mo_task_code.Contains(mo_task_code))
.WhereIF(!string.IsNullOrEmpty(mo_code), (a, b, c, d, e) => d.mo_code.Contains(mo_code)) .WhereIF(!string.IsNullOrEmpty(mo_code), (a, b, c, d, e) => d.mo_code.Contains(mo_code))
.WhereIF(!string.IsNullOrEmpty(mo_type),(a,b,c,d,e)=>d.mo_type==mo_type)
.WhereIF(!string.IsNullOrEmpty(name),(a,b,c,d,e)=>b.name.Contains(name))
.Where(a => a.act_start_date != null) .Where(a => a.act_start_date != null)
.OrderBy($"{input.sidx} {input.sort}") .OrderBy($"{input.sidx} {input.sort}")
.Select((a, b, c, d, e, f) => new PrdInstockRecordUpListOutPut() .Select((a, b, c, d, e, f) => new PrdInstockRecordUpListOutPut()
@@ -93,6 +98,7 @@ namespace Tnb.ProductionMgr
mo_task_status = e.FullName, mo_task_status = e.FullName,
workline_id = f.FullName, workline_id = f.FullName,
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS), act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
create_time = a.create_time.HasValue ? a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
tablefield102 = SqlFunc.Subqueryable<PrdInstockH>() tablefield102 = SqlFunc.Subqueryable<PrdInstockH>()
.LeftJoin<UserEntity>((x, y) => x.create_id == y.Id) .LeftJoin<UserEntity>((x, y) => x.create_id == y.Id)
.LeftJoin<DictionaryDataEntity>((x, y, z) => x.bill_type == z.Id) .LeftJoin<DictionaryDataEntity>((x, y, z) => x.bill_type == z.Id)
@@ -105,7 +111,6 @@ namespace Tnb.ProductionMgr
location_code = x.location_code, location_code = x.location_code,
create_id = y.RealName, create_id = y.RealName,
bill_date = x.bill_date == null ? "" : x.bill_date.ToString(DbTimeFormat.SS), bill_date = x.bill_date == null ? "" : x.bill_date.ToString(DbTimeFormat.SS),
}), }),
}).ToPagedListAsync(input.currentPage, input.pageSize); }).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<PrdInstockRecordUpListOutPut>.SqlSugarPageResult(result); return PageResult<PrdInstockRecordUpListOutPut>.SqlSugarPageResult(result);

View File

@@ -162,6 +162,11 @@
public string attachment { get; set; } = string.Empty; public string attachment { get; set; } = string.Empty;
public List<List<Exextype>>? checktypes { get; set; } public List<List<Exextype>>? checktypes { get; set; }
/// <summary>
/// 不合格时,选择的暂控开始结束时间,时间戳数组 例如[12358471,2654814753]
/// </summary>
public long []? startEndTime { get; set; }
} }
public class Exextype public class Exextype
{ {
@@ -208,6 +213,10 @@
public string? exectime { get; set; } public string? exectime { get; set; }
public string? execuser { get; set; } public string? execuser { get; set; }
public string batch { get; set; } public string batch { get; set; }
/// <summary>
/// 附件
/// </summary>
public string? attachment { get; set; }
public List<List<Checktype>>? checktypes { get; set; } public List<List<Checktype>>? checktypes { get; set; }

View File

@@ -138,5 +138,13 @@ namespace Tnb.QcMgr.Entities
/// 附件对象. /// 附件对象.
/// </summary> /// </summary>
public string attachment { get; set; } = string.Empty; public string attachment { get; set; } = string.Empty;
/// <summary>
/// 暂控开始时间
/// </summary>
public string control_start_time { get; set; }
/// <summary>
/// 暂控结束时间
/// </summary>
public string control_end_time { get; set; }
} }
} }

View File

@@ -28,6 +28,7 @@ using Tnb.ProductionMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.ProductionMgr.Entities.Dto.PrdManage; using Tnb.ProductionMgr.Entities.Dto.PrdManage;
using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities;
using JNPF.Common.Extension;
namespace Tnb.QcMgr namespace Tnb.QcMgr
{ {
@@ -284,6 +285,19 @@ namespace Tnb.QcMgr
QcCheckExecH.check_type = CheckTaskInput.check_type; QcCheckExecH.check_type = CheckTaskInput.check_type;
QcCheckExecH.remark = CheckTaskInput.remark; QcCheckExecH.remark = CheckTaskInput.remark;
QcCheckExecH.attachment = CheckTaskInput.attachment; QcCheckExecH.attachment = CheckTaskInput.attachment;
#region
if (CheckTaskInput.result == "no")//质检结论不合格,记录暂控时间
{
if(CheckTaskInput.startEndTime==null || CheckTaskInput.startEndTime.Length <= 1)
{
throw Oops.Bah("不合格时,请选择时间区间");
}
QcCheckExecH.control_start_time = CheckTaskInput.startEndTime[0].TimeStampToDateTime().ToString("yyyy-MM-dd HH:mm:ss");
QcCheckExecH.control_end_time = CheckTaskInput.startEndTime[1].TimeStampToDateTime().ToString("yyyy-MM-dd HH:mm:ss");
}
#endregion
List<QcCheckExecD> QcCheckExecDs = await db.Queryable<QcCheckExecD>().Where(p => p.mainid == CheckTaskInput.mainid).ToListAsync(); List<QcCheckExecD> QcCheckExecDs = await db.Queryable<QcCheckExecD>().Where(p => p.mainid == CheckTaskInput.mainid).ToListAsync();
int rqty = 0; int rqty = 0;
@@ -514,6 +528,7 @@ namespace Tnb.QcMgr
qty = a.qty, qty = a.qty,
equip_name = h.name, equip_name = h.name,
checktypes = new List<List<Checktype>>(), checktypes = new List<List<Checktype>>(),
attachment = a.attachment,
}).FirstAsync(); }).FirstAsync();
Result.checktypes = new List<List<Checktype>>(); Result.checktypes = new List<List<Checktype>>();
if (!string.IsNullOrEmpty(QcCheckExecH.carry_code)) if (!string.IsNullOrEmpty(QcCheckExecH.carry_code))