Example #1
0
        /// <summary>
        /// 生成其他物资运输排队记录
        /// </summary>
        /// <param name="autotruck">车辆</param>
        /// <param name="supply">供货单位</param>
        /// <param name="receive">收货单位</param>
        /// <param name="goodsType">物资类型</param>
        /// <param name="inFactoryTime">入厂时间</param>
        /// <param name="remark">备注</param>
        /// <param name="place">地点</param>
        /// <returns></returns>
        public bool JoinQueueGoodsTransport(CmcsAutotruck autotruck, CmcsSupplier supply, CmcsSupplier receive, CmcsGoodsType goodsType, DateTime inFactoryTime, string remark, string place)
        {
            CmcsGoodsTransport transport = new CmcsGoodsTransport
            {
                SerialNumber    = carTransportDAO.CreateNewTransportSerialNumber(eCarType.其他物资, inFactoryTime),
                AutotruckId     = autotruck.Id,
                CarNumber       = autotruck.CarNumber,
                SupplyUnitId    = supply.Id,
                SupplyUnitName  = supply.Name,
                ReceiveUnitId   = receive.Id,
                ReceiveUnitName = receive.Name,
                GoodsTypeId     = goodsType.Id,
                GoodsTypeName   = goodsType.GoodsName,
                InFactoryTime   = inFactoryTime,
                IsFinish        = 0,
                IsUse           = 1,
                StepName        = eTruckInFactoryStep.入厂.ToString(),
                Remark          = remark
            };

            if (SelfDber.Insert(transport) > 0)
            {
                // 插入未完成运输记录
                return(SelfDber.Insert(new CmcsUnFinishTransport
                {
                    TransportId = transport.Id,
                    CarType = eCarType.其他物资.ToString(),
                    AutotruckId = autotruck.Id,
                    PrevPlace = place,
                }) > 0);
            }

            return(false);
        }
        private void dataGridViewX1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == -1 || e.RowIndex == -1)
            {
                return;
            }

            CmcsGoodsTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsGoodsTransport>(superGridControl1.PrimaryGrid.GetCell(e.ColumnIndex, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            if (entity == null)
            {
                return;
            }

            switch (superGridControl1.PrimaryGrid.Columns[e.ColumnIndex].Name)
            {
            case "clmShow":
                FrmWeightCar_Oper frmShow = new FrmWeightCar_Oper(entity.Id, false, "其他物资");
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;
            }
        }
        private void FrmGoodsTransport_Oper_Load(object sender, EventArgs e)
        {
            cmb_GoodsTypeName.DataSource    = Dbers.GetInstance().SelfDber.Entities <CmcsGoodsType>(" where ParentId is not null order by OrderNumber");
            cmb_GoodsTypeName.DisplayMember = "GoodsName";
            cmb_GoodsTypeName.ValueMember   = "Id";
            cmb_GoodsTypeName.SelectedIndex = 0;

            this.CmcsGoodsTransport = Dbers.GetInstance().SelfDber.Get <CmcsGoodsTransport>(this.PId);
            if (this.CmcsGoodsTransport != null)
            {
                txt_SerialNumber.Text    = CmcsGoodsTransport.SerialNumber;
                txt_CarNumber.Text       = CmcsGoodsTransport.CarNumber;
                txt_SupplyUnitName.Text  = CmcsGoodsTransport.SupplyUnitName;
                txt_ReceiveUnitName.Text = CmcsGoodsTransport.ReceiveUnitName;
                dbi_FirstWeight.Value    = (double)CmcsGoodsTransport.FirstWeight;
                dbi_SecondWeight.Value   = (double)CmcsGoodsTransport.SecondWeight;
                cmb_GoodsTypeName.Text   = CmcsGoodsTransport.GoodsTypeName;
                dbi_SuttleWeight.Value   = (double)CmcsGoodsTransport.SuttleWeight;
                txt_InFactoryTime.Text   = CmcsGoodsTransport.InFactoryTime.Year == 1 ? "" : CmcsGoodsTransport.InFactoryTime.ToString();
                txt_OutFactoryTime.Text  = CmcsGoodsTransport.OutFactoryTime.Year == 1 ? "" : CmcsGoodsTransport.OutFactoryTime.ToString();
                txt_FirstTime.Text       = CmcsGoodsTransport.FirstTime.Year == 1 ? "" : CmcsGoodsTransport.FirstTime.ToString();
                txt_SecondTime.Text      = CmcsGoodsTransport.SecondTime.Year == 1 ? "" : CmcsGoodsTransport.SecondTime.ToString();
                txt_Remark.Text          = CmcsGoodsTransport.Remark;
                chb_IsFinish.Checked     = (CmcsGoodsTransport.IsFinish == 1);
                chb_IsUse.Checked        = (CmcsGoodsTransport.IsUse == 1);
            }

            if (this.EditMode == eEditMode.查看)
            {
                btnSubmit.Enabled = false;
                HelperUtil.ControlReadOnly(panelEx2, true);
            }
        }
Example #4
0
        /// <summary>
        /// 保存其他物资运输记录
        /// </summary>
        /// <param name="transportId"></param>
        /// <param name="weight">重量</param>
        /// <param name="place"></param>
        /// <returns></returns>
        public bool SaveGoodsTransport(string transportId, decimal weight, DateTime dt, string place)
        {
            CmcsGoodsTransport transport = SelfDber.Get <CmcsGoodsTransport>(transportId);

            if (transport == null)
            {
                return(false);
            }

            if (transport.FirstWeight == 0)
            {
                transport.StepName    = eTruckInFactoryStep.重车.ToString();
                transport.FirstWeight = weight;
                transport.FirstPlace  = place;
                transport.FirstTime   = dt;
            }
            else if (transport.SecondWeight == 0)
            {
                transport.StepName     = eTruckInFactoryStep.轻车.ToString();
                transport.SecondWeight = weight;
                transport.SecondPlace  = place;
                transport.SecondTime   = dt;
                transport.SuttleWeight = Math.Abs(transport.FirstWeight - transport.SecondWeight);

                // 回皮即完结
                transport.IsFinish = 1;
            }
            else
            {
                return(false);
            }

            return(SelfDber.Update(transport) > 0);
        }
Example #5
0
        private void dataGridViewX1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == -1 || e.RowIndex == -1)
            {
                return;
            }

            CmcsGoodsTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsGoodsTransport>(superGridControl1.PrimaryGrid.GetCell(e.ColumnIndex, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            if (entity == null)
            {
                return;
            }

            switch (superGridControl1.PrimaryGrid.Columns[e.ColumnIndex].Name)
            {
            case "clmDelete":
                // 查询正在使用该记录的车数
                if (MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Dbers.GetInstance().SelfDber.Delete <CmcsGoodsTransport>(entity.Id);

                    BindData();
                }
                else
                {
                    MessageBoxEx.Show("该记录正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                break;
            }
        }
        private void FrmGoodsTransport_Oper_Load(object sender, EventArgs e)
        {
            cmb_GoodsTypeName.DataSource    = Dbers.GetInstance().SelfDber.Entities <CmcsGoodsType>(" where ParentId is not null order by OrderNumber");
            cmb_GoodsTypeName.DisplayMember = "GoodsName";
            cmb_GoodsTypeName.ValueMember   = "Id";
            cmb_GoodsTypeName.SelectedIndex = 0;

            if (!String.IsNullOrEmpty(id))
            {
                this.cmcsGoodsTransport  = Dbers.GetInstance().SelfDber.Get <CmcsGoodsTransport>(this.id);
                txt_SerialNumber.Text    = cmcsGoodsTransport.SerialNumber;
                txt_CarNumber.Text       = cmcsGoodsTransport.CarNumber;
                txt_SupplyUnitName.Text  = cmcsGoodsTransport.SupplyUnitName;
                txt_ReceiveUnitName.Text = cmcsGoodsTransport.ReceiveUnitName;
                dbi_FirstWeight.Value    = (double)cmcsGoodsTransport.FirstWeight;
                dbi_SecondWeight.Value   = (double)cmcsGoodsTransport.SecondWeight;
                cmb_GoodsTypeName.Text   = cmcsGoodsTransport.GoodsTypeName;
                dbi_SuttleWeight.Value   = (double)cmcsGoodsTransport.SuttleWeight;
                txt_InFactoryTime.Text   = cmcsGoodsTransport.InFactoryTime.Year == 1 ? "" : cmcsGoodsTransport.InFactoryTime.ToString();
                txt_OutFactoryTime.Text  = cmcsGoodsTransport.OutFactoryTime.Year == 1 ? "" : cmcsGoodsTransport.OutFactoryTime.ToString();
                txt_FirstTime.Text       = cmcsGoodsTransport.FirstTime.Year == 1 ? "" : cmcsGoodsTransport.FirstTime.ToString();
                txt_SecondTime.Text      = cmcsGoodsTransport.SecondTime.Year == 1 ? "" : cmcsGoodsTransport.SecondTime.ToString();
                txt_Remark.Text          = cmcsGoodsTransport.Remark;
                chb_IsFinish.Checked     = (cmcsGoodsTransport.IsFinish == 1);
                chb_IsUse.Checked        = (cmcsGoodsTransport.IsUse == 1);
            }
            if (!edit)
            {
                btnSubmit.Enabled = false;
                CMCS.CarTransport.Queue.Utilities.Helper.ControlReadOnly(panelEx2);
            }
        }
        private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsGoodsTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsGoodsTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

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

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

            case "clmDelete":
                // 查询正在使用该记录的车数
                if (MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        Dbers.GetInstance().SelfDber.Delete <CmcsGoodsTransport>(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;
            }
        }
        private void btnReportExport_Click(object sender, EventArgs e)
        {
            try
            {
                FileStream   file         = new FileStream("计量明细模板.xls", FileMode.Open, FileAccess.Read);
                HSSFWorkbook hssfworkbook = new HSSFWorkbook(file);
                HSSFSheet    sheetl       = (HSSFSheet)hssfworkbook.GetSheet("计量明细");

                if (CurrExportData.Count == 0)
                {
                    MessageBox.Show("请先查询数据");
                    return;
                }

                if (folderBrowserDialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                for (int i = 0; i < CurrExportData.Count; i++)
                {
                    CmcsGoodsTransport entity = CurrExportData[i];

                    Mysheet1(sheetl, i + 1, 0, entity.SerialNumber.ToString());
                    Mysheet1(sheetl, i + 1, 1, entity.CarNumber);
                    Mysheet1(sheetl, i + 1, 2, entity.SupplyUnitName);
                    Mysheet1(sheetl, i + 1, 3, entity.GoodsTypeName);
                    Mysheet1(sheetl, i + 1, 4, entity.FirstWeight.ToString());
                    Mysheet1(sheetl, i + 1, 5, entity.SecondWeight.ToString());
                    Mysheet1(sheetl, i + 1, 6, "0");
                    Mysheet1(sheetl, i + 1, 7, entity.SuttleWeight.ToString());
                    Mysheet1(sheetl, i + 1, 8, entity.SecondTime.Year < 2000 ? "" : entity.SecondTime.ToString("yyyy-MM-dd HH:mm:ss"));
                }

                #region 合计
                Mysheet1(sheetl, CurrExportData.Count + 1, 0, "合计");
                Mysheet1(sheetl, CurrExportData.Count + 1, 1, CurrExportData.Count + "车");
                Mysheet1(sheetl, CurrExportData.Count + 1, 4, Math.Round(CurrExportData.Sum(a => a.FirstWeight), 2).ToString());
                Mysheet1(sheetl, CurrExportData.Count + 1, 5, Math.Round(CurrExportData.Sum(a => a.SecondWeight), 2).ToString());
                Mysheet1(sheetl, CurrExportData.Count + 1, 6, "0");
                Mysheet1(sheetl, CurrExportData.Count + 1, 7, Math.Round(CurrExportData.Sum(a => a.SuttleWeight), 2).ToString());
                #endregion

                sheetl.ForceFormulaRecalculation = true;
                string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + "计量明细.xls";
                GC.Collect();

                FileStream fs = File.OpenWrite(folderBrowserDialog.SelectedPath + "\\" + fileName);
                hssfworkbook.Write(fs);   //向打开的这个xls文件中写入表并保存。
                fs.Close();
                MessageBox.Show("导出成功");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #9
0
        private void FrmTransport_Confirm_Shown(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.transportId))
            {
                return;
            }

            if (this.carType == eCarType.入场煤.ToString())
            {
                CmcsBuyFuelTransport transport = commonDAO.SelfDber.Get <CmcsBuyFuelTransport>(this.transportId);
                if (transport != null)
                {
                    this.autotruckId = transport.AutotruckId;

                    txtSerialNumber.Text  = transport.SerialNumber;
                    txtCarNumber.Text     = transport.CarNumber;
                    txtInFactoryTime.Text = transport.InFactoryTime.ToString("yyyy-MM-dd HH:mm");
                }
            }
            else if (this.carType == eCarType.销售煤.ToString())
            {
                CmcsSaleFuelTransport transport = commonDAO.SelfDber.Get <CmcsSaleFuelTransport>(this.transportId);
                if (transport != null)
                {
                    this.autotruckId = transport.AutotruckId;

                    txtSerialNumber.Text  = transport.SerialNumber;
                    txtCarNumber.Text     = transport.CarNumber;
                    txtInFactoryTime.Text = transport.InFactoryTime.ToString("yyyy-MM-dd HH:mm");
                }
            }
            else if (this.carType == eCarType.其他物资.ToString())
            {
                CmcsGoodsTransport transport = commonDAO.SelfDber.Get <CmcsGoodsTransport>(this.transportId);
                if (transport != null)
                {
                    this.autotruckId = transport.AutotruckId;

                    txtSerialNumber.Text  = transport.SerialNumber;
                    txtCarNumber.Text     = transport.CarNumber;
                    txtInFactoryTime.Text = transport.InFactoryTime.ToString("yyyy-MM-dd HH:mm");
                }
            }
            else if (this.carType == eCarType.来访车辆.ToString())
            {
                CmcsVisitTransport transport = commonDAO.SelfDber.Get <CmcsVisitTransport>(this.transportId);
                if (transport != null)
                {
                    this.autotruckId = transport.AutotruckId;

                    txtSerialNumber.Text  = transport.SerialNumber;
                    txtCarNumber.Text     = transport.CarNumber;
                    txtInFactoryTime.Text = transport.InFactoryTime.ToString("yyyy-MM-dd HH:mm");
                }
            }
        }
        private void btnXExport_Click(object sender, EventArgs e)
        {
            try
            {
                FileStream   file         = new FileStream("车辆出入厂.xls", FileMode.Open, FileAccess.Read);
                HSSFWorkbook hssfworkbook = new HSSFWorkbook(file);
                HSSFSheet    sheetl       = (HSSFSheet)hssfworkbook.GetSheet("sheet1");

                if (this.listCount.Count == 0)
                {
                    MessageBox.Show("请先查询数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (folderBrowserDialog1.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                for (int i = 0; i < listCount.Count; i++)
                {
                    CmcsGoodsTransport entity    = listCount[i];
                    CmcsAutotruck      autoTruck = Dbers.GetInstance().SelfDber.Get <CmcsAutotruck>(entity.AutotruckId);
                    if (entity.CarNumber == "合计")
                    {
                        continue;
                    }
                    Mysheet1(sheetl, i + 2, 0, entity.CarNumber);
                    Mysheet1(sheetl, i + 2, 1, entity.InFactoryTime.ToString("yyyy-MM-dd HH:mm:ss"));
                    Mysheet1(sheetl, i + 2, 2, entity.SecondTime.ToString("yyyy-MM-dd HH:mm:ss"));
                    Mysheet1(sheetl, i + 2, 3, autoTruck != null ? autoTruck.EmissionStandard : "");
                    sheetl.GetRow(i + 2).Height = sheetl.GetRow(1).Height;

                    sheetl.GetRow(i + 3).GetCell(0).CellStyle = sheetl.GetRow(2).GetCell(0).CellStyle;
                    sheetl.GetRow(i + 3).GetCell(1).CellStyle = sheetl.GetRow(2).GetCell(1).CellStyle;
                    sheetl.GetRow(i + 3).GetCell(2).CellStyle = sheetl.GetRow(2).GetCell(2).CellStyle;
                    sheetl.GetRow(i + 3).GetCell(3).CellStyle = sheetl.GetRow(2).GetCell(3).CellStyle;
                    sheetl.GetRow(i + 3).GetCell(4).CellStyle = sheetl.GetRow(2).GetCell(4).CellStyle;
                    sheetl.GetRow(i + 3).GetCell(5).CellStyle = sheetl.GetRow(2).GetCell(5).CellStyle;
                    sheetl.GetRow(i + 3).GetCell(6).CellStyle = sheetl.GetRow(2).GetCell(6).CellStyle;
                    sheetl.GetRow(i + 3).GetCell(7).CellStyle = sheetl.GetRow(2).GetCell(7).CellStyle;
                    sheetl.GetRow(i + 3).GetCell(8).CellStyle = sheetl.GetRow(2).GetCell(8).CellStyle;
                }

                sheetl.ForceFormulaRecalculation = true;
                string fileName = "其他物资车辆出入厂记录_" + dtpStartTime.Value.ToString("yyyy-MM-dd") + ".xls";
                GC.Collect();

                FileStream fs = File.OpenWrite(folderBrowserDialog1.SelectedPath + "\\" + fileName);
                hssfworkbook.Write(fs);   //向打开的这个xls文件中写入表并保存。
                fs.Close();
                MessageBox.Show("导出成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #11
0
        private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsGoodsTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsGoodsTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

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

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

            case "clmDelete":
                // 查询正在使用该记录的车数
                if (MessageBoxEx.Show("确定要删除该记录?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        Dbers.GetInstance().SelfDber.Delete <CmcsGoodsTransport>(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 "clmPrint":
                if (entity.SuttleWeight <= 0)
                {
                    MessageBoxEx.Show("净重异常禁止打印", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                FrmPrintWeb frm = new FrmPrintWeb(null, entity);
                frm.ShowDialog();
                break;
            }
        }
        private void superGridControl1_DataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e)
        {
            foreach (GridRow gridRow in e.GridPanel.Rows)
            {
                CmcsGoodsTransport entity = gridRow.DataItem as CmcsGoodsTransport;
                if (entity == null)
                {
                    return;
                }

                // 填充有效状态
                gridRow.Cells["clmIsUse"].Value = (entity.IsUse == 1 ? "是" : "否");
            }
        }
Example #13
0
        /// <summary>
        /// 生成运输记录流水号
        /// </summary>
        /// <param name="carType">车类型</param>
        /// <param name="dt"></param>
        /// <returns></returns>
        public string CreateNewTransportSerialNumber(eCarType carType, DateTime dt)
        {
            string prefix = "Null";

            if (carType == eCarType.入厂煤)
            {
                prefix = "RCM";

                CmcsBuyFuelTransport entity = SelfDber.Entity <CmcsBuyFuelTransport>("where to_char(CreateDate,'yyyymmdd')=to_char(:CreateDate,'yyyymmdd') and SerialNumber like :Prefix || '%' order by InFactoryTime desc", new { CreateDate = dt, Prefix = prefix });
                if (entity == null)
                {
                    return(prefix + dt.ToString("yyMMdd") + "001");
                }
                else
                {
                    return(prefix + dt.ToString("yyMMdd") + (Convert.ToInt16(entity.SerialNumber.Replace(prefix + dt.ToString("yyMMdd"), "")) + 1).ToString().PadLeft(3, '0'));
                }
            }
            else if (carType == eCarType.销售煤)
            {
                prefix = "XSM";

                CmcsSaleFuelTransport entity = SelfDber.Entity <CmcsSaleFuelTransport>("where to_char(CreateDate,'yyyymmdd')=to_char(:CreateDate,'yyyymmdd') and SerialNumber like :Prefix || '%' order by InFactoryTime desc", new { CreateDate = dt, Prefix = prefix });
                if (entity == null)
                {
                    return(prefix + dt.ToString("yyMMdd") + "001");
                }
                else
                {
                    return(prefix + dt.ToString("yyMMdd") + (Convert.ToInt16(entity.SerialNumber.Replace(prefix + dt.ToString("yyMMdd"), "")) + 1).ToString().PadLeft(3, '0'));
                }
            }
            else if (carType == eCarType.其他物资)
            {
                prefix = "WZ";

                CmcsGoodsTransport entity = SelfDber.Entity <CmcsGoodsTransport>("where to_char(CreateDate,'yyyymmdd')=to_char(:CreateDate,'yyyymmdd') and SerialNumber like :Prefix || '%' order by InFactoryTime desc", new { CreateDate = dt, Prefix = prefix });
                if (entity == null)
                {
                    return(prefix + dt.ToString("yyMMdd") + "001");
                }
                else
                {
                    return(prefix + dt.ToString("yyMMdd") + (Convert.ToInt16(entity.SerialNumber.Replace(prefix + dt.ToString("yyMMdd"), "")) + 1).ToString().PadLeft(3, '0'));
                }
            }

            return(prefix + dt.ToString("yyMMdd") + DateTime.Now.Second.ToString().PadLeft(3, '0'));
        }
Example #14
0
        /// <summary>
        /// 保存其他物资运输记录
        /// </summary>
        /// <param name="transportId"></param>
        /// <param name="dt"></param>
        /// <returns></returns>
        public bool SaveGoodsTransport(string transportId, DateTime dt)
        {
            CmcsGoodsTransport transport = SelfDber.Get <CmcsGoodsTransport>(transportId);

            if (transport == null)
            {
                return(false);
            }

            transport.StepName       = eTruckInFactoryStep.出厂.ToString();
            transport.OutFactoryTime = dt;
            transport.IsFinish       = 1;

            return(SelfDber.Update(transport) > 0);
        }
Example #15
0
 public void Print(CmcsBuyFuelTransport buyfueltransport, CmcsGoodsTransport goodstransport = null)
 {
     _BuyFuelTransport = buyfueltransport;
     _GoodsTransport   = goodstransport;
     try
     {
         this._PrintDocument.Print();
     }
     catch
     {
         MessageBoxEx.Show("打印异常,请检查打印机!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     _BuyFuelTransport = null;
     _GoodsTransport   = null;
 }
        private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsGoodsTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsGoodsTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name)
            {
            case "clmShow":
                FrmWeightCar_Oper frmShow = new FrmWeightCar_Oper(entity.Id, false, "其他物资");
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;
            }
        }
Example #17
0
        public void PrintGoodsTransport(CmcsGoodsTransport entity)
        {
            #region 备份
            DataTable table = new DataTable();
            table.Columns.Add("SerialNumber", typeof(string));
            table.Columns.Add("TareTime", typeof(string));
            table.Columns.Add("CarNumber", typeof(string));
            table.Columns.Add("FuelKindName", typeof(string));
            table.Columns.Add("SupplierName", typeof(string));
            table.Columns.Add("Remark", typeof(string));
            table.Columns.Add("GrossWeight", typeof(string));
            table.Columns.Add("TareWeight", typeof(string));
            table.Columns.Add("SuttleWeight", typeof(string));
            table.Columns.Add("DeductWeight", typeof(string));
            table.Columns.Add("CreateUser", typeof(string));
            table.Columns.Add("Type", typeof(string));

            decimal GrossWeight = entity.FirstWeight, TareWeight = entity.SecondWeight;
            if (entity.FirstWeight < entity.SecondWeight)
            {
                GrossWeight = entity.SecondWeight;
                TareWeight  = entity.FirstWeight;
            }

            table.Rows.Add(entity.SerialNumber, entity.SecondTime.ToString("yyyy年MM月dd日 HH:mm"), entity.CarNumber, entity.GoodsTypeName, entity.SupplyUnitName, entity.ReceiveUnitName,
                           GrossWeight, TareWeight, entity.SuttleWeight, 0, CommonDAO.GetInstance().GetNameByAccount(entity.CreateUser));

            LocalReport report = new LocalReport();
            //设置需要打印的报表的文件名称。
            report.ReportPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TransportReport.rdlc");

            //创建要打印的数据源
            ReportDataSource source = new ReportDataSource();
            source.Name  = "Transport";
            source.Value = table;

            report.DataSources.Add(source);
            ////刷新报表中的需要呈现的数据
            //report.Refresh();

            PrintDocument(source, report);

            Dispose();

            report.Dispose();

            #endregion
        }
Example #18
0
        /// <summary>
        /// 其他物资
        /// </summary>
        /// <param name="entity"></param>
        public void PrintGoodsTransport(CmcsGoodsTransport entity)
        {
            CmcsTransportTemp temp = new CmcsTransportTemp()
            {
                TareTime     = entity.SecondTime,
                SupplierName = entity.SupplyUnitName,
                CarNumber    = entity.CarNumber,
                FuelKindName = entity.GoodsTypeName,
                GrossWeight  = entity.FirstWeight,
                TareWeight   = entity.SecondWeight,
                SuttleWeight = entity.SuttleWeight,
                DeductWeight = 0,
                Remark       = entity.Remark,
                SerialNumber = entity.SerialNumber
            };

            Print(temp);
        }
Example #19
0
        /// <summary>
        /// 重置信息
        /// </summary>
        void ResetGoods()
        {
            this.timer_Goods_Cancel = true;

            this.CurrentFlowFlag = eFlowFlag.等待车辆;

            this.CurrentAutotruck      = null;
            this.CurrentGoodsTransport = null;

            txtTagId_Goods.ResetText();

            btnSaveTransport_Goods.Enabled = false;

            LetBlocking();

            // 最后重置
            this.CurrentImperfectCar = null;
        }
Example #20
0
        /// <summary>
        /// 保存其他物资运输记录
        /// </summary>
        /// <param name="transportId"></param>
        /// <param name="weight">重量</param>
        /// <param name="place"></param>
        /// <returns></returns>
        public bool SaveGoodsTransport(string transportId, decimal weight, DateTime dt, string place)
        {
            CmcsGoodsTransport transport = SelfDber.Get <CmcsGoodsTransport>(transportId);

            if (transport == null)
            {
                return(false);
            }

            //根据当前流程节点名称判断
            if (transport.StepName != eTruckInFactoryStep.第一次称重.ToString())
            {
                transport.StepName    = eTruckInFactoryStep.第一次称重.ToString();
                transport.FirstWeight = weight;
                transport.FirstPlace  = place;
                transport.FirstTime   = dt;
            }
            else if (transport.StepName == eTruckInFactoryStep.第一次称重.ToString())
            {
                transport.StepName     = eTruckInFactoryStep.第二次称重.ToString();
                transport.SecondWeight = weight;
                transport.SecondPlace  = place;
                transport.SecondTime   = dt;
                transport.SuttleWeight = Math.Abs(transport.FirstWeight - transport.SecondWeight);

                // 回皮即完结
                transport.IsFinish = 1;

                //流程结束时删除临时运输记录
                CmcsUnFinishTransport unFinishTransport = SelfDber.Entity <CmcsUnFinishTransport>("where TransportId=:TransportId", new { TransportId = transportId });
                if (unFinishTransport != null)
                {
                    SelfDber.Delete <CmcsUnFinishTransport>(unFinishTransport.Id);
                }
            }
            else
            {
                return(false);
            }

            return(SelfDber.Update(transport) > 0);
        }
        public void BindData()
        {
            listCount.Clear();
            string tempSqlWhere = this.SqlWhere;

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

            labNumber_BuyFuel.Text = string.Format("已登记:{0}  已称重:{1}  已回皮:{2}  未回皮:{3}", listCount.Count, listCount.Where(a => a.FirstWeight > 0).Count(), listCount.Where(a => a.SecondWeight > 0).Count(), listCount.Where(a => a.SuttleWeight == 0).Count());
            listCount.OrderBy(a => a.SupplyUnitName);
            CmcsGoodsTransport listTotal1 = new CmcsGoodsTransport();

            listTotal1.CarNumber      = "合计";
            listTotal1.FirstWeight    = listCount.Sum(a => a.FirstWeight);
            listTotal1.SecondWeight   = listCount.Sum(a => a.SecondWeight);
            listTotal1.SuttleWeight   = listCount.Sum(a => a.SuttleWeight);
            listTotal1.SupplyUnitName = listCount.Count.ToString() + "车";//车数
            listCount.Add(listTotal1);

            superGridControl1.PrimaryGrid.DataSource = listCount;
        }
Example #22
0
        /// <summary>
        /// 更改其他物资运输记录的无效状态
        /// </summary>
        /// <param name="transportId"></param>
        /// <param name="isValid">是否有效</param>
        /// <returns></returns>
        public bool ChangeGoodsTransportToInvalid(string transportId, bool isValid)
        {
            if (isValid)
            {
                // 设置为有效
                CmcsGoodsTransport buyFuelTransport = SelfDber.Get <CmcsGoodsTransport>(transportId);
                if (buyFuelTransport != null)
                {
                    if (SelfDber.Execute("update " + EntityReflectionUtil.GetTableName <CmcsGoodsTransport>() + " set IsUse=1 where Id=:Id", new { Id = transportId }) > 0)
                    {
                        if (buyFuelTransport.IsFinish == 0)
                        {
                            SelfDber.Insert(new CmcsUnFinishTransport
                            {
                                AutotruckId = buyFuelTransport.AutotruckId,
                                CarType     = eCarType.其他物资.ToString(),
                                TransportId = buyFuelTransport.Id,
                                PrevPlace   = "未知"
                            });
                        }

                        return(true);
                    }
                }
            }
            else
            {
                // 设置为无效

                if (SelfDber.Execute("update " + EntityReflectionUtil.GetTableName <CmcsGoodsTransport>() + " set IsUse=0 where Id=:Id", new { Id = transportId }) > 0)
                {
                    SelfDber.DeleteBySQL <CmcsUnFinishTransport>("where TransportId=:TransportId", new { TransportId = transportId });

                    return(true);
                }
            }

            return(false);
        }
Example #23
0
        /// <summary>
        /// 保存运输记录
        /// </summary>
        /// <returns></returns>
        bool SaveGoodsTransport()
        {
            if (this.CurrentGoodsTransport == null)
            {
                return(false);
            }

            try
            {
                if (outerDAO.SaveGoodsTransport(this.CurrentGoodsTransport.Id, DateTime.Now))
                {
                    this.CurrentGoodsTransport = commonDAO.SelfDber.Get <CmcsGoodsTransport>(this.CurrentGoodsTransport.Id);

                    btnSaveTransport_Goods.Enabled = false;
                    this.CurrentFlowFlag           = eFlowFlag.等待离开;

                    if (!this.AutoHandMode)
                    {
                        MessageBoxEx.Show("出厂成功", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    LoadTodayUnFinishGoodsTransport();
                    LoadTodayFinishGoodsTransport();

                    LetPass();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show("保存失败\r\n" + ex.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

                Log4Neter.Error("保存运输记录", ex);
            }

            return(false);
        }
        private void tsmiPrint_Click(object sender, EventArgs e)
        {
            GridRow gridRow = superGridControl1.PrimaryGrid.ActiveRow as GridRow;

            if (gridRow == null)
            {
                return;
            }
            CmcsGoodsTransport entity = gridRow.DataItem as CmcsGoodsTransport;

            if (entity != null)
            {
                if (entity.IsFinish == 0)
                {
                    if (MessageBoxEx.Show("流程未完结,是否需要打印磅单!", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == System.Windows.Forms.DialogResult.Cancel)
                    {
                        return;
                    }
                }

                ReportPrint.GetInstance().PrintGoodsTransport(entity);
            }
        }
Example #25
0
        private void superGridControl1_DataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e)
        {
            foreach (GridRow gridRow in e.GridPanel.Rows)
            {
                CmcsGoodsTransport entity = gridRow.DataItem as CmcsGoodsTransport;
                if (entity == null)
                {
                    return;
                }

                // 填充有效状态
                gridRow.Cells["clmIsUse"].Value = (entity.IsUse == 1 ? "是" : "否");
                CmcsSupplyReceive supplyunit = Dbers.GetInstance().SelfDber.Get <CmcsSupplyReceive>(entity.SupplyUnitId);
                if (supplyunit != null)
                {
                    gridRow.Cells["SupplyUnitName"].Value = supplyunit.UnitName;
                }
                CmcsSupplyReceive receiveunit = Dbers.GetInstance().SelfDber.Get <CmcsSupplyReceive>(entity.ReceiveUnitId);
                if (receiveunit != null)
                {
                    gridRow.Cells["ReceiveUnitName"].Value = receiveunit.UnitName;
                }
                CmcsGoodsType goodstype = Dbers.GetInstance().SelfDber.Get <CmcsGoodsType>(entity.GoodsTypeId);
                if (goodstype != null)
                {
                    gridRow.Cells["GoodsTypeName"].Value = goodstype.GoodsName;
                }
                if (entity.FirstWeight > 0 && entity.SecondWeight > 0)
                {
                    gridRow.CellStyles.Default.TextColor = Color.Green;
                }
                else if (entity.FirstWeight == 0 && entity.SecondWeight == 0)
                {
                    gridRow.CellStyles.Default.TextColor = Color.Red;
                }
            }
        }
Example #26
0
        /// <summary>
        /// 生成其他物资运输排队记录
        /// </summary>
        /// <param name="autotruck">车辆</param>
        /// <param name="supply">供货单位</param>
        /// <param name="receive">收货单位</param>
        /// <param name="goodsType">物资类型</param>
        /// <param name="inFactoryTime">入厂时间</param>
        /// <param name="remark">备注</param>
        /// <param name="place">地点</param>
        /// <returns></returns>
        public bool JoinQueueGoodsTransport(CmcsAutotruck autotruck, CmcsSupplyReceive supply, CmcsGoodsType goodsType, string mineName, string upload, string fuelKindName, DateTime inFactoryTime, string remark, string place, ref CmcsGoodsTransport transport)
        {
            transport = new CmcsGoodsTransport
            {
                SerialNumber   = carTransportDAO.CreateNewTransportSerialNumber(eCarType.其他物资, inFactoryTime),
                AutotruckId    = autotruck.Id,
                CarNumber      = autotruck.CarNumber,
                SupplyUnitId   = supply != null ? supply.Id : "",
                SupplyUnitName = supply != null ? supply.UnitName : "",
                GoodsTypeId    = goodsType != null ? goodsType.Id : "",
                GoodsTypeName  = goodsType != null ? goodsType.GoodsName : "",
                FromMC         = mineName,
                ToMC           = upload,
                FuelKindName   = fuelKindName,
                InFactoryTime  = inFactoryTime,
                IsFinish       = 0,
                IsUse          = 1,
                StepName       = eTruckInFactoryStep.入厂.ToString(),
                Remark         = remark,
                CarType        = autotruck.CarType
            };

            return(SelfDber.Insert(transport) > 0);
        }
Example #27
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();
         }
     }
 }
Example #28
0
        private void makeImage(object sender, PrintPageEventArgs e)
        {
            Font fontTitle  = new Font("黑体", 14, FontStyle.Bold, GraphicsUnit.Pixel);
            Font fontTitle1 = new Font("黑体", 12, FontStyle.Bold, GraphicsUnit.Pixel);

            Font  fontContent   = new Font("黑体", instance.FontSize, FontStyle.Regular, GraphicsUnit.Pixel);
            Font  fontPrintTime = new Font("黑体", instance.FontSize, FontStyle.Bold, GraphicsUnit.Pixel);
            Font  fontSupplier  = new Font("黑体", instance.FontSize, FontStyle.Bold, GraphicsUnit.Pixel);
            float leftPadding   = instance.LeftPadding;
            int   PageIndex     = 1;

            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 = 53;
            Image  img;
            String path = Application.StartupPath + "\\logos.png";

            using (FileStream fs = new FileStream(path, FileMode.Open))
            {
                img = Image.FromStream(fs);
            }

            string printValue = "";

            g.DrawImage(img, leftPadding + 10, 25);
            g.DrawString("国家电投河南公司沁阳发电分公司", fontTitle1, Brushes.Black, leftPadding + 40, 40);
            TopValue += 15;

            g.DrawString("过  磅  单", new Font("黑体", 18, FontStyle.Bold, GraphicsUnit.Pixel), Brushes.Black, leftPadding + 85, TopValue);
            TopValue += 34;

            g.DrawLine(new Pen(Color.Black, 2), leftPadding + 0, TopValue, 300 - 10, TopValue);
            TopValue += 15;

            g.DrawString("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm"), fontPrintTime, Brushes.Black, leftPadding + 0, TopValue);
            TopValue += 20;

            if (printType == "入厂煤")
            {
                #region 入厂煤数据打印
                CmcsBuyFuelTransport entity = this.buyFuelTransport;
                List <CmcsBuyFuelTransportDeduct> deduct = Dbers.GetInstance().SelfDber.Entities <CmcsBuyFuelTransportDeduct>("where TransportId=:TransportId", new { TransportId = entity.Id });
                if (deduct != null && deduct.Count > 0)
                {
                    entity.DeductWeight = deduct.Sum(a => a.DeductWeight);
                }
                g.DrawString("流 水 号:" + entity.SerialNumber, fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString("车 牌 号:" + entity.CarNumber, fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                string FuelKindName = HasShowSupplier ? entity.FuelKindName : "****";
                g.DrawString("煤    种:" + FuelKindName, fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                string mineName = HasShowSupplier ? entity.MineName : "****";
                g.DrawString("矿    点:" + mineName, fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                printValue = entity.TheInFactoryBatch != null ? entity.TheInFactoryBatch.Batch : string.Empty;
                g.DrawString("批 次 号:" + printValue, fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString("收货单位:", fontContent, Brushes.Black, leftPadding + 0, TopValue);
                printValue = "国家电投河南公司沁阳发电分公司";

                SizeF SizeTitle = g.MeasureString("收货单位:", fontContent);

                TopValue = DrawContent(fontSupplier, leftPadding + SizeTitle.Width, g, TopValue, printValue);

                g.DrawString("运输单位:", fontContent, Brushes.Black, leftPadding, TopValue);
                printValue = entity.TransportCompanyName != null ? entity.TransportCompanyName : string.Empty;

                SizeTitle = g.MeasureString("运输单位:", fontContent);

                TopValue = DrawContent(fontSupplier, leftPadding + SizeTitle.Width, g, TopValue, printValue);

                g.DrawString("称重时间:" + DisposeTime(entity.GrossTime.ToString(), "yyyy-MM-dd HH:mm"), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString("回皮时间:" + DisposeTime(entity.TareTime.ToString(), "yyyy-MM-dd HH:mm"), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString(string.Format("矿发重量:{0} 吨", Math.Round(entity.TicketWeight, 2).ToString("F2").PadLeft(6, ' ')), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString(string.Format("毛    重:{0} 吨", Math.Round(entity.GrossWeight, 2).ToString("F2").PadLeft(6, ' ')), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString(string.Format("皮    重:{0} 吨", Math.Round(entity.TareWeight, 2).ToString("F2").PadLeft(6, ' ')), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString(string.Format("扣    吨:{0} 吨", Math.Round(entity.DeductWeight, 2).ToString("F2").PadLeft(6, ' ')), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString(string.Format("盈 亏 量:{0} 吨", Math.Round((entity.ProfitWeight), 2).ToString("F2").PadLeft(6, ' ')), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString(string.Format("净    重:{0} 吨", Math.Round(entity.SuttleWeight, 2).ToString("F2").PadLeft(6, ' ')), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString(string.Format("验 收 量:{0} 吨", Math.Round(entity.CheckWeight, 2).ToString("F2").PadLeft(6, ' ')), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;
                #endregion
            }
            else if (printType == "其他物资")
            {
                #region 其他物资数据打印
                CmcsGoodsTransport entity = this.goodsTransport;
                g.DrawString("流 水 号:" + entity.SerialNumber, fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString("车 牌 号:" + entity.CarNumber, fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString("供货单位:", fontContent, Brushes.Black, leftPadding + 0, TopValue);
                printValue = entity.SupplyUnitName != null ? entity.SupplyUnitName : string.Empty;
                SizeF SizeTitle = g.MeasureString("供货单位:", fontContent);
                TopValue = DrawContent(fontSupplier, leftPadding + SizeTitle.Width, g, TopValue, printValue);

                g.DrawString("收货单位:", fontContent, Brushes.Black, leftPadding + 0, TopValue);
                //printValue = "国家电投河南公司沁阳发电分公司";
                printValue = entity.ReceiveUnitName != null ? entity.ReceiveUnitName : "国家电投河南公司沁阳发电分公司";
                SizeTitle  = g.MeasureString("收货单位:", fontContent);
                TopValue   = DrawContent(fontSupplier, leftPadding + SizeTitle.Width, g, TopValue, printValue);

                g.DrawString("物资类型:" + entity.GoodsTypeName, fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString("第一次称重:", fontPrintTime, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString("称重时间:" + DisposeTime(entity.FirstTime.ToString(), "yyyy-MM-dd HH:mm"), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString(string.Format("重    量:{0} 吨", Math.Round(entity.FirstWeight, 2).ToString("F2").PadLeft(6, ' ')), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString("第二次称重:", fontPrintTime, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString("称重时间:" + DisposeTime(entity.SecondTime.ToString(), "yyyy-MM-dd HH:mm"), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString(string.Format("重    量:{0} 吨", Math.Round(entity.SecondWeight, 2).ToString("F2").PadLeft(6, ' ')), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;

                g.DrawString(string.Format("净    重:{0} 吨", Math.Round(entity.SuttleWeight, 2).ToString("F2").PadLeft(6, ' ')), fontContent, Brushes.Black, leftPadding + 0, TopValue);
                TopValue += 20;
                #endregion
            }

            g.DrawString(string.Format("操 作 员:{0}", SelfVars.LoginUser.UserName), fontContent, Brushes.Black, leftPadding + 0, TopValue);
            TopValue += 20;

            g.DrawString(PageIndex.ToString() + "联", fontTitle, Brushes.Black, leftPadding + 110, TopValue);
            TopValue += 20;

            if (e == null)
            {
                this.pictureBox1.Image = result;
                g.Dispose();
            }
        }
Example #29
0
        /// <summary>
        /// 请求数据
        /// </summary>
        void RequestData()
        {
            string value = string.Empty, machineCode = string.Empty;
            List <HtmlDataItem> datas = new List <HtmlDataItem>();

            datas.Clear();

            datas.Add(new HtmlDataItem("过衡程序_信号灯", ConvertBooleanToColor(commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.序状态.ToString())), eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("IO控制器_信号灯", ConvertBooleanToColor(commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.IO控制器_连接状态.ToString())), eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("地磅仪表_信号灯", ConvertBooleanToColor(commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.地磅仪表_连接状态.ToString())), eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("LED屏_信号灯", ConvertBooleanToColor(commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.LED屏1_连接状态.ToString())), eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("读卡器1_信号灯", ConvertBooleanToColor(commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.车号识别1_连接状态.ToString())), eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("读卡器2_信号灯", ConvertBooleanToColor(commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.车号识别2_连接状态.ToString())), eHtmlDataItemType.svg_color));

            // 根据信号“当前车Id"查询更多信息
            string  currentAutotruckId = commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.当前车Id.ToString());
            string  currentTransportId = commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.当前运输记录Id.ToString());
            decimal gross = 0, tare = 0;

            if (!string.IsNullOrEmpty(currentAutotruckId) && !string.IsNullOrEmpty(currentTransportId))
            {
                CmcsAutotruck autotruck = commonDAO.SelfDber.Get <CmcsAutotruck>(currentAutotruckId);
                if (autotruck != null)
                {
                    if (autotruck.CarType == eCarType.入场煤.ToString())
                    {
                        CmcsBuyFuelTransport transport = commonDAO.SelfDber.Get <CmcsBuyFuelTransport>(currentTransportId);
                        if (transport != null)
                        {
                            gross = transport.GrossWeight;
                            tare  = transport.TareWeight;
                        }
                    }
                    if (autotruck.CarType == eCarType.销售煤.ToString())
                    {
                        // TODO
                    }
                    if (autotruck.CarType == eCarType.其他物资.ToString())
                    {
                        CmcsGoodsTransport transport = commonDAO.SelfDber.Get <CmcsGoodsTransport>(currentTransportId);
                        if (transport != null)
                        {
                            gross = transport.FirstWeight;
                            tare  = transport.SecondWeight;
                        }
                    }
                }
            }
            datas.Add(new HtmlDataItem("卡车", (!string.IsNullOrEmpty(currentAutotruckId)).ToString(), eHtmlDataItemType.svg_visible));
            datas.Add(new HtmlDataItem("当前过衡车号", commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.当前车号.ToString()), eHtmlDataItemType.svg_text));
            datas.Add(new HtmlDataItem("毛重", gross.ToString() + " 吨", eHtmlDataItemType.svg_text));
            datas.Add(new HtmlDataItem("皮重", tare.ToString() + " 吨", eHtmlDataItemType.svg_text));

            datas.Add(new HtmlDataItem("地磅仪表_实时重量", commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.地磅仪表_实时重量.ToString()).PadLeft(5, ' ') + " 吨", eHtmlDataItemType.svg_text));
            datas.Add(new HtmlDataItem("地磅仪表_稳定", commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.地磅仪表_稳定.ToString()).ToLower() == "1" ? ColorTranslator.ToHtml(EquipmentStatusColors.BeReady) : ColorTranslator.ToHtml(EquipmentStatusColors.Working), eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("地感1信号", commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.地感1信号.ToString()).ToLower() == "1" ? ColorTranslator.ToHtml(EquipmentStatusColors.Working) : "#c0c0c0", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("地感2信号", commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.地感2信号.ToString()).ToLower() == "1" ? ColorTranslator.ToHtml(EquipmentStatusColors.Working) : "#c0c0c0", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("对射1信号", commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.对射1信号.ToString()).ToLower() == "1" ? ColorTranslator.ToHtml(EquipmentStatusColors.Working) : "#c0c0c0", eHtmlDataItemType.svg_color));
            //datas.Add(new HtmlDataItem("对射2信号", commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.对射2信号.ToString()).ToLower() == "1" ? ColorTranslator.ToHtml(EquipmentStatusColors.Working) : "#c0c0c0", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("对射3信号", commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.对射2信号.ToString()).ToLower() == "1" ? ColorTranslator.ToHtml(EquipmentStatusColors.Working) : "#c0c0c0", eHtmlDataItemType.svg_color));

            datas.Add(new HtmlDataItem("道闸1升杆", commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.道闸1升杆.ToString()), eHtmlDataItemType.svg_visible));
            datas.Add(new HtmlDataItem("道闸2升杆", commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.道闸2升杆.ToString()), eHtmlDataItemType.svg_visible));

            datas.Add(new HtmlDataItem("卡车", commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QC_Weighter_1, eSignalDataName.磅方向.ToString()), eHtmlDataItemType.svg_scare));
            // 添加更多...

            // 发送到页面
            cefWebBrowser.Browser.GetMainFrame().ExecuteJavaScript("requestData(" + Newtonsoft.Json.JsonConvert.SerializeObject(datas) + ");", "", 0);
        }
Example #30
0
        /// <summary>
        /// 其他物资运输记录业务定时器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer_Goods_Tick(object sender, EventArgs e)
        {
            if (this.timer_Goods_Cancel)
            {
                return;
            }

            timer_Goods.Stop();
            timer_Goods.Interval = 2000;

            try
            {
                switch (this.CurrentFlowFlag)
                {
                case eFlowFlag.验证信息:
                    #region

                    // 查找该车未完成的运输记录
                    CmcsUnFinishTransport unFinishTransport = carTransportDAO.GetUnFinishTransportByAutotruckId(this.CurrentAutotruck.Id, eCarType.其他物资.ToString());
                    if (unFinishTransport != null)
                    {
                        this.CurrentGoodsTransport = commonDAO.SelfDber.Get <CmcsGoodsTransport>(unFinishTransport.TransportId);
                        if (this.CurrentGoodsTransport != null)
                        {
                            // 判断路线设置
                            string nextPlace;
                            if (carTransportDAO.CheckNextTruckInFactoryWay(this.CurrentAutotruck.CarType, this.CurrentBuyFuelTransport.StepName, "出厂", CommonAppConfig.GetInstance().AppIdentifier, out nextPlace))
                            {
                                if (this.CurrentGoodsTransport.SuttleWeight > 0)
                                {
                                    this.CurrentFlowFlag = eFlowFlag.保存信息;
                                }
                                else
                                {
                                    this.voiceSpeaker.Speak("车牌号 " + this.CurrentAutotruck.CarNumber + " 称重未完成", 1, false);

                                    timer_Goods.Interval = 20000;
                                }
                            }
                            else
                            {
                                this.voiceSpeaker.Speak("路线错误 禁止通过 " + (!string.IsNullOrEmpty(nextPlace) ? "请前往" + nextPlace : ""), 1, false);

                                timer_Goods.Interval = 20000;
                            }
                        }
                        else
                        {
                            commonDAO.SelfDber.Delete <CmcsUnFinishTransport>(unFinishTransport.Id);
                        }
                    }
                    else
                    {
                        this.voiceSpeaker.Speak("车牌号 " + this.CurrentAutotruck.CarNumber + " 未找到排队记录", 1, false);

                        timer_Goods.Interval = 20000;
                    }

                    #endregion
                    break;

                case eFlowFlag.保存信息:
                    #region

                    if (this.AutoHandMode)
                    {
                        // 自动模式
                        if (!SaveGoodsTransport())
                        {
                            this.voiceSpeaker.Speak("车牌号 " + this.CurrentAutotruck.CarNumber + " 保存失败,请联系管理员", 1, false);
                        }
                    }
                    else
                    {
                        // 手动模式
                    }

                    #endregion
                    break;

                case eFlowFlag.等待离开:
                    #region

                    // 当前道路地感无信号时重置
                    if (!HasCarOnCurrentWay())
                    {
                        ResetGoods();
                    }

                    // 降低灵敏度
                    timer_Goods.Interval = 4000;

                    #endregion
                    break;
                }

                // 当前道路地感无信号时重置
                if (!HasCarOnCurrentWay() && this.CurrentFlowFlag != eFlowFlag.等待车辆 && (this.CurrentImperfectCar != null && this.CurrentImperfectCar.IsFromDevice))
                {
                    ResetGoods();
                }
            }
            catch (Exception ex)
            {
                Log4Neter.Error("timer_Goods_Tick", ex);
            }
            finally
            {
                timer_Goods.Start();
            }
        }