Example #1
0
        /// <summary>
        /// 坐标是否处理
        /// </summary>
        /// <returns></returns>
        public bool IsOkLoc(bool isDel)
        {
            try
            {
                bool res = false;
                if (isDel)
                {
                    // 清坐标
                    lockLocWMS = "";

                    lockLocRGV1 = 0;
                    lockLocRGV2 = 0;

                    TakeSiteX = 0;
                    TakeSiteY = 0;
                    TakeSiteZ = 0;

                    GiveSiteX = 0;
                    GiveSiteY = 0;
                    GiveSiteZ = 0;

                    res = true;
                }
                else
                {
                    if (string.IsNullOrEmpty(lockID))
                    {
                        // 清坐标
                        lockLocWMS = "";

                        lockLocRGV1 = 0;
                        lockLocRGV2 = 0;

                        TakeSiteX = 0;
                        TakeSiteY = 0;
                        TakeSiteZ = 0;

                        GiveSiteX = 0;
                        GiveSiteY = 0;
                        GiveSiteZ = 0;
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(lockLocWMS) ||
                            lockLocRGV1 == 0 || lockLocRGV2 == 0 ||
                            TakeSiteX == 0 || TakeSiteY == 0 || TakeSiteZ == 0 ||
                            GiveSiteX == 0 || GiveSiteY == 0 || GiveSiteZ == 0)
                        {
                            WCS_CONFIG_LOC loc = CommonSQL.GetWcsLocByTask(lockID);
                            if (loc == null || string.IsNullOrEmpty(loc.WMS_LOC) ||
                                string.IsNullOrEmpty(loc.RGV_LOC_1) || string.IsNullOrEmpty(loc.RGV_LOC_2) ||
                                string.IsNullOrEmpty(loc.AWC_LOC_TRACK) || string.IsNullOrEmpty(loc.AWC_LOC_STOCK))
                            {
                                throw new Exception("无对应作业【" + lockID + "】坐标!");
                            }

                            lockLocWMS  = loc.WMS_LOC;
                            lockLocRGV1 = int.Parse(loc.RGV_LOC_1);
                            lockLocRGV2 = int.Parse(loc.RGV_LOC_2);
                            string t = "";
                            string g = "";
                            switch (taskType)
                            {
                            case TaskTypeEnum.入库:
                                t = loc.AWC_LOC_TRACK;
                                g = loc.AWC_LOC_STOCK;
                                break;

                            case TaskTypeEnum.出库:
                                t = loc.AWC_LOC_STOCK;
                                g = loc.AWC_LOC_TRACK;
                                break;

                            default:
                                break;
                            }
                            if (!string.IsNullOrEmpty(t))
                            {
                                string[] ts = t.Split('-');
                                TakeSiteX = int.Parse(ts[0]) + gapX;
                                TakeSiteY = int.Parse(ts[1]) + gapY;
                                TakeSiteZ = int.Parse(ts[2]) + gapZ;
                            }
                            if (!string.IsNullOrEmpty(g))
                            {
                                string[] gs = g.Split('-');
                                GiveSiteX = int.Parse(gs[0]) + gapX;
                                GiveSiteY = int.Parse(gs[1]) + gapY;
                                GiveSiteZ = int.Parse(gs[2]) + gapZ;
                            }
                        }
                        else
                        {
                            res = true;
                        }
                    }
                }
                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }