Esempio n. 1
0
        public ActionResult GetUpdateRtnScale(string Scale, string RtnOrderNo)
        {
            RequestResult result = new RequestResult();
            bool          IsOK   = true;

            if (string.IsNullOrWhiteSpace(Scale))
            {
                IsOK           = false;
                result.message = "正确条码不能为空";
                result.success = true;
            }

            if (IsOK)
            {
                List <BarCode> SmallCodeList = ScaleOutStoke.GetRtnStockID(CurrentUser.UserName, Scale);

                string IDSet = "";
                foreach (BarCode b in SmallCodeList)
                {
                    if (IDSet != "")
                    {
                        IDSet += ",";
                    }
                    IDSet += b.ID.ToString();
                }

                if (IDSet != "")
                {
                    RtnStockScale.ToRtnStockCode(CurrentUser.UserName, IDSet, RtnOrderNo);
                }

                result.data    = SmallCodeList;
                result.message = "成功";
                result.success = true;
            }

            //string[] Scales = Scale.Split(',');
            //string msg = string.Empty;
            //for (int i = 0; i < Scales.Length - 1; i++)
            //{
            //    if (RtnStockScale.GetBoolC_UserOutScale(CurrentUser.UserName, Scales[i].Trim()) != "ok")
            //    {
            //        msg += Scales[i].Trim() + "添加失败!";
            //    }
            //    else
            //    {
            //        msg += "ok";
            //    }
            //}
            //if (string.IsNullOrWhiteSpace(msg) || msg.Contains("ok"))
            //{
            //    msg = "ok";
            //}
            //return Content(msg);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public RequestResult SmallCodeToRtnStock(string rtnorderno)
        {
            RequestResult result = new RequestResult();

            try
            {
                bool IsOK = true;

                IEnumerable <string> CodeArrayStr;
                Request.Headers.TryGetValues("CodeArrayStr", out CodeArrayStr);

                if (CodeArrayStr.ToArray() == null || CodeArrayStr.ToArray()[0] == "")
                {
                    IsOK           = false;
                    result.message = "正确条码不能为空";
                    result.success = false;
                }

                if (IsOK)
                {
                    string[] codeArray      = CodeArrayStr.ToArray()[0].Split(',');
                    string   SmallCodeArray = string.Empty;

                    for (int i = 0; i < codeArray.Length; i++)
                    {
                        if (codeArray[i] != "")
                        {
                            if (SmallCodeArray != "")
                            {
                                SmallCodeArray += ",";
                            }
                            SmallCodeArray += "'" + codeArray[i] + "'";
                        }
                    }

                    if (string.IsNullOrEmpty(SmallCodeArray))
                    {
                        result.message = "出货条码不能为空";
                        result.success = false;
                    }
                    else if (codeArray.Length > 1000)
                    {
                        result.message = "出货条码数量超出最大数量(1000)限制";
                        result.success = false;
                    }
                    else
                    {
                        List <BarCode> SmallCodeList = ScaleOutStoke.GetRtnStockID(MobileUser.UserName, SmallCodeArray);

                        string IDSet = "";
                        foreach (BarCode b in SmallCodeList)
                        {
                            if (IDSet != "")
                            {
                                IDSet += ",";
                            }
                            IDSet += b.ID.ToString();
                        }

                        if (IDSet != "")
                        {
                            RtnStockScale.ToRtnStockCode(MobileUser.UserName, IDSet, rtnorderno);
                        }

                        result.data    = SmallCodeList;
                        result.message = "成功";
                        result.success = true;
                    }
                }
            }
            catch (Exception ex)
            {
                result.message = "失败,error:" + ex.Message;
                result.success = false;
            }

            return(result);
        }