Exemplo n.º 1
0
        /// <summary>
        /// 弃样
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPut(object sender, EventArgs e)
        {
            GridButtonXEditControl btn = sender as GridButtonXEditControl;

            if (btn == null)
            {
                return;
            }
            InfCYGSam entity = btn.EditorCell.GridRow.DataItem as InfCYGSam;

            if (entity != null)
            {
                List <string> makeCodes = new List <string>();
                makeCodes.Add(entity.Code);
                SendCYGCmd(makeCodes, "弃样", SelfVars.LoginUser.UserName, entity.MachineCode);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 弃样
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPut(object sender, EventArgs e)
        {
            GridButtonXEditControl btn = sender as GridButtonXEditControl;

            if (btn == null)
            {
                return;
            }
            if (MessageBoxEx.Show("确定发送弃样命令?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                InfCYGSam entity = btn.EditorCell.GridRow.DataItem as InfCYGSam;
                if (entity != null)
                {
                    SendCYGCmd(entity.Code, entity.MachineCode, eCZPLX.弃样, SelfVars.LoginUser.UserName);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 弃样
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPut(object sender, EventArgs e)
        {
            GridButtonXEditControl btn = sender as GridButtonXEditControl;

            if (btn == null)
            {
                return;
            }
            if (MessageBoxEx.Show("确定发送弃样命令?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                InfCYGSam entity = btn.EditorCell.GridRow.DataItem as InfCYGSam;
                if (entity != null)
                {
                    InfCYGSam rulst = commonDAO.SelfDber.Get <InfCYGSam>(entity.Id);
                    if (rulst != null)
                    {
                        if (entity.MachineCode == GlobalVars.MachineCode_CYG1 && slightCYG.LightColor != EquipmentStatusColors.BeReady)
                        {
                            MessageBoxEx.Show(string.Format("{0}未就绪!", entity.MachineCode), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                        if (entity.MachineCode == GlobalVars.MachineCode_CYG2 && slightCYG2.LightColor != EquipmentStatusColors.BeReady)
                        {
                            MessageBoxEx.Show(string.Format("{0}未就绪!", entity.MachineCode), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        SendCYGCmd(entity.Code, entity.MachineCode, eCZPLX.弃样, SelfVars.LoginUser.UserName);
                        commonDAO.SaveAppletLog(eAppletLogLevel.Info, "弃样", string.Format("发送弃样命令,编码:{0} 操作人:{1}", entity.Code, SelfVars.LoginUser.UserName));
                    }
                    else
                    {
                        MessageBoxEx.Show("该样品已经不在存样柜,请核实!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
            }
        }
        /// <summary>
        /// 同步智能存样柜数据
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public bool SyncCYGInfo(Action <string, eOutputType> output)
        {
            int  resu         = 0; //修改
            int  resi         = 0; //新增
            bool returnresult = false;

            foreach (Tb_Bolt item in this.EquDber.Entities <Tb_Bolt>("where DataStatus=0"))
            {
                InfCYGSamHistory infcygsamhistory = new InfCYGSamHistory();
                InfCYGSam        infcygsam        = Dbers.GetInstance().SelfDber.Entity <InfCYGSam>(" where MachineCode=:MachineCode and CellIndex=:CellIndex and ColumnIndex=:ColumnIndex and AreaNumber=:AreaNumber", new { MachineCode = MachineCode, CellIndex = item.RowNo, ColumnIndex = item.ColumnNo, AreaNumber = item.RotateNo });

                if (infcygsam == null)
                {
                    infcygsam             = new InfCYGSam();
                    infcygsam.UpdateTime  = DateTime.Now;
                    infcygsam.Code        = item.Sample_Id;
                    infcygsam.SamType     = item.Big == 1 ? "大瓶" : "小瓶";
                    infcygsam.CellIndex   = item.RowNo;
                    infcygsam.ColumnIndex = item.ColumnNo;
                    infcygsam.AreaNumber  = item.RotateNo;
                    infcygsam.MachineCode = MachineCode;
                    if (!String.IsNullOrEmpty(item.Sample_Id))
                    {
                        infcygsam.IsNew = 1;
                    }
                    else
                    {
                        infcygsam.IsNew = 0;
                    }
                    if (Dbers.GetInstance().SelfDber.Insert(infcygsam) > 0)
                    {
                        resi++;
                        item.DataStatus = 1;
                        this.EquDber.Update(item);
                    }

                    //历史存样信息
                    //if (!String.IsNullOrEmpty(item.Sample_Id))
                    //{
                    //    infcygsamhistory.MachineCode = MachineCode;
                    //    infcygsamhistory.UpdateTime = DateTime.Now;
                    //    infcygsamhistory.Code = item.Sample_Id;
                    //    infcygsam.SamType = item.Big == 1 ? "大瓶" : "小瓶";
                    //    infcygsamhistory.CellIndex = item.RowNo;
                    //    infcygsamhistory.ColumnIndex = item.ColumnNo;
                    //    infcygsamhistory.AreaNumber = item.RotateNo;
                    //    infcygsamhistory.IsNew = 1;
                    //    resu += Dbers.GetInstance().SelfDber.Insert(infcygsamhistory);
                    //}
                }
                else
                {
                    #region 历史存样信息
                    //if (!String.IsNullOrEmpty(item.Sample_Id))
                    //{
                    //    infcygsamhistory.UpdateTime = DateTime.Now;
                    //    infcygsamhistory.Code = item.Sample_Id;
                    //    //infcygsamhistory.SamType = item.SampleType;
                    //    infcygsamhistory.CellIndex = item.RowNo;
                    //    infcygsamhistory.ColumnIndex = item.ColumnNo;
                    //    infcygsamhistory.AreaNumber = item.RotateNo;
                    //    infcygsamhistory.MachineCode = MachineCode;
                    //    infcygsamhistory.IsNew = 1;
                    //    resu += Dbers.GetInstance().SelfDber.Insert(infcygsamhistory);
                    //}
                    //else
                    //{
                    //    infcygsamhistory.UpdateTime = DateTime.Now;
                    //    infcygsamhistory.Code = infcygsam.Code;
                    //    infcygsamhistory.SamType = infcygsam.SamType;
                    //    infcygsamhistory.CellIndex = infcygsam.CellIndex;
                    //    infcygsamhistory.ColumnIndex = infcygsam.ColumnIndex;
                    //    infcygsamhistory.AreaNumber = infcygsam.AreaNumber;
                    //    infcygsamhistory.MachineCode = MachineCode;
                    //    infcygsamhistory.IsNew = 0;
                    //    resu += Dbers.GetInstance().SelfDber.Insert(infcygsamhistory);
                    //}

                    #endregion

                    infcygsam.UpdateTime  = DateTime.Now;
                    infcygsam.Code        = item.Sample_Id;
                    infcygsam.SamType     = item.Big == 1 ? "大瓶" : "小瓶";
                    infcygsam.CellIndex   = item.RowNo;
                    infcygsam.ColumnIndex = item.ColumnNo;
                    infcygsam.AreaNumber  = item.RotateNo;
                    infcygsam.MachineCode = MachineCode;
                    if (!String.IsNullOrEmpty(item.Sample_Id))
                    {
                        infcygsam.IsNew = 1;
                    }
                    else
                    {
                        infcygsam.IsNew = 0;
                    }
                    if (Dbers.GetInstance().SelfDber.Update(infcygsam) > 0)
                    {
                        resi++;
                        item.DataStatus = 1;
                        this.EquDber.Update(item);
                    }
                }
            }

            if (Dbers.GetInstance().SelfDber.Entities <InfCYGSam>(" where IsNew!=1").Count <= 50)
            {
                CommonDAO.GetInstance().SaveSysMessage(eMessageType.存样柜.ToString(), "智能存样柜空闲个数小于50个!", eMessageType.存样柜.ToString());
            }

            if (Dbers.GetInstance().SelfDber.Entities <InfCYGSam>(" where IsNew=1 and UpdateTime+90>sysdate").Count <= 50)
            {
                CommonDAO.GetInstance().SaveSysMessage(eMessageType.存样柜.ToString(), "智能存样柜样品已超期!", eMessageType.存样柜.ToString());
            }

            output(string.Format("同步数据:(实时数据同步:{0},历史数据同步:{1})", resi, resu), eOutputType.Normal);
            return(returnresult);
        }