委外到货
This commit is contained in:
@@ -268,6 +268,59 @@ 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);
|
||||
//((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<WmsOutsourceD>()
|
||||
.SetColumns(x => x.erp_arriveorder_b_pk == pk_arriveorder_b)
|
||||
.Where(x => x.id == item.mes_detail_id)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
int updateRow = await db.Updateable<WmsOutsourceH>()
|
||||
.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)}");
|
||||
}
|
||||
}
|
||||
|
||||
if (thirdResult.Code == 200 && record.third_name == "BIP" && record.name == "生产报告")
|
||||
{
|
||||
Dictionary<string,object> requestData = JsonConvert.DeserializeObject<Dictionary<string,object>>(record.request_data);
|
||||
|
||||
Reference in New Issue
Block a user