1.质检不合格,选择时间区间;2.生产入库记录增加工单类型及物料的查询条件;3.产成品入库同步BIP成功后,相关信息记录到生产入库记录
This commit is contained in:
@@ -18,6 +18,8 @@ using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
using Tnb.WarehouseMgr.Entities.Entity;
|
||||
using JNPF.Common.Security;
|
||||
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
@@ -367,6 +369,85 @@ namespace Tnb.BasicData
|
||||
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();
|
||||
|
||||
@@ -10,6 +10,10 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
||||
public string workstation_id { get; set; }
|
||||
public string workline_id { 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>();
|
||||
}
|
||||
|
||||
@@ -39,5 +43,10 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
||||
/// 条码编号
|
||||
/// </summary>
|
||||
public string barcode { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 物料规格型号
|
||||
/// </summary>
|
||||
public string material_standard { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,7 @@ namespace Tnb.ProductionMgr
|
||||
code_batch = a.code_batch,
|
||||
barcode = a.barcode,
|
||||
quantity = a.quantity.ToString(),
|
||||
material_standard=b.material_standard
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<PrdInstockRecordUpListDownOutPut>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
@@ -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>();
|
||||
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_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 = "";
|
||||
// if (!string.IsNullOrEmpty(workstation_id_str))
|
||||
@@ -75,15 +78,17 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
var result = await db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<OrganizeEntity>((a,b,c)=>a.workstation_id==c.Id)
|
||||
.LeftJoin<PrdMo>((a,b,c,d)=>a.mo_id==d.id)
|
||||
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e)=>e.DictionaryTypeId==DictConst.PrdTaskStatusTypeId && a.mo_task_status==e.EnCode)
|
||||
.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_code),(a,b,c,d,e)=>d.mo_code.Contains(mo_code))
|
||||
.Where(a=>a.act_start_date!=null)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c) => a.workstation_id == c.Id)
|
||||
.LeftJoin<PrdMo>((a, b, c, d) => a.mo_id == d.id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode)
|
||||
.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_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)
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.Select((a, b, c, d,e,f) => new PrdInstockRecordUpListOutPut()
|
||||
.Select((a, b, c, d, e, f) => new PrdInstockRecordUpListOutPut()
|
||||
{
|
||||
id = a.id,
|
||||
mo_task_code = a.mo_task_code,
|
||||
@@ -92,11 +97,12 @@ namespace Tnb.ProductionMgr
|
||||
workstation_id = c.FullName,
|
||||
mo_task_status = e.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>()
|
||||
.LeftJoin<UserEntity>((x,y)=>x.create_id==y.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((x,y,z)=>x.bill_type==z.Id)
|
||||
.Where(x=>x.mo_task_id==a.id).ToList((x,y,z)=>new PrdInstockRecordUpListChildOutPut()
|
||||
.LeftJoin<UserEntity>((x, y) => x.create_id == y.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((x, y, z) => x.bill_type == z.Id)
|
||||
.Where(x => x.mo_task_id == a.id).ToList((x, y, z) => new PrdInstockRecordUpListChildOutPut()
|
||||
{
|
||||
id = x.id,
|
||||
code = x.code,
|
||||
@@ -104,8 +110,7 @@ namespace Tnb.ProductionMgr
|
||||
carry_code = x.carry_code,
|
||||
location_code = x.location_code,
|
||||
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);
|
||||
return PageResult<PrdInstockRecordUpListOutPut>.SqlSugarPageResult(result);
|
||||
|
||||
@@ -162,6 +162,11 @@
|
||||
public string attachment { get; set; } = string.Empty;
|
||||
|
||||
public List<List<Exextype>>? checktypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 不合格时,选择的暂控开始结束时间,时间戳数组 例如[12358471,2654814753]
|
||||
/// </summary>
|
||||
public long []? startEndTime { get; set; }
|
||||
}
|
||||
public class Exextype
|
||||
{
|
||||
@@ -208,6 +213,10 @@
|
||||
public string? exectime { get; set; }
|
||||
public string? execuser { get; set; }
|
||||
public string batch { get; set; }
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
public string? attachment { get; set; }
|
||||
|
||||
|
||||
public List<List<Checktype>>? checktypes { get; set; }
|
||||
|
||||
@@ -138,5 +138,13 @@ namespace Tnb.QcMgr.Entities
|
||||
/// 附件对象.
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using JNPF.Common.Extension;
|
||||
|
||||
namespace Tnb.QcMgr
|
||||
{
|
||||
@@ -284,6 +285,19 @@ namespace Tnb.QcMgr
|
||||
QcCheckExecH.check_type = CheckTaskInput.check_type;
|
||||
QcCheckExecH.remark = CheckTaskInput.remark;
|
||||
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();
|
||||
|
||||
int rqty = 0;
|
||||
@@ -514,6 +528,7 @@ namespace Tnb.QcMgr
|
||||
qty = a.qty,
|
||||
equip_name = h.name,
|
||||
checktypes = new List<List<Checktype>>(),
|
||||
attachment = a.attachment,
|
||||
}).FirstAsync();
|
||||
Result.checktypes = new List<List<Checktype>>();
|
||||
if (!string.IsNullOrEmpty(QcCheckExecH.carry_code))
|
||||
|
||||
Reference in New Issue
Block a user