コード例 #1
0
        private static OrderDishPrintInfo ToOrderDishPrintInfo(JObject dataJObj)
        {
            if (dataJObj == null)
            {
                return(null);
            }

            var num  = GetJObjectDecimal(dataJObj, "dishnum");
            var unit = GetJObjectString(dataJObj, "dishunit");

            unit = InternationaHelper.FilterSeparatorFlag(unit);
            var dishName = GetJObjectString(dataJObj, "title");

            dishName = InternationaHelper.FilterSeparatorFlag(dishName);

            var item = new OrderDishPrintInfo
            {
                DishName    = dishName,
                Amount      = GetJObjectDecimal(dataJObj, "amount"),
                DishNumUnit = string.Format("{0}{1}", num, unit),
                DishPrice   = GetJObjectDecimal(dataJObj, "orderprice")
            };

            return(item);
        }
コード例 #2
0
ファイル: DataConverter.cs プロジェクト: zanderphh/candao-pos
 public static DishSaleInfo ToDishSaleInfo(DishSaleInfoDataResponse response)
 {
     return(new DishSaleInfo
     {
         Name = InternationaHelper.FilterSeparatorFlag(response.dishName),
         SalesCount = response.dishCount,
         SalesAmount = response.totlePrice ?? 0m,
     });
 }
コード例 #3
0
ファイル: frmOrder.cs プロジェクト: zanderphh/candao-pos
        private void addDish(JObject ja)
        {
            ///增加菜品到购物车
            if (ja == null)
            {
                return;
            }
            //如果是多单位的要选择单位
            string userid = Globals.CurrOrderInfo.userid;

            if (userid == null)
            {
                userid = Globals.UserInfo.UserID;
            }
            t_shopping dishinfo = new t_shopping();

            dishinfo.Orderid     = Globals.CurrOrderInfo.orderid;
            dishinfo.Userid      = userid;// Globals.UserInfo.UserID;
            dishinfo.Ordertime   = DateTime.Now;
            dishinfo.Orderstatus = 0;
            dishinfo.Dishnum     = 1;
            dishinfo.Tableid     = Globals.CurrTableInfo.tableNo;
            dishinfo.Dishid      = ja["dishid"].ToString();
            dishinfo.Avoid       = "";
            dishinfo.Dishidleft  = 1;
            dishinfo.Title       = InternationaHelper.GetBeforeSeparatorFlagData(ja["title"].ToString());
            dishinfo.DishType    = ja["dishtype"].ToString();
            dishinfo.DishUnitSrc = ja["unit"].ToString();
            dishinfo.Weigh       = int.Parse(ja["weigh"].ToString());
            dishinfo.Memberprice = 0;
            dishinfo.Level       = "0";
            try
            {
                dishinfo.Level = ja["level"].ToString();
            }
            catch { }
            if (Globals.CurrOrderInfo.memberno == null)
            {
                Globals.CurrOrderInfo.memberno = "";
            }
            bool    ismember = Globals.CurrOrderInfo.memberno.Length > 0;
            decimal price    = 0;
            string  pricestr = "";

            pricestr = ja["vipprice"].ToString(); //可能还会有多单位的问题
            if (pricestr.Equals("") || pricestr.Equals(""))
            {
                pricestr = ja["price"].ToString();
            }
            dishinfo.Memberprice = strtofloat(pricestr);
            pricestr             = ja["price"].ToString();
            dishinfo.Price2      = strtofloat(pricestr);
            if (dishinfo.Memberprice <= 0)
            {
                dishinfo.Memberprice = dishinfo.Price2;
            }
            if (ismember)
            {
                price = dishinfo.Memberprice;
            }
            else
            {
                price = dishinfo.Price2;
            }
            dishinfo.Price = price;

            dishinfo.Amount = 0;
            dishinfo.Source = ja["source"].ToString();
            int dishStatus = RestClient.getFoodStatus(dishinfo.Dishid, dishinfo.Dishunit);

            if (dishStatus == 1)
            {
                Warning("选择的菜品已沽清!");
                return;
            }
            //
            if (dishinfo.DishType.Equals("2"))
            {
                //套餐getMenuCombodish
                dishinfo.Menuid = menuid;
                TComboDish comboDish = null;
                if (frmCombodish.ShowCombodish(dishinfo, comboDish))//, out potDishInfo
                {
                }
            }
            else
            if (dishinfo.DishType.Equals("1"))     ////如果是鱼锅
            {
                TPotDishInfo potDishInfo;
                //如果level=1是新双拼类型鱼锅
                if (dishinfo.Level.Equals("1"))
                {
                    //显示新双拼选择界面

                    return;
                }
                if (frmFish.ShowFish(dishinfo, out potDishInfo))
                {
                    potDishInfo.PotInfo.Orderid               = Globals.CurrOrderInfo.orderid;
                    potDishInfo.PotInfo.Userid                = userid;// Globals.UserInfo.UserID;
                    potDishInfo.PotInfo.Ordertime             = DateTime.Now;
                    potDishInfo.PotInfo.Orderstatus           = 0;
                    potDishInfo.PotInfo.Tableid               = Globals.CurrTableInfo.tableNo;
                    potDishInfo.PotInfo.Primarydishtype       = 1;
                    potDishInfo.FishDishInfo1.Orderid         = Globals.CurrOrderInfo.orderid;
                    potDishInfo.FishDishInfo1.Userid          = userid;// Globals.UserInfo.UserID;
                    potDishInfo.FishDishInfo1.Ordertime       = DateTime.Now;
                    potDishInfo.FishDishInfo1.Orderstatus     = 0;
                    potDishInfo.FishDishInfo1.Tableid         = Globals.CurrTableInfo.tableNo;
                    potDishInfo.FishDishInfo1.Primarydishtype = 1;
                    dishinfo.Dishnum                      = 1;
                    dishinfo.Parentdishid                 = potDishInfo.PotInfo.Parentdishid;
                    dishinfo.Groupid                      = potDishInfo.PotInfo.Groupid;
                    dishinfo.DishUnitSrc                  = "份";
                    dishinfo.Orderstatus                  = 0;
                    potDishInfo.PotInfo.Orderstatus       = 2;
                    potDishInfo.FishDishInfo1.Orderstatus = 3;
                    dishinfo.Ordertype                    = 1;
                    dishinfo.Primarydishtype              = 1;
                    t_shopping.add(ref Globals.ShoppTable, dishinfo, true);
                    potDishInfo.PotInfo.Ordertype = 1;
                    t_shopping.add(ref Globals.ShoppTable, potDishInfo.PotInfo, true);
                    potDishInfo.FishDishInfo1.Ordertype = 1;
                    t_shopping.add(ref Globals.ShoppTable, potDishInfo.FishDishInfo1, true);
                    if (potDishInfo.FishDishInfo2 != null)
                    {
                        potDishInfo.FishDishInfo2.Orderid         = Globals.CurrOrderInfo.orderid;
                        potDishInfo.FishDishInfo2.Userid          = userid;// Globals.UserInfo.UserID;
                        potDishInfo.FishDishInfo2.Ordertime       = DateTime.Now;
                        potDishInfo.FishDishInfo2.Tableid         = Globals.CurrTableInfo.tableNo;
                        potDishInfo.FishDishInfo2.Orderstatus     = 3;
                        potDishInfo.FishDishInfo2.Ordertype       = 1;
                        potDishInfo.FishDishInfo2.Primarydishtype = 1;
                        t_shopping.add(ref Globals.ShoppTable, potDishInfo.FishDishInfo2, true);
                    }
                }
            }
            else
            {
                dishinfo.Ordertype       = 0;
                dishinfo.Primarydishtype = 0;
                t_shopping.add(ref Globals.ShoppTable, dishinfo, false);
            }
            //通知调用页更新页面
            OnShoppingChange();
        }
コード例 #4
0
ファイル: frmOrder.cs プロジェクト: zanderphh/candao-pos
        private void refreshBtn()
        {
            JObject ja          = null;
            string  tableid     = "";
            string  tableName   = "";
            string  tableNo     = "";
            string  tabletype   = "";
            int     orderstatus = 0;
            string  dishpy      = "";
            string  py          = edtPy.Text;
            int     weigh       = 0;
            int     j           = 0;

            for (int i = 0; i <= btncount - 1; i++)
            {
                btntables[i].Tag = -1;
            }
            //用两次循环实现,第一次填充,第二次隐藏  加入分页功能
            if (jarrTables != null)
            {
                int i         = 0;        //int tmpi = (currpage_type - 1) * btncount;
                int tmpi      = (currpage_type - 1) * btncount;
                int typecount = 0;
                for (i = 0; i <= jarrTables.Count - 1; i++)
                {
                    ja = (JObject)jarrTables[i];
                    if (py.Length > 0)
                    {
                        //有拼音过滤条件
                        dishpy = ja["py"].ToString();
                        if (dishpy.IndexOf(py) < 0)
                        {
                            continue;
                        }
                    }
                    //分类条件过滤 source
                    if (!selectSource.Equals(""))//selectbtn != null)
                    {
                        //string selectSource = ((JObject)selectbtn.lbl2.Tag)["itemid"].ToString();
                        if (!selectSource.Equals(ja["source"].ToString()))
                        {
                            continue;
                        }
                    }
                    //分页条件
                    typecount = typecount + 1;
                    if (typecount <= tmpi)
                    {
                        continue;
                    }
                    btntables[j].Visible = true;
                    tableid                 = ja["dishid"].ToString();
                    tableName               = ja["title"].ToString();
                    tableNo                 = ja["title"].ToString();
                    tableNo                 = InternationaHelper.GetBeforeSeparatorFlagData(tableNo);
                    tabletype               = ja["dishtype"].ToString();
                    weigh                   = int.Parse(ja["weigh"].ToString());
                    orderstatus             = 0;
                    btntables[j].lblNo.Text = tableNo;
                    if (Globals.CurrOrderInfo.memberno == null)
                    {
                        Globals.CurrOrderInfo.memberno = "";
                    }
                    bool   ismember = Globals.CurrOrderInfo.memberno.Length > 0;
                    string price    = "";
                    if (ismember)
                    {
                        price = ja["vipprice"].ToString(); //可能还会有多单位的问题
                        if (price.Equals("") || price.Equals(""))
                        {
                            price = ja["price"].ToString();
                        }
                    }
                    else
                    {
                        price = ja["price"].ToString();
                    }
                    if (tabletype.Equals("1"))
                    {
                        btntables[j].lbl2.Text = "";
                    }
                    else
                    {
                        btntables[j].lbl2.Text = string.Format("{0}/{1}", price, InternationaHelper.GetBeforeSeparatorFlagData(ja["unit"].ToString()));
                    }

                    if (weigh == 1)
                    {
                        btntables[j].lbl2.Text += "  称重";
                    }

                    btntables[j].status    = orderstatus;
                    btntables[j].lblNo.Tag = ja;
                    btntables[j].lbl2.Tag  = ja;
                    btntables[j].Tag       = i;
                    j++;
                    if (j >= btncount)
                    {
                        break;
                    }
                }
            }
            if (ja != null)
            {
                menuid = ja["menuid"].ToString();
            }
            for (int i = 0; i <= btncount - 1; i++)
            {
                int btntag = int.Parse(btntables[i].Tag.ToString());
                if (btntag < 0)
                {
                    btntables[i].Visible = false;
                }
            }
            if (j <= 0)
            {
                if (edtPy.Text.Length > 0)
                {
                    py2 = edtPy.Text.Substring(0, edtPy.Text.Length - 1);
                    tmrClear.Enabled = true;
                }
            }
        }
コード例 #5
0
ファイル: frmOrder.cs プロジェクト: zanderphh/candao-pos
        private void refreshTypeBtn()
        {
            JObject ja       = null;
            int     j        = 0;
            string  itemdesc = "";
            string  itemsort = "";
            string  itemid   = "";
            string  isShow   = "";

            selectbtn = null;
            setSelectTypeColor();
            if (jarrType.Count <= 10)
            {
                btnTypeUp.Enabled   = false;
                btnTypeDown.Enabled = false;
            }
            else
            {
                btnTypeUp.Enabled   = true;
                btnTypeDown.Enabled = true;
            }
            for (int i = 0; i <= btnTypetables.Length - 1; i++)
            {
                btnTypetables[i].Tag        = -1;
                btnTypetables[i].lblNo.Text = "";
                btnTypetables[i].lbl2.Text  = "";
                btnTypetables[i].lblNo.Tag  = null;
                btnTypetables[i].Enabled    = false;
            }
            if (jarrType.Count <= 0)
            {
                return;
            }
            int pagecount = jarrType.Count / 10;

            if (jarrType.Count % 10 > 0)
            {
                pagecount = pagecount + 1;
            }
            int currpage = int.Parse(btnTypeUp.Tag.ToString());

            if (currpage > pagecount)
            {
                currpage = pagecount;
            }
            btnTypeDown.Tag = pagecount;
            int ivalue = (currpage) * 10;

            if (jarrType != null)
            {
                for (int i = ivalue; i <= jarrType.Count - 1; i++)
                {
                    ja       = (JObject)jarrType[i];
                    itemdesc = ja["itemdesc"].ToString();
                    itemsort = ja["itemsort"].ToString();
                    itemid   = ja["itemid"].ToString();
                    isShow   = ja["isShow"].ToString();
                    btnTypetables[j].Visible    = true;
                    btnTypetables[j].lblNo.Text = InternationaHelper.GetBeforeSeparatorFlagData(itemdesc);
                    btnTypetables[j].lblNo.Tag  = ja;
                    btnTypetables[j].lbl2.Tag   = ja;
                    btnTypetables[j].Tag        = i;
                    btnTypetables[j].Enabled    = true;
                    j++;
                    if (j >= btnTypetables.Length)
                    {
                        break;
                    }
                }
            }
            showTypeNum();
        }