@ -61,72 +61,7 @@ namespace TaskJob.Services
{
var filePath = fileSavePath + itm ; //获取到导入的excel
var exten = Path . GetExtension ( fileSavePath ) ;
//List<string> _errorList = new List<string>();
//var checkList = new List<ErrorExportDto>();
////var _chList = await _relrepository.GetAllAsync(GuidGenerator.Create(), true);
////var _chls = _chList.Select(p => p.SettleMaterialCode).Distinct();
//List<string> _precodeList = new List<string>();//
//if (exten.ToUpper() == ".TXT")
//{
// using (TextReader textReader = new StreamReader(filePath))
// {
// int i = 0;
// while (true)
// {
// string str = textReader.ReadLine();
// if (string.IsNullOrEmpty(str))
// {
// break;
// }
// else
// {
// try
// {
// var _lst = str.Split(new char[] { '|' }).ToList();
// string _settleyear = _lst[1].Trim();
// string _kENNCode = _lst[2].Trim();
// string _chassisNumber = _lst[3].Trim();
// string _model = _lst[4].Trim();
// DateTime _cP5A = DateTime.Parse(_lst[5].Trim());
// DateTime _cP7 = DateTime.Parse(_lst[6].Trim());
// string _materialCode = _lst[7].Trim();
// decimal _qty = decimal.Parse(_lst[8].Trim());
// string _settlementID = _lst[9].Trim();
// string _settlementSupplier = _lst[10].Trim();
// _setls.Add(new Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount(
// Guid.NewGuid(),
// Guid.NewGuid(),
// _settleyear,
// _kENNCode,
// _chassisNumber,
// _model,
// _cP5A,
// _cP7,
// _materialCode,
// _qty,
// _settlementID,
// _settlementSupplier,
// DateTime.Now.Year.ToString(),
// DateTime.Now.Month.ToString(),
// _id,
// version,
// DateTime.Now,
// Guid.NewGuid()
// ));
// }
// catch
// {
// }
// }
// i++;
// }
// textReader.Close();
// }
//}
//else
//{
// _setls= _inputService.Input<Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount>(filePath);
var errorlist = new List < ErrorExportDto > ( ) ;
var dtoList = _ inputService . Input < SettleAccountImportDto > ( filePath , null , errorlist ) ;
foreach ( var dto in dtoList )
@ -139,13 +74,12 @@ namespace TaskJob.Services
dto . ChassisNumber , dto . Model , dto . CP5A , dto . CP7 ,
Regex . Replace ( dto . MaterialCode , @"\s" , "" ) , dto . Qty , dto . SettlementID , dto . SettlementSupplier ,
DateTime . Now . Month . ToString ( ) , dto . SettleYear , _ id , version , DateTime . Now , Guid . NewGuid ( ) ) ;
_ setls . Add ( _ settleaccount ) ;
_ setls . Add ( _ settleaccount ) ;
}
//}
#region
//var errorFileName = "错误文件.xlsx";
//checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}底盘号 {1}有重复", "11111111111", "22222222222"), string.Empty));
//_service.ExportError<ErrorExportDto>(id,errorFileName, checkList);
#endregion
}
@ -158,8 +92,7 @@ namespace TaskJob.Services
_ setls = _ setls . GroupBy ( p = > new { p . ChassisNumber , p . MaterialCode , p . KENNCode } ) . Select ( p = > p . FirstOrDefault ( ) ) . ToList ( ) ;
_ repository . Insert ( _ setls ) ;
_ versionRepository . Insert ( _ id , version , customerCode , customerCode ) ;
_ repository . GetDbContext ( ) . Database . ExecuteSqlRaw (
_ repository . GetDbContext ( ) . Database . ExecuteSqlRaw (
"EXEC sp_settle_fis_update"
) ;