using HH.TOOLS.LOG;
|
using HH.WMS.BLL;
|
using HH.WMS.BLL.Check;
|
using HH.WMS.Common;
|
using HH.WMS.Entitys;
|
using HH.WMS.Entitys.Check;
|
using HH.WMS.WebApi.Areas.Common.Controllers;
|
using Newtonsoft.Json;
|
using Newtonsoft.Json.Converters;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Web.Http;
|
|
namespace HH.WMS.WebApi.Areas.Check.Controllers
|
{
|
/// <summary>
|
/// 盘点(南通桑德)
|
/// </summary>
|
public class CheckWxysController : BaseController
|
{
|
#region GET
|
|
/// <summary>
|
/// 获取盘点主表分页
|
/// </summary>
|
/// <param name="obj"></param>
|
/// <returns></returns>
|
/// <History>[Hanhe(lt)] created by 2018-7-4</History>
|
[HttpPost]
|
public string GetCheckMst(dynamic obj)
|
{
|
string tokenId = Util.ToString(obj.tokenId);
|
return ValidateToken(tokenId, t =>
|
{
|
DataTable dt = BLLCreator.Create<TN_WM_CHECK_MSTBLL>().GetDataTable(obj);
|
OperateResult res = OperateResult.Succeed(null, new { rows = dt, total = obj.PageCount });
|
IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
|
timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
return JsonConvert.SerializeObject(res, timeFormat);
|
});
|
|
}
|
|
/// <summary>
|
/// 获取盘点明细
|
/// </summary>
|
/// <param name="obj"></param>
|
/// <returns></returns>
|
/// <history>[HanHe(lt)] CREATED 2018/12/6</history>
|
/// <history>[HanHe(dbs)] CREATED 2019/3/18</history>
|
public OperateResult GetCheckDtl(string opNo)
|
{
|
return ValidateToken(t =>
|
{
|
var result = BLLCreator.Create<TN_WM_CHECK_WXYSBLL>().GetCheckDtl(opNo);
|
return result;
|
});
|
}
|
|
/// <summary>
|
/// 获取盘点记录
|
/// </summary>
|
/// <param name="obj"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public string GetCheckList(dynamic obj)
|
{
|
string tokenId = Util.ToString(obj.tokenId);
|
return ValidateToken(tokenId, t =>
|
{
|
DataTable dt = BLLCreator.Create<TN_WM_CHECK_WXYSBLL>().GetCheckList(obj);
|
OperateResult res = OperateResult.Succeed(null, new { rows = dt, total = obj.PageCount });
|
IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
|
timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
return JsonConvert.SerializeObject(res, timeFormat);
|
});
|
}
|
|
/// <summary>
|
/// 根据单号获取盘点单列表
|
/// </summary>
|
/// <param name="opNo"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetCheckListByOpNo(string opNo)
|
{
|
var result = BLLCreator.Create<TN_WM_CHECK_WXYSBLL>().GetCheckListByOpNo(opNo);
|
return result;
|
}
|
|
/// <summary>
|
/// 获取主子表
|
/// </summary>
|
/// <param name="opNo"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetMstAndDtl(string opNo)
|
{
|
var result = BLLCreator.Create<TN_WM_CHECK_WXYSBLL>().GetMstAndDtl(opNo);
|
return result;
|
}
|
|
#endregion
|
|
#region ADD
|
|
/// <summary>
|
/// 盘点单新增
|
/// </summary>
|
/// <param name="checkAddDto"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public OperateResult Add(CheckAddDto checkAddDto)
|
{
|
var logPara = new LogPara("盘点单新增");
|
try
|
{
|
return ValidateToken(checkAddDto.tokenId, t =>
|
{
|
logPara.Push("接收参数:" + JsonConvert.SerializeObject(checkAddDto));
|
var result = BLLCreator.Create<TN_WM_CHECK_WXYSBLL>().Add(checkAddDto.checkList, t, logPara);
|
logPara.PushAndAdd("返回结果:" + (result.Success ? "成功" : "失败" + result.Msg));
|
return result;
|
});
|
}
|
catch (Exception ex)
|
{
|
logPara.PushAndAdd(ex);
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
|
#endregion
|
|
#region UPDATE
|
|
/// <summary>
|
/// 盘点单更新
|
/// </summary>
|
/// <param name="checkAddDto"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public OperateResult Update(CheckAddDto checkAddDto)
|
{
|
return ValidateToken(checkAddDto.tokenId, t =>
|
{
|
var result = BLLCreator.Create<TN_WM_CHECK_WXYSBLL>().Update(checkAddDto, t);
|
return result;
|
});
|
}
|
|
/// <summary>
|
/// 提交盘点单
|
/// </summary>
|
/// <param name="opNo"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public OperateResult Submit(CheckAuditDto checkAuditDto)
|
{
|
return BLLCreator.Create<TN_WM_CHECK_WXYSBLL>().Submit(checkAuditDto);
|
}
|
|
/// <summary>
|
/// 审核
|
/// </summary>
|
/// <param name="checkAuditDto"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public OperateResult Audit(CheckAuditDto checkAuditDto)
|
{
|
var logPara = new LogPara("盘点单审核");
|
var checkAuditPara = new CheckAuditPara { checkAuditDto = checkAuditDto };
|
try
|
{
|
logPara.Push("接收参数:" + JsonConvert.SerializeObject(checkAuditDto));
|
var result = BLLCreator.Create<TN_WM_CHECK_WXYSBLL>().Audit(checkAuditPara, logPara);
|
logPara.PushAndAdd("返回结果:" + result.Describe());
|
return result;
|
}
|
catch (Exception ex)
|
{
|
logPara.PushAndAdd(ex);
|
return OperateResult.Error(ex.Message);
|
}
|
|
}
|
|
/// <summary>
|
/// 盘点单反审
|
/// </summary>
|
/// <param name="checkAuditDto"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public OperateResult ReAudit(CheckAuditDto checkAuditDto)
|
{
|
var logPara = new LogPara("盘点单反审");
|
try
|
{
|
logPara.Push("接收参数:" + JsonConvert.SerializeObject(checkAuditDto));
|
var result = BLLCreator.Create<TN_WM_CHECK_WXYSBLL>().ReAudit(checkAuditDto, logPara);
|
logPara.PushAndAdd("返回结果:" + result.Describe());
|
return result;
|
}
|
catch (Exception ex)
|
{
|
return OperateResult.Error("系统异常:" + ex.Message);
|
}
|
|
}
|
|
#endregion
|
|
#region DELETE
|
|
/// <summary>
|
/// 盘点单删除
|
/// </summary>
|
/// <param name="opNo">盘点单号</param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult Delete(string opNo)
|
{
|
var logPara = new LogPara("盘点单删除");
|
try
|
{
|
logPara.Push("接收参数opNo:" + opNo);
|
var result = BLLCreator.Create<TN_WM_CHECK_WXYSBLL>().Delete(opNo, logPara);
|
logPara.PushAndAdd("执行结果:" + (result.Success ? "成功" : "失败," + result.Msg));
|
return result;
|
}
|
catch (Exception ex)
|
{
|
logPara.PushAndAdd(ex);
|
return OperateResult.Error("系统异常:" + ex.Message);
|
}
|
|
}
|
|
#endregion
|
|
}
|
}
|