转库单同步调整 库存报表调整

This commit is contained in:
2024-07-18 12:31:05 +08:00
parent 7f7f21c271
commit 5666f0262e
5 changed files with 114 additions and 97 deletions

View File

@@ -9,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities;
/// </summary>
public partial class WmsCarryStockReport
{
public int { get; set; }
public int index { get; set; }
///// <summary>
///// 所属组织
///// </summary>
@@ -23,22 +23,22 @@ public partial class WmsCarryStockReport
/// <summary>
/// 载具编码
/// </summary>
public string? { get; set; }
public string? carry_code { get; set; }
/// <summary>
/// 载具名称
/// </summary>
public string? { get; set; }
public string? carry_name { get; set; }
/// <summary>
/// 子载具编码
/// </summary>
public string? { get; set; }
public string? membercarry_code { get; set; }
/// <summary>
/// 子载具名称
/// </summary>
public string? { get; set; }
public string? membercarry_name { get; set; }
/// <summary>
/// 物料ID
@@ -48,77 +48,77 @@ public partial class WmsCarryStockReport
/// <summary>
/// 物料编码
/// </summary>
public string? { get; set; }
public string? material_code { get; set; }
/// <summary>
/// 物料名称
/// </summary>
public string? { get; set; }
public string? material_name { get; set; }
/// <summary>
/// 仓库名称
/// </summary>
public string? { get; set; }
public string? warehouse_name { get; set; }
/// <summary>
/// 库位编码
/// </summary>
public string? { get; set; }
public string? location_code { get; set; }
/// <summary>
/// 库位名称
/// </summary>
public string? { get; set; }
public string? location_name { get; set; }
/// <summary>
/// 载具状态
/// </summary>
public string? { get; set; }
public string? carry_status { get; set; }
/// <summary>
/// 库位状态
/// </summary>
public string? { get; set; }
public string? location_status { get; set; }
/// <summary>
/// 载具类型
/// </summary>
public string? { get; set; }
public string? carry_type { get; set; }
/// <summary>
/// 入库时间
/// </summary>
public string? { get; set; }
public string? instock_time { get; set; }
/// <summary>
/// 条码
/// </summary>
public string? { get; set; }
public string? barcode { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? { get; set; }
public string? code_batch { get; set; }
/// <summary>
/// 数量
/// </summary>
public decimal? { get; set; }
public decimal? qty { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? { get; set; }
public string? unit { get; set; }
/// <summary>
/// 操作用户
/// </summary>
public string? { get; set; }
public string? creator { get; set; }
/// <summary>
/// 绑定时间
/// </summary>
public string? { get; set; }
public string? bind_time { get; set; }
}
@@ -127,7 +127,7 @@ public partial class WmsCarryStockReport
/// </summary>
public partial class WmsCarryStockReportH
{
public int { get; set; }
public int index { get; set; }
///// <summary>
///// 所属组织
///// </summary>
@@ -141,47 +141,47 @@ public partial class WmsCarryStockReportH
/// <summary>
/// 载具编码
/// </summary>
public string? { get; set; }
public string? carry_code { get; set; }
/// <summary>
/// 载具名称
/// </summary>
public string? { get; set; }
public string? carry_name { get; set; }
/// <summary>
/// 仓库名称
/// </summary>
public string? { get; set; }
public string? warehouse_name { get; set; }
/// <summary>
/// 库位编码
/// </summary>
public string? { get; set; }
public string? location_code { get; set; }
/// <summary>
/// 库位名称
/// </summary>
public string? { get; set; }
public string? location_name { get; set; }
/// <summary>
/// 载具状态
/// </summary>
public string? { get; set; }
public string? carry_status { get; set; }
/// <summary>
/// 库位状态
/// </summary>
public string? { get; set; }
public string? location_status { get; set; }
/// <summary>
/// 载具类型
/// </summary>
public string? { get; set; }
public string? carry_type { get; set; }
/// <summary>
/// 入库时间
/// </summary>
public string? { get; set; }
public string? instock_time { get; set; }
public List<WmsCarryStockReportCode> Details { get; set; }
}
@@ -192,7 +192,7 @@ public partial class WmsCarryStockReportH
/// </summary>
public partial class WmsCarryStockReportCode
{
public int { get; set; }
public int index { get; set; }
///// <summary>
///// 载具ID
///// </summary>
@@ -201,12 +201,12 @@ public partial class WmsCarryStockReportCode
/// <summary>
/// 载具编码
/// </summary>
public string? { get; set; }
public string? carry_code { get; set; }
/// <summary>
/// 载具名称
/// </summary>
public string? { get; set; }
public string? carry_name { get; set; }
///// <summary>
///// 物料ID
@@ -216,32 +216,32 @@ public partial class WmsCarryStockReportCode
/// <summary>
/// 物料编号
/// </summary>
public string? { get; set; }
public string? material_code { get; set; }
/// <summary>
/// 物料名称
/// </summary>
public string? { get; set; }
public string? material_name { get; set; }
/// <summary>
/// 条码编号
/// </summary>
public string? { get; set; }
public string? barcode { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? { get; set; }
public string? code_batch { get; set; }
/// <summary>
/// 条码数量
/// </summary>
public decimal? { get; set; }
public decimal? qty { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? { get; set; }
public string? unit { get; set; }
///// <summary>
///// 操作用户
@@ -251,7 +251,7 @@ public partial class WmsCarryStockReportCode
/// <summary>
/// 绑定时间
/// </summary>
public string? { get; set; }
public string? bind_time { get; set; }
}

View File

@@ -4,6 +4,7 @@ using JNPF.Common.Enums;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.FriendlyException;
using JNPF.Systems.Entitys.System;
using JNPF.Systems.Interfaces.System;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Forms;
@@ -13,6 +14,7 @@ using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.ProductionMgr.Entities.Entity;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto.ErpInputs;
@@ -511,7 +513,6 @@ namespace Tnb.WarehouseMgr
WmsMaterialTransferD wmsMaterialTransferD = new WmsMaterialTransferD();
wmsMaterialTransferD.lineno = detail.lineno;
wmsMaterialTransferD.material_code = detail.material_code;
wmsMaterialTransferD.unit_code = detail.unit_code;
wmsMaterialTransferD.code_batch = detail.code_batch;
wmsMaterialTransferD.station_code = detail.station_code;
wmsMaterialTransferD.qty = detail.qty;
@@ -526,8 +527,20 @@ namespace Tnb.WarehouseMgr
{
wmsMaterialTransferD.material_id = material.id;
wmsMaterialTransferD.material_specification = material.material_specification;
wmsMaterialTransferD.unit_id = detail.unit_code;
}
var erpExtendField = await db.Queryable<ErpExtendField>().InnerJoin<DictionaryDataEntity>((a, b) => a.table_id == b.Id).Where((a, b) => a.cunitid == detail.unit_code).Select((a, b) => b).FirstAsync();
if (erpExtendField != null)
{
wmsMaterialTransferD.unit_id = erpExtendField.Id;
wmsMaterialTransferD.unit_code = erpExtendField.EnCode;
}
else
{
_LoggerErp2Mes.LogWarning($@"【MaterialTransfer】表体明细中单位{detail.unit_code}在wms系统中未找到");
throw new AppFriendlyException($@"表体明细中单位{detail.unit_code}在wms系统中未找到", 500);
}
wmsMaterialTransferDs.Add(wmsMaterialTransferD);
}

View File

@@ -669,12 +669,12 @@ namespace Tnb.WarehouseMgr
throw new AppFriendlyException("点位" + input.targetName + "不存在", 500);
}
string data = await _redisData.GetHash(strs[0], strs[1]);
Logger.Information("联核请求CheckPut接口查询X2Server数据:" + data);
Logger.Information("wcs请求CheckPut接口查询X2Server数据:" + data);
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
bool result = res != null && res["Value"] != null ? res.Value<bool>("Value") : false;
if (!result)
throw new AppFriendlyException("点位" + input.targetName + "不可放", 500);
Logger.Information("联核请求CheckPut接口结果CTU可放货" + data);
Logger.Information("wcs请求CheckPut接口结果CTU可放货" + data);
}
/// <summary>

View File

@@ -34,10 +34,7 @@ namespace Tnb.WarehouseMgr
_userManager = userManager;
}
/// <summary>
/// 转库单
/// </summary>
[HttpPost, NonUnify, AllowAnonymous]
[HttpPost]
public async Task<dynamic> CarryStock(CarryStockInput input)
{
var warehouse_id = "";
@@ -66,25 +63,25 @@ namespace Tnb.WarehouseMgr
.OrderByDescending((a, b, c, d, e, f) => b.carry_code)
.Select((a, b, c, d, e, f) => new WmsCarryStockReport
{
= c.whname,
warehouse_name = c.whname,
carry_id = b.id,
= string.IsNullOrEmpty(b.carry_code) ? "空托盘堆垛" : b.carry_code,
= string.IsNullOrEmpty(b.carry_code) ? "空托盘堆垛" : b.carry_name,
= b.is_lock == 1 ? "锁定" : "未锁定",
= d.carrystd_name,
= a.location_code,
= a.location_name,
= b.is_lock == 1 ? "锁定" : "未锁定",
= b.instock_time != null ? b.instock_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
= e.barcode,
= e.code_batch,
= e.codeqty,
carry_code = string.IsNullOrEmpty(b.carry_code) ? "空托盘堆垛" : b.carry_code,
carry_name = string.IsNullOrEmpty(b.carry_code) ? "空托盘堆垛" : b.carry_name,
carry_status = b.is_lock == 1 ? "锁定" : "未锁定",
carry_type = d.carrystd_name,
location_code = a.location_code,
location_name = a.location_name,
location_status = b.is_lock == 1 ? "锁定" : "未锁定",
instock_time = b.instock_time != null ? b.instock_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
barcode = e.barcode,
code_batch = e.code_batch,
qty = e.codeqty,
material_id = e.material_id,
= e.material_code,
= f.name,
= e.unit_id,
= e.create_id,
= e.create_time != null ? e.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
material_code = e.material_code,
material_name = f.name,
unit = e.unit_id,
creator = e.create_id,
bind_time = e.create_time != null ? e.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
})
.ToListAsync();
@@ -104,27 +101,27 @@ namespace Tnb.WarehouseMgr
.WhereIF(!string.IsNullOrEmpty(material_id), (a, b, c, d, e, f, g) => g.id == material_id)
.Select((a, b, c, d, e, f, g, h) => new WmsCarryStockReport
{
= c.whname,
warehouse_name = c.whname,
carry_id = b.id,
= b.carry_code,
= b.carry_name,
= h.carry_code,
= h.carry_name,
= b.is_lock == 1 ? "锁定" : "未锁定",
= d.carrystd_name,
= a.location_code,
= a.location_name,
= b.is_lock == 1 ? "锁定" : "未锁定",
= b.instock_time != null ? b.instock_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
= f.barcode,
= f.code_batch,
= f.codeqty,
carry_code = b.carry_code,
carry_name = b.carry_name,
membercarry_code = h.carry_code,
membercarry_name = h.carry_name,
carry_status = b.is_lock == 1 ? "锁定" : "未锁定",
carry_type = d.carrystd_name,
location_code = a.location_code,
location_name = a.location_name,
location_status = b.is_lock == 1 ? "锁定" : "未锁定",
instock_time = b.instock_time != null ? b.instock_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
barcode = f.barcode,
code_batch = f.code_batch,
qty = f.codeqty,
material_id = f.material_id,
= f.material_code,
= g.name,
= f.unit_id,
= f.create_id,
= f.create_time != null ? f.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
material_code = f.material_code,
material_name = g.name,
unit = f.unit_id,
creator = f.create_id,
bind_time = f.create_time != null ? f.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
})
.ToListAsync();
@@ -138,7 +135,7 @@ namespace Tnb.WarehouseMgr
_ = storeMap.TryGetValue(itGroup.Key, out WmsCarryStockReport? report);
WmsCarryStockReportH stockReport = report.Adapt<WmsCarryStockReportH>();
if (report. != "空托盘堆垛")
if (report.carry_code != "空托盘堆垛")
{
List<WmsCarryStockReport> curCarryCodes = items.FindAll(x => x.carry_id == itGroup.Key.carry_id);
@@ -148,19 +145,19 @@ namespace Tnb.WarehouseMgr
{
index++;
WmsCarryStockReportCode wmsCarryStockReportCode = new();
wmsCarryStockReportCode. = index;
wmsCarryStockReportCode.index = index;
//wmsCarryStockReportCode.carry_id = x.carry_id;
wmsCarryStockReportCode. = !string.IsNullOrEmpty(x.) ? x. : x.;
wmsCarryStockReportCode. = !string.IsNullOrEmpty(x.) ? x. : x.;
wmsCarryStockReportCode.carry_code = !string.IsNullOrEmpty(x.membercarry_code) ? x.membercarry_code : x.carry_code;
wmsCarryStockReportCode.carry_name = !string.IsNullOrEmpty(x.membercarry_name) ? x.membercarry_name : x.carry_name;
//wmsCarryStockReportCode.material_id = x.material_id;
wmsCarryStockReportCode. = x.;
wmsCarryStockReportCode. = x.;
wmsCarryStockReportCode. = x.;
wmsCarryStockReportCode. = x.;
wmsCarryStockReportCode. = x.;
wmsCarryStockReportCode. = x.;
wmsCarryStockReportCode.material_code = x.material_code;
wmsCarryStockReportCode.material_name = x.material_name;
wmsCarryStockReportCode.barcode = x.barcode;
wmsCarryStockReportCode.code_batch = x.code_batch;
wmsCarryStockReportCode.qty = x.qty;
wmsCarryStockReportCode.unit = x.unit;
//wmsCarryStockReportCode.创建用户 = x.操作用户;
wmsCarryStockReportCode. = x.;
wmsCarryStockReportCode.bind_time = x.bind_time;
wmsCarryStockReportCodes.Add(wmsCarryStockReportCode);
});
@@ -176,7 +173,7 @@ namespace Tnb.WarehouseMgr
int rowIndex = 0;
List<WmsCarryStockReportH> pages = result.Skip((input.currentPage - 1) * input.pageSize).Take(input.pageSize).ToList();
pages.ForEach(page => { rowIndex++; page. = rowIndex; });
pages.ForEach(page => { rowIndex++; page.index = rowIndex; });
SqlSugarPagedList<WmsCarryStockReportH> pagedList = new()
{