同步erp用户

This commit is contained in:
2024-10-09 08:44:01 +08:00
parent e26e405006
commit 92d5a5400f
6 changed files with 132 additions and 38 deletions

View File

@@ -41,9 +41,32 @@ namespace Tnb.BasicData
}
[HttpGet]
[AllowAnonymous]
public async Task<string> Send(string id)
{
ThirdWebapiRecord record = await _repository.GetSingleAsync(x=>x.id==id);
if (record.name == "产成品入库")
{
Dictionary<string, object> requestData = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(record.request_data)[0];
string reportId = requestData["report_id"].ToString();
PrdReport report = await _repository.AsSugarClient().Queryable<PrdReport>().Where(x=>x.id==reportId).SingleAsync();
if (report != null && !string.IsNullOrEmpty(report.erp_pk_wr) && !string.IsNullOrEmpty(report.erp_pk_wr_product))
{
requestData["csourcebillhid"] = report.erp_pk_wr;
JArray dtls = (JArray)requestData["dtls"];
foreach (var item in dtls)
{
item["csourcebillhid"] = report.erp_pk_wr;
item["csourcebillbid"] = report.erp_pk_wr_product;
}
record.request_data = JsonConvert.SerializeObject(requestData);
await _repository.AsSugarClient().Updateable<ThirdWebapiRecord>()
.SetColumns(x => x.request_data == record.request_data)
.Where(x => x.id == record.id)
.ExecuteCommandAsync();
}
}
ThirdResult thirdResult = await Send(Arrays.AsList(record), "手动",null,false);
return thirdResult.msgResult;
}