天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1442 lines
55 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QMFrameWork.WebUI.Attribute;
using QMFrameWork.WebUI.DataSource;
using QMAPP.ServicesAgent;
using QMAPP.FJC.Web.Models.FeedInManage;
using QMAPP.Common.Web.Controllers;
using QMAPP.FJC.Entity.Injection;
using QMAPP.Entity;
using System.Data;
using QMAPP.FJC.Entity.ProduceManage;
using QMAPP.MD.Entity;
using Corp = QMAPP.FJC.Entity.Basic.Corp;
using ProcessRoute = QMAPP.FJC.Entity.Basic.ProcessRoute;
using WorkCell = QMAPP.MD.Entity.WorkCell;
using WorkLoc = QMAPP.MD.Entity.WorkLoc;
using QMAPP.FJC.Entity.FIS;
using QMAPP.FJC.Entity.FileCopy.FIS;
using QMAPP.MD.BLL.Dict;
using QMAPP.FJC.Entity.Basic;
3 years ago
using QMAPP.MD.Entity.Bucket;
namespace QMAPP.FJC.Web.Controllers
{
public class DictController : QController
{
public string EmptyItemTitle = " ";
6 months ago
#region 投入产出点检项--类型
/// <summary>
/// 获取公司下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetTypeComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
model.Add(new ComboboxItem { ID = "1", Text = "单选" });
model.Add(new ComboboxItem { ID = "2", Text = "填写单边值" });
model.Add(new ComboboxItem { ID = "3", Text = "填写双边值" });
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
3 years ago
#region 注塑投料--物料绑定
6 months ago
3 years ago
public ActionResult GetMaterialTreeClass()
{
try
{
ServiceAgent wcfAgent = this.GetServiceAgent();
List<CombotreeItem> trees = new List<CombotreeItem>();
trees.Add(new CombotreeItem { id = "", text = this.EmptyItemTitle });
var materialResult = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", new Material());
MaterialClass materialclass = new MaterialClass();
materialclass.MaterialAttributes = "('1','')";
var classresult = wcfAgent.InvokeServiceFunction<DataResult<List<MaterialClass>>>
("MaterialBLL_GetMaterialClassList", materialclass).Result;
foreach (MaterialClass item in classresult.Where(p => string.IsNullOrWhiteSpace(p.UP_MATERIAL_TYPE_CODE)).OrderBy(p => p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = item.MATERIAL_TYPE_CODE, text = item.MATERIAL_TYPE_NAME, children = new List<CombotreeItem>() };
AppendTree(subnode, classresult, materialResult);
if (subnode.children.Count > 0)
{
trees.Add(subnode);
}
}
return Json(trees);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取料筒下拉列表
/// <summary>
/// 获取公司下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetBucketCodeComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<BucketInfo>>
("BucketInfoBLL_GetAllList");
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (BucketInfo item in dataResult)
{
model.Add(new ComboboxItem { ID = item.BucketCode, Text = item.BucketCode + "/" + item.BucketName });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取组织结构下拉列表数据源
/// <summary>
/// 获取组织结构下拉列表数据源
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetFixedComboxSource()
{
string kind = Request.Params["kind"];
//单雨春 是否带空项 2014年9月26日
bool isWithEmpty = string.IsNullOrEmpty(Request.Params["WithEmpty"]) ? true : false;
Dictionary<string, string> dicts = null;
try
{
ComboboxResult model = new ComboboxResult();
//单雨春 是否带空项 2014年9月26日
if (isWithEmpty)
{
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
}
QMFrameWork.Common.Util.ModelDictionaryHandler.TryGetModelDictionary(kind.ToString(), out dicts);
foreach (string key in dicts.Keys)
{
model.Add(new ComboboxItem { ID = key, Text = dicts[key] });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 表皮查询获得物料号下拉列表(张敬贺 2015.05.28)
/// <summary>
/// 获得所属仓库中存储区域对应的零件号下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterielDropDownList(string id)
{
List<EpidermisModel> list = new List<EpidermisModel>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(id) == false)
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<InjectionRecorder>>>(QMAPP.ServicesAgent.FeedInManage.EpidermisBLL_GetProductInfectionList.ToString(), id);
foreach (InjectionRecorder ps in dataResult.Result)
{
//将数据添加到model中
if (ps.PROCESSTYPE == ((int)QMAPP.FJC.Entity.EnumGeter.ProductType.biaopi).ToString())
{
ps.MATERIALCODE = ps.MATERIALCODE + "/" + ps.MATERIALTYPE + "/" + ps.INJECTIONTERMINAL;
}
else
{
ps.MATERIALCODE = ps.MATERIALCODE + "/" + ps.MATERIALTYPE;
}
list.Add(CopyToModel<EpidermisModel, InjectionRecorder>(ps));
}
list.Insert(0, new EpidermisModel { PID = "", MATERIALCODE = "" });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
else
{
return Content(AppResource.DeleteMessage);
}
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取缺陷类型
[HandleException]
public ActionResult GetDefectDropDownList()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataTable>("DefectTypeBLL_GetDefectType");
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
//闫永刚2018-8-8修改
foreach (DataRow dr in dataResult.Rows)
{
string keyvalue = dr["DEFECTKEY"].ToString();
//int keyvalue = Convert.ToInt32(dr["DEFECTKEY"]);
string defectValue = dr["DEFECTVALUE"].ToString();
defectValue = defectValue.Replace("\r", "");
defectValue = defectValue.Replace("\n", "");
model.Add(new ComboboxItem { ID = keyvalue.ToString(), Text = defectValue });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取公司下拉列表
/// <summary>
/// 获取公司下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetCorpComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<Corp>>>
("CorpBLL_GetCorpList", new Corp());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Corp item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.PID, Text = item.CORP_CODE + "/" + item.CORP_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工厂下拉列表
/// <summary>
/// 获取工厂下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetFactoryComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<Factory>>>
("FactoryBLL_GetFactoryList", new Factory());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Factory item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.FACTORY_CODE, Text = item.FACTORY_CODE + "/" + item.FACTORY_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 获取工厂下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetNewFactoryComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<Factory>>>
("FactoryBLL_GetFactoryList", new Factory());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Factory item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.FACTORY_CODE, Text = item.FACTORY_CODE + "/" + item.FACTORY_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取全部工序下拉列表
/// <summary>
/// 获取全部工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetALLWorkCellBasicComboxSource(string routecode)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<QMAPP.FJC.Entity.Basic.ProcessInfo>>>
("ProcessInfoBLL_GetProcessInfoBasicList", new QMAPP.FJC.Entity.Basic.ProcessInfo() { PROCESSTYPE = routecode });
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (QMAPP.FJC.Entity.Basic.ProcessInfo item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.PID, Text = item.PROCESSNAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取全部设备下拉列表
/// <summary>
/// 获取全部工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetALLEquipmentComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<QMAPP.MD.Entity.Equipment>>>
("EquipmentBLL_GetEquipmentList", new QMAPP.FJC.Entity.Basic.ProcessInfo());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (QMAPP.MD.Entity.Equipment item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.EQUIPMENT_CODE, Text = item.EQUIPMENT_CODE + "/" + item.EQUIPMENT_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取新物料信息下拉列表
/// <summary>
/// 获取物料信息下拉列表GetMaterialClassList
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetNewMaterialComboxSource(string materialtype)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var result = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", new Material() { MATERIAL_TYPE_CODE = materialtype });
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Material item in result)
{
model.Add(new ComboboxItem { ID = item.MATERIAL_CODE, Text = item.MATERIAL_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取物料信息下拉列表(联动)
/// <summary>
/// 获取物料信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterialWithTypeComboxSource(string materialtype)
{
List<Material> list = new List<Material>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(materialtype) == false)
{
var dataResult = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", new Material() { MATERIAL_TYPE_CODE = materialtype });
foreach (Material item in dataResult)
{
item.MATERIAL_NAME = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME;
list.Add(item);
}
}
//list.Insert(0, new Material() { MATERIAL_CODE = "", MATERIAL_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取物料信息下拉列表(FIS用)
/// <summary>
/// 获取物料信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetFisMaterialComboxSource()
{
WorkCell info = new WorkCell();
info.WORKCENTER_CODE = Request.Params["WORKCENTER_CODE"];
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var result = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetNewMaterialList", new Material(), info);
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Material item in result)
{
model.Add(new ComboboxItem { ID = item.MATERIAL_CODE, Text = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取物料信息下拉列表(订单)
/// <summary>
/// 获取物料信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterialSource(string ordertype)
{
//WorkCell info = new WorkCell();
//info.WORKCELL_CODE = ordertype;
List<Material> list = new List<Material>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialForInjectOrder", ordertype);
foreach (Material item in dataResult)
{
item.MATERIAL_NAME = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME;
list.Add(item);
}
list.Insert(0, new Material() { MATERIAL_CODE = "", MATERIAL_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取物料信息下拉列表(订单)
/// <summary>
/// 获取物料信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterialDoorPlan(string ordertype, string color, string hbtype, string mattypes)
{
Material info = new Material();
#region 前台传入后台文字乱码
//if (color !="undefined")
//{
// DictManageBLL dictCOLORBll = new DictManageBLL(DictKind.COLOR);
// //颜色
// color = dictCOLORBll.GetDictValue(color).GetHashCode().ToString();
// }
//if (hbtype != "undefined")
//{
// DictManageBLL dictHBtypeBll = new DictManageBLL(DictKind.HBTYPE);
// //高低配
// hbtype = dictHBtypeBll.GetDictValue(hbtype).GetHashCode().ToString();
//}
#endregion
info.ORDER_TYPE = ordertype;
info.COLOR = color;
info.HBTYPE = hbtype;
if (string.IsNullOrEmpty(mattypes) == false && mattypes != "undefined")
{
info.MaterialCodes = "('" + mattypes.Replace(";", "','") + "')";
}
List<Material> list = new List<Material>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialDoorPlan", info);
foreach (Material item in dataResult)
{
item.MATERIAL_NAME = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME;
list.Add(item);
}
list.Insert(0, new Material() { MATERIAL_CODE = "", MATERIAL_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 门板计划整车添加成都
/// <summary>
/// 获取物料信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetFisDoorPlanForCD()
{
FISAssembly info = new FISAssembly();
List<FISAssembly> list = new List<FISAssembly>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<FISAssembly>>("DoorPlankPlanBLL_GetMaterialDoorPlanForCD", info);
foreach (FISAssembly item in dataResult)
{
item.Name =item.Name;
list.Add(item);
}
list.Insert(0, new FISAssembly() { Id="",Name = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取物料信息下拉列表(所有)
/// <summary>
/// 获取物料信息下拉列表(所有)
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetALLMaterialComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var result = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", new Material());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Material item in result)
{
model.Add(new ComboboxItem { ID = item.MATERIAL_CODE, Text = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取物料类型下拉列表
/// <summary>
/// 获取物料类型下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterialClassComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<MaterialClass>>>
("MaterialBLL_GetMaterialClassList", new MaterialClass());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (MaterialClass item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.MATERIAL_TYPE_CODE, Text = item.MATERIAL_TYPE_NAME + "/" + item.MATERIAL_TYPE_CODE });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取物料类型(关联物料attribute)下拉列表
/// <summary>
/// 获取物料类型下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterialClassByAttributeComboxSource(string attribute)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
MaterialClass info = new MaterialClass();
info.MATERIAL_ATTRIBUTE = attribute;
List<MaterialClass> list = new List<MaterialClass>();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<MaterialClass>>
("MaterialBLL_GetAllMaterialClassList", info);
foreach (MaterialClass item in dataResult)
{
item.MATERIAL_TYPE_NAME = item.MATERIAL_TYPE_CODE + "/" + item.MATERIAL_TYPE_NAME;
list.Add(item);
}
list.Insert(0,new MaterialClass() { MATERIAL_TYPE_CODE = "", MATERIAL_TYPE_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取物料信息下拉列表--树
/// <summary>
/// 获取物料信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterialComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", new Material());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Material item in dataResult)
{
model.Add(new ComboboxItem { ID = item.MATERIAL_CODE, Text = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
public ActionResult GetFactoryMaterialComboxSource(string factoryCode)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var list = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", new Material{FACTORY_CODE = factoryCode});
//ComboboxResult model = new ComboboxResult();
//model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
//foreach (Material item in dataResult)
//{
// model.Add(new ComboboxItem { ID = item.MATERIAL_CODE, Text = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME });
//}
//return Content(model.ToString());
list.Insert(0, new Material() { MATERIAL_CODE = "", MATERIAL_NAME = " " });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// FIS
/// </summary>
/// <returns></returns>
[HandleException]
public ActionResult GetFisMaterialTree(string ordertype)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
Material material = new Material();
if (!string.IsNullOrEmpty(ordertype))
{
int i=0;
if (int.TryParse(ordertype, out i) == false)
{
material.ORDER_TYPE = ordertype;
}
else
{
material.MATERIAL_ATTRIBUTE = ordertype;
}
}
try
{
var materialResult = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", material);
var classresult = wcfAgent.InvokeServiceFunction<DataResult<List<MaterialClass>>>
("MaterialBLL_GetMaterialClassList", new MaterialClass()).Result;
List<CombotreeItem> trees = new List<CombotreeItem>();
trees.Add(new CombotreeItem { id = "", text = this.EmptyItemTitle });
foreach (MaterialClass item in classresult.Where(p => string.IsNullOrWhiteSpace(p.UP_MATERIAL_TYPE_CODE)).OrderBy(p => p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = item.MATERIAL_TYPE_CODE, text = item.MATERIAL_TYPE_NAME, children = new List<CombotreeItem>() };
AppendTree(subnode, classresult, materialResult);
if (subnode.children.Count > 0)
{
trees.Add(subnode);
}
}
return Json(trees);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 获取物料信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterialTree()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var materialResult = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", new Material());
var classresult = wcfAgent.InvokeServiceFunction<DataResult<List<MaterialClass>>>
("MaterialBLL_GetMaterialClassList", new MaterialClass()).Result;
List<CombotreeItem> trees = new List<CombotreeItem>();
trees.Add(new CombotreeItem { id = "", text = this.EmptyItemTitle });
foreach (MaterialClass item in classresult.Where(p => string.IsNullOrWhiteSpace(p.UP_MATERIAL_TYPE_CODE)).OrderBy(p => p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = item.MATERIAL_TYPE_CODE, text = item.MATERIAL_TYPE_NAME, children = new List<CombotreeItem>() };
AppendTree(subnode, classresult, materialResult);
if (subnode.children.Count > 0)
{
trees.Add(subnode);
}
}
return Json(trees);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 追加树节点
/// </summary>
/// <param name="node"></param>
/// <param name="mclasslist"></param>
/// <param name="materiallist"></param>
private void AppendTree(CombotreeItem node, List<MaterialClass> mclasslist, List<Material> materiallist)
{
foreach (var mclass in mclasslist.Where(p => string.Equals(node.id, p.UP_MATERIAL_TYPE_CODE)).OrderBy(p => p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = mclass.MATERIAL_TYPE_CODE, text = mclass.MATERIAL_TYPE_NAME, children = new List<CombotreeItem>() };
AppendTree(subnode, mclasslist, materiallist);
if (subnode.children.Count > 0)
{
node.children.Add(subnode);
}
}
foreach (var material in materiallist.Where(p => string.Equals(node.id, p.MATERIAL_TYPE_CODE)).OrderBy(p => p.MATERIAL_CODE))
{
var subnode = new CombotreeItem { id = material.MATERIAL_CODE, text = material.MATERIAL_CODE + "/" + material.MATERIAL_NAME };
node.children.Add(subnode);
}
}
#endregion
#region 获取全部工序下拉列表
/// <summary>
/// 获取全部工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetALLWorkCellComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<WorkCell>>
("WorkCellBLL_GetWorkCellList", new WorkCell());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (WorkCell item in dataResult)
{
model.Add(new ComboboxItem { ID = item.WORKCELL_CODE, Text = item.WORKCELL_CODE + "/" + item.WORKCELL_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
public ActionResult GetFactoryWorkCellComboxSource(string factoryCode, string workCenterCode)
{
string kind = Request.Params["kind"];
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var list = wcfAgent.InvokeServiceFunction<List<WorkCell>>
("WorkCellBLL_GetWorkCellList", new WorkCell { FACTORY_CODE = factoryCode, WORKCENTER_CODE = workCenterCode });
list.Insert(0, new WorkCell() { WORKCELL_CODE = "", WORKCELL_NAME = " " });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工序下拉列表
/// <summary>
/// 获取全部工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetWorkCellBasicComboxSource(string routecode)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<WorkCell>>>
("WorkCellBLL_GetWorkCellList", new WorkCell() ,routecode);
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (WorkCell item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.WORKCELL_CODE, Text = item.WORKCELL_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工序下拉列表(联动)
/// <summary>
/// 获取工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetWorkCellBasicWithTypeComboxSource(string routecode)
{
List<WorkCell> list = new List<WorkCell>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(routecode) == false)
{
var dataResult = wcfAgent.InvokeServiceFunction<List<WorkCell>>
("WorkCellBLL_GetNewWorkCellList", new WorkCell(), routecode);
foreach (WorkCell item in dataResult)
{
item.WORKCELL_NAME = item.WORKCELL_CODE + "/" + item.WORKCELL_NAME;
list.Add(item);
}
}
list.Insert(0, new WorkCell() { WORKCELL_CODE = "", WORKCELL_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工位下拉列表(联动)
/// <summary>
/// 获取工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetWorkLocFromWorkCellComboxSource(string workCellCode)
{
List<WorkLoc> list = new List<WorkLoc>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(workCellCode) == false)
{
var dataResult = wcfAgent.InvokeServiceFunction<List<WorkLoc>>
("WorkLocBLL_GetWorkLocFromWorkCellList", new WorkLoc(), workCellCode);
foreach (WorkLoc item in dataResult)
{
item.WORKLOC_NAME = item.WORKLOC_CODE + "/" + item.WORKLOC_NAME;
list.Add(item);
}
}
list.Insert(0, new WorkLoc() { WORKLOC_CODE = "", WORKLOC_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工位下拉列表(联动)
/// <summary>
/// 获取工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetWorkLocComboxSource(string workCenterCode)
{
List<WorkLoc> list = new List<WorkLoc>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(workCenterCode) == false)
{
list = wcfAgent.InvokeServiceFunction<List<WorkLoc>>
("WorkLocBLL_GetWorkLocFromWorkCenterCodeList", workCenterCode);
//foreach (WorkLoc item in dataResult)
//{
// item.WORKLOC_NAME = item.WORKLOC_NAME;
// list.Add(item);
//}
}
list.Insert(0, new WorkLoc() { WORKLOC_CODE = "", WORKLOC_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取班次下拉列表
/// <summary>
/// 获取班次下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetProduceShiftComboxSource(string workcentercode)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<ProduceShift>>
("ProduceShiftBLL_GetWorkcenterShifts", workcentercode);
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (ProduceShift item in dataResult)
{
model.Add(new ComboboxItem { ID = item.PRODUCESHIFTTCODE, Text = item.PRODUCESHIFTTCODE + "/" + item.PRODUCESHIFTNAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工艺路线下拉列表
/// <summary>
/// 获取工艺路线下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetProcessRouteComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<ProcessRoute>>>
("ProcessRouteBLL_GetProcessRouteList", new ProcessRoute());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (ProcessRoute item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.ROUTE_CODE, Text = item.ROUTE_CODE + "/" + item.ROUTE_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取全部工作中心下拉列表
/// <summary>
/// 获取工作中心下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetAllWorkCenterComboxSource()
{
string kind = Request.Params["kind"];
var workCenter = new WorkCenter();
if (!string.IsNullOrEmpty(kind))
{
workCenter.CENTER_TYPE = "0";
}
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<WorkCenter>>>
("WorkCenterBLL_GetWorkCenterList", workCenter);
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (WorkCenter item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.WORKCENTER_CODE, Text = item.WORKCENTER_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
public ActionResult GetFactoryWorkCenterComboxSource(string factoryCode)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<WorkCenter>>>
("WorkCenterBLL_GetWorkCenterList", new WorkCenter { FACTORY_CODE = factoryCode });
var list = dataResult.Result;
list.Insert(0, new WorkCenter() { WORKCENTER_CODE = "", WORKCENTER_NAME = " " });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取计划状态
/// <summary>
/// 获取计划状态
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetPlanStateComboxSource()
{
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
model.Add(new ComboboxItem { ID = "初始", Text = "初始" });
model.Add(new ComboboxItem { ID = "处理中", Text = "处理中" });
model.Add(new ComboboxItem { ID = "完成", Text = "完成" });
return Content(model.ToString());
}
#endregion
#region 获取PBOM头物料信息下拉列表
/// <summary>
/// 获取BOM头物料信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetPbomMaterialComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<Material>>>
("MaterialBLL_GetPbomMaterialList", new Material());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Material item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.MATERIAL_CODE, Text = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取设备(MACHINE)下拉列表
/// <summary>
/// 获取设备(MACHINE)下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMachineForOrder(string ordertype)
{
WorkCell info = new WorkCell();
info.WORKCELL_CODE = ordertype;
List<QMAPP.FJC.Entity.Basic.MachineInfo> list = new List<QMAPP.FJC.Entity.Basic.MachineInfo>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
//if (string.IsNullOrEmpty(ordertype) == false)
//{
var dataResult = wcfAgent.InvokeServiceFunction<List<QMAPP.FJC.Entity.Basic.MachineInfo>>
("MachineInfoBLL_GetMachineForOrderList", new QMAPP.FJC.Entity.Basic.MachineInfo(), info);
foreach (QMAPP.FJC.Entity.Basic.MachineInfo item in dataResult)
{
item.MACHINENAME = item.MACHINECODDE + "/" + item.MACHINENAME;
list.Add(item);
}
//}
list.Insert(0, new QMAPP.FJC.Entity.Basic.MachineInfo() { MACHINECODDE = "", MACHINENAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 获取设备(MACHINE)下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMachineList(string workcentercode)
{
QMAPP.FJC.Entity.Basic.MachineInfo info = new Entity.Basic.MachineInfo();
2 years ago
if (workcentercode == "VW371PA_FOAMAREA")
{
info.WORKCENTER_CODE = "VW371_FOAMAREA";
}
else
info.WORKCENTER_CODE = workcentercode;
List<QMAPP.FJC.Entity.Basic.MachineInfo> list = new List<QMAPP.FJC.Entity.Basic.MachineInfo>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
//if (string.IsNullOrEmpty(ordertype) == false)
//{
var dataResult = wcfAgent.InvokeServiceFunction<List<QMAPP.FJC.Entity.Basic.MachineInfo>>
("MachineInfoBLL_GetMachineInfoList", info);
foreach (QMAPP.FJC.Entity.Basic.MachineInfo item in dataResult)
{
2 years ago
if (workcentercode == "VW371PA_FOAMAREA")
2 years ago
{
if (item.MACHINECODDE.Contains("PA"))
{
item.MACHINENAME = item.MACHINECODDE + "/" + item.MACHINENAME;
list.Add(item);
}
}
2 years ago
else if (workcentercode == "VW371_FOAMAREA")
2 years ago
{
if (!item.MACHINECODDE.Contains("PA"))
{
item.MACHINENAME = item.MACHINECODDE + "/" + item.MACHINENAME;
list.Add(item);
}
}
2 years ago
else
{
item.MACHINENAME = item.MACHINECODDE + "/" + item.MACHINENAME;
list.Add(item);
}
}
//}
list.Insert(0, new QMAPP.FJC.Entity.Basic.MachineInfo() { MACHINECODDE = "", MACHINENAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 获取设备模架下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMouldList(string machinecode)
{
QMAPP.FJC.Entity.Basic.MachineInfoModels info = new Entity.Basic.MachineInfoModels();
info.MachineCode = machinecode;
List<QMAPP.FJC.Entity.Basic.MachineInfoModels> list = new List<QMAPP.FJC.Entity.Basic.MachineInfoModels>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (!string.IsNullOrEmpty(machinecode))
{
var machine = wcfAgent.InvokeServiceFunction<QMAPP.FJC.Entity.Basic.MachineInfo>
("MachineInfoBLL_GetMachineInfo", new QMAPP.FJC.Entity.Basic.MachineInfo { MACHINECODDE = machinecode });
if (machine != null)
{
info.MID = machine.PID;
}
}
var dataResult = wcfAgent.InvokeServiceFunction<List<QMAPP.FJC.Entity.Basic.MachineInfoModels>>
("MachineInfoModelBLL_GetAllList", info);
foreach (QMAPP.FJC.Entity.Basic.MachineInfoModels item in dataResult)
{
item.MODELNAME = item.MODELCODE + "/" + item.MODELNAME;
list.Add(item);
}
//}
list.Insert(0, new QMAPP.FJC.Entity.Basic.MachineInfoModels() { MODELCODE = "", MODELNAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取计划流水号
/// <summary>
/// 获取计划流水号
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetOrderPlanSeq(string datestr,string prefix)
{
FISPlan fisplan = new FISPlan();
fisplan.DATASTR = datestr;
fisplan.PREFIX = prefix;
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<FISPlan>
("OrderPlanBLL_GetOrderPlanSeq", fisplan);
return Json(dataResult, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
/// <summary>
/// 获取物料类型树
/// </summary>
/// <returns></returns>
[HandleException]
public ActionResult GetMaterialClassTree()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var classresult = wcfAgent.InvokeServiceFunction<DataResult<List<MaterialClass>>>
("MaterialBLL_GetMaterialClassList", new MaterialClass()).Result;
List<CombotreeItem> trees = new List<CombotreeItem>();
trees.Add(new CombotreeItem { id = "", text = this.EmptyItemTitle });
foreach (MaterialClass item in classresult.Where(p => string.IsNullOrWhiteSpace(p.UP_MATERIAL_TYPE_CODE)).OrderBy(p => p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = item.MATERIAL_TYPE_CODE, text = item.MATERIAL_TYPE_NAME, children = new List<CombotreeItem>() };
AppendTree(subnode, classresult);
trees.Add(subnode);
}
return Json(trees);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 获取物料类型树(有过滤)
/// </summary>
/// <returns></returns>
[HandleException]
public ActionResult GetMaterialClassTreeDea(string type)
{
MaterialClass materialclass = new MaterialClass();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if(!string.IsNullOrEmpty(type))
{
materialclass.MATERIAL_ATTRIBUTE = type;
}
var classresult = wcfAgent.InvokeServiceFunction<DataResult<List<MaterialClass>>>
("MaterialBLL_GetMaterialClassList", materialclass).Result;
List<CombotreeItem> trees = new List<CombotreeItem>();
trees.Add(new CombotreeItem { id = "", text = this.EmptyItemTitle });
foreach (MaterialClass item in classresult.Where(p => string.IsNullOrWhiteSpace(p.UP_MATERIAL_TYPE_CODE)).OrderBy(p => p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = item.MATERIAL_TYPE_CODE, text = item.MATERIAL_TYPE_NAME, children = new List<CombotreeItem>() };
AppendTree(subnode, classresult);
trees.Add(subnode);
}
return Json(trees);
}
catch (Exception ex)
{
throw ex;
}
}
private void AppendTree(CombotreeItem node, List<MaterialClass> mclasslist)
{
foreach (var mclass in mclasslist.Where(p => string.Equals(node.id, p.UP_MATERIAL_TYPE_CODE)).OrderBy(p => p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = mclass.MATERIAL_TYPE_CODE, text = mclass.MATERIAL_TYPE_NAME, children = new List<CombotreeItem>() };
AppendTree(subnode, mclasslist);
node.children.Add(subnode);
}
}
#region 获取呼叫类型
/// <summary>
/// 获取呼叫类型
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetConfigDetailComboxSource()
{
string kind = Request.Params["kind"];
bool isWithEmpty = string.IsNullOrEmpty(Request.Params["WithEmpty"]) ? true : false;
Dictionary<string, string> dicts = null;
try
{
ComboboxResult model = new ComboboxResult();
if (isWithEmpty)
{
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
}
//执行查询
List<ConfigDetail> list = new List<ConfigDetail>();
ServiceAgent wcfAgent = this.GetServiceAgent();
list = wcfAgent.InvokeServiceFunction<List<ConfigDetail>>("ConfigDetailBLL_GetAllList", kind);
foreach (ConfigDetail item in list)
{
//item.DetailTypeName = item.DetailTypeCode + "/" + item.DetailTypeName;
model.Add(new ComboboxItem { ID = item.DetailTypeCode, Text = item.DetailTypeName });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}