コード例 #1
0
        public JsonResult ConfirmOrder(Guid id, string supplier, string price, string reason, string remark, string count, string cReason, string cRemark, string isSame)
        {
            // 改数据库状态
            var channel = OrderApiClientChannelFactory.GetChannel();
            var res     = channel.Confirm(id, price, reason, remark, count, cReason, cRemark, isSame);

            if (res > 0)
            {
                var order = channel.FindByID(id);
                // 发用户消息
                WxMessageHandler.GetInstance().SendMessageToUser(order.IsTransfer == 0?CurrentWxUser.UserId:order.TransferUserMUDID, order);

                // 告诉小秘书已经收餐
                //var oponapiChannel = OpenApiChannelFactory.GetChannel();
                //var xmlres = oponapiChannel.finishOrder(order.XmsOrderId, "0", string.Empty);
                var req = new FinishOrderReq()
                {
                    _Channels    = supplier,
                    iPathOrderId = order.XmsOrderId,
                    type         = "0",
                    remark       = string.Empty
                };
                var iPathRes = apiClient.FinishOrder(req);


                return(Json(new { state = 1 }));
            }
            return(Json(new { state = 0, txt = "操作失败", errCode = 9008 }));
        }
コード例 #2
0
        public ActionResult SysConfirmOrder()
        {
            var      _time     = GetTSTime(TaskScheduler.SysConfirmOrder);
            var      _thisTime = DateTime.Now;
            TimeSpan timeSpan  = _thisTime - _time;

            if (timeSpan.TotalMinutes > 30d)
            {
                Task.Factory.StartNew(() =>
                {
                    try
                    {
                        var rtnVal = orderService.LoadOrders();
                        //var rtnVals = orderService.SystemConfirm();
                        LogHelper.Info("auto sync SysConfirmOrder result:" + rtnVal);
                        SetTSTime(TaskScheduler.SysConfirmOrder, _thisTime);
                        // 告诉小秘书已经收餐
                        //var oponapiChannel = OpenApiChannelFactory.GetChannel();
                        foreach (var item in rtnVal)
                        {
                            //oponapiChannel.finishOrder(item.XmsOrderId, "1", string.Empty);
                            var req = new FinishOrderReq()
                            {
                                _Channels    = item.Channel,
                                iPathOrderId = item.XmsOrderId,
                                type         = "1",
                                remark       = string.Empty
                            };
                            apiClient.FinishOrder(req);
                            orderService.SystemConfirm(item.ID);
                        }
                    }

                    catch (Exception ex)
                    {
                        LogHelper.Error("auto sync SysConfirmOrder  ERR", ex);
                        throw ex;
                    }
                });

                return(Content("sync SysConfirmOrder success!the next time at" + _thisTime.AddMinutes(30d).ToString("yyyy-MM-dd HH:mm:ss")));
            }
            else
            {
                return(Content("sync SysConfirmOrder not run!last run time at" + _time.ToString("yyyy-MM-dd HH:mm:ss")));
            }
        }