Пример #1
0
        public int AppendAttributeValuesForContainer(string strCode, string strValue, string lotNumber)
        {
            int    error    = 0;
            string errorMsg = "";

            string[] attributeUploadKeys   = new string[] { "ATTRIBUTE_CODE", "ATTRIBUTE_VALUE", "ERROR_CODE" };
            string[] attributeUploadValues = new string[] { strCode, strValue, "0" };
            string[] attributeResultValues = new string[] { };
            LogHelper.Info("begin api attribAppendAttributeValues (attribute code =" + strCode + ",attribute value=" + strValue + ")");
            error = imsapi.attribAppendAttributeValues(sessionContext, init.configHandler.StationNumber, 2, lotNumber, "-1", -1, 0
                                                       , attributeUploadKeys, attributeUploadValues, out attributeResultValues);
            //imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
            LogHelper.Info("end api attribAppendAttributeValues (result code = " + error + ")");
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error, "");
            }
            else
            {
                if (attributeResultValues[2] == "-901")//attribute code not exist, create
                {
                    imsapi.attribCreateAttribute(sessionContext, init.configHandler.StationNumber, 2, strCode, strCode, "N");
                    int error2 = imsapi.attribAppendAttributeValues(sessionContext, init.configHandler.StationNumber, 2, lotNumber, "-1", -1, 0
                                                                    , attributeUploadKeys, attributeUploadValues, out attributeResultValues);
                    //imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
                    errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
                    if (error2 == 0)
                    {
                        // view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error2, "");
                    }
                    else
                    {
                        view.errorHandler(3, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error2 + "(" + errorMsg + ")", "");
                    }
                    return(error2);
                }
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error + "(" + errorMsg + ")", "");
            }
            return(error);
        }
Пример #2
0
        public int AppendAttributeForAll(string stationNumber, int objectType, string objectNumber, string objectDetail, string attributeCode, string attributeValue)
        {
            int    error    = 0;
            string errorMsg = "";

            string[] attributeUploadKeys   = new string[] { "ATTRIBUTE_CODE", "ATTRIBUTE_VALUE", "ERROR_CODE" };
            string[] attributeUploadValues = new string[] { attributeCode, attributeValue, "0" };
            string[] attributeResultValues = new string[] { };
            error = imsapi.attribAppendAttributeValues(sessionContext, stationNumber, objectType, objectNumber, objectDetail, -1, 1, attributeUploadKeys, attributeUploadValues, out attributeResultValues);
            LogHelper.Info("Api attribAppendAttributeValues result code=" + error + ",object type=" + objectType + ",object number=" + objectNumber + ",object detail=" + objectDetail + ",attribute code=" + attributeCode + ",attribute value=" + attributeValue + ", station number =" + stationNumber);
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error, "");
            }
            else
            {
                if (attributeResultValues.Length > 0)
                {
                    if (attributeResultValues[2] == "-901")//attribute code not exist, create
                    {
                        imsapi.attribCreateAttribute(sessionContext, init.configHandler.StationNumber, objectType, attributeCode, attributeCode, "N");
                        error = imsapi.attribAppendAttributeValues(sessionContext, init.configHandler.StationNumber, objectType, objectNumber, objectDetail, -1, 1, attributeUploadKeys, attributeUploadValues, out attributeResultValues);
                        if (error == 0)
                        {
                            view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error, "");
                        }
                        else
                        {
                            view.errorHandler(3, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error + "(" + errorMsg + ")", "");
                        }
                    }
                }
                else
                {
                    view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error, "");
                }
            }
            return(error);
        }