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

This commit is contained in:
2024-10-15 17:28:50 +08:00
15 changed files with 262 additions and 35 deletions

View File

@@ -1947,14 +1947,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
// 上下升降机生成预任务(补充料架、上升降机取货到料架、上升降机满托运走,下升降机拿货到输送线、下升降机空托运走)
private async Task<bool> createPretask(string startlocation_id, string endlocation_id, string carry_id, string carry_code, ILogger logger, ISqlSugarClient dbConn, string biz_type = "", string source_id = "", string require_id = "")
private async Task<bool> createPretask(string startlocation_id, string endlocation_id, string carry_id, string carry_code, ILogger logger, ISqlSugarClient dbConn, string biz_type = "", string source_id = "", string require_id = "", string task_type = "")
{
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
commonCreatePretaskInput.startlocation_id = startlocation_id;
commonCreatePretaskInput.endlocation_id = endlocation_id;
commonCreatePretaskInput.carry_id = carry_id;
commonCreatePretaskInput.carry_code = carry_code;
commonCreatePretaskInput.task_type = WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID;
commonCreatePretaskInput.task_type = task_type ?? WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID;
commonCreatePretaskInput.biz_type = biz_type;
commonCreatePretaskInput.require_id = require_id;
commonCreatePretaskInput.source_id = source_id;
@@ -2378,7 +2378,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
//锁定终点库位
await db_Floor4DMJ2MJX.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == endlocation.id).ExecuteCommandAsync();
bool result_createPretask = await createPretask(wmsCarryH.location_id, endlocation.id, wmsCarryH.id, wmsCarryH.carry_code, LoggerFloor4DMJ2MJX, db_Floor4DMJ2MJX);
bool result_createPretask = await createPretask(wmsCarryH.location_id, endlocation.id, wmsCarryH.id, wmsCarryH.carry_code, LoggerFloor4DMJ2MJX, db_Floor4DMJ2MJX, WmsWareHouseConst.BIZTYPE_YRPS_ID, "","", WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID);
if (!result_createPretask)
{
LoggerFloor4DMJ2MJX.LogWarning($"【四楼待灭菌仓到灭菌线】 {wmsCarryH.location_code} 到 {endlocation.location_code} 预任务生成失败");
@@ -2771,7 +2771,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
//锁定终点库位
await db_F2KTPsupplement.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == endlocation.id).ExecuteCommandAsync();
bool result_createPretask = await createPretask(wmsCarryH.location_id, endlocation.id, wmsCarryH.id, wmsCarryH.carry_code, LoggerF2KTPsupplement, db_F2KTPsupplement);
bool result_createPretask = await createPretask(wmsCarryH.location_id, endlocation.id, wmsCarryH.id, wmsCarryH.carry_code, LoggerF2KTPsupplement, db_F2KTPsupplement, WmsWareHouseConst.BIZTYPE_ZDBKT_ID, "", "", WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID);
if (!result_createPretask)
{
LoggerF2KTPsupplement.LogWarning($"【二楼空托盘自动补充到线边】 {wmsCarryH.location_code} 到 {endlocation.location_code} 预任务生成失败");

View File

@@ -423,6 +423,15 @@ namespace Tnb.WarehouseMgr.Entities.Consts
/// </summary>
public const string BIZTYPE_WMSSTERILIZATIONINSTOCKCH_ID = "36318871067413";
/// <summary>
/// 预任务生成业务类型-预热配送
/// </summary>
public const string BIZTYPE_YRPS_ID = "37578970466581";
/// <summary>
/// 预任务生成业务类型-自动补空托
/// </summary>
public const string BIZTYPE_ZDBKT_ID = "37578979192341";
/// <summary>
/// 条码打印状态-已完成
/// </summary>

View File

@@ -160,4 +160,9 @@ public partial class WmsPurchaseD : BaseEntity<string>
/// </summary>
public string? production_unit { get; set; }
/// <summary>
///
/// </summary>
public DateTime? warehousing_time { get; set; }
}

View File

@@ -69,6 +69,16 @@ public partial class WmsSortingtask : BaseEntity<string>
/// </summary>
public DateTime create_time { get; set; } = DateTime.Now;
/// <summary>
/// 转移托盘
/// </summary>
public int? change_carry { get; set; }
/// <summary>
/// 新托盘
/// </summary>
public string? new_carrycode { get; set; }
/// <summary>
/// 来源单据id
/// </summary>
@@ -91,4 +101,8 @@ public partial class WmsSortingtask : BaseEntity<string>
[SugarColumn(IsIgnore = true)]
public string erp_bill_code { get; set; }
[SugarColumn(IsIgnore = true)]
public string container_no { get; set; }
}

View File

@@ -46,6 +46,10 @@ namespace Tnb.WarehouseMgr
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public static SemaphoreSlim s_elevatorStatusSemaphore = new(1);
/// <summary>
/// 物料签收
/// </summary>
public static SemaphoreSlim s_MaterialSignSemaphore = new(1);
/// <summary>
/// 原材料
/// </summary>

View File

@@ -440,7 +440,18 @@ namespace Tnb.WarehouseMgr
wmsPurchaseOrderD.material_specification = material.material_specification;
wmsPurchaseOrderD.material_standard = material.material_standard;
}
wmsPurchaseOrderD.auxprop_gys = detail.auxprop_gys;
var gys_erpExtendField = await db.Queryable<ErpExtendField>().Where(a => a.supplier_id == detail.auxprop_gys).FirstAsync();
if (gys_erpExtendField != null)
{
wmsPurchaseOrderD.auxprop_gys = gys_erpExtendField.table_id;
}
else
{
_LoggerErp2Mes.LogWarning($@"【PurchaseOrder】表体明细中组织{detail.auxprop_gys}在wms系统中未找到");
throw new AppFriendlyException($@"表体明细中组织{detail.auxprop_gys}在wms系统中未找到", 500);
}
wmsPurchaseOrderDs.Add(wmsPurchaseOrderD);
}
@@ -650,7 +661,18 @@ namespace Tnb.WarehouseMgr
wmsOutsourceOrderD.matcode_id = material.id;
wmsOutsourceOrderD.matspecification = material.material_specification;
}
wmsOutsourceOrderD.auxprop_gys = detail.auxprop_gys;
var gys_erpExtendField = await db.Queryable<ErpExtendField>().Where(a => a.supplier_id == detail.auxprop_gys).FirstAsync();
if (gys_erpExtendField != null)
{
wmsOutsourceOrderD.auxprop_gys = gys_erpExtendField.table_id;
}
else
{
_LoggerErp2Mes.LogWarning($@"【OutsourceOrder】表体明细中组织{detail.auxprop_gys}在wms系统中未找到");
throw new AppFriendlyException($@"表体明细中组织{detail.auxprop_gys}在wms系统中未找到", 500);
}
wmsOutsourceOrderDs.Add(wmsOutsourceOrderD);
}
@@ -1351,7 +1373,18 @@ namespace Tnb.WarehouseMgr
wmsSaleD.material_specification = material.material_specification;
}
wmsSaleD.auxprop = detail.auxprop;
wmsSaleD.auxprop_gys = detail.auxprop_gys;
var gys_erpExtendField = await db.Queryable<ErpExtendField>().Where(a => a.supplier_id == detail.auxprop_gys).FirstAsync();
if (gys_erpExtendField != null)
{
wmsSaleD.auxprop_gys = gys_erpExtendField.table_id;
}
else
{
_LoggerErp2Mes.LogWarning($@"【MaterialTransfer】表体明细中组织{detail.auxprop_gys}在wms系统中未找到");
throw new AppFriendlyException($@"表体明细中组织{detail.auxprop_gys}在wms系统中未找到", 500);
}
wmsSaleD.auxprop_xph = detail.auxprop_xph;
wmsSaleDs.Add(wmsSaleD);
}
@@ -1557,7 +1590,17 @@ namespace Tnb.WarehouseMgr
msRawmatTransferinstockD.matspecification = material.material_specification;
}
msRawmatTransferinstockD.auxprop = detail.auxprop;
msRawmatTransferinstockD.auxprop_gys = detail.auxprop_gys;
var gys_erpExtendField = await db.Queryable<ErpExtendField>().Where(a => a.supplier_id == detail.auxprop_gys).FirstAsync();
if (gys_erpExtendField != null)
{
msRawmatTransferinstockD.auxprop_gys = gys_erpExtendField.table_id;
}
else
{
_LoggerErp2Mes.LogWarning($@"【TransferOutstock】表体明细中组织{detail.auxprop_gys}在wms系统中未找到");
throw new AppFriendlyException($@"表体明细中组织{detail.auxprop_gys}在wms系统中未找到", 500);
}
msRawmatTransferinstockD.auxprop_xph = detail.auxprop_xph;
wmsRawmatTransferinstockDs.Add(msRawmatTransferinstockD);
}
@@ -1630,7 +1673,17 @@ namespace Tnb.WarehouseMgr
wmsTransferInstockD.material_desc = material.material_specification;
}
wmsTransferInstockD.auxprop = detail.auxprop;
wmsTransferInstockD.auxprop_gys = detail.auxprop_gys;
var gys_erpExtendField = await db.Queryable<ErpExtendField>().Where(a => a.supplier_id == detail.auxprop_gys).FirstAsync();
if (gys_erpExtendField != null)
{
wmsTransferInstockD.auxprop_gys = gys_erpExtendField.table_id;
}
else
{
_LoggerErp2Mes.LogWarning($@"【TransferOutstock】表体明细中组织{detail.auxprop_gys}在wms系统中未找到");
throw new AppFriendlyException($@"表体明细中组织{detail.auxprop_gys}在wms系统中未找到", 500);
}
wmsTransferInstockD.auxprop_xph = detail.auxprop_xph;
wmsTransferInstockDs.Add(wmsTransferInstockD);
@@ -1840,7 +1893,18 @@ namespace Tnb.WarehouseMgr
wmsPackInstockD.material_code = material.code;
wmsPackInstockD.material_desc = material.material_specification;
}
wmsPackInstockD.auxprop_gys = detail.auxprop_gys;
var gys_erpExtendField = await db.Queryable<ErpExtendField>().Where(a => a.supplier_id == detail.auxprop_gys).FirstAsync();
if (gys_erpExtendField != null)
{
wmsPackInstockD.auxprop_gys = gys_erpExtendField.table_id;
}
else
{
_LoggerErp2Mes.LogWarning($@"【TransferOutstock】表体明细中组织{detail.auxprop_gys}在wms系统中未找到");
throw new AppFriendlyException($@"表体明细中组织{detail.auxprop_gys}在wms系统中未找到", 500);
}
wmsPackInstockD.auxprop_xph = detail.auxprop_xph;
wmsPackInstockDs.Add(wmsPackInstockD);
@@ -2305,7 +2369,17 @@ namespace Tnb.WarehouseMgr
wmsRawmatOutstockD.material_specification = material.material_specification;
}
wmsRawmatOutstockD.auxprop = detail.auxprop;
wmsRawmatOutstockD.auxprop_gys = detail.auxprop_gys;
var gys_erpExtendField = await db.Queryable<ErpExtendField>().Where(a => a.supplier_id == detail.auxprop_gys).FirstAsync();
if (gys_erpExtendField != null)
{
wmsRawmatOutstockD.auxprop_gys = gys_erpExtendField.table_id;
}
else
{
_LoggerErp2Mes.LogWarning($@"【TransferOrder】表体明细中组织{detail.auxprop_gys}在wms系统中未找到");
throw new AppFriendlyException($@"表体明细中组织{detail.auxprop_gys}在wms系统中未找到", 500);
}
wmsRawmatOutstockD.auxprop_xph = detail.auxprop_xph;
wmsRawmatOutstockDs.Add(wmsRawmatOutstockD);
}
@@ -2438,7 +2512,18 @@ namespace Tnb.WarehouseMgr
}
wmsRawmatOutstockD.auxprop = detail.auxprop;
wmsRawmatOutstockD.auxprop_gys = detail.auxprop_gys;
var gys_erpExtendField = await db.Queryable<ErpExtendField>().Where(a => a.supplier_id == detail.auxprop_gys).FirstAsync();
if (gys_erpExtendField != null)
{
wmsRawmatOutstockD.auxprop_gys = gys_erpExtendField.table_id;
}
else
{
_LoggerErp2Mes.LogWarning($@"【TransferOrder】表体明细中组织{detail.auxprop_gys}在wms系统中未找到");
throw new AppFriendlyException($@"表体明细中组织{detail.auxprop_gys}在wms系统中未找到", 500);
}
wmsRawmatOutstockD.auxprop_xph = detail.auxprop_xph;
wmsRawmatOutstockDs.Add(wmsRawmatOutstockD);
}
@@ -2600,7 +2685,17 @@ namespace Tnb.WarehouseMgr
throw new AppFriendlyException($@"表体明细中单位{detail.unit_code}在wms系统中未找到", 500);
}
wmsInventorycheckD.auxprop = detail.auxprop;
wmsInventorycheckD.auxprop_gys = detail.auxprop_gys;
var gys_erpExtendField = await db.Queryable<ErpExtendField>().Where(a => a.supplier_id == detail.auxprop_gys).FirstAsync();
if (gys_erpExtendField != null)
{
wmsInventorycheckD.auxprop_gys = gys_erpExtendField.table_id;
}
else
{
_LoggerErp2Mes.LogWarning($@"【Inventorycheck】表体明细中组织{detail.auxprop_gys}在wms系统中未找到");
throw new AppFriendlyException($@"表体明细中组织{detail.auxprop_gys}在wms系统中未找到", 500);
}
wmsInventorycheckD.auxprop_xph = detail.auxprop_xph;
wmsInventorycheckDs.Add(wmsInventorycheckD);
}

View File

@@ -2,6 +2,7 @@
using JNPF.Common.Extension;
using JNPF.Common.Filter;
using JNPF.Common.Security;
using JNPF.Systems.Entitys.System;
using JNPF.VisualDev;
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
using Mapster;
@@ -59,14 +60,15 @@ namespace Tnb.WarehouseMgr
.LeftJoin<WmsCarrystd>((a, b, c, d) => d.id == b.carrystd_id)
.LeftJoin<WmsCarryCode>((a, b, c, d, e) => e.carry_id == b.id)
.LeftJoin<BasMaterial>((a, b, c, d, e, f) => f.id == e.material_id)
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f, g) => g.EnCode == f.unit_id && g.DictionaryTypeId == WmsWareHouseConst.UNITTYPEID)
.Where((a, b, c, d, e) => ((!string.IsNullOrEmpty(b.carry_code) && b.carry_status != "0" && b.carry_status != "6") || string.IsNullOrEmpty(b.carry_code)))
.WhereIF(!string.IsNullOrEmpty(warehouse_id), (a, b, c, d) => c.id == warehouse_id)
.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.material_standard.Contains(container_no))
.OrderByDescending((a, b, c, d, e, f) => b.carry_code)
.Select((a, b, c, d, e, f) => new WmsCarryStockReport
//.OrderByDescending((a, b, c, d, e, f) => b.carry_code)
.Select((a, b, c, d, e, f, g) => new WmsCarryStockReport
{
warehouse_name = c.whname,
carry_id = b.id,
@@ -86,7 +88,7 @@ namespace Tnb.WarehouseMgr
material_name = f.name,
material_specification = f.material_specification,
container_no = f.material_standard,
unit = e.unit_id,
unit = g.FullName,
creator = e.create_id,
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(""),
@@ -105,13 +107,14 @@ namespace Tnb.WarehouseMgr
.InnerJoin<WmsCarryCode>((a, b, c, d, e, f) => f.carry_id == e.membercarry_id)
.InnerJoin<BasMaterial>((a, b, c, d, e, f, g) => g.id == f.material_id)
.InnerJoin<WmsCarryH>((a, b, c, d, e, f, g, h) => h.id == e.membercarry_id)
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f, g,h,i) => i.EnCode == f.unit_id && i.DictionaryTypeId == WmsWareHouseConst.UNITTYPEID)
.Where((a, b, c, d, e) => b.carry_status != "0" && b.carry_status != "6")
.WhereIF(!string.IsNullOrEmpty(warehouse_id), (a, b, c, d) => c.id == warehouse_id)
.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.material_standard.Contains(container_no))
.Select((a, b, c, d, e, f, g, h) => new WmsCarryStockReport
.Select((a, b, c, d, e, f, g, h,i) => new WmsCarryStockReport
{
warehouse_name = c.whname,
carry_id = b.id,
@@ -133,7 +136,7 @@ namespace Tnb.WarehouseMgr
material_name = g.name,
material_specification = g.material_specification,
container_no = g.material_standard,
unit = f.unit_id,
unit = i.FullName,
creator = f.create_id,
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(""),

View File

@@ -86,6 +86,7 @@ namespace Tnb.WarehouseMgr
string msg = "成功";
try
{
await s_MaterialSignSemaphore.WaitAsync();
if (input == null)
{
throw new ArgumentNullException(nameof(input));
@@ -691,6 +692,10 @@ namespace Tnb.WarehouseMgr
await _db.Ado.RollbackTranAsync();
throw new AppFriendlyException($"【MaterialSign】物料签收失败 {ex.Message}", 500);
}
finally
{
s_MaterialSignSemaphore.Release();
}
return msg;
}

View File

@@ -265,7 +265,7 @@ namespace Tnb.WarehouseMgr
{
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 wmsOutsourceOrderD = wmsOutsourceOrderDs.Where(r => r.erp_line_pk == item.erp_outsource_order_d_pk).First();
wmsOutsourceOrderD.actual_quantity += outsource_arriveqty;
if (wmsOutsourceOrderD.actual_quantity > wmsOutsourceOrderD.outsource_quantity)
{

View File

@@ -426,9 +426,12 @@ namespace Tnb.WarehouseMgr
Logger.Error($"【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!");
throw new AppFriendlyException($"库位id {wmsCarryH.location_id}没有对应的库位基础资料!", 500);
}
if (location != null && location.region_id != WmsWareHouseConst.REGION_CPManualOutstock_ID)
if (location.is_type == "0")
{
throw new Exception($"托盘{wmsCarryH.carry_code}不在人工出库库位中,不能签收!");
if (location != null && location.region_id != WmsWareHouseConst.REGION_CPManualOutstock_ID)
{
throw new Exception($"托盘{wmsCarryH.carry_code}不在人工出库库位或者出入库库位中,不能签收!");
}
}
WmsDistaskH wmsDistaskH = _db.Queryable<WmsDistaskH>().Where(r => r.carry_code == input.carry_code && r.endlocation_id == location.id

View File

@@ -124,11 +124,19 @@ namespace Tnb.WarehouseMgr
//自制的采购入库 不在质检保存里调用erp接口
if (string.IsNullOrEmpty(wmsPurchaseH.erp_bill_code))
{
await _db.Updateable<WmsPurchaseD>()
.SetColumns(x => x.qc_res == qcRes)
.Where(x => x.id == id)
.ExecuteCommandAsync();
return "保存成功";
}
// 托盘对应入库单
List<WmsInstockH> instock_mains = await _db.Queryable<WmsInstockH>().Where(x => x.source_id == wmsPurchaseD.bill_id).ToListAsync();
if (instock_mains.Count == 0)
{
throw Oops.Bah("不存在此明细的入库记录!可能是入库任务还未执行完成或者物料是由人工入库");
}
List<WmsInstockD> allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => instock_mains.Select(r => r.id).Contains(it.bill_id) && it.material_id == wmsPurchaseD.material_id && it.code_batch == wmsPurchaseD.code_batch).OrderBy(x=>x.id).ToListAsync();

View File

@@ -135,10 +135,6 @@ namespace Tnb.WarehouseMgr
try
{
WmsPurchaseH wmsPurchaseH = await _db.Queryable<WmsPurchaseH>().Where(r => r.bill_code == input.bill_code).FirstAsync();
if (wmsPurchaseH.make_method == "自制")
{
throw Oops.Bah("自制采购收货单不能操作此按钮");
}
await _db.Ado.BeginTranAsync();
WmsInstockH? instock = null;
var purchaseDs = await PurchaseAndSaleUpdate(input);
@@ -203,16 +199,32 @@ namespace Tnb.WarehouseMgr
{
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)
if (wmsPurchaseOrderDs.Count > 0)
{
throw Oops.Bah($"采购订单明细行物料{wmsPurchaseOrderD.matcode} 批次{wmsPurchaseOrderD.code_batch} 到货数量不能超过采购数量!");
WmsPurchaseOrderD wmsPurchaseOrderD = wmsPurchaseOrderDs.Where(r => r.erp_line_pk == item.erp_purchase_order_d_pk).First();
wmsPurchaseOrderD.actual_quantity += purchase_arriveqty;
if (wmsPurchaseOrderD.actual_quantity > wmsPurchaseOrderD.purchase_quantity)
{
throw Oops.Bah($"采购订单明细行物料{wmsPurchaseOrderD.matcode} 批次{wmsPurchaseOrderD.code_batch} 到货数量不能超过采购数量!");
}
}
if (purchase_arriveqty > 0)
{
item.warehousing_time = DateTime.Now;
}
}
await _db.Updateable(dList).UpdateColumns(r => r.purchase_prqty).ExecuteCommandAsync();
await _db.Updateable(wmsPurchaseOrderDs).UpdateColumns(r => r.actual_quantity).ExecuteCommandAsync();
await _db.Updateable(dList).UpdateColumns(r => new { r.purchase_prqty, r.warehousing_time }).ExecuteCommandAsync();
if (wmsPurchaseOrderDs.Count > 0)
await _db.Updateable(wmsPurchaseOrderDs).UpdateColumns(r => r.actual_quantity).ExecuteCommandAsync();
if (wmsPurchaseH.make_method == "自制")
{
await _db.Ado.CommitTranAsync();
return await Task.FromResult(true);
}
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

@@ -475,13 +475,75 @@ namespace Tnb.WarehouseMgr
}
// 解锁分拣载具
await _db.Updateable<WmsCarryH>().SetColumns(r => r.is_lock == 0).Where(r => r.id == wmsSortingtask.carry_id).ExecuteCommandAsync();
// 扣减载具物料库存
await _db.Updateable<WmsCarryCode>().SetColumns(r => r.codeqty == r.codeqty - wmsSortingtask.qty).Where(r => r.carry_id == wmsSortingtask.carry_id).ExecuteCommandAsync();
if (input.change_carry == 0)
{
await _db.Updateable<WmsCarryCode>().SetColumns(r => r.codeqty == r.codeqty - wmsSortingtask.qty).Where(r => r.carry_id == wmsSortingtask.carry_id).ExecuteCommandAsync();
}
else
{
if (string.IsNullOrEmpty(input.new_carrycode))
{
throw new AppFriendlyException("转移托盘不能为空!", 500);
}
WmsCarryH wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.id == wmsSortingtask.carry_id).FirstAsync();
WmsCarryH new_wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.new_carrycode).FirstAsync();
if (wmsCarryH.carry_code == new_wmsCarryH.carry_code)
{
throw new AppFriendlyException($"转移托盘{new_wmsCarryH.carry_code}与原托盘不能相同!", 500);
}
if (new_wmsCarryH == null)
{
throw new AppFriendlyException($"转移托盘{new_wmsCarryH.carry_code}不存在!", 500);
}
new_wmsCarryH.is_lock = 0;
new_wmsCarryH.carry_status = "1";
new_wmsCarryH.location_id = wmsCarryH.location_id;
new_wmsCarryH.location_code = wmsCarryH.location_code;
wmsCarryH.location_id = "";
wmsCarryH.location_code = "";
List<WmsCarryCode> new_wmsCarryCodes = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == new_wmsCarryH.id).ToListAsync();
WmsCarryCode wmsCarryCode = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsSortingtask.carry_id).FirstAsync();
if (new_wmsCarryCodes.Count > 1)
{
throw new AppFriendlyException($"转移托盘{new_wmsCarryH.carry_code}上存在多条物料批次数据,请检查!", 500);
}
WmsCarryCode new_wmsCarryCode = wmsCarryCode.Adapt<WmsCarryCode>();
if (new_wmsCarryCodes.Count > 0)
{
if (new_wmsCarryCodes[0].material_id != wmsCarryCode.material_id || new_wmsCarryCodes[0].code_batch != wmsCarryCode.code_batch)
{
throw new AppFriendlyException($"转移托盘{new_wmsCarryH.carry_code}上的物料批次数据与分拣托盘上的物料批次数据不一致,不能转移!", 500);
}
new_wmsCarryCode = new_wmsCarryCodes[0];
new_wmsCarryCode.codeqty = wmsCarryCode.codeqty - wmsSortingtask.qty + new_wmsCarryCodes[0].codeqty;
await _db.Updateable(new_wmsCarryCode).UpdateColumns(r => new { r.codeqty }).ExecuteCommandAsync();
}
else
{
new_wmsCarryCode.id = SnowflakeIdHelper.NextId();
new_wmsCarryCode.carry_id = new_wmsCarryH.id;
new_wmsCarryCode.barcode = new_wmsCarryH.carry_code;
new_wmsCarryCode.codeqty = wmsCarryCode.codeqty - wmsSortingtask.qty;
await _db.Insertable(new_wmsCarryCode).ExecuteCommandAsync();
}
await _db.Updateable<WmsCarryCode>().SetColumns(r => r.codeqty == wmsSortingtask.qty).Where(r => r.carry_id == wmsSortingtask.carry_id).ExecuteCommandAsync();
await _db.Updateable(new_wmsCarryH).UpdateColumns(r => new { r.is_lock, r.carry_status, r.location_id, r.location_code }).ExecuteCommandAsync();
await _db.Updateable(wmsCarryH).UpdateColumns(r => new { r.location_id, r.location_code }).ExecuteCommandAsync();
}
await _db.Updateable<WmsSortingtask>().SetColumns(r => new WmsSortingtask
{
status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID,
complete_time = DateTime.Now
complete_time = DateTime.Now,
change_carry = input.change_carry,
new_carrycode = input.new_carrycode
}).Where(r => r.id == wmsSortingtask.id).ExecuteCommandAsync();
// 改为销售出库单
await _db.Updateable<WmsSaleD>().SetColumns(r => r.purchase_prqty == r.purchase_prqty + wmsSortingtask.qty).Where(r => r.id == wmsSortingtask.source_id).ExecuteCommandAsync();

View File

@@ -123,6 +123,7 @@ namespace Tnb.WarehouseMgr
material_code = c.code,
material_name = c.name,
material_specification = c.material_specification,
container_no = c.material_standard,
code_batch = b.code_batch,
erp_bill_code = e.erp_bill_code,
status = f.FullName

View File

@@ -2,6 +2,7 @@
using JNPF.Common.Extension;
using JNPF.Common.Filter;
using JNPF.Common.Security;
using JNPF.Systems.Entitys.System;
using JNPF.VisualDev;
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
using Mapster;
@@ -11,6 +12,7 @@ using Newtonsoft.Json.Linq;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Entity;
using Tnb.WarehouseMgr.Entities.Enums;
@@ -61,13 +63,14 @@ namespace Tnb.WarehouseMgr
.InnerJoin<BasMaterial>((a, b, c, d, e, f) => f.id == a.material_id)
.LeftJoin<WmsPurchaseD>((a, b, c, d, e, f, g) => e.require_id == g.id)
.LeftJoin<WmsPurchaseH>((a, b, c, d, e, f, g, h) => h.id == g.bill_id)
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f, g, h, i) => i.EnCode == f.unit_id && i.DictionaryTypeId == WmsWareHouseConst.UNITTYPEID)
.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.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())
.Select((a, b, c, d, e, f, g, h) => new WmsStockReportH
.Select((a, b, c, d, e, f, g, h, i) => new WmsStockReportH
{
org_id = e.org_id,
warehouse_id = c.wh_id,
@@ -84,6 +87,7 @@ namespace Tnb.WarehouseMgr
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,
unit_id = i.FullName,
}, true).ToListAsync();
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>()
@@ -134,6 +138,7 @@ namespace Tnb.WarehouseMgr
.InnerJoin<BasMaterial>((a, b, c, d, e, f) => f.id == a.material_id)
.LeftJoin<WmsPurchaseD>((a, b, c, d, e, f, g) => e.require_id == g.id)
.LeftJoin<WmsPurchaseH>((a, b, c, d, e, f, g, h) => h.id == g.bill_id)
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f, g, h, i) => i.EnCode == f.unit_id && i.DictionaryTypeId == WmsWareHouseConst.UNITTYPEID)
.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))
@@ -141,7 +146,7 @@ namespace Tnb.WarehouseMgr
.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())
.Select((a, b, c, d, e, f, g, h) => new WmsStockReportH
.Select((a, b, c, d, e, f, g, h, i) => new WmsStockReportH
{
org_id = e.org_id,
warehouse_id = c.wh_id,
@@ -158,6 +163,7 @@ namespace Tnb.WarehouseMgr
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,
unit_id = i.FullName,
}, true).ToListAsync();
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>()