Quintiq file version 2.0
|
#parent: #root
|
StaticMethod CheckImport (
|
MacroPlan macroplan
|
)
|
{
|
TextBody:
|
[*
|
// 甄兰鸽 Aug-22-2024 (created)
|
if( exists( macroplan, ChangeLossSettingExcel, excel, excel.Product1() = ''
|
or excel.Product2() = ''
|
or excel.Unit() = ''
|
or excel.ChangeLossNumber() = ''
|
or not excel.StartDate().IsFinite()
|
or not excel.EndDate().IsFinite() ) ){
|
error( Translations::MP_ChangeLossSettingExcel_Import_NullInputRequiredField() );
|
}
|
//导入的数量小于0
|
if( exists( macroplan, ChangeLossSettingExcel, excel, [Real]excel.ChangeLossNumber() <= 0 ) ){
|
error( Translations::MP_ChangeLossSettingExcel_Import_PositiveInteger() );
|
}
|
//导入产品是否存在
|
productfirsts := selectuniquevalues( macroplan, ChangeLossSettingExcel, excel, excel.Product1() );
|
productseconds := selectuniquevalues( macroplan, ChangeLossSettingExcel, excel, excel.Product2() );
|
productids := productfirsts.Union( productseconds );
|
nonproductids := selectuniquevalues( productids, Elements, e, not exists( macroplan, Product_MP, product, product.ID() = e ), e );
|
if( nonproductids.Size() > 0 ){
|
error( Translations::MP_ChangeLossSettingExcel_Import_ProductNoExist( nonproductids.Concatenate( ";" ) ) );
|
//if( exists( macroplan, ChangeLossSettingExcel, excel, not exists( macroplan, Product_MP, product, product.ID() = excel.Product1() or product.ID() = excel.Product2() ) ) ){
|
// error( Translations::MP_ChangeLossSettingExcel_Import_ProductNoExist() );
|
}
|
//导入产线是否存在
|
if( exists( macroplan, ChangeLossSettingExcel, excel, not exists( macroplan, Unit, unit, unit.ID() = excel.Unit() ) ) ){
|
error( Translations::MP_ChangeLossSettingExcel_Import_UnitNoExist() );
|
}
|
//导入的两个产品相等
|
if( exists( macroplan, ChangeLossSettingExcel, excel, excel.Product1() = excel.Product2() ) ){
|
error( Translations::MP_ChangeLossSetting_SameProduct() );
|
}
|
//导入的时间区间校验
|
if( exists( macroplan, ChangeLossSettingExcel, excel, excel.StartDate() > excel.EndDate() ) ){
|
error( Translations::MP_LibCal_Event_ValidDatePeriod() );
|
}
|
//重复导入校验
|
//if( selectduplicates( owner, LaneExcel, excel, excel.StartFrom(),
|
// excel.EndTo(),
|
// excel.StartStockingPoint(),
|
// excel.EndStockingPoint(),
|
// excel.TransporationType(),
|
// excel.Product(),
|
// excel.TransporationTime() ).Size() > 0 ){
|
// error( Translations::MP_LaneExcel_Import_RepeatKey() );
|
//}
|
*]
|
}
|