Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutsourceD.cs
#	WarehouseMgr/Tnb.WarehouseMgr/WmsOutsourceService.cs
This commit is contained in:
2024-10-14 11:46:49 +08:00
16 changed files with 161 additions and 17 deletions

View File

@@ -3222,8 +3222,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
Floor4DMJ2MJXtimer = new Timer(Floor4DMJ2MJX, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
Floor4MJX2MJCtimer = new Timer(Floor4MJX2MJC, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
// 需求变更弃用
//Floor4DMC2CPKtimer = new Timer(Floor4DMC2CPK, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
Floor4DMC2CPKtimer = new Timer(Floor4DMC2CPK, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
F2KTPsupplementtimer = new Timer(F2KTPsupplement, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
YCLInternalTransfertimer = new Timer(YCLInternalTransfer, null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(185));

View File

@@ -9,5 +9,15 @@
/// 分拣任务id
/// </summary>
public string? source_id { get; set; }
/// <summary>
/// 转移托盘
/// </summary>
public int? change_carry { get; set; }
/// <summary>
/// 新托盘
/// </summary>
public string? new_carrycode { get; set; }
}
}

View File

@@ -55,6 +55,11 @@ namespace Tnb.WarehouseMgr.Entities.Dto
// 策略编号
public string PolicyCode { get; set; }
/// <summary>
/// 过滤质检结果
/// </summary>
public List<string> qcres_list { get; set; }
public ISqlSugarClient dbConn { get; set; } = null;
}
}

View File

@@ -130,4 +130,9 @@ public partial class WmsCarryCode : BaseEntity<string>, IWmsCarryEntity
/// 辅助属性(小批号)
/// </summary>
public string? auxprop_xph { get; set; }
/// <summary>
/// 质检结果
/// </summary>
public string? qc_res { get; set; }
}

View File

@@ -129,6 +129,20 @@ public partial class WmsCarryStockReport
/// 绑定时间
/// </summary>
public string? bind_time { get; set; }
/// <summary>
/// 质检结果
/// </summary>
public string qc_res { get; set; } = string.Empty;
/// <summary>
/// 辅助属性(供应商)
/// </summary>
public string? auxprop_gys { get; set; } = string.Empty;
/// <summary>
/// 辅助属性(小批号)
/// </summary>
public string? auxprop_xph { get; set; } = string.Empty;
}
@@ -273,6 +287,21 @@ public partial class WmsCarryStockReportCode
/// </summary>
public string? bind_time { get; set; }
/// <summary>
/// 辅助属性(供应商)
/// </summary>
public string? auxprop_gys { get; set; }
/// <summary>
/// 辅助属性(小批号)
/// </summary>
public string? auxprop_xph { get; set; }
/// <summary>
/// 质检结果
/// </summary>
public string? qc_res { get; set; }
}

View File

@@ -169,6 +169,11 @@ public partial class WmsOutsourceD : BaseEntity<string>
/// </summary>
public int? gift { get; set; }
/// <summary>
/// 本次收货数量
/// </summary>
public decimal? outsource_arriveqty { get; set; }
public string erp_outsource_order_d_pk { get; set; }
public string erp_outsource_order_d_lineno { get; set; }

View File

@@ -75,6 +75,20 @@ public partial class WmsStockReportH : BaseEntity<string>
/// </summary>
public string code_batch { get; set; } = string.Empty;
/// <summary>
/// 质检结果
/// </summary>
public string qc_res { get; set; } = string.Empty;
/// <summary>
/// 辅助属性(供应商)
/// </summary>
public string? auxprop_gys { get; set; } = string.Empty;
/// <summary>
/// 辅助属性(小批号)
/// </summary>
public string? auxprop_xph { get; set; } = string.Empty;
///// <summary>
///// 现有库存
///// </summary>

View File

@@ -577,7 +577,8 @@ namespace Tnb.WarehouseMgr
.AndIF(!string.IsNullOrEmpty(input.container_no), (a, b, c) => b.container_no == input.container_no)
.AndIF(!string.IsNullOrEmpty(input.carrystd_id), (a, b, c) => a.carrystd_id == input.carrystd_id)
.AndIF(input.AvoidBusyPassage, (a, b, c) => !busyPassages.Contains(c.passage))
.AndIF(!string.IsNullOrEmpty(input.Region_id), (a, b, c) => c.region_id == input.Region_id);
.AndIF(!string.IsNullOrEmpty(input.Region_id), (a, b, c) => c.region_id == input.Region_id)
.AndIF(input.qcres_list != null, (a, b, c) => input.qcres_list.Contains(b.qc_res));
if (input.filter_carry_status)
{
@@ -605,7 +606,6 @@ namespace Tnb.WarehouseMgr
.Select<WmsCarryH>()
.ToListAsync();
items = items.DistinctBy(r => r.id).ToList();
return input.Size > 0 ? items.Take(input.Size).ToList() : items;
}
@@ -4431,8 +4431,8 @@ namespace Tnb.WarehouseMgr
material_id = input.material_id,
code_batch = input.code_batch,
Size = 100,
Region_id = WmsWareHouseConst.REGION_Purchase_ID,
PolicyCode = WmsWareHouseConst.POLICY_YCLOUTSTOCK
PolicyCode = WmsWareHouseConst.POLICY_YCLOUTSTOCK,
qcres_list = new List<string>() { "vergeOk", "ok" }
};
List<WmsCarryH> items = await OutStockStrategy(outStockStrategyInput);

View File

@@ -64,7 +64,7 @@ namespace Tnb.WarehouseMgr
.WhereIF(!string.IsNullOrEmpty(carry_code), (a, b, c, d) => b.carry_code.Contains(carry_code))
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e, f) => f.code.Contains(material_code))
.WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f) => e.code_batch.Contains(code_batch))
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f) => f.container_no.Contains(container_no))
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f) => f.material_standard.Contains(container_no))
.OrderByDescending((a, b, c, d, e, f) => b.carry_code)
.Select((a, b, c, d, e, f) => new WmsCarryStockReport
{
@@ -88,7 +88,10 @@ namespace Tnb.WarehouseMgr
container_no = f.material_standard,
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") : ""
bind_time = e.create_time != null ? e.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
qc_res = SqlFunc.IF(e.qc_res.Equals("await") || string.IsNullOrEmpty(e.qc_res)).Return("待检").ElseIF(e.qc_res.Equals("vergeOk")).Return("让步接收").ElseIF(e.qc_res.Equals("ok")).Return("合格").ElseIF(e.qc_res.Equals("no")).Return("不合格").End(""),
auxprop_gys = e.auxprop_gys,
auxprop_xph = e.auxprop_xph,
})
.OrderBy((a) => a.location_code)
.ToListAsync();
@@ -107,7 +110,7 @@ namespace Tnb.WarehouseMgr
.WhereIF(!string.IsNullOrEmpty(carry_code), (a, b, c, d, e, f, g, h) => b.carry_code.Contains(carry_code) || h.carry_code.Contains(carry_code))
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e, f, g) => g.code.Contains(material_code))
.WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f, g) => f.code_batch.Contains(code_batch))
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f, g) => g.container_no.Contains(container_no))
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f, g) => g.material_standard.Contains(container_no))
.Select((a, b, c, d, e, f, g, h) => new WmsCarryStockReport
{
warehouse_name = c.whname,
@@ -132,7 +135,10 @@ namespace Tnb.WarehouseMgr
container_no = g.material_standard,
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") : ""
bind_time = f.create_time != null ? f.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
qc_res = SqlFunc.IF(f.qc_res.Equals("await") || string.IsNullOrEmpty(f.qc_res)).Return("待检").ElseIF(f.qc_res.Equals("vergeOk")).Return("让步接收").ElseIF(f.qc_res.Equals("ok")).Return("合格").ElseIF(f.qc_res.Equals("no")).Return("不合格").End(""),
auxprop_gys = f.auxprop_gys,
auxprop_xph = f.auxprop_xph,
})
.OrderBy((a) => a.location_code)
.ToListAsync();
@@ -170,6 +176,9 @@ namespace Tnb.WarehouseMgr
wmsCarryStockReportCode.unit = x.unit;
wmsCarryStockReportCode.material_specification = x.material_specification;
wmsCarryStockReportCode.container_no = x.container_no;
wmsCarryStockReportCode.qc_res = x.qc_res;
wmsCarryStockReportCode.auxprop_gys = x.auxprop_gys;
wmsCarryStockReportCode.auxprop_xph = x.auxprop_xph;
//wmsCarryStockReportCode.创建用户 = x.操作用户;
wmsCarryStockReportCode.bind_time = x.bind_time;

View File

@@ -248,7 +248,8 @@ namespace Tnb.WarehouseMgr
material_id = input.material_id,
code_batch = input.code_batch,
Size = input.palletCount,
PolicyCode = WmsWareHouseConst.POLICY_YCLOUTSTOCK
PolicyCode = WmsWareHouseConst.POLICY_YCLOUTSTOCK,
qcres_list = new List<string>() { "vergeOk", "ok" }
};
List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(outStockStrategyInput);
@@ -362,7 +363,8 @@ namespace Tnb.WarehouseMgr
material_id = wmsMaterialTransferD.material_id,
code_batch = input.code_batch,
Size = input.palletCount,
PolicyCode = WmsWareHouseConst.POLICY_YCLOUTSTOCK
PolicyCode = WmsWareHouseConst.POLICY_YCLOUTSTOCK,
qcres_list = new List<string>() { "vergeOk", "ok" }
};
List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(outStockStrategyInput);
@@ -2367,6 +2369,13 @@ namespace Tnb.WarehouseMgr
{
WmsCarryH wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).FirstAsync();
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID).First();
if (wmsPretaskH != null)
{
Logger.LogWarning($"【RackInstock】此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}");
throw new AppFriendlyException($"此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}", 500);
}
// 料架到暂存仓
if (wmsCarryH.carrystd_id == "26037267399717")
{

View File

@@ -208,7 +208,7 @@ namespace Tnb.WarehouseMgr
.Where(x => x.id == item.outsource_order_d_id)
.ExecuteCommandAsync();
}
List<WmsInstockD> instockDs = new();
if (purchaseDs?.Count > 0)
{
@@ -251,7 +251,29 @@ namespace Tnb.WarehouseMgr
}
await _db.Insertable(instockDs).ExecuteCommandAsync();
List<WmsOutsourceD> dList = input.details;
List<WmsOutsourceD> dList = await _db.Queryable<WmsOutsourceD>().Where(x => x.fk_wms_outsource_order_id == purchaseDs.First().fk_wms_outsource_order_id).OrderBy(x => x.id).ToListAsync();
List<WmsOutsourceOrderD> wmsOutsourceOrderDs = await _db.Queryable<WmsOutsourceOrderD>().Where(r => dList.Select(x => x.erp_outsource_order_d_pk).Contains(r.erp_line_pk)).OrderBy(x => x.id).ToListAsync();
foreach (var item in dList)
{
decimal? outsource_arriveqty = input.details.Where(r => r.id == item.id).ToList()[0].outsource_arriveqty;
item.actual_quantity += outsource_arriveqty;
if (item.actual_quantity > item.outsource_quantity)
{
throw Oops.Bah($"委外收货单明细行物料{item.matcode} 批次{item.code_batch} 到货数量不能超过采购数量!");
}
WmsOutsourceOrderD wmsOutsourceOrderD = wmsOutsourceOrderDs.Where(r => r.erp_line_pk == item.erp_outsource_order_d_pk).ToList()[0];
wmsOutsourceOrderD.actual_quantity += outsource_arriveqty;
if (wmsOutsourceOrderD.actual_quantity > wmsOutsourceOrderD.outsource_quantity)
{
throw Oops.Bah($"采购订单明细行物料{wmsOutsourceOrderD.matcode} 批次{wmsOutsourceOrderD.code_batch} 到货数量不能超过采购数量!");
}
}
await _db.Updateable(dList).UpdateColumns(r => r.actual_quantity).ExecuteCommandAsync();
await _db.Updateable(wmsOutsourceOrderDs).UpdateColumns(r => r.actual_quantity).ExecuteCommandAsync();
List<String> materialIds = purchaseDs.Select(x => x.matcode_id).Distinct().ToList();
List<String> unitCodes = purchaseDs.Select(x => x.unit_id).Distinct().ToList();
List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
@@ -331,6 +353,7 @@ namespace Tnb.WarehouseMgr
// ["nastnum"] = item.purchase_arriveqty,
["nnum"] = item.bind_qty,
// ["nplanastnum"] = 0,
["nplannum"] = item.outsource_arriveqty,
["nplannum"] = item.outsource_quantity,
["pk_apfinanceorg"] = erpOrg.corpoid,
["pk_apfinanceorg_v"] = erpOrg.corpvid,

View File

@@ -88,7 +88,7 @@ namespace Tnb.WarehouseMgr
x.purchase_arriveqty = 0;
});
await _db.Updateable(purchaseDs).UpdateColumns(it => new { it.purchase_prqty, it.line_status }).ExecuteCommandAsync();
await _db.Updateable(purchaseDs).UpdateColumns(it => new { it.line_status }).ExecuteCommandAsync();
if (purchaseDs.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
{

View File

@@ -110,6 +110,14 @@ namespace Tnb.WarehouseMgr
wmsPurchaseQcrecord.result = qcRes;
await _db.Insertable(wmsPurchaseQcrecord).ExecuteCommandAsync();
List<WmsCarryCode> wmscarrycodes = await _db.Queryable<WmsCarryCode>()
.InnerJoin<WmsTempCode>((a, b) => a.barcode == b.barcode)
.InnerJoin<WmsPurchaseD>((a, b, c) => c.id == b.require_id)
.Where((a, b, c) => c.id == wmsPurchaseD.id).ToListAsync();
foreach (var item in wmscarrycodes)
item.qc_res = qcRes;
await _db.Updateable(wmscarrycodes).UpdateColumns(r => r.qc_res).ExecuteCommandAsync();
}
#endregion

View File

@@ -40,6 +40,7 @@ using JNPF.VisualDev.Entitys;
using Tnb.BasicData.Interfaces;
using JNPF.Common.Enums;
using System.Reflection;
using Aop.Api.Domain;
namespace Tnb.WarehouseMgr
{
@@ -192,6 +193,26 @@ namespace Tnb.WarehouseMgr
List<WmsPurchaseD> dList = await _db.Queryable<WmsPurchaseD>().Where(x=>x.bill_id==purchaseDs.First().bill_id).OrderBy(x=>x.id).ToListAsync();
List<WmsPurchaseOrderD> wmsPurchaseOrderDs = await _db.Queryable<WmsPurchaseOrderD>().Where(r => dList.Select(x => x.erp_purchase_order_d_pk).Contains(r.erp_line_pk)).OrderBy(x => x.id).ToListAsync();
foreach (var item in dList)
{
decimal purchase_arriveqty = input.details.Where(r => r.id == item.id).ToList()[0].purchase_arriveqty;
item.purchase_prqty += purchase_arriveqty;
if (item.purchase_prqty > item.purchase_qty)
{
throw Oops.Bah($"采购收货单明细行物料{item.material_code} 批次{item.code_batch} 到货数量不能超过采购数量!");
}
WmsPurchaseOrderD wmsPurchaseOrderD = wmsPurchaseOrderDs.Where(r => r.erp_line_pk == item.erp_purchase_order_d_pk).ToList()[0];
wmsPurchaseOrderD.actual_quantity += purchase_arriveqty;
if (wmsPurchaseOrderD.actual_quantity > wmsPurchaseOrderD.purchase_quantity)
{
throw Oops.Bah($"采购订单明细行物料{wmsPurchaseOrderD.matcode} 批次{wmsPurchaseOrderD.code_batch} 到货数量不能超过采购数量!");
}
}
await _db.Updateable(dList).UpdateColumns(r => r.purchase_prqty).ExecuteCommandAsync();
await _db.Updateable(wmsPurchaseOrderDs).UpdateColumns(r => r.actual_quantity).ExecuteCommandAsync();
List<String> materialIds = purchaseDs.Select(x=>x.material_id).Distinct().ToList();
List<String> unitCodes = purchaseDs.Select(x => x.unit_id).Distinct().ToList();
List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()

View File

@@ -543,6 +543,7 @@ namespace Tnb.WarehouseMgr
WmsSaleH newWmsSaleH = wmsSaleHs[0].Adapt<WmsSaleH>();
newWmsSaleH.id = SnowflakeIdHelper.NextId();
newWmsSaleH.bill_code = Code;
newWmsSaleH.erp_pk = string.Join(",", wmsSaleHs.Select(x => x.erp_pk));
newWmsSaleH.erp_bill_code = string.Join(",", wmsSaleHs.Select(x => x.erp_bill_code));
newWmsSaleH.customer_id = string.Join(",", wmsSaleHs.Select(x => x.customer_id));
newWmsSaleH.customer_code = string.Join(",", wmsSaleHs.Select(x => x.customer_code));

View File

@@ -63,7 +63,7 @@ namespace Tnb.WarehouseMgr
.LeftJoin<WmsPurchaseH>((a, b, c, d, e, f, g, h) => h.id == g.bill_id)
.WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d, e, f) => f.material_specification.Contains(material_specification))
.WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f) => a.code_batch.Contains(code_batch))
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f) => f.container_no.Contains(container_no))
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f) => f.material_standard.Contains(container_no))
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e, f) => f.code.Contains(material_code))
.WhereIF(!string.IsNullOrEmpty(warehouse_id), (a, b, c, d, e, f) => c.wh_id == warehouse_id)
.Where((a, b, c, d, e, f) => c.is_type == ((int)EnumLocationType.).ToString())
@@ -81,6 +81,9 @@ namespace Tnb.WarehouseMgr
code_batch = a.code_batch,
supplier_code = "",
supplier_name = "",
qc_res = SqlFunc.IF(a.qc_res.Equals("await") || string.IsNullOrEmpty(a.qc_res)).Return("待检").ElseIF(a.qc_res.Equals("vergeOk")).Return("让步接收").ElseIF(a.qc_res.Equals("ok")).Return("合格").ElseIF(a.qc_res.Equals("no")).Return("不合格").End(""),
auxprop_gys = a.auxprop_gys,
auxprop_xph = a.auxprop_xph,
}, true).ToListAsync();
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>()
@@ -134,7 +137,7 @@ namespace Tnb.WarehouseMgr
.WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d, e, f) => f.material_specification.Contains(material_specification))
.WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f) => a.code_batch.Contains(code_batch))
.WhereIF(!string.IsNullOrEmpty(supplier_code), (a, b, c, d, e, f, g, h) => h.supplier_code.Contains(supplier_code))
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f, g, h) => f.container_no.Contains(container_no))
.WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f, g, h) => f.material_standard.Contains(container_no))
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e, f) => f.code.Contains(material_code))
.WhereIF(!string.IsNullOrEmpty(warehouse_id), (a, b, c, d, e, f) => c.wh_id == warehouse_id)
.Where((a, b, c, d, e, f) => c.is_type == ((int)EnumLocationType.).ToString())
@@ -152,6 +155,9 @@ namespace Tnb.WarehouseMgr
code_batch = a.code_batch,
supplier_code = h.supplier_code,
supplier_name = h.supplier_name,
qc_res = SqlFunc.IF(a.qc_res.Equals("await") || string.IsNullOrEmpty(a.qc_res)).Return("待检").ElseIF(a.qc_res.Equals("vergeOk")).Return("让步接收").ElseIF(a.qc_res.Equals("ok")).Return("合格").ElseIF(a.qc_res.Equals("no")).Return("不合格").End(""),
auxprop_gys = a.auxprop_gys,
auxprop_xph = a.auxprop_xph,
}, true).ToListAsync();
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>()