Ejemplo n.º 1
0
        public RequestResult RemoveBigCode(string code)
        {
            RequestResult result = new RequestResult();

            try
            {
                List <Scale> scale = Scale.GetScaleForBig(code);

                if (scale.Count > 0)
                {
                    if (scale.Where(sca => sca.IsOut == true && sca.OutWay == 3).Count() == 0)
                    {
                        result.message = "未使用大标出货";
                        result.success = false;
                    }
                    else if (ScaleOutStoke.IsSubOutStock_BigCode(code))
                    {
                        result.message = "此条码下级已出货";
                        result.success = false;
                    }
                    else
                    {
                        Scale scaleDeal = scale.Where(sca => sca.IsOut == true && sca.OutWay == 3).FirstOrDefault();
                        scaleDeal.IsOut      = false;
                        scaleDeal.OutPDAUser = ""; // PdaUser.PUserName;
                        scaleDeal.OutTime    = 0;  // CommonFunc.GetNowTimestamp();
                        scaleDeal.UserName   = "";
                        scaleDeal.StateID    = 6;
                        scaleDeal.RemoveBigOut();

                        result.message = "成功";
                        result.success = true;
                    }
                }
                else
                {
                    result.code    = 304;
                    result.message = "条码不存在";
                    result.success = false;
                }

                PDALog.Write("撤消出货", "大标", code, PdaUser.PUserName + "-" + PdaUser.PRealName, string.Format("code:{0}", code), result.message);
            }
            catch (Exception ex)
            {
                result.code    = 500;
                result.message = "服务出错";
                result.success = false;
                DAL.Log.Instance.Write("撤消大标出货出错:" + ex.Message, "PDA上传出错");
            }

            return(result);
        }