生产报告回写id 产成品入库修改

This commit is contained in:
2024-08-30 15:27:17 +08:00
parent 60c27e331d
commit 285618ada9
8 changed files with 106 additions and 6 deletions

View File

@@ -159,5 +159,14 @@ public partial class PrdReport : BaseEntity<string>
/// 质检结果
/// </summary>
public string check_result { get; set; }
/// <summary>
/// 表头主键
/// </summary>
public string erp_pk_wr { get; set; }
/// <summary>
/// 表体主键
/// </summary>
public string erp_pk_wr_product { get; set; }
}

View File

@@ -2481,6 +2481,7 @@ namespace Tnb.ProductionMgr
erpRequestData.Add("vtrantypeid","0001A11000000002LVX8");
erpRequestData.Add("vdef1",null);
erpRequestData.Add("vdef2",null);
erpRequestData.Add("report_id",report.id);
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();

View File

@@ -823,6 +823,45 @@ namespace Tnb.ProductionMgr
}
}
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();
}