@ -24,6 +24,10 @@ namespace Aucma.Core.PrintTo.ViewModels
{
private static readonly log4net . ILog log = LogManager . GetLogger ( typeof ( IndexPageViewModel ) ) ;
protected readonly IBaseOrderInfoServices _baseOrderInfoServices ;
/// <summary>
/// 打印类型
/// </summary>
public int printType { get ; set ; }
public IndexPageViewModel ( )
{
@ -37,55 +41,64 @@ namespace Aucma.Core.PrintTo.ViewModels
#region 加载DataGrid数据
private async void LoadData ( )
{
Datalist . Clear ( ) ;
List < PrintPlanInfoView > list = await _baseOrderInfoServices . QueryPrintInfo ( ) ;
if ( list = = null ) return ;
foreach ( var item in list )
{
try
{
datalist . Add ( new OrderInfo ( )
Datalist . Clear ( ) ;
List < PrintPlanInfoView > list = await _baseOrderInfoServices . QueryPrintInfo ( ) ;
if ( list = = null ) return ;
list = list . OrderBy ( d = > d . CreateTime ) . ToList ( ) ;
foreach ( var item in list )
{
CreatedTime = item . CreateTime ,
OrderCode = item . OrderCode ,
ProductCode = item . ProductCode ,
ProductName = item . ProductName ,
PlanAmount = item . PlanAmount ,
CompleteAmount = item . CompleteAmount ,
MaterialCode = item . MaterialCode ,
MaterialName = item . MaterialName ,
StandardAmount = item . StandardAmount ,
LinerAmount = item . LinerAmount ,
BoxAmount = item . StandardAmount ,
ErrorNum = item . ErrorAmount ,
LinerCodeNum = item . LinerAmount ,
BoxCodeNum = item . BoxAmount
} ) ;
OrderInfo order = new OrderInfo ( ) ;
order . CreatedTime = item . CreateTime ;
order . OrderCode = item . OrderCode ;
order . ProductCode = item . ProductCode ;
order . ProductName = item . ProductName ;
order . PlanAmount = item . PlanAmount ;
order . CompleteAmount = item . CompleteAmount ;
order . MaterialCode = item . MaterialCode ;
order . MaterialName = item . MaterialName ;
order . StandardAmount = item . StandardAmount ;
order . LinerAmount = item . LinerAmount ;
order . BoxAmount = item . StandardAmount ;
order . ErrorNum = item . ErrorAmount ;
order . LinerCodeNum = item . LinerAmount ;
order . BoxCodeNum = item . BoxAmount ;
order . PrintName = item . PrintName ;
datalist . Add ( order ) ;
}
}
catch ( Exception ex )
{
log . Error ( ex . Message ) ;
}
}
private async void LoadData ( string queryStr )
{
Datalist . Clear ( ) ;
List < PrintPlanInfoView > list = await _baseOrderInfoServices . QueryPrintInfo ( ) ;
if ( list = = null ) return ;
foreach ( var item in list . Where ( d = > d . OrderCode . Contains ( queryStr ) | | d . ProductCode . Contains ( queryStr ) | | d . ProductName . Contains ( queryStr ) | | d . MaterialCode . Contains ( queryStr ) | | d . MaterialName . Contains ( queryStr ) ) )
if ( list . Count ( ) = = 0 ) return ;
List < PrintPlanInfoView > pintList = list . Where ( d = > d . OrderCode . Contains ( queryStr ) | | d . ProductCode . Contains ( queryStr ) | | d . ProductName . Contains ( queryStr ) ) . ToList ( ) ;
foreach ( var item in pintList )
{
Datalist. Add ( new OrderInfo ( )
{
CreatedTime = item . CreateTime ,
OrderCode = item . OrderCode ,
ProductCode = item . ProductCode ,
ProductName = item . ProductName ,
PlanAmount = item . PlanAmount ,
CompleteAmount = item . CompleteAmount ,
MaterialCode = item . MaterialCode ,
MaterialName = item . MaterialName ,
StandardAmount = item . StandardAmount ,
LinerAmount = item . LinerAmount ,
BoxAmount = item . StandardAmount ,
ErrorNum = item . ErrorAmount ,
LinerCodeNum = item . LinerAmount ,
BoxCodeNum = item . BoxAmount
} ) ;
OrderInfo order = new OrderInfo ( ) ;
order . CreatedTime = item . CreateTime ;
order . OrderCode = item . OrderCode ;
order . ProductCode = item . ProductCode ;
order . ProductName = item . ProductName ;
order . PlanAmount = item . PlanAmount ;
order . CompleteAmount = item . CompleteAmount ;
order . MaterialCode = item . MaterialCode ;
order . MaterialName = item . MaterialName ;
order . StandardAmount = item . StandardAmount ;
order . LinerAmount = item . LinerAmount ;
order . BoxAmount = item . StandardAmount ;
order . ErrorNum = item . ErrorAmount ;
order . LinerCodeNum = item . LinerAmount ;
order . BoxCodeNum = item . BoxAmount ;
order . PrintName = item . PrintName ;
datalist . Add ( order ) ;
}
}
# endregion
@ -119,7 +132,7 @@ namespace Aucma.Core.PrintTo.ViewModels
log . Error ( "QueryString方法出现异常" ) ;
}
}
# endregion
#region radio查询按钮
@ -127,36 +140,15 @@ namespace Aucma.Core.PrintTo.ViewModels
/// 查询
/// </summary>
[RelayCommand]
private async Task RadioQuery ( string query )
private void RadioQuery ( string type )
{
tr y
if ( type= = "内胆" )
{
string materialName = string . Empty ;
Datalist . Clear ( ) ;
var list = await _baseOrderInfoServices . QueryPrintInfo ( ) ;
var orderList = list . Where ( d = > d . MaterialName . Contains ( query ) ) ;
foreach ( var item in orderList )
{
OrderInfo info = new OrderInfo ( ) ;
info . CreatedTime = item . CreateTime ;
info . OrderCode = item . OrderCode ;
info . ProductCode = item . ProductCode ;
info . ProductName = item . ProductName ;
info . PlanAmount = item . PlanAmount ;
info . CompleteAmount = item . CompleteAmount ;
info . MaterialCode = item . MaterialCode ;
info . MaterialName = item . MaterialName ;
info . StandardAmount = item . StandardAmount ;
info . ErrorNum = item . ErrorAmount ;
info . LinerCodeNum = item . LinerAmount ;
info . BoxCodeNum = item . BoxAmount ;
Datalist . Add ( info ) ;
}
printType = 200 ;
}
catch ( Exception ex )
if ( type = = "箱体" )
{
log. Error ( "查询数据异常" , ex ) ;
printType = 500 ;
}
}
# endregion
@ -188,13 +180,13 @@ namespace Aucma.Core.PrintTo.ViewModels
string order_code = SelectedCells . OrderCode ;
string product_code = SelectedCells . ProductCode ;
string product_name = SelectedCells . ProductName ;
string material_code = SelectedCells . MaterialCode ;
string material_name = SelectedCells . MaterialName ;
//string material_code = SelectedCells.MaterialCode ;
//string material_name = SelectedCells.MaterialName ;
int standard_amount = SelectedCells . StandardAmount ;
string printName = SelectedCells . PrintName ;
PrintIsEnabled = "False" ;
PrintToDevView printToDev = new PrintToDevView ( product_code, material_code , material _name, standard_amount , printNam e) ;
PrintToDevView printToDev = new PrintToDevView ( order_code, product_code , product _name, standard_amount , printNam e, printTyp e) ;
printToDev . ShowDialog ( ) ;
}
catch ( Exception ex )
@ -255,7 +247,7 @@ namespace Aucma.Core.PrintTo.ViewModels
int standard_amount = SelectedCells . StandardAmount ;
string printName = SelectedCells . PrintName ;
PrintIsEnabled = "False" ;
PrintToDevView printToDev = new PrintToDevView ( product_code, material_code , material _name, standard_amount , printNam e) ;
PrintToDevView printToDev = new PrintToDevView ( order_code, product_code , product _name, standard_amount , printNam e, printTyp e) ;
printToDev . ShowDialog ( ) ;
}
catch ( Exception ex )