예제 #1
0
 /// <summary>
 /// 窗体加载事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FrmSupplier_Oper_Load(object sender, EventArgs e)
 {
     this.MinimizeBox = false;
     if (!String.IsNullOrEmpty(id))
     {
         try
         {
             if (printType == "入厂煤")
             {
                 this.buyFuelTransport = Dbers.GetInstance().SelfDber.Get <CmcsBuyFuelTransport>(this.id);
             }
             else if (printType == "其他物资")
             {
                 this.goodsTransport = Dbers.GetInstance().SelfDber.Get <CmcsGoodsTransport>(this.id);
             }
             makeImage(null, null);
         }
         catch (Exception ex)
         {
             MessageBoxEx.Show("打印失败,请联系系统管理员!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.Close();
         }
     }
 }
예제 #2
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();
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 判断是否可以发送卸样命令
        /// </summary>
        /// <param name="machineCode">设备编码</param>
        /// <returns></returns>
        public bool CanSendSampleUnloadCmd(string machineCode, out string message)
        {
            message = string.Empty;

            if (GetBeltSamplerSystemStatue(machineCode) != eEquInfSamplerSystemStatus.就绪待机.ToString())
            {
                message = "采样机系统未就绪";
                return(false);
            }

            if (Dbers.GetInstance().SelfDber.Count <InfBeltSampleUnloadCmd>("where MachineCode=:MachineCode and DataFlag=0", new { MachineCode = machineCode }) > 0)
            {
                message = "存在未处理的卸样任务";
                return(false);
            }

            if (Dbers.GetInstance().SelfDber.Count <InfBeltSampleUnloadCmd>("where MachineCode=:MachineCode and ResultCode='" + eEquInfCmdResultCode.默认 + "'", new { MachineCode = machineCode }) > 0)
            {
                message = "存在未执行的卸样任务";
                return(false);
            }

            return(string.IsNullOrEmpty(message));
        }
        public void BindData()
        {
            listCount.Clear();
            string tempSqlWhere = this.SqlWhere;

            listCount = Dbers.GetInstance().SelfDber.Entities <CmcsBuyFuelTransport>(tempSqlWhere + " order by SerialNumber desc");

            listCount.OrderBy(a => a.MineName);
            CmcsBuyFuelTransport listTotal1 = new CmcsBuyFuelTransport();

            listTotal1.MineName     = "合计";
            listTotal1.TicketWeight = listCount.Sum(a => a.TicketWeight);
            listTotal1.GrossWeight  = listCount.Sum(a => a.GrossWeight);
            listTotal1.TareWeight   = listCount.Sum(a => a.TareWeight);
            listTotal1.SuttleWeight = listCount.Sum(a => a.SuttleWeight);
            listTotal1.DeductWeight = listCount.Sum(a => a.DeductWeight);
            listTotal1.KsWeight     = listCount.Sum(a => a.AutoKsWeight + a.KsWeight);
            listTotal1.KgWeight     = listCount.Sum(a => a.KgWeight);
            listTotal1.CheckWeight  = listCount.Sum(a => a.CheckWeight);
            listTotal1.IsFinish     = listCount.Count;//车数
            listCount.Add(listTotal1);

            superGridControl1.PrimaryGrid.DataSource = listCount;
        }
예제 #5
0
 /// <summary>
 /// 获取指定入厂时间段的火车进厂队列详情视图
 /// </summary>
 /// <param name="trainTipperMachineCode">翻车机编码</param>
 /// <param name="startInfactoryTime">起始入厂时间</param>
 /// <param name="endInfactoryTime">结束入厂时间</param>
 /// <returns></returns>
 public List <View_TrainTipperQueue> GetView_TrainTipperQueue(string trainTipperMachineCode, DateTime startInfactoryTime, DateTime endInfactoryTime)
 {
     return(Dbers.GetInstance().SelfDber.Entities <View_TrainTipperQueue>("where TrainTipperMachineCode=:TrainTipperMachineCode and InfactoryTime>=:StartInfactoryTime and InfactoryTime<:EndInfactoryTime order by OrderNumber asc", new { TrainTipperMachineCode = trainTipperMachineCode, StartInfactoryTime = startInfactoryTime, EndInfactoryTime = endInfactoryTime }));
 }
예제 #6
0
 /// <summary>
 /// 保存数据
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (txt_CardNumber.Text.Length == 0)
     {
         MessageBoxEx.Show("该标卡号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     if (txt_TagId.Text.Length == 0)
     {
         MessageBoxEx.Show("该标签号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     if ((CmcsepcCard == null || CmcsepcCard.CardNumber != txt_CardNumber.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsEPCCard>(" where CardNumber=:CardNumber", new { CardNumber = txt_CardNumber.Text }).Count > 0)
     {
         MessageBoxEx.Show("该标卡号不可重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if ((CmcsepcCard == null || CmcsepcCard.TagId != txt_TagId.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsEPCCard>(" where TagId=:TagId", new { TagId = txt_TagId.Text }).Count > 0)
     {
         MessageBoxEx.Show("该标签号不可重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (this.EditMode == eEditMode.修改)
     {
         CmcsepcCard.CardNumber = txt_CardNumber.Text;
         CmcsepcCard.TagId      = txt_TagId.Text;
         Dbers.GetInstance().SelfDber.Update(CmcsepcCard);
     }
     else if (this.EditMode == eEditMode.新增)
     {
         CmcsepcCard            = new CmcsEPCCard();
         CmcsepcCard.CardNumber = txt_CardNumber.Text;
         CmcsepcCard.TagId      = txt_TagId.Text;
         Dbers.GetInstance().SelfDber.Insert(CmcsepcCard);
     }
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
예제 #7
0
 /// <summary>
 /// 获取最后一次卸样命令
 /// </summary>
 /// <param name="machineCode">设备编码</param>
 /// <returns></returns>
 public InfQCJXCYUnLoadCMD GetLastSampleUnloadCmd(string machineCode)
 {
     return(Dbers.GetInstance().SelfDber.Entity <InfQCJXCYUnLoadCMD>("where MachineCode=:MachineCode order by CreationTime desc", new { MachineCode = machineCode }));
 }
예제 #8
0
        /// <summary>
        /// 报警复位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAlarmReset_Click(object sender, EventArgs e)
        {
            InfBeltSampleCmd_KY cmd = new InfBeltSampleCmd_KY
            {
                DataFlag     = 0,
                MachineCode  = GlobalVars.MachineCode_PDCYJ_1,
                ResultCode   = eEquInfCmdResultCode.默认.ToString(),
                CmdCode      = ((int)eEquInfSamplerCmd_KY.报警复位).ToString(),
                OperatorName = GlobalVars.LoginUser.Name,
                SendDateTime = DateTime.Now,
                SyncFlag     = 0
            };
            InfBeltSampleCmd_KY cmd1 = new InfBeltSampleCmd_KY
            {
                DataFlag     = 0,
                MachineCode  = GlobalVars.MachineCode_PDCYJ_2,
                ResultCode   = eEquInfCmdResultCode.默认.ToString(),
                CmdCode      = ((int)eEquInfSamplerCmd_KY.报警复位).ToString(),
                OperatorName = GlobalVars.LoginUser.Name,
                SendDateTime = DateTime.Now,
                SyncFlag     = 0
            };

            if (Dbers.GetInstance().SelfDber.Insert <InfBeltSampleCmd_KY>(cmd) > 0 && Dbers.GetInstance().SelfDber.Insert <InfBeltSampleCmd_KY>(cmd1) > 0)
            {
                commonDAO.SaveOperationLog("发送皮带采样机报警复位命令", GlobalVars.LoginUser.Name);
                MessageBoxEx.Show("报警复位命令发送成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return;
            }
            else
            {
                MessageBoxEx.Show("报警复位命令发送失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return;
            }
        }
예제 #9
0
        void Search(string input)
        {
            List <CmcsAutotruck> list = Dbers.GetInstance().SelfDber.Entities <CmcsAutotruck>("where CarNumber like '%'|| :CarNumber ||'%' " + sqlWhere, new { CarNumber = input.ToUpper().Trim() });

            superGridControl1.PrimaryGrid.DataSource = list;
        }
예제 #10
0
        void Search(string input)
        {
            List <CmcsCarModel> list = Dbers.GetInstance().SelfDber.Entities <CmcsCarModel>("where ModelName like '%'|| :ModelName ||'%' " + sqlWhere, new { ModelName = input.ToUpper().Trim() });

            superGridControl1.PrimaryGrid.DataSource = list;
        }
예제 #11
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txt_ModelName.Text.Length == 0)
            {
                MessageBoxEx.Show("该标车型不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            if ((CmcsCarModel == null || CmcsCarModel.ModelName != txt_ModelName.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsCarModel>(" where ModelName=:ModelName", new { ModelName = txt_ModelName.Text }).Count > 0)
            {
                MessageBoxEx.Show("该标车型不可重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.EditMode == eEditMode.修改)
            {
                if (dbi_CarriageLength.Value <= 0)
                {
                    MessageBoxEx.Show("该车型长不能为0!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (dbi_CarriageWidth.Value <= 0)
                {
                    MessageBoxEx.Show("该车型宽不能为0!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (dbi_CarriageBottomToFloor.Value <= 0)
                {
                    MessageBoxEx.Show("该车型车厢底部到地面高不能为0!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if ((dbi_LeftObstacle6.Value > 0 || dbi_RightObstacle6.Value > 0) && (dbi_LeftObstacle5.Value <= 0 && dbi_RightObstacle5.Value <= 0))
                {
                    MessageBoxEx.Show("已有拉筋六信息必须有拉筋五信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if ((dbi_LeftObstacle5.Value > 0 || dbi_RightObstacle5.Value > 0) && (dbi_LeftObstacle4.Value <= 0 && dbi_RightObstacle4.Value <= 0))
                {
                    MessageBoxEx.Show("已有拉筋五信息必须有拉筋四信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if ((dbi_LeftObstacle4.Value > 0 || dbi_RightObstacle4.Value > 0) && (dbi_LeftObstacle3.Value <= 0 && dbi_RightObstacle3.Value <= 0))
                {
                    MessageBoxEx.Show("已有拉筋四信息必须有拉筋三信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if ((dbi_LeftObstacle3.Value > 0 || dbi_RightObstacle3.Value > 0) && (dbi_LeftObstacle2.Value <= 0 && dbi_RightObstacle2.Value <= 0))
                {
                    MessageBoxEx.Show("已有拉筋三信息必须有拉筋二信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if ((dbi_LeftObstacle2.Value > 0 || dbi_RightObstacle2.Value > 0) && (dbi_LeftObstacle1.Value <= 0 && dbi_RightObstacle1.Value <= 0))
                {
                    MessageBoxEx.Show("已有拉筋二信息必须有拉筋一信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                CmcsCarModel.ModelName             = txt_ModelName.Text;
                CmcsCarModel.LeftObstacle1         = (int)dbi_LeftObstacle1.Value;
                CmcsCarModel.LeftObstacle2         = (int)dbi_LeftObstacle2.Value;
                CmcsCarModel.LeftObstacle3         = (int)dbi_LeftObstacle3.Value;
                CmcsCarModel.LeftObstacle4         = (int)dbi_LeftObstacle4.Value;
                CmcsCarModel.LeftObstacle5         = (int)dbi_LeftObstacle5.Value;
                CmcsCarModel.LeftObstacle6         = (int)dbi_LeftObstacle6.Value;
                CmcsCarModel.RightObstacle1        = (int)dbi_RightObstacle1.Value;
                CmcsCarModel.RightObstacle2        = (int)dbi_RightObstacle2.Value;
                CmcsCarModel.RightObstacle3        = (int)dbi_RightObstacle3.Value;
                CmcsCarModel.RightObstacle4        = (int)dbi_RightObstacle4.Value;
                CmcsCarModel.RightObstacle5        = (int)dbi_RightObstacle5.Value;
                CmcsCarModel.RightObstacle6        = (int)dbi_RightObstacle6.Value;
                CmcsCarModel.CarriageLength        = (int)dbi_CarriageLength.Value;
                CmcsCarModel.CarriageWidth         = (int)dbi_CarriageWidth.Value;
                CmcsCarModel.CarriageBottomToFloor = (int)dbi_CarriageBottomToFloor.Value;
                CmcsCarModel.ReMark = txt_ReMark.Text;
                Dbers.GetInstance().SelfDber.Update(CmcsCarModel);
            }
            else if (this.EditMode == eEditMode.新增)
            {
                CmcsCarModel                       = new CmcsCarModel();
                CmcsCarModel.ModelName             = txt_ModelName.Text;
                CmcsCarModel.LeftObstacle1         = (int)dbi_LeftObstacle1.Value;
                CmcsCarModel.LeftObstacle2         = (int)dbi_LeftObstacle2.Value;
                CmcsCarModel.LeftObstacle3         = (int)dbi_LeftObstacle3.Value;
                CmcsCarModel.LeftObstacle4         = (int)dbi_LeftObstacle4.Value;
                CmcsCarModel.LeftObstacle5         = (int)dbi_LeftObstacle5.Value;
                CmcsCarModel.LeftObstacle6         = (int)dbi_LeftObstacle6.Value;
                CmcsCarModel.RightObstacle1        = (int)dbi_RightObstacle1.Value;
                CmcsCarModel.RightObstacle2        = (int)dbi_RightObstacle2.Value;
                CmcsCarModel.RightObstacle3        = (int)dbi_RightObstacle3.Value;
                CmcsCarModel.RightObstacle4        = (int)dbi_RightObstacle4.Value;
                CmcsCarModel.RightObstacle5        = (int)dbi_RightObstacle5.Value;
                CmcsCarModel.RightObstacle6        = (int)dbi_RightObstacle6.Value;
                CmcsCarModel.CarriageLength        = (int)dbi_CarriageLength.Value;
                CmcsCarModel.CarriageWidth         = (int)dbi_CarriageWidth.Value;
                CmcsCarModel.CarriageBottomToFloor = (int)dbi_CarriageBottomToFloor.Value;
                CmcsCarModel.ReMark                = txt_ReMark.Text;
                Dbers.GetInstance().SelfDber.Insert(CmcsCarModel);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
예제 #12
0
        /// <summary>
        /// 发送采样计划
        /// </summary>
        /// <returns></returns>
        bool SendSamplingPlan()
        {
            InfBeltSamplePlan oldBeltSamplePlan = Dbers.GetInstance().SelfDber.Entity <InfBeltSamplePlan>("where InFactoryBatchId=:InFactoryBatchId and SampleCode=:SampleCode and MachineCode=:MachineCode", new { InFactoryBatchId = this.CurrentRCSampling.BatchId, SampleCode = this.CurrentRCSampling.SampleCode, MachineCode = this.CurrentSampleMachine.EquipmentName });

            if (oldBeltSamplePlan == null)
            {
                oldBeltSamplePlan                  = new InfBeltSamplePlan();
                oldBeltSamplePlan.DataFlag         = 0;
                oldBeltSamplePlan.InterfaceType    = this.CurrentSampleMachine.InterfaceType;
                oldBeltSamplePlan.InFactoryBatchId = this.CurrentRCSampling.BatchId;
                oldBeltSamplePlan.SampleCode       = this.CurrentRCSampling.SampleCode;
                oldBeltSamplePlan.FuelKindName     = this.CurrentRCSampling.FuelKindName;
                oldBeltSamplePlan.Mt               = 0;
                oldBeltSamplePlan.TicketWeight     = 0;
                oldBeltSamplePlan.GatherType       = "样桶";
                oldBeltSamplePlan.TrainCode        = ((ComboItem)cmbTrainCode.SelectedItem) != null ? ((ComboItem)cmbTrainCode.SelectedItem).Text : "";
                oldBeltSamplePlan.SampleType       = CurrentRCSampling.SamplingType;
                oldBeltSamplePlan.MachineCode      = CurrentSampleMachine.EquipmentCode;
                oldBeltSamplePlan.CarCount         = this.CurrentRCSampling.TransportNumber;
                //oldBeltSamplePlan.TrainCode = "#2";
                if (oldBeltSamplePlan.SampleType == eSamplingType.机械采样.ToString() || oldBeltSamplePlan.SampleType == eSamplingType.皮带采样.ToString())
                {
                    IList <CmcsTransport> transports = commonDAO.SelfDber.Entities <CmcsTransport>("where InFactoryBatchId=:InFactoryBatchId order by OrderNumber", new { InFactoryBatchId = CurrentRCSampling.BatchId });
                    foreach (CmcsTransport item in transports)
                    {
                        InfBeltSamplePlanDetail samplePlanDetail = new InfBeltSamplePlanDetail();
                        samplePlanDetail.PlanId      = oldBeltSamplePlan.Id;
                        samplePlanDetail.MchineCode  = this.CurrentSampleMachine.EquipmentCode;
                        samplePlanDetail.CarNumber   = item.TransportNo;
                        samplePlanDetail.OrderNumber = item.OrderNumber;
                        samplePlanDetail.SyncFlag    = 0;
                        samplePlanDetail.CarModel    = item.TrainType;
                        samplePlanDetail.CyCount     = Convert.ToInt32(this.cmbCYCount.Text);                    //(int)dbi_CyCount.Value;
                        //samplePlanDetail.TrainCode = "#2";
                        Dbers.GetInstance().SelfDber.Insert <InfBeltSamplePlanDetail>(samplePlanDetail);
                    }
                    commonDAO.SetSignalDataValue(this.CurrentSampleMachine.EquipmentName, eSignalDataName.矿发量.ToString(), transports.Sum(a => a.TicketQty).ToString());
                }
                commonDAO.SetSignalDataValue(this.CurrentSampleMachine.EquipmentName, eSignalDataName.采样编码.ToString(), this.CurrentRCSampling.SampleCode);

                return(Dbers.GetInstance().SelfDber.Insert <InfBeltSamplePlan>(oldBeltSamplePlan) > 0);
            }
            else
            {
                oldBeltSamplePlan.DataFlag     = 0;
                oldBeltSamplePlan.FuelKindName = this.CurrentRCSampling.FuelKindName;
                oldBeltSamplePlan.Mt           = 0;
                oldBeltSamplePlan.TicketWeight = 0;
                oldBeltSamplePlan.SampleType   = CurrentRCSampling.SamplingType;
                oldBeltSamplePlan.MachineCode  = CurrentSampleMachine.EquipmentCode;
                oldBeltSamplePlan.CarCount     = this.CurrentRCSampling.TransportNumber;
                oldBeltSamplePlan.TrainCode    = ((ComboItem)cmbTrainCode.SelectedItem) != null ? ((ComboItem)cmbTrainCode.SelectedItem).Text : "";
                oldBeltSamplePlan.SyncFlag     = 0;
                if (oldBeltSamplePlan.SampleType == eSamplingType.机械采样.ToString() || oldBeltSamplePlan.SampleType == eSamplingType.皮带采样.ToString())
                {
                    IList <CmcsTransport> transports = commonDAO.SelfDber.Entities <CmcsTransport>("where InFactoryBatchId=:InFactoryBatchId order by OrderNumber", new { InFactoryBatchId = CurrentRCSampling.BatchId });
                    foreach (CmcsTransport item in transports)
                    {
                        InfBeltSamplePlanDetail samplePlanDetail = commonDAO.SelfDber.Entity <InfBeltSamplePlanDetail>("where PlanId=:PlanId and CarNumber=:CarNumber order by OrderNumber", new { PlanId = oldBeltSamplePlan.Id, CarNumber = item.TransportNo });
                        if (samplePlanDetail == null)
                        {
                            samplePlanDetail             = new InfBeltSamplePlanDetail();
                            samplePlanDetail.PlanId      = oldBeltSamplePlan.Id;
                            samplePlanDetail.MchineCode  = this.CurrentSampleMachine.EquipmentCode;
                            samplePlanDetail.CarNumber   = item.TransportNo;
                            samplePlanDetail.OrderNumber = item.OrderNumber;
                            samplePlanDetail.SyncFlag    = 0;
                            samplePlanDetail.CarModel    = item.TrainType;
                            samplePlanDetail.CyCount     = Convert.ToInt32(this.cmbCYCount.Text);                        // (int)dbi_CyCount.Value;
                            //samplePlanDetail.TrainCode = "#2";
                            Dbers.GetInstance().SelfDber.Insert <InfBeltSamplePlanDetail>(samplePlanDetail);
                        }
                    }
                }
                return(Dbers.GetInstance().SelfDber.Update(oldBeltSamplePlan) > 0);
            }
        }
예제 #13
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtUserName.Text))
            {
                MessageBoxEx.Show("请输入用户昵称!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrEmpty(txtUserPassword.Text))
            {
                MessageBoxEx.Show("请输入用户密码!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrEmpty(txtUserAccount.Text))
            {
                MessageBoxEx.Show("请输入用户账号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                char illicitChar = ' ';
                if (!CheckIllicitAccount(txtUserAccount.Text.Trim(), ref illicitChar))
                {
                    MessageBoxEx.Show("帐号中存在非法字符" + illicitChar + "!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                CmcsUser entityCheck = Dbers.GetInstance().SelfDber.Entity <CmcsUser>("where UserName='******'");
                if ((this.cmcsUser != null && entityCheck != null && this.cmcsUser.Id != entityCheck.Id) || (this.cmcsUser == null && entityCheck != null))
                {
                    MessageBoxEx.Show("已经存在该账号的用户!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            if (this.cmcsUser == null)
            {
                // 新增
                CmcsUser entity = new CmcsUser();
                entity.UserName     = txtUserAccount.Text.Trim();
                entity.Name         = txtUserName.Text.Trim();
                entity.PassWord     = txtUserPassword.Text.Trim();
                entity.IsUse        = Convert.ToInt16(chbIsUse.Checked);
                entity.IsDeductUser = Convert.ToInt16(chbIsDeductUser.Checked);
                entity.IsSupper     = Convert.ToInt16(chbIsSupper.Checked);
                Dbers.GetInstance().SelfDber.Insert <CmcsUser>(entity);

                MessageBoxEx.Show("新增成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                txtUserAccount.Text  = string.Empty;
                txtUserName.Text     = string.Empty;
                txtUserPassword.Text = string.Empty;
            }
            else
            {
                // 修改
                this.cmcsUser.Name         = txtUserName.Text.Trim();
                this.cmcsUser.PassWord     = txtUserPassword.Text.Trim();
                this.cmcsUser.IsUse        = Convert.ToInt16(chbIsUse.Checked);
                this.cmcsUser.IsDeductUser = Convert.ToInt16(chbIsDeductUser.Checked);
                this.cmcsUser.IsSupper     = Convert.ToInt16(chbIsSupper.Checked);

                Dbers.GetInstance().SelfDber.Update(this.cmcsUser);

                MessageBoxEx.Show("修改成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnCancel_Click(null, null);
            }
        }
예제 #14
0
 /// <summary>
 /// 历史制样记录分页查询
 /// </summary>
 /// <param name="PageSize">每页显示条数</param>
 /// <param name="CurrentIndex">当前页索引</param>
 /// <param name="sqlWhere">sql条件</param>
 /// <returns></returns>
 public List <InfMakerRecord> ExecutePager(int PageSize, int CurrentIndex, string sqlWhere)
 {
     return(Dbers.GetInstance().SelfDber.ExecutePager <InfMakerRecord>(PageSize, CurrentIndex, sqlWhere + " order by CreateDate desc"));
 }
예제 #15
0
        /// <summary>
        /// 根据采样id获取制样记录
        /// </summary>
        /// <param name="sampleId"></param>
        /// <returns></returns>
        public CmcsRCMake GetRCMakeBySampleId(string sampleId)
        {
            CmcsRCMake rcmake = Dbers.GetInstance().SelfDber.Entity <CmcsRCMake>("where SamplingId=:SamplingId and IsDeleted=0", new { SamplingId = sampleId });

            return(rcmake);
        }
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (this.EditMode == eEditMode.修改)
            {
                CmcsBuyFuelTransport.SerialNumber = txt_SerialNumber.Text;
                CmcsBuyFuelTransport.CarNumber    = txt_CarNumber.Text;
                if (cmcsSupplier != null)
                {
                    CmcsBuyFuelTransport.SupplierId   = cmcsSupplier.Id;
                    CmcsBuyFuelTransport.SupplierName = cmcsSupplier.Name;
                }
                if (cmcsTransportCompany != null)
                {
                    CmcsBuyFuelTransport.TransportCompanyId   = cmcsTransportCompany.Id;
                    CmcsBuyFuelTransport.TransportCompanyName = cmcsTransportCompany.Name;
                }
                if (cmcsMine != null)
                {
                    CmcsBuyFuelTransport.MineId   = cmcsMine.Id;
                    CmcsBuyFuelTransport.MineName = cmcsMine.Name;
                }
                if (cmcsFuelKind != null)
                {
                    CmcsBuyFuelTransport.FuelKindId   = cmcsFuelKind.Id;
                    CmcsBuyFuelTransport.FuelKindName = cmcsFuelKind.Name;
                }
                CmcsBuyFuelTransport.TicketWeight = (decimal)dbi_TicketWeight.Value;
                CmcsBuyFuelTransport.GrossWeight  = (decimal)dbi_GrossWeight.Value;
                CmcsBuyFuelTransport.DeductWeight = (decimal)dbi_DeductWeight.Value;
                CmcsBuyFuelTransport.TareWeight   = (decimal)dbi_TareWeight.Value;
                CmcsBuyFuelTransport.SuttleWeight = (decimal)dbi_SuttleWeight.Value;

                CmcsBuyFuelTransport.InFactoryTime  = txt_InFactoryTime.Value;
                CmcsBuyFuelTransport.SamplingTime   = txt_SamplingTime.Value;
                CmcsBuyFuelTransport.GrossTime      = txt_GrossTime.Value;
                CmcsBuyFuelTransport.UploadTime     = txt_UploadTime.Value;
                CmcsBuyFuelTransport.TareTime       = txt_TareTime.Value;
                CmcsBuyFuelTransport.OutFactoryTime = txt_OutFactoryTime.Value;

                CmcsBuyFuelTransport.Remark   = txt_Remark.Text;
                CmcsBuyFuelTransport.IsFinish = (chb_IsFinish.Checked ? 1 : 0);
                CmcsBuyFuelTransport.IsUse    = (chb_IsUse.Checked ? 1 : 0);
                CmcsBuyFuelTransport.StepName = cmbStepName.Text;

                CmcsUnFinishTransport unfinishTransport = Dbers.GetInstance().SelfDber.Entity <CmcsUnFinishTransport>(" where TransportId= '" + CmcsBuyFuelTransport.Id + "'");

                //有效并且未完成时需要存在[未完成运输记录]
                if (chb_IsUse.Checked && !chb_IsFinish.Checked)
                {
                    if (unfinishTransport == null)
                    {
                        unfinishTransport = new CmcsUnFinishTransport()
                        {
                            TransportId = CmcsBuyFuelTransport.Id,
                            CarType     = eCarType.入厂煤.ToString(),
                            AutotruckId = CmcsBuyFuelTransport.AutotruckId,
                            PrevPlace   = CommonAppConfig.GetInstance().AppIdentifier
                        };
                        Dbers.GetInstance().SelfDber.Insert(unfinishTransport);
                    }
                }
                //无效或者是完成时需要删除[未完成运输记录]
                if (!chb_IsUse.Checked || chb_IsFinish.Checked)
                {
                    if (unfinishTransport != null)
                    {
                        Dbers.GetInstance().SelfDber.Delete <CmcsUnFinishTransport>(unfinishTransport.Id);
                    }
                }

                // 生成批次以及采制化三级编码数据
                //CmcsInFactoryBatch inFactoryBatch = carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(CmcsBuyFuelTransport);
                //if (inFactoryBatch != null)
                //{
                //commonDAO.SaveModifyLog<CmcsBuyFuelTransport>(CmcsBuyFuelTransport, CmcsBuyFuelTransport.Id, "入厂煤运输记录", GlobalVars.LoginUser != null ? GlobalVars.LoginUser.UserName : "******");

                Dbers.GetInstance().SelfDber.Update(CmcsBuyFuelTransport, GlobalVars.LoginUser != null ? GlobalVars.LoginUser.UserName : "******");
                //}
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
예제 #17
0
        /// <summary>
        /// 导入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImport_Click(object sender, EventArgs e)
        {
            int res = 0;

            try
            {
                openFileDialog1.Filter = "(*.xlsx)|*.xlsx|(*.xls)|*.xls";
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    //获取用户选择文件的后缀名
                    string extension = Path.GetExtension(openFileDialog1.FileName);
                    //声明允许的后缀名
                    string[] str = new string[] { ".xls", ".xlsx" };
                    if (!str.Contains(extension))
                    {
                        MessageBoxEx.Show("仅能导入xls,xlsx格式的文件!");
                        return;
                    }

                    DataTable data = CommonDAO.GetInstance().GetExcelDatatable(openFileDialog1.FileName, "ImportTable");

                    if (data != null && data.Rows.Count > 0)
                    {
                        foreach (DataRow item in data.Rows)
                        {
                            string carNumber = item[0] != DBNull.Value ? item[0].ToString() : "";
                            if (string.IsNullOrEmpty(carNumber) || carNumber.Length != 7)
                            {
                                Log4Neter.Info(string.Format("车牌号:{0}导入失败,车牌号格式不正确。", carNumber));
                                continue;
                            }
                            //车号
                            CmcsAutotruck autoTruck = CommonDAO.GetInstance().SelfDber.Entity <CmcsAutotruck>("where CarNumber=:CarNumber", new { CarNumber = carNumber });
                            if (autoTruck == null)
                            {
                                autoTruck           = new CmcsAutotruck();
                                autoTruck.CarNumber = carNumber;
                                autoTruck.CarType   = eCarType.入厂煤.ToString();
                                autoTruck.IsUse     = 1;

                                autoTruck.Driver                = item[1] != DBNull.Value ? item[1].ToString() : "";
                                autoTruck.CellPhoneNumber       = item[2] != DBNull.Value ? item[2].ToString() : "";
                                autoTruck.CarriageTotalLength   = item[3] != DBNull.Value ? Convert.ToInt32(item[3]) : 0;
                                autoTruck.CarriageLength        = item[4] != DBNull.Value ? Convert.ToInt32(item[4]) : 0;
                                autoTruck.CarriageWidth         = item[5] != DBNull.Value ? Convert.ToInt32(item[5]) : 0;
                                autoTruck.CarriageHeight        = item[6] != DBNull.Value ? Convert.ToInt32(item[6]) : 0;
                                autoTruck.CarriageBottomToFloor = item[7] != DBNull.Value ? Convert.ToInt32(item[7]) : 0;
                                autoTruck.LeftObstacle1         = item[8] != DBNull.Value ? Convert.ToInt32(item[8]) : 0;
                                autoTruck.LeftObstacle2         = item[9] != DBNull.Value ? Convert.ToInt32(item[9]) : 0;
                                autoTruck.LeftObstacle3         = item[10] != DBNull.Value ? Convert.ToInt32(item[10]) : 0;
                                autoTruck.LeftObstacle4         = item[11] != DBNull.Value ? Convert.ToInt32(item[11]) : 0;
                                autoTruck.LeftObstacle5         = item[12] != DBNull.Value ? Convert.ToInt32(item[12]) : 0;
                                autoTruck.LeftObstacle6         = item[13] != DBNull.Value ? Convert.ToInt32(item[13]) : 0;
                                autoTruck.ReMark                = item[14] != DBNull.Value ? item[14].ToString() : "";
                                autoTruck.IsSynch               = 0;
                                res += Dbers.GetInstance().SelfDber.Insert(autoTruck);
                            }
                            else
                            {
                                autoTruck.Driver                = item[1] != DBNull.Value ? item[1].ToString() : "";
                                autoTruck.CellPhoneNumber       = item[2] != DBNull.Value ? item[2].ToString() : "";
                                autoTruck.CarriageTotalLength   = item[3] != DBNull.Value ? Convert.ToInt32(item[3]) : 0;
                                autoTruck.CarriageLength        = item[4] != DBNull.Value ? Convert.ToInt32(item[4]) : 0;
                                autoTruck.CarriageWidth         = item[5] != DBNull.Value ? Convert.ToInt32(item[5]) : 0;
                                autoTruck.CarriageHeight        = item[6] != DBNull.Value ? Convert.ToInt32(item[6]) : 0;
                                autoTruck.CarriageBottomToFloor = item[7] != DBNull.Value ? Convert.ToInt32(item[7]) : 0;
                                autoTruck.LeftObstacle1         = item[8] != DBNull.Value ? Convert.ToInt32(item[8]) : 0;
                                autoTruck.LeftObstacle2         = item[9] != DBNull.Value ? Convert.ToInt32(item[9]) : 0;
                                autoTruck.LeftObstacle3         = item[10] != DBNull.Value ? Convert.ToInt32(item[10]) : 0;
                                autoTruck.LeftObstacle4         = item[11] != DBNull.Value ? Convert.ToInt32(item[11]) : 0;
                                autoTruck.LeftObstacle5         = item[12] != DBNull.Value ? Convert.ToInt32(item[12]) : 0;
                                autoTruck.LeftObstacle6         = item[13] != DBNull.Value ? Convert.ToInt32(item[13]) : 0;
                                autoTruck.ReMark                = item[14] != DBNull.Value ? item[14].ToString() : "";
                                autoTruck.IsSynch               = 0;
                                res += Dbers.GetInstance().SelfDber.Update(autoTruck);
                            }
                        }
                    }
                    MessageBoxEx.Show("成功导入" + res + "条信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    btnSearch_Click(null, null);
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show("导入失败\r\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #18
0
        /// <summary>
        /// 同步采样计划
        /// </summary>
        /// <param name="output"></param>
        /// <param name="MachineCode">设备编码</param>
        public void SyncSamplePlan(Action <string, eOutputType> output)
        {
            int res = 0;

            // 集中管控 > 第三方
            foreach (InfBeltSamplePlan entity in BeltSamplerDAO.GetInstance().GetWaitForSyncBeltSamplePlan(this.MachineCode))
            {
                bool isSuccess = false;
                // 需调整:命令中的水分等信息视接口而定
                EquHCQSCYJPlan samplecmdEqu = this.EquDber.Get <EquHCQSCYJPlan>(entity.Id);
                if (samplecmdEqu == null)
                {
                    isSuccess = this.EquDber.Insert(new EquHCQSCYJPlan
                    {
                        // 保持相同的Id
                        Id               = entity.Id,
                        SampleCode       = entity.SampleCode,
                        MachineCode      = this.MachineCode,
                        TrainCode        = entity.TrainCode,
                        InFactoryBatchId = entity.InFactoryBatchId,
                        TicketWeight     = entity.TicketWeight,
                        CarCount         = entity.CarCount,
                        Mt               = entity.Mt,
                        DataFlag         = 0
                    }) > 0;
                }
                else
                {
                    samplecmdEqu.SampleCode       = entity.SampleCode;
                    samplecmdEqu.MachineCode      = this.MachineCode;
                    samplecmdEqu.TrainCode        = entity.TrainCode;
                    samplecmdEqu.InFactoryBatchId = entity.InFactoryBatchId;
                    samplecmdEqu.TicketWeight     = entity.TicketWeight;
                    samplecmdEqu.CarCount         = entity.CarCount;
                    samplecmdEqu.Mt       = entity.Mt;
                    samplecmdEqu.DataFlag = 0;
                    isSuccess             = this.EquDber.Update(samplecmdEqu) > 0;
                }

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

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


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

                //samplecmdInf.Point1 = entity.Point1;
                //samplecmdInf.Point2 = entity.Point2;
                //samplecmdInf.Point3 = entity.Point3;
                //samplecmdInf.Point4 = entity.Point4;
                //samplecmdInf.Point5 = entity.Point5;
                //samplecmdInf.Point6 = entity.Point6;
                samplecmdInf.StartTime  = entity.StartTime;
                samplecmdInf.EndTime    = entity.EndTime;
                samplecmdInf.SampleUser = entity.SampleUser;

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

                    res++;
                }
            }
            output(string.Format("同步采样计划 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
        }
예제 #19
0
        public void BindData()
        {
            listCount.Clear();
            string tempSqlWhere = this.SqlWhere;
            List <CmcsBuyFuelTransport> list = Dbers.GetInstance().SelfDber.Entities <CmcsBuyFuelTransport>(tempSqlWhere + " order by SerialNumber desc");

            var minename = from p in list group p by new { p.MineName } into g select new { MineName = g.Key.MineName };

            foreach (var item in minename)
            {
                List <CmcsBuyFuelTransport> listone = list.Where(a => a.MineName == item.MineName).ToList();
                if (listone != null && listone.Count > 0)
                {
                    CmcsBuyFuelTransport entity = new CmcsBuyFuelTransport();
                    entity.MineName     = listone[0].MineName;
                    entity.FuelKindName = listone[0].FuelKindName;
                    entity.TicketWeight = listone.Sum(a => a.TicketWeight);
                    entity.GrossWeight  = listone.Sum(a => a.GrossWeight);
                    entity.TareWeight   = listone.Sum(a => a.TareWeight);
                    entity.SuttleWeight = listone.Sum(a => a.SuttleWeight);
                    entity.DeductWeight = listone.Sum(a => a.DeductWeight);
                    entity.KsWeight     = listone.Sum(a => a.AutoKsWeight + a.KsWeight);
                    entity.KgWeight     = listone.Sum(a => a.KgWeight);
                    entity.CheckWeight  = listone.Sum(a => a.CheckWeight);
                    entity.IsFinish     = listone.Count;//把车数放到完成状态,用来过渡数据
                    listCount.Add(entity);
                }
            }
            listCount.OrderBy(a => a.MineName);
            if (chkFuelKindTotal.Checked && !chkMineTotal.Checked)
            {
                var fuelname = from p in list group p by new { p.FuelKindName } into g select new { FuelKindName = g.Key.FuelKindName };
                listCount.Clear();
                foreach (var item in fuelname)
                {
                    List <CmcsBuyFuelTransport> listone = list.Where(a => a.FuelKindName == item.FuelKindName).ToList();
                    if (listone != null && listone.Count > 0)
                    {
                        CmcsBuyFuelTransport entity = new CmcsBuyFuelTransport();
                        entity.MineName     = listone[0].MineName;
                        entity.FuelKindName = listone[0].FuelKindName;
                        entity.TicketWeight = listone.Sum(a => a.TicketWeight);
                        entity.GrossWeight  = listone.Sum(a => a.GrossWeight);
                        entity.TareWeight   = listone.Sum(a => a.TareWeight);
                        entity.SuttleWeight = listone.Sum(a => a.SuttleWeight);
                        entity.DeductWeight = listone.Sum(a => a.DeductWeight);
                        entity.KsWeight     = listone.Sum(a => a.AutoKsWeight + a.KsWeight);
                        entity.KgWeight     = listone.Sum(a => a.KgWeight);
                        entity.CheckWeight  = listone.Sum(a => a.CheckWeight);
                        entity.IsFinish     = listone.Count;//把车数放到完成状态,用来过渡数据
                        listCount.Add(entity);
                    }
                }
                listCount.OrderBy(a => a.FuelKindName);
            }
            else if (chkMineTotal.Checked && chkFuelKindTotal.Checked)
            {
                var minefuelname = from p in list group p by new { p.MineName, p.FuelKindName } into g select new { MineName = g.Key.MineName, FuelKindName = g.Key.FuelKindName };
                listCount.Clear();
                foreach (var item in minefuelname)
                {
                    List <CmcsBuyFuelTransport> listone = list.Where(a => a.MineName == item.MineName && a.FuelKindName == item.FuelKindName).ToList();
                    if (listone != null && listone.Count > 0)
                    {
                        CmcsBuyFuelTransport entity = new CmcsBuyFuelTransport();
                        entity.MineName     = listone[0].MineName;
                        entity.FuelKindName = listone[0].FuelKindName;
                        entity.TicketWeight = listone.Sum(a => a.TicketWeight);
                        entity.GrossWeight  = listone.Sum(a => a.GrossWeight);
                        entity.TareWeight   = listone.Sum(a => a.TareWeight);
                        entity.SuttleWeight = listone.Sum(a => a.SuttleWeight);
                        entity.DeductWeight = listone.Sum(a => a.DeductWeight);
                        entity.KsWeight     = listone.Sum(a => a.AutoKsWeight + a.KsWeight);
                        entity.KgWeight     = listone.Sum(a => a.KgWeight);
                        entity.CheckWeight  = listone.Sum(a => a.CheckWeight);
                        entity.IsFinish     = listone.Count;//把车数放到完成状态,用来过渡数据
                        listCount.Add(entity);
                    }
                }
                listCount.OrderBy(a => a.MineName).OrderBy(a => a.FuelKindName);
            }


            CmcsBuyFuelTransport listTotal1 = new CmcsBuyFuelTransport();

            listTotal1.MineName     = "合计";
            listTotal1.FuelKindName = "";
            listTotal1.TicketWeight = list.Sum(a => a.TicketWeight);
            listTotal1.GrossWeight  = list.Sum(a => a.GrossWeight);
            listTotal1.TareWeight   = list.Sum(a => a.TareWeight);
            listTotal1.SuttleWeight = list.Sum(a => a.SuttleWeight);
            listTotal1.DeductWeight = list.Sum(a => a.DeductWeight);
            listTotal1.KsWeight     = list.Sum(a => a.AutoKsWeight + a.KsWeight);
            listTotal1.KgWeight     = list.Sum(a => a.KgWeight);
            listTotal1.CheckWeight  = list.Sum(a => a.CheckWeight);
            listTotal1.IsFinish     = list.Count;//车数
            listCount.Add(listTotal1);

            superGridControl1.PrimaryGrid.DataSource = listCount;
        }
예제 #20
0
        /// <summary>
        /// 同步采样计划明细
        /// </summary>
        /// <param name="output"></param>
        /// <param name="MachineCode">设备编码</param>
        public void SyncSamplePlanDetail(Action <string, eOutputType> output)
        {
            int res = 0;

            // 集中管控 > 第三方
            foreach (InfBeltSamplePlanDetail entity in BeltSamplerDAO.GetInstance().GetWaitForSyncBeltSamplePlanDetail(this.MachineCode))
            {
                bool isSuccess = false;
                EquHCQSCYJPlanDetail samplecmdEqu = this.EquDber.Get <EquHCQSCYJPlanDetail>(entity.Id);
                if (samplecmdEqu == null)
                {
                    isSuccess = this.EquDber.Insert(new EquHCQSCYJPlanDetail
                    {
                        // 保持相同的Id
                        Id          = entity.Id,
                        PlanId      = entity.PlanId,
                        MachineCode = this.MachineCode,
                        CarNumber   = entity.CarNumber,
                        CarModel    = entity.CarModel.Substring(0, 3),
                        CyCount     = entity.CyCount,
                        OrderNumber = entity.OrderNumber,
                        DataFlag    = 0
                    }) > 0;
                }
                else
                {
                    samplecmdEqu.PlanId      = entity.PlanId;
                    samplecmdEqu.MachineCode = this.MachineCode;
                    samplecmdEqu.CarNumber   = entity.CarNumber;
                    samplecmdEqu.CarModel    = entity.CarModel.Substring(0, 3);
                    samplecmdEqu.CyCount     = entity.CyCount;
                    samplecmdEqu.OrderNumber = entity.OrderNumber;
                    //samplecmdEqu.DataFlag = 0;
                    isSuccess = this.EquDber.Update(samplecmdEqu) > 0;
                }

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

                    res++;
                }
            }
            output(string.Format("同步采样计划明细 {0} 条(集中管控 > 第三方)", res), eOutputType.Normal);


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

                //samplecmdInf.Point1 = entity.Point1;
                //samplecmdInf.Point2 = entity.Point2;
                //samplecmdInf.Point3 = entity.Point3;
                //samplecmdInf.Point4 = entity.Point4;
                //samplecmdInf.Point5 = entity.Point5;
                //samplecmdInf.Point6 = entity.Point6;
                samplecmdInf.StartTime  = entity.StartTime;
                samplecmdInf.EndTime    = entity.EndTime;
                samplecmdInf.SampleUser = entity.SampleUser;

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

                    res++;
                }
            }
            output(string.Format("同步采样计划明细 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
        }
예제 #21
0
        private void makeImage(object sender, PrintPageEventArgs e)
        {
            Font fontTitle = new Font("黑体", instance.FontSize, FontStyle.Bold, GraphicsUnit.Pixel);
            CmcsBuyFuelTransport entity = this.cmcsSupplier;


            CmcsRCMakeDetail makedetail = Dbers.GetInstance().SelfDber.Entities <CmcsRCMakeDetail>(" where BarrelCode=:BarrelCode", new { BarrelCode = barrelCode }).FirstOrDefault();

            if (makedetail == null)
            {
                return;
            }

            Graphics g;
            Bitmap   result = new Bitmap(600, 600);

            if (e == null)
            {
                g = Graphics.FromImage(result);
                g.FillRectangle(new SolidBrush(System.Drawing.Color.White), 0, 0, result.Width, result.Height);
            }
            else
            {
                g = e.Graphics;
            }

            // 行间距 30
            float  TopValue = 0;
            Bitmap bmp      = null;

            QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();

            qrCodeEncoder.QRCodeEncodeMode   = QRCodeEncoder.ENCODE_MODE.BYTE;
            qrCodeEncoder.QRCodeScale        = instance.ImgSize;
            qrCodeEncoder.QRCodeVersion      = 0;
            qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
            bmp = qrCodeEncoder.Encode(barrelCode);

            string printValue = "";

            g.DrawImage(bmp, instance.ImgLeftPadding, instance.ImgTopPadding);
            TopValue = instance.ImgTopPadding + bmp.Height + instance.CharToImg;
            TopValue = instance.CharToImg;
            float leftValue = instance.ImgLeftPadding + bmp.Width + instance.CharLeftPadding;

            printValue = "样品编码:" + makedetail.BarrelCode;
            TopValue   = DrawContent(fontTitle, g, TopValue, printValue, leftValue);

            printValue = "样品类型:" + makedetail.SampleType;
            TopValue   = DrawContent(fontTitle, g, TopValue, printValue, leftValue);

            printValue = "装罐时间:" + makedetail.CreateDate.ToString("yyyyMMdd");
            TopValue   = DrawContent(fontTitle, g, TopValue, printValue, leftValue);


            printValue = "样    重:" + (makedetail.Weight == 0 ? "0.00" : makedetail.Weight.ToString()) + " g";
            TopValue   = DrawContent(fontTitle, g, TopValue, printValue, leftValue);

            if (e == null)
            {
                this.pictureBox1.Image = result;
                g.Dispose();
            }
        }
예제 #22
0
        /// <summary>
        /// 同步采样命令
        /// </summary>
        /// <param name="output"></param>
        /// <param name="MachineCode">设备编码</param>
        public void SyncSampleCmd(Action <string, eOutputType> output)
        {
            int res = 0;

            // 集中管控 > 第三方
            foreach (InfBeltSampleCmd entity in BeltSamplerDAO.GetInstance().GetWaitForSyncBeltSampleCmd(this.MachineCode))
            {
                bool isSuccess = false;
                // 需调整:命令中的水分等信息视接口而定
                EquHCQSCYJSampleCmd samplecmdEqu = this.EquDber.Get <EquHCQSCYJSampleCmd>(entity.Id);
                if (samplecmdEqu == null)
                {
                    isSuccess = this.EquDber.Insert(new EquHCQSCYJSampleCmd
                    {
                        // 保持相同的Id
                        Id          = entity.Id,
                        SampleCode  = entity.SampleCode,
                        CmdCode     = entity.CmdCode,
                        ResultCode  = entity.ResultCode,
                        MachineCode = this.MachineCode,
                        DataFlag    = 0
                    }) > 0;
                }
                else
                {
                    samplecmdEqu.SampleCode = entity.SampleCode;
                    samplecmdEqu.CmdCode    = entity.CmdCode;
                    samplecmdEqu.ResultCode = entity.ResultCode;
                    samplecmdEqu.DataFlag   = 0;
                    isSuccess = this.EquDber.Update(samplecmdEqu) > 0;
                }

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

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


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

                //samplecmdInf.Point1 = entity.Point1;
                //samplecmdInf.Point2 = entity.Point2;
                //samplecmdInf.Point3 = entity.Point3;
                //samplecmdInf.Point4 = entity.Point4;
                //samplecmdInf.Point5 = entity.Point5;
                //samplecmdInf.Point6 = entity.Point6;
                if (entity.ResultCode.Contains("失败"))
                {
                    samplecmdInf.ResultCode = eEquInfCmdResultCode.失败.ToString();
                    commonDAO.SaveEquInfHitch(this.MachineCode, DateTime.Now, entity.ResultCode);
                }
                else
                {
                    samplecmdInf.ResultCode = entity.ResultCode;
                }

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

                    res++;
                }
            }
            output(string.Format("同步采样计划 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
        }
예제 #23
0
        /// <summary>
        /// 发送卸样命令
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSendLoadCmd_Click(object sender, EventArgs e)
        {
            if (this.currentEquInfSampleBarrels.Count == 0 || string.IsNullOrEmpty(this.currentSampleCode))
            {
                MessageBoxEx.Show("请选择集样罐再发送", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (!CheckBeltSampleBarrelUpdated())
            {
                MessageBoxEx.Show("集样罐已更新,请刷新样罐信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                LoadSampleBarrel(superGridControl1, this.CurrentSampler.EquipmentCode);
                return;
            }
            if (currentRCSampling == null)
            {
                MessageBoxEx.Show("请勾选绑定的采样单后再发送", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // 检测采样机系统的状态
            string samplerSystemStatue = commonDAO.GetSignalDataValue(this.CurrentSampler.EquipmentCode, eSignalDataName.系统.ToString());

            if (samplerSystemStatue != eEquInfSamplerSystemStatus.就绪待机.ToString())
            {
                MessageBoxEx.Show("采样机系统未就绪,禁止卸样", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // 检测制样机系统状态
            string makerSystemStatus = commonDAO.GetSignalDataValue(this.makerMachineCode, eSignalDataName.系统.ToString());

            if (rbtnToMaker.Checked && makerSystemStatus != eEquInfSamplerSystemStatus.就绪待机.ToString())
            {
                MessageBoxEx.Show("制样机系统未就绪,禁止卸样", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string message = string.Empty;

            if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(this.CurrentSampler.Parentid).EquipmentCode == "皮带采样机")
            {
                if (!beltSamplerDAO.CanSendSampleUnloadCmd(this.CurrentSampler.EquipmentCode, out message))
                {
                    MessageBoxEx.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (HandleWhetherSampleUnloadCmd(this.CurrentSampler))
                {
                    SendBeltSamplerUnloadCmd();
                }
            }
            else if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(this.CurrentSampler.Parentid).EquipmentCode == "汽车机械采样机")
            {
                if (!qcjxcySamplerDAO.CanSendSampleUnloadCmd(this.CurrentSampler.EquipmentCode, out message))
                {
                    MessageBoxEx.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (HandleWhetherSampleUnloadCmd(this.CurrentSampler))
                {
                    SendJxSamplerUnloadCmd();
                }
            }
            else
            {
                MessageBoxEx.Show("无此编码类型,请查证\"皮带采样机\"和\"汽车机械采样机\"类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
        private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsBuyFuelTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsBuyFuelTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name)
            {
            case "clmShow":
                FrmBuyFuelTransport_Oper frmShow = new FrmBuyFuelTransport_Oper(entity.Id, eEditMode.查看);
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmEdit":
                FrmBuyFuelTransport_Oper frmEdit = new FrmBuyFuelTransport_Oper(entity.Id, eEditMode.修改);
                if (frmEdit.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmDelete":
                // 查询正在使用该记录的车数
                if (MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        string logValue = "删除运输记录:" + Environment.NewLine;
                        logValue += "车号:" + entity.CarNumber + Environment.NewLine;
                        logValue += "矿点:" + entity.MineName + "   煤种:" + entity.FuelKindName + Environment.NewLine;
                        logValue += "入厂时间:" + entity.InFactoryTime + "   矿发量:" + entity.TicketWeight + Environment.NewLine;
                        logValue += "毛重时间:" + entity.GrossTime + "   毛重:" + entity.GrossWeight + Environment.NewLine;
                        logValue += "皮重时间:" + entity.TareTime + "   皮重:" + entity.TareWeight + Environment.NewLine;
                        logValue += "扣矸:" + entity.KgWeight + "   扣水:" + entity.KsWeight + "   自动扣水:" + entity.AutoKsWeight + Environment.NewLine;
                        logValue += "出厂时间:" + entity.OutFactoryTime + "   验收量:" + entity.CheckWeight + Environment.NewLine;
                        logValue += "修改人:" + SelfVars.LoginUser.UserName;
                        CommonDAO.GetInstance().SaveAppletLog(eAppletLogLevel.Info, "删除运输记录", logValue, SelfVars.LoginUser.UserAccount);
                        CommonDAO.GetInstance().SaveHandleEvent("删除入厂煤运输记录", entity.Id);
                        Dbers.GetInstance().SelfDber.Delete <CmcsBuyFuelTransport>(entity.Id);
                        Dbers.GetInstance().SelfDber.DeleteBySQL <CmcsUnFinishTransport>("where TransportId=:TransportId", new { TransportId = entity.Id });
                    }
                    catch (Exception)
                    {
                        MessageBoxEx.Show("该记录正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    BindData();
                }
                break;

            case "clmPic":

                if (Dbers.GetInstance().SelfDber.Entities <CmcsTransportPicture>(String.Format(" where TransportId='{0}'", entity.Id)).Count > 0)
                {
                    FrmTransportPicture frmPic = new FrmTransportPicture(entity.Id, entity.CarNumber);
                    if (frmPic.ShowDialog() == DialogResult.OK)
                    {
                        BindData();
                    }
                }
                else
                {
                    MessageBoxEx.Show("暂无抓拍图片!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                break;
            }
        }
예제 #25
0
 /// <summary>
 /// 获取待同步到第三方接口的卸样命令
 /// </summary>
 /// <param name="interfaceType">接口类型</param>
 /// <returns></returns>
 public List <InfQCJXCYUnLoadCMD> GetWaitForSyncQCJXCYSampleUnloadCmd(string interfaceType)
 {
     return(Dbers.GetInstance().SelfDber.Entities <InfQCJXCYUnLoadCMD>("where InterfaceType=:InterfaceType and SyncFlag=0", new { InterfaceType = interfaceType }));
 }
예제 #26
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().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);
                }
            }
        }
예제 #27
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (this.EditMode == eEditMode.修改)
            {
                CmcsGoodsTransport.FirstWeight  = (decimal)dbi_FirstWeight.Value;
                CmcsGoodsTransport.SecondWeight = (decimal)dbi_SecondWeight.Value;
                CmcsGoodsTransport.SuttleWeight = (decimal)dbi_SuttleWeight.Value;
                if (this.SupplyUnit != null)
                {
                    CmcsGoodsTransport.SupplyUnitId   = this.SupplyUnit.Id;
                    CmcsGoodsTransport.SupplyUnitName = this.SupplyUnit.Name;
                }
                if (this.ReceiveUnit != null)
                {
                    CmcsGoodsTransport.ReceiveUnitId   = this.ReceiveUnit.Id;
                    CmcsGoodsTransport.ReceiveUnitName = this.ReceiveUnit.Name;
                }
                if (cmcsGoodsType != null)
                {
                    CmcsGoodsTransport.GoodsTypeId   = cmcsGoodsType.Id;
                    CmcsGoodsTransport.GoodsTypeName = cmcsGoodsType.GoodsName;
                }
                CmcsGoodsTransport.InFactoryTime  = txt_InFactoryTime.Value;
                CmcsGoodsTransport.OutFactoryTime = txt_OutFactoryTime.Value;
                CmcsGoodsTransport.FirstTime      = txt_FirstTime.Value;
                CmcsGoodsTransport.SecondTime     = txt_SecondTime.Value;
                CmcsGoodsTransport.Remark         = txt_Remark.Text;
                CmcsGoodsTransport.IsFinish       = (chb_IsFinish.Checked ? 1 : 0);
                CmcsGoodsTransport.IsUse          = (chb_IsUse.Checked ? 1 : 0);
                CmcsGoodsTransport.StepName       = cmbStepName.Text;

                CmcsUnFinishTransport unfinishTransport = Dbers.GetInstance().SelfDber.Entity <CmcsUnFinishTransport>(" where TransportId= '" + CmcsGoodsTransport.Id + "'");

                //有效并且未完成时需要存在[未完成运输记录]
                if (chb_IsUse.Checked && !chb_IsFinish.Checked)
                {
                    if (unfinishTransport == null)
                    {
                        unfinishTransport = new CmcsUnFinishTransport()
                        {
                            TransportId = CmcsGoodsTransport.Id,
                            CarType     = eCarType.其他物资.ToString(),
                            AutotruckId = CmcsGoodsTransport.AutotruckId,
                            PrevPlace   = CommonAppConfig.GetInstance().AppIdentifier
                        };
                        Dbers.GetInstance().SelfDber.Insert(unfinishTransport);
                    }
                }
                //无效或者是完成时需要删除[未完成运输记录]
                if (!chb_IsUse.Checked || chb_IsFinish.Checked)
                {
                    if (unfinishTransport != null)
                    {
                        Dbers.GetInstance().SelfDber.Delete <CmcsUnFinishTransport>(unfinishTransport.Id);
                    }
                }

                Dbers.GetInstance().SelfDber.Update(CmcsGoodsTransport);
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
예제 #28
0
        public void SyncDoorEventData(Action <string, eOutputType> output)
        {
            int res = 0;

            try
            {
                List <Dictionary <string, object> > acsEventList = new List <Dictionary <string, object> >();
                List <string> cameraNameList = new List <string>();

                DoorEventRequest doorEventRequest = new DoorEventRequest()
                {
                    startTime = DateTime.Now.AddDays(-10),
                    endTime   = DateTime.Now,
                    pageNo    = 1,
                    pageSize  = 1000
                };

                string uri  = "/artemis/api/acs/v1/door/events";
                string body = JsonHelper.SerializeObject(doorEventRequest);

                byte[] resultByte = HttpUtillib.HttpPost(uri, body, 20);
                string resultStr  = Encoding.UTF8.GetString(resultByte);

                Result result = JsonHelper.DeserializeJsonToObject <Result>(resultStr);

                if (result.Code.Equals("0"))
                {
                    ResultData resultData = JsonHelper.DeserializeJsonToObject <ResultData>(result.Data.ToString());

                    acsEventList = JsonHelper.DeserializeJsonToObject <List <Dictionary <string, object> > >(resultData.List.ToString());

                    foreach (Dictionary <string, object> doorEvents in acsEventList)
                    {
                        int    eventType  = Convert.ToInt32(doorEvents["eventType"]);
                        string personName = doorEvents["personName"].ToString();

                        //只处理成功的事件
                        if (dicEventType.ContainsKey(eventType) && !string.IsNullOrWhiteSpace(personName))
                        {
                            string   eventId       = doorEvents["eventId"].ToString();
                            DateTime eventTime     = DateTime.Parse(doorEvents["eventTime"].ToString());
                            string   personId      = doorEvents["personId"].ToString();
                            string   doorIndexCode = doorEvents["doorIndexCode"].ToString();
                            string   doorName      = doorEvents["doorName"].ToString();

                            CmcsGuardInfo entity = Dbers.GetInstance().SelfDber.Entity <CmcsGuardInfo>("where NId=:NId", new { NId = eventId });
                            if (entity == null)
                            {
                                entity = new CmcsGuardInfo()
                                {
                                    DataFrom       = "智能化",
                                    F_ConsumerId   = personId,
                                    F_ConsumerName = personName,
                                    F_InOut        = "1",
                                    F_ReaderId     = doorIndexCode,
                                    F_ReaderName   = doorName,
                                    NId            = eventId,
                                    F_ReadDate     = eventTime,
                                    Remark         = dicEventType[eventType]
                                };

                                res += Dbers.GetInstance().SelfDber.Insert(entity);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                output("同步门禁数据异常" + ex.Message, eOutputType.Error);
                return;
            }

            output(string.Format("同步门禁数据{0}条", res), eOutputType.Normal);
        }
예제 #29
0
 /// <summary>
 /// 根据采样方案Id获取火车进厂队列详情视图
 /// </summary>
 /// <param name="trainSampleSchemeId"></param>
 /// <returns></returns>
 public List <View_TrainTipperQueue> GetView_TrainTipperQueueBy(string trainSampleSchemeId)
 {
     return(Dbers.GetInstance().SelfDber.Entities <View_TrainTipperQueue>("where TrainSampleSchemeId=:TrainSampleSchemeId order by OrderNumber asc", new { TrainSampleSchemeId = trainSampleSchemeId }));
 }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txt_SerialNumber.Text.Length == 0)
            {
                MessageBoxEx.Show("该标车牌号不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if ((CmcsSaleFuelTransport == null || CmcsSaleFuelTransport.CarNumber != txt_SerialNumber.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsSaleFuelTransport>(" where CarNumber=:CarNumber", new { CarNumber = txt_SerialNumber.Text }).Count > 0)
            {
                MessageBoxEx.Show("该标车牌号不可重复!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.EditMode == eEditMode.修改)
            {
                CmcsSaleFuelTransport.SerialNumber = txt_SerialNumber.Text;
                CmcsSaleFuelTransport.CarNumber    = txt_CarNumber.Text;
                if (cmcsSupplier != null)
                {
                    CmcsSaleFuelTransport.SupplierId   = cmcsSupplier.Id;
                    CmcsSaleFuelTransport.SupplierName = cmcsSupplier.Name;
                }
                if (cmcsTransportCompany != null)
                {
                    CmcsSaleFuelTransport.TransportCompanyId   = cmcsTransportCompany.Id;
                    CmcsSaleFuelTransport.TransportCompanyName = cmcsTransportCompany.Name;
                }
                if (cmcsFuelKind != null)
                {
                    CmcsSaleFuelTransport.FuelKindId   = cmcsFuelKind.Id;
                    CmcsSaleFuelTransport.FuelKindName = cmcsFuelKind.Name;
                }
                CmcsSaleFuelTransport.GrossWeight  = (decimal)dbi_GrossWeight.Value;
                CmcsSaleFuelTransport.TareWeight   = (decimal)dbi_TareWeight.Value;
                CmcsSaleFuelTransport.SuttleWeight = (decimal)dbi_SuttleWeight.Value;
                CmcsSaleFuelTransport.Remark       = txt_Remark.Text;
                CmcsSaleFuelTransport.IsFinish     = (chb_IsFinish.Checked ? 1 : 0);
                CmcsSaleFuelTransport.IsUse        = (chb_IsUse.Checked ? 1 : 0);
                CmcsSaleFuelTransport.StepName     = cmbStepName.Text;
                if (cmcsTransportSales != null)
                {
                    CmcsSaleFuelTransport.SupplierId           = cmcsTransportSales.SaleSorderId;
                    CmcsSaleFuelTransport.SupplierName         = cmcsTransportSales.Consignee;
                    CmcsSaleFuelTransport.TransportCompanyId   = cmcsTransportSales.TransportCompayId;
                    CmcsSaleFuelTransport.TransportCompanyName = cmcsTransportSales.TransportCompayName;
                }

                CmcsUnFinishTransport unfinishTransport = Dbers.GetInstance().SelfDber.Entity <CmcsUnFinishTransport>(" where TransportId= '" + CmcsSaleFuelTransport.Id + "'");

                //有效并且未完成时需要存在[未完成运输记录]
                if (chb_IsUse.Checked && !chb_IsFinish.Checked)
                {
                    if (unfinishTransport == null)
                    {
                        unfinishTransport = new CmcsUnFinishTransport()
                        {
                            TransportId = CmcsSaleFuelTransport.Id,
                            CarType     = eCarType.销售煤.ToString(),
                            AutotruckId = CmcsSaleFuelTransport.AutotruckId,
                            PrevPlace   = CommonAppConfig.GetInstance().AppIdentifier
                        };
                        Dbers.GetInstance().SelfDber.Insert(unfinishTransport);
                    }
                }
                //无效或者是完成时需要删除[未完成运输记录]
                if (!chb_IsUse.Checked || chb_IsFinish.Checked)
                {
                    if (unfinishTransport != null)
                    {
                        Dbers.GetInstance().SelfDber.Delete <CmcsUnFinishTransport>(unfinishTransport.Id);
                    }
                }

                Dbers.GetInstance().SelfDber.Update(CmcsSaleFuelTransport);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }