예제 #1
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);
            }
        }
예제 #2
0
        /// <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);
            }
        }
예제 #3
0
        private void superGridControl3_CellClick(object sender, GridCellClickEventArgs e)
        {
            InfBeltSampleUnloadCmd sampleUnloadCmd = e.GridCell.GridRow.DataItem as InfBeltSampleUnloadCmd;

            foreach (GridRow gridRow in superGridControl3.PrimaryGrid.Rows)
            {
                InfBeltSampleUnloadCmd beltSampleUnloadCmd = gridRow.DataItem as InfBeltSampleUnloadCmd;
                gridRow.Checked = (beltSampleUnloadCmd != null && sampleUnloadCmd.Id == beltSampleUnloadCmd.Id);
            }
        }
예제 #4
0
        /// <summary>
        /// 从卸样记录中获取最新的采样编码,判断是否能卸样
        /// </summary>
        /// <param name="cmcsCMEquipment"></param>
        /// <returns></returns>
        private bool HandleWhetherSampleUnloadCmd(CmcsCMEquipment cmcsCMEquipment)
        {
            string tempSamplingId = string.Empty;

            if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(cmcsCMEquipment.Parentid).EquipmentCode == "皮带采样机")
            {
                InfBeltSampleUnloadCmd entity = commonDAO.SelfDber.Entity <InfBeltSampleUnloadCmd>(" where MachineCode='" + cmcsCMEquipment.EquipmentCode + "' order by createdate desc");
                if (entity != null)
                {
                    tempSamplingId = entity.SamplingId;
                }
            }
            else if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(cmcsCMEquipment.Parentid).EquipmentCode == "汽车机械采样机")
            {
                InfQCJXCYUnLoadCMD entity = commonDAO.SelfDber.Entity <InfQCJXCYUnLoadCMD>(" where MachineCode='" + cmcsCMEquipment.EquipmentCode + "' order by createdate desc");
                if (entity != null)
                {
                    tempSamplingId = entity.SamplingId;
                }
            }
            else
            {
                rTxtOutputer.Output("无此编码类型,请查证\"皮带采样机\"和\"汽车机械采样机\"类型!", eOutputType.Error);
                return(false);
            }

            if (!string.IsNullOrEmpty(tempSamplingId))
            {
                //同一批次可以继续卸样
                if (this.CurrentRCSampling.Id == tempSamplingId)
                {
                    return(true);
                }

                CmcsRCMake rcMake = AutoMakerDAO.GetInstance().GetRCMakeBySampleId(tempSamplingId);
                if (rcMake != null)
                {
                    //未找到制样记录需要提示是否继续操作
                    InfMakerPlan infMakerPlan = Dbers.GetInstance().SelfDber.Entity <InfMakerPlan>("where MakeCode=:MakeCode", new { MakeCode = rcMake.MakeCode });
                    if (infMakerPlan == null)
                    {
                        if (MessageBoxEx.Show("该卸样记录与上一次未制样的记录不是同一批次,为防止混样,确定是否继续", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.OK)
                        {
                            if (new FrmConfirmOperationLog("确定人为操作继续卸样").ShowDialog() == DialogResult.OK)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
예제 #5
0
        /// <summary>
        /// 发送卸样命令
        /// </summary>
        /// <param name="machineCode">设备编码</param>
        /// <param name="sampleCode">采样码</param>
        /// <param name="sampleUnloadType">卸样方式</param>
        /// <returns></returns>
        public bool SendSampleUnloadCmd(string machineCode, string sampleCode, eEquInfSamplerUnloadType sampleUnloadType)
        {
            InfBeltSampleUnloadCmd SampleUnloadCmd = new InfBeltSampleUnloadCmd
            {
                DataFlag      = 0,
                InterfaceType = CommonDAO.GetInstance().GetMachineInterfaceTypeByCode(machineCode),
                MachineCode   = machineCode,
                ResultCode    = eEquInfCmdResultCode.默认.ToString(),
                SampleCode    = sampleCode,
                UnloadType    = sampleUnloadType.ToString(),
                SyncFlag      = 0
            };

            return(Dbers.GetInstance().SelfDber.Insert <InfBeltSampleUnloadCmd>(SampleUnloadCmd) > 0);
        }
예제 #6
0
        /// <summary>
        /// 发送卸样命令
        /// </summary>
        /// <param name="machineCode">设备编码</param>
        /// <param name="samplingId">采样单Id</param>
        /// <param name="sampleCode">采样码</param>
        /// <param name="sampleUnloadType">卸样方式</param>
        /// <param name="sampleUnloadCmdId">返回命令Id</param>
        /// <returns></returns>
        public bool SendSampleUnloadCmd(string machineCode, string samplingId, string sampleCode, eEquInfSamplerUnloadType sampleUnloadType, out string sampleUnloadCmdId)
        {
            InfBeltSampleUnloadCmd sampleUnloadCmd = new InfBeltSampleUnloadCmd
            {
                Id            = Guid.NewGuid().ToString(),
                DataFlag      = 0,
                InterfaceType = CommonDAO.GetInstance().GetMachineInterfaceTypeByCode(machineCode),
                MachineCode   = machineCode,
                ResultCode    = eEquInfCmdResultCode.默认.ToString(),
                SampleCode    = sampleCode,
                UnloadType    = sampleUnloadType.ToString(),
                SyncFlag      = 0,
                SamplingId    = samplingId
            };

            sampleUnloadCmdId = sampleUnloadCmd.Id;

            return(Dbers.GetInstance().SelfDber.Insert <InfBeltSampleUnloadCmd>(sampleUnloadCmd) > 0);
        }
예제 #7
0
        /// <summary>
        /// 获取卸样状态
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public eEquInfCmdResultCode GetBeltUnloadSamplerState(string UnloadSamplerId)
        {
            eEquInfCmdResultCode   eResult;
            InfBeltSampleUnloadCmd SampleUnloadCmd = Dbers.GetInstance().SelfDber.Get <InfBeltSampleUnloadCmd>(UnloadSamplerId);

            if (SampleUnloadCmd != null)
            {
                if (Enum.TryParse(SampleUnloadCmd.ResultCode, out eResult))
                {
                    return(eResult);
                }
                else
                {
                    return(eEquInfCmdResultCode.默认);
                }
            }
            else
            {
                return(eEquInfCmdResultCode.默认);
            }
        }
예제 #8
0
        private void superGridControl3_CellClick(object sender, GridCellClickEventArgs e)
        {
            if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(this.CurrentSampler.Parentid).EquipmentCode == "皮带采样机")
            {
                InfBeltSampleUnloadCmd sampleUnloadCmd = e.GridCell.GridRow.DataItem as InfBeltSampleUnloadCmd;

                foreach (GridRow gridRow in superGridControl3.PrimaryGrid.Rows)
                {
                    InfBeltSampleUnloadCmd beltSampleUnloadCmd = gridRow.DataItem as InfBeltSampleUnloadCmd;
                    gridRow.Checked = (beltSampleUnloadCmd != null && sampleUnloadCmd.Id == beltSampleUnloadCmd.Id);
                }
            }
            else if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(this.CurrentSampler.Parentid).EquipmentCode == "汽车机械采样机")
            {
                InfQCJXCYUnLoadCMD sampleUnloadCmd = e.GridCell.GridRow.DataItem as InfQCJXCYUnLoadCMD;

                foreach (GridRow gridRow in superGridControl3.PrimaryGrid.Rows)
                {
                    InfQCJXCYUnLoadCMD qcjxcySampleUnloadCmd = gridRow.DataItem as InfQCJXCYUnLoadCMD;
                    gridRow.Checked = (qcjxcySampleUnloadCmd != null && sampleUnloadCmd.Id == qcjxcySampleUnloadCmd.Id);
                }
            }
        }
예제 #9
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;
                }
            }
        }
예제 #10
0
        /// <summary>
        /// 同步卸样命令
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public void SyncUnloadCmd(Action <string, eOutputType> output)
        {
            int res = 0;

            // 集中管控 > 第三方
            foreach (InfBeltSampleUnloadCmd entity in BeltSamplerDAO.GetInstance().GetWaitForSyncBeltSampleUnloadCmd(Type == "入场" ? GlobalVars.InterfaceType_PDCYJ_In : GlobalVars.InterfaceType_PDCYJ_Out))
            {
                bool isSuccess = false;

                EquPDCYJUnloadCmd pDCYUnloadCMD = this.EquDber.Get <EquPDCYJUnloadCmd>(entity.Id);
                if (pDCYUnloadCMD == null)
                {
                    isSuccess = this.EquDber.Insert(new EquPDCYJUnloadCmd
                    {
                        // 保持相同的Id
                        Id          = entity.Id,
                        DataFlag    = 0,
                        CreateDate  = entity.CreateDate,
                        SampleCode  = entity.SampleCode,
                        MachineCode = ConvertToInfMachineCode(entity.MachineCode),
                        ResultCode  = eEquInfCmdResultCode.默认.ToString(),
                        SamplingId  = entity.SamplingId
                    }) > 0;
                }
                else
                {
                    isSuccess = true;
                }

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

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

            res = 0;
            // 第三方 > 集中管控
            foreach (EquPDCYJUnloadCmd entity in this.EquDber.Entities <EquPDCYJUnloadCmd>("where DataFlag=2 and datediff(dd,CreateDate,getdate())=0"))
            {
                InfBeltSampleUnloadCmd beltSampleUnloadCmd = commonDAO.SelfDber.Get <InfBeltSampleUnloadCmd>(entity.Id);
                if (beltSampleUnloadCmd == null)
                {
                    continue;
                }

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

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

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