Пример #1
0
        /// <summary>
        /// 检查Wms请求过来的信息是否完整
        /// </summary>
        /// <param name="model"></param>
        /// <param name="tasktype"></param>
        /// <param name="checkWdloc"></param>
        /// <returns></returns>
        private static HttpResponse CheckWmsModel(WmsModel model, WmsStatus tasktype, bool checkWdloc)
        {
            string msg = "";

            //是否检查目标货位是否为空
            if (checkWdloc)
            {
                if (model.W_D_Loc == null || model.W_D_Loc.Length == 0)
                {
                    msg = "W_D_Loc can't be empty";
                }
            }

            //任务ID不能为空
            if (model.Task_UID == null || model.Task_UID.Length == 0)
            {
                msg = "Task_UID can't be empty";
            }
            //任务类型不能为空
            else if (model.Task_type == WmsStatus.Empty)
            {
                msg = "Task_type can't be empty";
            }
            //货位条形码不能为空
            else if (model.Barcode == null || model.Barcode.Length == 0)
            {
                msg = "Barcode can't be empty";
            }
            //源货位不能为空
            else if (model.W_S_Loc == null || model.W_S_Loc.Length == 0)
            {
                msg = "W_S_Loc can't be empty";
            }

            if (msg.Length != 0)
            {
                return(new HttpResponse()
                {
                    ContentAsUTF8 = msg,
                    ReasonPhrase = "OK",
                    StatusCode = "200"
                });
            }

            return(null);
        }
Пример #2
0
 /// <summary>
 /// 移库任务
 /// 处理:WMS向WCS发送的移库任务
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 private static HttpResponse StockMoveHandle(HttpRequest request)
 {
     if (request.Content != null)
     {
         WmsModel     model    = JsonConvert.DeserializeObject <WmsModel>(request.Content);
         HttpResponse response = CheckWmsModel(model, WmsStatus.StockMoveTask, true);
         if (response != null)
         {
             return(response);
         }
         if (new ForWMSControl().WriteTaskToWCS(model))
         {
             return(FailResponse());
         }
         return(OkResponse());
     }
     else
     {
         return(EmptyMssage());
     }
 }