Example #1
0
        public int VerifyMerge(string serialNumberSlave, string serialNumberMaster)
        {
            SerialNumberStateData[] serialNumberStateDataArray = new SerialNumberStateData[] { };
            int    error    = imsapi.trVerifyMerge(sessionContext, init.configHandler.StationNumber, serialNumberSlave, "-1", serialNumberMaster, "-1", 0, out serialNumberStateDataArray);
            string errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            LogHelper.Info("API trVerifyMerge (serial number master = " + serialNumberMaster + ", serial number slave = " + serialNumberSlave + ",error =" + error + ")");
            if (error == 0)
            {
                view.errorHandler(0, " trVerifyMerge " + error, "");
            }
            else
            {
                view.errorHandler(2, " trVerifyMerge " + error + "(" + errorMsg + ")", "");
            }
            return(error);
        }
        public ShippingLotEntity ReuseCompleteShippingLot(string lotNumber, int functionMode)
        {
            int               error    = 0;
            string            errorMsg = "";
            ShippingLotEntity entity   = new ShippingLotEntity();

            string[] shippingLotResultKeys = new string[] { "HU_NUMBER", "MATERIAL_BIN_NUMBER", "MATERIAL_BIN_QTY_ACTUAL", "MATERIAL_BIN_QTY_TOTAL", "MATERIAL_BIN_STATE", "PART_DESC", "PART_NUMBER"
                                                            , "QUANTITY_UNIT", "SHIPPING_LOT_NUMBER", "SHIPPING_LOT_NUMBER2", "SHIPPING_LOT_PART_NUMBER", "SHIPPING_LOT_SNO_PART_DESCRIPTION", "SHIPPING_LOT_SNO_PART_NUMBER"
                                                            , "SHIPPING_LOT_SNO_QTY_ACTUAL", "SHIPPING_LOT_SNO_QTY_TOTAL", "WORKORDER_NUMBER" };
            string[] shippingLotResultValues = new string[] { };
            LogHelper.Info("begin api shipReuseCompletedShippingLot (Station number:" + init.configHandler.StationNumber + ",lot number =" + lotNumber + ",function mode =" + functionMode + ")");
            error = imsapi.shipReuseCompletedShippingLot(sessionContext, init.configHandler.StationNumber, functionMode, lotNumber, shippingLotResultKeys, out shippingLotResultValues);
            LogHelper.Info("end api shipReuseCompletedShippingLot (result code = " + error + ")");
            errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
            if (error == 0)
            {
                int loop  = shippingLotResultKeys.Length;
                int count = shippingLotResultValues.Length;
                for (int i = 0; i < count; i += loop)
                {
                    entity.HU_NUMBER               = shippingLotResultValues[i + 0];
                    entity.MATERIAL_BIN_NUMBER     = shippingLotResultValues[i + 1];
                    entity.MATERIAL_BIN_QTY_ACTUAL = shippingLotResultValues[i + 2];
                    entity.MATERIAL_BIN_QTY_TOTAL  = shippingLotResultValues[i + 3];
                    entity.MATERIAL_BIN_STATE      = shippingLotResultValues[i + 4];
                    entity.PART_DESC               = shippingLotResultValues[i + 5];
                    entity.PART_NUMBER             = shippingLotResultValues[i + 6];
                    entity.QUANTITY_UNIT           = shippingLotResultValues[i + 7];
                    //entity.SHIPPING_COMPLETE_DATE = shippingLotResultValues[i + 8];
                    entity.SHIPPING_LOT_NUMBER               = shippingLotResultValues[i + 8];
                    entity.SHIPPING_LOT_NUMBER2              = shippingLotResultValues[i + 9];
                    entity.SHIPPING_LOT_PART_NUMBER          = shippingLotResultValues[i + 10];
                    entity.SHIPPING_LOT_SNO_PART_DESCRIPTION = shippingLotResultValues[i + 11];
                    entity.SHIPPING_LOT_SNO_PART_NUMBER      = shippingLotResultValues[i + 12];
                    entity.SHIPPING_LOT_SNO_QTY_ACTUAL       = shippingLotResultValues[i + 13];
                    entity.SHIPPING_LOT_SNO_QTY_TOTAL        = shippingLotResultValues[i + 14];
                    entity.WORKORDER_NUMBER = shippingLotResultValues[i + 15];
                }
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " shipReuseCompletedShippingLot " + error, "");
            }
            else
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " shipReuseCompletedShippingLot " + error + "," + errorMsg, "");
            }
            return(entity);
        }
        public int trCheckSNStateNextStep(string serialNumber, int processLayer)
        {
            String[] serialNumberStateResultKeys   = new String[] { "ERROR_CODE" };
            String[] serialNumberStateResultValues = new String[] { };
            LogHelper.Info("begin api trCheckSerialNumberState (Serial number:" + serialNumber + ")");
            int error = imsapi.trCheckSerialNumberState(sessionContext, init.configHandler.StationNumber, processLayer, 0, serialNumber, "-1", serialNumberStateResultKeys, out serialNumberStateResultValues);

            //string errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
            LogHelper.Info("end api trCheckSerialNumberState (errorcode = " + error + ")");
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " trCheckSerialNumberState " + error, "");
            }
            else if (error == 5)
            {
                string errorMsg   = "";
                int    looplength = serialNumberStateResultKeys.Length;
                int    alllength  = serialNumberStateResultValues.Length;
                for (int i = 0; i < alllength; i += looplength)
                {
                    int errorcode = Convert.ToInt32(serialNumberStateResultValues[i]);
                    if (errorcode != 0)
                    {
                        if (errorcode == 202 || errorcode == 203)
                        {
                            string workstepdesc = GetNextProductionStep(serialNumber);
                            string errorString  = UtilityFunction.GetZHSErrorString(errorcode, init, sessionContext);
                            errorMsg = errorcode + ";" + errorString + "(" + workstepdesc + ")";
                        }
                        else
                        {
                            string errorString = UtilityFunction.GetZHSErrorString(errorcode, init, sessionContext);
                            errorMsg = errorcode + ";" + errorString;
                        }
                    }
                }
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " trCheckSerialNumberState (" + errorMsg + ")", "");
            }
            else
            {
                string errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " trCheckSerialNumberState (" + errorMsg + ")", "");
            }

            return(error);
        }
        public int UploadProcessResultCall(String[] serialNumberArray, int processLayer)
        {
            String[] serialNumberUploadKey    = new String[] { "ERROR_CODE", "SERIAL_NUMBER", "SERIAL_NUMBER_POS", "SERIAL_NUMBER_STATE" };
            String[] serialNumberUploadValues = new String[] { };
            String[] serialNumberResultValues = new String[] { };
            serialNumberUploadValues = serialNumberArray;
            error = imsapi.trUploadState(sessionContext, init.configHandler.StationNumber, 2, "-1", "-1", 0, 1, -1, 0, serialNumberUploadKey, serialNumberUploadValues, out serialNumberResultValues);
            string errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            if ((error != 0) && (error != 210))
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " trUploadState " + error + "(" + errorMsg + ")", "");
                return(error);
            }
            view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " trUploadState " + error, "");
            return(error);
        }
Example #5
0
        public Advice[] GetAdviceByStationAndWO(string workorder)
        {
            Advice[]   adviceArray   = null;
            KeyValue[] adviceFilters = new KeyValue[] { new KeyValue("WORKORDER_NUMBER", workorder) };
            int        error         = imsapi.adviceGetAdvice(sessionContext, init.configHandler.StationNumber, false, false, false, adviceFilters, out adviceArray);
            string     errorMsg      = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            if (error != 0)
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " adviceGetAdvice " + error + "(" + errorMsg + ")", "");
            }
            else
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " adviceGetAdvice " + error, "");
            }
            return(adviceArray);
        }
Example #6
0
 public int UploadProcessResultCall(string serialNumber, int processLayer)
 {
     String[] serialNumberUploadKey    = new String[] { "ERROR_CODE", "SERIAL_NUMBER", "SERIAL_NUMBER_POS", "SERIAL_NUMBER_STATE" };
     String[] serialNumberUploadValues = new String[] { };
     String[] serialNumberResultValues = new String[] { };
     error = imsapi.trUploadState(sessionContext, init.configHandler.StationNumber, processLayer, serialNumber, "-1", 0, 1, -1, 0, serialNumberUploadKey, serialNumberUploadValues, out serialNumberResultValues);
     LogHelper.Info("Api trUploadState: serial number =" + serialNumber + ", result code =" + error);
     if ((error != 0) && (error != 210))
     {
         string errorString = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
         view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " trUploadState " + error + "(" + errorString + ")", "");
         return(error);
     }
     error = 0;
     view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " trUploadState " + error, "");
     return(error);
 }
Example #7
0
        public byte[] GetDocumnetContentByID(long documentID)
        {
            byte[] content  = new byte[] { };
            int    error    = imsapi.mdaGetDocumentContent(sessionContext, init.configHandler.StationNumber, documentID, out content);
            string errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            if (error != 0)
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " mdaGetDocumentContent " + error + "(" + errorMsg + ")", "");
                return(null);
            }
            else
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " mdaGetDocumentContent " + error, "");
            }
            return(content);
        }
        public DataTable GetAllWorkorders()
        {
            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") };//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 + ")");
            if (error != 0)
            {
                string errorString = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
                view.errorHandler(3, init.lang.ERROR_API_CALL_ERROR + " trGetWorkOrderForStation " + error + "(" + errorString + ")", "");
            }
            else
            {
                if (workorderResultValues.Length > 0)
                {
                    DataRow rowEmpty = dt.NewRow();
                    rowEmpty["Quantity"]        = "";
                    rowEmpty["WorkorderNumber"] = "";
                    rowEmpty["Status"]          = "";
                    dt.Rows.Add(rowEmpty);

                    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);
        }
Example #9
0
        public int UpdateMaterialBinBooking(string materialBin, double strQty)
        {
            string[] materialBinBookingUploadKeys   = new string[] { "ERROR_CODE", "MATERIAL_BIN_NUMBER", "QUANTITY", "TRANSACTION_CODE" };
            string[] materialBinBookingUploadValues = new string[] { "0", materialBin, strQty.ToString(), "0" };
            string[] materialBinBookingResultValues = new string[] { };
            LogHelper.Info("begin api mlUploadMaterialBinBooking (material bin number =" + materialBin + ",quantity=" + strQty + ")");
            int    error    = imsapi.mlUploadMaterialBinBooking(sessionContext, init.configHandler.StationNumber, materialBinBookingUploadKeys, materialBinBookingUploadValues, out materialBinBookingResultValues);
            string errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            LogHelper.Info("end api mlUploadMaterialBinBooking (result code = " + error + ")");
            if (error != 0)
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " mlUploadMaterialBinBooking " + error + "(" + errorMsg + ")", "");
                return(error);
            }
            view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " mlUploadMaterialBinBooking " + error, "");
            return(error);
        }
        public int RemoveAttriValue(string attributeCode, string workorder)
        {
            int error = 0;

            LogHelper.Info("begin api attribRemoveAttributeValue (station number =" + init.configHandler.StationNumber + ",attribute code=" + attributeCode + ")");
            error = imsapi.attribRemoveAttributeValue(sessionContext, init.configHandler.StationNumber, 1, workorder, "-1", attributeCode, "-1");
            LogHelper.Info("end api attribRemoveAttributeValue (result code = " + error + ")");
            if (error == 0)
            {
                //view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribRemoveAttributeValue " + error, "");
            }
            else
            {
                string errorString = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " attribRemoveAttributeValue " + error + "(" + errorString + ")", "");
            }
            return(error);
        }
Example #11
0
        //trMergeParts
        public int MergeSerialNumber(string serialNumberMaster, string serialNumberSalve, int processLayer)
        {
            int error = 0;

            error = imsapi.trMergeParts(sessionContext, init.configHandler.StationNumber, processLayer, 0, serialNumberMaster, "-1", serialNumberSalve, "-1");
            string errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            LogHelper.Info("API trMergeParts (serial number master = " + serialNumberMaster + ", serial number slave = " + serialNumberSalve + ",error =" + error + ")");
            if (error == 0)
            {
                view.errorHandler(0, " trMergeParts " + error, "");
            }
            else
            {
                view.errorHandler(2, " trMergeParts " + error + "(" + errorMsg + ")", "");
            }
            return(error);
        }
        public void RemoveEquipment()
        {
            int    errorCode = 0;
            string errorMsg  = "";

            errorCode = imsapi.equRemoveEquipment(sessionContext, init.configHandler.StationNumber, init.currentSettings.workorderNumber, "-1", init.currentSettings.processLayer);
            LogHelper.Info("Api equRemoveEquipment: station no =" + init.configHandler.StationNumber + ",error code =" + errorCode);
            if (errorCode == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " equRemoveEquipment " + errorCode, "");
            }
            else
            {
                //imsapi.imsapiGetErrorText(sessionContext, errorCode, out errorMsg);
                errorMsg = UtilityFunction.GetZHSErrorString(errorCode, init, sessionContext);
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " equRemoveEquipment " + errorCode + "," + errorMsg, "");
            }
        }
Example #13
0
        public Dictionary <string, List <EquipmentEntity> > GetRequiredEquipmentDataDic(string workorder)
        {
            int           errorCode = 0;
            string        errorMsg  = "";
            List <string> equipList = new List <string>();
            Dictionary <string, List <EquipmentEntity> > dicequipement = new Dictionary <string, List <EquipmentEntity> >();

            string[] equipmentResultKeys   = new string[] { "EQUIPMENT_NUMBER", "PART_NUMBER", "EQUIPMENT_DESCRIPTION" };
            string[] equipmentResultValues = new string[] { };
            errorCode = imsapi.equGetRequiredEquipmentData(sessionContext, init.configHandler.StationNumber, workorder, "-1", "-1", init.currentSettings.processLayer, "-1",
                                                           equipmentResultKeys, out equipmentResultValues);
            LogHelper.Info("Api equGetRequiredEquipmentData: workorder number =" + workorder + ",error code =" + errorCode);
            if (errorCode == 0)
            {
                int loop  = equipmentResultKeys.Length;
                int count = equipmentResultValues.Length;
                for (int i = 0; i < count; i += loop)
                {
                    EquipmentEntity        entity     = new EquipmentEntity();
                    List <EquipmentEntity> entityList = new List <EquipmentEntity>();
                    entity.EQUIPMENT_NUMBER      = equipmentResultValues[i];
                    entity.EQUIPMENT_DESCRIPTION = equipmentResultValues[i + 2];
                    entity.PART_NUMBER           = equipmentResultValues[i + 1];
                    entityList.Add(entity);

                    if (!dicequipement.ContainsKey(equipmentResultValues[i + 1]))
                    {
                        dicequipement.Add(equipmentResultValues[i + 1], entityList);
                    }
                    else
                    {
                        dicequipement[equipmentResultValues[i + 1]].AddRange(entityList);
                    }
                }
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " equGetRequiredEquipmentData " + errorCode, "");
            }
            else
            {
                //imsapi.imsapiGetErrorText(sessionContext, errorCode, out errorMsg);
                errorMsg = UtilityFunction.GetZHSErrorString(errorCode, init, sessionContext);
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " equGetRequiredEquipmentData " + errorCode + "," + errorMsg, "");
            }
            return(dicequipement);
        }
Example #14
0
        public ShippingLotEntity GetLotFromSN(string serialNumber)
        {
            int               error    = 0;
            string            errorMsg = "";
            ShippingLotEntity entity   = new ShippingLotEntity();

            string[] lotResultKeys = new string[] { "MATERIAL_BIN_NUMBER", "MATERIAL_BIN_QTY_ACTUAL", "MATERIAL_BIN_QTY_TOTAL", "MATERIAL_BIN_STATE", "PART_NUMBER", "PART_DESC"
                                                    , "QUANTITY_UNIT", "SHIPPING_LOT_NUMBER", "SHIPPING_LOT_NUMBER2", "SHIPPING_LOT_PART_NUMBER", "SHIPPING_LOT_SNO_PART_DESCRIPTION", "SHIPPING_LOT_SNO_PART_NUMBER"
                                                    , "SHIPPING_LOT_SNO_QTY_ACTUAL", "SHIPPING_LOT_SNO_QTY_TOTAL" };
            string[] lotResultValues = new string[] { };
            LogHelper.Info("begin api shipGetLotFromSerialNumber (Station number:" + init.configHandler.StationNumber + ",serial number =" + serialNumber + ")");
            error = imsapi.shipGetLotFromSerialNumber(sessionContext, init.configHandler.StationNumber, serialNumber, "-1", lotResultKeys, out lotResultValues);
            LogHelper.Info("end api shipGetLotFromSerialNumber (result code = " + error + ")");
            //imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
            if (error == 0)
            {
                int loop  = lotResultKeys.Length;
                int count = lotResultValues.Length;
                for (int i = 0; i < count; i += loop)
                {
                    entity.MATERIAL_BIN_NUMBER     = lotResultValues[i + 0];
                    entity.MATERIAL_BIN_QTY_ACTUAL = lotResultValues[i + 1];
                    entity.MATERIAL_BIN_QTY_TOTAL  = lotResultValues[i + 2];
                    entity.MATERIAL_BIN_STATE      = lotResultValues[i + 3];
                    entity.PART_NUMBER             = lotResultValues[i + 4];
                    entity.PART_DESC                         = lotResultValues[i + 5];
                    entity.QUANTITY_UNIT                     = lotResultValues[i + 6];
                    entity.SHIPPING_LOT_NUMBER               = lotResultValues[i + 7];
                    entity.SHIPPING_LOT_NUMBER2              = lotResultValues[i + 8];
                    entity.SHIPPING_LOT_PART_NUMBER          = lotResultValues[i + 9];
                    entity.SHIPPING_LOT_SNO_PART_DESCRIPTION = lotResultValues[i + 10];
                    entity.SHIPPING_LOT_SNO_PART_NUMBER      = lotResultValues[i + 11];
                    entity.SHIPPING_LOT_SNO_QTY_ACTUAL       = lotResultValues[i + 12];
                    entity.SHIPPING_LOT_SNO_QTY_TOTAL        = lotResultValues[i + 13];
                }
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " shipGetLotFromSerialNumber " + error, "");
            }
            else//-418 'Serial number was not found in the lot'
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " shipGetLotFromSerialNumber " + error + "," + errorMsg, "");
            }
            return(entity);
        }
Example #15
0
        /// <summary>
        /// 根据锡膏印刷做了设备绑定工单的修改       郑培聪     20180301
        /// </summary>
        /// <param name="equipmentIndex"></param>
        /// <param name="equipmentNo"></param>
        /// <param name="setupFlag"></param>
        /// <returns></returns>
        public int UpdateEquipmentData(string equipmentIndex, string equipmentNo, int setupFlag)
        {
            int    errorCode = 0;
            string errorMsg  = "";

            string[] equipmentUploadKeys   = new string[] { "EQUIPMENT_INDEX", "ERROR_CODE", "EQUIPMENT_NUMBER" };
            string[] equipmentUploadValues = new string[] { equipmentIndex, "0", equipmentNo };
            string[] equipmentResultValues = new string[] { };
            errorCode = imsapi.equUpdateEquipmentData(sessionContext, init.configHandler.StationNumber, setupFlag, "-1", init.currentSettings.workorderNumber, init.currentSettings.processLayer,
                                                      equipmentUploadKeys, equipmentUploadValues, out equipmentResultValues);
            LogHelper.Info("Api equUpdateEquipmentData: equipment no =" + equipmentNo + ",setup flag = " + setupFlag + ", error code =" + errorCode);
            if (errorCode == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " equUpdateEquipmentData " + errorCode, "");
            }
            else
            {
                if (errorCode == 5)
                {
                    if (equipmentResultValues[1] == "1301")
                    {
                        errorCode = 0;
                    }
                    else if (equipmentResultValues[1] == "1300")
                    {
                        //remove
                        errorCode = Convert.ToInt32(equipmentResultValues[1]);
                        UpdateEquipmentData(equipmentIndex, equipmentNo, 1);
                    }
                    else
                    {
                        errorCode = Convert.ToInt32(equipmentResultValues[1]);
                    }
                }
                if (errorCode != 0)
                {
                    //imsapi.imsapiGetErrorText(sessionContext, errorCode, out errorMsg);
                    errorMsg = UtilityFunction.GetZHSErrorString(errorCode, init, sessionContext);
                    view.errorHandler(3, init.lang.ERROR_API_CALL_ERROR + " equUpdateEquipmentData " + errorCode + "," + errorMsg, "");
                }
            }
            return(errorCode);
        }
        public int CheckSNAddToShippingLot(string lotNumber, string serialNumber)
        {
            int    error    = 0;
            string errorMsg = "";

            LogHelper.Info("begin api shipCheckSerialNumberAddToShippingLot (Station number:" + init.configHandler.StationNumber + ",lot number =" + lotNumber + ",serial number =" + serialNumber + ")");
            error = imsapi.shipCheckSerialNumberAddToShippingLot(sessionContext, init.configHandler.StationNumber, lotNumber, serialNumber, "-1");
            LogHelper.Info("end api shipCheckSerialNumberAddToShippingLot (result code = " + error + ")");
            errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " shipCheckSerialNumberAddToShippingLot " + error, "");
            }
            else//=-424 'Serial number is already assigned to the lot';=-437 'Package quantity already reached'//=-425 'Part no. is different from the serial numbers already included'
            {
                view.errorHandler(3, init.lang.ERROR_API_CALL_ERROR + " shipCheckSerialNumberAddToShippingLot " + error + "," + errorMsg, "");
            }
            return(error);
        }
        public int AddSNToShippingLot(string lotNumber, string serialNumber)
        {
            int    error    = 0;
            string errorMsg = "";

            LogHelper.Info("begin api shipAddSerialNumberToShippingLot (Station number:" + init.configHandler.StationNumber + ",lot number =" + lotNumber + ",serial number =" + serialNumber + ")");
            error = imsapi.shipAddSerialNumberToShippingLot(sessionContext, init.configHandler.StationNumber, lotNumber, serialNumber, -1, -1);
            LogHelper.Info("end api shipAddSerialNumberToShippingLot (result code = " + error + ")");
            errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
            if (error == 0 || error == 405)//405 'Last serial number'
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " shipAddSerialNumberToShippingLot " + error, "");
            }
            else//-437 'Package quantity already reached'
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " shipAddSerialNumberToShippingLot " + error + "," + errorMsg, "");
            }
            return(error);
        }
        public int RemoveSNFormShippingLot(string lotNumber, string serialNumber)
        {
            int    error    = 0;
            string errorMsg = "";

            LogHelper.Info("begin api shipRemoveSerialNumberFromShippingLot (Station number:" + init.configHandler.StationNumber + ",lot number =" + lotNumber + ",serial number =" + serialNumber + ")");
            error = imsapi.shipRemoveSerialNumberFromShippingLot(sessionContext, init.configHandler.StationNumber, lotNumber, serialNumber, "-1", -1);
            LogHelper.Info("end api shipRemoveSerialNumberFromShippingLot (result code = " + error + ")");
            errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " shipRemoveSerialNumberFromShippingLot " + error, "");
            }
            else//-418 'Serial number was not found in the lot'
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " shipRemoveSerialNumberFromShippingLot " + error + "," + errorMsg, "");
            }
            return(error);
        }
Example #19
0
        public int SwitchSerialNumber(string serialNumber, int processLayer)
        {
            SwitchSerialNumberData snData = new SwitchSerialNumberData(0, serialNumber + "_1", "1", serialNumber, 0);

            SwitchSerialNumberData[] serialNumberArray = new SwitchSerialNumberData[] { snData };

            int    error    = imsapi.trSwitchSerialNumber(sessionContext, init.configHandler.StationNumber, "-1", "-1", ref serialNumberArray);
            string errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            if (error == 0)
            {
                view.errorHandler(0, " trSwitchSerialNumber " + error, "");
            }
            else
            {
                view.errorHandler(2, " trSwitchSerialNumber " + error + "(" + errorMsg + ")", "");
            }
            return(error);
        }
Example #20
0
        public int CheckUserSkillForWS(string userName)
        {
            int errorCode = 0;

            KeyValue[] checkUserSkillFilter = new KeyValue[] { new KeyValue("WORKORDER_NUMBER", init.currentSettings.workorderNumber) };
            LogHelper.Info("begin api trCheckUserSkill (Station number:" + init.configHandler.StationNumber + ",process layer:" + init.currentSettings.processLayer + ",user name:" + userName + ")");
            errorCode = imsapi.trCheckUserSkill(sessionContext, init.configHandler.StationNumber, init.currentSettings.processLayer, userName, checkUserSkillFilter);
            LogHelper.Info("end api trCheckUserSkill (result code = " + errorCode + ")");
            if (errorCode != 0)
            {
                view.errorHandler(3, init.lang.ERROR_API_CALL_ERROR + " trCheckUserSkill " + errorCode, "");
            }
            else
            {
                string errorString = UtilityFunction.GetZHSErrorString(errorCode, init, sessionContext);
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " trCheckUserSkill " + errorCode + "(" + errorString + ")", "");
            }
            return(errorCode);
        }
Example #21
0
        public int trCheckSNState(string serialNumber, int processLayer)
        {
            String[] serialNumberStateResultKeys   = new String[] { "ERROR_CODE" };
            String[] serialNumberStateResultValues = new String[] { };
            LogHelper.Info("begin api trCheckSerialNumberState (Serial number:" + serialNumber + ")");
            int    error       = imsapi.trCheckSerialNumberState(sessionContext, init.configHandler.StationNumber, processLayer, 1, serialNumber, "-1", serialNumberStateResultKeys, out serialNumberStateResultValues);
            string errorString = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            LogHelper.Info("end api trCheckSerialNumberState (errorcode = " + error + ")");
            if (error != 0)
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " trCheckSerialNumberState " + error + "(" + errorString + ")", "");
            }
            else
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " trCheckSerialNumberState " + error, "");
            }
            return(error);
        }
        public string GetNextMaterialBinNumber(string partNumber)
        {
            string materialBinNo = "";

            LogHelper.Info("begin api mlGetNextMaterialBinNumber (part number:" + partNumber + ")");
            int error = imsapi.mlGetNextMaterialBinNumber(sessionContext, init.configHandler.StationNumber, partNumber, out materialBinNo);

            LogHelper.Info("end api mlGetNextMaterialBinNumber (result code = " + error + ")");
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " mlGetNextMaterialBinNumber " + error, "");
            }
            else
            {
                string errorString = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " mlGetNextMaterialBinNumber " + error + "(" + errorString + ")", "");
            }
            return(materialBinNo);
        }
        public int DeactivateShippingLotAtStation(string lotNumber)
        {
            int    error    = 0;
            string errorMsg = "";

            LogHelper.Info("begin api shipDeactivateShippingLotAtKap (Station number:" + init.configHandler.StationNumber + ",lot number =" + lotNumber + ")");
            error = imsapi.shipDeactivateShippingLotAtKap(sessionContext, init.configHandler.StationNumber, lotNumber);
            LogHelper.Info("end api shipDeactivateShippingLotAtKap (result code = " + error + ")");
            errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " shipDeactivateShippingLotAtKap " + error, "");
            }
            else
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " shipDeactivateShippingLotAtKap " + error + "," + errorMsg, "");
            }
            return(error);
        }
Example #24
0
        public int SetupStateChange(string workorder, int activateFlag)
        {
            int error = 0;

            //0 = Activate setup
            //1 = Deactivate setup
            //2 = Delete setup
            error = imsapi.setupStateChange(sessionContext, init.configHandler.StationNumber, init.currentSettings.processLayer, workorder, "-1", -1, activateFlag);
            if (error != 0)
            {
                string errorString = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " setupStateChange " + error + "(" + errorString + ")", "");
            }
            else
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " setupStateChange " + error, "");
            }
            return(error);
        }
Example #25
0
        public DataTable GetBomMaterialData(string workorder, string erpGroup)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("PartNo", typeof(string)));
            dt.Columns.Add(new DataColumn("MaterialBinNumber", typeof(string)));
            dt.Columns.Add(new DataColumn("Qty", typeof(string)));
            dt.Columns.Add(new DataColumn("CompName", typeof(string)));
            dt.Columns.Add(new DataColumn("ErpGroup", typeof(string)));
            KeyValue[] bomDataFilter       = new KeyValue[] { new KeyValue("WORKORDER_NUMBER", workorder), new KeyValue("PROCESS_BASED", "1") };
            string[]   bomDataResultKeys   = new string[] { "PART_NUMBER", "QUANTITY", "MACHINE_GROUP_NUMBER" };
            string[]   bomDataResultValues = new string[] { };
            LogHelper.Info("begin api mdataGetBomData (Work Order:" + workorder + ")");
            int    error    = imsapi.mdataGetBomData(sessionContext, init.configHandler.StationNumber, bomDataFilter, bomDataResultKeys, out bomDataResultValues);
            string errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            LogHelper.Info("end api mdataGetBomData (result code = " + error + ")");
            if (error != 0)
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " mdataGetBomData " + error + "(" + errorMsg + ")", "");
                return(null);
            }
            else
            {
                int loop  = bomDataResultKeys.Length;
                int count = bomDataResultValues.Length;
                for (int i = 0; i < count; i += loop)
                {
                    if (erpGroup == bomDataResultValues[i + 2].ToString())
                    {
                        DataRow row = dt.NewRow();
                        row["PartNo"]            = bomDataResultValues[i].ToString();
                        row["CompName"]          = bomDataResultValues[i + 1].ToString();
                        row["ErpGroup"]          = bomDataResultValues[i + 2].ToString();
                        row["MaterialBinNumber"] = "";
                        row["Qty"] = "";
                        dt.Rows.Add(row);
                    }
                }
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " mdataGetBomData " + error, "");
            }
            return(dt);
        }
Example #26
0
        public ProductEntity GetProductQty(int processLayer, string workorder)
        {
            ProductEntity entity = null;

            KeyValue[] workorderFilters          = new KeyValue[] { };
            KeyValue[] filterDataArray           = new KeyValue[] { new KeyValue("0", workorder) };
            string[]   productQuantityResultKeys = new string[] { "QUANTITY_FAIL", "QUANTITY_PASS", "QUANTITY_SCRAP", "QUANTITY_WORKORDER_FINISHED"
                                                                  , "QUANTITY_WORKORDER_STARTED", "QUANTITY_WORKORDER_TOTAL", "STATION_NUMBER", "WORKSTEP_NUMBER" };
            string[] productQuantityResultValues = new string[] { };
            LogHelper.Info("begin api trGetProductQuantity (Station number:" + init.configHandler.StationNumber + ",Process layer:" + processLayer + ",Workorder number:" + workorder + ")");
            int error = imsapi.trGetProductQuantity(sessionContext, init.configHandler.StationNumber, processLayer, 0, workorderFilters, filterDataArray, productQuantityResultKeys, out productQuantityResultValues);

            LogHelper.Info("end api trGetProductQuantity (result code = " + error + ")");
            if (error != 0)
            {
                string errorString = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " trGetProductQuantity " + error + "(" + errorString + ")", "");
                return(null);
            }
            else
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " trGetProductQuantity " + error, "");
            }
            if (productQuantityResultValues.Length > 0)
            {
                entity = new ProductEntity();
                int loop  = productQuantityResultKeys.Length;
                int count = productQuantityResultValues.Length;
                for (int i = 0; i < count; i += loop)
                {
                    entity.QUANTITY_FAIL  = productQuantityResultValues[i + 0];
                    entity.QUANTITY_PASS  = productQuantityResultValues[i + 1];
                    entity.QUANTITY_SCRAP = productQuantityResultValues[i + 2];
                    entity.QUANTITY_WORKORDER_FINISHED = productQuantityResultValues[i + 3];
                    entity.QUANTITY_WORKORDER_STARTED  = productQuantityResultValues[i + 4];
                    entity.QUANTITY_WORKORDER_TOTAL    = productQuantityResultValues[i + 5];
                    entity.STATION_NUMBER  = productQuantityResultValues[i + 6];
                    entity.WORKSTEP_NUMBER = productQuantityResultValues[i + 7];
                }
            }
            return(entity);
        }
        public int RemoveAttriValuebyEquipment(string attributeCode, string equipment)
        {
            int    error    = 0;
            string errorMsg = "";

            LogHelper.Info("begin api attribRemoveAttributeValue (station number =" + init.configHandler.StationNumber + ",attribute code=" + attributeCode + ")");
            error = imsapi.attribRemoveAttributeValue(sessionContext, init.configHandler.StationNumber, 15, equipment, "0", attributeCode, "-1");
            LogHelper.Info("end api attribRemoveAttributeValue (result code = " + error + ")");
            //imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
            if (error == 0)
            {
                //view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribRemoveAttributeValue " + error, "");
            }
            else
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " attribRemoveAttributeValue " + error + "(" + errorMsg + ")", "");
            }
            return(error);
        }
Example #28
0
        public string[] GetWorkorderByFilter(string woFilter)
        {
            KeyValue[] workorderFilter       = new KeyValue[] { new KeyValue("WORKORDER_STATE", "S,F"), new KeyValue("WORKORDER_NUMBER", woFilter) };//F = opened (released);S = started
            string[]   workorderResultKeys   = new string[] { "PART_NUMBER", "QUANTITY" };
            string[]   workorderResultValues = new string[] { };
            LogHelper.Info("begin api trGetWorkOrderForStation (Station number:" + init.configHandler.StationNumber + ",workorder filter:" + woFilter + ")");
            int    error    = imsapi.trGetWorkOrderForStation(sessionContext, init.configHandler.StationNumber, workorderFilter, workorderResultKeys, out workorderResultValues);
            string errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            LogHelper.Info("end api trGetWorkOrderForStation (result code = " + error + ")");
            if (error != 0)
            {
                view.errorHandler(3, init.lang.ERROR_API_CALL_ERROR + " trGetWorkOrderForStation " + error + "(" + errorMsg + ")", "");
            }
            else
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " trGetWorkOrderForStation " + error, "");
            }
            return(workorderResultValues);
        }
        public string[] MdataGetFailureDataforStation()
        {
            var failuredataResultKeys   = new string[] { "FAILURE_TYPE_CODE", "FAILURE_TYPE_DESC" };
            var failureDataResultValues = new string[] { };

            LogHelper.Info("begin api mdataGetFailureDataForStation (Station:" + init.configHandler.StationNumber);
            int    error    = imsapi.mdataGetFailureDataForStation(sessionContext, init.configHandler.StationNumber, 0, failuredataResultKeys, out failureDataResultValues);
            string errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);

            LogHelper.Info("end api mdataGetFailureDataForStation (ResultCode = " + error + ")");
            if (error == 0)
            {
                view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " mdataGetFailureDataForStation " + error, "");
            }
            else
            {
                view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " mdataGetFailureDataForStation " + error + "(" + errorMsg + ")", "");
            }
            return(failureDataResultValues);
        }
        public SerialNumberData[] GetSerialNumberBySNRef(string serialNumberRef)
        {
            int    error    = 0;
            string errorMsg = "";

            SerialNumberData[] serialNumberArray = new SerialNumberData[] { };
            error = imsapi.trGetSerialNumberBySerialNumberRef(sessionContext, init.configHandler.StationNumber, serialNumberRef, "-1", out serialNumberArray);
            //imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg);
            errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext);
            LogHelper.Info("api trGetSerialNumberBySerialNumberRef (serial number ref = " + serialNumberRef + ",result code = " + error);
            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(serialNumberArray);
        }