| | |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Net.Http; |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using System.Web.Script.Serialization; |
| | | using VueWebApi.DLL.BLL; |
| | | using VueWebApi.Models; |
| | | using VueWebApi.Tools; |
| | |
| | | { |
| | | [RoutePrefix(prefix: "api/ProductionManagement")] |
| | | [ControllerGroup("生产管理", "在线接口")] |
| | | //[ChannelActionFilter] |
| | | [ChannelActionFilter] |
| | | public class ProductionManagementController : ApiController |
| | | { |
| | | //定义全局信息返回变量 |
| | |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage MesOrderSearch(string mesorderstus = null, string mesordercode = null,string sourceorder=null,string ordertype=null, string partcode = null, string partname = null, string partspec = null, string creatuser = null, string createdate = null, int page = 0, int rows = 0, string prop = null, string order = null) |
| | | public HttpResponseMessage MesOrderSearch(int page, int rows, string prop, string order,string mesorderstus = null, string mesordercode = null,string sourceorder=null,string ordertype=null, string partcode = null, string partname = null, string partspec = null, string creatuser = null, string createdate = null) |
| | | { |
| | | int startNum = rows * (page - 1) + 1; //起始记录rowNum |
| | | int endNum = rows * page; //结束记录 rowNum |
| | | mes = ProductionManagementBLL.MesOrderSearch(mesorderstus, mesordercode, sourceorder, ordertype, partcode, partname, partspec, startNum, creatuser, createdate, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[MES报废补单工单查询] |
| | | /// <summary> |
| | | /// MES报废补单工单查询 |
| | | /// </summary> |
| | | /// <param name="mesordercode">工单编号</param> |
| | | /// <param name="sourceorder">源单单号</param> |
| | | /// <param name="partcode">产品编码</param> |
| | | /// <param name="partname">产品名称</param> |
| | | /// <param name="partspec">产品规格</param> |
| | | /// <param name="creatuser">创建人员</param> |
| | | /// <param name="createdate">创建时间</param> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">每页显示条数</param> |
| | | /// <param name="prop">排序字段</param> |
| | | /// <param name="order">排序规则</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesBadOrderSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage MesBadOrderSearch(int page, int rows, string prop, string order, string mesordercode = null, string sourceorder = null, string partcode = null, string partname = null, string partspec = null, string creatuser = null, string createdate = null) |
| | | { |
| | | int startNum = rows * (page - 1) + 1; //起始记录rowNum |
| | | int endNum = rows * page; //结束记录 rowNum |
| | | mes = ProductionManagementBLL.MesBadOrderSearch(mesordercode, sourceorder, partcode, partname, partspec, startNum, creatuser, createdate, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | public HttpResponseMessage SelectRouteStep(string routecode) |
| | | { |
| | | mes = ProductionManagementBLL.SelectRouteStep(routecode); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[工单派发选择工艺路线或选择生产车间时判断绑定条件] |
| | | /// <summary> |
| | | /// 工单派发选择工艺路线或选择生产车间时判断绑定条件 |
| | | /// </summary> |
| | | /// <param name="partcode">产品编码</param> |
| | | /// <param name="routecode">工艺路线编码</param> |
| | | /// <param name="wkshopcode">车间编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "SelectRouteOrWkshop")] |
| | | [HttpGet] |
| | | public HttpResponseMessage SelectRouteOrWkshop(string partcode, string routecode, string wkshopcode) |
| | | { |
| | | mes = ProductionManagementBLL.SelectRouteOrWkshop(partcode, routecode, wkshopcode); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[MES工单新增、获取工单号] |
| | | /// <summary> |
| | | /// MES工单新增、获取工单号 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "AddMesOrderCodeSearch")] |
| | | [HttpPost] |
| | | public HttpResponseMessage AddMesOrderCodeSearch() |
| | | { |
| | | mes = ProductionManagementBLL.AddMesOrderCodeSearch(); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | [HttpPost] |
| | | public HttpResponseMessage ClosedMesOrder(string wocode, string m_po) |
| | | { |
| | | mes = ProductionManagementBLL.ClosedMesOrder(wocode, m_po); |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductionManagementBLL.ClosedMesOrder(username,wocode, m_po); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产开报工,工序检验扫码获取任务信息] |
| | | |
| | | #region[工序检验扫码获取任务信息] |
| | | /// <summary> |
| | | /// 生产开报工,工序检验扫码获取任务信息 |
| | | /// 工序检验扫码获取任务信息 |
| | | /// </summary> |
| | | /// <param name="orderstepqrcode">扫描二维码信息</param> |
| | | /// <param name="orderstepqrcode">扫描工序二维码信息</param> |
| | | /// <param name="checktype">检验方式FirstCheck(首检) PatroCheck(巡检) EndCheck(完工检)</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderStepCheckSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage MesOrderStepCheckSearch(string orderstepqrcode) |
| | | public HttpResponseMessage MesOrderStepCheckSearch(string orderstepqrcode, string checktype) |
| | | { |
| | | mes = ProductionManagementBLL.MesOrderStepCheckSearch(orderstepqrcode); |
| | | mes = ProductionManagementBLL.MesOrderStepCheckSearch(orderstepqrcode, checktype); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产开报工,工序检验获取检验标准下拉框数据] |
| | | #region[工序检验根据选择的检验方案查找检验项目] |
| | | /// <summary> |
| | | /// 生产开报工,工序检验获取检验标准下拉框数据 |
| | | /// 入厂检验,工序检验根据选择的检验方案查找检验项目 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderStepCheckSelect")] |
| | | [HttpGet] |
| | | public HttpResponseMessage MesOrderStepCheckSelect() |
| | | { |
| | | mes = ProductionManagementBLL.MesOrderStepCheckSelect(); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产开报工,工序检验根据检验标准获取检验项目列表] |
| | | /// <summary> |
| | | /// 生产开报工,工序检验根据检验标准获取检验项目列表 |
| | | /// </summary> |
| | | /// <param name="checkstandcode">检验标准编码</param> |
| | | /// <param name="checkstandcode">检验方案编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderStepCheckItemList")] |
| | | [HttpGet] |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产开报工,工序检验提交保存] |
| | | #region[工序检验,提交] |
| | | /// <summary> |
| | | /// 生产开报工,工序检验提交保存 |
| | | /// 工序检验,提交 |
| | | /// </summary> |
| | | /// <param name="obj">提交信息</param> |
| | | /// <returns></returns> |
| | | [Route(template: "SaveMesOrderStepCheckItem")] |
| | | [HttpPost] |
| | | public HttpResponseMessage SaveMesOrderStepCheckItem([FromBody] JObject obj) |
| | | { |
| | | string mesordercode = obj["mesordercode"].ToString(); //工单编号 |
| | | string wocode = obj["wocode"].ToString(); //工单编号 |
| | | string partcode = obj["partcode"].ToString(); //产品编码 |
| | | string stepcode = obj["stepcode"].ToString(); //工序编码 |
| | | string checkstanedcode = obj["checkstanedcode"].ToString(); //检验标准编码 |
| | | string checkusercode = obj["checkusercode"].ToString(); //检验人员编码 |
| | | string checktypecode = obj["checktypecode"].ToString(); //检验类型编码 |
| | | string checkresult = obj["checkresult"].ToString(); //检验结果 |
| | | string checkdescr = obj["checkdescr"].ToString(); //检验描述 |
| | | string checkqty = obj["checkqty"].ToString(); //检验数量 |
| | | string data = obj["data"].ToString(); |
| | | List<StepCheck> json = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StepCheck>>(data); |
| | | string checkstandcode = obj["checkstandcode"].ToString(); //质检方案编码 |
| | | string check_type = obj["check_type"].ToString(); //检验方式FirstCheck(首检) PatroCheck(巡检) EndCheck(完工检) |
| | | string sampmethod = obj["sampmethod"].ToString(); //抽检方式:固定抽检(FIXED) 比例抽检(SCARE) |
| | | string qualitystatus = obj["qualitystatus"].ToString(); //质量状态(合格、不合格) |
| | | string labqty = obj["good_qty"].ToString(); //工序任务合格数量 |
| | | string sampleqty = obj["sampleqty"].ToString(); //样本数量 |
| | | string goodqty = obj["goodqty"].ToString(); //合格数量 |
| | | string ngqty = obj["ngqty"].ToString();//不合格数量 |
| | | string checkitemcont = obj["checkitemcont"].ToString(); //检验项目数据 |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductionManagementBLL.SaveMesOrderStepCheckItem(mesordercode, partcode, stepcode, checkstanedcode, checkusercode, checktypecode, checkresult, checkdescr, checkqty, username,json); |
| | | mes = ProductionManagementBLL.SaveMesOrderStepCheckItem(wocode, partcode, stepcode, checkstandcode, check_type, sampmethod, qualitystatus, labqty, sampleqty, goodqty, ngqty, checkitemcont, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[MES工单批量关闭查询] |
| | | /// <summary> |
| | | /// MES工单查询 |
| | | /// </summary> |
| | | /// <param name="mesorderstus">工单状态码</param> |
| | | /// <param name="mesordercode">工单编号</param> |
| | | /// <param name="sourceorder">源单单号</param> |
| | | /// <param name="ordertype">单据类型</param> |
| | | /// <param name="partcode">产品编码</param> |
| | | /// <param name="partname">产品名称</param> |
| | | /// <param name="partspec">产品规格</param> |
| | | /// <param name="creatuser">创建人员</param> |
| | | /// <param name="createdate">创建时间</param> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">每页显示条数</param> |
| | | /// <param name="prop">排序字段</param> |
| | | /// <param name="order">排序规则</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderBitchClosedSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage MesOrderBitchClosedSearch(string mesorderstus = null, string mesordercode = null, string sourceorder = null, string ordertype = null, string partcode = null, string partname = null, string partspec = null, string creatuser = null, string createdate = null, int page = 0, int rows = 0, string prop = null, string order = null) |
| | | { |
| | | int startNum = rows * (page - 1) + 1; //起始记录rowNum |
| | | int endNum = rows * page; //结束记录 rowNum |
| | | mes = ProductionManagementBLL.MesOrderBitchClosedSearch(mesorderstus, mesordercode, sourceorder, ordertype, partcode, partname, partspec, startNum, creatuser, createdate, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[MES工单批量关闭提交] |
| | | /// <summary> |
| | | /// MES工单批量关闭提交 |
| | | /// </summary> |
| | | /// <param name="dt">工单号数组对象</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderBitchClosedSeave")] |
| | | [HttpPost] |
| | | public HttpResponseMessage MesOrderBitchClosedSeave(DataTable dt) |
| | | { |
| | | |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductionManagementBLL.MesOrderBitchClosedSeave(username, dt); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[MES工单批量反关闭] |
| | | /// <summary> |
| | | /// MES工单批量反关闭 |
| | | /// </summary> |
| | | /// <param name="dt">工单号数组对象</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderBitchAntiClosedSeave")] |
| | | [HttpPost] |
| | | public HttpResponseMessage MesOrderBitchAntiClosedSeave(DataTable dt) |
| | | { |
| | | |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductionManagementBLL.MesOrderBitchAntiClosedSeave(username, dt); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[产能规划查询] |
| | | /// <summary> |
| | | /// 产能规划查询 |
| | | /// </summary> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">页数</param> |
| | | /// <param name="prop">排序字段</param> |
| | | /// <param name="order">排序规则</param> |
| | | /// <param name="workshop">车间编码</param> |
| | | /// <param name="devicetype">生产单元</param> |
| | | /// <param name="stustype">有效状态</param> |
| | | /// <returns></returns> |
| | | [Route(template: "CapacityPlanningSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage CapacityPlanningSearch(int page, int rows, string prop, string order,string workshop = null, string devicetype = null, string stustype = null) |
| | | { |
| | | int startNum = rows * (page - 1) + 1; //起始记录rowNum |
| | | int endNum = rows * page; //结束记录 rowNum |
| | | mes = ProductionManagementBLL.CapacityPlanningSearch(workshop, devicetype, stustype, startNum, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[产能规划默认方案保存提交] |
| | | /// <summary> |
| | | /// 产能规划默认方案保存提交 |
| | | /// </summary> |
| | | /// <param name="captplanid">产能规划(生产资源)id</param> |
| | | /// <param name="wkshopcode">车间编码</param> |
| | | /// <param name="capunitcode">生产单元编码</param> |
| | | /// <param name="capsetupcode">默认方案编码</param> |
| | | /// <param name="captplantype">资源类型</param> |
| | | /// <returns></returns> |
| | | [Route(template: "CapacityPlanSubmit")] |
| | | [HttpPost] |
| | | public HttpResponseMessage CapacityPlanSubmit(string wkshopcode, string capunitcode,string captplanid=null,string capsetupcode=null,string captplantype=null) |
| | | { |
| | | string type = ""; //提交类型 |
| | | if (captplanid == "" || captplanid == null) |
| | | { |
| | | type = "Add"; |
| | | } |
| | | else |
| | | { |
| | | type = "Update"; |
| | | } |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductionManagementBLL.CapacityPlanSubmit(type,captplanid,wkshopcode,capunitcode,capsetupcode, captplantype,username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[产能规划点击日历组件查找已关联的日期方案] |
| | | /// <summary> |
| | | /// 产能规划点击日历组件查找已关联的日期方案 |
| | | /// </summary> |
| | | /// <param name="captplanid">产能规划(生产资源)id</param> |
| | | /// <returns></returns> |
| | | [Route(template: "CapacityPlanningCalendar")] |
| | | [HttpGet] |
| | | public HttpResponseMessage CapacityPlanningCalendar(string captplanid) |
| | | { |
| | | mes = ProductionManagementBLL.CapacityPlanningCalendar(captplanid); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[产能规划日历双击时带出对应的方案] |
| | | /// <summary> |
| | | /// 产能规划日历双击时带出对应的方案 |
| | | /// </summary> |
| | | /// <param name="captplanid">产能规划(生产资源)id</param> |
| | | /// <param name="datetime">双击选中的日期</param> |
| | | /// <returns></returns> |
| | | [Route(template: "CapacityPlanningOnclickSelect")] |
| | | [HttpGet] |
| | | public HttpResponseMessage CapacityPlanningOnclickSelect(string captplanid,string datetime) |
| | | { |
| | | mes = ProductionManagementBLL.CapacityPlanningOnclickSelect(captplanid, datetime); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[产能规划工作日历选择提交] |
| | | /// <summary> |
| | | /// 产能规划工作日历选择提交 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "CapacityPlanningGivePlanSubmit")] |
| | | [HttpPost] |
| | | public HttpResponseMessage CapacityPlanningGivePlanSubmit() |
| | | { |
| | | string wkshopcode = HttpContext.Current.Request["wkshopcode"].ToString();//车间编码 |
| | | string capunitcode = HttpContext.Current.Request["capunitcode"].ToString();//生产单元编码 |
| | | string captplanid = HttpContext.Current.Request["captplanid"].ToString(); //产能规划(生产资源)列表id |
| | | string capsetupcode = HttpContext.Current.Request["capsetupcode"].ToString(); //默认方案编码 |
| | | string captplantype = HttpContext.Current.Request["captplantype"].ToString(); //资源类型 |
| | | string worklist = HttpContext.Current.Request["worklist"].ToString(); //工作日历数据集 |
| | | JavaScriptSerializer Serializer = new JavaScriptSerializer(); |
| | | List<CapaPlan> objs = Serializer.Deserialize<List<CapaPlan>>(worklist); |
| | | string type = ""; //提交类型 |
| | | if (captplanid == "" || captplanid == null) |
| | | { |
| | | type = "Add"; |
| | | } |
| | | else |
| | | { |
| | | type = "Update"; |
| | | } |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductionManagementBLL.CapacityPlanningGivePlanSubmit(captplanid, wkshopcode, capunitcode, capsetupcode, captplantype, objs,type, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[自动排程工单查询] |
| | | /// <summary> |
| | | /// 自动排程工单查询 |
| | | /// </summary> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">每页条数</param> |
| | | /// <param name="prop">排序字段</param> |
| | | /// <param name="order">排序规则</param> |
| | | /// <param name="workshop">车间编码</param> |
| | | /// <param name="wocode">生产工单号</param> |
| | | /// <param name="partcode">物料编码</param> |
| | | /// <param name="partname">物料名称</param> |
| | | /// <returns></returns> |
| | | [Route(template: "AdvancedSchedulingSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage AdvancedSchedulingSearch(int page, int rows, string prop, string order, string workshop = null, string wocode = null, string partcode = null,string partname=null) |
| | | { |
| | | int startNum = rows * (page - 1) + 1; //起始记录rowNum |
| | | int endNum = rows * page; //结束记录 rowNum |
| | | mes = ProductionManagementBLL.AdvancedSchedulingSearch(workshop, wocode, partcode, partname, startNum, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[高级排程点击工单任务带出瓶颈工序设备、已排程任务数据] |
| | | /// <summary> |
| | | /// 高级排程点击工单任务带出瓶颈工序设备、已排程任务数据 |
| | | /// </summary> |
| | | /// <param name="wocode">工单编号</param> |
| | | /// <param name="wkshpcode">车间编码</param> |
| | | /// <param name="partcode">物料编码</param> |
| | | /// <param name="botproccode">瓶颈工序编码(首道工序)</param> |
| | | /// <param name="startdate">开始日期</param> |
| | | /// <param name="enddate">结束日期</param> |
| | | /// <returns></returns> |
| | | [Route(template: "OnclickAdvancedSchedulingDevice")] |
| | | [HttpGet] |
| | | public HttpResponseMessage OnclickAdvancedSchedulingDevice(string wocode,string wkshpcode,string partcode,string botproccode,string startdate,string enddate) |
| | | { |
| | | List<AdvancedSchedulingDevice> list = new List<AdvancedSchedulingDevice>(); |
| | | List<AdvancedSchedAlready> list1 = new List<AdvancedSchedAlready>(); |
| | | list = ProductionManagementBLL.OnclickAdvancedSchedulingDevice(wocode, wkshpcode, partcode, startdate, enddate, ref mes); //排产设备信息 |
| | | DataTable dt = ProductionManagementBLL.AlreadyScheduling(wocode, wkshpcode, partcode, botproccode, startdate, enddate); //设备已排程信息 |
| | | |
| | | Dictionary<object, object> dList = new Dictionary<object, object>(); |
| | | dList.Add("rus", mes); |
| | | dList.Add("rows", list); |
| | | dList.Add("Cont", dt); |
| | | return TJson.toJson(dList); |
| | | } |
| | | #endregion |
| | | |
| | | #region[排程数据提交] |
| | | /// <summary> |
| | | /// 排程数据提交 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "SubmitAlreadyScheduling")] |
| | | [HttpPost] |
| | | public HttpResponseMessage SubmitAlreadyScheduling() |
| | | { |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | string wocode = HttpContext.Current.Request["wocode"].ToString();//工单编号 |
| | | string botprocecode = HttpContext.Current.Request["botprocecode"].ToString(); //瓶颈工序编码 |
| | | string json = HttpContext.Current.Request["json"].ToString(); //排程提交数据 |
| | | JavaScriptSerializer Serializer = new JavaScriptSerializer(); |
| | | List<AlreadyScheduling> objs = Serializer.Deserialize<List<AlreadyScheduling>>(json); |
| | | mes = ProductionManagementBLL.SubmitAlreadyScheduling(username, wocode, botprocecode, objs); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | } |
| | | } |