采购收货质检收货单找载具逻辑

This commit is contained in:
2024-08-21 12:37:56 +08:00
parent cdaeefa4ae
commit 3ab02675d7
10 changed files with 131 additions and 123 deletions

View File

@@ -48,10 +48,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
/// </summary>
public string erp_pk { get; set; }
/// <summary>
/// erp仓库类型
/// </summary>
public string erp_wh_type { get; set; }
public List<SaleShippingDetail> details { get; set; }

View File

@@ -1,93 +1,92 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
{
public class TransferOrderInput
{
/// <summary>
/// 单号
/// </summary>
public string? transfer_order { get; set; }
/// <summary>
/// 部门编码
/// </summary>
public string? dept_code { get; set; }
/// <summary>
/// 业务员编码
/// </summary>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
{
public class TransferOrderInput
{
/// <summary>
/// 单号
/// </summary>
public string? transfer_order { get; set; }
/// <summary>
/// 部门编码
/// </summary>
public string? dept_code { get; set; }
/// <summary>
/// 业务员编码
/// </summary>
public string? biller { get; set; }
/// <summary>
/// 出库仓库
/// </summary>
/// <summary>
/// 出库仓库
/// </summary>
public string? warehouse_outstock { get; set; }
/// <summary>
/// 入库组织编号
/// </summary>
public string? instockorg_code { get; set; }
/// <summary>
/// 供货日期
/// </summary>
/// <summary>
/// 入库组织编号
/// </summary>
public string? instockorg_code { get; set; }
/// <summary>
/// 供货日期
/// </summary>
public DateTime? ship_date { get; set; }
/// <summary>
/// 主表pk
/// </summary>
/// <summary>
/// 主表pk
/// </summary>
public string? erp_pk { get; set; }
/// <summary>
/// 交易类型
/// </summary>
/// <summary>
/// 交易类型
/// </summary>
public string? transaction_type { get; set; }
/// <summary>
/// </summary>
public string erp_wh_type { get; set; }
public List<TransferOrderInputDetail> details { get; set; }
}
public class TransferOrderInputDetail
{
/// <summary>
/// 行号
/// </summary>
public string? lineno { get; set; }
/// <summary>
/// 物品代码
/// </summary>
public string? material_code { get; set; }
/// <summary>
/// 单位代码
/// </summary>
public string? unit_code { get; set; }
public List<TransferOrderInputDetail> details { get; set; }
}
public class TransferOrderInputDetail
{
/// <summary>
/// 行号
/// </summary>
public string? lineno { get; set; }
/// <summary>
/// 物品代码
/// </summary>
public string? material_code { get; set; }
/// <summary>
/// 单位代码
/// </summary>
public string? unit_code { get; set; }
/// <summary>
/// 采购数量
/// </summary>
public decimal? qty { get; set; }
/// 采购数量
/// </summary>
public decimal? qty { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? code_batch { get; set; }
/// <summary>
/// 交货日期
/// </summary>
public DateTime? delivery_date { get; set; }
/// <summary>
/// 子表主键
/// </summary>
/// <summary>
/// 批次
/// </summary>
public string? code_batch { get; set; }
/// <summary>
/// 交货日期
/// </summary>
public DateTime? delivery_date { get; set; }
/// <summary>
/// 子表主键
/// </summary>
public string erp_line_pk { get; set; }
}
}

View File

@@ -58,11 +58,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
/// </summary>
public string? erp_pk { get; set; }
/// <summary>
/// erp仓库类型
/// </summary>
public string? erp_wh_type { get; set; }
public List<RawMatTransferInstockDetail> details { get; set; }
}
public class RawMatTransferInstockDetail

View File

@@ -42,7 +42,7 @@ public partial class WmsOutinStockDetail : BaseEntity<string>
/// <summary>
/// 源单单据类型
/// </summary>
public int? source_type { get; set; }
public string? source_type { get; set; }
/// <summary>
/// 来源单据行号

View File

@@ -760,7 +760,6 @@ namespace Tnb.WarehouseMgr
s_eleUseStatusDic[elevator.device_id] = (int)EnumElevatorUseStatus.;
Logger.Information($"【TaskCallback】 {devName.Match(@"\d+")}#梯,设备名称:{devName},开始进入关门流程 {devName} 变更为空闲 {s_eleUseStatusDic.GetHashCode()} {s_eleUseStatusDic[elevator.device_id]}");
int doorStatus = await _elevatorControlService.GetTagAsync(devName, ElevatorConsts.DoorStatus);
Logger.Information($"【TaskCallback】 设备:{devName},门状态:{doorStatus.ToEnum<EnumDoorStatus>().ToString()}");
if (doorStatus.ToEnum<EnumDoorStatus>() != EnumDoorStatus.

View File

@@ -501,18 +501,18 @@ namespace Tnb.WarehouseMgr
}
var tasks = ParallelWriteTagAsync(input);
var writeRes = await Task.WhenAll(tasks);
var timedTaskSvc = _backgudSvc as TimedTaskBackgroundService;
if (timedTaskSvc != null)
{
if (input.flag.Equals("close", StringComparison.OrdinalIgnoreCase))
{
_ = timedTaskSvc.CloseAgvHeartbeat(input.devNames);
}
else
{
_ = timedTaskSvc.OpenAgvHeartbeat(input.devNames);
}
}
//var timedTaskSvc = _backgudSvc as TimedTaskBackgroundService;
//if (timedTaskSvc != null)
//{
// if (input.flag.Equals("close", StringComparison.OrdinalIgnoreCase))
// {
// _ = timedTaskSvc.CloseAgvHeartbeat(input.devNames);
// }
// else
// {
// _ = timedTaskSvc.OpenAgvHeartbeat(input.devNames);
// }
//}
}

View File

@@ -751,11 +751,11 @@ namespace Tnb.WarehouseMgr
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
}
WmsErpWarehouserelaH wmsErpWarehouserelaH = await db.Queryable<WmsErpWarehouserelaH>().Where(r => r.erp_warehousecode == input.erp_wh_type).FirstAsync();
WmsErpWarehouserelaH wmsErpWarehouserelaH = await db.Queryable<WmsErpWarehouserelaH>().Where(r => r.erp_warehousecode == input.warehouse_code).FirstAsync();
if (wmsErpWarehouserelaH == null)
{
_LoggerErp2Mes.LogWarning($@"【TransferOrder】不存在erp仓库类型{input.erp_wh_type}对应wms系统的映射关系");
throw new AppFriendlyException($@"不存在erp仓库类型{input.erp_wh_type}对应wms系统的映射关系", 500);
_LoggerErp2Mes.LogWarning($@"【TransferOrder】不存在erp仓库类型{input.warehouse_code}对应wms系统的映射关系");
throw new AppFriendlyException($@"不存在erp仓库类型{input.warehouse_code}对应wms系统的映射关系", 500);
}
string warehouse_outstock_code = wmsErpWarehouserelaH.wms_warehousecode;
@@ -778,7 +778,7 @@ namespace Tnb.WarehouseMgr
wmsSaleH.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
wmsSaleH.warehouse_id = warehouse_outstock.id;
wmsSaleH.customer_code = input.customer_code;
wmsSaleH.erp_wh_type = input.erp_wh_type;
wmsSaleH.erp_wh_type = input.warehouse_code;
var customer = await db.Queryable<BasCustomer>().Where(p => p.customer_code == input.customer_code).FirstAsync();
if (customer != null)
{
@@ -866,11 +866,11 @@ namespace Tnb.WarehouseMgr
throw new AppFriendlyException($"主表主键不能为空", 500);
}
WmsErpWarehouserelaH wmsErpWarehouserelaH = await db.Queryable<WmsErpWarehouserelaH>().Where(r => r.erp_warehousecode == input.erp_wh_type).FirstAsync();
WmsErpWarehouserelaH wmsErpWarehouserelaH = await db.Queryable<WmsErpWarehouserelaH>().Where(r => r.erp_warehousecode == input.warehouse_instock).FirstAsync();
if (wmsErpWarehouserelaH == null)
{
_LoggerErp2Mes.LogWarning($@"【TransferOrder】不存在erp仓库类型{input.erp_wh_type}对应wms系统的映射关系");
throw new AppFriendlyException($@"不存在erp仓库类型{input.erp_wh_type}对应wms系统的映射关系", 500);
_LoggerErp2Mes.LogWarning($@"【TransferOrder】不存在erp仓库类型{input.warehouse_instock}对应wms系统的映射关系");
throw new AppFriendlyException($@"不存在erp仓库类型{input.warehouse_instock}对应wms系统的映射关系", 500);
}
string warehouse_instock_code = wmsErpWarehouserelaH.wms_warehousecode;
@@ -918,7 +918,7 @@ namespace Tnb.WarehouseMgr
wmsRawmatTransferinstockH.create_time = DateTime.Now;
wmsRawmatTransferinstockH.dept_code = input.dept_code;
wmsRawmatTransferinstockH.biller = input.biller;
wmsRawmatTransferinstockH.erp_wh_type = input.erp_wh_type;
wmsRawmatTransferinstockH.erp_wh_type = input.warehouse_instock;
wmsRawmatTransferinstockH.org_id = WmsWareHouseConst.AdministratorOrgId;
await db.Insertable(wmsRawmatTransferinstockH).ExecuteCommandAsync();
@@ -978,7 +978,7 @@ namespace Tnb.WarehouseMgr
wmsTransferInstockH.create_time = DateTime.Now;
wmsTransferInstockH.dept_code = input.dept_code;
wmsTransferInstockH.biller = input.biller;
wmsTransferInstockH.erp_wh_type = input.erp_wh_type;
wmsTransferInstockH.erp_wh_type = input.warehouse_instock;
await db.Insertable(wmsTransferInstockH).ExecuteCommandAsync();
List<WmsTransferInstockD> wmsTransferInstockDs = new List<WmsTransferInstockD>();
@@ -1079,11 +1079,11 @@ namespace Tnb.WarehouseMgr
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
}
WmsErpWarehouserelaH wmsErpWarehouserelaH = await db.Queryable<WmsErpWarehouserelaH>().Where(r => r.erp_warehousecode == input.erp_wh_type).FirstAsync();
WmsErpWarehouserelaH wmsErpWarehouserelaH = await db.Queryable<WmsErpWarehouserelaH>().Where(r => r.erp_warehousecode == input.warehouse_outstock).FirstAsync();
if (wmsErpWarehouserelaH == null)
{
_LoggerErp2Mes.LogWarning($@"【TransferOrder】不存在erp仓库类型{input.erp_wh_type}对应wms系统的映射关系");
throw new AppFriendlyException($@"不存在erp仓库类型{input.erp_wh_type}对应wms系统的映射关系", 500);
_LoggerErp2Mes.LogWarning($@"【TransferOrder】不存在erp仓库类型{input.warehouse_outstock}对应wms系统的映射关系");
throw new AppFriendlyException($@"不存在erp仓库类型{input.warehouse_outstock}对应wms系统的映射关系", 500);
}
string warehouse_outstock_code = wmsErpWarehouserelaH.wms_warehousecode;
@@ -1107,7 +1107,7 @@ namespace Tnb.WarehouseMgr
wmsTransferOrderH.create_id = WmsWareHouseConst.ErpUserId;
wmsTransferOrderH.create_time = DateTime.Now;
wmsTransferOrderH.org_id = WmsWareHouseConst.AdministratorOrgId;
wmsTransferOrderH.erp_wh_type = input.erp_wh_type;
wmsTransferOrderH.erp_wh_type = input.warehouse_outstock;
var _erpExtendField = await db.Queryable<ErpExtendField>().InnerJoin<DictionaryDataEntity>((a, b) => a.table_id == b.Id)
.Where((a, b) => a.transaction_type_id == input.transaction_type).Select((a, b) => b).FirstAsync();
@@ -1176,7 +1176,7 @@ namespace Tnb.WarehouseMgr
wmsRawmatTransferoutstockH.issuance_status = "0";
wmsRawmatTransferoutstockH.transaction_type = _erpExtendField.EnCode;
wmsRawmatTransferoutstockH.org_id = WmsWareHouseConst.AdministratorOrgId;
wmsRawmatTransferoutstockH.erp_wh_type = input.erp_wh_type;
wmsRawmatTransferoutstockH.erp_wh_type = input.warehouse_outstock;
List<WmsRawmatTransferoutstockD> wmsRawmatTransferoutstockDs = new List <WmsRawmatTransferoutstockD>();
foreach (var detail in input.details)
{
@@ -1229,7 +1229,7 @@ namespace Tnb.WarehouseMgr
wmsTransferOutstockH.issuance_status = "0";
wmsTransferOutstockH.transaction_type = _erpExtendField.EnCode;
wmsTransferOutstockH.org_id = WmsWareHouseConst.AdministratorOrgId;
wmsTransferOutstockH.erp_wh_type = input.erp_wh_type;
wmsTransferOutstockH.erp_wh_type = input.warehouse_outstock;
List<WmsTransferOutstockD> wmsTransferOutstockDs = new List<WmsTransferOutstockD>();
foreach (var detail in input.details)
{

View File

@@ -138,6 +138,16 @@ namespace Tnb.WarehouseMgr
wmsOutinStockDetail.act_end_date = input.disTask.act_end_date;
wmsOutinStockDetail.pretask_code = input.disTask.pretask_code;
wmsOutinStockDetail.distask_code = input.disTask.bill_code;
wmsOutinStockDetail.create_time = DateTime.Now;
switch (input.disTask.biz_type)
{
case WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID:
{
wmsOutinStockDetail.source_detail_id = input.disTask.source_id;
wmsOutinStockDetail.source_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID;
break;
}
}
wmsOutinStockDetail.type = type;
List<BasMaterial> mats = await db.Queryable<BasMaterial>().Where(r => wmsCarryCodes.Select(x => x.material_id).Distinct().Contains(r.id)).ToListAsync();
@@ -187,7 +197,14 @@ namespace Tnb.WarehouseMgr
rows = await db.Insertable(wmsOutinStockCodes).ExecuteCommandAsync();
if (rows == 0)
{
throw new Exception($"插入出入库明细条码失败!");
if (wmsCarryCodes.Count == 0)
{
Logger.LogWarning("空载具无需插入出入库明细条码");
}
else
{
throw new Exception($"插入出入库明细条码失败!");
}
}
await db.Ado.CommitTranAsync();
}

View File

@@ -397,6 +397,7 @@ namespace Tnb.WarehouseMgr
var billCode = input.data.ContainsKey(nameof(WmsPurchaseH.bill_code)) ? input.data[nameof(WmsPurchaseH.bill_code)] : null;
string bill_type = "";
string required_type = (await _dbScanInStockByRedis.Queryable<WmsTempCode>().FirstAsync(it => it.barcode == input.data["物料条码"])).required_type;
string source_id = (await _dbScanInStockByRedis.Queryable<WmsTempCode>().FirstAsync(it => it.barcode == input.data["物料条码"])).require_id;
switch (required_type)
{
case WmsWareHouseConst.BILLTYPE_PURCHASE_ID:
@@ -581,6 +582,7 @@ namespace Tnb.WarehouseMgr
area_code = it.Key,
require_id = instock.id,
require_code = instock.bill_code,
source_id = source_id,
create_id = _userManager.User == null ? "" : _userManager.UserId!,
create_time = DateTime.Now,
priority = WmsWareHouseConst.priority_instock

View File

@@ -1,6 +1,6 @@
{
"AgvRequestUrls": {
"CreateTaskChainUrl": "http://10.147.19.104:5013/api/task-chain/create",
"CreateTaskChainUrl": "http://192.168.11.104:1880/api/task-chain/create",
"CancelTaskChainUrl": "http://192.168.11.104:1880/api/task-chain/cancel"
}
}