| | |
| | | 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 |
| | |
| | | }; |
| | | 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 业务处理 |
| | |
| | | } |
| | | |
| | | |
| | | ///// <summary> |
| | | ///// 导入出库单-版本1(使用出库单据的版本) |
| | | ///// </summary> |
| | | ///// <param name="inputmaterials"></param> |
| | | ///// <returns></returns> |
| | | //[HttpPost] |
| | | //public ActionResult importOutOrder(List<InputMaterialEntity> inputmaterials) |
| | | //{ |
| | | // var responseMessage = new ApiResponse<string>(); |
| | | // try |
| | | // { |
| | | // var msg = ""; |
| | | |
| | | // #region 验证 |
| | | // if (inputmaterials?.Count() == 0) |
| | | // { |
| | | // responseMessage = new ApiResponse<string>() |
| | | // { |
| | | // Code = 500, |
| | | // Success = false, |
| | | // Message = "数据条数为0", |
| | | // Data = null, |
| | | // }; |
| | | // return ApiResponseHelper.ReturnApiResponse(responseMessage, "importOutOrder", ""); |
| | | // } |
| | | // if (inputmaterials.Select(x => x.ListNo).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); |
| | | |
| | | // #endregion |
| | | |
| | | // if (!string.IsNullOrEmpty(msg)) |
| | | // { |
| | | // responseMessage = new ApiResponse<string>() |
| | | // { |
| | | // Code = 500, |
| | | // Success = false, |
| | | // Message = "生成出库任务异常:" + msg, |
| | | // Data = null, |
| | | // }; |
| | | // } |
| | | // else |
| | | // { |
| | | // responseMessage = new ApiResponse<string>() |
| | | // { |
| | | // Code = 200, |
| | | // Success = true, |
| | | // Message = "成功", |
| | | // Data = null, |
| | | // }; |
| | | // } |
| | | |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // responseMessage = new ApiResponse<string>() |
| | | // { |
| | | // Code = 500, |
| | | // Success = false, |
| | | // Message = "异常:" + ex.Message, |
| | | // Data = null, |
| | | // }; |
| | | // } |
| | | |
| | | // return ApiResponseHelper.ReturnApiResponse(responseMessage, "importOutOrder", ""); |
| | | //} |
| | | |
| | | |
| | | /// <summary> |
| | | /// 导入出库单 |
| | | /// 导入出库单-版本2(选择库存出库的版本) |
| | | /// </summary> |
| | | /// <param name="inputmaterials"></param> |
| | | /// <returns></returns> |
| | |
| | | }; |
| | | 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 |
| | | |
| | |
| | | |
| | | return ApiResponseHelper.ReturnApiResponse(responseMessage, "importOutOrder", ""); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 公共导入 入库单或出库单 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <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, "库存管理"); |
| | | } |
| | | |
| | | } |
| | | } |