Quintiq file version 2.0
|
#parent: #root
|
StaticMethod Update (
|
Units units_i,
|
Boolean isBatchEditValidity,
|
Boolean isBatchEditGIS,
|
Boolean isBatchEditMisc,
|
Boolean isBatchEditNote,
|
Boolean isBatchEditUseShiftOptimization,
|
String id,
|
String name,
|
Unit parent,
|
String capacitytype,
|
Group group,
|
UnitOfMeasure_MP unitofmeasure,
|
Currency_MP currency,
|
Date startdate,
|
Date enddate,
|
Duration campaigntypeduration,
|
Boolean isplannedinfinite,
|
Real minimumquantity,
|
Boolean hasmaximumquantity,
|
Real maximumquantity,
|
Real lotsize,
|
String usericonname,
|
String quantitytoprocess,
|
String giscountrycode,
|
String giscity,
|
String gispostalcode,
|
String notes,
|
Boolean hascapacitysmoothing,
|
Boolean issmoothcapacityoverallperiods,
|
Number usercapacitysmoothinglength,
|
Real capacitysmoothingpercentagedelta,
|
Boolean isoverlapcapacitysmoothing,
|
Boolean isincludedinsupplyspec,
|
Boolean issupplier,
|
Boolean hasuserfrozenfutureduration,
|
Duration userfrozenfutureduration,
|
Boolean useshiftoptimization,
|
Boolean isfromdb
|
)
|
{
|
Description: 'update methods for web client, with support of batch editing'
|
TextBody:
|
[*
|
// gdn1 Aug-17-2018 (created)
|
traverse( units_i, Elements, unit )
|
{
|
// Exception on batch edit
|
if( units_i.Size() > 1 )
|
{
|
// attributes that has no change on batch editing
|
id := unit.ID();
|
name := unit.Name();
|
parent := unit.Parent();
|
capacitytype:= unit.CapacityType();
|
group := unit.Group();
|
unitofmeasure:= unit.UnitOfMeasure_MP();
|
currency := unit.Currency_MP();
|
isplannedinfinite := unit.IsPlannedInfinite();
|
minimumquantity := unit.MinimumQuantity();
|
hasmaximumquantity:= unit.HasMaximumQuantity();
|
maximumquantity := unit.MaximumQuantity();
|
lotsize := unit.LotSize();
|
usericonname := unit.IconName();
|
quantitytoprocess := unit.QuantityToProcess();
|
|
hascapacitysmoothing := unit.HasCapacitySmoothing();
|
issmoothcapacityoverallperiods := unit.IsSmoothCapacityOverAllPeriods();
|
usercapacitysmoothinglength := unit.UserCapacitySmoothingLength();
|
capacitysmoothingpercentagedelta:= unit.CapacitySmoothingPercentageDelta();
|
isoverlapcapacitysmoothing := unit.IsOverlapCapacitySmoothing();
|
|
//if no batch edit, set it with original unit's value
|
if( not isBatchEditValidity )
|
{
|
startdate := unit.StartDate();
|
enddate := unit.EndDate();
|
}
|
|
if( not isBatchEditGIS )
|
{
|
giscity := unit.GISCity();
|
giscountrycode := unit.GISCountryCode();
|
gispostalcode := unit.GISPostalCode();
|
}
|
|
if( not isBatchEditMisc )
|
{
|
campaigntypeduration := unit.CampaignTypeDuration();
|
hasuserfrozenfutureduration := unit.HasUserFrozenFutureDuration();
|
userfrozenfutureduration := unit.UserFrozenFutureDuration();
|
isincludedinsupplyspec := unit.IsIncludedInSupplySpecification();
|
issupplier := unit.IsSupplier();
|
}
|
|
if( not isBatchEditNote )
|
{
|
notes := unit.Notes();
|
}
|
|
if( not isBatchEditUseShiftOptimization )
|
{
|
useshiftoptimization := unit.UseShiftOptimization();
|
}
|
}
|
|
unit.Update( id
|
,name
|
,parent
|
,capacitytype
|
,group
|
,unitofmeasure
|
,currency
|
,startdate
|
,enddate
|
,campaigntypeduration
|
,isplannedinfinite
|
,minimumquantity
|
,hasmaximumquantity
|
,maximumquantity
|
,lotsize
|
,usericonname
|
,quantitytoprocess
|
,giscountrycode
|
,giscity
|
,gispostalcode
|
,notes
|
,hascapacitysmoothing
|
,issmoothcapacityoverallperiods
|
,usercapacitysmoothinglength
|
,capacitysmoothingpercentagedelta
|
,isoverlapcapacitysmoothing
|
,isincludedinsupplyspec
|
,issupplier
|
,hasuserfrozenfutureduration
|
,userfrozenfutureduration
|
,useshiftoptimization
|
,isfromdb
|
);
|
}
|
*]
|
}
|