bug
This commit is contained in:
10
BasicData/Tnb.BasicData.Entities/Dto/ErpPurchaseDto.cs
Normal file
10
BasicData/Tnb.BasicData.Entities/Dto/ErpPurchaseDto.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Tnb.BasicData.Entities.Dto
|
||||||
|
{
|
||||||
|
public class ErpPurchaseDto
|
||||||
|
{
|
||||||
|
public string pk_arriveorder { get; set; }
|
||||||
|
public string pk_arriveorder_b { get; set; }
|
||||||
|
public string csourcebid { get; set; }
|
||||||
|
public string mes_detail_id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
|
using Tnb.BasicData.Entities.Dto;
|
||||||
|
|
||||||
namespace Tnb.BasicData
|
namespace Tnb.BasicData
|
||||||
{
|
{
|
||||||
@@ -207,11 +208,4 @@ namespace Tnb.BasicData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ErpPurchaseDto
|
|
||||||
{
|
|
||||||
public string pk_arriveorder { get; set; }
|
|
||||||
public string pk_arriveorder_b { get; set; }
|
|
||||||
public string csourcebid { get; set; }
|
|
||||||
public string mes_detail_id { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,7 @@ using JNPF.Systems.Interfaces.System;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using SQLitePCL;
|
using SQLitePCL;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using SqlSugar.Extensions;
|
using SqlSugar.Extensions;
|
||||||
@@ -39,6 +40,7 @@ using Tnb.ProductionMgr.Interfaces;
|
|||||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||||
using Tnb.ProductionMgr.Entities.Entity;
|
using Tnb.ProductionMgr.Entities.Entity;
|
||||||
using Tnb.ProductionMgr.Entities.Entity.ErpEntity;
|
using Tnb.ProductionMgr.Entities.Entity.ErpEntity;
|
||||||
|
using Tnb.BasicData.Entities.Dto;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr
|
namespace Tnb.ProductionMgr
|
||||||
{
|
{
|
||||||
@@ -716,6 +718,9 @@ namespace Tnb.ProductionMgr
|
|||||||
string response = "";
|
string response = "";
|
||||||
var elapsedMilliseconds = 0l;
|
var elapsedMilliseconds = 0l;
|
||||||
ThirdResult thirdResult = new ThirdResult();
|
ThirdResult thirdResult = new ThirdResult();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
foreach (var record in records)
|
foreach (var record in records)
|
||||||
{
|
{
|
||||||
now = DateTime.Now;
|
now = DateTime.Now;
|
||||||
@@ -765,7 +770,68 @@ namespace Tnb.ProductionMgr
|
|||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (thirdResult.Code == 200 && record.third_name == "BIP" && record.name == "采购到货")
|
||||||
|
{
|
||||||
|
Dictionary<string,object> requestData = JsonConvert.DeserializeObject<Dictionary<string,object>>(record.request_data);
|
||||||
|
//((JObject)requestData[0]["dtls"]).SelectTokens("csourcebid")
|
||||||
|
|
||||||
|
string billCode = requestData.ContainsKey("vbillcode") ? requestData["vbillcode"].ToString() : "";
|
||||||
|
if (string.IsNullOrEmpty(billCode))
|
||||||
|
{
|
||||||
|
Log.Error($"请求记录id{record.id}采购到货单号为空");
|
||||||
}
|
}
|
||||||
|
var requestDtos = ((JArray)requestData["dtls"]).Select(x => new ErpPurchaseDto()
|
||||||
|
{
|
||||||
|
csourcebid = x["csourcebid"]?.ToString(),
|
||||||
|
mes_detail_id = x["mes_detail_id"]?.ToString(),
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
JObject data = (JObject)thirdResult.msg;
|
||||||
|
JToken children = data.SelectToken("children")[0];
|
||||||
|
var responsetDtos = children.Select(x => new ErpPurchaseDto()
|
||||||
|
{
|
||||||
|
pk_arriveorder = x["valueIndex"]["pk_arriveorder"].ToString(),
|
||||||
|
pk_arriveorder_b = x["valueIndex"]["pk_arriveorder_b"].ToString(),
|
||||||
|
csourcebid = x["valueIndex"]["csourcebid"].ToString()
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
string pk_arriveorder = responsetDtos[0]?.pk_arriveorder ?? "";
|
||||||
|
int updateDRow = 0;
|
||||||
|
bool flag = !string.IsNullOrEmpty(pk_arriveorder);
|
||||||
|
foreach (var item in requestDtos)
|
||||||
|
{
|
||||||
|
string pk_arriveorder_b = responsetDtos.Find(x => x.csourcebid == item.csourcebid)?.pk_arriveorder_b;
|
||||||
|
if (string.IsNullOrEmpty(pk_arriveorder_b))
|
||||||
|
{
|
||||||
|
flag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
updateDRow += await _db.Updateable<WmsPurchaseD>()
|
||||||
|
.SetColumns(x => x.erp_arriveorder_b_pk == pk_arriveorder_b)
|
||||||
|
.Where(x => x.id == item.mes_detail_id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
int updateRow = await _db.Updateable<WmsPurchaseH>()
|
||||||
|
.SetColumns(x => x.erp_arriveorder_pk == pk_arriveorder)
|
||||||
|
.Where(x => x.bill_code == billCode)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
|
||||||
|
if (flag || updateRow <= 0 || updateDRow <= 0)
|
||||||
|
{
|
||||||
|
Log.Error($"更新失败,requestDtos:{JsonConvert.SerializeObject(requestDtos)},responsetDtos:{JsonConvert.SerializeObject(responsetDtos)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.Error(e.Message,e);
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return "true";
|
return "true";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user