出库时物料状态控制,采购订单收货单到货数量调整、报表调整

This commit is contained in:
2024-10-12 17:09:59 +08:00
parent 20ff2d213a
commit 8c047af86e
13 changed files with 318 additions and 212 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)); Floor4DMJ2MJXtimer = new Timer(Floor4DMJ2MJX, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
Floor4MJX2MJCtimer = new Timer(Floor4MJX2MJC, 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)); F2KTPsupplementtimer = new Timer(F2KTPsupplement, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
YCLInternalTransfertimer = new Timer(YCLInternalTransfer, null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(185)); YCLInternalTransfertimer = new Timer(YCLInternalTransfer, null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(185));

View File

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

View File

@@ -130,4 +130,9 @@ public partial class WmsCarryCode : BaseEntity<string>, IWmsCarryEntity
/// 辅助属性(小批号) /// 辅助属性(小批号)
/// </summary> /// </summary>
public string? auxprop_xph { get; set; } 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> /// </summary>
public string? bind_time { get; set; } 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> /// </summary>
public string? bind_time { get; set; } 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

@@ -75,6 +75,20 @@ public partial class WmsStockReportH : BaseEntity<string>
/// </summary> /// </summary>
public string code_batch { get; set; } = string.Empty; 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>
///// 现有库存 ///// 现有库存
///// </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.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(!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(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) if (input.filter_carry_status)
{ {
@@ -605,7 +606,6 @@ namespace Tnb.WarehouseMgr
.Select<WmsCarryH>() .Select<WmsCarryH>()
.ToListAsync(); .ToListAsync();
items = items.DistinctBy(r => r.id).ToList(); items = items.DistinctBy(r => r.id).ToList();
return input.Size > 0 ? items.Take(input.Size).ToList() : items; return input.Size > 0 ? items.Take(input.Size).ToList() : items;
} }
@@ -4431,8 +4431,8 @@ namespace Tnb.WarehouseMgr
material_id = input.material_id, material_id = input.material_id,
code_batch = input.code_batch, code_batch = input.code_batch,
Size = 100, 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); 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(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(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(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) .OrderByDescending((a, b, c, d, e, f) => b.carry_code)
.Select((a, b, c, d, e, f) => new WmsCarryStockReport .Select((a, b, c, d, e, f) => new WmsCarryStockReport
{ {
@@ -88,7 +88,10 @@ namespace Tnb.WarehouseMgr
container_no = f.material_standard, container_no = f.material_standard,
unit = e.unit_id, unit = e.unit_id,
creator = e.create_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) .OrderBy((a) => a.location_code)
.ToListAsync(); .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(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(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(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 .Select((a, b, c, d, e, f, g, h) => new WmsCarryStockReport
{ {
warehouse_name = c.whname, warehouse_name = c.whname,
@@ -132,7 +135,10 @@ namespace Tnb.WarehouseMgr
container_no = g.material_standard, container_no = g.material_standard,
unit = f.unit_id, unit = f.unit_id,
creator = f.create_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) .OrderBy((a) => a.location_code)
.ToListAsync(); .ToListAsync();
@@ -170,6 +176,9 @@ namespace Tnb.WarehouseMgr
wmsCarryStockReportCode.unit = x.unit; wmsCarryStockReportCode.unit = x.unit;
wmsCarryStockReportCode.material_specification = x.material_specification; wmsCarryStockReportCode.material_specification = x.material_specification;
wmsCarryStockReportCode.container_no = x.container_no; 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.创建用户 = x.操作用户;
wmsCarryStockReportCode.bind_time = x.bind_time; wmsCarryStockReportCode.bind_time = x.bind_time;

View File

@@ -248,7 +248,8 @@ namespace Tnb.WarehouseMgr
material_id = input.material_id, material_id = input.material_id,
code_batch = input.code_batch, code_batch = input.code_batch,
Size = input.palletCount, 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); List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(outStockStrategyInput);
@@ -362,7 +363,8 @@ namespace Tnb.WarehouseMgr
material_id = wmsMaterialTransferD.material_id, material_id = wmsMaterialTransferD.material_id,
code_batch = input.code_batch, code_batch = input.code_batch,
Size = input.palletCount, 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); 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(); 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") if (wmsCarryH.carrystd_id == "26037267399717")
{ {

View File

@@ -191,220 +191,220 @@ namespace Tnb.WarehouseMgr
public async Task<dynamic> Purchase(PurchaseAndReceiveUpInput input) public async Task<dynamic> Purchase(PurchaseAndReceiveUpInput input)
{ {
var blFlag = true; var blFlag = true;
try //try
{ //{
WmsPurchaseH wmsPurchaseH = await _db.Queryable<WmsPurchaseH>().Where(r => r.bill_code == input.bill_code).FirstAsync(); // WmsPurchaseH wmsPurchaseH = await _db.Queryable<WmsPurchaseH>().Where(r => r.bill_code == input.bill_code).FirstAsync();
if (wmsPurchaseH.make_method == "自制") // if (wmsPurchaseH.make_method == "自制")
{ // {
throw Oops.Bah("自制采购收货单不能操作此按钮"); // throw Oops.Bah("自制采购收货单不能操作此按钮");
} // }
await _db.Ado.BeginTranAsync(); // await _db.Ado.BeginTranAsync();
WmsInstockH? instock = null; // WmsInstockH? instock = null;
var purchaseDs = await PurchaseAndSaleUpdate(input); // var purchaseDs = await PurchaseAndSaleUpdate(input);
List<WmsInstockD> instockDs = new(); // List<WmsInstockD> instockDs = new();
if (purchaseDs?.Count > 0) // if (purchaseDs?.Count > 0)
{ // {
instock = input.Adapt<WmsInstockH>(); // instock = input.Adapt<WmsInstockH>();
instock.id = SnowflakeIdHelper.NextId(); // instock.id = SnowflakeIdHelper.NextId();
instock.bill_code = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_INSTOCK_ENCODE); // instock.bill_code = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_INSTOCK_ENCODE);
instock.create_id = _userManager.UserId; // instock.create_id = _userManager.UserId;
instock.create_time = DateTime.Now; // instock.create_time = DateTime.Now;
instock.org_id = _userManager.User.OrganizeId; // instock.org_id = _userManager.User.OrganizeId;
if (instock.source_code != null) // if (instock.source_code != null)
{ // {
instock.sync_status = WmsWareHouseConst.SYNC_STATUS__NOTSYNC; // instock.sync_status = WmsWareHouseConst.SYNC_STATUS__NOTSYNC;
} // }
else // else
{ // {
instock.sync_status = WmsWareHouseConst.SYNC_STATUS_NONEEDSYNC; // instock.sync_status = WmsWareHouseConst.SYNC_STATUS_NONEEDSYNC;
} // }
instock.audit_status = 0; // instock.audit_status = 0;
instock.print_status = "0"; // instock.print_status = "0";
instock.is_check = 0; // instock.is_check = 0;
await _db.Insertable(instock).ExecuteCommandAsync(); // await _db.Insertable(instock).ExecuteCommandAsync();
instockDs = purchaseDs.Adapt<List<WmsInstockD>>(); // instockDs = purchaseDs.Adapt<List<WmsInstockD>>();
instockDs.ForEach(instockD => // instockDs.ForEach(instockD =>
{ // {
instockD.bill_id = instock.id; // instockD.bill_id = instock.id;
instockD.create_id = _userManager.UserId; // instockD.create_id = _userManager.UserId;
instockD.create_time = DateTime.Now; // instockD.create_time = DateTime.Now;
instockD.org_id = _userManager.User.OrganizeId; // instockD.org_id = _userManager.User.OrganizeId;
}); // });
await _db.Insertable(instockDs).ExecuteCommandAsync(); // await _db.Insertable(instockDs).ExecuteCommandAsync();
var purchase = await _db.Queryable<WmsPurchaseH>().FirstAsync(it => it.id == purchaseDs.First().bill_id); // var purchase = await _db.Queryable<WmsPurchaseH>().FirstAsync(it => it.id == purchaseDs.First().bill_id);
if (string.IsNullOrEmpty(purchase.supplier_id)) // if (string.IsNullOrEmpty(purchase.supplier_id))
{ // {
BasSupplier basSupplier = await _db.Queryable<BasSupplier>().Where(x => x.supplier_code == purchase.supplier_code).FirstAsync(); // BasSupplier basSupplier = await _db.Queryable<BasSupplier>().Where(x => x.supplier_code == purchase.supplier_code).FirstAsync();
if (basSupplier != null) // if (basSupplier != null)
{ // {
await _db.Updateable<WmsPurchaseH>() // await _db.Updateable<WmsPurchaseH>()
.SetColumns(x => x.supplier_id == basSupplier.id) // .SetColumns(x => x.supplier_id == basSupplier.id)
.Where(x => x.id == purchase.id) // .Where(x => x.id == purchase.id)
.ExecuteCommandAsync(); // .ExecuteCommandAsync();
purchase.supplier_id = basSupplier.id; // purchase.supplier_id = basSupplier.id;
} // }
} // }
//purchase.supplier_code // //purchase.supplier_code
List<WmsPurchaseD> dList = await _db.Queryable<WmsPurchaseD>().Where(x => x.bill_id == purchaseDs.First().bill_id).OrderBy(x => x.id).ToListAsync(); // List<WmsPurchaseD> dList = await _db.Queryable<WmsPurchaseD>().Where(x => x.bill_id == purchaseDs.First().bill_id).OrderBy(x => x.id).ToListAsync();
List<String> materialIds = purchaseDs.Select(x => x.material_id).Distinct().ToList(); // List<String> materialIds = purchaseDs.Select(x => x.material_id).Distinct().ToList();
List<String> unitCodes = purchaseDs.Select(x => x.unit_id).Distinct().ToList(); // List<String> unitCodes = purchaseDs.Select(x => x.unit_id).Distinct().ToList();
List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>() // List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId) // .LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && (unitCodes.Contains(y.EnCode) || unitCodes.Contains(y.Id))) // .Where((x, y) => x.EnCode == DictConst.MeasurementUnit && (unitCodes.Contains(y.EnCode) || unitCodes.Contains(y.Id)))
.Select((x, y) => y) // .Select((x, y) => y)
.ToListAsync(); // .ToListAsync();
List<WmsErpWarehouserelaH> erpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x => x.id != null).ToListAsync(); // List<WmsErpWarehouserelaH> erpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x => x.id != null).ToListAsync();
WmsPurchaseOrderH wmsPurchaseOrderH = await _db.Queryable<WmsPurchaseOrderH>().SingleAsync(x => x.id == purchase.erp_bill_code); // WmsPurchaseOrderH wmsPurchaseOrderH = await _db.Queryable<WmsPurchaseOrderH>().SingleAsync(x => x.id == purchase.erp_bill_code);
//todo 先取采购订单第一条 // //todo 先取采购订单第一条
//WmsPurchaseOrderD wmsPurchaseOrderDs = await _db.Queryable<WmsPurchaseOrderD>().FirstAsync(x=>x.fk_wms_purchase_order_id==purchase.erp_bill_code); // //WmsPurchaseOrderD wmsPurchaseOrderDs = await _db.Queryable<WmsPurchaseOrderD>().FirstAsync(x=>x.fk_wms_purchase_order_id==purchase.erp_bill_code);
//自制的不调erp接口 // //自制的不调erp接口
if (!string.IsNullOrEmpty(wmsPurchaseOrderH.erp_bill_code)) // if (!string.IsNullOrEmpty(wmsPurchaseOrderH.erp_bill_code))
{ // {
List<string> ids = new List<string>(); // List<string> ids = new List<string>();
// ids.Add(_userManager.UserId); // // ids.Add(_userManager.UserId);
// ids.Add(WmsWareHouseConst.AdministratorUserId); // // ids.Add(WmsWareHouseConst.AdministratorUserId);
ids.Add(WmsWareHouseConst.AdministratorOrgId); // ids.Add(WmsWareHouseConst.AdministratorOrgId);
ids.Add(purchase.warehouse_id); // ids.Add(purchase.warehouse_id);
ids.AddRange(materialIds); // ids.AddRange(materialIds);
ids.Add(wmsPurchaseOrderH.supplier_id); // ids.Add(wmsPurchaseOrderH.supplier_id);
ids.AddRange(unitDatas.Select(x => x.Id).ToList()); // ids.AddRange(unitDatas.Select(x => x.Id).ToList());
string userId = _userManager.UserId ?? WmsWareHouseConst.AdministratorUserId; // string userId = _userManager.UserId ?? WmsWareHouseConst.AdministratorUserId;
ids.Add(userId); // ids.Add(userId);
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => ids.Contains(x.table_id)).ToListAsync(); // List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => ids.Contains(x.table_id)).ToListAsync();
// string erpCreateId = erpExtendFields.Find(x=>x.table_id==userId)?.user_id ?? WmsWareHouseConst.ERPUSERID; // // string erpCreateId = erpExtendFields.Find(x=>x.table_id==userId)?.user_id ?? WmsWareHouseConst.ERPUSERID;
string erpCreateId = WmsWareHouseConst.ERPUSERID; // string erpCreateId = WmsWareHouseConst.ERPUSERID;
ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId)); // ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId));
string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>(); // List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
Dictionary<string, object> erpRequestData = new Dictionary<string, object>(); // Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
erpRequestData.Add("approver", erpCreateId); // erpRequestData.Add("approver", erpCreateId);
erpRequestData.Add("billmaker", erpCreateId); // erpRequestData.Add("billmaker", erpCreateId);
erpRequestData.Add("creationtime", nowStr); // erpRequestData.Add("creationtime", nowStr);
erpRequestData.Add("creator", erpCreateId); // erpRequestData.Add("creator", erpCreateId);
erpRequestData.Add("dbilldate", purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss")); // erpRequestData.Add("dbilldate", purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"));
erpRequestData.Add("dmakedate", nowStr); // erpRequestData.Add("dmakedate", nowStr);
erpRequestData.Add("ntotalastnum", purchaseDs.Sum(x => x.purchase_arriveqty)); // erpRequestData.Add("ntotalastnum", purchaseDs.Sum(x => x.purchase_arriveqty));
erpRequestData.Add("pk_arriveorder", null); // erpRequestData.Add("pk_arriveorder", null);
// erpRequestData.Add("pk_dept","1001A1100000001JFOPQ"); // // erpRequestData.Add("pk_dept","1001A1100000001JFOPQ");
// erpRequestData.Add("pk_dept_v","0001A1100000000AOMIQ"); // // erpRequestData.Add("pk_dept_v","0001A1100000000AOMIQ");
erpRequestData.Add("Pk_receivepsndoc", erpCreateId); // erpRequestData.Add("Pk_receivepsndoc", erpCreateId);
erpRequestData.Add("pk_org", erpOrg.pk_org); // erpRequestData.Add("pk_org", erpOrg.pk_org);
erpRequestData.Add("pk_org_v", erpOrg.pk_org_v); // erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
erpRequestData.Add("pk_group", erpOrg.pk_group); // erpRequestData.Add("pk_group", erpOrg.pk_group);
erpRequestData.Add("pk_pupsndoc", ""); // erpRequestData.Add("pk_pupsndoc", "");
erpRequestData.Add("csourceid", wmsPurchaseOrderH?.erp_pk ?? ""); // erpRequestData.Add("csourceid", wmsPurchaseOrderH?.erp_pk ?? "");
erpRequestData.Add("pk_purchaseorg", erpOrg.pk_org); // erpRequestData.Add("pk_purchaseorg", erpOrg.pk_org);
erpRequestData.Add("pk_purchaseorg_v", erpOrg.pk_org_v); // erpRequestData.Add("pk_purchaseorg_v", erpOrg.pk_org_v);
erpRequestData.Add("pk_supplier", erpExtendFields.Find(x => x.table_id == purchase.supplier_id)?.supplier_id ?? "");//先写死 // erpRequestData.Add("pk_supplier", erpExtendFields.Find(x => x.table_id == purchase.supplier_id)?.supplier_id ?? "");//先写死
erpRequestData.Add("pk_supplier_v", erpExtendFields.Find(x => x.table_id == purchase.supplier_id)?.supplier_vid ?? "");//先写死 // erpRequestData.Add("pk_supplier_v", erpExtendFields.Find(x => x.table_id == purchase.supplier_id)?.supplier_vid ?? "");//先写死
erpRequestData.Add("vbillcode", purchase.bill_code); // erpRequestData.Add("vbillcode", purchase.bill_code);
erpRequestData.Add("vmemo", purchase.remark); // erpRequestData.Add("vmemo", purchase.remark);
erpRequestData.Add("vtrantypecode", ""); // erpRequestData.Add("vtrantypecode", "");
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>(); // List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
foreach (WmsPurchaseD item in dList) // foreach (WmsPurchaseD item in dList)
{ // {
erpRequestDataDetails.Add(new Dictionary<string, object>() // erpRequestDataDetails.Add(new Dictionary<string, object>()
{ // {
["castunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id || x.Id == item.unit_id)?.Id ?? ""))?.cunitid ?? "", // ["castunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id || x.Id == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
["cfirstbid"] = wmsPurchaseOrderH?.erp_pk ?? "", // ["cfirstbid"] = wmsPurchaseOrderH?.erp_pk ?? "",
["cfirstid"] = item.erp_purchase_order_d_pk, // ["cfirstid"] = item.erp_purchase_order_d_pk,
["cfirsttypecode"] = "", // ["cfirsttypecode"] = "",
["crececountryid"] = "0001Z010000000079UJJ", // ["crececountryid"] = "0001Z010000000079UJJ",
["crowno"] = item.erp_purchase_order_d_lineno, // ["crowno"] = item.erp_purchase_order_d_lineno,
["csendcountryid"] = "0001Z010000000079UJJ", // ["csendcountryid"] = "0001Z010000000079UJJ",
["csourcetypecode"] = "", // ["csourcetypecode"] = "",
["ctaxcountryid"] = "0001Z010000000079UJJ", // ["ctaxcountryid"] = "0001Z010000000079UJJ",
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id || x.Id == item.unit_id)?.Id ?? ""))?.cunitid ?? "", // ["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id || x.Id == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
["dbilldate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"), // ["dbilldate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
["dplanreceivedate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"), // ["dplanreceivedate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
["dproducedate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"), // ["dproducedate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
// ["fbuysellflag"] = 2, // // ["fbuysellflag"] = 2,
["fproductclass"] = 1, // ["fproductclass"] = 1,
// ["naccumchecknum"] = 0, // // ["naccumchecknum"] = 0,
// ["nastnum"] = item.purchase_arriveqty, // // ["nastnum"] = item.purchase_arriveqty,
["nnum"] = item.purchase_arriveqty, // ["nnum"] = item.purchase_arriveqty,
// ["nplanastnum"] = 0, // // ["nplanastnum"] = 0,
["nplannum"] = item.purchase_qty, // ["nplannum"] = item.purchase_qty,
["pk_apfinanceorg"] = erpOrg.corpoid, // ["pk_apfinanceorg"] = erpOrg.corpoid,
["pk_apfinanceorg_v"] = erpOrg.corpvid, // ["pk_apfinanceorg_v"] = erpOrg.corpvid,
["pk_arriveorder"] = null, // ["pk_arriveorder"] = null,
["pk_arriveorder_b"] = null, // ["pk_arriveorder_b"] = null,
["pk_group"] = erpOrg.pk_group, // ["pk_group"] = erpOrg.pk_group,
["pk_material"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "", // ["pk_material"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "",
["pk_order"] = wmsPurchaseOrderH?.erp_pk ?? "", // ["pk_order"] = wmsPurchaseOrderH?.erp_pk ?? "",
["pk_order_b"] = item.erp_purchase_order_d_pk, // ["pk_order_b"] = item.erp_purchase_order_d_pk,
["pk_org"] = erpOrg.pk_org, // ["pk_org"] = erpOrg.pk_org,
["pk_org_v"] = erpOrg.pk_org_v, // ["pk_org_v"] = erpOrg.pk_org_v,
["pk_psfinanceorg"] = erpOrg.corpoid, // ["pk_psfinanceorg"] = erpOrg.corpoid,
["pk_psfinanceorg_v"] = erpOrg.corpvid, // ["pk_psfinanceorg_v"] = erpOrg.corpvid,
// ["pk_receivestore"] = erpExtendFields.Find(x=>x.table_id==purchase.warehouse_id)?.cotherwhid ?? "", // // ["pk_receivestore"] = erpExtendFields.Find(x=>x.table_id==purchase.warehouse_id)?.cotherwhid ?? "",
// ["pk_receivestore"] = erpWarehouserelaHs.Find(x => x.erp_warehousecode == item.erp_wh_type)?.erp_warehouseid ?? "", // // ["pk_receivestore"] = erpWarehouserelaHs.Find(x => x.erp_warehousecode == item.erp_wh_type)?.erp_warehouseid ?? "",
["pk_receivestore"] = item.erp_wh_type, // ["pk_receivestore"] = item.erp_wh_type,
["pk_reqstoorg"] = erpOrg.pk_org, // ["pk_reqstoorg"] = erpOrg.pk_org,
["pk_reqstoorg_v"] = erpOrg.pk_org_v, // ["pk_reqstoorg_v"] = erpOrg.pk_org_v,
["pk_srcmaterial"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "", // ["pk_srcmaterial"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "",
["vbatchcode"] = item.code_batch, // ["vbatchcode"] = item.code_batch,
["Vfree1"] = item.code_batch, // ["Vfree1"] = item.code_batch,
["mes_detail_id"] = item.id, // ["mes_detail_id"] = item.id,
["bpresent"] = item.gift == 1, // ["bpresent"] = item.gift == 1,
["csourceid"] = wmsPurchaseOrderH?.erp_pk ?? "", // ["csourceid"] = wmsPurchaseOrderH?.erp_pk ?? "",
["vsourcecode"] = wmsPurchaseOrderH.erp_bill_code, // ["vsourcecode"] = wmsPurchaseOrderH.erp_bill_code,
["csourcebid"] = item.erp_purchase_order_d_pk, // ["csourcebid"] = item.erp_purchase_order_d_pk,
["IsType"] = 0, // ["IsType"] = 0,
["csourcetypecode"] = null, // ["csourcetypecode"] = null,
["vsourcerowno"] = null, // ["vsourcerowno"] = null,
["vsourcetrantype"] = null, // ["vsourcetrantype"] = null,
["cproductorid"] = item.production_unit, // ["cproductorid"] = item.production_unit,
}); // });
} // }
erpRequestData.Add("dtls", erpRequestDataDetails); // erpRequestData.Add("dtls", erpRequestDataDetails);
requestData.Add(erpRequestData); // requestData.Add(erpRequestData);
BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.BIPURL); // BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.BIPURL);
ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord(); // ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord();
thirdWebapiRecord.id = SnowflakeIdHelper.NextId(); // thirdWebapiRecord.id = SnowflakeIdHelper.NextId();
thirdWebapiRecord.third_name = WmsWareHouseConst.BIP; // thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
thirdWebapiRecord.name = "采购到货"; // thirdWebapiRecord.name = "采购到货";
thirdWebapiRecord.method = "POST"; // thirdWebapiRecord.method = "POST";
// thirdWebapiRecord.url = config.value+"uapws/rest/purarrvial/save"; // // thirdWebapiRecord.url = config.value+"uapws/rest/purarrvial/save";
thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/purarrvial/save"; // thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/purarrvial/save";
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(erpRequestData); // thirdWebapiRecord.request_data = JsonConvert.SerializeObject(erpRequestData);
thirdWebapiRecord.create_time = DateTime.Now; // thirdWebapiRecord.create_time = DateTime.Now;
thirdWebapiRecord.remark = $"【WmsPurchaseService Purchase】erp采购订单:{wmsPurchaseOrderH.erp_bill_code}"; // thirdWebapiRecord.remark = $"【WmsPurchaseService Purchase】erp采购订单:{wmsPurchaseOrderH.erp_bill_code}";
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync(); // await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
BasFactoryConfig callErp = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.CALLERP); // BasFactoryConfig callErp = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.CALLERP);
if (callErp.value == "1") // if (callErp.value == "1")
{ // {
await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord }, "自动", _db); // await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord }, "自动", _db);
} // }
} // }
} // }
//通知Mes接口 // //通知Mes接口
//_ = SyncMesData(instock.id, instockDs.Select(x => x.material_id).ToList(), EnumTriggerEvent.入厂检按物料编号); // //_ = SyncMesData(instock.id, instockDs.Select(x => x.material_id).ToList(), EnumTriggerEvent.入厂检按物料编号);
await _db.Ado.CommitTranAsync(); // await _db.Ado.CommitTranAsync();
} //}
catch (Exception ex) //catch (Exception ex)
{ //{
blFlag = false; // blFlag = false;
await _db.Ado.RollbackTranAsync(); // await _db.Ado.RollbackTranAsync();
Log.Error("采购收货失败", ex); // Log.Error("采购收货失败", ex);
throw; // throw;
} //}
return await Task.FromResult(blFlag); return await Task.FromResult(blFlag);
} }

View File

@@ -110,6 +110,14 @@ namespace Tnb.WarehouseMgr
wmsPurchaseQcrecord.result = qcRes; wmsPurchaseQcrecord.result = qcRes;
await _db.Insertable(wmsPurchaseQcrecord).ExecuteCommandAsync(); 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 #endregion

View File

@@ -40,6 +40,7 @@ using JNPF.VisualDev.Entitys;
using Tnb.BasicData.Interfaces; using Tnb.BasicData.Interfaces;
using JNPF.Common.Enums; using JNPF.Common.Enums;
using System.Reflection; using System.Reflection;
using Aop.Api.Domain;
namespace Tnb.WarehouseMgr 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<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> materialIds = purchaseDs.Select(x=>x.material_id).Distinct().ToList();
List<String> unitCodes = purchaseDs.Select(x => x.unit_id).Distinct().ToList(); List<String> unitCodes = purchaseDs.Select(x => x.unit_id).Distinct().ToList();
List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>() List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()

View File

@@ -543,6 +543,7 @@ namespace Tnb.WarehouseMgr
WmsSaleH newWmsSaleH = wmsSaleHs[0].Adapt<WmsSaleH>(); WmsSaleH newWmsSaleH = wmsSaleHs[0].Adapt<WmsSaleH>();
newWmsSaleH.id = SnowflakeIdHelper.NextId(); newWmsSaleH.id = SnowflakeIdHelper.NextId();
newWmsSaleH.bill_code = Code; 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.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_id = string.Join(",", wmsSaleHs.Select(x => x.customer_id));
newWmsSaleH.customer_code = string.Join(",", wmsSaleHs.Select(x => x.customer_code)); 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) .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(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(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(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) .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()) .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, code_batch = a.code_batch,
supplier_code = "", supplier_code = "",
supplier_name = "", 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(); }, true).ToListAsync();
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>() 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(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(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(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(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) .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()) .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, code_batch = a.code_batch,
supplier_code = h.supplier_code, supplier_code = h.supplier_code,
supplier_name = h.supplier_name, 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(); }, true).ToListAsync();
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>() List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>()