erp仓库映射关系、erp同步完善、库存报表添加箱号 批次号查询;载具库存报表添加箱号 批次号查询
This commit is contained in:
@@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.OpenXmlFormats;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
@@ -295,7 +296,6 @@ namespace Tnb.WarehouseMgr
|
||||
await db.Insertable(WmsInstockDs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 采购订单
|
||||
/// </summary>
|
||||
@@ -345,6 +345,7 @@ namespace Tnb.WarehouseMgr
|
||||
wmsPurchaseOrderH.erp_pk = input.erp_pk;
|
||||
wmsPurchaseOrderH.create_id = WmsWareHouseConst.ErpUserId;
|
||||
wmsPurchaseOrderH.create_time = DateTime.Now;
|
||||
wmsPurchaseOrderH.erp_wh_type = input.erp_wh_type;
|
||||
var supplier = await db.Queryable<BasSupplier>().Where(p => p.supplier_code == input.supplier_code).FirstAsync();
|
||||
if (supplier != null)
|
||||
{
|
||||
@@ -354,7 +355,6 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
await db.Insertable(wmsPurchaseOrderH).ExecuteCommandAsync();
|
||||
|
||||
|
||||
List<WmsPurchaseOrderD> wmsPurchaseOrderDs = new List<WmsPurchaseOrderD>();
|
||||
foreach (var detail in input.details)
|
||||
{
|
||||
@@ -374,7 +374,6 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($@"表体明细中单位{detail.unit_code}在wms系统中未找到!", 500);
|
||||
}
|
||||
|
||||
|
||||
wmsPurchaseOrderD.purchase_quantity = detail.purchase_quantity;
|
||||
wmsPurchaseOrderD.stock_location = detail.stock_location;
|
||||
wmsPurchaseOrderD.code_batch = detail.code_batch;
|
||||
@@ -882,7 +881,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;
|
||||
await db.Insertable(wmsRawmatTransferinstockH).ExecuteCommandAsync();
|
||||
|
||||
List<WmsRawmatTransferinstockD> wmsRawmatTransferinstockDs = new List<WmsRawmatTransferinstockD>();
|
||||
@@ -980,11 +979,20 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||
}
|
||||
|
||||
BasWarehouse warehouse_outstock = await db.Queryable<BasWarehouse>().Where(r => r.whcode == input.warehouse_outstock).FirstAsync();
|
||||
WmsErpWarehouserelaH wmsErpWarehouserelaH = await db.Queryable<WmsErpWarehouserelaH>().Where(r => r.erp_warehousecode == input.erp_wh_type).FirstAsync();
|
||||
if (wmsErpWarehouserelaH == null)
|
||||
{
|
||||
_LoggerErp2Mes.LogWarning($@"【TransferOrder】不存在erp仓库类型{input.erp_wh_type}对应wms系统的映射关系!");
|
||||
throw new AppFriendlyException($@"不存在erp仓库类型{input.erp_wh_type}对应wms系统的映射关系!", 500);
|
||||
}
|
||||
|
||||
string warehouse_outstock_code = wmsErpWarehouserelaH.wms_warehousecode;
|
||||
|
||||
BasWarehouse warehouse_outstock = await db.Queryable<BasWarehouse>().Where(r => r.whcode == warehouse_outstock_code).FirstAsync();
|
||||
if (warehouse_outstock == null)
|
||||
{
|
||||
_LoggerErp2Mes.LogWarning($"【MaterialTransfer】无法查询到出库仓库{input.warehouse_outstock}的档案记录!");
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, $"无法查询到出库仓库{input.warehouse_outstock}的档案记录!");
|
||||
_LoggerErp2Mes.LogWarning($"【MaterialTransfer】无法查询到出库仓库{warehouse_outstock_code}的档案记录!");
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, $"无法查询到出库仓库{warehouse_outstock_code}的档案记录!");
|
||||
}
|
||||
|
||||
try
|
||||
@@ -1001,6 +1009,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;
|
||||
|
||||
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();
|
||||
@@ -1033,7 +1042,6 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($@"表体明细中单位{detail.unit_code}在wms系统中未找到!", 500);
|
||||
}
|
||||
|
||||
|
||||
wmsTransferOrderD.qty = detail.qty;
|
||||
wmsTransferOrderD.batchno = detail.code_batch;
|
||||
wmsTransferOrderD.erp_line_pk = detail.erp_line_pk;
|
||||
@@ -1070,6 +1078,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;
|
||||
List<WmsRawmatTransferoutstockD> wmsRawmatTransferoutstockDs = new List <WmsRawmatTransferoutstockD>();
|
||||
foreach (var detail in input.details)
|
||||
{
|
||||
@@ -1122,6 +1131,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;
|
||||
List<WmsTransferOutstockD> wmsTransferOutstockDs = new List<WmsTransferOutstockD>();
|
||||
foreach (var detail in input.details)
|
||||
{
|
||||
|
||||
@@ -1672,13 +1672,13 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Information($"【GenTaskExecute】判断为非三四号梯任务");
|
||||
if (e != null)
|
||||
{
|
||||
wmsDistaskHs[0].device_id = e.device_id;
|
||||
}
|
||||
Logger.Information($"【GenTaskExecute】呼叫电梯");
|
||||
_ = ExecuteTargetFloorTask(wmsDistaskHs);
|
||||
//Logger.Information($"【GenTaskExecute】判断为非三四号梯任务");
|
||||
//if (e != null)
|
||||
//{
|
||||
// wmsDistaskHs[0].device_id = e.device_id;
|
||||
//}
|
||||
//Logger.Information($"【GenTaskExecute】呼叫电梯");
|
||||
//_ = ExecuteTargetFloorTask(wmsDistaskHs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($"【MaterialByCarry】托盘{input.carry_code}不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsCarryCode> wmsCarryCodes = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).ToList();
|
||||
List<WmsCarryCode> wmsCarryCodes = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id && r.codeqty > 0).ToList();
|
||||
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功", wmsCarryCodes);
|
||||
}
|
||||
|
||||
@@ -40,11 +40,15 @@ namespace Tnb.WarehouseMgr
|
||||
var warehouse_id = "";
|
||||
var carry_code = "";
|
||||
var material_code = "";
|
||||
var container_no = "";
|
||||
var code_batch = "";
|
||||
if (!input.queryJson.IsNullOrWhiteSpace())
|
||||
{
|
||||
warehouse_id = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.warehouse_id));
|
||||
carry_code = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.carry_code));
|
||||
material_code = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.material_code));
|
||||
code_batch = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.code_batch));
|
||||
container_no = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.container_no));
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +64,8 @@ namespace Tnb.WarehouseMgr
|
||||
.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) => e.material_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))
|
||||
.OrderByDescending((a, b, c, d, e, f) => b.carry_code)
|
||||
.Select((a, b, c, d, e, f) => new WmsCarryStockReport
|
||||
{
|
||||
@@ -99,6 +105,8 @@ namespace Tnb.WarehouseMgr
|
||||
.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.container_no.Contains(container_no))
|
||||
.Select((a, b, c, d, e, f, g, h) => new WmsCarryStockReport
|
||||
{
|
||||
warehouse_name = c.whname,
|
||||
|
||||
@@ -96,6 +96,12 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($"【MaterialSign】载具{input.carry_code}当前库位为空,无法签收", 500);
|
||||
}
|
||||
|
||||
BasLocation carryLoc = await _db.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).FirstAsync();
|
||||
if (carryLoc != null && carryLoc.is_type == "0")
|
||||
{
|
||||
throw new Exception($"托盘{wmsCarryH.carry_code}在存储库位中,不能签收!");
|
||||
}
|
||||
|
||||
List<WmsCarryCode> wmsCarryCodes = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).ToList();
|
||||
|
||||
WmsMaterialSignH wmsMaterialSignH = new WmsMaterialSignH();
|
||||
@@ -103,6 +109,16 @@ namespace Tnb.WarehouseMgr
|
||||
wmsMaterialSignH.create_time = DateTime.Now;
|
||||
wmsMaterialSignH.carry_id = wmsCarryH.id;
|
||||
wmsMaterialSignH.carry_code = wmsCarryH.carry_code;
|
||||
WmsDistaskH wmsDistaskH = await _db.Queryable<WmsDistaskH>().Where(r => r.carry_id == wmsCarryH.id).OrderByDescending(r => r.id).FirstAsync();
|
||||
if (wmsDistaskH == null)
|
||||
{
|
||||
throw new AppFriendlyException($"【MaterialSign】无法找到载具{input.carry_code}的执行任务", 500);
|
||||
}
|
||||
if (string.IsNullOrEmpty(wmsDistaskH.biz_type))
|
||||
{
|
||||
throw new AppFriendlyException($"【MaterialSign】载具{input.carry_code}任务{wmsDistaskH.bill_code}的业务类型异常", 500);
|
||||
}
|
||||
wmsMaterialSignH.biz_type = wmsDistaskH.biz_type;
|
||||
List<WmsMaterialSignD> wmsMaterialSignDs = new List<WmsMaterialSignD>();
|
||||
await _db.Ado.BeginTranAsync();
|
||||
foreach (var item in input.details)
|
||||
@@ -147,15 +163,10 @@ namespace Tnb.WarehouseMgr
|
||||
CarryCodeUnbindCodeInput carryCodeUnbindCodeInput = new CarryCodeUnbindCodeInput();
|
||||
await _wmsCarryUnbindService.CarryCodeUnbindCode(carryCodeUnbindCodeInput, _db);
|
||||
}
|
||||
await _db.Updateable<WmsTempCode>().SetColumns(r => r.codeqty == wmsCarryCode.codeqty)
|
||||
.Where(r => r.barcode == wmsCarryCode.barcode).ExecuteCommandAsync();
|
||||
//await _db.Updateable<WmsTempCode>().SetColumns(r => r.codeqty == wmsCarryCode.codeqty)
|
||||
// .Where(r => r.barcode == wmsCarryCode.barcode).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
BasLocation carryLoc = await _db.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).FirstAsync();
|
||||
if (carryLoc != null && carryLoc.is_type == "0")
|
||||
{
|
||||
throw new Exception($"托盘{wmsCarryH.carry_code}在存储库位中,不能签收!");
|
||||
}
|
||||
|
||||
switch (carryLoc.wh_id)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NPOI.HPSF;
|
||||
using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
@@ -96,10 +97,19 @@ namespace Tnb.WarehouseMgr
|
||||
WmsRawmatTransferoutstockH wmsRawmatTransferoutstockH = await _db.Queryable<WmsRawmatTransferoutstockH>().FirstAsync(it => it.id == wmsRawmatTransferoutstockD.bill_id);
|
||||
|
||||
List<WmsCarryH> items = await _db.Queryable<WmsCarryH>().Where(r => input.carrys.Contains(r.carry_code)).ToListAsync();
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.is_lock == 1)
|
||||
{
|
||||
throw new AppFriendlyException($"载具{item.carry_code}已锁定", 500);
|
||||
}
|
||||
BasLocation carrryLoc = await _db.Queryable<BasLocation>().Where(r => r.id == item.location_id).FirstAsync();
|
||||
if (carrryLoc == null || carrryLoc.is_type != "0")
|
||||
{
|
||||
throw new Exception($"托盘{item.carry_code}已经不在存储库位中,不能出库!");
|
||||
}
|
||||
}
|
||||
|
||||
List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>().Where(r => items.Select(c => c.id).Contains(r.carry_id)
|
||||
&& r.material_id == wmsRawmatTransferoutstockD.matcode_id && r.code_batch == wmsRawmatTransferoutstockD.code_batch).ToListAsync();
|
||||
|
||||
@@ -39,11 +39,13 @@ namespace Tnb.WarehouseMgr
|
||||
var supplier_code = "";
|
||||
var code_batch = "";
|
||||
var material_specification = "";
|
||||
var container_no = "";
|
||||
if (!input.queryJson.IsNullOrWhiteSpace())
|
||||
{
|
||||
supplier_code = JObject.Parse(input.queryJson).Value<string>("supplier_code");
|
||||
code_batch = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.code_batch));
|
||||
material_specification = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.material_specification));
|
||||
container_no = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.container_no));
|
||||
}
|
||||
|
||||
List<WmsStockReportH?> result = new List<WmsStockReportH?>();
|
||||
@@ -57,6 +59,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))
|
||||
.Select((a, b, c, d, e, f, g, h) => new WmsStockReportH
|
||||
{
|
||||
org_id = e.org_id,
|
||||
@@ -119,6 +122,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))
|
||||
.Select((a, b, c, d, e, f, g, h) => new WmsStockReportH
|
||||
{
|
||||
org_id = e.org_id,
|
||||
|
||||
Reference in New Issue
Block a user