Example #1
0
        /// <summary>
        /// 打印编码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnPrintCode_Click(object sender, EventArgs e)
        {
            GridButtonXEditControl btn = sender as GridButtonXEditControl;

            if (btn == null)
            {
                return;
            }

            CmcsRCSampleBarrel sampleBarrel = btn.EditorCell.GridRow.DataItem as CmcsRCSampleBarrel;

            if (sampleBarrel == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(sampleBarrel.SampSecondCode))
            {
                if (sampleBarrel.PrintCount > 0)
                {
                    if (MessageBoxEx.Show("该采样桶已打印,是否再次打印?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                    {
                        return;
                    }
                }
                sampleBarrel.PrintCount++;
                sampleBarrel.PrintDate = DateTime.Now;
                sampleBarrel.PrintUser = SelfVars.LoginUser.UserName;
                commonDAO.SelfDber.Update(sampleBarrel);
                commonDAO.SaveAppletLog(eAppletLogLevel.Info, "打印采样桶明细", string.Format("采样次码:{0};采样主码:{1};操作人:{2};", sampleBarrel.SampSecondCode, sampleBarrel.SampleCode, SelfVars.LoginUser.UserName));
                _CodePrinter.Print(sampleBarrel.SampleCode);
                _CodePrinter.Print(sampleBarrel.SampSecondCode);
            }
        }
Example #2
0
        /// <summary>
        /// 发送制样计划
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSendMakeCmd_Click(object sender, EventArgs e)
        {
            CmcsBeltSampleUnloadCmd entity = null;

            foreach (GridRow gridRow in superGridControl3.PrimaryGrid.Rows)
            {
                if (gridRow.Checked)
                {
                    entity = gridRow.DataItem as CmcsBeltSampleUnloadCmd;
                }
            }
            if (entity == null)
            {
                MessageBoxEx.Show("请先选择卸样记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            CmcsRCSampleBarrel RCSampleBarrel = CommonDAO.GetInstance().GetDber().Entity <CmcsRCSampleBarrel>(" where BarrelCode='" + entity.SampleCode + "'");

            if (RCSampleBarrel == null)
            {
                MessageBoxEx.Show("未找到采样单明细记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            SendMakePlan(RCSampleBarrel.SamplingId, RCSampleBarrel.InFactoryBatchId);
        }
Example #3
0
        /// <summary>
        /// 发送制样计划
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSendMakeCmd_Click(object sender, EventArgs e)
        {
            InfBeltSampleUnloadCmd beltSampleUnloadCmd = null;

            foreach (GridRow gridRow in superGridControl3.PrimaryGrid.Rows)
            {
                if (gridRow.Checked)
                {
                    beltSampleUnloadCmd = gridRow.DataItem as InfBeltSampleUnloadCmd;
                }
            }
            if (beltSampleUnloadCmd == null)
            {
                MessageBoxEx.Show("请选择卸样记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            CmcsRCSampleBarrel rCSampleBarrel = commonDAO.SelfDber.Entity <CmcsRCSampleBarrel>(" where SampleCode='" + beltSampleUnloadCmd.SampleCode + "'");

            if (rCSampleBarrel == null)
            {
                MessageBoxEx.Show("未找到采样单明细记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (MessageBoxEx.Show("确定要发送制样命令?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
            {
                SendMakePlan(rCSampleBarrel.SampleCode, rCSampleBarrel.InFactoryBatchId);
            }
        }
 /// <summary>
 /// 重置
 /// </summary>
 private void Restet()
 {
     this.CurrentBarrelCode      = string.Empty;
     this.CurrentSampleInfo      = null;
     this.CurrenSampleBarrel     = null;
     this.CurrentRCSampleBarrels = new List <CmcsRCSampleBarrel>();
 }
Example #5
0
        /// <summary>
        /// 同步历史卸样结果
        /// </summary>
        /// <param name="output"></param>
        /// <param name="MachineCode"></param>
        public void SyncUnloadResult(Action <string, eOutputType> output)
        {
            int res = 0;

            res = 0;
            // 第三方 > 集中管控
            foreach (EquQCJXCYJUnloadResult entity in this.EquDber.Entities <EquQCJXCYJUnloadResult>("where DataFlag=0"))
            {
                InfQCJXCYJUnloadResult oldUnloadResult = commonDAO.SelfDber.Get <InfQCJXCYJUnloadResult>(entity.Id);
                if (oldUnloadResult == null)
                {
                    // 查找采样命令
                    EquQCJXCYJSampleCmd qCJXCYJSampleCmd = this.EquDber.Entity <EquQCJXCYJSampleCmd>("where SampleCode=@SampleCode", new { SampleCode = entity.SampleCode });
                    if (qCJXCYJSampleCmd != null)
                    {
                        CmcsRCSampling sampling = commonDAO.SelfDber.Entity <CmcsRCSampling>("where SampleCode=:SampleCode", new { SampleCode = entity.SampleCode });
                        //生成采样桶记录
                        CmcsRCSampleBarrel rCSampleBarrel = new CmcsRCSampleBarrel()
                        {
                            BarrelCode       = entity.BarrelCode,
                            BarrellingTime   = entity.UnloadTime,
                            BarrelNumber     = entity.BarrelCode,
                            InFactoryBatchId = qCJXCYJSampleCmd.InFactoryBatchId,
                            SamplerName      = this.MachineCode,
                            SampleType       = eSamplingType.机械采样.ToString(),
                            SamplingId       = sampling != null ? sampling.Id : entity.SamplingId,
                            SampleWeight     = entity.SampleWeigh
                        };

                        if (commonDAO.SelfDber.Insert(rCSampleBarrel) > 0)
                        {
                            if (commonDAO.SelfDber.Insert(new InfQCJXCYJUnloadResult
                            {
                                SampleCode = entity.SampleCode,
                                BarrelCode = entity.BarrelCode,
                                UnloadTime = entity.UnloadTime,
                                DataFlag = entity.DataFlag
                            }) > 0)
                            {
                                CmcsCYJCodeInfo codeInfo = commonDAO.SelfDber.Entity <CmcsCYJCodeInfo>("where SampleCode=:SampleCode and BarrelCode=:BarrelCode and SamplerName=:SamplerName and IsClear=0", new { SampleCode = entity.SampleCode, BarrelCode = entity.BarrelCode, SamplerName = this.MachineCode });
                                if (codeInfo != null)
                                {
                                    codeInfo.ClearTime = entity.UnloadTime;
                                    codeInfo.IsClear   = 1;
                                    commonDAO.SelfDber.Update(codeInfo);
                                }
                                entity.DataFlag = 1;
                                this.EquDber.Update(entity);

                                res++;
                            }
                        }
                    }
                }
            }
            output(string.Format("{0}-同步卸样结果 {0} 条(第三方 > 集中管控)", this.MachineCode, res), eOutputType.Normal);
        }
 /// <summary>
 /// 重置
 /// </summary>
 private void Restet()
 {
     txtInputSampleCode.ResetText();
     this.CurrentBarrelCode      = string.Empty;
     this.CurrentSampleInfo      = null;
     this.CurrenSampleBarrel     = null;
     this.CurrentRCSampleBarrels = new List <CmcsRCSampleBarrel>();
     this.CurrentFlowFlag        = eFlowFlag.择采样单;
 }
        /// <summary>
        /// 发送制样计划
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSendMakeCmd_Click(object sender, EventArgs e)
        {
            String tempSampleCode = String.Empty;

            if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(this.CurrentSampler.Parentid).EquipmentCode == "皮带采样机")
            {
                InfBeltSampleUnloadCmd beltSampleUnloadCmd = null;
                foreach (GridRow gridRow in superGridControl3.PrimaryGrid.Rows)
                {
                    if (gridRow.Checked)
                    {
                        beltSampleUnloadCmd = gridRow.DataItem as InfBeltSampleUnloadCmd;
                    }
                }
                if (beltSampleUnloadCmd == null)
                {
                    MessageBoxEx.Show("请选择卸样记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                tempSampleCode = beltSampleUnloadCmd.SampleCode;
            }
            else if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(this.CurrentSampler.Parentid).EquipmentCode == "汽车机械采样机")
            {
                InfQCJXCYUnLoadCMD qcjxcyUnLoadCMD = null;
                foreach (GridRow gridRow in superGridControl3.PrimaryGrid.Rows)
                {
                    if (gridRow.Checked)
                    {
                        qcjxcyUnLoadCMD = gridRow.DataItem as InfQCJXCYUnLoadCMD;
                    }
                }
                if (qcjxcyUnLoadCMD == null)
                {
                    MessageBoxEx.Show("请选择卸样记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                tempSampleCode = qcjxcyUnLoadCMD.SampleCode;
            }
            else
            {
                rTxtOutputer.Output("无此编码类型,请查证\"皮带采样机\"和\"汽车机械采样机\"类型!", eOutputType.Error);
                return;
            }

            CmcsRCSampleBarrel rCSampleBarrel = commonDAO.SelfDber.Entity <CmcsRCSampleBarrel>(" where BarrelCode='" + tempSampleCode + "' and IsDeleted=0");

            if (rCSampleBarrel == null)
            {
                MessageBoxEx.Show("未找到采样单明细记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (MessageBoxEx.Show("确定要发送制样命令?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
            {
                SendMakePlan(rCSampleBarrel.SamplingId, rCSampleBarrel.InFactoryBatchId);
            }
        }
Example #8
0
        /// <summary>
        /// 查找样桶登记记录
        /// </summary>
        /// <param name="BarrelCode">样桶编码</param>
        public CmcsRCSampleBarrel GetRCSampleBarrel(string BarrelCode, out string message)
        {
            message = string.Empty;
            CmcsRCSampleBarrel entity = Dbers.GetInstance().SelfDber.Entity <CmcsRCSampleBarrel>(" where SampSecondCode='" + BarrelCode + "' and IsDeleted=0 order by BarrellingTime desc");

            if (entity == null)
            {
                message = "未找到编码【" + BarrelCode + "】的样桶登记记录";
            }
            return(entity);
        }
Example #9
0
        /// <summary>
        /// 查找样桶登记记录
        /// </summary>
        /// <param name="BarrelCode">样桶编码</param>
        public CmcsRCSampleBarrel GetRCSampleBarrel(string BarrelCode, out string message)
        {
            message = string.Empty;
            CmcsRCSampleBarrel entity = Dbers.GetInstance().SelfDber.Entity <CmcsRCSampleBarrel>(string.Format(" where (SampseCondCode='{0}' or SampleCode='{0}') order by BarrellingTime desc", BarrelCode));

            if (entity == null)
            {
                message = "未找到编码【" + BarrelCode + "】的样桶登记记录";
            }
            return(entity);
        }
Example #10
0
        /// <summary>
        /// 查找同一采样单的样桶登记记录
        /// </summary>
        /// <param name="BarrelCode"></param>
        /// <returns></returns>
        public List <CmcsRCSampleBarrel> GetRCSampleBarrels(string BarrelCode, out string message)
        {
            message = string.Empty;
            List <CmcsRCSampleBarrel> list   = new List <CmcsRCSampleBarrel>();
            CmcsRCSampleBarrel        entity = GetRCSampleBarrel(BarrelCode, out message);

            if (entity != null)
            {
                list    = Dbers.GetInstance().SelfDber.Entities <CmcsRCSampleBarrel>(" where SamplingId='" + entity.SamplingId + "' and IsDeleted=0");
                message = "扫码成功,该批次采样桶共" + list.Count + "桶";
            }
            return(list);
        }
Example #11
0
        /// <summary>
        /// 同步历史卸样结果
        /// </summary>
        /// <param name="output"></param>
        /// <param name="MachineCode"></param>
        public void SyncUnloadResult(Action <string, eOutputType> output)
        {
            int res = 0;

            res = 0;
            // 第三方 > 集中管控
            foreach (EquQCJXCYJUnloadResult entity in this.EquDber.Entities <EquQCJXCYJUnloadResult>("where DataFlag=0"))
            {
                InfQCJXCYJUnloadResult oldUnloadResult = commonDAO.SelfDber.Get <InfQCJXCYJUnloadResult>(entity.Id);
                if (oldUnloadResult == null)
                {
                    // 查找采样命令
                    EquQCJXCYJSampleCmd qCJXCYJSampleCmd = this.EquDber.Entity <EquQCJXCYJSampleCmd>("where SampleCode=@SampleCode", new { SampleCode = entity.SampleCode });
                    if (qCJXCYJSampleCmd != null)
                    {
                        CmcsRCSampling sample = commonDAO.SelfDber.Entity <CmcsRCSampling>("where SamplingType='机械采样' and InFactoryBatchId=:InFactoryBatchId order by CreateDate desc", new { InFactoryBatchId = qCJXCYJSampleCmd.InFactoryBatchId });
                        // 生成采样桶记录
                        CmcsRCSampleBarrel rCSampleBarrel = new CmcsRCSampleBarrel()
                        {
                            BarrelCode       = entity.BarrelCode,
                            BarrellingTime   = entity.UnloadTime,
                            BarrelNumber     = entity.BarrelNumber,
                            InFactoryBatchId = qCJXCYJSampleCmd.InFactoryBatchId,
                            SamplerName      = this.MachineCode,
                            SampleType       = eSamplingType.机械采样.ToString(),
                            SamplingId       = sample != null ? sample.Id : "",
                            SampSecondCode   = entity.BarrelCode
                        };

                        if (commonDAO.SelfDber.Insert(rCSampleBarrel) > 0)
                        {
                            if (commonDAO.SelfDber.Insert(new InfQCJXCYJUnloadResult
                            {
                                SampleCode = entity.SampleCode,
                                BarrelCode = entity.BarrelCode,
                                UnloadTime = entity.UnloadTime,
                                SamplingId = sample != null ? sample.Id : "",
                                DataFlag = entity.DataFlag
                            }) > 0)
                            {
                                entity.DataFlag = 1;
                                this.EquDber.Update(entity);

                                res++;
                            }
                        }
                    }
                }
            }
            output(string.Format("{0}同步卸样结果 {1} 条(第三方 > 集中管控)", this.MachineCode, res), eOutputType.Normal);
        }
Example #12
0
        /// <summary>
        /// 同步卸样结果,根据卸样信息生成集控采样桶记录
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public void SyncUnloadResult(Action <string, eOutputType> output)
        {
            int res = 0;

            foreach (EquPDCYJUnloadResult pDCYJUnloadResult in this.EquDber.Entities <EquPDCYJUnloadResult>("where DataFlag=0"))
            {
                InfBeltSamplerUnloadResult oldUnloadResult = commonDAO.SelfDber.Get <InfBeltSamplerUnloadResult>(pDCYJUnloadResult.Id);
                if (oldUnloadResult == null)
                {
                    // 查找采样计划
                    EquPDCYJPlan pDCYJPlan = this.EquDber.Entity <EquPDCYJPlan>("where SampleCode=@SampleCode", new { SampleCode = pDCYJUnloadResult.SampleCode });
                    if (pDCYJPlan != null)
                    {
                        // 生成采样桶记录
                        CmcsRCSampleBarrel rCSampleBarrel = new CmcsRCSampleBarrel()
                        {
                            SampleCode       = pDCYJUnloadResult.SampleCode,
                            BarrelCode       = pDCYJUnloadResult.BarrelCode,
                            BarrellingTime   = pDCYJUnloadResult.UnloadTime,
                            InFactoryBatchId = pDCYJPlan.InFactoryBatchId,
                            SampleMachine    = commonDAO.GetMachineNameByCode(ConvertToCmcsMachineCode(pDCYJUnloadResult.MachineCode)),
                            SampleType       = eSamplingType.皮带采样.ToString(),
                            SamplingId       = pDCYJUnloadResult.SamplingId
                        };

                        if (commonDAO.SelfDber.Insert(rCSampleBarrel) > 0)
                        {
                            // 同步卸样结果
                            if (commonDAO.SelfDber.Insert(new InfBeltSamplerUnloadResult
                            {
                                MachineCode = ConvertToCmcsMachineCode(pDCYJUnloadResult.MachineCode),
                                SampleCode = pDCYJUnloadResult.SampleCode,
                                DataFlag = pDCYJUnloadResult.DataFlag,
                                BarrelCode = pDCYJUnloadResult.BarrelCode,
                                UnloadTime = pDCYJUnloadResult.UnloadTime,
                                SamplingId = pDCYJUnloadResult.SamplingId
                            }) > 0)
                            {
                                pDCYJUnloadResult.DataFlag = 1;
                                this.EquDber.Update(pDCYJUnloadResult);

                                res++;
                            }
                        }
                    }
                }
            }

            output(string.Format("同步卸样结果 {0} 条", res), eOutputType.Normal);
        }
Example #13
0
        /// <summary>
        /// 同步历史卸样结果
        /// </summary>
        /// <param name="output"></param>
        /// <param name="MachineCode"></param>
        public void SyncUnloadResult(Action <string, eOutputType> output)
        {
            int res = 0;

            res = 0;
            // 第三方 > 集中管控
            foreach (EquHCQSCYJUnloadResult entity in this.EquDber.Entities <EquHCQSCYJUnloadResult>("where DataFlag=0"))
            {
                InfBeltSamplerUnloadResult oldUnloadResult = commonDAO.SelfDber.Get <InfBeltSamplerUnloadResult>(entity.Id);
                if (oldUnloadResult == null)
                {
                    // 查找采样命令
                    EquHCQSCYJPlan qCJXCYJSampleCmd = this.EquDber.Entity <EquHCQSCYJPlan>("where SampleCode=@SampleCode", new { SampleCode = entity.SampleCode });
                    if (qCJXCYJSampleCmd != null)
                    {
                        // 生成采样桶记录
                        CmcsRCSampleBarrel rCSampleBarrel = new CmcsRCSampleBarrel()
                        {
                            //BarrelCode = entity.BarrelCode,
                            //BarrellingTime = entity.UnloadTime,
                            //BarrelNumber = entity.BarrelNumber,
                            //InFactoryBatchId = qCJXCYJSampleCmd.InFactoryBatchId,
                            //SamplerName = this.MachineCode,
                            //SampleType = eSamplingType.机械采样.ToString(),
                            //SamplingId = entity.SamplingId
                        };

                        if (commonDAO.SelfDber.Insert(rCSampleBarrel) > 0)
                        {
                            //if (commonDAO.SelfDber.Insert(new InfQCJXCYJUnloadResult
                            //{
                            //	MachineCode = this.MachineCode,
                            //	SampleCode = entity.SampleCode,
                            //	BarrelCode = entity.BarrelCode,
                            //	UnloadTime = entity.UnloadTime,
                            //	DataFlag = entity.DataFlag
                            //}) > 0)
                            {
                                entity.DataFlag = 1;
                                this.EquDber.Update(entity);

                                res++;
                            }
                        }
                    }
                }
            }
            output(string.Format("同步卸样结果 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
        }
Example #14
0
 private void superGridControl1_DataBindingComplete(object sender, GridDataBindingCompleteEventArgs e)
 {
     foreach (GridRow grid in e.GridPanel.Rows)
     {
         CmcsRCSampleBarrel entity = grid.DataItem as CmcsRCSampleBarrel;
         if (entity == null)
         {
             return;
         }
         if (entity.PrintCount > 0)
         {
             grid.CellStyles.Default.TextColor = Color.Green;
         }
     }
 }
        /// <summary>
        /// 同步历史卸样结果
        /// </summary>
        /// <param name="output"></param>
        /// <param name="MachineCode"></param>
        public void SyncUnloadResult(Action <string, eOutputType> output)
        {
            int res = 0;

            res = 0;
            // 第三方 > 集中管控
            foreach (EquQCJXCYJUnloadResult entity in DcDbers.GetInstance().CarJXSampler_Dber.Entities <EquQCJXCYJUnloadResult>("where DataFlag=0"))
            {
                InfQCJXCYJUnloadResult oldUnloadResult = commonDAO.SelfDber.Get <InfQCJXCYJUnloadResult>(entity.Id);
                if (oldUnloadResult == null)
                {
                    // 查找采样命令
                    EquQCJXCYJSampleCmd qCJXCYJSampleCmd = DcDbers.GetInstance().CarJXSampler_Dber.Entity <EquQCJXCYJSampleCmd>("where SampleCode=:SampleCode", new { SampleCode = entity.SampleCode });
                    if (qCJXCYJSampleCmd != null)
                    {
                        // 生成采样桶记录
                        CmcsRCSampleBarrel rCSampleBarrel = new CmcsRCSampleBarrel()
                        {
                            BarrelCode       = entity.BarrelCode,
                            BarrellingTime   = entity.UnloadTime,
                            BarrelNumber     = entity.BarrelNumber,
                            InFactoryBatchId = qCJXCYJSampleCmd.InFactoryBatchId,
                            SamplerName      = commonDAO.GetMachineNameByCode(this.MachineCode),
                            SampleType       = eSamplingType.机械采样.ToString(),
                            SamplingId       = entity.SamplingId
                        };

                        if (commonDAO.SelfDber.Insert(rCSampleBarrel) > 0)
                        {
                            if (commonDAO.SelfDber.Insert(new InfQCJXCYJUnloadResult
                            {
                                SampleCode = entity.SampleCode,
                                BarrelCode = entity.BarrelCode,
                                UnloadTime = entity.UnloadTime,
                                DataFlag = entity.DataFlag
                            }) > 0)
                            {
                                entity.DataFlag = 1;
                                DcDbers.GetInstance().CarJXSampler_Dber.Update(entity);

                                res++;
                            }
                        }
                    }
                }
            }
            output(string.Format("同步卸样结果 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
        }
Example #16
0
        /// <summary>
        /// 新增采样明细
        /// </summary>
        /// <param name="sampleId"></param>
        /// <returns></returns>
        public bool SaveSampleDetail(string sampleId, decimal weight)
        {
            CmcsRCSampling sample = Dbers.GetInstance().SelfDber.Get <CmcsRCSampling>(sampleId);

            if (sample != null)
            {
                CmcsRCSampleBarrel sampleBarrel = new CmcsRCSampleBarrel();
                sampleBarrel.SamplingId     = sampleId;
                sampleBarrel.BarrellingTime = DateTime.Now;
                sampleBarrel.SampSecondCode = CommonDAO.GetInstance().CreateSampleDetailCode(sample.SampleCode);
                sampleBarrel.BarrelWeight   = (double)weight;
                sampleBarrel.SampleCode     = sample.SampleCode;
                sampleBarrel.SampleType     = "人工采样";
                sampleBarrel.SampleMachine  = "人工";
                return(Dbers.GetInstance().SelfDber.Insert(sampleBarrel) > 0);
            }
            return(false);
        }
        /// <summary>
        /// 打印编码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnPrintCode_Click(object sender, EventArgs e)
        {
            GridButtonXEditControl btn = sender as GridButtonXEditControl;

            if (btn == null)
            {
                return;
            }

            CmcsRCSampleBarrel sampleBarrel = btn.EditorCell.GridRow.DataItem as CmcsRCSampleBarrel;

            if (sampleBarrel == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(sampleBarrel.SampseCondCode))
            {
                _CodePrinter.Print(sampleBarrel.SampleCode);
                _CodePrinter.Print(sampleBarrel.SampseCondCode);
            }
        }
        /// <summary>
        /// 打印编码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnPrintCode_Click(object sender, EventArgs e)
        {
            GridButtonXEditControl btn = sender as GridButtonXEditControl;

            if (btn == null)
            {
                return;
            }

            CmcsRCSampleBarrel sampleBarrel = btn.EditorCell.GridRow.DataItem as CmcsRCSampleBarrel;

            if (sampleBarrel == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(sampleBarrel.SampSecondCode))
            {
                commonDAO.SelfDber.Update(sampleBarrel);
                commonDAO.SaveAppletLog(eAppletLogLevel.Info, "打印采样桶明细", string.Format("采样子码:{0};操作人:{1};", sampleBarrel.SampSecondCode, SelfVars.LoginUser.UserName), SelfVars.LoginUser.UserName);
                _CodePrinter.Print(sampleBarrel.SampSecondCode);
            }
        }
        /// <summary>
        /// 删除明细
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnDel_Click(object sender, EventArgs e)
        {
            GridButtonXEditControl btn = sender as GridButtonXEditControl;

            if (btn == null)
            {
                return;
            }

            CmcsRCSampleBarrel sampleBarrel = btn.EditorCell.GridRow.DataItem as CmcsRCSampleBarrel;

            if (sampleBarrel == null)
            {
                return;
            }
            if (MessageBoxEx.Show("确定删除该采样桶?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                if (Dbers.GetInstance().SelfDber.Delete <CmcsRCSampleBarrel>(sampleBarrel.Id) > 0)
                {
                    LoadSampleDetail();
                }
            }
        }
Example #20
0
        /// <summary>
        /// 删除明细
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnDel_Click(object sender, EventArgs e)
        {
            GridButtonXEditControl btn = sender as GridButtonXEditControl;

            if (btn == null)
            {
                return;
            }

            CmcsRCSampleBarrel sampleBarrel = btn.EditorCell.GridRow.DataItem as CmcsRCSampleBarrel;

            if (sampleBarrel == null)
            {
                return;
            }
            if (MessageBoxEx.Show("确定删除该采样桶?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                commonDAO.SaveAppletLog(eAppletLogLevel.Warn, "删除采样桶明细", string.Format("采样次码:{0};采样主码:{1};操作人:{2};", sampleBarrel.SampSecondCode, sampleBarrel.SampleCode, SelfVars.LoginUser.UserName));
                if (Dbers.GetInstance().SelfDber.Delete <CmcsRCSampleBarrel>(sampleBarrel.Id) > 0)
                {
                    LoadSampleDetail();
                }
            }
        }
Example #21
0
        /// <summary>
        /// 发送制样计划
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSendMakeCmd_Click(object sender, EventArgs e)
        {
            String tempSampleID = String.Empty;

            if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(this.currentSampler.Parentid).EquipmentCode == "皮带采样机")
            {
                InfBeltSampleUnloadCmd beltSampleUnloadCmd = null;
                foreach (GridRow gridRow in superGridControl3.PrimaryGrid.Rows)
                {
                    if (gridRow.Checked)
                    {
                        beltSampleUnloadCmd = gridRow.DataItem as InfBeltSampleUnloadCmd;
                    }
                }
                if (beltSampleUnloadCmd == null)
                {
                    MessageBoxEx.Show("请选择卸样记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                tempSampleID = beltSampleUnloadCmd.SamplingId;
            }
            else if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(this.currentSampler.Parentid).EquipmentCode == "汽车机械采样机")
            {
                InfQCJXCYUnLoadCMD qcjxcyUnLoadCMD = null;
                foreach (GridRow gridRow in superGridControl3.PrimaryGrid.Rows)
                {
                    if (gridRow.Checked)
                    {
                        qcjxcyUnLoadCMD = gridRow.DataItem as InfQCJXCYUnLoadCMD;
                    }
                }
                if (qcjxcyUnLoadCMD == null)
                {
                    MessageBoxEx.Show("请选择卸样记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                tempSampleID = qcjxcyUnLoadCMD.SamplingId;
            }

            CmcsRCSampleBarrel rCSampleBarrel = commonDAO.SelfDber.Entity <CmcsRCSampleBarrel>(" where SamplingId='" + tempSampleID + "' order by CreateDate desc");

            if (rCSampleBarrel == null)
            {
                MessageBoxEx.Show("未找到采样单明细记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string str = getStr(tempSampleID);            //根据采样ID查询该采样ID所在的批次是否还有未卸样的记录

            str = str == string.Empty ? "确定要发送制样命令" : str + "还有同批次的煤样未卸载,确定要发送制样命令?";
            if (MessageBoxEx.Show(str, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
            {
                string systemStatus = commonDAO.GetSignalDataValue(this.CurrentmakerMachineCode, eSignalDataName.系统.ToString());
                if (systemStatus == "就绪待机")
                {
                    SendMakePlan(tempSampleID);
                }
                else
                {
                    MessageBoxEx.Show("制样机系统未就绪,禁止发送制样命令", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
        }
        /// <summary>
        /// 键入Enter检测有效性
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtInputSampleCode_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (this.CurrentFlowFlag != eFlowFlag.等待扫码)
                {
                    return;
                }

                string barrelCode = txtInputSampleCode.Text.Trim().ToUpper();
                if (String.IsNullOrWhiteSpace(barrelCode))
                {
                    return;
                }

                //  根据采样桶编码查找该采样单下所有采样桶记录
                if (this.brotherRCSampleBarrels.Count == 0)
                {
                    this.brotherRCSampleBarrels = czyHandlerDAO.GetRCSampleBarrels(barrelCode, out resMessage);
                    if (this.brotherRCSampleBarrels.Count == 0)
                    {
                        ShowMessage(resMessage, eOutputType.Error);
                        txtInputSampleCode.ResetText();
                        return;
                    }
                    ShowMessage(resMessage, eOutputType.Normal);
                    CreateButtonX(this.brotherRCSampleBarrels.Count);
                    ShowButton(this.brotherRCSampleBarrels.Count, "Sum");
                }

                // 采样桶编码属于同一采样单下则验证通过,直到全部验证完毕
                this.rCSampleBarrel = this.brotherRCSampleBarrels.Where(a => a.SampSecondCode == barrelCode).FirstOrDefault();
                if (this.rCSampleBarrel != null)
                {
                    if (!this.IsScanedRCSampleBarrelId.Contains(this.rCSampleBarrel.Id))
                    {
                        this.IsScanedRCSampleBarrelId.Add(this.rCSampleBarrel.Id);

                        //ShowButton(this.IsScanedRCSampleBarrelId.Count, "Already");
                        ShowButton(this.IsScanedRCSampleBarrelId.Count, "Already", Convert.ToInt32(this.rCSampleBarrel.SampSecondCode.Substring(14, 2)));

                        if (this.IsScanedRCSampleBarrelId.Count < this.brotherRCSampleBarrels.Count)
                        {
                            ShowMessage("样桶编码:" + barrelCode + ",还剩" + (this.brotherRCSampleBarrels.Count - this.IsScanedRCSampleBarrelId.Count) + "桶未交样,请扫下个样桶", eOutputType.Normal);
                        }
                        else
                        {
                            foreach (CmcsRCSampleBarrel item in this.brotherRCSampleBarrels)
                            {
                                CmcsSampleBarrel entity = commonDAO.SelfDber.Entity <CmcsSampleBarrel>(" where BarrelCode='" + item.BarrelCode + "' ");
                                if (entity != null)
                                {
                                    entity.IsUse = 0;
                                    Dbers.GetInstance().SelfDber.Update(entity);
                                }
                            }
                            czyHandlerDAO.SaveHandSamplingSend(this.brotherRCSampleBarrels[0].SamplingId, SelfVars.LoginUser.UserName, DateTime.Now);
                            ShowMessage("样桶编码:" + barrelCode + ",该批次样桶已全部交样成功", eOutputType.Normal);
                        }
                        this.CurrentFlowFlag = eFlowFlag.等待校验;
                    }
                    else
                    {
                        txtInputSampleCode.ResetText();
                        ShowMessage("样桶编码:" + barrelCode + " 已校验,请扫下个样桶", eOutputType.Error);
                    }
                }
                else
                {
                    txtInputSampleCode.ResetText();
                    ShowMessage("样桶编码:" + barrelCode + " 交样失败,请扫下个样桶", eOutputType.Error);
                }
            }
        }
Example #23
0
        /// <summary>
        /// 同步卸样操作结果
        /// </summary>
        /// <param name="output"></param>
        public void SyncResult(Action <string, eOutputType> output)
        {
            int res = 0, res2 = 0;

            // 第三方 > 集中管控 卸样结果
            foreach (InfQCJXCYUnLoadCMD item in Dbers.GetInstance().SelfDber.Entities <InfQCJXCYUnLoadCMD>("where MachineCode=:MachineCode and DataFlag=0", new { MachineCode = this.MachineCode }))
            {
                if (item.UnLoadType == "到制样机")
                {
                    IList <KY_CYJ_BarrelStatus> barrelstatus = this.EquDber.Entities <KY_CYJ_BarrelStatus>("where CY_Code=@CY_Code order by Barrel_Code", new { CY_Code = item.SampleCode });
                    IList <KY_CYJ_Down>         downlist     = new List <KY_CYJ_Down>();
                    foreach (KY_CYJ_BarrelStatus barrel in barrelstatus)
                    {
                        KY_CYJ_Down down = this.EquDber.Entity <KY_CYJ_Down>("where Barrel_Code=@Barrel_Code and XL_Finish=1", new { Barrel_Code = barrel.Barrel_Code });
                        if (down != null)
                        {
                            downlist.Add(down);
                        }
                    }
                    if (downlist.Count == barrelstatus.Count)
                    {
                        foreach (KY_CYJ_Down entity in downlist)
                        {
                            //历史卸样结果
                            InfQCJXCYJUnloadResult oldUnloadResult = commonDAO.SelfDber.Entity <InfQCJXCYJUnloadResult>("where SampleCode=:SampleCode and BarrelCode=:BarrelCode and UnLoadType=:UnLoadType and DataFlag=0", new { SampleCode = item.SampleCode, UnLoadType = item.UnLoadType, BarrelCode = entity.Barrel_Code });
                            if (oldUnloadResult == null)
                            {
                                // 生成采样桶记录
                                CmcsRCSampleBarrel rCSampleBarrel = new CmcsRCSampleBarrel();

                                rCSampleBarrel.BarrelCode       = item.SampleCode;
                                rCSampleBarrel.BarrellingTime   = entity.LastDateTime;
                                rCSampleBarrel.SampleCode       = item.SampleCode;
                                rCSampleBarrel.SampleMachine    = this.MachineCode.Contains("#1") ? "#1汽车机械采样机" : "#2汽车机械采样机";
                                rCSampleBarrel.SampleType       = eSamplingType.机械采样.ToString();
                                rCSampleBarrel.SampSecondCode   = commonDAO.CreateSampleDetailCode(rCSampleBarrel.SampleCode);
                                rCSampleBarrel.SamplingId       = commonDAO.GetSamplingIdBySamplingCode(item.SampleCode);
                                rCSampleBarrel.InFactoryBatchId = commonDAO.GetBatchIdByRCSamplingId(rCSampleBarrel.SamplingId);

                                if (commonDAO.SelfDber.Insert(rCSampleBarrel) > 0)
                                {
                                    if (commonDAO.SelfDber.Insert(new InfQCJXCYJUnloadResult
                                    {
                                        SampleCode = item.SampleCode,
                                        BarrelCode = entity.Barrel_Code,
                                        UnloadTime = entity.LastDateTime,
                                        UnLoadType = item.UnLoadType,
                                        DataFlag = 0
                                    }) > 0)
                                    {
                                        res++;
                                    }
                                }
                            }
                        }
                        item.ResultCode = eEquInfCmdResultCode.成功.ToString();
                        item.DataFlag   = 1;
                        if (Dbers.GetInstance().SelfDber.Update(item) > 0)
                        {
                            // 我方已读
                            this.EquDber.Execute(string.Format("update {0} set XL_Start = 0,XL_Finish = 0,Read_Flag = 0 where XL_Finish=1", CMCS.DapperDber.Util.EntityReflectionUtil.GetTableName <KY_CYJ_Down>()));

                            res2++;
                        }
                    }
                }
                else if (item.UnLoadType == "到归批机")
                {
                    KY_CYJ_Down down = this.EquDber.Entity <KY_CYJ_Down>("where Barrel_Code=@Barrel_Code and XL_Finish=1", new { Barrel_Code = item.BarrelNumber });
                    if (down != null)
                    {
                        //历史卸样结果
                        InfQCJXCYJUnloadResult oldUnloadResult = commonDAO.SelfDber.Entity <InfQCJXCYJUnloadResult>("where SampleCode=:SampleCode and BarrelCode=:BarrelCode and UnLoadType=:UnLoadType and DataFlag=0", new { SampleCode = item.SampleCode, UnLoadType = item.UnLoadType, BarrelCode = item.BarrelNumber });
                        if (oldUnloadResult == null)
                        {
                            // 生成采样桶记录
                            CmcsRCSampleBarrel rCSampleBarrel = new CmcsRCSampleBarrel();

                            rCSampleBarrel.BarrelCode       = item.SampleCode;
                            rCSampleBarrel.SampSecondCode   = commonDAO.CreateSampleDetailCode(item.SampleCode);;
                            rCSampleBarrel.BarrellingTime   = down.LastDateTime;
                            rCSampleBarrel.SampleCode       = item.SampleCode;
                            rCSampleBarrel.SampSecondCode   = commonDAO.CreateSampleDetailCode(rCSampleBarrel.SampleCode);
                            rCSampleBarrel.SampleMachine    = this.MachineCode.Contains("#1") ? "#1汽车机械采样机" : "#2汽车机械采样机";
                            rCSampleBarrel.SampleType       = eSamplingType.机械采样.ToString();
                            rCSampleBarrel.SamplingId       = commonDAO.GetSamplingIdBySamplingCode(item.SampleCode);
                            rCSampleBarrel.InFactoryBatchId = commonDAO.GetBatchIdByRCSamplingId(rCSampleBarrel.SamplingId);

                            if (commonDAO.SelfDber.Insert(rCSampleBarrel) > 0)
                            {
                                InfQCJXCYJUnloadResult unload = new InfQCJXCYJUnloadResult
                                {
                                    SampleCode = item.SampleCode,
                                    BarrelCode = down.Barrel_Code,
                                    UnloadTime = down.LastDateTime,
                                    DataFlag   = 0
                                };
                                if (commonDAO.SelfDber.Insert(unload) > 0)
                                {
                                    res++;
                                }
                            }
                        }
                        item.ResultCode = eEquInfCmdResultCode.成功.ToString();
                        item.DataFlag   = 1;
                        if (Dbers.GetInstance().SelfDber.Update(item) > 0)
                        {
                            // 我方已读
                            this.EquDber.Execute(string.Format("update {0} set XL_Start = 0,XL_Finish = 0,Read_Flag = 0 where XL_Finish=1 and Barrel_Code='{1}'", CMCS.DapperDber.Util.EntityReflectionUtil.GetTableName <KY_CYJ_Down>(), item.BarrelNumber));

                            res2++;
                        }
                    }
                }
            }

            output(string.Format("同步历史卸样结果 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
            output(string.Format("同步卸样结果 {0} 条(第三方 > 集中管控)", res2), eOutputType.Normal);
        }
        private void txtInputSampleCode_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string barrelCode = txtInputSampleCode.Text.Trim();
                if (String.IsNullOrWhiteSpace(barrelCode))
                {
                    return;
                }

                if (this.CurrentFlowFlag == eFlowFlag.等待扫码)
                {
                    if (!this.CurrentRCSampleBarrels.Any(a => a.BarrelCode == barrelCode))
                    {
                        // 查找3天内未绑定采样单的样桶记录
                        CmcsRCSampleBarrel rCSampleBarrel = commonDAO.SelfDber.Entity <CmcsRCSampleBarrel>("where BarrelCode=:BarrelCode and CreateDate>=:CreateDate order by CreateDate desc", new { BarrelCode = barrelCode, CreateDate = DateTime.Now.Date.AddDays(-3) });
                        if (rCSampleBarrel != null)
                        {
                            if (!string.IsNullOrWhiteSpace(rCSampleBarrel.SamplingId))
                            {
                                ShowMessage("此样桶已登记", eOutputType.Error);
                                txtInputSampleCode.ResetText();

                                return;
                            }
                            else
                            {
                                this.MachineRCSampleBarrelId.Add(rCSampleBarrel.Id);
                                this.CurrenSampleBarrel = rCSampleBarrel;
                            }
                        }

                        this.CurrentBarrelCode = barrelCode;

                        if (IsUseWeight)
                        {
                            this.CurrentFlowFlag = eFlowFlag.样桶称重;
                            ShowMessage("扫码成功,开始称重", eOutputType.Normal);
                        }
                        else
                        {
                            this.CurrentFlowFlag = eFlowFlag.等待登记;
                            ShowMessage("扫码成功,开始登记", eOutputType.Normal);

                            WaitRegister();
                        }
                    }
                    else
                    {
                        ShowMessage("列表中已存在该采样桶", eOutputType.Error);
                        txtInputSampleCode.ResetText();
                    }
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(this.CurrentBarrelCode))
                    {
                        ShowMessage("请先选择采样单", eOutputType.Error);
                        txtInputSampleCode.ResetText();
                    }
                }
            }
        }
Example #25
0
        /// <summary>
        /// 键入Enter检测有效性
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtInputSampleCode_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (this.CurrentFlowFlag != eFlowFlag.等待扫码)
                {
                    return;
                }

                string barrelCode = txtInputSampleCode.Text.Trim();
                if (String.IsNullOrWhiteSpace(barrelCode))
                {
                    return;
                }

                //  根据采样桶编码查找该采样单下所有采样桶记录
                if (this.brotherRCSampleBarrels.Count == 0)
                {
                    this.brotherRCSampleBarrels = czyHandlerDAO.GetRCSampleBarrels(barrelCode, out resMessage);
                    if (this.brotherRCSampleBarrels.Count == 0)
                    {
                        ShowMessage(resMessage, eOutputType.Error);
                        txtInputSampleCode.ResetText();
                        return;
                    }
                    ShowMessage(resMessage, eOutputType.Normal);
                    ShowButton(this.brotherRCSampleBarrels.Count, "Sum");
                }

                // 采样桶编码属于同一采样单下则验证通过,直到全部验证完毕
                this.rCSampleBarrel = this.brotherRCSampleBarrels.Where(a => a.SampSecondCode == barrelCode && !this.IsScanedRCSampleBarrelId.Contains(a.Id)).FirstOrDefault();
                if (this.rCSampleBarrel != null)
                {
                    if (!this.IsScanedRCSampleBarrelId.Contains(this.rCSampleBarrel.Id))
                    {
                        this.IsScanedRCSampleBarrelId.Add(this.rCSampleBarrel.Id);
                        ShowButton(this.IsScanedRCSampleBarrelId.Count, "Already");

                        if (this.IsScanedRCSampleBarrelId.Count < this.brotherRCSampleBarrels.Count)
                        {
                            ShowMessage("样桶编码:" + barrelCode + ",还剩" + (this.brotherRCSampleBarrels.Count - this.IsScanedRCSampleBarrelId.Count) + "桶未校验,请扫下个样桶", eOutputType.Normal);
                        }
                        else
                        {
                            this.czyHandlerDAO.SaveHandSamplingReceive(this.brotherRCSampleBarrels[0].SamplingId, SelfVars.LoginUser.UserName, DateTime.Now);
                            ShowMessage("样桶编码:" + barrelCode + ",该批次样桶已全部校验成功", eOutputType.Normal);
                        }
                        this.CurrentFlowFlag = eFlowFlag.等待校验;
                    }
                    else
                    {
                        txtInputSampleCode.ResetText();
                        ShowMessage("样桶编码:" + barrelCode + " 已校验,请扫下个样桶", eOutputType.Error);
                    }
                }
                else
                {
                    txtInputSampleCode.ResetText();
                    ShowMessage("样桶编码:" + barrelCode + " 校验失败,请扫下个样桶", eOutputType.Error);
                }
            }
        }
Example #26
0
 /// <summary>
 /// 保存样桶登记记录(人工样 采样第一次称重)
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool SaveRCSampleBarrel(CmcsRCSampleBarrel entity)
 {
     return(Dbers.GetInstance().SelfDber.Insert <CmcsRCSampleBarrel>(entity) > 0 ? true : false);
 }
Example #27
0
 private void txtInputSampleCode_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     if (e.KeyCode == System.Windows.Forms.Keys.Return)
     {
         if (this.CurrentFlowFlag != eFlowFlag.等待扫码)
         {
             return;
         }
         string barrelCode = this.txtInputSampleCode.Text.Trim();
         if (string.IsNullOrWhiteSpace(barrelCode))
         {
             return;
         }
         if (this.brotherRCSampleBarrels.Count == 0)
         {
             this.brotherRCSampleBarrels = this.czyHandlerDAO.GetRCSampleBarrels(barrelCode, out this.resMessage);
             if (this.brotherRCSampleBarrels.Count == 0)
             {
                 this.ShowMessage(this.resMessage, FrmMakeTake.eOutputType.Error);
                 this.txtInputSampleCode.ResetText();
                 return;
             }
             this.ShowMessage(this.resMessage, FrmMakeTake.eOutputType.Normal);
             this.CreateButtonX(this.brotherRCSampleBarrels.Count);
             this.ShowButton(this.brotherRCSampleBarrels.Count, "Sum", 0);
         }
         this.rCSampleBarrel = (from a in this.brotherRCSampleBarrels
                                where a.SampSecondCode == barrelCode
                                select a).FirstOrDefault <CmcsRCSampleBarrel>();
         if (this.rCSampleBarrel != null)
         {
             if (!this.IsScanedRCSampleBarrelId.Contains(this.rCSampleBarrel.Id))
             {
                 this.IsScanedRCSampleBarrelId.Add(this.rCSampleBarrel.Id);
                 this.ShowButton(this.IsScanedRCSampleBarrelId.Count, "Already", System.Convert.ToInt32(this.rCSampleBarrel.SampSecondCode.Substring(14, 2)));
                 if (this.IsScanedRCSampleBarrelId.Count < this.brotherRCSampleBarrels.Count)
                 {
                     this.ShowMessage(string.Concat(new object[]
                     {
                         "样桶编码:",
                         barrelCode,
                         ",还剩",
                         this.brotherRCSampleBarrels.Count - this.IsScanedRCSampleBarrelId.Count,
                         "桶未校验,请扫下个样桶"
                     }), FrmMakeTake.eOutputType.Normal);
                 }
                 else
                 {
                     foreach (CmcsRCSampleBarrel current in this.brotherRCSampleBarrels)
                     {
                         CmcsSampleBarrel cmcsSampleBarrel = Dbers.GetInstance().SelfDber.Entity <CmcsSampleBarrel>(" where BarrelCode='" + current.BarrelCode + "' ", null);
                         if (cmcsSampleBarrel != null)
                         {
                             cmcsSampleBarrel.IsUse = 0;
                             Dbers.GetInstance().SelfDber.Update <CmcsSampleBarrel>(cmcsSampleBarrel);
                         }
                     }
                     this.czyHandlerDAO.SaveHandSamplingReceive(this.brotherRCSampleBarrels[0].SamplingId, SelfVars.LoginUser.UserName, DateTime.Now);
                     this.ShowMessage("样桶编码:" + barrelCode + ",该批次样桶已全部校验成功", FrmMakeTake.eOutputType.Normal);
                 }
                 this.CurrentFlowFlag = eFlowFlag.等待校验;
                 return;
             }
             this.txtInputSampleCode.ResetText();
             this.ShowMessage("样桶编码:" + barrelCode + " 已校验,请扫下个样桶", FrmMakeTake.eOutputType.Error);
             return;
         }
         else
         {
             this.txtInputSampleCode.ResetText();
             this.ShowMessage("样桶编码:" + barrelCode + " 校验失败,请扫下个样桶", FrmMakeTake.eOutputType.Error);
         }
     }
 }
        /// <summary>
        /// 同步历史卸样结果
        /// </summary>
        /// <param name="output"></param>
        /// <param name="MachineCode"></param>
        public void SyncUnloadResult(Action <string, eOutputType> output)
        {
            int res = 0;

            res = 0;
            // 第三方 > 集中管控
            foreach (KY_CYJ_P_BARREL entity in DcDbers.GetInstance().BeltSampler_Dber.Entities <KY_CYJ_P_BARREL>("where DateDiff(dd,EditDate,getdate())<=7"))
            {
                // 查找采样命令
                CmcsRCSampling sampling = commonDAO.SelfDber.Entity <CmcsRCSampling>("where SampleCode=:SampleCode", new { SampleCode = entity.Barrel_Name });
                if (sampling != null)
                {
                    CmcsRCSampleBarrel cmcsRCSampleBarrel = commonDAO.SelfDber.Entity <CmcsRCSampleBarrel>("where BarrelNumber='" + entity.Barrel_Name + "' and to_char(BarrellingTime,'yyyy-mm-dd hh24:mi:ss')= '" + entity.EditDate.ToString("yyyy-MM-dd HH:mm:ss") + "' and SamplerName = '" + KYToMachineCode(entity.CYJ_Machine) + "'");
                    if (cmcsRCSampleBarrel == null)
                    {
                        // 生成采样桶记录
                        CmcsRCSampleBarrel rCSampleBarrel = new CmcsRCSampleBarrel()
                        {
                            SamplingId     = sampling.Id,
                            BarrellingTime = entity.EditDate,
                            BarrelNumber   = entity.Barrel_Name,
                            SamplerName    = KYToMachineCode(entity.CYJ_Machine),
                            SampleType     = eSamplingType.机械采样.ToString(),
                            //SampleCount = barrel.SampleCount,
                            SampleWeight = entity.Barrel_Weight,
                            BarrelCode   = entity.Barrel_Code
                        };
                        commonDAO.SelfDber.Insert(rCSampleBarrel);
                    }
                    else
                    {
                        cmcsRCSampleBarrel.SampleWeight = entity.Barrel_Weight;
                        commonDAO.SelfDber.Update(cmcsRCSampleBarrel);
                    }
                }


                InfBeltSamplerUnloadResult oldUnloadResult = commonDAO.SelfDber.Entity <InfBeltSamplerUnloadResult>("where samplecode='" + entity.Barrel_Name + "' and to_char(UnloadTime,'yyyy-mm-dd hh24:mi:ss')= '" + entity.EditDate.ToString("yyyy-MM-dd HH:mm:ss") + "'");
                if (oldUnloadResult == null)
                {
                    if (commonDAO.SelfDber.Insert(new InfBeltSamplerUnloadResult
                    {
                        MachineCode = KYToMachineCode(entity.CYJ_Machine),
                        SampleCode = entity.Barrel_Name,
                        BarrelCode = entity.Barrel_Code,
                        UnloadTime = entity.EditDate
                    }) > 0)
                    {
                        //entity.DataFlag = 1;
                        //this.EquDber.Update(entity);

                        res++;
                    }
                }
                else
                {
                    oldUnloadResult.MachineCode = KYToMachineCode(entity.CYJ_Machine);
                    oldUnloadResult.SampleCode  = entity.Barrel_Name;
                    oldUnloadResult.BarrelCode  = entity.Barrel_Code;
                    oldUnloadResult.UnloadTime  = entity.EditDate;

                    if (commonDAO.SelfDber.Update(oldUnloadResult) > 0)
                    {
                        //entity.DataFlag = 1;
                        //this.EquDber.Update(entity);

                        res++;
                    }
                }
            }
            output(string.Format("同步卸样结果 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
        }
Example #29
0
        /// <summary>
        /// 键入Enter检测有效性
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtInputSampleCode_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (this.CurrentFlowFlag != eFlowFlag.等待扫码)
                {
                    return;
                }

                if (ReadRwer.Status && string.IsNullOrEmpty(txtInputSampleCode.Text))
                {
                    ReadRf();
                }

                string barrelCode = txtInputSampleCode.Text;                // = this.samplecode; ;
                if (String.IsNullOrWhiteSpace(barrelCode))
                {
                    return;
                }

                //  根据采样桶编码查找该采样单下所有采样桶记录
                if (this.brotherRCSampleBarrels.Count == 0)
                {
                    this.brotherRCSampleBarrels = czyHandlerDAO.GetRCSampleBarrels(barrelCode, out resMessage);
                    if (this.brotherRCSampleBarrels.Count == 0)
                    {
                        ShowMessage(resMessage, eOutputType.Error);
                        txtInputSampleCode.ResetText();
                        return;
                    }
                    ShowMessage(resMessage, eOutputType.Normal);
                    ShowButton(this.brotherRCSampleBarrels.Count, "Sum");
                }

                // 采样桶编码属于同一采样单下则验证通过,直到全部验证完毕
                this.rCSampleBarrel = this.brotherRCSampleBarrels.Where(a => a.BarrelCode == barrelCode).FirstOrDefault();
                if (this.rCSampleBarrel != null)
                {
                    if (!this.IsScanedRCSampleBarrelId.Contains(this.rCSampleBarrel.Id))
                    {
                        this.IsScanedRCSampleBarrelId.Add(this.rCSampleBarrel.Id);
                        ShowButton(this.IsScanedRCSampleBarrelId.Count, "Already");

                        if (this.IsScanedRCSampleBarrelId.Count < this.brotherRCSampleBarrels.Count)
                        {
                            ShowMessage("样桶编码:" + barrelCode + ",还剩" + (this.brotherRCSampleBarrels.Count - this.IsScanedRCSampleBarrelId.Count) + "桶未校验,请扫下个样桶", eOutputType.Normal);
                        }
                        else
                        {
                            ShowMessage("样桶编码:" + barrelCode + ",该批次样桶已全部校验成功", eOutputType.Normal);
                        }

                        this.CurrentFlowFlag = eFlowFlag.等待校验;
                    }
                    else
                    {
                        txtInputSampleCode.ResetText();
                        ShowMessage("样桶编码:" + barrelCode + " 已校验,请扫下个样桶", eOutputType.Error);
                    }
                }
                else
                {
                    txtInputSampleCode.ResetText();
                    ShowMessage("样桶编码:" + barrelCode + " 校验失败,请扫下个样桶", eOutputType.Error);
                }
            }
        }
Example #30
0
        /// <summary>
        /// 键入Enter检测有效性
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtInputSampleCode_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (this.CurrentFlowFlag != eFlowFlag.等待扫码)
                {
                    return;
                }

                string barrelCode = txtInputSampleCode.Text.Trim();
                if (String.IsNullOrWhiteSpace(barrelCode))
                {
                    return;
                }

                //  根据采样桶编码查找该采样单下所有采样桶记录
                if (this.brotherRCSampleBarrels.Count == 0)
                {
                    this.brotherRCSampleBarrels = czyHandlerDAO.GetRCSampleBarrels(barrelCode, out resMessage);
                    if (this.brotherRCSampleBarrels.Count == 0)
                    {
                        ShowMessage(resMessage, eOutputType.Error);
                        txtInputSampleCode.ResetText();
                        return;
                    }
                    ShowMessage(resMessage, eOutputType.Normal);
                    ShowButton(this.brotherRCSampleBarrels.Count, "Sum");
                }

                //// 采样桶编码属于同一采样单下则验证通过,直到全部验证完毕
                //this.rCSampleBarrel = this.brotherRCSampleBarrels.Where(a => a.BarrelCode == barrelCode).FirstOrDefault();

                //20180529 by xuwen 改为 一次性校验所有 采样桶
                foreach (var rCSampleBarrel in this.brotherRCSampleBarrels.Where(a => a.BarrelCode == barrelCode))
                {
                    this.rCSampleBarrel = rCSampleBarrel;

                    if (this.rCSampleBarrel != null)
                    {
                        if (!this.IsScanedRCSampleBarrelId.Contains(this.rCSampleBarrel.Id))
                        {
                            this.IsScanedRCSampleBarrelId.Add(this.rCSampleBarrel.Id);
                            ShowButton(this.IsScanedRCSampleBarrelId.Count, "Already");

                            if (this.IsScanedRCSampleBarrelId.Count < this.brotherRCSampleBarrels.Count)
                            {
                                ShowMessage("样桶编码:" + barrelCode + ",还剩" + (this.brotherRCSampleBarrels.Count - this.IsScanedRCSampleBarrelId.Count) + "桶未校验,请扫下个样桶", eOutputType.Normal);
                            }
                            else
                            {
                                ShowMessage("样桶编码:" + barrelCode + ",该批次样桶已全部校验成功", eOutputType.Normal);
                            }
                        }
                        else
                        {
                            txtInputSampleCode.ResetText();
                            ShowMessage("样桶编码:" + barrelCode + " 已校验,请扫下个样桶", eOutputType.Error);
                        }


                        ShowMessage("校验成功,重量:" + wber.Weight.ToString() + "KG", eOutputType.Normal);

                        // 所有桶扫描完后进入下一流程
                        if (this.IsScanedRCSampleBarrelId.Count == this.brotherRCSampleBarrels.Count)
                        {
                            ShowMessage("该环节样桶已全部校验完毕!", eOutputType.Normal);
                            txtInputSampleCode.ResetText();

                            this.RCMake = czyHandlerDAO.GetRCMakeBySampleId(this.brotherRCSampleBarrels[0].SamplingId);
                            if (this.RCMake != null)
                            {
                                this.CurrentFlowFlag = eFlowFlag.发送制样命令;
                                SendMakePlanAndStart();
                            }
                            else
                            {
                                ShowMessage("未找到制样单", eOutputType.Error);
                            }
                        }
                        else
                        {
                            txtInputSampleCode.ResetText();
                            this.CurrentFlowFlag = eFlowFlag.等待扫码;
                        }
                    }
                    else
                    {
                        txtInputSampleCode.ResetText();
                        ShowMessage("样桶编码:" + barrelCode + " 校验失败,请扫下个样桶", eOutputType.Error);
                    }
                }
            }
        }