Пример #1
0
        /// <summary>
        /// 同步全过程基础信息(轻车计量反馈)
        /// </summary>
        public void SyncBaseInfoForJLPZ(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber)
        {
            int res = 0;

            try
            {
                foreach (View_rlgl_jlgl_pz qgc_pz in commonDAO.SelfDber.Entities <View_rlgl_jlgl_pz>("where issync=0"))
                {
                    if (sqlDapperDber.Insert(new View_rlgl_jlgl_pz_QGC()
                    {
                        Chph = qgc_pz.Chph,
                        Mpph = qgc_pz.Mpph,
                        Mztime = qgc_pz.Mztime,
                        Rfid_xlh = qgc_pz.Rfid_xlh,
                        Pz = qgc_pz.Pz
                    }) > 0)
                    {
                        res++;

                        //更新同步状态
                        qgc_pz.Issync = 1;
                        commonDAO.SelfDber.Update(qgc_pz);
                    }
                }
            }
            catch (Exception ex)
            {
                output("同步轻车计量反馈报错," + ex.Message, eOutputType.Error);
            }

            output(string.Format("同步轻车计量反馈{0}条", res), eOutputType.Normal);
        }
Пример #2
0
        /// <summary>
        /// 同步全过程基础信息(验票反馈表)
        /// </summary>
        public void SyncBaseInfoForYAPFK(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber)
        {
            int res = 0;

            try
            {
                foreach (View_rlgl_chlgl_yapfk qgc_dyjh in commonDAO.SelfDber.Entities <View_rlgl_chlgl_yapfk>("where issync=0"))
                {
                    if (sqlDapperDber.Insert(new View_rlgl_chlgl_yapfk_QGC()
                    {
                        Yptime = qgc_dyjh.Yptime,
                        Chph = qgc_dyjh.Chph,
                        Cyjbm = qgc_dyjh.Cyjbm,
                        Kfl = qgc_dyjh.Kfl,
                        Dybh = qgc_dyjh.Dybh,
                        Rfid_xlh = qgc_dyjh.Rfid_xlh
                    }) > 0)
                    {
                        res++;

                        //更新同步状态
                        qgc_dyjh.IsSync = 1;
                        commonDAO.SelfDber.Update(qgc_dyjh);
                    }
                }
            }
            catch (Exception ex)
            {
                output("同步验票反馈报错," + ex.Message, eOutputType.Error);
            }

            output(string.Format("同步验票反馈{0}条", res), eOutputType.Normal);
        }
Пример #3
0
        private void CmdHandle(EquPDCYJUnloadCmd input)
        {
            Task task = new Task((state) =>
            {
                EquPDCYJUnloadCmd pDCYJUnloadCmd = state as EquPDCYJUnloadCmd;
                OutputRunInfo(rtxtOutput, "处理卸样命令,采样码:" + pDCYJUnloadCmd.SampleCode);

                // 更新系统状态为正在卸样
                dber.Execute("update " + EntityReflectionUtil.GetTableName <EquPDCYJSignal>() + " set TagValue=@TagValue where MachineCode=@MachineCode and TagName=@TagName", new { MachineCode = pDCYJUnloadCmd.MachineCode, TagName = eSignalDataName.设备状态.ToString(), TagValue = eEquInfSamplerSystemStatus.正在卸样.ToString() });
                Thread.Sleep(3000);

                foreach (EquPDCYJBarrel pDCYJBarrel in dber.Entities <EquPDCYJBarrel>("where SampleCode=@SampleCode", new { SampleCode = pDCYJUnloadCmd.SampleCode }))
                {
                    // 生成卸样结果
                    dber.Insert(new EquPDCYJUnloadResult
                    {
                        DataFlag   = 0,
                        SampleCode = pDCYJUnloadCmd.SampleCode,
                        UnloadTime = DateTime.Now,
                        //BarrelNumber = pDCYJBarrel.BarrelNumber,
                        BarrelCode = Guid.NewGuid().ToString().Substring(0, 8).ToUpper(),
                        //SamplingId = pDCYJUnloadCmd.SamplingId,
                        MachineCode = pDCYJBarrel.MachineCode
                    });

                    pDCYJBarrel.SampleCount      = 0;
                    pDCYJBarrel.InFactoryBatchId = string.Empty;
                    pDCYJBarrel.SampleCode       = string.Empty;
                    pDCYJBarrel.BarrelStatus     = eSampleBarrelStatus.空桶.ToString();
                    pDCYJBarrel.UpdateTime       = DateTime.Now;
                    pDCYJBarrel.DataFlag         = 0;

                    if (dber.Update(pDCYJBarrel) > 0)
                    {
                        OutputRunInfo(rtxtOutput, "卸样完成,罐号:" + pDCYJBarrel.BarrelNumber.ToString() + "  " + pDCYJBarrel.BarrelType.ToString());
                    }

                    Thread.Sleep(1500);
                }

                // 更新命令
                pDCYJUnloadCmd.ResultCode = eEquInfCmdResultCode.成功.ToString();
                pDCYJUnloadCmd.DataFlag   = 2;
                dber.Update(pDCYJUnloadCmd);

                OutputRunInfo(rtxtOutput, "卸样完成");

                autoResetEvent.Set();
            }, input);

            task.Start();
        }
Пример #4
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            List <InfBalanceRecordDetail> details = new List <InfBalanceRecordDetail>();

            foreach (GridRow item in superGridControl2.PrimaryGrid.Rows)
            {
                InfBalanceRecordDetail entity = item.DataItem as InfBalanceRecordDetail;
                if (Convert.ToBoolean(item.Cells["clmDetailCheck"].Value))
                {
                    details.Add(entity);
                }
            }
            if (details.Count == 0)
            {
                MessageBoxEx.Show("请选择数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            try
            {
                int res = 0;
                SqlServerDapperDber sqlServerDapper = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("开元天平接口数据连接字符串"));
                foreach (InfBalanceRecordDetail detail in details)
                {
                    TPWeight weight = sqlServerDapper.Entity <TPWeight>("where S_NO=@S_NO and TP_Type=@TP_Type", new { S_NO = detail.TheBalanceRecord.AssayCode + "-" + detail.GGCode, TP_Type = detail.TheBalanceRecord.AssayType });
                    if (weight == null)
                    {
                        weight            = new TPWeight();
                        weight.S_NO       = detail.TheBalanceRecord.AssayCode + "-" + detail.GGCode;
                        weight.TP_Type    = detail.TheBalanceRecord.AssayType;
                        weight.Weight     = detail.Weight;
                        weight.TP_NO      = detail.TheBalanceRecord.MachineCode;
                        weight.Stateop    = 1;
                        weight.SortNumber = detail.GGCode;
                        weight.GG_NO      = detail.GGCode;
                        weight.Sample_NO  = detail.TheBalanceRecord.AssayCode;
                        weight.CreateTime = DateTime.Now;
                        weight.Creator    = detail.CreateUser;
                        sqlServerDapper.Insert(weight);

                        detail.SyncFlag = 1;
                        commonDAO.SelfDber.Update(detail);
                        res++;
                    }
                    else
                    {
                        if (MessageBoxEx.Show("该化验编码重量已提交,是否覆盖!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning) == DialogResult.OK)
                        {
                            weight.S_NO      = detail.TheBalanceRecord.AssayCode + "-" + detail.GGCode;
                            weight.TP_Type   = detail.TheBalanceRecord.AssayType;
                            weight.Weight    = detail.Weight;
                            weight.TP_NO     = detail.TheBalanceRecord.MachineCode;
                            weight.Stateop   = 1;
                            weight.GG_NO     = detail.GGCode;
                            weight.Sample_NO = detail.TheBalanceRecord.AssayCode;
                            sqlServerDapper.Update(weight);
                            res++;
                        }
                    }
                }
                MessageBoxEx.Show("成功提交" + res + "条数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                LoadBalanceDetailList(superGridControl2, this.CurrentAssay.Id);
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show("提交失败:" + Environment.NewLine + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }