生产入库记录增加是否同步bip字段,并且修改新增生产入库记录逻辑
This commit is contained in:
@@ -380,6 +380,7 @@ namespace Tnb.BasicData
|
|||||||
foreach (var reqData in requestDatas)
|
foreach (var reqData in requestDatas)
|
||||||
{
|
{
|
||||||
var report_id = reqData["report_id"].ToString();
|
var report_id = reqData["report_id"].ToString();
|
||||||
|
var prd_instock_h_id = reqData["prd_instock_h_id"].ToString();
|
||||||
if (string.IsNullOrEmpty(report_id))
|
if (string.IsNullOrEmpty(report_id))
|
||||||
{
|
{
|
||||||
Log.Error($"请求记录id{record.id},生产提报记录id为空");
|
Log.Error($"请求记录id{record.id},生产提报记录id为空");
|
||||||
@@ -387,7 +388,7 @@ namespace Tnb.BasicData
|
|||||||
}
|
}
|
||||||
PrdReport prdReport = await db.Queryable<PrdReport>().SingleAsync(r => r.id == report_id);
|
PrdReport prdReport = await db.Queryable<PrdReport>().SingleAsync(r => r.id == report_id);
|
||||||
|
|
||||||
#region 生成入库记录主表数据
|
#region 修改生成入库记录主表数据为已同步bip
|
||||||
var wmsPrdInstockD = await db.Queryable<WmsPrdInstockD>().SingleAsync(r => r.prd_report_id == report_id);
|
var wmsPrdInstockD = await db.Queryable<WmsPrdInstockD>().SingleAsync(r => r.prd_report_id == report_id);
|
||||||
if(wmsPrdInstockD==null)
|
if(wmsPrdInstockD==null)
|
||||||
{
|
{
|
||||||
@@ -404,25 +405,7 @@ namespace Tnb.BasicData
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var prdInstockH = new PrdInstockH();
|
await db.Updateable<PrdInstockH>().SetColumns(r => r.is_sync_bip == 1).Where(r => r.id == prd_instock_h_id).ExecuteCommandAsync();
|
||||||
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
|
#endregion
|
||||||
|
|
||||||
#region 生成入库记录子表数据
|
#region 生成入库记录子表数据
|
||||||
@@ -433,7 +416,7 @@ namespace Tnb.BasicData
|
|||||||
{
|
{
|
||||||
PrdInstockD prdInstockD = new PrdInstockD();
|
PrdInstockD prdInstockD = new PrdInstockD();
|
||||||
prdInstockD.id = SnowflakeIdHelper.NextId();
|
prdInstockD.id = SnowflakeIdHelper.NextId();
|
||||||
prdInstockD.instock_id = prdInstockH.id;
|
prdInstockD.instock_id = prd_instock_h_id;
|
||||||
prdInstockD.material_id = wmsPrdInstockH.material_id;
|
prdInstockD.material_id = wmsPrdInstockH.material_id;
|
||||||
prdInstockD.material_code= wmsPrdInstockH.material_code;
|
prdInstockD.material_code= wmsPrdInstockH.material_code;
|
||||||
prdInstockD.unit_id = _detail.unit_id;
|
prdInstockD.unit_id = _detail.unit_id;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
|||||||
/// 起始库位编号
|
/// 起始库位编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string location_code { get; set; } = string.Empty;
|
public string location_code { get; set; } = string.Empty;
|
||||||
|
public int is_sync_bip { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PrdInstockRecordUpListDownOutPut
|
public class PrdInstockRecordUpListDownOutPut
|
||||||
|
|||||||
@@ -85,5 +85,8 @@ public partial class PrdInstockH : BaseEntity<string>
|
|||||||
/// 入库单编号
|
/// 入库单编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? code { get; set; }
|
public string? code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否同步bip
|
||||||
|
/// </summary>
|
||||||
|
public int? is_sync_bip { get; set; } = 0;
|
||||||
}
|
}
|
||||||
@@ -82,14 +82,14 @@ namespace Tnb.ProductionMgr
|
|||||||
.LeftJoin<PrdMo>((a, b, c, d) => a.mo_id == d.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<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)
|
.LeftJoin<OrganizeEntity>((a, b, c, d, e, f) => a.workline_id == f.Id)
|
||||||
.LeftJoin<EqpEquipment>((a,b,c,d,e,f,g)=>a.eqp_id==g.id)
|
.LeftJoin<EqpEquipment>((a, b, c, d, e, f, g) => a.eqp_id == g.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(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))
|
.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,g) => new PrdInstockRecordUpListOutPut()
|
.Select((a, b, c, d, e, f, g) => new PrdInstockRecordUpListOutPut()
|
||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
mo_task_code = a.mo_task_code,
|
mo_task_code = a.mo_task_code,
|
||||||
@@ -98,15 +98,15 @@ namespace Tnb.ProductionMgr
|
|||||||
workstation_id = c.FullName,
|
workstation_id = c.FullName,
|
||||||
mo_task_status = e.FullName,
|
mo_task_status = e.FullName,
|
||||||
workline_id = f.FullName,
|
workline_id = f.FullName,
|
||||||
eqp_code=g.code,
|
eqp_code = g.code,
|
||||||
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") : "",
|
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)
|
||||||
.LeftJoin<WmsCarryH>((x,y,z,j)=>x.carry_code==j.id)
|
.LeftJoin<WmsCarryH>((x, y, z, j) => x.carry_code == j.id)
|
||||||
.LeftJoin<BasLocation>((x,y,z,j,k)=>x.location_code==k.id)
|
.LeftJoin<BasLocation>((x, y, z, j, k) => x.location_code == k.id)
|
||||||
.Where(x => x.mo_task_id == a.id).ToList((x, y, z,j,k) => new PrdInstockRecordUpListChildOutPut()
|
.Where(x => x.mo_task_id == a.id).ToList((x, y, z, j, k) => new PrdInstockRecordUpListChildOutPut()
|
||||||
{
|
{
|
||||||
id = x.id,
|
id = x.id,
|
||||||
code = x.code,
|
code = x.code,
|
||||||
@@ -115,6 +115,7 @@ namespace Tnb.ProductionMgr
|
|||||||
location_code = k.location_code,
|
location_code = k.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),
|
||||||
|
is_sync_bip = x.is_sync_bip.HasValue ? x.is_sync_bip.Value : 0
|
||||||
}),
|
}),
|
||||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
return PageResult<PrdInstockRecordUpListOutPut>.SqlSugarPageResult(result);
|
return PageResult<PrdInstockRecordUpListOutPut>.SqlSugarPageResult(result);
|
||||||
|
|||||||
@@ -362,6 +362,46 @@ namespace Tnb.WarehouseMgr
|
|||||||
if (prdReport == null) return;
|
if (prdReport == null) return;
|
||||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdReport.mo_task_id);
|
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdReport.mo_task_id);
|
||||||
PrdMo prdMo = await _db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
|
PrdMo prdMo = await _db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
|
||||||
|
|
||||||
|
#region 新增生产入库记录
|
||||||
|
|
||||||
|
var prdInstockH = new PrdInstockH();
|
||||||
|
|
||||||
|
prdInstockH = await _db.Queryable<PrdInstockH>().Where(r => r.mo_task_id == prdReport.mo_task_id).FirstAsync();
|
||||||
|
if (prdInstockH != null)
|
||||||
|
{
|
||||||
|
prdInstockH.bill_type = instock.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 = instock.org_id;
|
||||||
|
prdInstockH.station_id = prdMoTask?.workstation_id;
|
||||||
|
prdInstockH.workline_id = prdMoTask?.workline_id;
|
||||||
|
prdInstockH.mo_task_id = prdReport?.mo_task_id;
|
||||||
|
prdInstockH.code = instock.bill_code;
|
||||||
|
prdInstockH.is_sync_bip = 0;
|
||||||
|
await _db.Updateable(prdInstockH).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prdInstockH.id = SnowflakeIdHelper.NextId();
|
||||||
|
prdInstockH.bill_type = instock.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 = instock.org_id;
|
||||||
|
prdInstockH.station_id = prdMoTask?.workstation_id;
|
||||||
|
prdInstockH.workline_id = prdMoTask?.workline_id;
|
||||||
|
prdInstockH.mo_task_id = prdReport?.mo_task_id;
|
||||||
|
prdInstockH.code = instock.bill_code;
|
||||||
|
prdInstockH.is_sync_bip = 0;
|
||||||
|
|
||||||
|
await _db.Insertable(prdInstockH).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
//来源erp才产成品入库
|
//来源erp才产成品入库
|
||||||
if (prdMo.mo_source != "1")
|
if (prdMo.mo_source != "1")
|
||||||
{
|
{
|
||||||
@@ -428,6 +468,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
erpRequestData.Add("vtrantypecode", "46-01");
|
erpRequestData.Add("vtrantypecode", "46-01");
|
||||||
erpRequestData.Add("csourcebillhid", prdReport?.erp_pk_wr ?? "");
|
erpRequestData.Add("csourcebillhid", prdReport?.erp_pk_wr ?? "");
|
||||||
erpRequestData.Add("report_id", prdReport?.id ?? "");
|
erpRequestData.Add("report_id", prdReport?.id ?? "");
|
||||||
|
erpRequestData.Add("prd_instock_h_id", prdInstockH.id);
|
||||||
|
|
||||||
|
|
||||||
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||||
|
|||||||
Reference in New Issue
Block a user