using HH.AutoBom.Core;
using HH.WMS.Common;
using HH.WMS.Entitys.Basic;
using HH.WMS.WebUI.Controllers;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace HH.WMS.WebUI.Areas.Sys.Controllers
{
public class TrayController : BaseController
{
public ActionResult Index()
{
return View();
}
public ActionResult Add()
{
return View();
}
public ActionResult Edit(string trayCode)
{
ViewData["trayCode"] = trayCode;
return View();
}
#region 新增容器
///
/// 新增容器
///
/// 容器编号
/// 容器类型
/// 新增数量
///
/// [Hanhe(DBS)] CREATED BY 2018-12-06
[HttpPost]
public string Add(TN_WM_B_TRAY_INFOEntity model)
{
var loginer = FormsAuth.GetUserData();
model.TokenId = loginer.Extend1;
model.CN_S_CREATOR = model.CN_S_MODIFY = loginer.UserCode;
model.CN_S_CREATOR_BY = model.CN_S_MODIFY_BY = loginer.UserName;
model.CN_T_CREATE = model.CN_T_MODIFY = DateTime.Now;
return HttpWMS_Post("Api/Tray/Add", JsonConvert.SerializeObject(model));
}
#endregion
#region 根据托盘号获取实体
///
/// 根据托盘号获取实体
///
/// 托盘号
///
/// [Hanhe(DBS)] CREATED BY 2018-12-06
public string GetModel(string trayCode)
{
return HttpWMS_Get("Api/Tray/GetModel?trayCode=" + trayCode);
}
#endregion
#region 修改容器
///
/// 修改容器
///
/// 容器编号
/// 容器类型
///
/// [Hanhe(DBS)] CREATED BY 2018-12-06
[HttpPost]
public string Edit(TN_WM_B_TRAY_INFOEntity model)
{
var loginer = FormsAuth.GetUserData();
model.TokenId = loginer.Extend1;
model.CN_S_MODIFY = loginer.UserCode;
model.CN_S_MODIFY_BY = loginer.UserName;
model.CN_T_MODIFY = DateTime.Now;
return HttpWMS_Post("Api/Tray/Edit", JsonConvert.SerializeObject(model));
}
#endregion
#region 根据托盘号批量删除
///
/// 根据托盘号批量删除
///
/// 多个托盘号用逗号隔开
///
/// [Hanhe(DBS)] CREATED BY 2018-12-06
[HttpGet]
public string Delete(string trays)
{
//var sr = new StreamReader(Request.InputStream);
//string stream = sr.ReadToEnd();
//string[] trays = trays.Split(',');
return HttpWMS_Get("Api/Tray/Delete?trays=" + trays);
}
#endregion
#region 查询容器
///
/// 查询容器
///
/// 分页索引
/// 分页大小
/// 容器编号
/// 容器类型
///
/// [Hanhe(DBS)] CREATED BY 2018-12-01
public string GetList(int pageIndex, int pageSize, string trayCode,string trayType)
{
var loginer = FormsAuth.GetUserData();
var searchModel = new
{
TokenId=loginer.Extend1,
PageIndex = pageIndex,
PageSize = pageSize,
SearchCondition = new
{
CN_S_TRAY_CODE = trayCode,
CN_S_TRAY_TYPE=trayType
}
};
return HttpWMS_Post("Api/Tray/GetList", JsonConvert.SerializeObject(searchModel));
}
#endregion
}
}