lazhen
2024-09-03 94861b664bc8ed851c047a013d3be239ea0c46dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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() = '' ) ){
      error( Translations::MP_ChangeLossSettingExcel_Import_NullInputRequiredField() );
    }
    //导入的数量小于0
    if( exists( macroplan, ChangeLossSettingExcel, excel, [Real]excel.ChangeLossNumber() > 0 and ceil( [Real]excel.ChangeLossNumber() ) <> floor( [Real]excel.ChangeLossNumber() ) ) ){
      error( Translations::MP_ChangeLossSettingExcel_Import_PositiveInteger() );
    }
    //导入产品是否存在
    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( 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() );
    //}
  *]
}