Example #1
0
        /// <summary>
        /// 通用数据采集
        /// </summary>
        /// <param name="_session"></param>
        /// <param name="_transData"></param>
        private void ExecuteNDQ(MesSession _session, TransData _transData)
        {
            //1、参数校验---equipmentID---------------------------------
            string equipmentID = string.Empty;

            if (!EmployeeComm.CheckEquipmentID(_session, _transData, out equipmentID, EmployeeName))
            {
                return;
            }

            //2、参数校验---ProcessData > 2项------------------------------
            List <string> lstProcessData = new List <string>();

            if (!EmployeeComm.CheckProcessData(_session, _transData, out lstProcessData, EmployeeName, Comparator.MoreThan, 2))
            {
                return;
            }

            if (!GlobalData.IsDebug)
            {
                if ((lstProcessData[0]) == "02")
                {
                    string nEmployeeName = $"气密性测试数据采集-通用过站";

                    //2.1、参数校验---apiStatus
                    string apiStatus = string.Empty;
                    if (!EmployeeComm.CheckApiStatus(_session, _transData, out apiStatus, nEmployeeName))
                    {
                        return;
                    }

                    //2.2、【气密性测试数据采集】需要提前执行【通过过站】操作 //不需要传制令单号
                    if (!EmployeeComm.CheckRoute(_session, _transData, "", equipmentID, apiStatus, nEmployeeName))
                    {
                        return;
                    }

                    //2.3、队列方式进行报工(如果记录了不良则无需进行第二次报工,因为记录不良时已经进行第一次报工了)
                    if (apiStatus != "FAIL")
                    {
                        GlobalData.queueServerNDQ.EnqueueItem(new TestItemFlex(_session, _transData, equipmentID, nEmployeeName, "103OUT"));
                    }
                }

                //3、采集数据参数校验
                if (!CheckNdqParam(_session, _transData, equipmentID, lstProcessData))
                {
                    return;
                }
            }

            //4、API执行成功  ---------------------------------
            EmployeeComm.SendMsg(_session, _transData, CheckResult.OK);

            //5、队列方式保存采集数据
            GlobalData.queueServerNDQ.EnqueueItem(new TestItemFlex(_transData.SN, _transData.DeviceCode, equipmentID, lstProcessData, _session));
        }
Example #2
0
        /// <summary>
        /// 检验工序过站(值类型)
        /// </summary>
        /// <param name="_session"></param>
        /// <param name="_transData"></param>
        private void ExecuteTVC(MesSession _session, TransData _transData)
        {
            LogInfo log = null;

            //1、参数校验---EquipmentNumber---------------------------------
            string equipmentID = string.Empty;

            if (!EmployeeComm.CheckEquipmentID(_session, _transData, out equipmentID, EmployeeName))
            {
                return;
            }

            //2、参数校验---WorkOrder---------------------------------
            string workOrder = string.Empty;

            if (!EmployeeComm.CheckWorkOrder(_session, _transData, out workOrder, EmployeeName, DataFrom.SQLite))
            {
                return;
            }

            //3、参数校验---获取待检验数据并校验有效性 ---------------------------------
            decimal weight = ConvertHelper.ToDecimal(_transData.ProcessData, 0);

            if (weight <= 0)
            {
                log = new SocketService.LogInfo(_session, LogLevel.Error, $"[{_transData.SN}]执行【{EmployeeName}】之称重检验接口失败>> 协议错误,请检查协议中过程数据是否为有效值(数值需大于0),当前过程数据:{_transData.ProcessData}。");
                EmployeeComm.SendMsg(_session, _transData, CheckResult.NG);
                return;
            }

            if (!GlobalData.IsDebug)
            {
                //4、执行称重校验 ---------------------------------
                string apiStatus = string.Empty;
                CheckWeight(_session, _transData, weight, out apiStatus);

                //5、执行过站
                if (!EmployeeComm.CheckRoute(_session, _transData, workOrder, equipmentID, apiStatus, EmployeeName))
                {
                    return;
                }

                //5.1、队列方式进行报工(如果记录了不良则无需进行第二次报工,因为记录不良时已经进行第一次报工了)
                if (apiStatus != "FAIL")
                {
                    GlobalData.queueServerNDQ.EnqueueItem(new TestItemFlex(_session, _transData, equipmentID, EmployeeName, "103OUT"));
                }
            }
            //6、API执行成功  ---------------------------------
            EmployeeComm.SendMsg(_session, _transData, CheckResult.OK);
        }
Example #3
0
        /// <summary>
        /// 通用过站
        /// </summary>
        /// <param name="_session"></param>
        /// <param name="_transData"></param>
        private void ExecuteNRC(MesSession _session, TransData _transData)
        {
            //1、参数校验---equipmentID
            string equipmentID = string.Empty;

            if (!EmployeeComm.CheckEquipmentID(_session, _transData, out equipmentID, EmployeeName))
            {
                return;
            }

            //2、参数校验---WorkOrder
            string workOrder = string.Empty;

            if (_transData.DeviceCode == "OP010") //首站需要校验制令单号
            {
                if (!EmployeeComm.CheckWorkOrder(_session, _transData, out workOrder, $"{EmployeeName}-工单获取", DataFrom.SQLite))
                {
                    return;
                }
            }

            //3、参数校验---apiStatus
            string apiStatus = string.Empty;

            if (!EmployeeComm.CheckApiStatus(_session, _transData, out apiStatus, EmployeeName))
            {
                return;
            }

            if (!GlobalData.IsDebug)
            {
                //4、执行过站
                if (!EmployeeComm.CheckRoute(_session, _transData, workOrder, equipmentID, apiStatus, EmployeeName))
                {
                    return;
                }

                //4.1 队列方式进行报工(如果记录了不良则无需进行第二次报工,因为记录不良时已经进行第一次报工了)
                if (apiStatus != "FAIL")
                {
                    GlobalData.queueServerNDQ.EnqueueItem(new TestItemFlex(_session, _transData, equipmentID, EmployeeName, "103OUT"));
                }
            }

            //5、API执行成功 ---------------------------------
            EmployeeComm.SendMsg(_session, _transData, CheckResult.OK);
        }