using AngleSharp.Dom;
using log4net.Core;
using Masuit.Tools;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.Const;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO;
using WIDESEA_DTO.WMS;
using WIDESEA_Model.Models;
namespace WIDESEA_StoragIntegrationServices
{
public partial class MCSService
{
///
/// 请求移库
///
///
///
public WebResponseContent RequestChangeLocation(object json)
{
WebResponseContent content = new WebResponseContent();
try
{
if (string.IsNullOrEmpty(json.ToString())) throw new Exception("请求参数为空");
var result = JsonConvert.DeserializeObject(json.ToString());
var location = _locationRepository.QueryFirst(x => x.AreaId == result.LocationArea && x.LocationCode == result.LocationID);
if (location == null) throw new Exception("未知库位");
if (_taskRepository.QueryFirst(x => x.SourceAddress == result.LocationID && x.Roadway == location.RoadwayNo) != null)
{
throw new Exception("当前库位已存在任务");
}
LogFactory.GetLog("分容移库申请").Info(true, $"\r\r--------------------------------------");
LogFactory.GetLog("分容移库申请").Info(true, result.ToJsonString());
return content.OK();
}
catch (Exception ex)
{
LogFactory.GetLog("分容移库申请").Info(true, $"\r\r--------------------------------------");
LogFactory.GetLog("分容移库申请").Info(true, ex.Message);
return content.Error(ex.Message);
}
}
}
}