@ -269,7 +269,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
throw new BusinessException ( "导入模板数据不能为空!" ) ;
}
//物料号不能为空,直接过滤掉,模板的中看不到有空行的情况,但是通过个IE这个插件发现有空行数据导入
var _l ist = _l istOrgin . Where ( p = > ! string . IsNullOrEmpty ( p . SapMaterialCode ) ) ;
var _l ist = _l istOrgin . Where ( p = > ! string . IsNullOrEmpty ( p . SapMaterialCode ) ) ;
foreach ( var itm in _l ist )
{
@ -278,7 +278,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
checkList . Add ( new ErrorExportDto ( version , "红旗一轿出库单导入" , string . Empty , string . Empty , string . Empty , string . Empty , string . Format ( "导入模板中SAP编码{0}的是否备件及客户号不能为空,影响出库请检查!" , itm . SapMaterialCode ) , string . Empty ) ) ;
}
}
foreach ( var itm in _l ist )
{
if ( itm . IsBack ! = "是" & & itm . IsBack ! = "否" )
@ -287,14 +287,26 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
}
}
//和物料主数据中SAP物料号检验是否存在
foreach ( var itm in _l ist )
var gethqimportdata = _l ist . Select ( p = > p . SapMaterialCode ) . Distinct ( ) . ToList ( ) ;
var getmaterial = _ erpdapperRepository . GetMaterialList ( ) ;
var queryCheck = from itm in gethqimportdata
join itm1 in getmaterial on itm equals itm1 . MaterialCode into temp1
from tm1 in temp1 . DefaultIfEmpty ( )
where tm1 = = null
select itm ;
foreach ( var itm in queryCheck )
{
if ( ! _ erpdapperRepository . GetMaterialList ( ) . Any ( p = > p . MaterialCode = = itm . SapMaterialCode ) )
{
checkList . Add ( new ErrorExportDto ( version , "红旗一轿出库单导入" , string . Empty , string . Empty , itm . SapMaterialCode , string . Empty , string . Format ( "物料主数据不存在当前导入的物料号{0}!" , itm . SapMaterialCode ) , string . Empty ) ) ;
}
checkList . Add ( new ErrorExportDto ( version , "红旗一轿出库单导入" , string . Empty , string . Empty , itm , string . Empty , string . Format ( "物料主数据不存在当前导入的物料号{0}!" , itm ) , string . Empty ) ) ;
}
//foreach (var itm in _list)
//{
// if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.SapMaterialCode))
// {
// checkList.Add(new ErrorExportDto(version, "红旗一轿出库单导入", string.Empty, string.Empty, itm.SapMaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.SapMaterialCode), string.Empty));
// }
//}
if ( checkList . Count > 0 )
{
@ -314,11 +326,11 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
}
}
var getbillName = "HQVSBT" ; //混合数据
if ( _l ist . FirstOrDefault ( ) . Extend = = "100113" )
if ( _l ist . FirstOrDefault ( ) . Extend = = "100113" )
{
getbillName = "BT" ; //一轿
}
else if ( _l ist . FirstOrDefault ( ) . Extend = = "100053" )
else if ( _l ist . FirstOrDefault ( ) . Extend = = "100053" )
{
getbillName = "HQKB" ; //红旗
}
@ -346,14 +358,14 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
0 ,
0 ,
itm . Price ,
Math . Round ( ( itm . Price * itm . Qty ) , 2 )
Math . Round ( ( itm . Price * itm . Qty ) , 2 )
) ;
await _ wmsRepository . GetDbContext ( ) . BulkInsertAsync ( query . ToList ( ) , new BulkConfig ( ) { BulkCopyTimeout = 0 , BatchSize = 1 0 0 0 0 } ) ;
int _ count = _ wmsVersionRepository . Count ( p = > p . Version = = version & & p . BillNum = = _ billNum ) ;
if ( _ count = = 0 )
{
var _ version = new WmsHQWithOutKanbanOutPut ( GuidGenerator . Create ( ) , version , _ billNum , CurrentUser . Email , string . Empty ) ;
var _ version = new WmsHQWithOutKanbanOutPut ( GuidGenerator . Create ( ) , version , _ billNum , CurrentUser . Email , string . Empty ) ;
await _ wmsVersionRepository . InsertAsync ( _ version , true ) ;
}
return ApplicationConsts . SuccessStr ; ;