|
|
|
|
|
using System.Collections;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Controllers;
|
|
|
using Estsh.Core.Util;
|
|
|
using Estsh.Core.Model.ExcelModel;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:出货单维护
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
|
{
|
|
|
public class MESOD10Controller : BaseController
|
|
|
{
|
|
|
private IMESOD10Service service;
|
|
|
public MESOD10Controller(IMESOD10Service _service)
|
|
|
{
|
|
|
service = _service;
|
|
|
}
|
|
|
//
|
|
|
// GET: /MESOD10/
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取出货单维护列表数据
|
|
|
/// </summary>
|
|
|
/// <param name="MESOD10Name">菜单名称</param>
|
|
|
/// <param name="pager">分页</param>
|
|
|
/// <param name="direction">排序方式</param>
|
|
|
/// <param name="sort">排序列</param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getMESOD10ListByPage(String QiShiHuoYunDan, String JieShuHuoYunDan, Pager pager, String direction, String sort, String enabled = "Y")
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
|
Hashtable dataHt = this.service.getMESOD10ListByPage(QiShiHuoYunDan, JieShuHuoYunDan, pager, direction, sort, enabled);
|
|
|
result.Add("rows", dataHt["dataList"]);
|
|
|
result.Add("pager.totalRows", dataHt["totalCount"]);
|
|
|
result.Add("sort", sort);
|
|
|
result.Add("direction", direction);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取下拉列表数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult GetTerminalName()
|
|
|
{
|
|
|
string a = "";
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> MESOD10List = this.service.GetTerminalName();
|
|
|
result.Add("list", MESOD10List);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存数据
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult saveMESOD10()
|
|
|
{
|
|
|
String editType = Request.Form["editType"].ToString();
|
|
|
|
|
|
String partId = Request.Form["partId"].ToString();
|
|
|
String cust_order = Request.Form["cust_order"].ToString();
|
|
|
String ship_unit = Request.Form["ship_unit"].ToString();
|
|
|
|
|
|
SysPartCustOrder sysPartCustOrder = new SysPartCustOrder();
|
|
|
sysPartCustOrder.PartId = Convert.ToInt32(partId);
|
|
|
sysPartCustOrder.CustOrder = cust_order;
|
|
|
sysPartCustOrder.ShipUnit = ship_unit;
|
|
|
|
|
|
String message = "";
|
|
|
if (editType != null && editType.Trim().Equals("edit"))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
sysPartCustOrder.UpdateUserId = CurrentEmp.EmpId;
|
|
|
this.service.updateMESOD10(sysPartCustOrder);
|
|
|
message = "修改成功";
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "修改失败!";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
sysPartCustOrder.CreateUserId = CurrentEmp.EmpId;
|
|
|
this.service.saveMESOD10(sysPartCustOrder);
|
|
|
message = "添加成功";
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "添加失败!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("message", message);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查看详情
|
|
|
/// </summary>
|
|
|
/// <param name="ruid"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getMESOD10(String MESOD10_id)
|
|
|
{
|
|
|
List<SysPartCustOrder> MESOD10Info = this.service.getMESOD10(MESOD10_id);
|
|
|
ViewData.Add("partId", MESOD10Info[0].PartId);
|
|
|
ViewData.Add("cust_order", MESOD10Info[0].CustOrder);
|
|
|
ViewData.Add("ship_unit", MESOD10Info[0].ShipUnit);
|
|
|
|
|
|
return View("viewMESOD10");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 编辑
|
|
|
/// </summary>
|
|
|
/// <param name="ruid"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult editMESOD10(String partId)
|
|
|
{
|
|
|
List<SysPartCustOrder> MESOD10Info = this.service.getMESOD10(partId);
|
|
|
ViewData.Add("editType", "edit");
|
|
|
ViewData.Add("partId", partId);
|
|
|
ViewData.Add("cust_order", MESOD10Info[0].CustOrder);
|
|
|
ViewData.Add("ship_unit", MESOD10Info[0].ShipUnit);
|
|
|
|
|
|
return View("EditMESOD10");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult deleteMESOD10(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.deleteMESOD10(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 导出
|
|
|
/// </summary>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="txtOrderNo"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="isPage"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult ExportMESOD10(String locationDate, String terminal_name, String Date, String Date2, Pager pager, String sort, String direction, String isPage)
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(locationDate))
|
|
|
{
|
|
|
return Json("");
|
|
|
}
|
|
|
|
|
|
Boolean paging = false;
|
|
|
if (isPage == null || "".Equals(isPage))
|
|
|
{
|
|
|
paging = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if ("1".Equals(isPage))
|
|
|
{
|
|
|
paging = true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
paging = false;
|
|
|
}
|
|
|
}
|
|
|
List<MESOD> dataHt = this.service.getTableListByPage(locationDate, terminal_name, Date, Date2, pager, direction, sort, paging);
|
|
|
|
|
|
var memoryStream = ExcelHelper.ToExcel(dataHt);
|
|
|
return File(memoryStream.ToArray(), "application/ms-excel", "解锁记录明细.xls");
|
|
|
}
|
|
|
}
|
|
|
}
|