Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        private void GetBin_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (DGtask.SelectedItem == null)
                {
                    return;
                }

                if (!WindowCommon.ConfirmAction("是否请求库位分配!!"))
                {
                    return;
                }

                string id     = (DGtask.SelectedItem as DataRowView)["任务号"].ToString();
                string status = (DGtask.SelectedItem as DataRowView)["任务状态"].ToString();
                string type   = (DGtask.SelectedItem as DataRowView)["任务类型"].ToString();
                if (type == "入库")
                {
                    // 请求WMS入库分配
                    if (ADS.AssignInSite("B01", id))
                    {
                        Notice.Show("完成!请刷新~", "分配", 3, MessageBoxIcon.Success);
                    }
                    else
                    {
                        Notice.Show("失败!", "失败", 3, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    Notice.Show("该任务不符合分配条件!", "提示", 3, MessageBoxIcon.Info);
                }

                Refresh_Click(sender, e);
            }
            catch (Exception ex)
            {
                Notice.Show(ex.Message, "错误", 3, MessageBoxIcon.Error);
            }
        }