|
|
using Estsh.Core.Controllers;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Util;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:发运通道维护
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
|
{
|
|
|
public class RollDefineController : BaseController
|
|
|
{
|
|
|
private IRollDefineService service;
|
|
|
public RollDefineController(IRollDefineService _service)
|
|
|
{
|
|
|
service = _service;
|
|
|
}
|
|
|
//
|
|
|
// GET: /Roll/
|
|
|
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 保存数据
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult saveRoll()
|
|
|
{
|
|
|
String editType = Request.Form["editType"].ToString();
|
|
|
|
|
|
String rollNo = Request.Form["rollNo"].ToString();
|
|
|
String ruid = Request.Form["ruid"].ToString();
|
|
|
|
|
|
//bool pdroll= this.service.pdrollNo(rollNo);
|
|
|
//String rollName = Request.Form["rollName"].ToString();
|
|
|
//String rollType = Request.Form["rollType"].ToString();
|
|
|
|
|
|
String maxQty = Request.Form["maxQty"].ToString();
|
|
|
String minQty = Request.Form["minQty"].ToString();
|
|
|
String qty = Request.Form["qty"].ToString();
|
|
|
String custPdlineId = Request.Form["cbCustPDLine"].ToString();
|
|
|
String modelId = "";
|
|
|
try
|
|
|
{
|
|
|
modelId = Request.Form["cbModel"].ToString();
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
modelId = "0";
|
|
|
}
|
|
|
|
|
|
|
|
|
GRoll gRoll = new GRoll();
|
|
|
gRoll.RollName = "";
|
|
|
gRoll.RollType = 0;
|
|
|
gRoll.MaxQty = Convert.ToInt32(maxQty);
|
|
|
gRoll.MinQty = Convert.ToInt32(minQty);
|
|
|
gRoll.Qty = Convert.ToInt32(qty);
|
|
|
gRoll.ModelId = Convert.ToInt32(modelId);
|
|
|
gRoll.CustPdlineId = Convert.ToInt32(custPdlineId);
|
|
|
gRoll.ModelId = Convert.ToInt32(modelId);
|
|
|
|
|
|
String message = "";
|
|
|
String flag = "";
|
|
|
if (editType != null && editType.Trim().Equals("edit"))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
gRoll.UpdateUserId = CurrentEmp.EmpId;
|
|
|
gRoll.Ruid = Convert.ToInt32(ruid);
|
|
|
gRoll.RollNo = rollNo;
|
|
|
this.service.updateRoll(gRoll);
|
|
|
message = "修改成功";
|
|
|
flag = "OK";
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "修改失败!";
|
|
|
flag = "Fail";
|
|
|
throw;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
if (this.service.IsExistOrd(rollNo))
|
|
|
{
|
|
|
message = "" + rollNo + ":该编号已存在!";
|
|
|
flag = "Fail";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
gRoll.CreateUserId = CurrentEmp.EmpId;
|
|
|
gRoll.RollNo = rollNo;
|
|
|
this.service.insertRoll(gRoll);
|
|
|
message = "添加成功!";
|
|
|
flag = "OK";
|
|
|
}
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "添加失败!";
|
|
|
flag = "Fail";
|
|
|
}
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("message", message);
|
|
|
result.Add("flag", flag);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取列表数据
|
|
|
/// </summary>
|
|
|
/// <param name="VendorName">菜单名称</param>
|
|
|
/// <param name="pager">分页</param>
|
|
|
/// <param name="direction">排序方式</param>
|
|
|
/// <param name="sort">排序列</param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getRollListByPage(String cbPDLineID, String rollNo, String rollName, String rollType, Pager pager, String direction, String sort, String enabled = "Y")
|
|
|
{
|
|
|
if ((string.IsNullOrEmpty(cbPDLineID)) || cbPDLineID == "null")
|
|
|
{
|
|
|
cbPDLineID = "0";
|
|
|
}
|
|
|
String factoryId = CurrentEmp.FactoryId.ToString();
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
|
Hashtable dataHt = this.service.getRollListByPage(cbPDLineID, rollNo, rollName, rollType, pager, direction, sort, factoryId, 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>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult GetQuery()
|
|
|
{
|
|
|
string awhere = string.Empty;
|
|
|
awhere = " ";
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Request.Form["rollNo"]))
|
|
|
{
|
|
|
awhere += " where a.rollNo like '%" + Request.Form["rollNo"].ToString() + "%' ";
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Request.Form["rollName"]))
|
|
|
{
|
|
|
awhere += " a.rollName like '%" + Request.Form["rollName"].ToString() + "%' ";
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Request.Form["rollType"]))
|
|
|
{
|
|
|
awhere += " a.rollType like '%" + Request.Form["rollType"].ToString() + "%' ";
|
|
|
}
|
|
|
|
|
|
if (awhere.Contains(" and "))
|
|
|
{
|
|
|
awhere = awhere.Remove(awhere.LastIndexOf(" and "));
|
|
|
}
|
|
|
|
|
|
Hashtable reault = new Hashtable();
|
|
|
List<GRoll> list = service.GetQuery(awhere);
|
|
|
reault.Add("rows", list);
|
|
|
return Json(reault);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取辊道编号
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult GetRollNO()
|
|
|
{
|
|
|
Hashtable reault = new Hashtable();
|
|
|
List<KeyValueResult> list = service.GetRollNO();
|
|
|
reault.Add("list", list);
|
|
|
return Json(reault);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取辊道名称
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult GetRollName()
|
|
|
{
|
|
|
Hashtable reault = new Hashtable();
|
|
|
List<KeyValueResult> list = service.GetRollName();
|
|
|
reault.Add("list", list);
|
|
|
return Json(reault);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查看菜单详情
|
|
|
/// </summary>
|
|
|
/// <param name="typeId"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getRollDetail(String rollNo)
|
|
|
{
|
|
|
Hashtable ht = this.service.getRollDetail(rollNo);
|
|
|
ViewData.Add("rollNo", ht["rollNo"]);
|
|
|
ViewData.Add("rollName", ht["rollName"]);
|
|
|
ViewData.Add("rollType", ht["rollType"]);
|
|
|
ViewData.Add("maxQty", ht["maxQty"]);
|
|
|
ViewData.Add("minQty", ht["minQty"]);
|
|
|
ViewData.Add("qty", ht["qty"]);
|
|
|
ViewData.Add("modelId", ht["modelId"]);
|
|
|
return View("ViewRoll");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 编辑
|
|
|
/// </summary>
|
|
|
/// <param name="rollNo"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult editRoll(String ruid)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(ruid))
|
|
|
{
|
|
|
Hashtable ht = this.service.getRollDetail(ruid);
|
|
|
ViewData.Add("editType", "edit");
|
|
|
|
|
|
ViewData.Add("rollNo", ht["rollNo"]);
|
|
|
//ViewData.Add("rollName", ht["rollName"]);
|
|
|
//ViewData.Add("rollType", ht["rollType"]);
|
|
|
ViewData.Add("maxQty", ht["maxQty"]);
|
|
|
ViewData.Add("minQty", ht["minQty"]);
|
|
|
ViewData.Add("qty", ht["qty"]);
|
|
|
ViewData.Add("cbCustPDLine", ht["cbCustPDLine"]);
|
|
|
ViewData.Add("cbModel", ht["modelId"]);
|
|
|
ViewData.Add("ruid", ht["ruid"]);
|
|
|
ViewData.Add("cbModelType", ht["cbModelType"]);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ViewData.Add("editType", "new");
|
|
|
}
|
|
|
|
|
|
return View("EditRollDefine");
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除数据
|
|
|
/// </summary>
|
|
|
/// <param name="id"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult deleteRoll(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.deleteRoll(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 启用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onEnable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.EnableData(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 禁用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onDisable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.DisableData(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取客户产线列表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult GetCustPDLine()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> list = this.service.GetCustPDLine();
|
|
|
result.Add("list", list);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据客户产线查询车型
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult GetMode_type(string CustPDLine)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> list = this.service.GetMode_type(CustPDLine);
|
|
|
result.Add("list", list);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据车型编号查询座椅配置
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult GetModelList(int ModelType)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> list = this.service.GetModelList(ModelType);
|
|
|
result.Add("list", list);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取客户产线编号
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult GetCustID()
|
|
|
{
|
|
|
Hashtable reault = new Hashtable();
|
|
|
List<KeyValueResult> list = this.service.GetCustID();
|
|
|
reault.Add("list", list);
|
|
|
return Json(reault);
|
|
|
}
|
|
|
}
|
|
|
} |