[DataContractAttribute]
class SetLogShipCallContract implements SysOperationValidatable
{
str qryStr;
Common argsRecord;
}
public Query getQuery()
{
return new Query(SysOperationHelper::base64Decode(qryStr));
}
public void initQuery()
{
Query query;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRangeShipAdviceType;
query = new Query(queryStr(SetLogShipAdviceListPage));
queryBuildDataSource = query.addDataSource(tableNum(SetLogShipAdvHeader));
SysQuery::findOrCreateRange(queryBuildDataSource, fieldNum(SetLogShipAdvHeader, WHI_ShipAdviceType));
queryBuildRangeShipAdviceType = query.dataSourceTable(tableNum(KCS_SetLogShipAdvHeader)).addRange(fieldNum(SetLogShipAdvHeader, WHI_ShipAdviceType));
queryBuildRangeShipAdviceType.value(enum2str(WHI_ShipAdviceType::CBX));
queryBuildRangeShipAdviceType.status(RangeStatus::Open);
query.dataSourceTable(tableNum(KCS_SetLogShipAdvHeader)).addSortField(fieldNum(SetLogShipAdvHeader, WHI_ShipAdviceType), SortOrder::Ascending);
this.setQuery(query);
}
[DataMemberAttribute,
SysOperationControlVisibilityAttribute(false)]
public Common parmArgsRecord(Common _argsRecord = argsRecord)
{
argsRecord = _argsRecord;
return argsRecord;
}
[
DataMemberAttribute,
AifQueryTypeAttribute('_packedQuery', queryStr(KCS_SetLogShipAdviceListPage))
]
public str parmPackedQuery(str _packedQuery = qryStr)
{
qryStr = _packedQuery;
return qryStr;
}
public void setQuery(Query _query)
{
qryStr = SysOperationHelper::base64Encode(_query.pack());
}
public boolean validate()
{
boolean ret;
SetLogCallHeader callHeader = this.parmArgsRecord();
SetLogCallLine callLine;
PurchLine purchLine;
Qty openQty;
;
ret = true;
if (callHeader.RecId)
{
while select * from callLine
where callLine.CallHeader == callHeader.CallId
join * from purchLine
where purchLine.InventTransId == callLine.PurchLine
{
openQty = purchLine.RemainInventPhysical;
}
if(openQty == 0)
{
SetLogLogTable::LogEntry(callHeader, "@KCS1572", Exception::Error);
ret = checkFailed("@KCS1572");
}
}
return ret;
}
class SetLogShipCallController extends SysOperationServiceController
{
str qryStr;
}
public boolean canGoBatch()
{
return true;
}
protected void dialogPostRun()
{
sysOperationDialog sysOperationDialog;
DialogTabPage batchTab;
FormRun formRun;
super();
sysOperationDialog = this.dialog() as SysOperationDialog;
formRun = sysOperationDialog.formRun();
batchTab = sysOperationDialog.batchDialogTabPage();
formRun.selectControl(batchTab.control());
}
protected container getOriginalQuery(str queryKey, QueryName _queryName = qryStr)
{
container ret;
ret = super(queryKey, _queryName);
return ret;
}
protected Object initializeServiceParameter(DictMethod dictMethod, int parameterIndex)
{
Object ret;
SetLogShipCallContract setLogShipCallContract;
ret = super(dictMethod, parameterIndex);
if(ret is SetLogShipCallContract)
{
setLogShipCallContract = ret;
SetLogShipCallController::initQuery(ret);
}
return ret;
}
public LabelType parmDialogCaption(LabelType _dialogCaption = strFmt("@KCS4790"))
{
LabelType ret;
ret = super(_dialogCaption);
return ret;
}
[
DataMemberAttribute
,AifQueryTypeAttribute('_qryStr', '')
]
public str parmQuery(str _qryStr = qryStr)
{
qryStr = _qryStr;
return qryStr;
}
public boolean showBatchTab(boolean _showBatchTab = true)
{
boolean ret;
ret = super(_showBatchTab);
return ret;
}
public boolean showQuerySelectButton(str parameterName = qryStr)
{
boolean ret;
ret = super(parameterName);
return ret;
}
public boolean showQueryValues(str parameterName = '')
{
boolean ret = true;
ret = super(parameterName);
return ret;
}
public static Query initQuery(SetLogShipCallContract _dataContract)
{
Query query;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRangeShipAdvicetype;
QueryBuildRange QueryBuildRangeShipAdvStatus;
;
query = new Query();
queryBuildDataSource = query.addDataSource(tableNum(SetLogShipAdvHeader));
SysQuery::findOrCreateRange(queryBuildDataSource, fieldNum(SetLogShipAdvHeader, WHI_ShipAdviceType));
queryBuildRangeShipAdvicetype = query.dataSourceTable(tableNum(SetLogShipAdvHeader)).addRange(fieldNum(SetLogShipAdvHeader, WHI_ShipAdviceType));
queryBuildRangeShipAdvicetype = queryBuildDataSource.addRange(fieldnum(SetLogShipAdvHeader, WHI_ShipAdviceType));
queryBuildRangeShipAdvicetype.value(strfmt("%1", WHI_ShipAdviceType::CBX));
query.dataSourceTable(tableNum(KCS_SetLogShipAdvHeader)).addSortField(fieldNum(SetLogShipAdvHeader, WHI_ShipAdviceType), SortOrder::Ascending);
QueryBuildRangeShipAdvStatus = queryBuildDataSource.addRange(fieldnum(SetLogShipAdvHeader, Status));
QueryBuildRangeShipAdvStatus.value(strfmt("!%1, !%2", SetLogShipAdvStatus::Error, SetLogShipAdvStatus::Adopted));
_dataContract.parmPackedQuery(SysOperationHelper::base64Encode(query.pack()));
return query;
}
public static void main(Args _args)
{
SetLogShipCallController setLogSvcCallController;
identifierName className;
identifierName methodName;
SysOperationExecutionMode executionMode;
;
[className, methodName, executionMode] = SysOperationServiceController::parseServiceInfo(_args);
setLogSvcCallController = new SetLogShipCallController(className, methodName, executionMode);
setLogSvcCallController.startOperation();
}
public static SetLogShipCallController newFromArgs(Args _args)
{
SetLogShipCallController setLogShipCallController;
SetLogShipCallContract setLogShipCallContract;
;
setLogShipCallController = new SetLogShipCallController();
setLogShipCallController.initializeFromArgs(_args);
setLogShipCallController.showBatchTab(true);
setLogShipCallContract = setLogShipCallController.getDataContractObject();
if(_args && _args.dataset())
{
setLogShipCallController.parmShowDialog(true);
setLogShipCallController.parmShowProgressForm(true);
setLogShipCallController.parmDialogCaption("@KCS1348");
setLogShipCallContract.parmArgsRecord(_args.record());
SetLogShipCallController::initQuery(setLogShipCallContract);
setLogShipCallController.canGoBatch();
_args.caller(setLogShipCallController);
new MenuFunction(menuItemActionStr(SetLogPostShipAdvicesBatch), MenuItemType::Action).run(_args);
}
else
{
throw error("@KCS1193");
}
return setLogShipCallController;
}