生产报告回写id 产成品入库修改
This commit is contained in:
@@ -15,6 +15,7 @@ using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
@@ -154,6 +155,45 @@ namespace Tnb.BasicData
|
||||
}
|
||||
}
|
||||
|
||||
if (thirdResult.Code == 200 && record.third_name == "BIP" && record.name == "生产报告")
|
||||
{
|
||||
Dictionary<string,object> requestData = JsonConvert.DeserializeObject<Dictionary<string,object>>(record.request_data);
|
||||
|
||||
string reportId = requestData.ContainsKey("report_id") ? requestData["report_id"].ToString() : "";
|
||||
if (string.IsNullOrEmpty(reportId))
|
||||
{
|
||||
Log.Error($"请求记录id{record.id}生产报告提报id为空");
|
||||
}
|
||||
|
||||
JObject data = (JObject)thirdResult.msg;
|
||||
JToken children = data.SelectToken("children")[0];
|
||||
var responsetDtos = children.Select(x => new ErpReportDto()
|
||||
{
|
||||
pk_wr_product = x["valueIndex"]["pk_wr_product"].ToString(),
|
||||
pk_wr = x["valueIndex"]["pk_wr"].ToString(),
|
||||
report_id = reportId
|
||||
}).ToList();
|
||||
|
||||
int updateRow = 0;
|
||||
foreach (var item in responsetDtos)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.pk_wr) && !string.IsNullOrEmpty(item.pk_wr_product))
|
||||
{
|
||||
updateRow += await db.Updateable<PrdReport>()
|
||||
.SetColumns(x => x.erp_pk_wr == item.pk_wr)
|
||||
.SetColumns(x => x.erp_pk_wr_product == item.pk_wr_product)
|
||||
.Where(x => x.id == item.report_id)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (updateRow <= 0)
|
||||
{
|
||||
Log.Error($"请求记录{record.id}更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Reference in New Issue
Block a user