Esempio n. 1
0
        internal static String InitRawMaterial(Entity.EntityInitRawMaterial q)
        {
            String resultReturn = "";

            try
            {
                DataTable queryTable  = new DataTable();
                String    queryString = "select * from materiales where num_pallet='" + q.Num_Pallet + "'";
                String    connectionStringFromAppConfig = "ConnectToMySQL";
                queryTable = Conectivity.ConnectItAndExecuteMYSQL(queryString, connectionStringFromAppConfig);

                if (queryTable.Rows.Count == 0)
                {
                    RPCServicesClient RPC        = new RPCServices_CogiscanManager.RPCServicesClient();
                    String            partNumber = SQLDataManager.selectValuesFromMateriales(q.NumMaterial);

                    executeCommandRequest paramInitRawMat = new executeCommandRequest("initializeRawMaterial", @"
                    <Parameters>
                       <Parameter name=""itemId"">" + q.Num_Pallet + @"</Parameter>
                       <Parameter name=""partNumber"">" + partNumber + @"</Parameter>
                       <Parameter name=""msLevel"">1</Parameter>k
                       <Parameter name=""containerType"">REEL</Parameter>
                       <Parameter name=""supplierId"">Default</Parameter>
                       <Parameter name=""quantity"">" + q.Orig_Cant + @"</Parameter>
                       <Parameter name=""tagId""></Parameter>
                       <Parameter name=""tagModel""></Parameter>
                    </Parameters>");

                    executeCommandResponse res = RPC.executeCommand(paramInitRawMat);
                    LogThis.LogThisValue("Material Inicializado: " + q.Num_Pallet);
                    takeTheThreadFlag(Form1.logRTBInitRaw, true, q.Num_Pallet);

                    resultReturn = CleanInput(res.result);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            { LogThis.LogThisValue(e); return(e.Message); }

            return(resultReturn);
        }
Esempio n. 2
0
        internal static String InitRawMaterial(Entity.EntityInitRawMaterial q)
        {
            String resultReturn = "";

            try
            {
                DataTable queryTable  = new DataTable();
                String    queryString = "select num_pallet from materiales where num_pallet='" + q.Num_Pallet + "'";
                String    connectionStringFromAppConfig = "ConnectToMySQL";
                queryTable = Conectivity.ConnectItAndExecuteMYSQL(queryString, connectionStringFromAppConfig);

                if (queryTable.Rows.Count == 0)
                {
                    String partNumber = SQLDataManager.selectValuesFromMateriales(q.NumMaterial);

                    //Boolean opNotInit = CheckIfOpMustInit(q.NumMaterial, q.Num_Pallet);

                    //if (opNotInit)
                    //{ goto skipped; }

                    RPCServicesClient RPC = new RPCServicesClient();

                    executeCommandRequest paramInitRawMat = new executeCommandRequest("initializeRawMaterial", @"
                    <Parameters>
                       <Parameter name=""itemId"">" + q.Num_Pallet + @"</Parameter>
                       <Parameter name=""partNumber"">" + partNumber + @"</Parameter>
                       <Parameter name=""containerType"">REEL</Parameter>
                       <Parameter name=""supplierId"">DEFAULT</Parameter>
                       <Parameter name=""quantity"">" + q.Orig_Cant + @"</Parameter>
                       <Parameter name=""tagId""></Parameter>
                       <Parameter name=""tagModel""></Parameter>
                    </Parameters>");


                    executeCommandResponse res = RPC.executeCommand(paramInitRawMat);
                    //LogThis.LogThisValue("Material Inicializado: " + q.Num_Pallet);
                    takeTheThreadFlag(Form1.logRTBInitRaw, true, q.Num_Pallet);

                    resultReturn = CleanInput(res.result);

                    if (res.result.Contains("<Success />"))
                    {
                        executeCommandRequest paramLoadRawMat = new executeCommandRequest("load", @"
                        <Parameters>
                            <Parameter name=""contentId"">" + q.Num_Pallet + @"</Parameter>
                            <Parameter name=""containerId"">DEFAULTSTORAGE</Parameter>
                            <Parameter name=""location""></Parameter>
                            <Parameter name=""unloadPrevious"">false</Parameter>
                            <Parameter name=""deletePrevious"">false</Parameter>
                        </Parameters>");

                        string responseFromLoad = executeWSRequest(paramLoadRawMat);
                        resultReturn = "||" + responseFromLoad + "OnLoad - ";
                    }


                    skipped : string skipped = "";
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            { System.Console.WriteLine(e.Message); }

            return(resultReturn);
        }