Пример #1
0
        public Dictionary <string, string> GetAttributeValues(string materialBinNumber)
        {
            string errorMsg = "";
            Dictionary <string, string> dicValues = new Dictionary <string, string>();

            string[] attributeCodeArray    = new string[] { };//"PickListWSAttrib", "PickListQtyAttrib", "PickListNoAttrib", "PickListStatusAttrib"
            string[] attributeResultKeys   = new string[] { "ATTRIBUTE_CODE", "ATTRIBUTE_VALUE", "ERROR_CODE" };
            string[] attributeResultValues = new string[] { };
            //LogHelper.Info("begin api attribGetAttributeValues (material bin number =" + materialBinNumber + ")");
            int error = imsapi.attribGetAttributeValues(sessionContext, init.configHandler.StationNumber, 2, materialBinNumber, "-1", attributeCodeArray, 0, attributeResultKeys, out attributeResultValues);

            imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            //LogHelper.Info("end api attribGetAttributeValues (errorcode = " + error + ")");
            if (error == 0)
            {
                int loop  = attributeResultKeys.Length;
                int count = attributeResultValues.Length;
                for (int i = 0; i < count; i += loop)
                {
                    dicValues[attributeResultValues[i]] = attributeResultValues[i + 1];
                }
                //view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribGetAttributeValues " + error, "");
            }
            else
            {
                //view.errorHandler(3, init.lang.ERROR_API_CALL_ERROR + " attribGetAttributeValues " + error + "(" + errorMsg + ")", "");
            }
            return(dicValues);
        }
Пример #2
0
        public int CreateNewMaterialBin(string materialBinNo, string partNo, string qty, string lotNo)
        {
            string errorMsg = "";

            string[] materialBinUploadKeys   = new string[] { "ERROR_CODE", "MATERIAL_BIN_NUMBER", "MATERIAL_BIN_PART_NUMBER", "MATERIAL_BIN_QTY_ACTUAL", "SUPPLIER_CHARGE_NUMBER" };
            string[] materialBinUploadValues = new string[] { "0", materialBinNo, partNo, qty, lotNo };
            string[] materialBinResultValues = new string[] { };
            int      error = imsapi.mlCreateNewMaterialBin(sessionContext, init.configHandler.StationNumber, materialBinUploadKeys, materialBinUploadValues, out materialBinResultValues);

            imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            LogHelper.Info("Api mlCreateNewMaterialBin (errorcode = " + error + ",error message = " + errorMsg + "),material bin number = " + materialBinNo + ", part number =" + partNo + ", quantity =" + qty);
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " mlCreateNewMaterialBin " + error, "");
            }
            else
            {
                foreach (var item in materialBinResultValues)
                {
                    LogHelper.Info(item);
                }
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " mlCreateNewMaterialBin " + error + "(" + errorMsg + ")", "");
            }
            return(error);
        }
Пример #3
0
        public string[] GetSNInfo(string serialNumber, string stationNumber)
        {
            int    error    = 0;
            string errorMsg = "";

            string[] serialNumberResultKeys   = new string[] { "PART_DESC", "PART_NUMBER", "WORKORDER_NUMBER" };
            string[] serialNumberResultValues = new string[] { };
            LogHelper.Info("begin api trGetSerialNumberInfo (serial number =" + serialNumber + ",station number =" + stationNumber + ")");
            error = imsapi.trGetSerialNumberInfo(sessionContext, stationNumber, serialNumber, "-1", serialNumberResultKeys, out serialNumberResultValues);
            LogHelper.Info("end api trGetSerialNumberInfo (result code = " + error + ")");
            imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " trGetSerialNumberInfo " + error, "");
            }
            else
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " trGetSerialNumberInfo " + error + "," + errorMsg, "");
            }
            return(serialNumberResultValues);
        }
Пример #4
0
        public int lockObjects(string mbn)
        {
            int    error    = 0;
            string errorMsg = "";

            string[] objectUploadKeys   = new string[] { "ERROR_CODE", "MATERIAL_BIN_NUMBER", "MATERIAL_BIN_STATE" };
            string[] objectUploadValues = new string[] { "0", mbn, "B" };
            string[] objectResultValues = new string[] { };
            error = imsapi.lockObjects(sessionContext, init.configHandler.StationNumber, 1, mbn, mbn, -1, 0, objectUploadKeys, objectUploadValues, out objectResultValues);
            imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            LogHelper.Info("Api lockObjects MBN=" + mbn + ",material bin state = B,result code = " + error + "(" + errorMsg + ")");
            return(error);
        }
Пример #5
0
        //public DateTime GetServerDateTime()
        //{
        //    var calendarDataResultKeys = new string[] { "CURRENT_TIME_MILLIS" };
        //    var calendarDataResultValues = new string[] { };
        //    int error = imsapi.mdataGetCalendarData(sessionContext, init.configHandler.StationNumber, calendarDataResultKeys, out calendarDataResultValues);
        //    if (error != 0)
        //    {
        //        LogHelper.Info("API mdataGetCalendarData error code = " + error);
        //        return DateTime.Now;
        //    }
        //    long numer = long.Parse(calendarDataResultValues[0]);
        //    DateTime start = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
        //    DateTime date = start.AddMilliseconds(numer).ToLocalTime();
        //    return date;
        //}

        public static string GetZHSErrorString(int iErrorCode, InitModel _init, IMSApiSessionContextStruct _sessionContext)
        {
            string errorString = "";

            if (_init.configHandler.Language == "US")
            {
                imsapi.imsapiGetErrorText(sessionContext, iErrorCode, out errorString);
            }
            else
            {
                if (_init.ErrorCodeZHS.ContainsKey(iErrorCode))
                {
                    errorString = _init.ErrorCodeZHS[iErrorCode];
                }
                else
                {
                    imsapi.imsapiGetErrorText(sessionContext, iErrorCode, out errorString);
                }
            }

            return(errorString);
        }
Пример #6
0
        public int RemoveContainerAttribute(string materialBinNumber, string attributeCode)
        {
            int    error    = 0;
            string errorMsg = "";

            LogHelper.Info("begin attribRemoveAttributeValue (material bin number =" + materialBinNumber + ",ATTRIBUTE_CODE =" + attributeCode + ")");
            error = imsapi.attribRemoveAttributeValue(sessionContext, init.configHandler.StationNumber, 2, materialBinNumber, "-1", attributeCode, "-1");
            imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            LogHelper.Info("end attribRemoveAttributeValue error=" + error + "");
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribRemoveAttributeValue " + error, "");
            }
            else
            {
                view.errorHandler(3, init.lang.ERROR_API_CALL_ERROR + " attribRemoveAttributeValue " + error + "(" + errorMsg + ")", "");
            }
            return(error);
        }
Пример #7
0
        public int SendShippingLot(string lotNumber)
        {
            int    error    = 0;
            string errorMsg = "";

            KeyValue[] shippingLotSendValues = new KeyValue[] { };
            LogHelper.Info("begin api shipSendLot (Station number:" + init.configHandler.StationNumber + ",lot number =" + lotNumber + ")");
            error = imsapi.shipSendLot(sessionContext, init.configHandler.StationNumber, lotNumber, -1, shippingLotSendValues);
            LogHelper.Info("end api shipSendLot (result code = " + error + ")");
            imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " shipSendLot " + error, "");
            }
            else
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " shipSendLot " + error + "," + errorMsg, "");
            }
            return(error);
        }
Пример #8
0
        public DataTable GetWorkordersByFilter(string woFilter)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Quantity", typeof(string)));
            dt.Columns.Add(new DataColumn("WorkorderNumber", typeof(string)));
            dt.Columns.Add(new DataColumn("Status", typeof(string)));

            KeyValue[] workorderFilter       = new KeyValue[] { new KeyValue("WORKORDER_STATE", "S,F"), new KeyValue("WORKORDER_NUMBER", woFilter) };//F = opened (released);S = started
            string[]   workorderResultKeys   = new string[] { "QUANTITY", "WORKORDER_NUMBER", "WORKORDER_STATE" };
            string[]   workorderResultValues = new string[] { };
            LogHelper.Info("begin api trGetWorkOrderForStation (Station number:" + init.configHandler.StationNumber + ")");
            int error = imsapi.trGetWorkOrderForStation(sessionContext, init.configHandler.StationNumber, workorderFilter, workorderResultKeys, out workorderResultValues);

            LogHelper.Info("end api trGetWorkOrderForStation (result code = " + error + ")");
            string errorMsg = "";

            imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            if (error != 0)
            {
                view.errorHandler(3, init.lang.ERROR_API_CALL_ERROR + " trGetWorkOrderForStation " + error + ",error message:" + errorMsg, "");
            }
            else
            {
                if (workorderResultValues.Length > 0)
                {
                    int loop  = workorderResultKeys.Length;
                    int count = workorderResultValues.Length;
                    for (int i = 0; i < count; i += loop)
                    {
                        DataRow row = dt.NewRow();
                        row["Quantity"]        = workorderResultValues[i].ToString();
                        row["WorkorderNumber"] = workorderResultValues[i + 1].ToString();
                        row["Status"]          = GetStatusText(workorderResultValues[i + 2].ToString());
                        dt.Rows.Add(row);
                    }
                }
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " trGetWorkOrderForStation " + error, "");
            }
            return(dt);
        }
Пример #9
0
        public int AppendAttributeValues(string strCode, string strValue)
        {
            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, 7, init.configHandler.StationNumber, "-1", -1, 1
                                                       , attributeUploadKeys, attributeUploadValues, out attributeResultValues);
            imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            LogHelper.Info("end api attribAppendAttributeValues (result code = " + error + ")");
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error, "");
            }
            else
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error + "(" + errorMsg + ")", "");
            }
            return(error);
        }
Пример #10
0
        public int ActivateShippingLotAtStation(string lotNumber)
        {
            int    error    = 0;
            string errorMsg = "";

            LogHelper.Info("begin api shipActivateShippingLotAtKap (Station number:" + init.configHandler.StationNumber + ",lot number =" + lotNumber + ")");
            error = imsapi.shipActivateShippingLotAtKap(sessionContext, init.configHandler.StationNumber, lotNumber);
            imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            LogHelper.Info("end api shipActivateShippingLotAtKap (result code = " + error + ")");
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " shipActivateShippingLotAtKap " + error, "");
            }
            else
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " shipActivateShippingLotAtKap " + error + "," + errorMsg, "");
            }
            return(error);
        }