using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Mvc;
|
using Model.ModelVm;
|
using Model.ModelVm.SysVm;
|
using System;
|
using System.Collections.Generic;
|
using System.Security.Claims;
|
using Model.ModelVm.LogVm;
|
using WMS.IBLL.IBllAsnServer;
|
using WMS.IBLL.ILogServer;
|
using Model.ModelVm.BllAsnVm;
|
using Wms.Tools;
|
using Microsoft.Extensions.Options;
|
|
namespace Wms.Controllers
|
{
|
[Route("api/[controller]/[action]")]
|
[ApiController]
|
[Authorize]
|
public class BllAsnController : ControllerBase
|
{
|
#region 依赖注入
|
private readonly ApiUrlConfig _config; //接口交互路径
|
private readonly IArrivalNoticeServer _arrivalNoticeSvc; // 入库单据Svc
|
private readonly IPalletBindServer _PalletBindSvc; // 托盘绑定Svc
|
private readonly IBllBoxInfoServer _BoxInfoSvc;
|
private readonly ITaskServer _taskSvc; //入库任务Svc
|
private readonly IOperationASNServer _logSvc; //入库库操作日志Svc
|
private readonly IPalletUnbindServer _palletUnbind; //托盘解绑绑定
|
private readonly IAuditLogServer _auditLog; //审核记录
|
private readonly IBllLabelBoxNoServer _labelBox; //箱码标签
|
#endregion
|
|
#region 构造函数
|
public BllAsnController(IOptions<ApiUrlConfig> setting, IArrivalNoticeServer arrivalNoticeSvc, IPalletBindServer palletBindSvc,IBllBoxInfoServer bllBoxInfoSvc, ITaskServer taskSvc,IOperationASNServer logSvc, IPalletUnbindServer palletUnbind,IAuditLogServer auditLog,IBllLabelBoxNoServer labelBox)
|
{
|
_config = setting.Value;
|
_arrivalNoticeSvc = arrivalNoticeSvc;
|
_PalletBindSvc = palletBindSvc;
|
_BoxInfoSvc = bllBoxInfoSvc;
|
_taskSvc = taskSvc;
|
_logSvc = logSvc;
|
_palletUnbind = palletUnbind;
|
_auditLog = auditLog;
|
_labelBox = labelBox;
|
}
|
#endregion
|
|
#region 入库单据
|
/// <summary>
|
/// 获取入库单信息
|
/// </summary>
|
/// <param name="model">查询条件</param>
|
/// <returns>入库单信息</returns>
|
[HttpPost]
|
public IActionResult GetArrivalNoticeList(ArrivalNoticeVm model)
|
{
|
try
|
{
|
var models = _arrivalNoticeSvc.GetArrivalNoticeList(model, out int count);
|
|
return Ok(new { code = 0, count, msg = "入库单信息", data = models });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
[HttpPost]
|
public IActionResult GetArrivalNoticeDetailList(ArrivalNoticeDetailVm model)
|
{
|
try
|
{
|
var models = _arrivalNoticeSvc.GetArrivalNoticeDetailList(model, out int count);
|
|
return Ok(new { code = 0, count, msg = "入库单明细信息", data = models });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 获取入库单明细剩余打印数量
|
/// </summary>
|
/// <param name="id"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetAsnDetailQtyList(int id)
|
{
|
try
|
{
|
var models = _arrivalNoticeSvc.GetAsnDetailQtyList(id);
|
|
return Ok(new { code = 0, msg = "入库单明细信息", data = models });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 获取添加明细数据源
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetMaterialsList(GetMaterialsVm model)
|
{
|
try
|
{
|
var models = _arrivalNoticeSvc.GetMaterialsList(model);
|
|
return Ok(new { code = 0, msg = "物料信息", data = models });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
[HttpPost]
|
public IActionResult AddArrivalNotice(ArrivalNoticeVm model)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(UserId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
|
model.CreateUser = int.Parse(UserId);
|
string strMesage = _arrivalNoticeSvc.AddArrivalNotice(model, _config.WcsHost + _config.AddOrderTaskUrl);
|
|
if (strMesage == "")
|
{
|
return Ok(new { code = 0, msg = "添加成功" });
|
}
|
if (strMesage.Contains("-1"))
|
{
|
return Ok(new { code = 1, msg = strMesage });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = strMesage });
|
}
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
[HttpPost]
|
public IActionResult EditArrivalNotice(ArrivalNoticeVm model)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(UserId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
|
model.CreateUser = int.Parse(UserId);
|
string strMesage = _arrivalNoticeSvc.EditArrivalNotice(model);
|
|
if (strMesage == "")
|
{
|
return Ok(new { code = 0, msg = "编辑成功" });
|
}
|
if (strMesage.Contains("-1"))
|
{
|
return Ok(new { code = 0, msg = "部分成功" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = strMesage });
|
}
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
[HttpPost]
|
public IActionResult DelArrivalNotice(ArrivalNoticeVm model)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(UserId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
|
model.CreateUser = int.Parse(UserId);
|
string strMesage = _arrivalNoticeSvc.DelArrivalNotice(model);
|
|
if (strMesage == "")
|
{
|
return Ok(new { code = 0, msg = "删除成功" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = strMesage });
|
}
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
[HttpPost]
|
public IActionResult DelArrivalNoticeDetail(ArrivalNoticeDetailVm model)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(UserId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
|
model.CreateUser = int.Parse(UserId);
|
string strMesage = _arrivalNoticeSvc.DelArrivalNoticeDetail(model);
|
|
if (strMesage == "")
|
{
|
return Ok(new { code = 0, msg = "删除成功" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = strMesage });
|
}
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 入库单撤销申请
|
/// </summary>
|
/// <param name="id"></param>
|
/// <param name="reason"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult CancelOrder(int id,string reason)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
|
_arrivalNoticeSvc.CancelOrder(id,reason,int.Parse(userId));
|
|
|
return Ok(new { code = 0, msg = "入库单撤销申请成功" });
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 维护入库单备注信息
|
/// </summary>
|
/// <param name="id"></param>
|
/// <param name="demo"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult EditNoticeDemo(int id, string demo)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
|
_arrivalNoticeSvc.EditNoticeDemo(id, demo, int.Parse(userId));
|
|
|
return Ok(new { code = 0, msg = "编辑备注成功" });
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
#endregion
|
|
#region 托盘绑定
|
[HttpPost]
|
public IActionResult GetPalletBindList(PalletBindVm model)
|
{
|
try
|
{
|
var models = _PalletBindSvc.GetPalletBindList(model, out int count);
|
|
return Ok(new { code = 0, count, msg = "托盘绑定信息", data = models });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
[HttpPost]
|
public IActionResult GetBoxInfoList(BoxInfoVm model)
|
{
|
try
|
{
|
var models = _PalletBindSvc.GetBoxInfoList(model, out int count);
|
|
return Ok(new { code = 0, count, msg = "箱支明细信息", data = models });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
[HttpGet]
|
public IActionResult GetBoxInfoByBoxNo(string bindNo, string boxNo, string boxNo3)
|
{
|
try
|
{
|
var models = _PalletBindSvc.GetBoxInfoByBoxNo(bindNo,boxNo, boxNo3);
|
|
return Ok(new { code = 0, count= models.Count, msg = "箱支明细信息", data = models });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 删除托盘绑定信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult DelPalletBind(IdVm model)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
_PalletBindSvc.DelPalletBind(model.Id, int.Parse(userId));
|
|
return Ok(new { code = 0, count = 0, msg = "删除成功", data = "" });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 删除绑定的箱码信息
|
/// </summary>
|
/// <param name="boxNo">箱号</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult DelBindBoxInfo(string boxNo)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
_PalletBindSvc.DelBindBoxInfo(boxNo,int.Parse(userId));
|
|
return Ok(new { code = 0, count = 0, msg = "删除成功", data = "" });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
|
/// <summary>
|
/// 托盘绑定撤销申请
|
/// </summary>
|
/// <param name="id"></param>
|
/// <param name="reason">申请原因</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult CancelPalletBind(int id, string reason)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
_PalletBindSvc.CancelPalletBind(id, reason,int.Parse(userId));
|
|
return Ok(new { code = 0, count = 0, msg = "托盘绑定撤销申请成功", data = "" });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 根据箱码获取未组盘的箱码信息
|
/// </summary>
|
/// <param name="boxNo"></param>
|
/// <param name="isContinue"></param>
|
/// <param name="boxNo2"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetBoxInfoListByBoxCode(string boxNo, string isContinue, string boxNo2)
|
{
|
try
|
{
|
var list = _BoxInfoSvc.GetBoxInfoList(boxNo, isContinue, boxNo2);
|
var num = 0;
|
if (list!=null)
|
{
|
num = list.Count;
|
}
|
return Ok(new { code = 0, count = num, msg = "箱码信息", data = list });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
#endregion
|
|
#region 指定储位
|
|
/// <summary>
|
/// 指定储位数据源(正常的空储位)
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetLocateList(GetOkLocateVm model)
|
{
|
try
|
{
|
var models = _PalletBindSvc.GetLocateList("W01",model.RoadwayNo,model.Row,model.Column,model.Layer,model.LocateNo,model.BindId,model.Page,model.Limit, out int count);
|
|
return Ok(new { code = 0, count, msg = "获取指定储位信息", data = models });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 保存指定的储位
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult SaveAppointSlot(SaveLocateVm model)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
_PalletBindSvc.SaveAppointSlot(model.BindId,model.LocateId,int.Parse(userId));
|
|
return Ok(new { code = 0, count = 0, msg = "指定储位成功", data = "" });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
#endregion
|
|
#region 物料信息录入
|
[HttpPost]
|
public IActionResult GetBllBoxInfoList(BoxInfoVm model)
|
{
|
try
|
{
|
var models = _BoxInfoSvc.GetBoxInfoList(model, out int count);
|
|
return Ok(new { code = 0, count, msg = "箱支信息", data = models });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
[HttpPost]
|
public IActionResult AddBllBoxInfo(BoxInfoVm model)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(UserId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
|
model.CreateUser = int.Parse(UserId);
|
string strMesage = _BoxInfoSvc.AddBoxInfo(model);
|
|
if (strMesage == "")
|
{
|
return Ok(new { code = 0, msg = "添加成功" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = strMesage });
|
}
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = "添加失败:" + e.Message });
|
}
|
}
|
|
[HttpPost]
|
public IActionResult DelBllBoxInfo(BoxInfoVm model)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(UserId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
|
model.CreateUser = int.Parse(UserId);
|
string strMesage = _BoxInfoSvc.DelBoxInfo(model);
|
|
if (strMesage == "")
|
{
|
return Ok(new { code = 0, msg = "删除成功" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = strMesage });
|
}
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 物料信息录入 导入
|
/// </summary>
|
/// <param name="models"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult ImportBllBoxInfo(BoxInfoVms models)
|
{
|
try
|
{
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(UserId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
|
models.CreateUser = int.Parse(UserId);
|
string strMessage = _BoxInfoSvc.ImportBoxInfo(models);
|
|
if (strMessage.Contains("-1"))
|
{
|
return Ok(new { code = 1, msg = strMessage });
|
}
|
else
|
{
|
return Ok(new { code = 0, msg = strMessage });
|
}
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
#endregion
|
|
#region 入库日志
|
|
/// <summary>
|
/// 获取入库任务信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetArrivalTaskList(GetTaskVm model)
|
{
|
try
|
{
|
var type = new List<string>() { "0" };
|
var bolls = _taskSvc.GetTaskList(type, model.Type, model.Status, model.TaskNo, model.IsSuccess, model.PalletNo, model.Msg, model.Page, model.Limit, out int count);
|
|
return Ok(new { code = 0, count, msg = "入库任务信息", data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 取消入库任务
|
/// </summary>
|
/// <param name="taskNo"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult CancelAsnTask(string taskNo)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
_PalletBindSvc.CancelAsnTask(taskNo, int.Parse(userId));
|
|
return Ok(new { code = 0, msg = "取消任务已完成", data = "" });
|
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 完成入库任务
|
/// </summary>
|
/// <param name="taskNo"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult FinishAsnTask(string taskNo)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
_PalletBindSvc.ArrivalSuccess(taskNo, int.Parse(userId));
|
|
return Ok(new { code = 0, msg = "成功完成任务", data = "" });
|
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
|
#endregion
|
|
#region 操作日志
|
|
/// <summary>
|
/// 获取入库操作日志信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetLogOperationAsnList(GetOperationVm model)
|
{
|
try
|
{
|
var bolls = _logSvc.GetLogOperationAsnList(model.MenuName, model.Type, model.Msg, model.StartTime, model.EndTime, model.Page, model.Limit, out int count);
|
|
return Ok(new { code = 0, count, msg = "入库操作日志信息", data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
#endregion
|
|
#region 托盘解绑绑定
|
[HttpPost]
|
public IActionResult GetPalletUnbindList(PalletUnbindVm model)
|
{
|
try
|
{
|
int count = 0;
|
var list = _palletUnbind.GetPalletUnbindList(model, out count);
|
return Ok(new { code = 0, count = count, msg = "托盘解绑绑定列表", data = list });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, count = 0, msg = e.Message });
|
}
|
}
|
[HttpPost]
|
public IActionResult GetPalletUnbindList2(PalletUnbindVm model)
|
{
|
try
|
{
|
int count = 0;
|
var list = _palletUnbind.GetPalletUnbindList2(model, out count);
|
return Ok(new { code = 0, count = count, msg = "托盘解绑绑定箱码列表", data = list });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, count = 0, msg = e.Message });
|
}
|
}
|
#endregion
|
|
#region 审核记录
|
|
[HttpPost]
|
public IActionResult GetAuditLogList(AuditLogVm model)
|
{
|
try
|
{
|
var list = _auditLog.GetAuditLogList(model, out int count);
|
return Ok(new { code = 0, count, msg = "审核记录列表", data = list });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, count = 0, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 编辑审核
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult EditAudit(EditAuditVm model)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
_auditLog.EditAudit(model.Id,model.Status,model.Opinion, int.Parse(userId));
|
|
return Ok(new { code = 0, count=0, msg = "审核记录列表", data = "" });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, count = 0, msg = e.Message });
|
}
|
}
|
|
#endregion
|
|
#region 箱码标签
|
|
[HttpPost]
|
public IActionResult GetLabelBoxList(LabelBoxInfoVm model)
|
{
|
try
|
{
|
var list = _BoxInfoSvc.GetLabelBoxList(model, out int count);
|
return Ok(new { code = 0, count, msg = "箱码标签列表", data = list });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, count = 0, msg = e.Message });
|
}
|
}
|
|
[HttpGet]
|
public IActionResult GetLabelBoxModel(int id)
|
{
|
try
|
{
|
var list = _BoxInfoSvc.GetLabelBoxModel(id);
|
return Ok(new { code = 0, msg = "箱码模板信息", data = list });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
[HttpPost]
|
public IActionResult AddLabelBox(AddLabelBoxInfoVm model)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
var list = _BoxInfoSvc.AddLabelBox(model.Id, model.IsReset, decimal.Parse(model.ArriveQty), model.ProductionTime, model.ExpirationTime, model.StoreTime, model.SupplierLot, int.Parse(userId));
|
return Ok(new { code = 0, msg = "生成箱码标签成功", data = list });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, count = 0, msg = e.Message });
|
}
|
}
|
|
|
[HttpPost]
|
public IActionResult GetBuDaLabelList(BuDaLabelBoxVm model)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
var list = _BoxInfoSvc.GetBuDaLabelList(model.BoxNo, model.EndBoxNo, model.BoxNo2, model.EndBoxNo2,model.Type,int.Parse(userId));
|
return Ok(new { code = 0, msg = "获取补打箱码标签信息", data = list });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, count = 0, msg = e.Message });
|
}
|
}
|
|
//根据入库单号过去单据下所有批次号
|
[HttpGet]
|
public IActionResult GetLotNoListByAsn(string asnNo)
|
{
|
try
|
{
|
var list = _BoxInfoSvc.GetLotNoListByAsn(asnNo);
|
return Ok(new { code = 0, msg = "成功获取单据下所有批次号信息", data = list });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, count = 0, msg = e.Message });
|
}
|
}
|
|
//删除单据下单个或多个批次的标签
|
[HttpPost]
|
public IActionResult DelLabelByAsnNo(LabelBoxInfoVm model)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
_BoxInfoSvc.DelLabelByAsnNo(model.AsnNo,model.LotNo,int.Parse(userId));
|
return Ok(new { code = 0, msg = "删除成功", data = "" });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, count = 0, msg = e.Message });
|
}
|
}
|
|
|
//编辑标签数量
|
[HttpPost]
|
public IActionResult EditLabelQty(EditLabelQtyVm model)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
|
}
|
_BoxInfoSvc.EditLabelQty(model.Id, model.Qty, int.Parse(userId));
|
return Ok(new { code = 0, msg = "编辑成功", data = "" });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, count = 0, msg = e.Message });
|
}
|
}
|
|
#endregion
|
}
|
|
}
|