|
|
@ -779,9 +779,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false); |
|
|
|
var data = ms.ToArray(); |
|
|
|
var tupleList = this.ImportInternal<VmiLog>(data); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (tupleList.Any(o => o.Item2.Count > 0)) |
|
|
|
{ |
|
|
|
using var workbook = new XLWorkbook(new MemoryStream(data)); |
|
|
@ -876,18 +873,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
seDetails.Add(seDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var result = await CheckBusinessJISLocation(seDetails,businessType).ConfigureAwait(false); |
|
|
|
if (result != "ok") |
|
|
|
{ |
|
|
|
return new JsonResult(new { code = 400, message = "发运数据有不在" + result + "库位中" }); |
|
|
|
return new JsonResult(new { code = 400, message = result }); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return await BeginTran(seDetails, logList).ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
if (businessType == EnumBusinessType.JisHBPO ) |
|
|
|
if (businessType == EnumBusinessType.JisHBPO) |
|
|
|
{ |
|
|
|
List<HBPO_SE_DETAIL> seDetails = new List<HBPO_SE_DETAIL>(); |
|
|
|
foreach (var item in logList) |
|
|
@ -925,12 +918,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
seDetail.Remark = "期初初始化"; |
|
|
|
seDetails.Add(seDetail); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var result = await CheckBusinessJISLocation(seDetails, businessType).ConfigureAwait(false); |
|
|
|
if (result != "ok") |
|
|
|
{ |
|
|
|
return new JsonResult(new { code = 400, message = "发运数据有不再" + result + "库位中" }); |
|
|
|
return new JsonResult(new { code = 400, message = result }); |
|
|
|
} |
|
|
|
return await BeginTran(seDetails, logList).ConfigureAwait(false); |
|
|
|
} |
|
|
@ -973,14 +966,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
seDetails.Add(seDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var result = await CheckBusinessJISLocation(seDetails, businessType).ConfigureAwait(false); |
|
|
|
if (result != "ok") |
|
|
|
{ |
|
|
|
return new JsonResult(new { code = 400, message = "发运数据有不再" + result + "库位中" }); |
|
|
|
return new JsonResult(new { code = 400, message = result }); |
|
|
|
} |
|
|
|
return await BeginTran(seDetails, logList).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
if (businessType == EnumBusinessType.ZhiGongJianBBAC) |
|
|
|
{ |
|
|
|
List<PUB_SE_DETAIL> seDetails = new List<PUB_SE_DETAIL>(); |
|
|
@ -1021,7 +1014,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var result = await CheckBusinessPUBLocation(seDetails, businessType).ConfigureAwait(false); |
|
|
|
if (result != "ok") |
|
|
|
{ |
|
|
|
return new JsonResult(new { code = 400, message = "发运数据有不再" + result + "库位中" }); |
|
|
|
return new JsonResult(new { code = 400, message = result }); |
|
|
|
} |
|
|
|
return await BeginTran(seDetails, logList).ConfigureAwait(false); |
|
|
|
} |
|
|
@ -1065,7 +1058,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var result = await CheckBusinessPUBLocation(seDetails, businessType).ConfigureAwait(false); |
|
|
|
if (result != "ok") |
|
|
|
{ |
|
|
|
return new JsonResult(new { code = 400, message = "发运数据有不再" + result + "库位中" }); |
|
|
|
return new JsonResult(new { code = 400, message = result }); |
|
|
|
} |
|
|
|
return await BeginTran(seDetails, logList).ConfigureAwait(false); |
|
|
|
} |
|
|
@ -1109,10 +1102,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var result = await CheckBusinessPUBLocation(seDetails, businessType).ConfigureAwait(false); |
|
|
|
if (result != "ok") |
|
|
|
{ |
|
|
|
return new JsonResult(new { code = 400, message = "发运数据有不再" + result + "库位中" }); |
|
|
|
return new JsonResult(new { code = 400, message = result }); |
|
|
|
} |
|
|
|
return await BeginTran(seDetails, logList).ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
if (businessType == EnumBusinessType.YinDuJian) |
|
|
|
{ |
|
|
@ -1154,7 +1146,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var result = await CheckBusinessPUBLocation(seDetails, businessType).ConfigureAwait(false); |
|
|
|
if (result != "ok") |
|
|
|
{ |
|
|
|
return new JsonResult(new { code = 400, message = "发运数据有不再" + result + "库位中" }); |
|
|
|
return new JsonResult(new { code = 400, message = result }); |
|
|
|
} |
|
|
|
return await BeginTran(seDetails, logList).ConfigureAwait(false); |
|
|
|
} |
|
|
@ -1176,7 +1168,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<IActionResult> BeginTran<T>(List<T> p_list, List<VmiLog> logList) where T : SE_BASE, new() |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
//var messageList = logList.Select(log => new VmiMessage { Message = JsonSerializer.Serialize(log) }).ToList();
|
|
|
|
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); |
|
|
|
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options; |
|
|
@ -1191,6 +1183,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
{ |
|
|
|
itm.Version = GetVersionByBillTime(itm.BillTime.Value, value); |
|
|
|
} |
|
|
|
foreach (var itm in p_list) |
|
|
|
{ |
|
|
|
itm.Version= GetVersionByBillTime(itm.ShippingDate, value); |
|
|
|
} |
|
|
|
|
|
|
|
await context.BulkInsertAsync(p_list).ConfigureAwait(false); |
|
|
|
await context.BulkInsertAsync(logList).ConfigureAwait(false); |
|
|
|
transaction.Commit(); |
|
|
@ -1217,6 +1214,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<string> CheckBusinessJISLocation<T>(List<T> p_list, EnumBusinessType enumBusinessType) where T : JisSeBase, new() |
|
|
|
{ |
|
|
|
if (p_list.Count == 0) |
|
|
|
{ |
|
|
|
return "符合条件记录为0,请检查记录中EDI生产码、发运类型等 是否录入正确" ; |
|
|
|
} |
|
|
|
var locList = _codeRepository.Where(p => p.Project == "库位").ToList(); |
|
|
|
switch (enumBusinessType) |
|
|
|
{ |
|
|
@ -1254,7 +1255,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var locs = locList.Select(p => p.Description).ToList(); |
|
|
|
if (p_list.Any(p => !locs.Contains(p.ErpToLoc))) |
|
|
|
{ |
|
|
|
return string.Join(",", locs); |
|
|
|
return "发运数据有不再" + string.Join(",", locs) + "库位中" ; |
|
|
|
} |
|
|
|
return "ok" ; |
|
|
|
} |
|
|
@ -1267,6 +1268,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<string> CheckBusinessPUBLocation(List<PUB_SE_DETAIL> p_list, EnumBusinessType enumBusinessType) |
|
|
|
{ |
|
|
|
if (p_list.Count == 0) |
|
|
|
{ |
|
|
|
return "符合条件记录为0,请检查记录中EDI生产码、发运类型等 是否录入正确"; |
|
|
|
} |
|
|
|
var locList = _codeRepository.Where(p => p.Project == "库位").ToList(); |
|
|
|
switch (enumBusinessType) |
|
|
|
{ |
|
|
@ -1288,7 +1293,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var locs = locList.Select(p => p.Description).ToList(); |
|
|
|
if (p_list.Any(p => !locs.Contains(p.ToErpLocCode))) |
|
|
|
{ |
|
|
|
return string.Join(",",locs) ; |
|
|
|
return "发运数据有不再" + string.Join(",", locs) + "库位中"; |
|
|
|
} |
|
|
|
|
|
|
|
return "ok"; |
|
|
@ -1337,7 +1342,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
//List<BBAC_SE_DETAIL> seDetails = new List<BBAC_SE_DETAIL>();
|
|
|
|
//List<HBPO_SE_DETAIL> hbpo_seDetails=new List<HBPO_SE_DETAIL>();
|
|
|
|
//List<PUB_SE_DETAIL> pub_seDetails=new List<PUB_SE_DETAIL>();
|
|
|
|
|
|
|
|
//foreach (var item in logList)
|
|
|
|
//{
|
|
|
|
// if(item.DeliverBillType== EnumDeliverBjBmpBillType.JIS件&&item.DeliverSubBillType== EnumDeliverSubBillType.保险杠BBAC)
|
|
|
@ -1370,12 +1374,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
// seDetail.LU = item.CustPartCode;
|
|
|
|
// seDetail.CustPartCode = item.CustPartCode;
|
|
|
|
// seDetail.BillTime= item.BillTime;
|
|
|
|
|
|
|
|
// seDetail.Remark = "期初初始化";
|
|
|
|
|
|
|
|
// seDetails.Add(seDetail);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (item.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && item.DeliverSubBillType == EnumDeliverSubBillType.买单件小件BBAC)
|
|
|
|
// {
|
|
|
|
// BBAC_SE_DETAIL seDetail = new BBAC_SE_DETAIL();
|
|
|
@ -1406,12 +1407,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
// seDetail.LU = item.CustPartCode;
|
|
|
|
// seDetail.CustPartCode = item.CustPartCode;
|
|
|
|
// seDetail.BillTime = item.BillTime;
|
|
|
|
|
|
|
|
// seDetail.Remark = "期初初始化";
|
|
|
|
|
|
|
|
// seDetails.Add(seDetail);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (item.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && item.DeliverSubBillType == EnumDeliverSubBillType.保险杠HBPO)
|
|
|
|
// {
|
|
|
|
// HBPO_SE_DETAIL seDetail = new HBPO_SE_DETAIL();
|
|
|
@ -1442,12 +1440,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
// seDetail.LU = item.CustPartCode;
|
|
|
|
// seDetail.CustPartCode = item.CustPartCode;
|
|
|
|
// seDetail.BillTime = item.BillTime;
|
|
|
|
|
|
|
|
// seDetail.Remark = "期初初始化";
|
|
|
|
|
|
|
|
// hbpo_seDetails.Add(seDetail);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (item.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && item.DeliverSubBillType == EnumDeliverSubBillType.买单件小件HBPO)
|
|
|
|
// {
|
|
|
|
// HBPO_SE_DETAIL seDetail = new HBPO_SE_DETAIL();
|
|
|
@ -1478,12 +1473,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
// seDetail.LU = item.CustPartCode;
|
|
|
|
// seDetail.CustPartCode = item.CustPartCode;
|
|
|
|
// seDetail.BillTime = item.BillTime;
|
|
|
|
|
|
|
|
// seDetail.Remark = "期初初始化";
|
|
|
|
|
|
|
|
// hbpo_seDetails.Add(seDetail);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (item.DeliverBillType == EnumDeliverBjBmpBillType.JIT直供件 && item.DeliverSubBillType == EnumDeliverSubBillType.JIT直供件BBAC)
|
|
|
|
// {
|
|
|
|
// PUB_SE_DETAIL seDetail = new PUB_SE_DETAIL();
|
|
|
@ -1514,12 +1506,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
// seDetail.LU = item.CustPartCode;
|
|
|
|
// seDetail.CustPartCode = item.CustPartCode;
|
|
|
|
// seDetail.BillTime = item.BillTime;
|
|
|
|
|
|
|
|
// seDetail.Remark = "期初初始化";
|
|
|
|
|
|
|
|
// pub_seDetails.Add(seDetail);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (item.DeliverBillType == EnumDeliverBjBmpBillType.JIT直供件 && item.DeliverSubBillType == EnumDeliverSubBillType.JIT直供件HBPO)
|
|
|
|
// {
|
|
|
|
// PUB_SE_DETAIL seDetail = new PUB_SE_DETAIL();
|
|
|
@ -1550,12 +1539,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
// seDetail.LU = item.CustPartCode;
|
|
|
|
// seDetail.CustPartCode = item.CustPartCode;
|
|
|
|
// seDetail.BillTime = item.BillTime;
|
|
|
|
|
|
|
|
// seDetail.Remark = "期初初始化";
|
|
|
|
|
|
|
|
// pub_seDetails.Add(seDetail);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (item.DeliverBillType == EnumDeliverBjBmpBillType.北汽4S备件 && item.DeliverSubBillType == EnumDeliverSubBillType.北汽4S备件BBAC)
|
|
|
|
// {
|
|
|
|
// PUB_SE_DETAIL seDetail = new PUB_SE_DETAIL();
|
|
|
@ -1586,12 +1572,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
// seDetail.LU = item.CustPartCode;
|
|
|
|
// seDetail.CustPartCode = item.CustPartCode;
|
|
|
|
// seDetail.BillTime = item.BillTime;
|
|
|
|
|
|
|
|
// seDetail.Remark = "期初初始化";
|
|
|
|
|
|
|
|
// pub_seDetails.Add(seDetail);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (item.DeliverBillType == EnumDeliverBjBmpBillType.印度件 && item.DeliverSubBillType == EnumDeliverSubBillType.印度件BBAC)
|
|
|
|
// {
|
|
|
|
// PUB_SE_DETAIL seDetail = new PUB_SE_DETAIL();
|
|
|
@ -1622,15 +1605,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
// seDetail.LU = item.CustPartCode;
|
|
|
|
// seDetail.CustPartCode = item.CustPartCode;
|
|
|
|
// seDetail.BillTime = item.BillTime;
|
|
|
|
|
|
|
|
// seDetail.Remark = "期初初始化";
|
|
|
|
|
|
|
|
// pub_seDetails.Add(seDetail);
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//var messageList = logList.Select(log => new VmiMessage { Message = JsonSerializer.Serialize(log) }).ToList();
|
|
|
|
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); |
|
|
|
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options; |
|
|
|