Пример #1
0
 /// <summary>
 /// 发送气送命令
 /// </summary>
 public bool SaveQDCmd(string makeCode, CmcsCMEquipment startOpt, CmcsCMEquipment endOpt, out string message)
 {
     try
     {
         InfQDCSCmd entity = new InfQDCSCmd();
         entity.MachineCode = GlobalVars.MachineCode_QD;
         entity.MakeCode    = makeCode;
         entity.OpStart     = startOpt.EquipmentName;
         entity.OpStartIP   = startOpt.EquipmentCode;
         entity.OpEnd       = endOpt.EquipmentName;
         entity.OpEndIP     = endOpt.EquipmentCode;
         entity.ResultCode  = eEquInfCmdResultCode.默认.ToString();
         entity.DataFlag    = 0;
         message            = "气送命令发送成功";
         if (Dbers.GetInstance().SelfDber.Insert <InfQDCSCmd>(entity) > 0)
         {
             return(true);
         }
         message = "气送命令发送失败";
         return(false);
     }
     catch (Exception ex)
     {
         message = "气送命令发送失败" + ex.Message;
         return(false);
     }
 }
Пример #2
0
        /// <summary>
        /// 获取气动传输执行结果
        /// </summary>
        /// <param name="makeCode"></param>
        /// <returns></returns>
        public eEquInfCmdResultCode GetQDCSResult(string makeCode)
        {
            eEquInfCmdResultCode equInfCmdResult = eEquInfCmdResultCode.默认;
            InfQDCSCmd           cmdDetail       = Dbers.GetInstance().SelfDber.Entity <InfQDCSCmd>("where MakeCode=:MakeCode order by createdate desc", new { MakeCode = makeCode });

            if (cmdDetail != null)
            {
                Enum.TryParse(cmdDetail.ResultCode, out equInfCmdResult);
            }
            return(equInfCmdResult);
        }
Пример #3
0
        public int SyncQDCSCmd(Action <string, eOutputType> output)
        {
            int res = 0;

            foreach (InfQDCSCmd item in Dbers.GetInstance().SelfDber.Entities <InfQDCSCmd>("where DataFlag=0 order by CreateDate desc"))
            {
                string       Transno      = DateTime.Now.ToString("yyyyMMdd") + "001";
                Trans_Cmd_Tb cmd_Previous = null;
                do
                {
                    cmd_Previous = this.EquDber.Entity <Trans_Cmd_Tb>(string.Format("where Transno ={0}", Transno));

                    if (cmd_Previous != null)
                    {
                        Transno = DateTime.Now.ToString("yyyyMMdd") + (Convert.ToInt32(cmd_Previous.Transno.Substring(8, 3)) + 1).ToString().PadLeft(3, '0');
                    }
                } while (cmd_Previous != null);

                Trans_Cmd_Tb cmd = new Trans_Cmd_Tb();
                cmd.Transno               = Transno;
                cmd.MachineCode           = 1;
                cmd.TransPriority         = 0;
                cmd.TransPackCode         = DateTime.Now.ToString("yyyyMMdd");
                cmd.SampleId              = item.MakeCode;
                cmd.CommandCode           = 1;//直传
                cmd.CmdOriginStation      = item.OpStartIP;
                cmd.CmdDestinationStation = item.OpEndIP;
                cmd.SendCommandTime       = DateTime.Now;
                cmd.DataStatus            = 0;
                if (this.EquDber.Insert(cmd) > 0)
                {
                    item.DataFlag = 1;
                    Dbers.GetInstance().SelfDber.Update(item);
                    res++;
                }
            }
            output(string.Format("气动传输-同步命令 {0} 条", res), eOutputType.Normal);
            res = 0;
            foreach (Trans_Status_Tb item in this.EquDber.Entities <Trans_Status_Tb>("where SamReady=3"))
            {
                InfQDCSCmd entity = Dbers.GetInstance().SelfDber.Entity <InfQDCSCmd>("where DataFlag=1 and ResultCode='默认' order by CreateDate desc");
                if (entity != null)
                {
                    entity.ResultCode = eEquInfCmdResultCode.成功.ToString();
                    entity.DataFlag   = 3;
                    if (Dbers.GetInstance().SelfDber.Update(entity) > 0)
                    {
                        res++;
                    }
                }
            }
            output(string.Format("气动传输-同步结果 {0} 条", res), eOutputType.Normal);
            return(res);
        }
Пример #4
0
 /// <summary>
 /// 发送气送命令
 /// </summary>
 public bool SaveQDCmd(InfQDCSCmd entity, out string message)
 {
     try
     {
         message = "气送命令发送成功";
         if (Dbers.GetInstance().SelfDber.Insert <InfQDCSCmd>(entity) > 0)
         {
             return(true);
         }
         message = "气送命令发送失败";
         return(false);
     }
     catch (Exception ex)
     {
         message = "气送命令发送失败" + ex.Message;
         return(false);
     }
 }