Пример #1
0
        public ActionResult GetSave(Int64?id)
        {
            OverseasDeliveryResult res = new OverseasDeliveryResult();

            try
            {
                res = _service.GetSave(id.Value);
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.Msg     = ex.ToString();
                res.success = false;
                return(Json(res));
            }
        }
Пример #2
0
        public ActionResult Getpage(string pagenum, string onepagecount, int?express_id, DateTime?start_time, DateTime?end_time)
        {
            OverseasDeliveryResult com = new OverseasDeliveryResult();

            if (!Regex.IsMatch(pagenum, @"(?i)^[0-9a-z\u4e00-\u9fa5]+$") && !string.IsNullOrEmpty(pagenum))
            {
                com.Msg     = "页数不正确";
                com.success = false;
                return(Json(com));
            }

            if (!Regex.IsMatch(onepagecount, @"(?i)^[0-9a-z\u4e00-\u9fa5]+$") && !string.IsNullOrEmpty(onepagecount))
            {
                com.Msg     = "每页数量不正确";
                com.success = false;
                return(Json(com));
            }

            int    totil     = 0;
            int    totilpage = 0;
            string exmsg     = string.Empty;
            List <OverseasDeliveryModel> mylist = _service.GetOverseasDeliveryList(Convert.ToInt32(pagenum), Convert.ToInt32(onepagecount), out totil,
                                                                                   out totilpage, out exmsg, express_id, start_time, end_time);

            if (!string.IsNullOrEmpty(exmsg))
            {
                com.Msg     = exmsg;
                com.success = false;
                return(Json(com));
            }
            else
            {
                OverseasDeliveryViewModel mylistview = new OverseasDeliveryViewModel();
                mylistview.supplist   = mylist;
                mylistview.totil      = totil.ToString();
                mylistview.totilcount = totilpage.ToString();
                com.DataResult        = mylistview;
                com.success           = true;
                return(Json(com));
            }
        }
        /// <summary>
        /// 确认到货
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public OverseasDeliveryResult GetSave(Int64?id)
        {
            bool rstNum = false;
            OverseasDeliveryResult result = new OverseasDeliveryResult();

            if (id == 0)
            {
                result.success = false;
                result.Msg     = "参数错误";
                return(result);
            }
            using (var db = SugarDao.GetInstance(LoginUser.GetConstr()))
            {
                var model = db.Queryable <busi_transfer>().InSingle(id.Value);
                if (model == null)
                {
                    result.success = false;
                    result.Msg     = "不存在的信息";
                    return(result);
                }

                if (model.tran_status >= 1 && model.tran_status <= 3)
                {
                    //if (model.tran_status == 1)
                    //{
                    //    result.success = false;
                    //    result.Msg = "该转运单号未转运,操作失败!";
                    //    return result;
                    //}
                    if (model.tran_status == 3)
                    {
                        result.success = false;
                        result.Msg     = "该转运单号已确认收货,操作失败!";
                        return(result);
                    }
                }
                else
                {
                    result.success = false;
                    result.Msg     = "不存在的状态,操作失败!";
                    return(result);
                }
                model.edit_time    = DateTime.Now;
                model.edit_user_id = LoginUser.Current.user_id;
                model.tran_status  = 3;
                rstNum             = db.Update <busi_transfer>(model);
                if (rstNum)
                {
                    result.success = true;
                    result.URL     = "/OverseasDelivery/Index";
                    result.Msg     = "操作成功!";
                    return(result);
                }
                else
                {
                    result.success = false;
                    result.Msg     = "操作失败!";
                    return(result);
                }
            }
        }