/// <summary>
        /// Private Sub Search_Scaner_Ele(ByVal strID As String)
        /// 获取电极信息
        /// </summary>
        /// <param name="CNCItemID"></param>
        /// <returns></returns>
        public CNCItem GetCNCItem(int CNCItemID)
        {
            string  _url  = "/Task/JsonCNCItem?CNCItemID=" + CNCItemID;
            CNCItem _item = JsonConvert.DeserializeObject <CNCItem>(_server.ReceiveStream(_url));

            return(_item);
        }
        public CNCItem GetCNCItem(string LabelName)
        {
            string  _url  = "/Task/JsonCNCItemLabel?LabelName=" + LabelName;
            CNCItem _item = JsonConvert.DeserializeObject <CNCItem>(_server.ReceiveStream(_url));

            return(_item);
        }
        public void SetReady(int CNCItemID)
        {
            CNCItem _item = QueryByID(CNCItemID);

            _item.Ready = true;
            _context.SaveChanges();
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="ELE_IndexCode"></param>
        /// <returns></returns>
        public CNCItem GetCNCItemsByELE_Index(string ELE_IndexCode)
        {
            string  _url  = "/Task/GetCNCItemsByELE_Index?ELE_IndexCode=" + ELE_IndexCode;
            CNCItem _item = JsonConvert.DeserializeObject <CNCItem>(_server.ReceiveStream(_url));

            return(_item);
        }
        public void SetUnRequired(int CNCItemID)
        {
            CNCItem _item = QueryByID(CNCItemID);

            _item.Required = false;
            _context.SaveChanges();
        }
        public void SetFinish(int CNCItemID)
        {
            CNCItem _item = QueryByID(CNCItemID);

            _item.Finished = true;
            _context.SaveChanges();
        }
        /// <summary>
        /// 打印标签(复打)
        /// </summary>
        /// <param name="CNCItemID"></param>
        /// <param name="Reprint"></param>
        /// <returns></returns>
        public string SetToPrint(int CNCItemID, bool Reprint = false)
        {
            CNCItem    _item           = QueryByID(CNCItemID);
            List <int> _ItemStatusList = new List <int>()
            {
                (int)CNCItemStatus.未开始, (int)CNCItemStatus.暂停
            };

            if (Reprint)
            {
                _item.LabelPrinted = false;
                _item.LabelToPrint = true;
                if (_ItemStatusList.Contains(_item.Status) && _item.Required)
                {
                    _item.Status = (int)CNCItemStatus.备料;
                }
                _context.SaveChanges();
                return("");
            }
            else
            {
                if (!_item.LabelPrinted)
                {
                    _item.LabelToPrint = true;
                    _item.Status       = (int)CNCItemStatus.备料;
                    _context.SaveChanges();
                    return("");
                }
                else
                {
                    return(_item.LabelName);
                }
            }
        }
        public void SetPrinted(int CNCItemID)
        {
            CNCItem _item = QueryByID(CNCItemID);

            _item.LabelPrinted = true;
            _context.SaveChanges();
        }
 public TaskFinishGridRowModel(CNCItem Item, string machineName)
 {
     cell    = new string[4];
     cell[0] = Item.CNCItemID.ToString();
     cell[1] = Item.LabelName;
     cell[2] = Item.CNCStartTime.ToString("yyyy-MM-dd HH:mm");
     cell[3] = machineName;//Item.CNCMachine;
 }
        public void SetPosition(string Label, string Position)
        {
            CNCItem _item = QueryByLabel(Label);

            _item.PartPosition = Position;
            _item.Finished     = true;
            _context.SaveChanges();
        }
        public CNCItem QueryByELE_IndexCode(string ELE_IndexCode)
        {
            ELE_IndexCode = ELE_IndexCode.Trim();
            //string ELE_IndexCode = "*EI0000018013*";
            ELE_IndexCode = ELE_IndexCode.Replace("*", "");
            //ELE_IndexCode = ELE_IndexCode.Replace("EI", "");
            ELE_IndexCode = ELE_IndexCode.Substring(2, ELE_IndexCode.Length - 2);
            int     ELE_Index = Convert.ToInt32(ELE_IndexCode);
            CNCItem _cncItem  = _context.CNCItems.Where(c => c.ELE_INDEX == ELE_Index).FirstOrDefault();

            return(_cncItem);
        }
Exemple #12
0
        public CNCItemGridRowModel(Task _task, CNCItem Item)
        {
            cell    = new string[11];
            cell[0] = Item.CNCItemID.ToString();
            cell[1] = Item.LabelName;
            cell[2] = Item.Ready.ToString();
            cell[3] = Item.Required.ToString();
            cell[4] = Item.Material;
            cell[5] = Item.SafetyHeight.ToString();
            cell[6] = _task.Raw;
            cell[7] = Item.LabelPrinted.ToString();
            cell[8] = Item.Status >= (int)CNCItemStatus.CNC结束? true.ToString() : false.ToString();

            cell[9]  = Item.CNCStartTime.ToString("yyyy-MM-dd HH:mm");
            cell[10] = Item.CNCFinishTime.ToString("yyyy-MM-dd HH:mm");
        }
Exemple #13
0
        public ElectrodeGridRowModel(CNCItem CNCItem, string TaskName, DateTime FinishDate)
        {
            cell    = new string[7];
            cell[0] = CNCItem.CNCItemID.ToString();
            cell[1] = TaskName;
            cell[2] = CNCItem.LabelName;
            cell[3] = CNCItem.Gap.ToString();
            cell[4] = CNCItem.GapCompensation.ToString();
            cell[5] = CNCItem.ZCompensation.ToString();

            if (FinishDate == new DateTime(1900, 1, 1))
            {
                cell[6] = "-";
            }
            else
            {
                cell[6] = FinishDate.ToString("yyyy-MM-dd HH:mm");
            }
        }
        public ElectrodeStockGridRowModel(CNCItem CNCItem)
        {
            cell    = new string[6];
            cell[0] = CNCItem.CNCItemID.ToString();
            cell[1] = CNCItem.LabelName;
            cell[2] = CNCItem.Material;
            cell[3] = CNCItem.CreateTime.ToString("yyyy-MM-dd HH:mm");
            cell[4] = Enum.GetName(typeof(CNCItemStatus), CNCItem.Status);
            string middle = "0000000000" + CNCItem.ELE_INDEX.ToString();

            try
            {
                middle = middle.Substring(middle.Length - 10, 10) ?? "";
            }
            catch
            {
                middle = "";
            }
            middle  = "*EI" + middle + "*";
            cell[5] = middle;
        }
        public int Save(CNCItem CNCItem)
        {
            bool    _isNew   = false;
            CNCItem _dbEntry = QueryByID(CNCItem.CNCItemID);

            if (_dbEntry == null)
            {
                _dbEntry = QueryByLabel(CNCItem.LabelName);
                if (_dbEntry == null)
                {
                    _context.CNCItems.Add(CNCItem);
                    _isNew = true;
                }
                else
                {
                    _dbEntry.TaskID          = CNCItem.TaskID;
                    _dbEntry.LabelName       = CNCItem.LabelName;
                    _dbEntry.Material        = CNCItem.Material;
                    _dbEntry.OffsetX         = CNCItem.OffsetX;
                    _dbEntry.OffsetY         = CNCItem.OffsetY;
                    _dbEntry.OffsetZ         = CNCItem.OffsetZ;
                    _dbEntry.OffsetC         = CNCItem.OffsetC;
                    _dbEntry.GapCompensation = CNCItem.GapCompensation;
                    _dbEntry.ZCompensation   = CNCItem.ZCompensation;
                    _dbEntry.Status          = CNCItem.Status;
                    _dbEntry.CreateTime      = CNCItem.CreateTime;
                    _dbEntry.CNCStartTime    = CNCItem.CNCStartTime;
                    _dbEntry.CNCFinishTime   = CNCItem.CNCFinishTime;
                    _dbEntry.CNCMachine      = CNCItem.CNCMachine;
                    _dbEntry.Destroy         = CNCItem.Destroy;
                    _dbEntry.DestroyTime     = CNCItem.DestroyTime;
                    _dbEntry.Gap             = CNCItem.Gap;
                    _dbEntry.EleType         = CNCItem.EleType;
                    _dbEntry.HeightMax       = CNCItem.HeightMax;
                    _dbEntry.HeightMin       = CNCItem.HeightMin;
                    _dbEntry.GapMax          = CNCItem.GapMax;
                    _dbEntry.GapMin          = CNCItem.GapMin;
                    _dbEntry.LabelToPrint    = CNCItem.LabelToPrint;
                    _dbEntry.LabelPrinted    = CNCItem.LabelPrinted;
                    _dbEntry.SafetyHeight    = CNCItem.SafetyHeight;
                    _dbEntry.ELE_INDEX       = CNCItem.ELE_INDEX;
                    _dbEntry.CNCMachMethod   = CNCItem.CNCMachMethod;
                    _dbEntry.MoldNumber      = CNCItem.MoldNumber;
                    _dbEntry.QCFinishTime    = CNCItem.QCFinishTime;
                }
            }
            else
            {
                _dbEntry.TaskID          = CNCItem.TaskID;
                _dbEntry.LabelName       = CNCItem.LabelName;
                _dbEntry.Material        = CNCItem.Material;
                _dbEntry.OffsetX         = CNCItem.OffsetX;
                _dbEntry.OffsetY         = CNCItem.OffsetY;
                _dbEntry.OffsetZ         = CNCItem.OffsetZ;
                _dbEntry.OffsetC         = CNCItem.OffsetC;
                _dbEntry.GapCompensation = CNCItem.GapCompensation;
                _dbEntry.ZCompensation   = CNCItem.ZCompensation;
                _dbEntry.Status          = CNCItem.Status;
                _dbEntry.CreateTime      = CNCItem.CreateTime;
                _dbEntry.CNCStartTime    = CNCItem.CNCStartTime;
                _dbEntry.CNCFinishTime   = CNCItem.CNCFinishTime;
                _dbEntry.CNCMachine      = CNCItem.CNCMachine;
                _dbEntry.Destroy         = CNCItem.Destroy;
                _dbEntry.DestroyTime     = CNCItem.DestroyTime;
                _dbEntry.Gap             = CNCItem.Gap;
                _dbEntry.EleType         = CNCItem.EleType;
                _dbEntry.HeightMax       = CNCItem.HeightMax;
                _dbEntry.HeightMin       = CNCItem.HeightMin;
                _dbEntry.GapMax          = CNCItem.GapMax;
                _dbEntry.GapMin          = CNCItem.GapMin;
                _dbEntry.LabelToPrint    = CNCItem.LabelToPrint;
                _dbEntry.LabelPrinted    = CNCItem.LabelPrinted;
                _dbEntry.SafetyHeight    = CNCItem.SafetyHeight;
                _dbEntry.ELE_INDEX       = CNCItem.ELE_INDEX;
                _dbEntry.CNCMachMethod   = CNCItem.CNCMachMethod;
                _dbEntry.MoldNumber      = CNCItem.MoldNumber;
                _dbEntry.QCFinishTime    = CNCItem.QCFinishTime;
            }

            _context.SaveChanges();
            if (_isNew)
            {
                return(CNCItem.CNCItemID);
            }
            else
            {
                return(_dbEntry.CNCItemID);
            }
        }