| | |
| | | macroplan.ChangeLossSettingExcel( relflush ); |
| | | error( e.GeneralInformation() ); |
| | | } |
| | | clsset := construct( ChangeLossSettings ); |
| | | //遍历处理导入的数据 |
| | | traverse( macroplan, ChangeLossSettingExcel, excel ){ |
| | | cls := selectobject( macroplan, ChangeLossSetting, cls, cls.ProductFirst().ID() = excel.Product1() |
| | | and cls.ProductSecond().ID() = excel.Product2() |
| | | and cls.Unit().ID() = excel.Unit() ); |
| | | and cls.Unit().ID() = excel.Unit() |
| | | and cls.StartDate() = excel.StartDate() |
| | | and cls.EndDate() = excel.EndDate() ); |
| | | if( isnull( cls ) ){ |
| | | cls := macroplan.ChangeLossSetting( relnew, ChangeLossNr := [Number]excel.ChangeLossNumber() ); |
| | | product1 := selectobject( macroplan, Product_MP, product, product.ID() = excel.Product1() ); |
| | | product2 := selectobject( macroplan, Product_MP, product, product.ID() = excel.Product2() ); |
| | | unit := selectobject( macroplan, Unit, unit, unit.ID() = excel.Unit() ); |
| | | cls.ProductFirst( relset, product1 ); |
| | | cls.ProductSecond( relset, product2 ); |
| | | cls.Unit( relset, unit ); |
| | | feedback := ''; |
| | | if( ChangeLossSetting::ValidateInput( feedback, macroplan, null( ChangeLossSetting ), unit, product1, product2, excel.StartDate(), excel.EndDate(), [Number]excel.ChangeLossNumber() ) ){ |
| | | cls := macroplan.ChangeLossSetting( relnew, ChangeLossNr := [Number]excel.ChangeLossNumber() ); |
| | | |
| | | cls.ProductFirst( relset, product1 ); |
| | | cls.ProductSecond( relset, product2 ); |
| | | cls.Unit( relset, unit ); |
| | | clsset.Add( cls ); |
| | | }else{ |
| | | traverse( clsset, Elements, e ){ |
| | | e.Delete(); |
| | | } |
| | | error( feedback ); |
| | | } |
| | | }else { |
| | | cls.ChangeLossNr( [Number]excel.ChangeLossNumber() ); |
| | | } |