using Estsh.Core.Wms.IServices;
using Estsh.Core.Model.Result;
using Microsoft.AspNetCore.Mvc;
using Estsh.Core.Models;
using Estsh.Core.Controllers;
using System.Diagnostics;
using Estsh.Core.Util;
namespace Estsh.Core.Web.Areas.Wms.Controllers.Receiving
{
[Route("wms/[controller]")]
[ApiController]
public class ReceiveController : WmsBaseController
{
private IReceiveService service;
// GET: LoginController
public ReceiveController(IReceiveService _service)
{
service = _service;
}
///
/// 正常收货
///
///
///
///
///
[HttpPost("CheckCartonStatus")]
public IActionResult CheckCartonStatus(Newtonsoft.Json.Linq.JObject jobj)
{
string cartonNo = jobj["cartonNo"].ToString();
bool isRejection = Convert.ToBoolean(jobj["isRejection"].ToString());
bool isQc = Convert.ToBoolean(jobj["isQc"].ToString());
string groupNo = jobj["groupNo"].ToString();
string loginId = jobj["loginId"].ToString();
string supportingParts = jobj["supportingParts"].ToString();
string cdNum = jobj["cdNum"].ToString();
string orderNo = jobj["orderNo"].ToString();
WmsResponseResult result = new WmsResponseResult();
try
{
Stopwatch sw = new Stopwatch();
sw.Start();
string obj = service.CheckCartonStatus(cartonNo, isRejection, groupNo, CurrentEmp, supportingParts,cdNum,orderNo, isQc);
result.Success = true;
result.Data = obj;
sw.Stop();
int timeFor = (int)sw.Elapsed.TotalMilliseconds;
LogHelper.Info("当前操作:正常收货;订单号为:"+ orderNo + ";当前时间差:" + timeFor);
}
catch (Exception ex)
{
result.Msg = ex.Message;
}
return Json(result);
}
///
/// 收货拒收,更改数据状态
///
///
///
[HttpPost("UpdateCartonStatusInRejection")]
public IActionResult UpdateCartonStatusInRejection(Newtonsoft.Json.Linq.JObject jobj)
{
string cartonNo = jobj["cartonNo"].ToString();
string info = jobj["info"].ToString();
string loginId = jobj["loginId"].ToString();
string supportingParts = jobj["supportingParts"].ToString();
WmsResponseResult result = new WmsResponseResult();
try
{
string obj = service.UpdateCartonStatusInRejection(cartonNo, info, loginId, supportingParts);
result.Success = true;
result.Data = obj;
}
catch (Exception ex)
{
result.Msg = ex.Message;
}
return Json(result);
}
[HttpPost("UpdateCartonStatusInRejectionBycd")]
public IActionResult UpdateCartonStatusInRejectionBycd(Newtonsoft.Json.Linq.JObject jobj)
{
string cartonNo = jobj["cartonNo"].ToString();
string info = jobj["info"].ToString();
string loginId = jobj["loginId"].ToString();
string supportingParts = jobj["supportingParts"].ToString();
string cdNum = jobj["cdNum"].ToString();
WmsResponseResult result = new WmsResponseResult();
try
{
string obj = service.UpdateCartonStatusInRejectionBycd(cartonNo, info, loginId, supportingParts, cdNum);
result.Success = true;
result.Data = obj;
}
catch (Exception ex)
{
result.Msg = ex.Message;
}
return Json(result);
}
///
/// 通过箱条码获取收货订单的明细信息
///
///
///
///
[HttpPost("GetCartonSummaryInfo")]
public IActionResult GetCartonSummaryInfo(Newtonsoft.Json.Linq.JObject jobj)
{
string cartonNo = jobj["cartonNo"].ToString();
string receving = jobj["receving"].ToString();
string loginId = jobj["loginId"].ToString();
string supportingParts = jobj["supportingParts"].ToString();
WmsResponseResult result = new WmsResponseResult();
try
{
Stopwatch sw = new Stopwatch();
sw.Start();
SetObjectDetail obj = service.GetCartonSummaryInfo(cartonNo, receving, supportingParts, loginId);
result.Success = true;
result.Data = obj;
sw.Stop();
int timeFor = (int)sw.Elapsed.TotalMilliseconds;
LogHelper.Info("当前操作:列出当前收货中的订单列表,当前时间差:" + timeFor);
}
catch (Exception ex)
{
result.Msg = ex.Message;
}
return Json(result);
}
///
/// 通过箱条码获取收货订单的明细信息
///
///
///
///
[HttpPost("GetRecevingListing")]
public IActionResult GetRecevingListing(Newtonsoft.Json.Linq.JObject jobj)
{
string orderNo = jobj["orderNo"].ToString();
WmsResponseResult result = new WmsResponseResult();
try
{
SetObjectDetail obj = service.GetRecevingListing(orderNo);
result.Success = true;
result.Data = obj;
}
catch (Exception ex)
{
result.Msg = ex.Message;
}
return Json(result);
}
///
/// 当前收货中订单生成QC列表
///
///
///
///
[HttpPost("CreateQcInfo")]
public IActionResult CreateQcInfo(Newtonsoft.Json.Linq.JObject jobj)
{
WmsResponseResult result = new WmsResponseResult();
try
{
string receving = jobj["receving"].ToString();
string loginId = jobj["loginId"].ToString();
Stopwatch sw = new Stopwatch();
sw.Start();
string obj = service.CreateQcInfo(receving, loginId);
result.Success = true;
result.Data = obj;
sw.Stop();
int timeFor = (int)sw.Elapsed.TotalMilliseconds;
LogHelper.Info("当前操作:当前收货中订单生成QC列表,当前时间差:" + timeFor);
}
catch (Exception ex)
{
result.Msg = ex.Message;
}
return Json(result);
}
///
///
///
///
///
///
[HttpPost("GetRejectionInfo")]
public IActionResult GetRejectionInfo()
{
WmsResponseResult result = new WmsResponseResult();
try
{
Stopwatch sw = new Stopwatch();
sw.Start();
List obj = service.GetRejectionInfo();
result.Success = true;
result.Data = obj;
sw.Stop();
int timeFor = (int)sw.Elapsed.TotalMilliseconds;
LogHelper.Info("当前操作:初始化拒收,当前时间差:" + timeFor);
}
catch (Exception ex)
{
result.Msg = ex.Message;
}
return Json(result);
}
///
/// 自动提交
///
///
///
[HttpPost("CheckStatus")]
public IActionResult CheckStatus(Newtonsoft.Json.Linq.JObject jobj)
{
string receving = jobj["receving"].ToString();
WmsResponseResult result = new WmsResponseResult();
try
{
string obj = service.CheckStatus(receving);
result.Success = true;
result.Data = obj;
}
catch (Exception ex)
{
result.Msg = ex.Message;
}
return Json(result);
}
///
/// 得到 标准收货列表
///
///
[HttpPost("GetStandardList")]
public IActionResult GetStandardList(Newtonsoft.Json.Linq.JObject jobj)
{
WmsResponseResult result = new WmsResponseResult();
try
{
string cartonno = jobj["cartonno"].ToString();
List obj = service.GetStandardList(cartonno);
result.Success = true;
result.Data = obj;
}
catch (Exception ex)
{
result.Msg = ex.Message;
}
return Json(result);
}
[HttpPost("GetRecevingListByOrderNo")]
public IActionResult GetRecevingListByOrderNo(Newtonsoft.Json.Linq.JObject jobj)
{
WmsResponseResult result = new WmsResponseResult();
try
{
string orderNo = jobj["orderNo"].ToString();
Stopwatch sw = new Stopwatch();
sw.Start();
SetObjectDetail obj = service.GetRecevingListByOrderNo(orderNo);
result.Success = true;
result.Data = obj;
sw.Stop();
int timeFor = (int)sw.Elapsed.TotalMilliseconds;
LogHelper.Info("当前操作:列出" + orderNo + "收货中的订单列表,当前时间差:" + timeFor);
}
catch (Exception ex)
{
result.Msg = ex.Message;
}
return Json(result);
}
[HttpPost("GetRealOrderList")]
public IActionResult GetRealOrderList(Newtonsoft.Json.Linq.JObject jobj)
{
WmsResponseResult result = new WmsResponseResult();
try
{
string orderNo = jobj["orderNo"].ToString();
Stopwatch sw = new Stopwatch();
sw.Start();
SetObjectDetail obj = service.GetRealOrderList(orderNo);
result.Success = true;
result.Data = obj;
sw.Stop();
int timeFor = (int)sw.Elapsed.TotalMilliseconds;
LogHelper.Info("当前操作:列出"+ orderNo + "收货中的已收订单列表,当前时间差:" + timeFor);
}
catch (Exception ex)
{
result.Msg = ex.Message;
}
return Json(result);
}
}
}