Пример #1
0
 private void btnSelectBranch_Click(object sender, EventArgs e)
 {
     using (FrmBranchSelect select = new FrmBranchSelect("0,2"))
     {
         select.ShowDialog();
         if (!string.IsNullOrEmpty(select.BranchNO))
         {
             this.txtBranchNO.Text = select.BranchNO;
         }
     }
 }
Пример #2
0
        /// <summary>
        /// F1查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSelectBranch_Click(object sender, EventArgs e)
        {
            #region test1
            string type = "0,2";
            using (FrmBranchSelect select = new FrmBranchSelect(type.ToString()))
            {
                select.ShowDialog();
                if (!string.IsNullOrEmpty(select.BranchNO))
                {
                    bool   isok         = true;
                    string errorMessage = string.Empty;;
                    this.txtdBranchNO.Text = select.BranchNO;
                    Dictionary <string, object> _dic = Gfunc.GetServiceParameter();
                    _dic.Add("branch_no", Gattr.BranchNo);
                    _dic.Add("d_branch_no", this.txtdBranchNO.Text);
                    string result = PServiceProvider.Instance.InvokeMethod(Gattr.serverUrl + "/Getcomstock", _dic, ref isok, ref errorMessage);
                    if (isok)
                    {
                        if (result != "-10" && result != "-20")
                        {
                            if (result != "-1" && result != "0" && result != "-2")
                            {
                                DataTable table = JsonUtility.Instance.JsonToDataTable(result);
                                this.dt.Clear();
                                foreach (DataRow dr in table.Rows)
                                {
                                    DataRow dr1 = this.dt.NewRow();
                                    dr1["item_no"]    = ExtendUtility.Instance.ParseToString(dr["item_no"]);
                                    dr1["item_subno"] = "";
                                    dr1["item_name"]  = ExtendUtility.Instance.ParseToString(dr["item_name"]);
                                    //dr1["item_size"] = ExtendUtility.Instance.ParseToString(dr["item_size"]);
                                    dr1["unit_no"]   = ExtendUtility.Instance.ParseToString(dr["unit_no"]);
                                    dr1["real_qty"]  = 1;
                                    dr1["other1"]    = "";
                                    dr1["stock"]     = ExtendUtility.Instance.ParseToString(dr["item_stock"]);
                                    dr1["stock_qty"] = ExtendUtility.Instance.ParseToString(dr["d_stock_qty"]);
                                    this.dt.Rows.Add(dr1);
                                }
                            }
                            else
                            {
                                string error = "";
                                switch (result)
                                {
                                case "-1":
                                    error = "记录不存在";
                                    break;

                                case "-2":
                                    error = "保存异常";
                                    break;

                                default:
                                    error = "保存失败";
                                    break;
                                }
                                MessageBox.Show(error, Gattr.AppTitle);
                            }
                        }
                        else
                        {
                            if (result == "-10")
                            {
                                //参数错误
                                MessageBox.Show("参数错误", Gattr.AppTitle);
                            }
                            else
                            {
                                //禁止操作
                                MessageBox.Show("禁止操作", Gattr.AppTitle);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(errorMessage, Gattr.AppTitle);
                    }
                }
            }
            if (this.txtdBranchNO.Text.Trim() != "")
            {
                //string tradeType = Gattr.Bll.GetTradeType(this.txtdBranchNO.Text.Trim());
                //if (tradeType.Equals("0") || tradeType.Equals("2"))
                //{
                //    this.cmbType.SelectedIndex = 0;
                //    this.dateValid.Visible = this.cmbType.SelectedIndex == 0;
                //    this.lblValide.Visible = this.cmbType.SelectedIndex == 0;
                //}
                //else
                //{
                this.cmbType.SelectedIndex = 0;
                this.dateValid.Visible     = this.cmbType.SelectedIndex == 0;
                this.lblValide.Visible     = this.cmbType.SelectedIndex == 0;
                //}
            }
            #endregion
        }