@ -59,73 +59,73 @@ namespace TaskJob.Services
{
{
var filePath = fileSavePath + itm ; //获取到导入的excel
var filePath = fileSavePath + itm ; //获取到导入的excel
var exten = Path . GetExtension ( fileSavePath ) ;
var exten = Path . GetExtension ( fileSavePath ) ;
List < string > _ errorList = new List < string > ( ) ;
//List<string> _errorList = new List<string>();
var checkList = new List < ErrorExportDto > ( ) ;
//var checkList = new List<ErrorExportDto>();
//var _chList = await _relrepository.GetAllAsync(GuidGenerator.Create(), true);
//// var _chList = await _relrepository.GetAllAsync(GuidGenerator.Create(), true);
//var _chls = _chList.Select(p => p.SettleMaterialCode).Distinct();
//// var _chls = _chList.Select(p => p.SettleMaterialCode).Distinct();
List < string > _ precodeList = new List < string > ( ) ; //
//List<string> _precodeList = new List<string>(); //
if ( exten . ToUpper ( ) = = ".TXT" )
//if (exten.ToUpper() == ".TXT")
{
//{
using ( TextReader textReader = new StreamReader ( filePath ) )
// using (TextReader textReader = new StreamReader(filePath))
{
// {
int i = 0 ;
// int i = 0;
while ( true )
// while (true)
{
// {
string str = textReader . ReadLine ( ) ;
// string str = textReader.ReadLine();
if ( string . IsNullOrEmpty ( str ) )
// if (string.IsNullOrEmpty(str))
{
// {
break ;
// break;
}
// }
else
// else
{
// {
try
// try
{
// {
var _l st = str . Split ( new c har [ ] { '|' } ) . ToList ( ) ;
// var _lst = str.Split(new c har[] { '|' }).ToList();
string _ settleyear = _l st [ 1 ] . Trim ( ) ;
// string _settleyear = _lst[1].Trim();
string _ kENNCode = _l st [ 2 ] . Trim ( ) ;
// string _kENNCode = _lst[2].Trim();
string _ chassisNumber = _l st [ 3 ] . Trim ( ) ;
// string _chassisNumber = _lst[3].Trim();
string _ model = _l st [ 4 ] . Trim ( ) ;
// string _model = _lst[4].Trim();
DateTime _ cP5A = DateTime . Parse ( _l st [ 5 ] . Trim ( ) ) ;
// DateTime _cP5A = DateTime.Parse(_lst[5].Trim());
DateTime _ cP7 = DateTime . Parse ( _l st [ 6 ] . Trim ( ) ) ;
// DateTime _cP7 = DateTime.Parse(_lst[6].Trim());
string _ materialCode = _l st [ 7 ] . Trim ( ) ;
// string _materialCode = _lst[7].Trim();
decimal _ qty = decimal . Parse ( _l st [ 8 ] . Trim ( ) ) ;
// decimal _qty = decimal.Parse(_lst[8].Trim());
string _ settlementID = _l st [ 9 ] . Trim ( ) ;
// string _settlementID = _lst[9].Trim();
string _ settlementSupplier = _l st [ 1 0 ] . Trim ( ) ;
// string _settlementSupplier = _lst[10].Trim();
_ setls . Add ( new Win . Sfs . SettleAccount . Entities . SettleAccounts . SettleAccount (
// _setls.Add(new Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount(
Guid . NewGuid ( ) ,
// Guid.NewGuid(),
Guid . NewGuid ( ) ,
// Guid.NewGuid(),
_ settleyear ,
// _settleyear,
_ kENNCode ,
// _kENNCode,
_ chassisNumber ,
// _chassisNumber,
_ model ,
// _model,
_ cP5A ,
// _cP5A,
_ cP7 ,
// _cP7,
_ materialCode ,
// _materialCode,
_ qty ,
// _qty,
_ settlementID ,
// _settlementID,
_ settlementSupplier ,
// _settlementSupplier,
DateTime . Now . Year . ToString ( ) ,
// DateTime.Now.Year.ToString(),
DateTime . Now . Month . ToString ( ) ,
// DateTime.Now.Month.ToString(),
_ id ,
// _id,
version ,
// version,
DateTime . Now ,
// DateTime.Now,
Guid . NewGuid ( )
// Guid.NewGuid()
) ) ;
// ));
}
// }
c atch
// c atch
{
// {
}
// }
}
// }
i + + ;
// i++;
}
// }
textReader . Close ( ) ;
// textReader.Close();
}
// }
}
//}
else
//else
{
//{
// _setls= _inputService.Input<Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount>(filePath);
// _setls= _inputService.Input<Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount>(filePath);
var errorlist = new List < ErrorExportDto > ( ) ;
var errorlist = new List < ErrorExportDto > ( ) ;
var dtoList = _ inputService . Input < SettleAccountImportDto > ( filePath , null , errorlist ) ;
var dtoList = _ inputService . Input < SettleAccountImportDto > ( filePath , null , errorlist ) ;
foreach ( var dto in dtoList )
foreach ( var dto in dtoList )
{
{
@ -139,7 +139,7 @@ namespace TaskJob.Services
DateTime . Now . Month . ToString ( ) , dto . SettleYear , _ id , version , DateTime . Now , Guid . NewGuid ( ) ) ;
DateTime . Now . Month . ToString ( ) , dto . SettleYear , _ id , version , DateTime . Now , Guid . NewGuid ( ) ) ;
_ setls . Add ( _ settleaccount ) ;
_ setls . Add ( _ settleaccount ) ;
}
}
}
//}
#region
#region
//var errorFileName = "错误文件.xlsx";
//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));
//checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}底盘号 {1}有重复", "11111111111", "22222222222"), string.Empty));