예제 #1
0
        public ActionResult Index(int aid = 0, int storeId = 0, string orderId = "", string storeName = "", string goodsName = "", int orderState = -999, string consignee = "", string phone = "", int sendWay = -999, int groupState = -999, int groupId = 0, string startDate = "", string endDate = "", int pageIndex = 0, int pageSize = 20, string act = "")
        {
            PinGoodsOrderBLL pinGoodsOrderBLL = new PinGoodsOrderBLL();

            if (act == "getNewOrder")
            {
                bool isSuccess = pinGoodsOrderBLL.havingNewOrder(storeId, DateTime.Now.AddSeconds(-10)); //检查是否有新订单(10秒前到现在)

                result.code = isSuccess ? 1 : 0;
                result.msg  = isSuccess ? "存在新订单" : "没有新订单";
                return(Json(result));
            }
            if (aid <= 0 || storeId <= 0)
            {
                return(Content($"参数错误 aid:{aid},storeId:{storeId}"));
            }
            ViewModel <PinGoodsOrder> vm = new ViewModel <PinGoodsOrder>();
            int recordCount = 0;

            vm.DataList = pinGoodsOrderBLL.GetListByCondition(aid, storeId, orderId, storeName, goodsName, orderState, consignee, phone, sendWay, groupState, groupId, startDate, endDate, pageIndex, pageSize, out recordCount);
            if (vm.DataList != null && vm.DataList.Count > 0)
            {
                string          groupIds     = string.Join(",", vm.DataList.Select(s => s.groupId).Distinct());
                List <PinGroup> pinGroupList = PinGroupBLL.SingleModel.GetListByIds(groupIds);

                vm.DataList.ForEach(order =>
                {
                    order.groupInfo = pinGroupList?.FirstOrDefault(f => f.id == order.groupId);
                    if (order.sendway == (int)PinEnums.SendWay.到店自取)
                    {
                        PickPlace place = PickPlaceBLL.SingleModel.GetModel(Convert.ToInt32(order.address));
                        if (place != null)
                        {
                            order.storeName = place.name;
                            order.address   = place.address;
                        }
                        else
                        {
                            order.address = string.Empty;
                        }
                    }
                });
            }
            vm.TotalCount      = recordCount;
            vm.aId             = aid;
            vm.storeId         = storeId;
            ViewBag.OrderId    = orderId;
            ViewBag.StoreName  = storeName;
            ViewBag.goodsName  = goodsName;
            ViewBag.OrderState = orderState;
            ViewBag.Consignee  = consignee;
            ViewBag.Phone      = phone;
            ViewBag.SendWay    = sendWay;
            ViewBag.GroupState = groupState;
            ViewBag.GroupId    = groupId;
            ViewBag.StartDate  = startDate;
            ViewBag.EndDate    = endDate;
            return(View(vm));
        }
예제 #2
0
 public ActionResult updatePickPlaceState(int aid = 0, int storeId = 0, int id = 0, string act = "")
 {
     if (aid <= 0 || storeId <= 0 || id <= 0 || string.IsNullOrEmpty(act))
     {
         result.code = 0;
         result.msg  = "参数错误";
         return(Json(result));
     }
     if (act == "del")
     {
         PickPlace place = PickPlaceBLL.SingleModel.GetModelByAid_StoreId_Id(aid, storeId, id);
         if (place == null)
         {
             result.code = 0;
             result.msg  = "数据错误";
             return(Json(result));
         }
         place.state = -1;
         if (PickPlaceBLL.SingleModel.Update(place, "state"))
         {
             result.code = 1;
             result.msg  = "操作成功";
         }
         else
         {
             result.code = 0;
             result.msg  = "操作失败";
         }
         return(Json(result));
     }
     else
     {
         result.code = 0;
         result.msg  = "参数错误act error";
         return(Json(result));
     }
 }
예제 #3
0
 /// <summary>
 /// 保存自提信息
 /// </summary>
 /// <param name="place"></param>
 /// <returns></returns>
 public ActionResult SavePlaceInfo(PickPlace place)
 {
     if (place == null || place.aid <= 0 || place.storeId <= 0)
     {
         result.code = 0;
         result.msg  = "参数错误";
         return(Json(result));
     }
     if (string.IsNullOrEmpty(place.name))
     {
         result.code = 0;
         result.msg  = "请输入店铺名称";
         return(Json(result));
     }
     if (string.IsNullOrEmpty(place.address))
     {
         result.code = 0;
         result.msg  = "请选择店铺地址";
         return(Json(result));
     }
     place.addtime = DateTime.Now;
     if (place.Id > 0)
     {
         PickPlace model = PickPlaceBLL.SingleModel.GetModelByAid_Id(place.aid, place.Id);
         if (model == null)
         {
             result.code = 0;
             result.msg  = "数据错误";
             return(Json(result));
         }
         model.name    = place.name;
         model.address = place.address;
         model.lat     = place.lat;
         model.lng     = place.lng;
         model.addtime = place.addtime;
         if (PickPlaceBLL.SingleModel.Update(model))
         {
             result.code = 1;
             result.obj  = PickPlaceBLL.SingleModel.GetListByAid_StoreId(place.aid, place.storeId);
             result.msg  = "保存成功";
         }
         else
         {
             result.code = 0;
             result.msg  = "保存失败";
         }
         return(Json(result));
     }
     else
     {
         place.Id = Convert.ToInt32(PickPlaceBLL.SingleModel.Add(place));
         if (place.Id > 0)
         {
             result.code = 1;
             result.obj  = PickPlaceBLL.SingleModel.GetListByAid_StoreId(place.aid, place.storeId);
             result.msg  = "保存成功";
         }
         else
         {
             result.code = 0;
             result.msg  = "保存失败";
         }
         return(Json(result));
     }
 }
예제 #4
0
        /// <summary>
        /// 专业版普通订单打印内容拼接
        /// </summary>
        /// <param name="food"></param>
        /// <param name="foodGoodsOrder"></param>
        /// <param name="cars"></param>
        /// <param name="foodPrintList"></param>
        /// <returns></returns>
        public static string entPrintOrderContent(EntGoodsOrder goodsOrder)
        {
            //打印内容
            string content = "";

            List <EntGoodsCart> cars = EntGoodsCartBLL.SingleModel.GetList($" GoodsOrderId = {goodsOrder.Id} ") ?? new List <EntGoodsCart>();

            string          goodsIds     = string.Join(",", cars.Select(s => s.FoodGoodsId).Distinct());
            List <EntGoods> entGoodsList = EntGoodsBLL.SingleModel.GetListByIds(goodsIds);

            cars.ForEach(c =>
            {
                c.goodsMsg = entGoodsList?.FirstOrDefault(f => f.id == c.FoodGoodsId) ?? new EntGoods();
            });

            XcxAppAccountRelation curXcx = XcxAppAccountRelationBLL.SingleModel.GetModel(goodsOrder.aId);

            if (curXcx == null)
            {
                log4net.LogHelper.WriteInfo(typeof(PrinterHelper), "专业版打印内容拼接失败 curXcx_null");
                return(content);
            }
            //获取店铺名
            OpenAuthorizerConfig XUserList = OpenAuthorizerConfigBLL.SingleModel.GetModelByAppids(curXcx.AppId);

            if (XUserList == null)
            {
                log4net.LogHelper.WriteInfo(typeof(PrinterHelper), "专业版打印内容获取不到小程序名,但仍旧打印 XUserList_null");
            }

            string zqStoreInfo = "送货地址:无(到店自取)\r\n";

            if (!string.IsNullOrEmpty(goodsOrder.attribute))
            {
                goodsOrder.attrbuteModel = JsonConvert.DeserializeObject <EntGoodsOrderAttr>(goodsOrder.attribute);
            }
            PickPlace storeAddress = null;

            if (goodsOrder.attrbuteModel.zqStoreId > 0)
            {
                storeAddress = PickPlaceBLL.SingleModel.GetModel(goodsOrder.attrbuteModel.zqStoreId);
            }
            else if (!string.IsNullOrWhiteSpace(goodsOrder.attrbuteModel.zqStoreName))
            {
                storeAddress = PickPlaceBLL.SingleModel.GetModelByAid_Name(goodsOrder.aId, goodsOrder.attrbuteModel.zqStoreName);
            }
            if (storeAddress != null)
            {
                zqStoreInfo = $"送货地址:【{storeAddress?.name}】{storeAddress?.address}\r\n";
            }

            //拼接订单内容排版
            content  = $"<MC>0,00005,0</MC><FS>{XUserList?.nick_name ?? string.Empty}</FS>\r\n";
            content += "<table><tr><td>商品</td><td>数量</td><td>金额(元)</td></tr>";
            content += "<tr><td>@@2................................</td></tr>";
            foreach (var car in cars)
            {
                //car.goodsMsg = foodGoodsBLL.GetModel($"Id={car.FoodGoodsId}");
                content += $"<tr><td>{car.goodsMsg.name}</td><td>{car.Count}</td><td>{(car.Price * car.Count * 0.01).ToString("0.00")}</td></tr>";
                if (!string.IsNullOrEmpty(car.SpecInfo))
                {
                    content += $"<tr><td>规格:{car.SpecInfo}</td></tr>";
                }

                content += $"<tr><td></td></tr>";
            }
            content += "<tr><td>┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄</td></tr>";
            content += $"<tr><td>实收:</td><td>-</td><td>{(goodsOrder.BuyPrice * 0.01).ToString("0.00")}</td></tr>";
            content += $"<tr><td></td><td></td><td>({Enum.GetName(typeof(miniAppBuyMode), goodsOrder.BuyMode)})</td></tr></table>";
            content += "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄\r\n";
            content += $"订单号:{goodsOrder.OrderNum}\r\n";
            content += $"下单时间:{goodsOrder.CreateDate}\r\n";
            content += $"打印时间:{DateTime.Now}\r\n";
            content += $"收货人:{goodsOrder.AccepterName}\r\n";
            content += $"联系方式:{goodsOrder.AccepterTelePhone}\r\n";
            switch (goodsOrder.GetWay)
            {
            case (int)miniAppOrderGetWay.商家配送:
                content += $"送货地址:{goodsOrder.Address}\r\n";

                break;

            case (int)miniAppOrderGetWay.到店自取:
            case (int)miniAppOrderGetWay.到店消费:
                content += zqStoreInfo;

                break;
            }
            content += $"订单备注:{goodsOrder.Message}\r\n";

            return(content);
        }