Thursday, 5 November 2015

security role

public static void main(Args _args, container _con,Noyes _printDigitopiaRouteCard)
{
    WHSWorkTable          whsWorkTable;
    MSRouteCardController MSRouteCardController = new MSRouteCardController();
    ProdTable             prodtable = _args.record();
    Args                  args = new Args();
    SecurityUserRole      securityUserRole;
    boolean  roleexist = false;
    UserId   user;

        user = curUserId();
    // added for checking the roles of current user
    while select securityUserRole where securityUserRole.User == user
    {                                                                                                 //  role name             roleid, role name            roleid
        if( (securityUserRole.SecurityRole == 886351) || (securityUserRole.SecurityRole == 886340)    //System administrator    886351, Production planner     886340
          ||(securityUserRole.SecurityRole == 886333) || (securityUserRole.SecurityRole == 886332)    //Production supervisor    886333, Production manager     886332
          ||(securityUserRole.SecurityRole == 886282) || (securityUserRole.SecurityRole == 886281) )  //Product design manager    886282, Product designer     886281
        {
            roleexist = true;
        }
    }

    select whsWorkTable
        where whsWorkTable.OrderNum   == prodtable.ProdId
        && whsWorkTable.WorkTransType == WHSWorkTransType::ProdPick
        && whsWorkTable.WorkStatus    != WHSWorkStatus::Cancelled
        && whsWorkTable.AutoExecute   == NoYes::Yes;
    if (whsWorkTable)
    {
        ttsBegin;
        MsWhsWorkAutoExecute::autoExecuteWork(whsWorkTable.WorkId);
        ttsCommit;
        if(roleexist == true && whsWorkTable.WorkId && _printDigitopiaRouteCard == NoYes::Yes)
        {
            args.record(whsWorkTable);
            MSRouteCardController::main(args,_con);
        }
    }
    else
    {
        select whsWorkTable where whsWorkTable.OrderNum      == prodtable.ProdId
                               && whsWorkTable.WorkTransType == WHSWorkTransType::ProdPick
                               && whsWorkTable.WorkStatus    != WHSWorkStatus::Cancelled;
        if(roleexist == true && whsWorkTable.WorkId && _printDigitopiaRouteCard == NoYes::Yes)
        {
            args.record(whsWorkTable);
            MSRouteCardController::main(args,_con);
        }
    }



}


No comments:

Post a Comment