schangxiang@126.com
2 天以前 35d6465fc502a3287c6cc1d0f307d616dbe1ccda
DEmon/WebWIPAPI/Controllers/MesIntegrController.cs
@@ -3,15 +3,18 @@
using iWareCommon.Utils;
using iWareDataCore.BASE.Entity;
using iWareDataCore.BASE.Service;
using iWareDataCore.TASK.Service;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web.Hosting;
using System.Web.Mvc;
using WebWIPAPI.Models;
using WebWIPAPI.Properties;
using WebWIPAPI.Utils;
using static System.Runtime.CompilerServices.RuntimeHelpers;
using LogTextHelper = WebWIPAPI.Utils.LogTextHelper;
namespace WebWIPAPI.Controllers
@@ -108,6 +111,17 @@
                    };
                    return ApiResponseHelper.ReturnApiResponse(responseMessage, "importInOrder", "");
                }
                if (importMaterials.Select(x => x.Code).Distinct().Count() != 1)
                {
                    responseMessage = new ApiResponse<string>()
                    {
                        Code = 500,
                        Success = false,
                        Message = "本次请求中物料号不能重复",
                        Data = null,
                    };
                    return ApiResponseHelper.ReturnApiResponse(responseMessage, "importOutOrder", "");
                }
                #endregion
                #region 业务处理
@@ -179,7 +193,7 @@
        ///// <summary>
        ///// 导入出库单-版本1
        ///// 导入出库单-版本1(使用出库单据的版本)
        ///// </summary>
        ///// <param name="inputmaterials"></param>
        ///// <returns></returns>
@@ -261,7 +275,7 @@
        /// <summary>
        /// 导入出库单-版本2
        /// 导入出库单-版本2(选择库存出库的版本)
        /// </summary>
        /// <param name="inputmaterials"></param>
        /// <returns></returns>
@@ -296,12 +310,24 @@
                    };
                    return ApiResponseHelper.ReturnApiResponse(responseMessage, "importOutOrder", "");
                }
                if (inputmaterials.Select(x => x.Code).Distinct().Count() != 1)
                {
                    responseMessage = new ApiResponse<string>()
                    {
                        Code = 500,
                        Success = false,
                        Message = "本次请求中物料号不能重复",
                        Data = null,
                    };
                    return ApiResponseHelper.ReturnApiResponse(responseMessage, "importOutOrder", "");
                }
                #endregion
                #region 业务处理
                string typeName = "出库";
                handler_importOutOrder(typeName, inputmaterials, out msg);
                handler_OutOrder(inputmaterials, out msg);
                //handler_importOutOrder(typeName, inputmaterials, out msg);
                #endregion
@@ -439,5 +465,47 @@
            }
        }
        /// <summary>
        /// 选择库存出库的版本
        /// </summary>
        /// <param name="inputmaterials"></param>
        /// <param name="msg"></param>
        private void handler_OutOrder(List<InputMaterialEntity> inputmaterials, out string msg)
        {
            msg = "";
            //查找库存表中的id
            var qList = inputmaterials.Select(x => x.Code).ToList();
            List<int> ids = PlaceMaterialViewService.GetInstance().GetPlaceMaterialViewsByCodeList(qList, out msg);
            if (!string.IsNullOrEmpty(msg))
            {
                return;
            }
            // List<int> ids = GetSelectedDataKeyIDs(PlaceGrid);
            if (ids.Count > 0)
            {
                int count = MainTaskService.GetInstance().SaveOutMainTask(ids, out msg);
                if (count > 0)
                {
                    msg = "出库任务生成成功";
                }
                else if (count == 0)
                {
                    msg = "出库任务已在任务队列中";
                }
                else
                {
                    msg = "出库任务生成失败!";
                }
            }
            else
            {
                msg = "请选择要出库的物料";
            }
            //Alert.Show(msg);
            //WriteLog("库位物料出库" + msg, "库存管理");
        }
    }
}