Example #1
0
        /// <summary>
        /// 添加商品,采购单位未完成,价格取值未完成,税额未完成
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ButtonPRODAdd_Click(object sender, EventArgs e)
        {
            FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid;

            int[]  selections    = Grid4.SelectedRowIndexArray;
            string _TAKEIN_ID    = tbxTAKEIN_ID.Text;
            string _Shop_ID      = ddlSHOP_NAME.SelectedValue;
            string _Shop_Name    = ddlSHOP_NAME.SelectedText;
            string result        = "";
            var    m_Shop        = new SHOP00(x => x.SHOP_ID == _Shop_ID);
            string _priceArea_id = m_Shop.SHOP_Price_Area;

            if (!String.IsNullOrEmpty(_TAKEIN_ID))
            {
                foreach (int i in selections)
                {
                    string  _Prod_ID = Grid4.DataKeys[i][0].ToString();
                    string  _shop_id = ddlSHOP_NAME.SelectedValue;
                    var     model    = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id);
                    int     rowCount = Grid2.Rows.Count;
                    JObject deObject = new JObject();
                    deObject.Add("Id01", "0");
                    deObject.Add("SHOP_ID01", _Shop_ID);
                    deObject.Add("SHOP_NAME01", _Shop_Name);
                    deObject.Add("TAKEIN_ID01", _TAKEIN_ID);
                    deObject.Add("SNo01", rowCount + 1);
                    deObject.Add("PROD_ID01", _Prod_ID);
                    deObject.Add("PROD_NAME01", model.PROD_NAME1);
                    deObject.Add("QUANTITY01", model.ORDER_QUAN);
                    deObject.Add("STD_UNIT01", model.Purchase_UNIT);
                    deObject.Add("STD_CONVERT01", model.PROD_CONVERT1);
                    deObject.Add("STD_QUAN01", model.Purchase_QUAN);
                    deObject.Add("STD_PRICE01", model.COST);
                    deObject.Add("Tax01", 0);
                    deObject.Add("QUAN101", 0);
                    deObject.Add("QUAN201", 0);
                    deObject.Add("Item_DISC_Amt01", 0);
                    deObject.Add("MEMO", "");
                    deObject.Add("BAT_NO", "");
                    //var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());
                    //string lgname = OlUser.Manager_LoginName;
                    //deObject.Add("CRT_USER_ID1", lgname);
                    //deObject.Add("CRT_DATETIME1", DateTime.Now.ToString());
                    //deObject.Add("MOD_USER_ID1", OlUser.Manager_LoginName);
                    //deObject.Add("MOD_DATETIME1", DateTime.Now.ToString());
                    Grid2.AddNewRecord(deObject, true);
                }
            }
            else
            {
                FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information);
            }
            if (!String.IsNullOrEmpty(result.Trim()))
            {
                FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// 添加商品,采购单位未完成,价格取值未完成,税额未完成
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ButtonPRODAdd_Click(object sender, EventArgs e)
        {
            FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid;

            int[]  selections    = Grid4.SelectedRowIndexArray;
            string _tbxPREPAR_ID = tbxPREPAR_ID.Text;
            string _Shop_ID      = ddlSHOP_NAME.SelectedValue;
            string _Shop_Name    = ddlSHOP_NAME.SelectedText;
            string result        = "";
            var    m_Shop        = new SHOP00(x => x.SHOP_ID == _Shop_ID);
            string _priceArea_id = m_Shop.SHOP_Price_Area;

            if (!String.IsNullOrEmpty(_tbxPREPAR_ID))
            {
                foreach (int i in selections)
                {
                    string  _Prod_ID = Grid4.DataKeys[i][0].ToString();
                    string  _shop_id = ddlSHOP_NAME.SelectedValue;
                    var     model    = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id);
                    int     rowCount = Grid2.Rows.Count;
                    JObject deObject = new JObject();
                    deObject.Add("Id01", "0");
                    deObject.Add("SHOP_ID01", _Shop_ID);
                    deObject.Add("SHOP_NAME01", _Shop_Name);
                    deObject.Add("PREPARE_ID01", _tbxPREPAR_ID);
                    deObject.Add("SNo01", rowCount + 1);
                    deObject.Add("PROD_ID01", _Prod_ID);
                    deObject.Add("PROD_NAME01", model.PROD_NAME1);
                    deObject.Add("QUANTITY01", model.ORDER_QUAN);
                    deObject.Add("STD_UNIT01", 0);
                    deObject.Add("STD_CONVERT01", 0);
                    deObject.Add("STD_QUAN01", 0);
                    deObject.Add("STD_PRICE01", 0);
                    deObject.Add("COST01", "");

                    deObject.Add("sProd_ID01", "");
                    deObject.Add("BAT_NO01", "");
                    deObject.Add("IsScales01", 0);
                    deObject.Add("IsFlag01", 0);
                    deObject.Add("Scales_User01", "");
                    deObject.Add("Scale_Date01", DateTime.Now.ToString());


                    deObject.Add("MEMO01", "");
                    Grid2.AddNewRecord(deObject, true);
                }
            }
            else
            {
                FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information);
            }
            if (!String.IsNullOrEmpty(result.Trim()))
            {
                FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ButtonPRODAdd_Click(object sender, EventArgs e)
        {
            FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid;

            int[]  selections    = Grid4.SelectedRowIndexArray;
            string _INV_ID       = tbxINV_ID.Text;
            string _Shop_ID      = ddlSHOP_NAME.SelectedValue;
            string _Shop_Name    = ddlSHOP_NAME.SelectedText;
            string result        = "";
            var    m_Shop        = new SHOP00(x => x.SHOP_ID == _Shop_ID);
            string _priceArea_id = m_Shop.SHOP_Price_Area;

            if (!String.IsNullOrEmpty(_INV_ID))
            {
                foreach (int i in selections)
                {
                    string _Prod_ID    = Grid4.DataKeys[i][0].ToString();
                    string _prod_name  = Grid4.DataKeys[i][1].ToString();
                    string checkresult = ProdAddCheck(_Prod_ID, _prod_name);
                    if (!String.IsNullOrEmpty(checkresult))
                    {
                        result = result + "\r\n" + checkresult;
                        continue;
                    }
                    string  _shop_id = ddlSHOP_NAME.SelectedValue;
                    var     model    = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id);
                    int     rowCount = Grid2.Rows.Count;
                    JObject deObject = new JObject();
                    deObject.Add("Id01", "0");
                    deObject.Add("SHOP_ID01", _Shop_ID);
                    deObject.Add("SHOP_NAME101", _Shop_Name);
                    deObject.Add("INV_ID01", _INV_ID);
                    deObject.Add("SNo01", rowCount + 1);
                    deObject.Add("PROD_ID01", _Prod_ID);
                    deObject.Add("PROD_NAME01", model.PROD_NAME1);
                    deObject.Add("QUANTITY01", model.SAFE_QUAN);
                    deObject.Add("QUAN01", 0);
                    deObject.Add("QUAN101", 0);
                    deObject.Add("QUAN201", 0);
                    deObject.Add("QUAN_B01", 0);
                    deObject.Add("MEMO01", 0);
                    Grid2.AddNewRecord(deObject, true);
                }
            }
            else
            {
                FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information);
            }
            if (!String.IsNullOrEmpty(result.Trim()))
            {
                FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information);
            }
        }
        protected void ButtonOrderAdd_Click(Object sender, EventArgs e)
        {
            FineUI.Grid Grid4      = Window4.FindControl("PanelGrid5").FindControl("Grid4") as FineUI.Grid;
            int[]       selections = Grid4.SelectedRowIndexArray;
            tbxRELATE_ID.Text = Grid4.DataKeys[0][0].ToString();
            foreach (int i in selections)
            {
                List <ConditionFun.SqlqueryCondition> order00con = new List <ConditionFun.SqlqueryCondition>();
                order00con.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, OUT_BACK01Table.BK_ID, Comparison.Equals, Grid4.DataKeys[i][0].ToString(), false, false));
                List <string> colList = new List <string>();
                colList.Add("SHOP_ID");
                colList.Add("PROD_ID");
                colList.Add("QUANTITY");
                colList.Add("STD_UNIT");
                colList.Add("STD_CONVERT");
                colList.Add("STD_QUAN");
                colList.Add("STD_PRICE");
                //colList.Add("COST_PRICE");
                //colList.Add("");预留采购单位类别
                DataTable da = OUT_BACK01Bll.GetInstence().GetDataTable(false, 0, colList, 0, 0, order00con, null);

                foreach (DataRow dr in da.Rows)
                {
                    string  _shopid  = dr["SHOP_ID"].ToString();
                    string  _PROD_ID = dr["PROD_ID"].ToString();
                    var     model    = new SHOP00(x => x.SHOP_ID == _shopid);
                    var     model2   = new PRODUCT00(x => x.PROD_ID == _PROD_ID);
                    int     rowCount = Grid2.Rows.Count;
                    JObject deObject = new JObject();
                    deObject.Add("Id01", "0");
                    deObject.Add("SHOP_ID01", dr["SHOP_ID"].ToString());
                    deObject.Add("SHOP_NAME01", model.SHOP_NAME1);
                    deObject.Add("IB_ID01", tbxIB_ID.Text);
                    deObject.Add("SNo01", rowCount + 1);
                    deObject.Add("PROD_ID01", dr["PROD_ID"].ToString());
                    deObject.Add("PROD_NAME01", model2.PROD_NAME1);
                    deObject.Add("QUANTITY01", dr["QUANTITY"].ToString());
                    deObject.Add("STD_TYPE01", dr["STD_UNIT"].ToString());
                    deObject.Add("STD_UNIT01", dr["STD_UNIT"].ToString());
                    deObject.Add("STD_CONVERT01", dr["STD_CONVERT"].ToString());
                    deObject.Add("STD_QUAN01", dr["STD_QUAN"].ToString());
                    deObject.Add("STD_PRICE01", dr["STD_PRICE"].ToString());
                    deObject.Add("COST01", dr["STD_PRICE"].ToString());
                    deObject.Add("QUAN101", dr["STD_QUAN"].ToString());
                    deObject.Add("QUAN201", dr["STD_QUAN"].ToString());
                    deObject.Add("MEMO01", "");
                    deObject.Add("BAT_NO", "");
                    Grid2.AddNewRecord(deObject, true);
                }
            }
        }
Example #5
0
        protected void Grid2AddNewRow_Click(object sender, EventArgs e)
        {
            FineUI.Grid Grid3 = Window2.FindControl("PanelA").FindControl("Grid3") as FineUI.Grid;

            int[]  selections = Grid3.SelectedRowIndexArray;
            string _ORDDEP_ID = hidORDDEP_ID.Text.ToString();
            string result     = "";

            if (!String.IsNullOrEmpty(_ORDDEP_ID))
            {
                foreach (int i in selections)
                {
                    int    _Id         = ConvertHelper.Cint(Grid3.DataKeys[i][0].ToString());
                    var    model       = new PROD_DEP(x => x.Id == _Id);
                    string checkResult = CheckDataAddDep(model.DEP_ID);
                    if (!String.IsNullOrEmpty(checkResult))
                    {
                        result = result + checkResult + Environment.NewLine;
                        continue;
                    }

                    JObject deObject = new JObject();
                    deObject.Add("Id1", "0");
                    deObject.Add("ORDDEP_ID1", _ORDDEP_ID);
                    deObject.Add("DEP_ID1", model.DEP_ID);
                    deObject.Add("DEP_NAME1", model.DEP_NAME);
                    deObject.Add("Meno", " ");
                    deObject.Add("USABLE1", true);
                    var    OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());
                    string lgname = OlUser.Manager_LoginName;
                    deObject.Add("CRT_USER_ID1", lgname);
                    deObject.Add("CRT_DATETIME1", DateTime.Now.ToString());
                    deObject.Add("MOD_USER_ID1", OlUser.Manager_LoginName);
                    deObject.Add("MOD_DATETIME1", DateTime.Now.ToString());
                    Grid2.AddNewRecord(deObject, true);
                }
            }
            if (!String.IsNullOrEmpty(result.Trim()))
            {
                FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information);
            }
        }
        ///// <summary>
        ///// 更新按钮
        ///// </summary>
        //public void BtnPur01_Edit(Object sender, EventArgs e)
        //{
        //    string result = Pur_Edit();
        //    if (!String.IsNullOrEmpty(result))
        //    {
        //        FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Error);
        //    }
        //}
        /// <summary>
        /// 新增一个按钮触发事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void btn_Pur02AddSingle(Object sender, EventArgs e)
        {
            string  _Shop_ID   = ddlSHOP_NAME.SelectedValue;
            string  _Shop_Name = ddlSHOP_NAME.SelectedText;
            string  _Pur00_ID  = tbxPurchase_ID.Text;
            JObject deObject   = new JObject();
            int     rowCount   = Grid2.Rows.Count;

            deObject.Add("Id01", "0");
            deObject.Add("SHOP_ID01", _Shop_ID);
            deObject.Add("SHOP_NAME01", "");
            deObject.Add("SHOP_NAME02", "");
            deObject.Add("Purchase_ID01", _Pur00_ID);
            deObject.Add("SNo01", rowCount + 1);
            deObject.Add("PROD_ID01", "");
            deObject.Add("PROD_NAME01", "");
            deObject.Add("QUANTITY01", "");
            deObject.Add("STD_UNIT01", "");
            deObject.Add("STD_UNIT_NAME01", "");
            deObject.Add("STD_CONVERT01", "");

            deObject.Add("STD_QUAN01", "");
            deObject.Add("STD_PRICE01", "");
            deObject.Add("Tax01", 0);
            deObject.Add("QUAN101", 0);
            deObject.Add("QUAN201", 0);
            deObject.Add("Item_DISC_Amt01", 0);
            deObject.Add("MEMO", "");

            deObject.Add("UNIT_NAME01", "");
            deObject.Add("UNIT_NAME101", "");
            deObject.Add("UNIT_NAME201", "");
            deObject.Add("PROD_CONVERT101", "");
            deObject.Add("PROD_CONVERT201", "");
            deObject.Add("SUP_COST01", "");
            deObject.Add("SUP_COST101", "");
            deObject.Add("SUP_COST201", "");
            deObject.Add("Tax_Num01", "");
            deObject.Add("Tax_Type01", "");
            Grid2.AddNewRecord(deObject, true);
        }
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ButtonPRODAdd_Click(object sender, EventArgs e)
        {
            FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid;

            int[]  selections    = Grid4.SelectedRowIndexArray;
            string _Pur00_ID     = hidPurchase_ID.Text;
            string _Shop_ID      = ddlSHOP_NAME.SelectedValue;
            string _Shop_Name    = ddlSHOP_NAME.SelectedText;
            string result        = "";
            var    m_Shop        = new SHOP00(x => x.SHOP_ID == _Shop_ID);
            string _priceArea_id = m_Shop.SHOP_Price_Area;
            int    rowCount      = Grid2.Rows.Count;

            if (!String.IsNullOrEmpty(_Pur00_ID))
            {
                foreach (int i in selections)
                {
                    string _Prod_ID    = Grid4.DataKeys[i][0].ToString();
                    string _prod_name  = Grid4.DataKeys[i][1].ToString();
                    string checkresult = ProdAddCheck(_Prod_ID, _prod_name);
                    if (!String.IsNullOrEmpty(checkresult))
                    {
                        result = result + "\r\n" + checkresult;
                        continue;
                    }
                    string  _shop_id = ddlSHOP_NAME.SelectedValue;
                    var     model    = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id);
                    JObject deObject = new JObject();
                    deObject.Add("Id01", "0");
                    deObject.Add("SHOP_ID01", _Shop_ID);
                    deObject.Add("SHOP_NAME01", _Shop_Name);
                    deObject.Add("Purchase_ID01", _Pur00_ID);
                    rowCount = rowCount + 1;
                    deObject.Add("SNo01", rowCount);
                    deObject.Add("PROD_ID01", _Prod_ID);
                    deObject.Add("PROD_NAME01", model.PROD_NAME1);
                    deObject.Add("PROD_NAME02", model.PROD_NAME1);
                    deObject.Add("QUANTITY01", model.ORDER_QUAN);
                    deObject.Add("STD_UNIT01", model.Purchase_UNIT);
                    deObject.Add("STD_UNIT_NAME01", model.Purchase_UNIT_NAME);
                    deObject.Add("STD_CONVERT01", model.Purchase_CONVERT);

                    deObject.Add("STD_QUAN01", model.Purchase_QUAN);
                    deObject.Add("STD_PRICE01", model.Purchase_PRICE);
                    if (model.TAX_TYPE == '0')
                    {
                        deObject.Add("Tax01", 0);
                    }
                    else
                    {
                        deObject.Add("Tax01", ConvertHelper.Cdbl((model.Purchase_PRICE.ToString())) * ConvertHelper.Cdbl((model.Purchase_QUAN.ToString())) * ConvertHelper.Cdbl((model.Tax.ToString())) * 0.01);
                    }
                    deObject.Add("QUAN101", 0);
                    deObject.Add("QUAN201", 0);
                    deObject.Add("Item_DISC_Amt01", 0);
                    deObject.Add("MEMO", "");

                    deObject.Add("UNIT_NAME01", model.UNIT_NAME);
                    deObject.Add("UNIT_NAME101", model.UNIT_NAME1);
                    deObject.Add("UNIT_NAME201", model.UNIT_NAME2);
                    deObject.Add("PROD_CONVERT101", model.PROD_CONVERT1);
                    deObject.Add("PROD_CONVERT201", model.PROD_CONVERT2);
                    deObject.Add("SUP_COST01", model.SUP_COST);
                    deObject.Add("SUP_COST101", model.SUP_COST1);
                    deObject.Add("SUP_COST201", model.SUP_COST2);
                    deObject.Add("Tax_Num01", model.Tax);
                    deObject.Add("Tax_Type01", model.TAX_TYPE);
                    Grid2.AddNewRecord(deObject, true);
                }
            }
            else
            {
                FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information);
            }
            if (!String.IsNullOrEmpty(result.Trim()))
            {
                FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information);
            }
        }
Example #8
0
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ButtonPRODAdd_Click(object sender, EventArgs e)
        {
            FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid;

            int[] selections = Grid4.SelectedRowIndexArray;
            //这里要改
            string _TAKENIN_ID = tbxTAKEIN_ID.Text;
            string result      = "";

            if (!String.IsNullOrEmpty(_TAKENIN_ID))
            {
                int rowCount = Grid2.Rows.Count;
                foreach (int i in selections)
                {
                    string _Prod_ID    = Grid4.DataKeys[i][0].ToString();
                    string _prod_name  = Grid4.DataKeys[i][1].ToString();
                    string _PRCAREA_ID = Grid4.DataKeys[i][2].ToString();
                    string checkresult = ProdAddCheck(_Prod_ID, _prod_name);
                    if (!String.IsNullOrEmpty(checkresult))
                    {
                        result = result + "\r\n" + checkresult;
                        continue;
                    }

                    var     model    = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _PRCAREA_ID);
                    JObject deObject = new JObject();
                    deObject.Add("Id01", "0");
                    deObject.Add("SHOP_ID01", ddlSHOP_NAME.SelectedValue);
                    deObject.Add("SHOP_NAME101", ddlSHOP_NAME.SelectedText);
                    deObject.Add("TAKEIN_ID01", _TAKENIN_ID);
                    deObject.Add("SNo01", rowCount + 1);
                    deObject.Add("PROD_ID01", _Prod_ID);
                    deObject.Add("PROD_NAME101", model.PROD_NAME1);
                    deObject.Add("QUANTITY01", model.Purchase_QUAN);
                    deObject.Add("STD_UNIT01", model.Purchase_UNIT);
                    deObject.Add("STD_QUAN01", model.Purchase_QUAN);
                    switch (model.Purchase_UNIT)
                    {
                    case 1:
                        deObject.Add("STD_PRICE01", model.SUP_COST);
                        deObject.Add("STD_CONVERT01", 1);
                        break;

                    case 2:
                        deObject.Add("STD_PRICE01", model.SUP_COST1);
                        deObject.Add("STD_CONVERT01", model.PROD_CONVERT1);
                        break;

                    case 3:
                        deObject.Add("STD_PRICE01", model.SUP_COST2);
                        deObject.Add("STD_CONVERT01", model.PROD_CONVERT2);
                        break;

                    default:
                        deObject.Add("STD_PRICE01", 0);
                        deObject.Add("STD_CONVERT01", 1);
                        break;
                    }
                    if (model.TAX_TYPE == '0')
                    {
                        deObject.Add("Tax01", 0);
                    }
                    else
                    {
                        deObject.Add("Tax01", model.Tax * model.TAX_TYPE * 0.01);
                    }


                    deObject.Add("QUAN101", 0);
                    deObject.Add("QUAN201", 0);
                    deObject.Add("MEMO01", "");
                    deObject.Add("BAT_NO", "");

                    deObject.Add("STD_UNIT_NAME01", model.Purchase_UNIT_NAME);
                    deObject.Add("UNIT_NAME01", model.UNIT_NAME);
                    deObject.Add("UNIT_NAME101", model.UNIT_NAME1);
                    deObject.Add("UNIT_NAME201", model.UNIT_NAME2);

                    deObject.Add("PROD_CONVERT101", model.PROD_CONVERT1);
                    deObject.Add("PROD_CONVERT201", model.PROD_CONVERT2);

                    deObject.Add("SUP_COST01", model.SUP_COST);
                    deObject.Add("SUP_COST101", model.SUP_COST1);
                    deObject.Add("SUP_COST201", model.SUP_COST2);
                    deObject.Add("Tax_Num01", model.Tax);
                    deObject.Add("Tax_Type01", model.TAX_TYPE);
                    rowCount++;
                    Grid2.AddNewRecord(deObject, true);
                }
            }
            else
            {
                FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information);
            }
            if (!String.IsNullOrEmpty(result.Trim()))
            {
                FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ButtonPRODAdd_Click(object sender, EventArgs e)
        {
            FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid;

            int[]  selections    = Grid4.SelectedRowIndexArray;
            string _OUT_ID       = tbxOUT_ID.Text;
            string _Shop_ID      = ddlIN_SHOP.SelectedValue;
            string _Shop_Name    = ddlIN_SHOP.SelectedText;
            string result        = "";
            var    m_Shop        = new SHOP00(x => x.SHOP_ID == _Shop_ID);
            string _priceArea_id = m_Shop.SHOP_Price_Area;
            int    rowCount      = Grid2.Rows.Count;

            if (!String.IsNullOrEmpty(_OUT_ID))
            {
                foreach (int i in selections)
                {
                    string _Prod_ID    = Grid4.DataKeys[i][0].ToString();
                    string _shop_id    = ddlSHOP_NAME.SelectedValue;
                    string _prod_name  = Grid4.DataKeys[i][1].ToString();
                    string checkresult = ProdAddCheck(_Prod_ID, _prod_name);
                    if (!String.IsNullOrEmpty(checkresult))
                    {
                        result = result + "\r\n" + checkresult;
                        continue;
                    }
                    var     model    = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id);
                    JObject deObject = new JObject();
                    deObject.Add("Id01", "0");
                    deObject.Add("SHOP_ID01", _Shop_ID);
                    deObject.Add("SHOP_NAME101", _Shop_Name);
                    deObject.Add("OUT_ID01", _OUT_ID);
                    deObject.Add("SNo01", rowCount + 1);
                    deObject.Add("PROD_ID01", _Prod_ID);
                    deObject.Add("PROD_NAME01", model.PROD_NAME1);
                    deObject.Add("QUANTITY01", model.ORDER_QUAN);
                    deObject.Add("STD_UNIT01", model.ORDER_UNIT);

                    string STD_PRICE01  = "";
                    string PROD_CONVERT = "";
                    //根据门店类型取进价
                    if (m_Shop.SHOP_KIND == 2)
                    {
                        switch (model.ORDER_UNIT)
                        {
                        case 1: STD_PRICE01 = model.T_COST.ToString();
                            PROD_CONVERT    = "1"; break;

                        case 2: STD_PRICE01 = model.T_COST1.ToString();
                            PROD_CONVERT    = model.PROD_CONVERT1.ToString(); break;

                        case 3: STD_PRICE01 = model.T_COST2.ToString();
                            PROD_CONVERT    = model.PROD_CONVERT2.ToString(); break;

                        default: STD_PRICE01 = model.T_COST.ToString();
                            PROD_CONVERT     = "1";; break;
                        }
                        deObject.Add("STD_PRICE101", model.T_COST);
                        deObject.Add("STD_PRICE201", model.T_COST1);
                        deObject.Add("STD_PRICE301", model.T_COST2);
                    }
                    else
                    {
                        switch (model.ORDER_UNIT)
                        {
                        case 1: STD_PRICE01 = model.U_Cost.ToString();
                            PROD_CONVERT    = "1"; break;

                        case 2: STD_PRICE01 = model.U_Cost1.ToString();
                            PROD_CONVERT    = model.PROD_CONVERT1.ToString(); break;

                        case 3: STD_PRICE01 = model.U_Cost2.ToString();
                            PROD_CONVERT    = model.PROD_CONVERT1.ToString(); break;

                        default: STD_PRICE01 = model.U_Cost.ToString();
                            PROD_CONVERT     = "1"; break;
                        }
                        deObject.Add("STD_PRICE101", model.U_Cost);
                        deObject.Add("STD_PRICE201", model.U_Cost1);
                        deObject.Add("STD_PRICE301", model.U_Cost2);
                    }
                    deObject.Add("STD_CONVERT01", PROD_CONVERT);
                    deObject.Add("STD_UNIT_NAME01", model.ORDER_NAME);
                    deObject.Add("STD_QUAN01", model.ORDER_UNIT);
                    deObject.Add("STD_PRICE01", STD_PRICE01);
                    deObject.Add("MIN_STD_QUAN01", model.ORDER_UNIT);
                    deObject.Add("COST01", model.COST);
                    deObject.Add("QUAN101", 0);
                    deObject.Add("QUAN201", 0);
                    deObject.Add("MEMO01", "");
                    deObject.Add("BAT_NO", "");

                    deObject.Add("UNIT_NAME01", model.UNIT_NAME);
                    deObject.Add("UNIT_NAME101", model.UNIT_NAME1);
                    deObject.Add("UNIT_NAME201", model.UNIT_NAME2);
                    deObject.Add("PROD_CONVERT101", model.PROD_CONVERT1);
                    deObject.Add("PROD_CONVERT201", model.PROD_CONVERT2);
                    deObject.Add("COST101", model.COST);
                    deObject.Add("COST201", model.COST1);
                    deObject.Add("COST301", model.COST2);
                    rowCount = rowCount + 1;
                    Grid2.AddNewRecord(deObject, true);
                }
            }
            else
            {
                FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information);
            }
            if (!String.IsNullOrEmpty(result.Trim()))
            {
                FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information);
            }
        }
 public void btnEditCon_Click(Object sender, EventArgs e)
 {
     try
     {
         //int Grid3RowIndex = ConvertHelper.Cint(Grid3Rowindex.Text);
         string _CONTRACT_ID = tbxCONTRACT_ID.Text.ToString();
         if (String.IsNullOrEmpty(_CONTRACT_ID))
         {
             FineUI.Alert.ShowInParent("未选择商品", FineUI.MessageBoxIcon.Information);
             return;
         }
         FineUI.Grid Grid4      = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid;
         int[]       selections = Grid4.SelectedRowIndexArray;
         if (selections.Length == 0)
         {
             FineUI.Alert.ShowInParent("请选择一行", FineUI.MessageBoxIcon.Information);
             return;
         }
         foreach (int i in selections)
         {
             int _Id = ConvertHelper.Cint(Grid4.DataKeys[i][0].ToString());
             if (_Id > 0)
             {
                 JObject defaultObj = new JObject();
                 var     model      = new PRODUCT00(x => x.Id == _Id);
                 //暂时保留后期可能优化
                 string  _UserHashKey = Session[OnlineUsersTable.UserHashKey].ToString();
                 var     OlUser       = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());
                 DataSet dsCom        = (DataSet)SPs.Get_CONTRACT01_PRODUCT01(_UserHashKey, model.PROD_ID).ExecuteDataSet();
                 if (dsCom.Tables.Count > 0)
                 {
                     if (dsCom.Tables[0].Rows.Count > 0)
                     {
                         defaultObj.Add("Id01", 0);
                         defaultObj.Add("CONTRACT_ID01", _CONTRACT_ID);
                         defaultObj.Add("PROD_ID01", model.PROD_ID);
                         defaultObj.Add("PROD_NAME01", model.PROD_NAME1);
                         defaultObj.Add("CONTRACT_PRICE01", dsCom.Tables[0].Rows[0]["COST"].ToString());
                         defaultObj.Add("CONTRACT_PRICE101", dsCom.Tables[0].Rows[0]["COST1"].ToString());
                         defaultObj.Add("CONTRACT_PRICE201", dsCom.Tables[0].Rows[0]["COST2"].ToString());
                         defaultObj.Add("USABLE01", true);
                         defaultObj.Add("Meno01", "");
                         defaultObj.Add("CRT_USER_ID01", OlUser.Manager_LoginName);
                         defaultObj.Add("CRT_DATETIME01", DateTime.Now.ToString());
                         defaultObj.Add("MOD_USER_ID01", OlUser.Manager_LoginName);
                         defaultObj.Add("MOD_DATETIME01", DateTime.Now.ToString());
                         Grid2.AddNewRecord(defaultObj, true);
                     }
                     else
                     {
                         FineUI.Alert.ShowInParent("添加失败", FineUI.MessageBoxIcon.Information);
                     }
                 }
                 else
                 {
                     FineUI.Alert.ShowInParent("添加失败", FineUI.MessageBoxIcon.Information);
                 }
             }
         }
     }
     catch (Exception err)
     {
         FineUI.Alert.ShowInParent("添加失败:" + err.Message, FineUI.MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ButtonPRODAdd_Click(object sender, EventArgs e)
        {
            FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid;

            int[]  selections = Grid4.SelectedRowIndexArray;
            string _BK_ID     = tbxBK_ID.Text;
            string _Shop_ID   = ddlSHOP_NAME.SelectedValue;
            //string _Shop_Name = ddlSHOP_NAME.SelectedText;
            string result = "";

            if (!String.IsNullOrEmpty(_BK_ID))
            {
                int rowCount = Grid2.Rows.Count;
                foreach (int i in selections)
                {
                    string  _Prod_ID = Grid4.DataKeys[i][0].ToString();
                    string  _shop_id = ddlSHOP_NAME.SelectedValue;
                    var     model    = new V_STOCK01_PRODUCT01(x => x.PROD_ID == _Prod_ID && x.SHOP_ID == _Shop_ID);
                    JObject deObject = new JObject();
                    deObject.Add("Id01", "0");
                    deObject.Add("SHOP_ID01", _Shop_ID);
                    deObject.Add("SHOP_NAME101", model.SHOP_NAME1);
                    deObject.Add("BK_ID01", _BK_ID);
                    deObject.Add("SNo01", rowCount + 1);
                    deObject.Add("PROD_ID01", _Prod_ID);
                    deObject.Add("PROD_NAME101", model.PROD_NAME1);
                    deObject.Add("QUANTITY01", model.ORDER_QUAN);
                    deObject.Add("STD_UNIT01", model.ORDER_UNIT);
                    deObject.Add("STD_CONVERT01", model.PROD_CONVERT1);
                    deObject.Add("STD_QUAN01", model.ORDER_QUAN);
                    switch (model.ORDER_UNIT)
                    {
                    case 1: deObject.Add("STD_PRICE01", model.S_Cost);
                        deObject.Add("COST01", model.COST);
                        break;

                    case 2: deObject.Add("STD_PRICE01", model.S_Cost1);
                        deObject.Add("COST01", model.COST1);
                        break;

                    case 3: deObject.Add("STD_PRICE01", model.S_Cost2);
                        deObject.Add("COST01", model.COST2);
                        break;

                    default: deObject.Add("STD_PRICE01", 0);
                        deObject.Add("COST01", 0);
                        break;
                    }
                    deObject.Add("QUAN101", 0);
                    deObject.Add("QUAN201", 0);
                    deObject.Add("REASON_ID01", 0);
                    deObject.Add("MEMO01", "");
                    deObject.Add("BAT_NO", "");


                    deObject.Add("STD_UNIT_NAME01", model.ORDER_NAME);
                    deObject.Add("UNIT_NAME01", model.UNIT_NAME);
                    deObject.Add("UNIT_NAME101", model.UNIT_NAME1);
                    deObject.Add("UNIT_NAME201", model.UNIT_NAME2);

                    deObject.Add("PROD_CONVERT101", model.PROD_CONVERT1);
                    deObject.Add("PROD_CONVERT201", model.PROD_CONVERT2);


                    deObject.Add("S_RET_COST01", model.S_Ret_Cost);
                    deObject.Add("S_RET_COST101", model.S_Ret_Cost1);
                    deObject.Add("S_RET_COST201", model.S_Ret_Cost2);

                    deObject.Add("R_COST01", model.COST);
                    deObject.Add("R_COST101", model.COST1);
                    deObject.Add("R_COST201", model.COST2);
                    rowCount++;
                    Grid2.AddNewRecord(deObject, true);
                }
            }
            else
            {
                FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information);
            }
            if (!String.IsNullOrEmpty(result.Trim()))
            {
                FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information);
            }
        }