bug
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Extension;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
using JNPF.Extras.CollectiveOAuth.Utils;
|
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||||
@@ -53,7 +54,14 @@ namespace Tnb.BasicData
|
|||||||
ThirdResult thirdResult = new ThirdResult();
|
ThirdResult thirdResult = new ThirdResult();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
thirdResult = JsonConvert.DeserializeObject<ThirdResult>(response);
|
if (response != null && !response.IsEmpty())
|
||||||
|
{
|
||||||
|
thirdResult = JsonConvert.DeserializeObject<ThirdResult>(response);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
thirdResult.Code = 500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ using JNPF.Common.Filter;
|
|||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using JNPF.EventBus;
|
using JNPF.EventBus;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Systems.Entitys.System;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.Common.Utils;
|
using Tnb.Common.Utils;
|
||||||
@@ -22,6 +24,8 @@ using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
|||||||
using Tnb.WarehouseMgr.Entities.Dto.Queries;
|
using Tnb.WarehouseMgr.Entities.Dto.Queries;
|
||||||
using Tnb.WarehouseMgr.Entities.Enums;
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
using Tnb.ProductionMgr.Entities.Entity;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
@@ -307,6 +311,99 @@ namespace Tnb.WarehouseMgr
|
|||||||
instock.status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
instock.status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
||||||
}
|
}
|
||||||
_ = await _db.Updateable(instock).UpdateColumns(it => it.status).ExecuteCommandAsync();
|
_ = await _db.Updateable(instock).UpdateColumns(it => it.status).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
|
||||||
|
List<String> materialIds = allInstockDetails.Select(x=>x.material_id).Distinct().ToList();
|
||||||
|
List<String> unitCodes = allInstockDetails.Select(x => x.unit_id).Distinct().ToList();
|
||||||
|
List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
|
||||||
|
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
|
||||||
|
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && unitCodes.Contains(y.EnCode))
|
||||||
|
.Select((x,y)=>y)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
List<string> tableIds = new List<string>();
|
||||||
|
tableIds.Add(_userManager.UserId);
|
||||||
|
tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
|
||||||
|
tableIds.Add(instock.warehouse_id);
|
||||||
|
tableIds.AddRange(materialIds);
|
||||||
|
tableIds.Add(instock.supplier_id);
|
||||||
|
tableIds.AddRange(unitDatas.Select(x=>x.Id).ToList());
|
||||||
|
|
||||||
|
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x=>tableIds.Contains(x.table_id)).ToListAsync();
|
||||||
|
string erpCreateId = erpExtendFields.Find(x=>x.table_id==instock.create_id)?.user_id ?? "";
|
||||||
|
ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId));
|
||||||
|
string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
|
||||||
|
Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
|
||||||
|
erpRequestData.Add("approver",erpCreateId);
|
||||||
|
erpRequestData.Add("billmaker",erpCreateId);
|
||||||
|
erpRequestData.Add("bitinbill",false);
|
||||||
|
erpRequestData.Add("cgeneralhid",null);
|
||||||
|
erpRequestData.Add("corpoid",erpOrg.corpoid);
|
||||||
|
erpRequestData.Add("corpvid",erpOrg.corpvid);
|
||||||
|
erpRequestData.Add("creationtime",nowStr);
|
||||||
|
erpRequestData.Add("creator",erpCreateId);
|
||||||
|
erpRequestData.Add("ctrantypeid","");
|
||||||
|
erpRequestData.Add("cvendorid",erpExtendFields.Find(x=>x.table_id==instock.supplier_id)?.supplier_id ?? "");
|
||||||
|
erpRequestData.Add("cvendorvid",erpExtendFields.Find(x=>x.table_id==instock.supplier_id)?.supplier_vid ?? "");
|
||||||
|
erpRequestData.Add("cwarehouseid",erpExtendFields.Find(x=>x.table_id==instock.warehouse_id)?.cotherwhid ?? "");//类型视图里取
|
||||||
|
erpRequestData.Add("dbilldate",nowStr);
|
||||||
|
erpRequestData.Add("dmakedate",nowStr);
|
||||||
|
erpRequestData.Add("fbillflag",2);
|
||||||
|
erpRequestData.Add("fbuysellflag",2);
|
||||||
|
erpRequestData.Add("ntotalnum",allInstockDetails.Sum(x=>x.qty));
|
||||||
|
erpRequestData.Add("pk_org",erpOrg.pk_org);
|
||||||
|
erpRequestData.Add("pk_org_v",erpOrg.pk_org_v);
|
||||||
|
erpRequestData.Add("pk_group",erpOrg.pk_group);
|
||||||
|
erpRequestData.Add("vbillcode",null);
|
||||||
|
erpRequestData.Add("vtrantypecode",null);
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||||
|
foreach(WmsInstockD item in allInstockDetails)
|
||||||
|
{
|
||||||
|
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
["castunitid"] = erpExtendFields.Find(x=>x.table_id==(unitDatas.Find(x=>x.EnCode==item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||||
|
["cbodytranstypecode"] = "",
|
||||||
|
["cbodywarehouseid"] = erpExtendFields.Find(x=>x.table_id==instock.warehouse_id)?.cotherwhid ?? "",
|
||||||
|
["cgeneralbid"] = "",
|
||||||
|
["cgeneralhid"] = "",
|
||||||
|
["cmaterialoid"] = erpExtendFields.Find(x=>x.table_id==item.material_id)?.cmaterialoid ?? "",
|
||||||
|
["cmaterialvid"] = erpExtendFields.Find(x=>x.table_id==item.material_id)?.cmaterialvid ?? "",
|
||||||
|
["corpoid"] = erpOrg.corpoid,
|
||||||
|
["corpvid"] = erpOrg.corpvid,
|
||||||
|
["crowno"] = (allInstockDetails.FindIndex(x=>x.id==item.id)+1) * 10,
|
||||||
|
["cunitid"] = erpExtendFields.Find(x=>x.table_id==(unitDatas.Find(x=>x.EnCode==item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||||
|
["cvendorid"] = erpExtendFields.Find(x=>x.table_id==instock.supplier_id)?.supplier_id ?? "",
|
||||||
|
["cvendorvid"] = erpExtendFields.Find(x=>x.table_id==instock.supplier_id)?.supplier_vid ?? "",
|
||||||
|
["dbizdate"] = instock.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
|
["nnum"] = item.qty,
|
||||||
|
["nshouldnum"] = item.pr_qty,
|
||||||
|
["pk_creqwareid"] = erpExtendFields.Find(x=>x.table_id==instock.warehouse_id)?.cotherwhid ?? "",
|
||||||
|
["pk_group"] = erpOrg.pk_group,
|
||||||
|
["pk_org"] = erpOrg.pk_org,
|
||||||
|
["pk_org_v"] = erpOrg.pk_org_v,
|
||||||
|
["pseudocolumn"] = (allInstockDetails.FindIndex(x=>x.id==item.id)+1) * 10,
|
||||||
|
["vbatchcode"] = item.code_batch,
|
||||||
|
["vfree1"] = erpExtendFields.Find(x=>x.table_id==instock.supplier_id)?.supplier_id ?? "",
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
erpRequestData.Add("PurchaseInBodyVODtl",erpRequestDataDetails);
|
||||||
|
requestData.Add(erpRequestData);
|
||||||
|
|
||||||
|
ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord();
|
||||||
|
thirdWebapiRecord.id = SnowflakeIdHelper.NextId();
|
||||||
|
thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
|
||||||
|
thirdWebapiRecord.name = "采购入库";
|
||||||
|
thirdWebapiRecord.method = "POST";
|
||||||
|
thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN+"uapws/rest/purarrvial/save";
|
||||||
|
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(erpRequestData);
|
||||||
|
thirdWebapiRecord.create_time = DateTime.Now;
|
||||||
|
|
||||||
|
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
|
|||||||
@@ -140,9 +140,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
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.delivery_date.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","");
|
erpRequestData.Add("pk_arriveorder","");
|
||||||
// erpRequestData.Add("pk_dept","1001A1100000000JRLI1");
|
// erpRequestData.Add("pk_dept","1001A1100000000JRLI1");
|
||||||
// erpRequestData.Add("pk_dept_v","0001A11000000007GGO8");
|
// erpRequestData.Add("pk_dept_v","0001A11000000007GGO8");
|
||||||
@@ -173,14 +173,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
["csourcetypecode"] = "",
|
["csourcetypecode"] = "",
|
||||||
["ctaxcountryid"] = "0001Z010000000079UJJ",
|
["ctaxcountryid"] = "0001Z010000000079UJJ",
|
||||||
["cunitid"] = erpExtendFields.Find(x=>x.table_id==(unitDatas.Find(x=>x.EnCode==item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
["cunitid"] = erpExtendFields.Find(x=>x.table_id==(unitDatas.Find(x=>x.EnCode==item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||||
["dbilldate"] = "",
|
["dbilldate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
["dplanreceivedate"] = "",
|
["dplanreceivedate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
["dproducedate"] = "",
|
["dproducedate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
["fbuysellflag"] = 1,
|
["fbuysellflag"] = 1,
|
||||||
["fproductclass"] = 1,
|
["fproductclass"] = 1,
|
||||||
["naccumchecknum"] = 0,
|
["naccumchecknum"] = 0,
|
||||||
["nastnum"] = item.purchase_arriveqty,
|
["nastnum"] = item.purchase_arriveqty,
|
||||||
["nnum"] = null,
|
["nnum"] = item.purchase_arriveqty,
|
||||||
// ["nplanastnum"] = 0,
|
// ["nplanastnum"] = 0,
|
||||||
// ["nplannum"] = item.purchase_qty,
|
// ["nplannum"] = item.purchase_qty,
|
||||||
["apfinanceorg"] = erpOrg.pk_org,
|
["apfinanceorg"] = erpOrg.pk_org,
|
||||||
|
|||||||
Reference in New Issue
Block a user