Esempio n. 1
0
        public List <RecipeEntity> GetRecipeDataByPN(string stationNumber, string partNumber, string machineGroupNo)
        {
            List <RecipeEntity> entityList = new List <RecipeEntity>();

            KeyValue[] recipeFilters      = new KeyValue[] { new KeyValue("MACHINE_GROUP_NUMBER", ""), new KeyValue("PART_NUMBER", ""), new KeyValue("STATION_NUMBER", "") };
            string[]   recipeResultKeys   = new string[] { "MEASURE_NAME", "NOMINAL", "REMARK" };
            string[]   recipeResultValues = new string[] { };
            int        error    = imsapi.mdaGetRecipeData(sessionContext, stationNumber, -1, "-1", "-1", "-1", -1, "-1", "-1", 1, recipeFilters, recipeResultKeys, out recipeResultValues);
            string     errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            LogHelper.Info("api mdaGetRecipeData (station number =" + stationNumber + ",part number =" + partNumber + ",machine group number =" + machineGroupNo + ") error code =" + error);
            if (error == 0)
            {
                int loop  = recipeResultKeys.Length;
                int count = recipeResultValues.Length;
                for (int i = 0; i < count; i += loop)
                {
                    RecipeEntity entity = new RecipeEntity();
                    entity.MEASURE_NAME = recipeResultValues[i];
                    entity.NOMINAL      = recipeResultValues[i + 1];
                    entity.REMARK       = recipeResultValues[i + 2];
                    entityList.Add(entity);
                }
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " mdaGetRecipeData " + error, "");
            }
            else
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " mdaGetRecipeData " + error + "(" + errorMsg + ")", "");
            }
            return(entityList);
        }