Exemplo n.º 1
0
        /// <summary>
        /// 发送制样计划,并发送开始制样命令
        /// </summary>
        public bool SaveMakerPlanAndStartCmd(InfMakerPlan entity, out string message)
        {
            try
            {
                message = "制样计划发送成功";
                if (Dbers.GetInstance().SelfDber.Insert <InfMakerPlan>(entity) > 0)
                {
                    InfMakerControlCmd makerControlCmd = new InfMakerControlCmd();
                    makerControlCmd.InterfaceType = CommonDAO.GetInstance().GetMachineInterfaceTypeByCode(entity.MachineCode);
                    makerControlCmd.MachineCode   = entity.MachineCode;
                    makerControlCmd.MakeCode      = entity.MakeCode;
                    makerControlCmd.ResultCode    = eEquInfCmdResultCode.默认.ToString();
                    makerControlCmd.CmdCode       = eEquInfMakerCmd.开始制样.ToString();
                    makerControlCmd.SyncFlag      = 0;
                    Dbers.GetInstance().SelfDber.Insert <InfMakerControlCmd>(makerControlCmd);

                    // 修改入厂煤制样记录的开始制样时间
                    //Dbers.GetInstance().SelfDber.Execute("update " + EntityReflectionUtil.GetTableName<CmcsRCMake>() + " set GetPle='自动接样',GetDate=:DtNow,MakeDate=:DtNow where MakeCode=:MakeCode", new { DtNow = DateTime.Now, MakeCode = entity.MakeCode });

                    return(true);
                }
                message = "制样计划发送失败";
                return(false);
            }
            catch (Exception ex)
            {
                message = "制样计划发送失败" + ex.Message;
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 皮带控制命令表
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public void SyncCmd(Action <string, eOutputType> output)
        {
            int res = 0;

            // 集中管控 > 第三方
            foreach (InfMakerControlCmd entity in AutoMakerDAO.GetInstance().GetWaitForSyncMakerControlCmd(this.MachineCode))
            {
                bool isSuccess = false;

                EquQZDZYJCmd qZDZYJCmd = this.EquDber.Get <EquQZDZYJCmd>(entity.Id);
                if (qZDZYJCmd == null)
                {
                    isSuccess = this.EquDber.Insert(new EquQZDZYJCmd
                    {
                        // 保持相同的Id
                        Id         = entity.Id,
                        CmdCode    = entity.CmdCode,
                        MakeCode   = entity.MakeCode,
                        ResultCode = eEquInfCmdResultCode.默认.ToString(),
                        DataFlag   = 0
                    }) > 0;
                }
                else
                {
                    isSuccess = true;
                }

                if (isSuccess)
                {
                    entity.SyncFlag = 1;
                    commonDAO.SelfDber.Update(entity);

                    res++;
                }
            }
            output(string.Format("同步控制命令 {0} 条(集中管控 > 第三方)", res), eOutputType.Normal);

            res = 0;
            // 第三方 > 集中管控
            foreach (EquQZDZYJCmd entity in this.EquDber.Entities <EquQZDZYJCmd>("where DataFlag=2"))
            {
                InfMakerControlCmd makerControlCmd = commonDAO.SelfDber.Get <InfMakerControlCmd>(entity.Id);
                if (makerControlCmd == null)
                {
                    continue;
                }

                // 更新执行结果等
                makerControlCmd.ResultCode = entity.ResultCode;
                makerControlCmd.DataFlag   = 3;

                if (commonDAO.SelfDber.Update(makerControlCmd) > 0)
                {
                    // 我方已读
                    entity.DataFlag = 3;
                    this.EquDber.Update(entity);

                    res++;
                }
            }
            output(string.Format("同步控制命令 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
        }