|
|
using Dapper;
|
|
|
using Estsh.Core.Controllers;
|
|
|
using Estsh.Core.Model.ExcelModel;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Util;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using NPOI.HSSF.UserModel;
|
|
|
using System.Collections;
|
|
|
using System.Text.Json;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:总成/原材料零件号管理
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
|
{
|
|
|
|
|
|
public class PartMasterController : BaseController
|
|
|
{
|
|
|
private IPartMasterService service;
|
|
|
public PartMasterController(IPartMasterService _service)
|
|
|
{
|
|
|
service = _service;
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET: /PartMaster/
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
//ViewData.Add("partType", partType);
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取总成/原材料零件号管理列表数据
|
|
|
/// </summary>
|
|
|
/// <param name="PartMasterName">菜单名称</param>
|
|
|
/// <param name="pager">分页</param>
|
|
|
/// <param name="direction">排序方式</param>
|
|
|
/// <param name="sort">排序列</param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getPartMasterListByPage(String partType, String partNo, String partSpec, Pager pager, String direction, String sort, string enabled = "Y")
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.page_no", pager.pageNo);
|
|
|
Hashtable dataHt = this.service.getPartMasterListByPage(partType, partNo, partSpec, enabled, factoryId, pager, direction, sort);
|
|
|
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 getSelectPartMaster()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> PartMasterList = this.service.getSelectPartMaster();
|
|
|
result.Add("list", PartMasterList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
#region 编辑数据,已注释
|
|
|
/// <summary>
|
|
|
/// 保存数据
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
//public ActionResult savePartMaster(string partType)
|
|
|
//{
|
|
|
// Hashtable result = new Hashtable();
|
|
|
|
|
|
// if (string.IsNullOrEmpty(partType) || partType == "null")
|
|
|
// {
|
|
|
// partType = "0";
|
|
|
// }
|
|
|
|
|
|
// String editType = Request.Form["editType"].ToString();
|
|
|
// String partId = Request.Form["partId"].ToString();
|
|
|
// //标签一
|
|
|
// String partSpec = Request.Form["partSpec"].ToString();
|
|
|
// String partNo = Request.Form["partNo"].ToString();
|
|
|
// // String partType = partType;
|
|
|
|
|
|
// String isExemption= Request.Form["isExemption"].ToString();
|
|
|
// String partLocation = Request.Form["enumValue"].ToString();
|
|
|
// String modelId = Request.Form["modelId"].ToString();
|
|
|
// String version = Request.Form["version"].ToString();
|
|
|
// String custPartNo = Request.Form["custPartNo"].ToString();
|
|
|
// String mfgerPartNo = Request.Form["mfgerPartNo"].ToString();
|
|
|
// String vendorPartNo = Request.Form["vendorPartNo"].ToString();
|
|
|
// String erpPartNo = Request.Form["erpPartNo"].ToString();
|
|
|
// String unit = Request.Form["unit"].ToString();
|
|
|
// String partClass = Request.Form["partClass"].ToString();
|
|
|
// String partNo3c = Request.Form["partNo3c"].ToString();
|
|
|
// String enabled = Request.Form["enabled"].ToString();
|
|
|
|
|
|
// //标签二
|
|
|
// String labelFile = Request.Form["labelFile"].ToString();
|
|
|
// String labelType = Request.Form["labelType"].ToString();
|
|
|
// String locateId = Request.Form["locateId"].ToString();
|
|
|
// String defaultBoxQty = "0";
|
|
|
// if (string.IsNullOrEmpty(Request.Form["defaultBoxQty"].ToString()))
|
|
|
// {
|
|
|
// defaultBoxQty = "0";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// defaultBoxQty = Request.Form["defaultBoxQty"].ToString();
|
|
|
// }
|
|
|
// String defaultReelQty = "0";
|
|
|
// if (string.IsNullOrEmpty(Request.Form["defaultReelQty"].ToString()))
|
|
|
// {
|
|
|
// defaultReelQty = "0";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// defaultReelQty = Request.Form["defaultReelQty"].ToString();
|
|
|
// }
|
|
|
// String defaultSetQty = "0";
|
|
|
// if (string.IsNullOrEmpty(Request.Form["defaultSetQty"].ToString()))
|
|
|
// {
|
|
|
// defaultSetQty = "0";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// defaultSetQty = Request.Form["defaultSetQty"].ToString();
|
|
|
// }
|
|
|
// String minPackQty = "0";
|
|
|
// if (string.IsNullOrEmpty(Request.Form["minPackQty"].ToString()))
|
|
|
// {
|
|
|
// minPackQty = "0";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// minPackQty = Request.Form["minPackQty"].ToString();
|
|
|
// }
|
|
|
// String minStockQty = "0";
|
|
|
// if (string.IsNullOrEmpty(Request.Form["minStockQty"].ToString()))
|
|
|
// {
|
|
|
// minStockQty = "0";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// minStockQty = Request.Form["minStockQty"].ToString();
|
|
|
// }
|
|
|
// String maxStockQty = "0";
|
|
|
// if (string.IsNullOrEmpty(Request.Form["maxStockQty"].ToString()))
|
|
|
// {
|
|
|
// maxStockQty = "0";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// maxStockQty = Request.Form["maxStockQty"].ToString();
|
|
|
// }
|
|
|
// String indate = Request.Form["indate"].ToString();
|
|
|
|
|
|
// String sortSeq = "0";
|
|
|
// if (string.IsNullOrEmpty(Request.Form["sortSeq"].ToString()))
|
|
|
// {
|
|
|
// sortSeq = "0";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// sortSeq = Request.Form["sortSeq"].ToString();
|
|
|
// }
|
|
|
// String isSort = "0";
|
|
|
// if (string.IsNullOrEmpty(Request.Form["isSort"].ToString()))
|
|
|
// {
|
|
|
// isSort = "0";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// isSort = Request.Form["isSort"].ToString();
|
|
|
// }
|
|
|
// String sortQty = "0";
|
|
|
// if (string.IsNullOrEmpty(Request.Form["sortQty"].ToString()))
|
|
|
// {
|
|
|
// sortQty = "0";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// sortQty = Request.Form["sortQty"].ToString();
|
|
|
// }
|
|
|
// String sortType = Request.Form["sortType"].ToString();
|
|
|
// String batchControl = Request.Form["batchControl"].ToString();
|
|
|
// String splitFlag = Request.Form["splitFlag"].ToString();
|
|
|
// String overRequest = Request.Form["overRequest"].ToString();
|
|
|
// String indateFlag = Request.Form["indateFlag"].ToString();
|
|
|
|
|
|
|
|
|
// //标签三
|
|
|
// String burninTime = Request.Form["burninTime"].ToString();
|
|
|
// String subboardQty = "0";
|
|
|
// if (string.IsNullOrEmpty(Request.Form["subboardQty"].ToString()))
|
|
|
// {
|
|
|
// subboardQty = "0";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// subboardQty = Request.Form["subboardQty"].ToString();
|
|
|
// }
|
|
|
// String UPCCode = Request.Form["UPCCode"].ToString();
|
|
|
// String UCCCode = Request.Form["UCCCode"].ToString();
|
|
|
// String EANCode = Request.Form["EANCode"].ToString();
|
|
|
|
|
|
// SysPart model = new SysPart();
|
|
|
// //标签一
|
|
|
// model.PartSpec = partSpec;
|
|
|
// model.PartNo = partNo;
|
|
|
// model.PartType = partType;
|
|
|
// model.PartLocation = partLocation;
|
|
|
// model.IsExemption = isExemption;
|
|
|
// model.ModelId = modelId == "" ? null : Convert.ToInt32( modelId);
|
|
|
// model.Version = version;
|
|
|
// model.Unit= unit == "" ? "EA" : unit;
|
|
|
// model.PartClass = partClass;
|
|
|
// model.Enabled = enabled;
|
|
|
// //标签二
|
|
|
// model.LabelFile = labelFile;
|
|
|
// model.LabelType = labelType;
|
|
|
// model.LocateId = locateId==""?null: Convert.ToInt32(locateId);
|
|
|
// model.DefaultBoxQty = defaultBoxQty == "" ? null : Convert.ToDecimal(defaultBoxQty);
|
|
|
// model.DefaultReelQty = defaultReelQty == "" ? null : Convert.ToDecimal(defaultReelQty);
|
|
|
// model.DefaultSetQty = defaultSetQty == "" ? null : Convert.ToDecimal(defaultSetQty);
|
|
|
// model.MinPackQty = minPackQty == "" ? null : Convert.ToDecimal(minPackQty);
|
|
|
// model.MinStockQty = minStockQty == "" ? null : Convert.ToDecimal(minStockQty);
|
|
|
// model.MaxStockQty = maxStockQty == "" ? null : Convert.ToDecimal(maxStockQty);
|
|
|
// model.Indate = indate == "" ? null : Convert.ToInt32(indate);
|
|
|
// model.SortSeq = sortSeq == "" ? null : Convert.ToInt32( sortSeq);
|
|
|
// model.IsSort = isSort == "" ? null : Convert.ToInt32(isSort);
|
|
|
// model.SortQty = sortQty == "" ? null : Convert.ToInt32(sortQty);
|
|
|
// model.SortType = sortType;
|
|
|
// model.BatchControl = batchControl;
|
|
|
// model.SplitFlag = splitFlag;
|
|
|
// model.OverRequest = overRequest;
|
|
|
// model.IndateFlag = indateFlag;
|
|
|
|
|
|
// //标签三
|
|
|
// model.BurninTime = burninTime == "" ? null : Convert.ToInt32(burninTime);
|
|
|
// model.SubboardQty = subboardQty == "" ? null : Convert.ToInt32(subboardQty);
|
|
|
// model.UpcCode = UPCCode;
|
|
|
// model.UccCode = UCCCode;
|
|
|
// model.EanCode = EANCode;
|
|
|
|
|
|
// model.FactoryId = CurrentEmp.FactoryId;
|
|
|
// model.FactoryCode = CurrentEmp.FactoryCode;
|
|
|
|
|
|
// String message = "";
|
|
|
// if (labelType.Equals("1"))
|
|
|
// {
|
|
|
// if (!vendorPartNo.Trim().Equals("") && vendorPartNo != null && !mfgerPartNo.Trim().Equals("") && mfgerPartNo!=null)
|
|
|
// {
|
|
|
// if (editType != null && editType.Trim().Equals("edit"))
|
|
|
// {
|
|
|
// try
|
|
|
// {
|
|
|
|
|
|
// model.UpdateUserId = CurrentEmp.EmpId;
|
|
|
|
|
|
// model.PartId = Convert.ToInt32(partId);
|
|
|
|
|
|
// this.service.updatePartMaster(model);
|
|
|
// message = "修改成功";
|
|
|
// }
|
|
|
// catch (Exception e)
|
|
|
// {
|
|
|
// message = "修改失败!";
|
|
|
// }
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// try
|
|
|
// {
|
|
|
// model.CreateUserId = CurrentEmp.EmpId;
|
|
|
|
|
|
// this.service.savePartMaster(model);
|
|
|
// message = "添加成功";
|
|
|
// }
|
|
|
// catch (Exception e)
|
|
|
// {
|
|
|
// message = "添加失败!";
|
|
|
// }
|
|
|
// }
|
|
|
// }else{
|
|
|
// message = "操作失败,对焊接总成进行操作需要填写供应商零件号和制造商零件号";
|
|
|
// }
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// if (editType != null && editType.Trim().Equals("edit"))
|
|
|
// {
|
|
|
// try
|
|
|
// {
|
|
|
|
|
|
// model.UpdateUserId = CurrentEmp.EmpId;
|
|
|
// model.PartId = Convert.ToInt32(partId);
|
|
|
|
|
|
// this.service.updatePartMaster(model);
|
|
|
// message = "修改成功";
|
|
|
// }
|
|
|
// catch (Exception e)
|
|
|
// {
|
|
|
// message = "修改失败!";
|
|
|
// }
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// try
|
|
|
// {
|
|
|
|
|
|
// model.CreateUserId = CurrentEmp.EmpId;
|
|
|
// this.service.savePartMaster(model);
|
|
|
// message = "添加成功";
|
|
|
// }
|
|
|
// catch (Exception e)
|
|
|
// {
|
|
|
// message = "添加失败!";
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// result.Add("message", message);
|
|
|
// return Json(result);
|
|
|
//}
|
|
|
|
|
|
///// <summary>
|
|
|
///// 编辑
|
|
|
///// </summary>
|
|
|
///// <param name="ruid"></param>
|
|
|
///// <returns></returns>
|
|
|
//public ActionResult editPartMaster(String partId)
|
|
|
//{
|
|
|
// List<SysPart> PartMasterInfo = this.service.getPartMaster(partId);
|
|
|
// //Hashtable PartMasterInfo[0] = (Hashtable)PartMasterInfo[0];
|
|
|
// ViewData.Add("editType", "edit");
|
|
|
// ViewData.Add("partId", partId);
|
|
|
// ViewData.Add("partSpec", PartMasterInfo[0].PartSpec);
|
|
|
// ViewData.Add("partNo", PartMasterInfo[0].PartNo);
|
|
|
// ViewData.Add("partType", PartMasterInfo[0].PartType);
|
|
|
// ViewData.Add("isExemption", PartMasterInfo[0].IsExemption);
|
|
|
// ViewData.Add("enumValue", PartMasterInfo[0].PartLocation);
|
|
|
// ViewData.Add("modelId", PartMasterInfo[0].ModelId);
|
|
|
// ViewData.Add("version", PartMasterInfo[0].Version);
|
|
|
// ViewData.Add("unit", PartMasterInfo[0].Unit);
|
|
|
// ViewData.Add("labelFile", PartMasterInfo[0].LabelFile);
|
|
|
// ViewData.Add("labelType", PartMasterInfo[0].LabelType);
|
|
|
// ViewData.Add("locateId", PartMasterInfo[0].LocateId);
|
|
|
// ViewData.Add("defaultBoxQty", PartMasterInfo[0].DefaultBoxQty);
|
|
|
// ViewData.Add("defaultReelQty", PartMasterInfo[0].DefaultReelQty);
|
|
|
// ViewData.Add("defaultSetQty", PartMasterInfo[0].DefaultSetQty);
|
|
|
// ViewData.Add("minPackQty", PartMasterInfo[0].MinPackQty);
|
|
|
// ViewData.Add("minStockQty", PartMasterInfo[0].MinStockQty);
|
|
|
// ViewData.Add("maxStockQty", PartMasterInfo[0].MaxStockQty);
|
|
|
// ViewData.Add("indate", PartMasterInfo[0].Indate);
|
|
|
// ViewData.Add("sortSeq", PartMasterInfo[0].SortSeq);
|
|
|
// ViewData.Add("isSort", PartMasterInfo[0].IsSort);
|
|
|
// ViewData.Add("sortQty", PartMasterInfo[0].SortQty);
|
|
|
// ViewData.Add("sortType", PartMasterInfo[0].SortType);
|
|
|
// ViewData.Add("batchControl", PartMasterInfo[0].BatchControl);
|
|
|
// ViewData.Add("splitFlag", PartMasterInfo[0].SplitFlag);
|
|
|
// ViewData.Add("overRequest", PartMasterInfo[0].OverRequest);
|
|
|
// ViewData.Add("indateFlag", PartMasterInfo[0].IndateFlag);
|
|
|
// ViewData.Add("rule_set", PartMasterInfo[0].RuleSet);
|
|
|
// ViewData.Add("route_id", PartMasterInfo[0].RouteId);
|
|
|
// ViewData.Add("burninTime", PartMasterInfo[0].BurninTime);
|
|
|
// ViewData.Add("subboardQty", PartMasterInfo[0].SubboardQty);
|
|
|
// ViewData.Add("UPCCode", PartMasterInfo[0].UpcCode);
|
|
|
// ViewData.Add("UCCCode", PartMasterInfo[0].UccCode);
|
|
|
// ViewData.Add("EANCode", PartMasterInfo[0].EanCode);
|
|
|
// ViewData.Add("partClass", PartMasterInfo[0].PartClass);
|
|
|
// //ViewData.Add("partNo3c", PartMasterInfo[0].PartNo3c);
|
|
|
// ViewData.Add("enabled", PartMasterInfo[0].Enabled);
|
|
|
|
|
|
// return View("EditPartMaster");
|
|
|
//}
|
|
|
#endregion
|
|
|
|
|
|
public ActionResult savePartMaster(string partType)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
|
|
|
if (string.IsNullOrEmpty(partType) || partType == "null")
|
|
|
{
|
|
|
partType = "0";
|
|
|
}
|
|
|
|
|
|
String editType = Request.Form["editType"].ToString();
|
|
|
String partId = Request.Form["partId"].ToString();
|
|
|
String partNo = Request.Form["partNo"].ToString();
|
|
|
String partSpec = Request.Form["partSpec"].ToString();
|
|
|
String partSpec2 = Request.Form["partSpec2"].ToString();
|
|
|
String unit = Request.Form["unit"].ToString();
|
|
|
String defaultBoxQty = "0";
|
|
|
if (string.IsNullOrEmpty(Request.Form["defaultBoxQty"].ToString()))
|
|
|
{
|
|
|
defaultBoxQty = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
defaultBoxQty = Request.Form["defaultBoxQty"].ToString();
|
|
|
}
|
|
|
String partGroup = Request.Form["partGroup"].ToString();
|
|
|
String partAbc = Request.Form["partAbc"].ToString();
|
|
|
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
String factoryCode = CurrentEmp.FactoryCode;
|
|
|
String enabled = Request.Form["enabled"].ToString();
|
|
|
|
|
|
SysPart model = new SysPart();
|
|
|
model.PartNo = partNo;
|
|
|
model.PartSpec = partSpec;
|
|
|
model.PartSpec2 = partSpec2;
|
|
|
model.PartType = partType;
|
|
|
model.Unit = unit == "" ? "件" : unit;
|
|
|
model.DefaultBoxQty = Convert.ToDecimal(defaultBoxQty);
|
|
|
model.PartGroup = partGroup;
|
|
|
model.PartAbc = partAbc;
|
|
|
|
|
|
model.FactoryId = factoryId;
|
|
|
model.FactoryCode = factoryCode;
|
|
|
model.Enabled = enabled;
|
|
|
|
|
|
String message = "";
|
|
|
|
|
|
if (editType != null && editType.Trim().Equals("edit"))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
model.UpdateUserId = CurrentEmp.EmpId;
|
|
|
model.PartId = Convert.ToInt32(partId);
|
|
|
this.service.updatePartMaster(model);
|
|
|
message = "修改成功";
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "修改失败!";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
if (this.service.getPartByExistName(partNo) != null)
|
|
|
{
|
|
|
message = "零件号已存在,请检查!";
|
|
|
}
|
|
|
else if (this.service.getPartByExistSpec(partSpec) != null)
|
|
|
{
|
|
|
message = "零件简码已存在,请检查!";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
model.CreateUserId = CurrentEmp.EmpId;
|
|
|
if (this.service.savePartMaster(model) > 0)
|
|
|
{
|
|
|
message = "添加成功";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
message = "添加失败";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "添加失败!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result.Add("message", message);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 编辑
|
|
|
/// </summary>
|
|
|
/// <param name="ruid"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult editPartMaster(String partId, String partType)
|
|
|
{
|
|
|
|
|
|
if (!string.IsNullOrEmpty(partId))
|
|
|
{
|
|
|
List<SysPart> PartMasterInfo = this.service.getPartMaster(partId);
|
|
|
ViewData.Add("editType", "edit");
|
|
|
ViewData.Add("partId", partId);
|
|
|
ViewData.Add("partNo", PartMasterInfo[0].PartNo);
|
|
|
ViewData.Add("partSpec", PartMasterInfo[0].PartSpec);
|
|
|
ViewData.Add("partSpec2", PartMasterInfo[0].PartSpec2);
|
|
|
ViewData.Add("partType", PartMasterInfo[0].PartType);
|
|
|
ViewData.Add("unit", PartMasterInfo[0].Unit);
|
|
|
ViewData.Add("defaultBoxQty", PartMasterInfo[0].DefaultBoxQty);
|
|
|
ViewData.Add("partGroup", PartMasterInfo[0].PartGroup);
|
|
|
ViewData.Add("partAbc", PartMasterInfo[0].PartAbc);
|
|
|
ViewData.Add("enabled", PartMasterInfo[0].Enabled);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ViewData.Add("partType", partType);
|
|
|
}
|
|
|
|
|
|
return View("EditPartMaster");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult deletePartMaster(String ids)
|
|
|
{
|
|
|
string partId = ids.Substring(0, ids.Length - 1);
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.deletePartMaster(partId);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取车型数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getSelectPartMaster_Model_name()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> PartMasterList = this.service.getSelectPartMaster_Model_name();
|
|
|
result.Add("list", PartMasterList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 座椅位置
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getSelectPartLocation()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> PartLocation = this.service.getSelectPartLocation();
|
|
|
result.Add("list", PartLocation);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取单位数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getSelectPartMaster_Enum()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> PartMasterList = this.service.getSelectPartMaster_Enum();
|
|
|
result.Add("list", PartMasterList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取默认库位数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getSelectPartMaster_Locate()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> PartMasterList = this.service.getSelectPartMaster_Locate();
|
|
|
result.Add("list", PartMasterList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取条码规则数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getSelectPartMaster_TMGZ()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> PartMasterList = this.service.getSelectPartMaster_TMGZ();
|
|
|
result.Add("list", PartMasterList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取工艺流程数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getSelectPartMaster_Route()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> PartMasterList = this.service.getSelectPartMaster_Route();
|
|
|
result.Add("list", PartMasterList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 启用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onEnable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.EnablePartMaster(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.DisablePartMaster(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 导出数据到Excel
|
|
|
/// BY NOAH
|
|
|
/// <returns></returns>
|
|
|
public ActionResult exportData(String partType, String partNo, String partSpec, string enabled = "Y")
|
|
|
{
|
|
|
string excelName = "";
|
|
|
string dateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
|
if (partType == "1")
|
|
|
{
|
|
|
excelName = "总成零件号数据" + dateTime;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
excelName = "原材料零件数据" + dateTime;
|
|
|
}
|
|
|
List<PartMaster> listHt = this.service.getExportList(partType, partNo, partSpec, enabled, CurrentEmp.FactoryId);
|
|
|
var memoryStream = ExcelHelper.ToExcel(listHt);
|
|
|
return File(memoryStream.ToArray(), "application/ms-excel", excelName + ".xls");
|
|
|
}
|
|
|
}
|
|
|
}
|