You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

249 lines
8.2 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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
{
/// <summary>
/// 客户订单维护
/// </summary>
public class TruckOrderPrintController : BaseController
{
private ITruckOrderPrintService service;
public TruckOrderPrintController(ITruckOrderPrintService _service)
{
service = _service;
}
//
// GET: /TruckOrderPrint/
public ActionResult Index()
{
return View();
}
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="TruckOrderPrintName">菜单名称</param>
/// <param name="pager">分页</param>
/// <param name="direction">排序方式</param>
/// <param name="sort">排序列</param>
/// <returns></returns>
public ActionResult getTruckOrderPrintListByPage(String custPdlineName, String comtype_name,String StartCar_no,String EndCar_no,String date,String date2, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
if (string.IsNullOrEmpty(custPdlineName))
{
result.Add("message", "请选择客户产线! ");
}
else if (string.IsNullOrEmpty(comtype_name))
{
result.Add("message", " 请选择客户产线!");
}
Hashtable dataHt = this.service.getTruckOrderPrintListByPage(custPdlineName, comtype_name, StartCar_no, EndCar_no, date, date2, pager, direction, sort);
return Json(result);
}
/// <summary>
/// 获取下拉列表数据
/// </summary>
/// <rehuoturns></returns>
public ActionResult getSelectTruckOrderPrint()
{
Hashtable result = new Hashtable();
List<KeyValueResult> TruckOrderPrintList = this.service.getSelectTruckOrderPrint();
result.Add("list", TruckOrderPrintList);
return Json(result);
}
/// <summary>
/// 保存数据
/// </summary>
/// <returns></returns>
public ActionResult saveTruckOrderPrint()
{
String editType = Request.Form["editType"].ToString();
String partId = Request.Form["partId"].ToString();
String custOrder = Request.Form["custOrder"].ToString();
String shipUnit = Request.Form["shipUnit"].ToString();
SysPartCustOrder sysPartCustOrder = new SysPartCustOrder();
sysPartCustOrder.PartId = Convert.ToInt32(partId);
sysPartCustOrder.CustOrder = custOrder;
sysPartCustOrder.ShipUnit = shipUnit;
String message = "";
if (editType != null && editType.Trim().Equals("edit"))
{
try
{
sysPartCustOrder.UpdateUserId = CurrentEmp.EmpId;
this.service.updateTruckOrderPrint(sysPartCustOrder);
message = "修改成功";
}
catch (Exception e)
{
message = "修改失败!";
}
}
else
{
try
{
sysPartCustOrder.CreateUserId = CurrentEmp.EmpId;
this.service.saveTruckOrderPrint(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 getTruckOrderPrint(String TruckOrderPrint_id)
{
List<SysPartCustOrder> TruckOrderPrintInfo = this.service.getTruckOrderPrint(TruckOrderPrint_id);
ViewData.Add("partId", TruckOrderPrintInfo[0].PartId);
ViewData.Add("custOrder", TruckOrderPrintInfo[0].CustOrder);
ViewData.Add("shipUnit", TruckOrderPrintInfo[0].ShipUnit);
return View("viewTruckOrderPrint");
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="ruid"></param>
/// <returns></returns>
public ActionResult editTruckOrderPrint(String partId)
{
if (!string.IsNullOrEmpty(partId))
{
List<SysPartCustOrder> TruckOrderPrintInfo = this.service.getTruckOrderPrint(partId);
ViewData.Add("editType", "edit");
ViewData.Add("partId", partId);
ViewData.Add("custOrder", TruckOrderPrintInfo[0].CustOrder);
ViewData.Add("shipUnit", TruckOrderPrintInfo[0].ShipUnit);
}
else
{
ViewData.Add("editType", "new");
}
return View("EditTruckOrderPrint");
}
/// <summary>
/// 删除
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public ActionResult deleteTruckOrderPrint(String ids)
{
int delCount = 0;
try
{
delCount = this.service.deleteTruckOrderPrint(ids);
}
catch (Exception e)
{
delCount = -1;
}
Hashtable result = new Hashtable();
result.Add("status", delCount);
return Json(result);
}
/// <summary>
/// 获取下拉列表数据
/// </summary>
/// <rehuoturns></returns>
public ActionResult getCust_pdline_nameListData()
{
string a = "";
Hashtable result = new Hashtable();
List<KeyValueResult> ProduceSerchList = this.service.getCust_pdline_nameListData();
result.Add("list", ProduceSerchList);
return Json(result);
}
/// <summary>
/// 获取下拉列表数据
/// </summary>
/// <rehuoturns></returns>
public ActionResult getType_nameListData(String custPdlineId)
{
string a = "";
Hashtable result = new Hashtable();
List<KeyValueResult> ProduceSerchList = this.service.getType_nameListData(custPdlineId);
result.Add("list", ProduceSerchList);
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 ExportTruckOrderPrint(String partNo, String custOrder, Pager pager, String sort, String direction, String isPage)
{
Boolean paging = false;
if (isPage == null || "".Equals(isPage))
{
paging = false;
}
else
{
if ("1".Equals(isPage))
{
paging = true;
}
else
{
paging = false;
}
}
List<TruckOrderPrint> dataHt = this.service.getTableListByPage(partNo, custOrder, pager, direction, sort, paging);
var memoryStream = ExcelHelper.ToExcel(dataHt);
return File(memoryStream.ToArray(), "application/ms-excel", "随车单打印.xls");
}
}
}