/// <summary>
        /// 子表保存
        /// </summary>
        /// <returns></returns>
        public string DetailEdit()
        {
            JArray jarr   = Grid2.GetMergedData();
            var    OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());
            string result = "";
            int    n      = 0;

            for (int i = 0; i < jarr.Count; i++)
            {
                try
                {
                    int id     = ConvertHelper.Cint(jarr[i]["values"]["Id01"].ToString());
                    var model2 = new OUT_BACK01(x => x.Id == id);
                    //string str = jarr[i]["status"].ToString();
                    if (jarr[i]["status"].ToString().Equals("modified"))
                    {
                        model2.SetIsNew(false);
                    }
                    else if (jarr[i]["status"].ToString().Equals("unchanged"))
                    {
                        continue;
                    }
                    else
                    {
                        model2.SetIsNew(true);
                    }
                    model2.SHOP_ID = jarr[i]["values"]["SHOP_ID01"].ToString();
                    if (!String.IsNullOrEmpty(jarr[i]["values"]["BK_ID01"].ToString()))
                    {
                        model2.BK_ID = jarr[i]["values"]["BK_ID01"].ToString();
                    }
                    else
                    {
                        return("保存失败");
                    }
                    model2.SNo          = ConvertHelper.Cint(jarr[i]["values"]["SNo01"].ToString());
                    model2.PROD_ID      = jarr[i]["values"]["PROD_ID01"].ToString();
                    model2.QUANTITY     = ConvertHelper.Cdbl(jarr[i]["values"]["QUANTITY01"].ToString());
                    model2.STD_UNIT     = jarr[i]["values"]["STD_UNIT01"].ToString();
                    model2.STD_CONVERT  = ConvertHelper.Cint(jarr[i]["values"]["STD_CONVERT01"].ToString());
                    model2.STD_QUAN     = ConvertHelper.StringToDecimal(jarr[i]["values"]["STD_QUAN01"].ToString());
                    model2.STD_PRICE    = ConvertHelper.StringToDecimal(jarr[i]["values"]["STD_PRICE01"].ToString());
                    model2.COST         = ConvertHelper.StringToDecimal(jarr[i]["values"]["COST01"].ToString());
                    model2.QUAN1        = ConvertHelper.StringToDecimal(jarr[i]["values"]["QUAN101"].ToString());
                    model2.QUAN2        = ConvertHelper.StringToDecimal(jarr[i]["values"]["QUAN201"].ToString());
                    model2.MEMO         = jarr[i]["values"]["MEMO01"].ToString();
                    model2.REASON_ID    = jarr[i]["values"]["REASON_ID01"].ToString();
                    model2.BAT_NO       = jarr[i]["values"]["BAT_NO"].ToString();
                    model2.Exp_DateTime = DateTime.Now;
                    OUT_BACK01Bll.GetInstence().Save(this, model2);
                }
                catch (Exception err)
                {
                    n++;
                    result = "明细保存失败" + n + "条";
                }
            }
            LoadDETAIL();
            return(result);
        }
        /// <summary>
        /// 子表保存
        /// </summary>
        /// <returns></returns>
        public string DetailEdit()
        {
            JArray jarr   = Grid2.GetMergedData();
            var    OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());
            string result = "";
            int    n      = 0;

            for (int i = 0; i < jarr.Count; i++)
            {
                try
                {
                    int id     = ConvertHelper.Cint(jarr[i]["values"]["Id01"].ToString());
                    var model2 = new Inventory01(x => x.Id == id);
                    //string str = jarr[i]["status"].ToString();
                    if (jarr[i]["status"].ToString().Equals("modified"))
                    {
                        model2.SetIsNew(false);
                    }
                    //else if (jarr[i]["status"].ToString().Equals("unchanged"))
                    //{
                    //    continue;
                    //}
                    else
                    {
                        model2.SetIsNew(true);
                    }
                    model2.SHOP_ID = jarr[i]["values"]["SHOP_ID01"].ToString();
                    if (!String.IsNullOrEmpty(tbxINV_ID.Text))
                    {
                        model2.INV_ID = tbxINV_ID.Text;
                    }
                    else
                    {
                        return("保存失败");
                    }
                    model2.SNo      = ConvertHelper.Cint(jarr[i]["values"]["SNo01"].ToString());
                    model2.PROD_ID  = jarr[i]["values"]["PROD_ID01"].ToString();
                    model2.QUANTITY = ConvertHelper.Cdbl(jarr[i]["values"]["QUANTITY01"].ToString());
                    model2.QUAN     = ConvertHelper.Cdbl(jarr[i]["values"]["QUAN01"].ToString());
                    model2.QUAN1    = ConvertHelper.Cint(jarr[i]["values"]["QUAN101"].ToString());
                    model2.QUAN2    = ConvertHelper.Cdbl(jarr[i]["values"]["QUAN201"].ToString());
                    model2.QUAN_B   = ConvertHelper.Cdbl(jarr[i]["values"]["QUAN_B01"].ToString());
                    model2.MEMO     = jarr[i]["values"]["MEMO01"].ToString();
                    Inventory01Bll.GetInstence().Save(this, model2);
                }
                catch (Exception err)
                {
                    n++;
                    result = "明细保存失败" + n + "条";
                }
            }
            LoadDETAIL();
            return(result);
        }
Beispiel #3
0
        /// <summary>获得Post提交的参数值,判断是否double,是返回,否返回0</summary>
        /// <param name="strName">表单参数</param>
        /// <returns>返回double型</returns>
        public static double PostDouble(string strName)
        {
            string str = GetFormString(strName);

            if (str.Length > 0 && ConvertHelper.IsNumeric(str))
            {
                return(ConvertHelper.Cdbl(str));
            }
            else
            {
                return(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 _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);
            }
        }