예제 #1
0
        public List <EquipmentEntityExt> GetSetupEquipmentDataByStation(string stationNumber)
        {
            int errorCode = 0;
            List <EquipmentEntityExt> entityList = new List <EquipmentEntityExt>();
            EquipmentEntityExt        entity     = null;

            string[] equipmentSetupResultValues = new string[] { };
            string[] equipmentSetupResultKeys   = new string[] { "EQUIPMENT_NUMBER", "EQUIPMENT_STATE", "SECONDS_BEFORE_EXPIRATION", "USAGES_BEFORE_EXPIRATION", "EQUIPMENT_INDEX" };
            errorCode = imsapi.equGetSetupEquipmentData(sessionContext, stationNumber, new KeyValue[] { }, equipmentSetupResultKeys, out equipmentSetupResultValues);
            LogHelper.Info("Api equGetSetupEquipmentData: station number =" + stationNumber + ",error code =" + errorCode);
            if (errorCode == 0)
            {
                int loop  = equipmentSetupResultKeys.Length;
                int count = equipmentSetupResultValues.Length;
                for (int i = 0; i < count; i += loop)
                {
                    entity = new EquipmentEntityExt();
                    entity.EQUIPMENT_NUMBER          = equipmentSetupResultValues[i];
                    entity.EQUIPMENT_STATE           = equipmentSetupResultValues[i + 1];
                    entity.SECONDS_BEFORE_EXPIRATION = equipmentSetupResultValues[i + 2];
                    entity.USAGES_BEFORE_EXPIRATION  = equipmentSetupResultValues[i + 3];
                    entity.EQUIPMENT_INDEX           = equipmentSetupResultValues[i + 4];
                    entityList.Add(entity);
                }
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " equGetSetupEquipmentData " + errorCode, "");
            }
            else
            {
                string errorString = UtilityFunction.GetZHSErrorString(errorCode, init, sessionContext);
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " equGetSetupEquipmentData " + errorCode + "," + errorString, "");
            }
            return(entityList);
        }
예제 #2
0
        public EquipmentEntityExt GetSetupEquipmentData(string equipmentNo)
        {
            int                errorCode = 0;
            string             errorMsg  = "";
            EquipmentEntityExt entity    = null;

            string[] equipmentSetupResultValues = new string[] { };
            string[] equipmentSetupResultKeys   = new string[] { "EQUIPMENT_NUMBER", "EQUIPMENT_STATE", "SECONDS_BEFORE_EXPIRATION", "USAGES_BEFORE_EXPIRATION" };
            errorCode = imsapi.equGetSetupEquipmentData(sessionContext, init.configHandler.StationNumber, new KeyValue[] { }, equipmentSetupResultKeys, out equipmentSetupResultValues);
            LogHelper.Info("Api equGetSetupEquipmentData: equipment no =" + equipmentNo + ",error code =" + errorCode);
            if (errorCode == 0)
            {
                int loop  = equipmentSetupResultKeys.Length;
                int count = equipmentSetupResultValues.Length;
                for (int i = 0; i < count; i += loop)
                {
                    if (equipmentSetupResultValues[i] == equipmentNo)
                    {
                        entity = new EquipmentEntityExt();
                        entity.EQUIPMENT_NUMBER          = equipmentSetupResultValues[i];
                        entity.EQUIPMENT_STATE           = equipmentSetupResultValues[i + 1];
                        entity.SECONDS_BEFORE_EXPIRATION = equipmentSetupResultValues[i + 2];
                        entity.USAGES_BEFORE_EXPIRATION  = equipmentSetupResultValues[i + 3];
                    }
                }
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " equGetSetupEquipmentData " + errorCode, "");
            }
            else
            {
                //imsapi.imsapiGetErrorText(sessionContext, errorCode, out errorMsg);
                errorMsg = UtilityFunction.GetZHSErrorString(errorCode, init, sessionContext);
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " equGetSetupEquipmentData " + errorCode + "," + errorMsg, "");
            }
            return(entity);
        }