临时恢复数据

optimize
wanghaomei 1 year ago
parent c6c21f8569
commit 17c13a948b

@ -8663,43 +8663,70 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
#region 临时测试使用
/// <summary>
/// 比对数据临时测试
/// 恢复场站数据临时使用
/// </summary>
/// <returns></returns>
[HttpPost("/BookingOrder/HCCompareTest"), AllowAnonymous]
[NonUnify]
public async Task<string> HCCompareTest()
[HttpGet("/BookingOrder/DataRepire"), AllowAnonymous]
public async Task DataRepire()
{
return
"{ " +
" \"Code\": 200, " +
" \"Message\": \"\", " +
" \"Data\": { " +
" \"Normal\": [ " +
" { " +
" \"Id\": 123123, " +
" \"MBLNO\": \"aaaaaaa\", " +
" \"Result\": \"没有此票业务\" " +
" } " +
" ], " +
" \"Deleted\": [ " +
" { " +
" \"Id\": 234234, " +
" \"MBLNO\": \"bbbbbbb\", " +
" \"Result\": \"此业务未删除\" " +
" } " +
" ] " +
" } " +
"} ";
}
var basePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "DataRepire");
if (Directory.Exists(basePath))
{
var files = Directory.GetFiles(basePath, "*.txt");
foreach (var f in files)
{
try
{
var jobj = JObject.Parse(File.ReadAllText(f));
var jinput = jobj.GetJObjectValue("input");
[HttpGet("/BookingOrder/AutoYard"), AllowAnonymous]
public async Task AutoYard(long bookId = 437779259732037)
{
await AutoYardData(bookId);
var bookId = Convert.ToInt64(Path.GetFileNameWithoutExtension(f));
var bookOrd = _rep.AsQueryable().Filter(null, true).First(x => x.Id == bookId);
var dbCtns = _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == bookId).ToList();
foreach (var dbCtn in dbCtns)
{
dbCtn.IsDeleted = true;
dbCtn.REMARK = "系统恢复删除";
_repCtn.Update(dbCtn);
}
var jarrCtn = jinput.GetJArrayValue("ctnInputs");
foreach (JObject jc in jarrCtn)
{
var ctnentity = new BookingCtn();
ctnentity.Id = YitIdHelper.NextId();
ctnentity.CTNCODE = jc.GetStringValue("ctncode");
ctnentity.CTNALL = jc.GetStringValue("ctnall");
ctnentity.CTNNUM = jc.GetIntValue("ctnnum");
ctnentity.CNTRNO = jc.GetStringValue("cntrno");
ctnentity.SEALNO = jc.GetStringValue("sealno");
ctnentity.PKGS = jc.GetIntValue("pkgs");
ctnentity.KINDPKGS = jc.GetStringValue("kindpkgs");
ctnentity.KGS = jc.GetDecimalValue("kgs");
ctnentity.CBM = jc.GetDecimalValue("cbm");
ctnentity.WEIGHTYPE = jc.GetStringValue("weightype");
ctnentity.WEIGHKGS = jc.GetDecimalValue("weighkgs");
ctnentity.BILLID = bookId;
ctnentity.CreatedUserName = "系统恢复";
ctnentity.REMARK = "系统恢复";
ctnentity.TEU = 0;
ctnentity.TAREWEIGHT = jc.GetDecimalValue("tareweight");
ctnentity.CreatedUserId = bookOrd.CreatedUserId;
ctnentity.TenantId = bookOrd.TenantId;
await _repCtn.InsertAsync(ctnentity);
}
File.Delete(f);
}
catch
{
}
}
}
}
#endregion
#region 打印船公司ONE的订舱附件

Loading…
Cancel
Save