成品调拨入库传erp调整,电梯到出货缓存区取消逻辑调整
This commit is contained in:
@@ -72,13 +72,12 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.Information($"进入成品调拨入库单上传BIP逻辑");
|
||||
|
||||
|
||||
WmsInstockH instock = await _db.Queryable<WmsInstockH>().SingleAsync(x => x.id == input.requireId);
|
||||
List<WmsInstockD> allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||
string TransferInstockDId = input.requireId;
|
||||
WmsTransferInstockD wmsTransferInstockD = await _db.Queryable<WmsTransferInstockD>().SingleAsync(x => x.id == TransferInstockDId);
|
||||
string TransferInstockHId = wmsTransferInstockD?.bill_id ?? "";
|
||||
WmsTransferInstockH wmsTransferInstockH = await _db.Queryable<WmsTransferInstockH>().SingleAsync(x => x.id == TransferInstockHId);
|
||||
|
||||
string rawmatTransferinstockDId = input.source_id;
|
||||
WmsRawmatTransferinstockD wmsRawmatTransferinstockD = await _db.Queryable<WmsRawmatTransferinstockD>().SingleAsync(x => x.id == rawmatTransferinstockDId);
|
||||
string rawmatTransferinstockHId = wmsRawmatTransferinstockD?.bill_id ?? "";
|
||||
WmsRawmatTransferinstockH wmsRawmatTransferinstockH = await _db.Queryable<WmsRawmatTransferinstockH>().SingleAsync(x => x.id == rawmatTransferinstockHId);
|
||||
List<WmsTransferInstockD> allInstockDetails = await _db.Queryable<WmsTransferInstockD>().Where(it => it.bill_id == TransferInstockHId).ToListAsync();
|
||||
|
||||
List<String> materialIds = allInstockDetails.Select(x => x.material_id).Distinct().ToList();
|
||||
List<String> unitCodes = allInstockDetails.Select(x => x.unit_id).Distinct().ToList();
|
||||
@@ -88,9 +87,9 @@ namespace Tnb.WarehouseMgr
|
||||
.Select((x, y) => y)
|
||||
.ToListAsync();
|
||||
List<WmsErpWarehouserelaH> erpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x=>x.id!=null).ToListAsync();
|
||||
BasWarehouse basWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x=>x.id==instock.warehouse_id);
|
||||
string userAccount = wmsRawmatTransferinstockH?.biller ?? "";
|
||||
string deptCode = wmsRawmatTransferinstockH?.dept_code ?? "";
|
||||
BasWarehouse basWarehouse = await _db.Queryable<BasWarehouse>().Where(r => r.id == WmsWareHouseConst.WAREHOUSE_CP_ID).FirstAsync();
|
||||
string userAccount = wmsTransferInstockH?.biller ?? "";
|
||||
string deptCode = wmsTransferInstockH?.dept_code ?? "";
|
||||
UserEntity userEntity = await _db.Queryable<UserEntity>().Where(x=>x.Account==userAccount).FirstAsync();
|
||||
string userId = userEntity?.Id ?? WmsWareHouseConst.AdministratorUserId;
|
||||
|
||||
@@ -98,7 +97,7 @@ namespace Tnb.WarehouseMgr
|
||||
List<string> tableIds = new List<string>();
|
||||
tableIds.Add(userId);
|
||||
tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
|
||||
tableIds.Add(instock.warehouse_id);
|
||||
tableIds.Add(basWarehouse.id);
|
||||
tableIds.AddRange(materialIds);
|
||||
tableIds.Add(supplierId);
|
||||
tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
|
||||
@@ -128,14 +127,18 @@ namespace Tnb.WarehouseMgr
|
||||
erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
|
||||
erpRequestData.Add("pk_group", erpOrg.pk_group);
|
||||
erpRequestData.Add("vdef1", null);
|
||||
erpRequestData.Add("vbillcode", instock.bill_code);
|
||||
erpRequestData.Add("vbillcode", wmsTransferInstockH.bill_code);
|
||||
erpRequestData.Add("ctrantypeid", "0001H11000000000D31E");//先写死
|
||||
erpRequestData.Add("vtrantypecode", "4E-01");//先写死
|
||||
erpRequestData.Add("csourcebillhid", wmsRawmatTransferinstockH?.erp_pk ?? "");
|
||||
|
||||
erpRequestData.Add("csourcebillhid", wmsTransferInstockH?.erp_pk ?? "");
|
||||
|
||||
List<WmsCarryCode> wmsCarryCodes = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == input.wmsDistaskH.carry_id)
|
||||
.Where(r => r.material_id == wmsTransferInstockD.material_id && r.code_batch == wmsTransferInstockD.pi_code).ToList();
|
||||
|
||||
decimal qty = wmsCarryCodes.Sum(r => r.codeqty);
|
||||
|
||||
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||
foreach (WmsInstockD item in allInstockDetails)
|
||||
foreach (WmsTransferInstockD item in allInstockDetails)
|
||||
{
|
||||
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||
{
|
||||
@@ -147,24 +150,24 @@ namespace Tnb.WarehouseMgr
|
||||
["corpoid"] = erpOrg.corpoid,
|
||||
["corpvid"] = erpOrg.corpvid,
|
||||
["crowno"] = (allInstockDetails.FindIndex(x => x.id == item.id) + 1) * 10,
|
||||
["csourcebillhid"] = wmsRawmatTransferinstockH?.erp_pk ?? "",
|
||||
["csourcebillbid"] = wmsRawmatTransferinstockD?.erp_line_pk ?? "",
|
||||
["csourcebillhid"] = wmsTransferInstockH?.erp_pk ?? "",
|
||||
["csourcebillbid"] = wmsTransferInstockD?.erp_line_pk ?? "",
|
||||
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||
["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
|
||||
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "",
|
||||
["dbizdate"] = instock.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
["dplanarrivedate"] = instock.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
["dplanoutdate"] = instock.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
["dbizdate"] = wmsTransferInstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
["dplanarrivedate"] = wmsTransferInstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
["dplanoutdate"] = wmsTransferInstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
// ["nnum"] = item.qty,
|
||||
// ["nshouldnum"] = item.pr_qty,
|
||||
["nnum"] = wmsRawmatTransferinstockD.actual_qty,
|
||||
["nshouldnum"] = wmsRawmatTransferinstockD.actual_qty,
|
||||
["nnum"] = qty,
|
||||
["nshouldnum"] = qty,
|
||||
["pk_group"] = erpOrg.pk_group,
|
||||
["pk_org"] = erpOrg.pk_org,
|
||||
["pk_org_v"] = erpOrg.pk_org_v,
|
||||
["vbatchcode"] = item.code_batch,
|
||||
["coutcalbodyoid"] = wmsRawmatTransferinstockH.outstockorg_code,
|
||||
["coutcalbodyvid"] = wmsRawmatTransferinstockH.outstockorg_id,
|
||||
["vbatchcode"] = item.pi_code,
|
||||
["coutcalbodyoid"] = wmsTransferInstockH.outstockorg_code,
|
||||
["coutcalbodyvid"] = wmsTransferInstockH.outstockorg_id,
|
||||
});
|
||||
}
|
||||
erpRequestData.Add("dtls", erpRequestDataDetails);
|
||||
|
||||
Reference in New Issue
Block a user