예제 #1
0
        public ActionResult GetUpdateC_UserOutScale(string Agent, string Scale, string OutOrderNo)
        {
            RequestResult result = new RequestResult();
            bool          IsOK   = true;

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

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

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

                if (IDSet != "")
                {
                    ScaleOutStoke.ToOutStockAgent(CurrentUser.UserName, Agent, IDSet, OutOrderNo);
                }

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

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public RequestResult SmallCodeToOutStock(string outorderno, string agent = "m2000")
        {
            RequestResult result = new RequestResult();

            try
            {
                bool IsOK = true;

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

                if (string.IsNullOrWhiteSpace(agent))
                {
                    IsOK           = false;
                    result.message = "经销商不能为空";
                    result.success = false;
                }

                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.GetOutStockID(MobileUser.UserName, SmallCodeArray);

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

                        if (IDSet != "")
                        {
                            ScaleOutStoke.ToOutStockAgent(MobileUser.UserName, agent, IDSet, outorderno);
                        }

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

            return(result);
        }