Ejemplo n.º 1
0
        /// <summary>
        /// 同步倒料命令
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public void SyncCmd(Action <string, eOutputType> output)
        {
            int res = 0;

            // 集中管控 > 第三方
            foreach (InfPackingBatchCmd entity in PackingBatchDAO.GetInstance().GetWaitForSyncJXCYPackingBatchCmd())
            {
                bool isSuccess = false;

                isSuccess = this.EquDber.Insert(new HYGP_Cmd_Tb
                {
                    Command    = 1,
                    SampleCode = entity.SampleCode,
                    DateTime   = DateTime.Now,
                    DataStatus = 0
                }) > 0;

                if (isSuccess)
                {
                    entity.SyncFlag = 1;
                    commonDAO.SelfDber.Update(entity);
                    res++;
                }
            }
            output(string.Format("同步控制命令 {0} 条(集中管控 > 第三方)", res), eOutputType.Normal);


            res = 0;
            // 第三方 > 集中管控
            foreach (HYGP_Cmd_Tb entity in this.EquDber.Entities <HYGP_Cmd_Tb>("where DataStatus=11 or DataStatus=12"))
            {
                InfPackingBatchCmd makerControlCmd = commonDAO.SelfDber.Entity <InfPackingBatchCmd>("where SampleCode=:SampleCode and DataFlag=0 order by CreateDate desc", new { SampleCode = entity.SampleCode });
                if (makerControlCmd == null)
                {
                    continue;
                }

                // 更新执行结果等
                makerControlCmd.ResultCode = ((eDataStatus)entity.DataStatus).ToString();
                makerControlCmd.DataFlag   = 3;
                if (commonDAO.SelfDber.Update(makerControlCmd) > 0)
                {
                    res++;
                }
            }
            output(string.Format("同步控制命令 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 同步样桶信息
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public void SyncCoord(Action <string, eOutputType> output)
        {
            int res = 0;

            // 集中管控 > 第三方
            foreach (Coord_TB entity in this.EquDber.Entities <Coord_TB>(""))
            {
                bool isSuccess = false;
                InfPackingBatchCoord batchcoord = new InfPackingBatchCoord();
                batchcoord.MachineCode = this.MachineCode;
                batchcoord.SampleCode  = entity.SampleCode;
                batchcoord.State       = entity.State;
                batchcoord.UpdateTime  = entity.DateTime;
                batchcoord.Coord       = entity.Coord;
                isSuccess = PackingBatchDAO.GetInstance().SaveCoord(batchcoord);
                if (isSuccess)
                {
                    res++;
                }
            }
            output(string.Format("同步样桶信息 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
        }