Example #1
0
        /// <summary>
        /// 扫码数据处理
        /// </summary>
        /// <param name="devName"></param>
        /// <param name="code"></param>
        public void GetCode(string devName, string code)
        {
            try
            {
                if (!code.StartsWith("@") || code.Split('@').Length != 2)
                {
                    return;
                }

                if (devices.Exists(c => c.devName == devName))
                {
                    DevInfoFRT f = devices.Find(c => c.devName == devName);

                    //if (f._.ActionStatus == ActionEnum.运行中 || f._.RollerStatus != RollerStatusEnum.辊台停止)
                    //{
                    //    throw new Exception(string.Format("辊台未停止,不处理扫码.", code));
                    //}

                    //是否满足任务
                    if (CommonSQL.GetInTask(code, out string tid))
                    {
                        if (!string.IsNullOrEmpty(tid))
                        {
                            if (string.IsNullOrEmpty(f.lockID1))
                            {
                                // 请求WMS分配
                                if (ADS.AssignInSite(f.area, tid))
                                {
                                    f.IsLockUnlockNew(f.isLock, tid, f.lockID2);
                                }
                            }
                            else if (string.IsNullOrEmpty(f.lockID2))
                            {
                                if (tid != f.lockID1)
                                {
                                    // 请求WMS分配
                                    if (ADS.AssignInSite(f.area, tid))
                                    {
                                        f.IsLockUnlockNew(f.isLock, f.lockID1, tid);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        throw new Exception(string.Format("读取二维码[{0}]异常.", code));
                    }
                }
            }
            catch (Exception ex)
            {
                // LOG
                CommonSQL.LogErr("FRT.DoTaskNew()", "固定辊台作业[设备]", (ex.Message + ex.Source), devName);
            }
        }