自制单据行号优化

This commit is contained in:
2024-10-08 10:57:30 +08:00
parent 7152324b26
commit f5c0e0e41f
6 changed files with 8 additions and 6 deletions

View File

@@ -87,6 +87,7 @@ namespace Tnb.WarehouseMgr
WmsRawmatOutstockD wmsRawmatOutstockD = await _db.Queryable<WmsRawmatOutstockD>().SingleAsync(x=>x.id==input.source_id);
WmsRawmatOutstockH wmsRawmatOutstockH = await _db.Queryable<WmsRawmatOutstockH>().SingleAsync(x=>x.id==wmsRawmatOutstockD.bill_id);
List<WmsRawmatOutstockD> wmsRawmatOutstockDs = await _db.Queryable<WmsRawmatOutstockD>().Where(x=>x.bill_id==wmsRawmatOutstockH.id).OrderBy(x=>x.id).ToListAsync();
List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>()
.Where(r => r.carry_id == input.wmsDistaskH.carry_id)
.Where(r => r.material_id == wmsRawmatOutstockD.material_id && r.code_batch == wmsRawmatOutstockD.batchno)
@@ -160,6 +161,7 @@ namespace Tnb.WarehouseMgr
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
foreach(var item in wmsCarryCodes)
{
int lineno = (wmsRawmatOutstockDs.FindIndex(x => x.id == wmsRawmatOutstockD.id) + 1) * 10;
// 出库数量wmsMaterialSignD.sign_qty
erpRequestDataDetails.Add(new Dictionary<string, object>()
{
@@ -169,7 +171,7 @@ namespace Tnb.WarehouseMgr
["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialvid ?? "",
["corpoid"] = erpOrg.corpoid,
["corpvid"] = erpOrg.corpvid,
["crowno"] = wmsRawmatOutstockD.lineno,
["crowno"] = wmsRawmatOutstockD.lineno ?? lineno.ToString(),
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id || x.Id==item.unit_id)?.Id ?? ""))?.cunitid ?? "",
["cvendorid"] = erpExtendFields.Find((x=>x.table_id==item.auxprop_gys))?.supplier_id,
["cvendorvid"] = erpExtendFields.Find((x=>x.table_id==item.auxprop_gys))?.supplier_vid,