Esempio n. 1
0
        /// <summary>
        /// 窗体加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainFormLoad(object sender, EventArgs e)
        {
            try
            {
                ribbonControl1.Minimized = true;
                // 加载一些默认皮肤
                SkinHelper.InitSkinGallery(rbSkin, true);
                // ChildFormManagementHelper.Navigate(this, "http://yd.zt-express.com/Help/Index2", "帮助");
                ChildFormManagementHelper.LoadMdiForm(this, "FrmPrintData");
                // ChildFormManagementHelper.Navigate(this, "http://zto.com", "申通官网");
                // radialMenu1.ShowPopup(Control.MousePosition, true);
                //ChildFormManagement.LoadMdiForm(this, "FrmSendManData");
                //ChildFormManagement.LoadMdiForm(this, "FrmReceiveManData");
                if (xtraTabbedMdiManager1.Pages.Count > 1)
                {
                    xtraTabbedMdiManager1.SelectedPage = xtraTabbedMdiManager1.Pages[1];
                }

                #region 底部一些基本信息绑定
                barItemsUser.Visibility   = DevExpress.XtraBars.BarItemVisibility.Never;
                barItemWeather.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
                var version = Assembly.GetExecutingAssembly().GetName().Version;
                barItemWelcome.Caption = string.Format("欢迎使用{1}-当前版本:{0}", version, BaseSystemInfo.SoftFullName);
                // 得到数据库的版本
                BaseParameterManager parameterManager = new BaseParameterManager(BillPrintHelper.DbHelper, BaseSystemInfo.UserInfo, BaseParameterEntity.TableName);
                var synchronous = parameterManager.GetParameter("Bill", "DBVersion", "Synchronous");
                if (!string.IsNullOrEmpty(synchronous))
                {
                    barItemWelcome.Caption += " 主库版本:" + synchronous;
                }
                this.Text           = string.Format("{0}-当前版本:{1}", this.Text, version);
                barItemTime.Caption = string.Format("登录时间:{0}  {1}", DateTime.Now.ToString(BaseSystemInfo.DateTimeFormat), DateUtil.GetDayOfWeek(DateTime.Now.DayOfWeek.ToString(), true) + " " + DateHelper.GetChineseDateTime(DateTime.Now));

                #endregion

                var userManager = new ZtoUserManager(BillPrintHelper.DbHelper);
                var userList    = userManager.GetList <ZtoUserEntity>(new KeyValuePair <string, object>(ZtoUserEntity.FieldIsDefault, 1), new KeyValuePair <string, object>(ZtoUserEntity.FieldIssendorreceive, 1));
                if (!userList.Any())
                {
                    if (XtraMessageBox.Show(@"未添加默认发件人信息,请添加默认发件人信息,有利于提取申通大头笔", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
                    {
                        var addSendMan = new FrmAddSendMan();
                        addSendMan.ShowDialog();
                        addSendMan.Dispose();
                    }
                }
                timerUpdate.Start();
                //FrmChatMessage chatMessage = new FrmChatMessage();
                //chatMessage.Show();
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 取消订单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBackBill_Click(object sender, EventArgs e)
        {
            ZtoElecUserInfoEntity elecUserInfoEntity = BillPrintHelper.GetElecUserInfoEntity();

            if (elecUserInfoEntity != null)
            {
                List <object> stateList = new List <object>();
                //输入单号字符串集合
                var orderNumberList = DotNet.Utilities.StringUtil.SplitMobile(txtOrderNumbers.Text, false).ToList();
                if (!orderNumberList.Any())
                {
                    XtraMessageBox.Show("没有任何的订单信息,请在左侧填写订单号进行回收");
                    return;
                }
                ZtoPrintCancelManager cancelManager = new ZtoPrintCancelManager(BillPrintHelper.DbHelper);
                foreach (var orderNumber in orderNumberList)
                {
                    string msg    = "";
                    var    result = ZtoElecBillHelper.BackZtoElecBill(orderNumber, elecUserInfoEntity, ref msg);
                    stateList.Add(new
                    {
                        订单号 = orderNumber,
                        状态  = msg
                    });
                    // 取消成功了可以把订单号和单号都清空一下
                    if (result)
                    {
                        string commandText = string.Format("UPDATE ZTO_PRINT_BILL SET ORDER_NUMBER = '', BILL_CODE = '' WHERE ORDER_NUMBER = '" + orderNumber + "'");
                        if (IsUpdateBackUpData)
                        {
                            // 同时把单号的订单取消掉,备份库的订单号和单号也要取消掉
                            BillPrintHelper.BackupDbHelper.ExecuteNonQuery(commandText);
                        }
                        else
                        {
                            // 同时把单号的订单取消掉,打印数据的取消掉就行了
                            BillPrintHelper.DbHelper.ExecuteNonQuery(commandText);
                        }
                        var temp = _printBillEntities.Find(p => p.OrderNumber.Replace(" ", "").Replace("\t", "") == orderNumber.Replace(" ", ""));
                        if (temp != null)
                        {
                            cancelManager.Add(new ZtoPrintCancelEntity()
                            {
                                OrderNumber    = temp.OrderNumber,
                                BillCode       = temp.BillCode,
                                SendMan        = temp.SendMan,
                                SendPhone      = temp.SendPhone,
                                SendAddress    = temp.SendAddress,
                                ReceiveMan     = temp.ReceiveMan,
                                ReceivePhone   = temp.ReceivePhone,
                                ReceiveAddress = temp.ReceiveAddress,
                                Remark         = "取消时间点是:" + DateTime.Now.ToString(BaseSystemInfo.DateTimeFormat)
                            });
                        }
                        else
                        {
                            cancelManager.Add(new ZtoPrintCancelEntity()
                            {
                                OrderNumber = orderNumber,
                                Remark      = "取消时间点是:" + DateTime.Now.ToString(BaseSystemInfo.DateTimeFormat)
                            });
                        }
                    }
                }
                if (stateList.Any())
                {
                    gcStatus.DataSource = stateList;
                }
            }
            else
            {
                // 获取系统是否有默认发件人,如果有救修改,如果没有就新增
                ZtoUserManager userManager = new ZtoUserManager(BillPrintHelper.DbHelper);
                var            userList    = userManager.GetList <ZtoUserEntity>(new KeyValuePair <string, object>(ZtoUserEntity.FieldIsDefault, 1), new KeyValuePair <string, object>(ZtoUserEntity.FieldIssendorreceive, 1));
                if (!userList.Any())
                {
                    XtraMessageBox.Show("系统未绑定默认发件人和商家ID,请进行绑定", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    FrmAddSendMan addSendMan = new FrmAddSendMan();
                    addSendMan.ShowDialog();
                    addSendMan.Dispose();
                }
                else
                {
                    XtraMessageBox.Show("默认发件人未绑定商家ID,请进行绑定", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    FrmAddSendMan frmSendMan = new FrmAddSendMan {
                        Id = userList.First().Id.ToString()
                    };
                    frmSendMan.ShowDialog();
                    frmSendMan.Dispose();
                }
            }
        }