Ejemplo n.º 1
0
        /// <summary>
        /// 获取在上次下载数据后更新过的数据
        /// </summary>
        /// <returns></returns>
        public List <ZcZoning> FindUpdate()
        {
            ZcZoningDao             dao     = new ZcZoningDao();
            DownloadIdentifyService service = new DownloadIdentifyService();
            DateTime lastUpdate             = service.GetLastUpdate();

            return(dao.FindUpdate(lastUpdate));
        }
Ejemplo n.º 2
0
        public List <ZcOrderSorte> FindByStreet()
        {
            ZcOrderSorteDao         dao     = new ZcOrderSorteDao();
            DownloadIdentifyService service = new DownloadIdentifyService();
            DateTime lastUpdate             = service.GetLastUpdate();

            return(dao.FindByStreet(lastUpdate));
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        private void submit()
        {
            string branch_code = listDataGridView.CurrentRow.Cells[0].Value.ToString();
            string branch_name = listDataGridView.CurrentRow.Cells[1].Value.ToString();
            //MessageBox.Show(code + "、" + branch_code + "、" + branch_name);


            DownloadIdentifyService identifyService = new DownloadIdentifyService();
            //将系统编码存入本地
        }
Ejemplo n.º 4
0
        private void loadData()
        {
            messagebox.SelectionStart = 0;
            messagebox.AppendText("开始下载数据,请稍等.......\n");
            DownloadDataService download = new DownloadDataService();

            download.DownloadData(this);
            DownloadIdentifyService service = new DownloadIdentifyService();

            ///更新最后一次下载时间
            service.UpdateIdentify(DateTime.Now);
            ///更新亭点收货标识
            service.UpdateHarvestFlag(Constant.HARVEST_NO);
        }
Ejemplo n.º 5
0
        private void DownloadData()
        {
            DownloadIdentifyService service = new DownloadIdentifyService();

            if (!service.NeedDownload())
            {
                return;
            }
            /////更新最后一次下载时间
            //service.UpdateIdentify(DateTime.Now);
            /////更新亭点收货标识
            //service.UpdateHarvestFlag(Constant.HARVEST_NO);
            DownloadData p = new DownloadData();

            p.StartPosition = FormStartPosition.CenterScreen;
            p.Show();
        }
Ejemplo n.º 6
0
        ///// <summary>
        ///// 主界面
        ///// </summary>
        //private BranchMain branchMain;

        ///// <summary>
        ///// 重载的构造函数
        ///// </summary>
        ///// <param name="branchMain"></param>
        //public DeliveryGoods(BranchMain branchMain)
        //{
        //    InitializeComponent();
        //    this.branchMain = branchMain;
        //}

        private void DeliveryGoods_Load(object sender, EventArgs e)
        {
            ////初始化当前分店
            //inNameTextBox.Text = LoginUserInfo.branchName;
            ////以下为暂时的默认数据
            //salesmanNameTextBox.Text = LoginUserInfo.name;
            //初始化当前分店
            inNameLabel.Text = LoginUserInfo.branchName;
            //以下为暂时的默认数据
            salesmanNameLabel.Text = LoginUserInfo.name;

            //itemsInput = new ItemInput(this, log);
            //itemsInput.TopLevel = false;
            //this.itemInputPanel.Controls.Add(itemsInput);
            //itemsInput.Show();

            DownloadIdentifyService service = new DownloadIdentifyService();

            ///判断亭点是否收获
            if (service.IsHarvest())
            {
                harvestFlag = false;
                ///已经已收货
                loadHarvestGoods();
                loadTotal();
            }
            else    ///未收货
            {
                loadGoods();
                initDifference();
            }



            Times times = new Times();

            times.TopLevel = false;
            this.timePanel.Controls.Add(times);
            times.Show();
            ///初始化焦点事件  将焦点放到扫描框
            numberTextBox.Focus();
        }
Ejemplo n.º 7
0
        private void deliveryButton_Click(object sender, EventArgs e)
        {
            if (!harvestFlag)
            {
                MessageBox.Show("当前货物已确认收货,无法重复确认收货!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                return;
            }
            bool deli   = false;
            bool prompt = false;

            if (itemDataGridView.Rows.Count == 0)
            {
                MessageBox.Show("当前并无需要提交的收货单!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                return;
            }
            for (int i = 0; i < itemDataGridView.Rows.Count; i++)
            {
                if (Convert.ToInt32(itemDataGridView[5, i].Value) == 0)
                {
                    deli = true;
                }

                if (Convert.ToInt32(itemDataGridView[6, i].Value) != 0)
                {
                    prompt = true;
                }
            }
            if (deli || prompt)
            {
                string   sInput   = "";
                DGPrompt dGPrompt = new DGPrompt();
                if (dGPrompt.ShowDialog() == DialogResult.OK)
                {//
                    sInput = dGPrompt.inputMess;
                    //MessageBox.Show(sInput);
                }
                if (!sInput.Equals("y"))
                {
                    return;
                }
            }

            List <DailyReceiveGoods> list = new List <DailyReceiveGoods>();

            //确定收货
            for (int i = 0; i < itemDataGridView.RowCount; i++)
            {
                DailyReceiveGoods obj = new DailyReceiveGoods();
                DataGridViewRow   dc  = itemDataGridView.Rows[i];
                obj.Id                  = Guid.NewGuid().ToString().Replace("-", "");
                obj.CreateTime          = DateTime.Now;
                obj.UpdateTime          = DateTime.Now;
                obj.SerialNumber        = dc.Cells[0].Value.ToString();
                obj.Name                = dc.Cells[1].Value.ToString();
                obj.Classify            = dc.Cells[11].Value.ToString();
                obj.GoodsUnit           = dc.Cells[10].Value.ToString();
                obj.GoodsSpecifications = dc.Cells[9].Value.ToString();
                obj.GooodsPrice         = dc.Cells[2].Value.ToString();
                obj.Nums                = dc.Cells[3].Value.ToString();
                obj.ActualQuantity      = dc.Cells[5].Value == null ? "" : dc.Cells[5].Value.ToString();
                obj.OrderAmount         = dc.Cells[7].Value.ToString();
                obj.ReceiveAmount       = dc.Cells[8].Value == null ? "" : dc.Cells[8].Value.ToString();
                obj.sortenum            = dc.Cells[4].Value.ToString();
                obj.Salesman            = LoginUserInfo.id;
                obj.BranchId            = LoginUserInfo.branchId;
                obj.receiveDate         = DateTime.Now;
                list.Add(obj);
            }
            BranchDailyReceiveGoodsService branchservice = new BranchDailyReceiveGoodsService();

            //存入本地数据库
            branchservice.AddDailyReceiveGoods(list);

            //将全部订单改为待提货
            BranchZcOrderTransitService branchZcOrderTransitService = new BranchZcOrderTransitService();

            branchZcOrderTransitService.UpdateOrderStatus(Constant.ORDER_STATUS_RECEIPT);
            //将亭点收获标识更新为true
            DownloadIdentifyService downloadService = new DownloadIdentifyService();

            downloadService.UpdateHarvestFlag(Constant.HARVEST_YES);

            List <ZcOrderTransit> tranlist = branchZcOrderTransitService.FindAll();

            ///上传数据处理
            if (PingTask.IsConnected)
            {
                //上传每日收货数据
                DailyReceiveGoodsService service = new DailyReceiveGoodsService();
                service.AddDailyReceiveGoods(list);

                ZcOrderTransitService zcOderTransitService = new ZcOrderTransitService();
                zcOderTransitService.UpdateStatus(tranlist);
            }
            else
            {
                List <UploadInfo> uploadList = new List <UploadInfo>();
                foreach (DailyReceiveGoods obj in list)
                {
                    UploadInfo uploadInfo = new UploadInfo();
                    uploadInfo.Id         = obj.Id;
                    uploadInfo.CreateTime = DateTime.Now;
                    uploadInfo.UpdateTime = DateTime.Now;
                    uploadInfo.Type       = Constant.DAILY_RECEIVE_GOODS;
                    uploadList.Add(uploadInfo);
                }
                foreach (ZcOrderTransit obj in tranlist)
                {
                    UploadInfo uploadInfo = new UploadInfo();
                    uploadInfo.Id         = obj.Id;
                    uploadInfo.CreateTime = DateTime.Now;
                    uploadInfo.UpdateTime = DateTime.Now;
                    uploadInfo.Type       = Constant.ZC_ORDER_TRANSIT_UPDATE;
                    uploadList.Add(uploadInfo);
                }

                UploadDao uploadDao = new UploadDao();
                uploadDao.AddUploadInfo(uploadList);
            }


            MessageBox.Show("收货成功!");
            this.branchMain.Show();
            this.Close();
        }
Ejemplo n.º 8
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            string username = this.userNameTextBox.Text;
            string pass     = this.userPasswordTextBox.Text;

            if (username.Equals("") || pass.Equals(""))
            {
                promptPanel.Show();
                //MessageBox.Show("用户名或者密码不能为空!");
                return;
            }
            string queryString = "";
            //调用Md5 获取加密后的密码
            string password = MD5Util.GetMd5(pass);

            //判断当前分店系统是否已获取自编码
            DownloadIdentifyService identifyService = new DownloadIdentifyService();

            code = identifyService.getIdCode();
            if (string.IsNullOrEmpty(code))
            {
                System.Guid guid = new Guid();
                guid = Guid.NewGuid();
                code = guid.ToString();

                //SetCode setCode = new SetCode(code);
                //setCode.ShowDialog();

                //将系统编码存入本地
                identifyService.setIdCode(code);
                code_flag = true;
            }


            ///业务逻辑判断
            /// 1判断是否是初始化第一次登陆
            if (identifyService.IsFirst())
            {
                ///需要连接远程Oracle服务器进行用户的验证
                ///2 判断网络是否连通
                if (PingTask.IsConnected)
                {
                    ///3  用户账号密码验证
                    queryString = "select password,id,name from ctp_user where name ='" + username + "'";
                    //获取数据库连接
                    OracleConnection connection = OracleUtil.OpenConn();
                    OracleCommand    command    = new OracleCommand(queryString);
                    command.Connection = connection;
                    try
                    {
                        var reader = command.ExecuteReader();
                        if (reader.Read())
                        {
                            string confirmPassword = string.Format("{0}", reader["password"]);
                            if (password.Equals(confirmPassword))
                            {
                                LoginUserInfo.id   = reader.IsDBNull(1) ? string.Empty : reader.GetString(1);
                                LoginUserInfo.name = reader.IsDBNull(2) ? string.Empty : reader.GetString(2);
                                loadLoginUserInfo();

                                identifyService.setBranchTotalId();
                                //上传分店系统编码
                                if (code_flag && !code.Equals(""))
                                {
                                    //获取当前分店信息
                                    ZcBranchTotalService branchTotal   = new ZcBranchTotalService();
                                    ZcBranchTotal        zcBranchTotal = branchTotal.FindOfAll(LoginUserInfo.branchCode);
                                    //将系统编码上传与分店绑定
                                    SetCodeToBranchService setCodeToBranchService = new SetCodeToBranchService();
                                    setCodeToBranchService.setIdCodeToBranch(code, zcBranchTotal, LoginUserInfo.branchId);
                                }
                                //MessageBox.Show(code_flag + ":" + code + ":" + LoginUserInfo.branchName + ":" + LoginUserInfo.branchId);

                                //用户名,密码验证成功
                                this.DialogResult = DialogResult.OK;
                            }
                            else
                            {
                                promptPanel.Show();
                                //MessageBox.Show("用户名或者密码输入错误,请重新输入!");
                            }
                        }
                        else
                        {
                            promptPanel.Show();
                            //MessageBox.Show("用户名或者密码输入错误,请重新输入!");
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("获取当前登录用户信息失败", ex);
                    }
                    finally
                    {
                        OracleUtil.CloseConn(connection);
                    }
                }
                else
                {
                    MessageBox.Show("首次登录系统会进行初始化的数据下载,请检查网络状态,重新登陆!");
                    return;
                }
            }
            else
            {
                ///表示已经初始化过系统,系统里面有用户表可以进行登陆判断
                ///判断是否需要下载数据    并且网络是否连通
                if (identifyService.NeedDownload() && (!PingTask.IsConnected))
                {
                    ///表示需要下载数据,并且网络未连通
                    ///今日首次登陆
                    MessageBox.Show("每日首次登录系统会进行订单等数据的下载,请检查网络状态,重新登陆!");
                    return;
                }
                else
                {
                    queryString = "select a.name,a.id,a.password from ctp_user a left join zc_user_info b on a.id = b.user_id "
                                  + " left join download_identify c on  b.branch_name_id = c.branch_id "
                                  + " where c.id = '1' and a.name = '" + username + "'";
                    /// 1 需要下载数据,网络通  2不需要下载数据, 网络通  3不需要下载数据,网络不通
                    MysqlDBHelper   dbHelper = new MysqlDBHelper();
                    MySqlConnection conn     = null;
                    MySqlCommand    cmd      = new MySqlCommand();
                    try
                    {
                        conn            = dbHelper.GetConnection();
                        cmd.CommandText = queryString;
                        cmd.Connection  = conn;
                        var reader = cmd.ExecuteReader();
                        if (reader.Read())
                        {
                            string confirmPassword = string.Format("{0}", reader["password"]);
                            if (password.Equals(confirmPassword))
                            {
                                LoginUserInfo.id   = reader.IsDBNull(1) ? string.Empty : reader.GetString(1);
                                LoginUserInfo.name = username;
                                MysqlloadLoginUserInfo();
                                //用户名,密码验证成功
                                this.DialogResult = DialogResult.OK;
                            }
                            else
                            {
                                promptPanel.Show();
                                //MessageBox.Show("用户名或者密码输入错误,请重新输入!");
                            }
                        }
                        else
                        {
                            promptPanel.Show();
                            //MessageBox.Show("用户名或者密码输入错误,请重新输入!");
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("查询当前登录账号信息失败", ex);
                    }
                }
            }
        }