Ejemplo n.º 1
0
        private void ShowSelectedGoods()
        {
            if (currGoods != null)
            {
                IBLL.ISaleData bll = new BLL.SaleData();
                if (supcus_no != "")
                {
                    if (bll.CheckCusIsRetail(supcus_no))
                    {
                        lbl_price.Text = currGoods.base_price.ToString("F2");//一级批发价
                    }
                    else
                    {
                        IBLL.IClientBLL bll2 = new BLL.ClientBLL();
                        lbl_price.Text = bll2.GetCusItemPrice(supcus_no, currGoods.item_no).ToString("F2"); //在线取客户零批价
                    }
                }
                else
                {
                    lbl_price.Text = currGoods.base_price.ToString("F2");//一级批发价
                }

                lblgoods.Text = currGoods.item_name;

                //自动取重模式:称重商品将自动取重
                if (Program.weight_model == "2" && currGoods.item_flag == "1")
                {
                    inputQty("取重");
                }
            }
        }
Ejemplo n.º 2
0
            public void doing()
            {
                try
                {
                    int             eId  = 99;
                    string          eMsg = "";
                    IBLL.IClientBLL bll  = new BLL.ClientBLL();
                    //上传销售出库单
                    decimal count = Conv.ToDecimal(bll.GetNoUpLoadSaleCount());
                    for (var i = 0; i < count / 100; i++)
                    {
                        bll.UpLoadSale(out eId, out eMsg);
                        if (eId == 0)
                        {
                            int temp_i = (int)count;
                            if (count > 100)
                            {
                                temp_i = (i + 1) * 100;
                            }
                            mainThreadCon.Invoke(deleg, 99, "销售出库单上传完成: " + temp_i);
                        }
                        else
                        {
                            throw new Exception("销售出库单上传异常:" + eMsg);
                            //mainThreadCon.Invoke(deleg, 99, eMsg);
                        }
                    }

                    //上传采购入库单
                    count = Conv.ToDecimal(bll.GetNoUpLoadInOutCount());
                    for (var i = 0; i < count / 100; i++)
                    {
                        bll.UpLoadInOut(out eId, out eMsg);
                        if (eId == 0)
                        {
                            int temp_i = (int)count;
                            if (count > 100)
                            {
                                temp_i = (i + 1) * 100;
                            }
                            mainThreadCon.Invoke(deleg, 99, "采购入库单上传完成: " + temp_i);
                        }
                        else
                        {
                            throw new Exception("销售出库单上传异常:" + eMsg);
                            //mainThreadCon.Invoke(deleg, 99, eMsg);
                        }
                    }

                    mainThreadCon.Invoke(deleg, 0, "");
                }
                catch (Exception ex)
                {
                    mainThreadCon.Invoke(deleg, -1, ex.GetMessage());
                    Log.writeLog("frmUpload ->MyTh.doing()", ex.ToString(), null);
                }
            }
Ejemplo n.º 3
0
        public CusBalanceForm(string cust_id)
        {
            InitializeComponent();

            IBLL.IClientBLL bll        = new BLL.ClientBLL();
            decimal         bal_amt    = 0;
            decimal         credit_amt = 0;

            bll.GetCusBalance(cust_id, out bal_amt, out credit_amt);

            IBLL.ISaleData bll2   = new BLL.SaleData();
            decimal        no_pay = bll2.GetCusNoPayAmt(cust_id);

            lbl_bal_amt.Text    = (bal_amt - no_pay).ToString("F2");
            lbl_credit_amt.Text = credit_amt.ToString("F2");
            lbl_use_amt.Text    = (credit_amt + (bal_amt - no_pay)).ToString("F2");
        }
Ejemplo n.º 4
0
        private void label14_Click(object sender, EventArgs e)
        {
            if (txt_pwd2.Text.Length == 0)
            {
                var frm = new MsgForm("请正确输入密码");
                frm.ShowDialog();
                txt_pwd2.Focus();
            }
            else
            {
                try
                {
                    IBLL.IClientBLL bll     = new BLL.ClientBLL();
                    string          old_pwd = txt_pwd1.Text;
                    string          pwd     = txt_pwd2.Text;
                    Helper.sec      sec     = new Helper.sec();
                    if (old_pwd != "")
                    {
                        old_pwd = sec.des(old_pwd);
                    }
                    if (pwd != "")
                    {
                        pwd = sec.des(pwd);
                    }
                    var res = bll.ChangePwd(Program.branch_no, Program.oper_id, old_pwd, pwd);
                    if (res)
                    {
                        IBLL.IOper bll2 = new BLL.Oper();
                        bll2.UpdatePwd(Program.branch_no, Program.oper_id, pwd);

                        var frm = new MsgForm("修改密码成功");
                        frm.ShowDialog();
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    var frm = new MsgForm(ex.GetMessage());
                    frm.ShowDialog();
                }
            }
        }
Ejemplo n.º 5
0
        public PUNReportData GetPUNReport(Guid punId)
        {
            PickupNoticeInformation.PickupNoticeAgentInformation punAgent = PickupNoticeInformation.PickupNoticeAgents[0];
            BLL.CommodityGradeBLL       commodityGrade = BLL.CommodityGradeBLL.GetCommodityGrade(PickupNoticeInformation.CommodityGradeId);
            BLL.ClientBLL               clientBLL      = BLL.ClientBLL.GetClinet(PickupNoticeInformation.ClientId);
            Membership.MemberShipLookUp memberLookup   = new WarehouseApplication.Membership.MemberShipLookUp();
            Membership.Member           member         = memberLookup.GetMember(PickupNoticeInformation.MemberId);
            Membership.Rep              rep            = memberLookup.GetRep(new Guid(PickupNoticeInformation.RepId));
            string        status     = ((PUNStatusType)PickupNoticeInformation.Status).ToString();
            PUNReportData reportData = new PUNReportData()
            {
                AgentName          = punAgent.AgentName,
                AgentTel           = punAgent.AgentTel,
                Client             = clientBLL.ClientName,
                ClientId           = clientBLL.ClientId,
                ExpectedPickupDate = PickupNoticeInformation.ExpectedPickupDate,
                ExpirationDate     = PickupNoticeInformation.ExpirationDate,
                Member             = (member == null)?null:member.Name,
                MemberId           = (member == null) ? null : member.IdNo,
                NIDNumber          = punAgent.NIDNumber,
                NIDType            = SystemLookup.LookupSource.GetLookup("NIDType")[punAgent.NIDType],
                PickupNoticeId     = PickupNoticeInformation.PickupNoticeId,
                Rep    = rep.RepName,
                RepId  = rep.IDNO,
                Status = status
            };

            foreach (PickupNoticeInformation.WarehouseReceiptInformation wr in PickupNoticeInformation.WarehouseReceipts)
            {
                reportData.WRs.Add(new WRReportData()
                {
                    CommodityGrade = commodityGrade.GradeName,
                    NetWeight      = wr.Weight,
                    PickupNoticeId = wr.PickupNoticeId,
                    Quantity       = wr.Quantity,
                    WHR            = wr.WarehouseReceiptId,
                    GRNNo          = wr.GRNNo
                });
            }
            return(reportData);
        }
Ejemplo n.º 6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //
            path = Application.StartupPath;
            //注册表
            Registry();

            /*
             * IBLL.IPayBLL pbll = new BLL.PayBLL();
             * string sheet_no = "";
             * Program.jh = "001";
             * pbll.MicroPay("81231000525321", "W", 0.01M, "135495986333499595", out sheet_no);
             */

            //处理未捕获的异常
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            //处理UI线程异常
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            //处理非UI线程异常
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            try
            {
                //更新软件
                if (!Debugger.IsAttached)
                {
                    SoftUpdate.Update();
                }


                //验证程序
                //if (SoftUpdate.VerifySoft() != 1)
                //{
                //    MessageBox.Show("没有找到加密狗!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //    System.Environment.Exit(0);
                //}

                //创建数据库文件
                try
                {
                    if (!System.IO.Directory.Exists(path + "\\logs"))
                    {
                        System.IO.Directory.CreateDirectory(path + "\\logs");
                    }
                    if (!System.IO.Directory.Exists(path + "\\setting"))
                    {
                        System.IO.Directory.CreateDirectory(path + "\\setting");
                    }
                    if (System.IO.Directory.Exists(path + "\\data") == false)
                    {
                        System.IO.Directory.CreateDirectory(path + "\\data");
                    }
                    string db_file = Application.StartupPath + "\\data\\data";
                    if (System.IO.File.Exists(db_file) == false)
                    {
                        SQLiteByHandClose.CreateFile(db_file);
                    }
                    conn = "Data Source=" + db_file + ";Version=3;Pooling=False;Max Pool Size=100;";
                    var db = new DB.SQLiteByHandClose(conn);
                    db.Open();
                    Program.db = db;
                    Program.db.ExecuteScalar("PRAGMA synchronous = OFF;", null);
                    create_table.bt_sysn_info.Upgrade(db);
                    create_table.bt_par_setting.Upgrade(db);
                    create_table.bi_t_item_cls.Upgrade(db);
                    create_table.bi_t_item_info.Upgrade(db);
                    create_table.bi_t_supcust_info.Upgrade(db);
                    create_table.ic_t_branch_stock.Upgrade(db);
                    create_table.ot_pay_flow.Upgrade(db);
                    create_table.ic_t_inout_store_detail.Upgrade(db);
                    create_table.ic_t_inout_store_master.Upgrade(db);
                    create_table.sa_t_operator_i.Upgrade(db);
                    create_table.sm_t_salesheet.Upgrade(db);
                    create_table.sm_t_salesheet_detail.Upgrade(db);
                    create_table.t_order_detail.Upgrade(db);
                    create_table.bi_t_branch_info.Upgrade(db);
                    create_table.sys_t_sheet_no.Upgrade(db);
                    create_table.bi_t_cust_price.Upgrade(db);
                    create_table.bi_t_sup_item.Upgrade(db);
                    create_table.sys_t_system.Upgrade(db);
                    create_table.t_print_log.Upgrade(db);
                    create_table.t_clear_db_log.Upgrade(db);
                    create_table.t_click_log.Upgrade(db);
                }
                catch (Exception ex)
                {
                    Log.writeLog("创建数据库失败", ex.ToString(), null);
                    var frm = new Forms.MsgForm(ex.GetMessage());
                    frm.ShowDialog();
                    return;
                    //throw ex;
                }

                //检测打印机参数设置
                if (Appsetting.is_print == "1" && Appsetting.print_name == "")
                {
                    var frm = new Forms.MsgForm("请先设置打印机");
                    frm.ShowDialog();
                    return;
                }

                //删除过期数据
                IBLL.ISysBLL bll = new BLL.SysBLL();
                if (1 == 1)
                {
                    try
                    {
                        bll.DeleteOldData();
                    }
                    catch (Exception ex)
                    {
                        Log.writeLog("删除过期数据失败", ex.ToString(), null);
                        var frm = new Forms.MsgForm(ex.GetMessage());
                        frm.ShowDialog();
                    }
                }

                //
                ReadWeight = new BLL.ReadWeight_Common();
                is_run     = true;
                try
                {
                    Thread t = new Thread(() => {
                        while (true)
                        {
                            try
                            {
                                IBLL.IClientBLL bll2 = new BLL.ClientBLL();
                                //判断网络连接状态
                                is_connect = bll2.CheckConnect();

                                for (var i = 0; i < 30; i++)
                                {
                                    Thread.Sleep(1000);
                                    if (!is_run)
                                    {
                                        System.Environment.Exit(0);
                                        break;
                                    }
                                }

                                //30秒自动上传销售和采购数据
                                if (is_connect && is_login)
                                {
                                    int errId     = 0;
                                    string errMsg = "";
                                    bll2.UpLoadSale(out errId, out errMsg);

                                    errId  = 0;
                                    errMsg = "";
                                    bll2.UpLoadInOut(out errId, out errMsg);
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("网络异常[2001]:" + ex.GetMessage());
                            }
                        }
                    });
                    t.Start();
                }
                catch (Exception ex)
                {
                    Log.writeLog("连接服务器异常", ex.ToString(), null);
                    var frm = new Forms.MsgForm(ex.GetMessage());
                    frm.ShowDialog();
                }
                //判断基础档案更新
                try
                {
                    Thread t = new Thread(() =>
                    {
                        while (true)
                        {
                            try
                            {
                                IBLL.IClientBLL bll2 = new BLL.ClientBLL();
                                int errId            = 0;
                                string errMsg        = "";
                                item_count           = bll2.GetItemCount(out errId, out errMsg);
                                sup_count            = bll2.GetSupCusCount(out errId, out errMsg);
                                cus_price_count      = bll2.GetCusPriceCount("", "", out errId, out errMsg);
                                sup_price_count      = bll2.GetSupPriceCount("", "", out errId, out errMsg);


                                if (is_connect && is_login)
                                {
                                    errId  = 0;
                                    errMsg = "";
                                    bll2.DownLoadItemCls(out errId, out errMsg);

                                    errId  = 0;
                                    errMsg = "";
                                    bll2.DownLoadItem(out errId, out errMsg);

                                    errId  = 0;
                                    errMsg = "";
                                    bll2.DownLoadSupCus(out errId, out errMsg);

                                    errId  = 0;
                                    errMsg = "";
                                    bll2.DownLoadCusPrice("", "", out errId, out errMsg);

                                    errId  = 0;
                                    errMsg = "";
                                    bll2.DownLoadSupPrice("", "", out errId, out errMsg);
                                }

                                Thread.Sleep(5 * 60 * 1000);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("网络异常[2002]:" + ex.GetMessage());
                            }
                        }
                    });
                    t.Start();
                }
                catch (Exception ex)
                {
                    Log.writeLog("判断基础档案更新异常", ex.ToString(), null);
                }
                //
                try
                {
                    var lst = bll.GetParSettingList();
                    foreach (Model.bt_par_setting item in lst)
                    {
                        if (item.par_id == "mo_ling")
                        {
                            mo_ling = item.par_val;
                        }
                        else if (item.par_id == "weight_model")
                        {
                            weight_model = item.par_val;
                        }
                        else if (item.par_id == "branch_no")
                        {
                            branch_no = item.par_val;
                        }
                        else if (item.par_id == "jh")
                        {
                            jh = item.par_val;
                        }
                        else if (item.par_id == "input_cus_model")
                        {
                            input_cus_model = item.par_val;
                        }
                        else if (item.par_id == "print_count")
                        {
                            print_count = Conv.ToInt(item.par_val);
                        }
                        else if (item.par_id == "can_input_qty")
                        {
                            can_input_qty = item.par_val;
                        }
                        else if (item.par_id == "is_continue_weight")
                        {
                            is_continue_weight = item.par_val;
                        }
                    }
                    if (branch_no.Length == 0)
                    {
                        if (new Forms.frmInitSetting().ShowDialog() == DialogResult.OK)
                        {
                            if (new Forms.WaitForm("正在加载数据,请稍候", "1").ShowWait())
                            {
                                if (new Forms.NewLoginForm().Login())
                                {
                                    Application.Run(new Forms.frmMenu());
                                }
                            }
                        }
                        else
                        {
                            System.Environment.Exit(0);
                        }
                    }
                    else
                    {
                        if (new Forms.WaitForm("正在加载数据,请稍候", "1").ShowWait())
                        {
                            if (new Forms.NewLoginForm().Login())
                            {
                                Application.Run(new Forms.frmMenu());
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.writeLog("系统异常", ex.ToString(), null);
                    var frm = new Forms.MsgForm(ex.GetMessage());
                    frm.ShowDialog();
                }
            }
            catch (Exception e)
            {
                string str         = "";
                string strDateInfo = "出现应用程序未处理的异常:" + DateTime.Now.ToString() + "\r\n";

                if (e != null)
                {
                    str = string.Format(strDateInfo + "异常类型:{0}\r\n异常消息:{1}\r\n异常信息:{2}\r\n",
                                        e.GetType().Name, e.Message, e.StackTrace);
                }
                else
                {
                    str = string.Format("应用程序线程错误:{0}", e);
                }
                Log.writeLog("Main", str);

                MessageBox.Show("系统错误!Message:" + e.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 7
0
        private void label14_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                if (txt_branch_no.Text.Trim().Length == 0)
                {
                    new MsgForm("机构编码不能为空").ShowDialog();
                    return;
                }
                string mo_ling         = "0";
                string weight_model    = "1";
                string input_cus_model = "1";
                if (radioButton2.Checked)
                {
                    mo_ling = "1";
                }
                else if (radioButton3.Checked)
                {
                    mo_ling = "2";
                }
                else if (radioButton4.Checked)
                {
                    mo_ling = "3";
                }

                if (radioButton6.Checked)
                {
                    weight_model = "2";
                }

                if (radioButton8.Checked)
                {
                    input_cus_model = "2";
                }

                var can_input_qty = "1";
                if (!chk_input_qty.Checked)
                {
                    can_input_qty = "0";
                }

                var is_continue_weight = "0";
                if (chk_continue_weight.Checked)
                {
                    is_continue_weight = "1";
                }

                IBLL.ISysBLL bll = new BLL.SysBLL();
                var          lst = new List <Model.bt_par_setting>();
                lst.Add(new Model.bt_par_setting {
                    par_id = "mo_ling", par_val = mo_ling
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "weight_model", par_val = weight_model
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "branch_no", par_val = txt_branch_no.Text
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "jh", par_val = txt_jh.Text
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "input_cus_model", par_val = input_cus_model
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "print_count", par_val = txt_print_count.Text
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "can_input_qty", par_val = can_input_qty
                });
                lst.Add(new Model.bt_par_setting {
                    par_id = "is_continue_weight", par_val = is_continue_weight
                });
                bll.UpdateParSetting(lst);
                Program.mo_ling            = mo_ling;
                Program.weight_model       = weight_model;
                Program.branch_no          = txt_branch_no.Text;
                Program.jh                 = txt_jh.Text;
                Program.input_cus_model    = input_cus_model;
                Program.print_count        = Conv.ToInt(txt_print_count.Text);
                Program.can_input_qty      = can_input_qty;
                Program.is_continue_weight = is_continue_weight;
                if (!SoftUpdate.PermissionsBalidation())
                {
                    IBLL.IClientBLL bll2   = new BLL.ClientBLL();
                    int             errId  = 0;
                    string          errMsg = "";
                    bll2.DownLoadOper(out errId, out errMsg);
                }

                var frm = new MsgForm("修改参数设置成功");
                frm.ShowDialog();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                new MsgForm(ex.GetMessage()).ShowDialog();
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Ejemplo n.º 8
0
            public void down()
            {
                try
                {
                    IBLL.IClientBLL bll = new BLL.ClientBLL();
                    if (1 == 1)
                    {
                        int    errId  = 0;
                        string errMsg = "";
                        bll.DownLoadBranch(out errId, out errMsg);
                        if (errId != 0)
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, -2, "下载机构档案异常:" + errMsg);
                            }
                            else
                            {
                                throw new Exception(errMsg);
                            }
                        }
                        else
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, 1, "下载机构档案完成");
                            }
                        }
                    }

                    if (chk1 == true)
                    {
                        int    errId  = 0;
                        string errMsg = "";
                        bll.DownLoadItemCls(out errId, out errMsg);
                        if (errId != 0)
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, -2, "下载品类档案异常:" + errMsg);
                            }
                            else
                            {
                                throw new Exception(errMsg);
                            }
                        }
                        else
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, 1, "下载品类档案完成");
                            }
                        }

                        bll.DownLoadItem(out errId, out errMsg);
                        if (errId != 0)
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, -2, "下载商品档案异常:" + errMsg);
                            }
                            else
                            {
                                throw new Exception(errMsg);
                            }
                        }
                        else
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, 1, "下载商品档案完成");
                            }
                        }
                    }
                    if (chk2 == true)
                    {
                        int    errId  = 0;
                        string errMsg = "";
                        bll.DownLoadOper(out errId, out errMsg);
                        if (errId != 0)
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, -2, "下载操作员档案异常:" + errMsg);
                            }
                            else
                            {
                                throw new Exception(errMsg);
                            }
                        }
                        else
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, 1, "下载操作员档案完成");
                            }
                        }
                    }
                    if (chk3 == true)
                    {
                        int    errId  = 0;
                        string errMsg = "";
                        bll.DownLoadStock(out errId, out errMsg);
                        if (errId != 0)
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, -2, "下载库存/成本异常:" + errMsg);
                            }
                            else
                            {
                                throw new Exception(errMsg);
                            }
                        }
                        else
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, 1, "下载库存/成本完成");
                            }
                        }
                    }
                    if (chk4 == true)
                    {
                        int    errId  = 0;
                        string errMsg = "";
                        bll.DownLoadSupCus(out errId, out errMsg);
                        if (errId != 0)
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, -2, "下载供应商/客户档案异常:" + errMsg);
                            }
                            else
                            {
                                throw new Exception(errMsg);
                            }
                        }
                        else
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, 1, "下载供应商/客户档案完成");
                            }
                        }
                    }
                    if (chk5 == true)
                    {
                        int    errId  = 0;
                        string errMsg = "";
                        bll.DownLoadSupPrice("", "", out errId, out errMsg);
                        if (errId != 0)
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, -2, "下载供应商价格异常:" + errMsg);
                            }
                            else
                            {
                                throw new Exception(errMsg);
                            }
                        }
                        else
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, 1, "下载供应商价格完成");
                            }
                        }

                        errId  = 0;
                        errMsg = "";
                        bll.DownLoadCusPrice("", "", out errId, out errMsg);
                        if (errId != 0)
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, -2, "下载客户价格异常:" + errMsg);
                            }
                            else
                            {
                                throw new Exception(errMsg);
                            }
                        }
                        else
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, 1, "下载客户价格完成");
                            }
                        }
                    }
                    if (1 == 1)
                    {
                        int    errId  = 0;
                        string errMsg = "";
                        bll.DownLoadSystemPars(out errId, out errMsg);
                        if (errId != 0)
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, -2, "下载系统参数异常:" + errMsg);
                            }
                            else
                            {
                                throw new Exception(errMsg);
                            }
                        }
                        else
                        {
                            if (deleg != null)
                            {
                                mainCon.Invoke(deleg, 1, "下载系统参数完成");
                            }
                        }
                    }

                    if (deleg != null)
                    {
                        mainCon.Invoke(deleg, 0, "");
                    }
                }
                catch (Exception ex)
                {
                    Log.writeLog("frmDownload ->downThread()", ex.GetMessage(), ex.StackTrace);
                    if (deleg != null)
                    {
                        mainCon.Invoke(deleg, -1, ex.GetMessage());
                    }
                }
            }
Ejemplo n.º 9
0
        private void WaitForm_Shown(object sender, EventArgs e)
        {
            if (this.op_type == "1")
            {
                try
                {
                    IBLL.IClientBLL bll = new BLL.ClientBLL();
                    if (1 == 1)
                    {
                        int errId = 0;
                        string errMsg = "";
                        bll.DownLoadBranch(out errId, out errMsg);
                        if (errId != 0)
                        {
                            new MsgForm("下载机构档案异常:" + errMsg).ShowDialog();
                            Log.writeLog("WaitForm()", "下载机构档案异常:" + errMsg, null);
                        }
                        Application.DoEvents();
                    }
                    if (1 == 1)
                    {
                        
                        int errId = 0;
                        string errMsg = "";
                        bll.DownLoadOper(out errId, out errMsg);
                        if (errId != 0)
                        {
                            new MsgForm("下载操作员档案异常:" + errMsg).ShowDialog();
                            Log.writeLog("WaitForm()", "下载操作员档案异常:" + errMsg, null);
                        }
                        Application.DoEvents();
                    }

                    if (1 == 1)
                    {
                        
                        int errId = 0;
                        string errMsg = "";
                        bll.DownLoadSystemPars(out errId, out errMsg);
                        if (errId != 0)
                        {
                            new MsgForm("下载系统参数异常:" + errMsg).ShowDialog();
                            Log.writeLog("WaitForm()", "下载系统参数异常:" + errMsg, null);
                        }
                        Application.DoEvents();
                    }
                }
                catch (Exception ex)
                {
                    new MsgForm("初始化数据异常:" + ex.GetMessage()).ShowDialog();
                    Log.writeLog("WaitForm()", "初始化数据异常:" + ex.GetMessage(), null);
                }
                finally
                {
                    timer1.Stop();
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
            }
            else if (this.op_type == "2")
            { 
            
            }
        }
Ejemplo n.º 10
0
        //取重、输入数量
        private void inputQty(string text)
        {
            if (supcus_no == "")
            {
                new MsgForm("未选择客户").ShowDialog();
                return;
            }
            if (currGoods != null)
            {
                if (Program.is_continue_weight == "1" && total_weight == Weight)
                {
                    new MsgForm("请先放商品,再取重").ShowDialog();
                    return;
                }
                IBLL.ISaleData       bll      = new BLL.SaleData();
                IBLL.IGoods          goodsBLL = new BLL.Goods();
                Model.bi_t_item_info gd       = currGoods;
                Model.t_order_detail item     = new Model.t_order_detail();
                item.item_no = gd.item_no;
                switch (text)
                {
                case "取重":
                    if (Program.is_continue_weight == "1" && total_weight != 0)
                    {
                        item.qty = Weight - total_weight;
                    }
                    else
                    {
                        item.qty = Weight;
                    }
                    break;

                case "手输数量":
                    if (Program.can_input_qty == "1" && currGoods.item_flag == "1")
                    {
                        new MsgForm("称重商品不可手输数量").ShowDialog();
                        return;
                    }
                    InputNumerForm frm = new InputNumerForm("数量", 3);
                    decimal        qty = 0;
                    if (frm.Input(out qty) == true)
                    {
                        if (qty <= 0)
                        {
                            new MsgForm("数量不正确").ShowDialog();
                            return;
                        }
                        item.qty = qty;
                    }
                    else
                    {
                        return;
                    }

                    break;
                }
                if (bll.CheckCusIsRetail(supcus_no))
                {
                    item.price = currGoods.base_price;//一级批发价
                }
                else
                {
                    IBLL.IClientBLL bll2 = new BLL.ClientBLL();
                    item.price = bll2.GetCusItemPrice(supcus_no, item.item_no); //在线取客户零批价
                }
                total_weight = Weight;

                item.item_subno   = gd.item_subno;
                item.item_name    = gd.item_name;
                item.unit_no      = gd.unit_no;
                item.amt          = item.qty * item.price;
                item.sheet_no     = lblsheet_no.Text;
                item.oper_id      = Program.oper_id;
                item.oper_date    = DateTime.Now;
                item.jh           = Program.jh;
                item.cost_price   = goodsBLL.GetCost(gd.item_no, Program.branch_no);
                item.branch_no    = Program.branch_no;
                item.cus_no       = supcus_no;
                item.sup_no       = supcus_no;
                item.is_give      = "0";
                item.source_price = item.price;
                item.discount     = 1;

                int flow_id = 0;
                bll.Insert(item, out flow_id);
                item.flow_id = flow_id;
                this.lines.Add(item);
                this.ShowLine();
            }
        }