| | |
| | | using Newtonsoft.Json.Linq; |
| | | using Newtonsoft.Json; |
| | | 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 VueWebApi.DLL.BLL; |
| | | using VueWebApi.Models; |
| | | using VueWebApi.Tools; |
| | | |
| | | namespace VueWebApi.Controllers |
| | | { |
| | | [RoutePrefix(prefix: "api/ProductionManagement")] |
| | | [ControllerGroup("生产管理", "在线接口")] |
| | | //[ChannelActionFilter] |
| | | public class ProductionManagementController : ApiController |
| | | { |
| | | //定义全局信息返回变量 |
| | |
| | | /// <param name="partcode">产品编码</param> |
| | | /// <param name="partname">产品名称</param> |
| | | /// <param name="partspec">产品规格</param> |
| | | /// <param name="paydate">交付时间</param> |
| | | /// <param name="paystartdate">预计开工时间</param> |
| | | /// <param name="payenddate">预计完工时间</param> |
| | | /// <param name="creatuser">创建人员</param> |
| | | /// <param name="createdate">创建时间</param> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">每页显示条数</param> |
| | | /// <param name="prop">排序字段</param> |
| | |
| | | /// <returns></returns> |
| | | [Route(template: "ErpOrderSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage ErpOrderSearch(string erporderstus = null, string erpordercode = null, string partcode = null, string partname = null, string partspec = null, string paydate = null, string creatuser = null, string createdate = null, int page = 0, int rows = 0, string prop = null, string order = null) |
| | | public HttpResponseMessage ErpOrderSearch(string erporderstus = null, string erpordercode = null, string partcode = null, string partname = null, string partspec = null, string paystartdate = null, string payenddate = null, string creatuser = null, int page = 0, int rows = 0, string prop = null, string order = null) |
| | | { |
| | | string paydatestartdate = ""; //交付开始时间 |
| | | string paydateenddate = ""; //交付结束时间 |
| | | string createstartdate = ""; //操作开始时间 |
| | | string createenddate = ""; //操作结束时间 |
| | | if (paydate != "" && paydate != null) |
| | | string paydatestartdate = ""; //预计开工开始时间 |
| | | string paydateenddate = ""; //预计开工结束时间 |
| | | string paydatestartdate1 = ""; //预计完工开始时间 |
| | | string paydateenddate2 = ""; //预计完工结束时间 |
| | | if (paystartdate != "" && paystartdate != null) |
| | | { |
| | | paydatestartdate = paydate.Split('~')[0].ToString(); |
| | | paydateenddate = paydate.Split('~')[1].ToString(); |
| | | paydatestartdate = paystartdate.Split('~')[0].ToString(); |
| | | paydateenddate = paystartdate.Split('~')[1].ToString(); |
| | | } |
| | | if (createdate != "" && createdate != null) |
| | | if (payenddate != "" && payenddate != null) |
| | | { |
| | | createstartdate = createdate.Split('~')[0].ToString(); |
| | | createenddate = createdate.Split('~')[1].ToString(); |
| | | paydatestartdate1 = payenddate.Split('~')[0].ToString(); |
| | | paydateenddate2 = payenddate.Split('~')[1].ToString(); |
| | | } |
| | | int startNum = rows * (page - 1) + 1; //起始记录rowNum |
| | | int endNum = rows * page; //结束记录 rowNum |
| | | mes = ProductionManagementBLL.ErpOrderSearch(erporderstus, erpordercode, partcode, partname, partspec, startNum, paydatestartdate, paydateenddate, creatuser, createstartdate, createenddate, endNum, prop, order); |
| | | mes = ProductionManagementBLL.ErpOrderSearch(erporderstus, erpordercode, partcode, partname, partspec, startNum, paydatestartdate, paydateenddate, paydatestartdate1, paydateenddate2, creatuser, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | [HttpPost] |
| | | public HttpResponseMessage MarkSaveErpOrder([FromBody] JObject obj) |
| | | { |
| | | string erporderid = obj["erporderid"].ToString(); //订单id |
| | | string erpordercode = obj["erpordercode"].ToString(); //订单编号 |
| | | string partcode = obj["partcode"].ToString(); //产品编码 |
| | | string wkshopcode = obj["wkshopcode"].ToString(); //车间编码 |
| | |
| | | string ordernum = obj["ordernum"].ToString(); //下单单数 |
| | | string relse_qty = obj["relse_qty"].ToString(); //已下单数量 |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductionManagementBLL.MarkSaveErpOrder(erpordercode, partcode, wkshopcode, warehousecode, erpqty, markqty, ordernum, relse_qty, username); |
| | | mes = ProductionManagementBLL.MarkSaveErpOrder(erporderid,erpordercode, partcode, wkshopcode, warehousecode, erpqty, markqty, ordernum, relse_qty, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | /// <summary> |
| | | /// ERP订单关闭 |
| | | /// </summary> |
| | | /// <param name="erporderid">订单id</param> |
| | | /// <param name="erpordercode">订单号</param> |
| | | /// <returns></returns> |
| | | [Route(template: "ClosedErpOrder")] |
| | | [HttpPost] |
| | | public HttpResponseMessage ClosedErpOrder(string erpordercode) |
| | | public HttpResponseMessage ClosedErpOrder(string erporderid, string erpordercode) |
| | | { |
| | | //var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | var username = "Admin"; |
| | | mes = ProductionManagementBLL.ClosedErpOrder(erpordercode, username); |
| | | mes = ProductionManagementBLL.ClosedErpOrder(erporderid,erpordercode, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | /// </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> |
| | |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage MesOrderSearch(string mesorderstus = null, string mesordercode = 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(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.MesOrderSearch(mesorderstus, mesordercode, partcode, partname, partspec, startNum, creatuser, createdate, endNum, prop, order); |
| | | mes = ProductionManagementBLL.MesOrderSearch(mesorderstus, mesordercode, sourceorder, ordertype, partcode, partname, partspec, startNum, creatuser, createdate, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | public HttpResponseMessage AddUpdateMesOrder([FromBody] JObject obj) |
| | | { |
| | | string mesorderstus = obj["mesorderstus"].ToString(); //工单状态码 |
| | | string sourceorder = obj["sourceorder"].ToString(); //源单编号 |
| | | string ordertype = obj["ordertype"].ToString(); //工单类型 |
| | | string mesordercode = obj["mesordercode"].ToString(); //工单编号 |
| | | string partcode = obj["partcode"].ToString(); //产品编码 |
| | | string mesqty = obj["mesqty"].ToString(); //工单数量 |
| | |
| | | string orderlev = obj["orderlev"].ToString(); //工单等级 |
| | | string opertype = obj["OperType"].ToString(); //操作类型 |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductionManagementBLL.AddUpdateMesOrder(mesorderstus, mesordercode, partcode, mesqty, routecode, wkshopcode, planstartdate, planenddate, orderlev, username, opertype); |
| | | mes = ProductionManagementBLL.AddUpdateMesOrder(mesorderstus, sourceorder, ordertype, mesordercode, partcode, mesqty, routecode, wkshopcode, planstartdate, planenddate, orderlev, username, opertype); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | /// <summary> |
| | | /// MES工单删除 |
| | | /// </summary> |
| | | /// <param name="souceid">源单工单</param> |
| | | /// <param name="wocode">工单编号</param> |
| | | /// <param name="m_po">订单编号</param> |
| | | /// <param name="orderqty">工单数量</param> |
| | | /// <returns></returns> |
| | | [Route(template: "DeleteMesOrder")] |
| | | [HttpPost] |
| | | public HttpResponseMessage DeleteMesOrder(string wocode, string m_po, string orderqty) |
| | | public HttpResponseMessage DeleteMesOrder(string souceid, string wocode, string m_po, string orderqty) |
| | | { |
| | | mes = ProductionManagementBLL.DeleteMesOrder(wocode, m_po, orderqty); |
| | | mes = ProductionManagementBLL.DeleteMesOrder(souceid, wocode, m_po, orderqty); |
| | | 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 |
| | |
| | | int startNum = rows * (page - 1) + 1; //起始记录rowNum |
| | | int endNum = rows * page; //结束记录 rowNum |
| | | mes = ProductionManagementBLL.MesOrderWxStepSearch(orderstepqrcode, startNum, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产开报工扫码获取工单对应工序任务(不良)] |
| | | /// <summary> |
| | | /// 生产开报工扫码获取工单对应工序任务(不良) |
| | | /// </summary> |
| | | /// <param name="orderstepqrcode">扫描的二维码信息</param> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">每页显示条数</param> |
| | | /// <param name="prop">排序字段</param> |
| | | /// <param name="order">排序规则(默认按照计划开工时间正序)</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderNgStepSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage MesOrderNgStepSearch(string orderstepqrcode = 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.MesOrderNgStepSearch(orderstepqrcode, startNum, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产开报工扫码获取工单对应工序任务(不良明细)] |
| | | /// <summary> |
| | | /// 生产开报工扫码获取工单对应工序任务(不良明细) |
| | | /// </summary> |
| | | /// <param name="orderstepqrcode">扫描的二维码信息</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderNgSubStepSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage MesOrderNgSubStepSearch(string orderstepqrcode) |
| | | { |
| | | mes = ProductionManagementBLL.MesOrderNgSubStepSearch(orderstepqrcode); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | string reportqty = obj["reportqty"].ToString(); //报工工数量 |
| | | string ngqty = obj["ngqty"].ToString(); //不良数量 |
| | | string badcode = obj["badcode"].ToString(); //不良原因编码 |
| | | string remarks = obj["remarks"].ToString(); //备注 |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductionManagementBLL.SavaMesOrderStepReport(mesordercode, partcode, stepseq, stepcode, eqpcode, usergroupcode, reportuser, taskqty, startqty, reportqty, ngqty, badcode, username); |
| | | mes = ProductionManagementBLL.SavaMesOrderStepReport(mesordercode, partcode, stepseq, stepcode, eqpcode, usergroupcode, reportuser, taskqty, startqty, reportqty, ngqty, badcode, remarks, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | string sqty = obj["sqty"].ToString(); //收料数量 |
| | | string ngqty = obj["ngqty"].ToString(); //不良数量 |
| | | string badcode = obj["badcode"].ToString(); //不良原因编码 |
| | | string remarks = obj["remarks"].ToString(); //备注 |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductionManagementBLL.SavaMesOrderStepIn(mesordercode, partcode, stepseq, stepcode, wxcode, inuser, taskqty, sqty, ngqty, badcode, username); |
| | | mes = ProductionManagementBLL.SavaMesOrderStepIn(mesordercode, partcode, stepseq, stepcode, wxcode, inuser, taskqty, sqty, ngqty, badcode, remarks, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[不良处理,提交] |
| | | /// <summary> |
| | | /// 不良处理,提交 |
| | | /// </summary> |
| | | /// <param name="username">处理人员编码</param> |
| | | /// <param name="json">提交数据</param> |
| | | /// <returns></returns> |
| | | [Route(template: "EditOrderNgStepSeave")] |
| | | [HttpPost] |
| | | public HttpResponseMessage EditOrderNgStepSeave(string username, ReportDefectHandle json) |
| | | { |
| | | mes = ProductionManagementBLL.EditOrderNgStepSeave(json, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产开报工,工序检验扫码获取任务信息] |
| | | /// <summary> |
| | | /// 生产开报工,工序检验扫码获取任务信息 |
| | | /// </summary> |
| | | /// <param name="orderstepqrcode">扫描二维码信息</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderStepCheckSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage MesOrderStepCheckSearch(string orderstepqrcode) |
| | | { |
| | | mes = ProductionManagementBLL.MesOrderStepCheckSearch(orderstepqrcode); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #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> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderStepCheckItemList")] |
| | | [HttpGet] |
| | | public HttpResponseMessage MesOrderStepCheckItemList(string checkstandcode) |
| | | { |
| | | mes = ProductionManagementBLL.MesOrderStepCheckItemList(checkstandcode); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #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 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); |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductionManagementBLL.SaveMesOrderStepCheckItem(mesordercode, partcode, stepcode, checkstanedcode, checkusercode, checktypecode, checkresult, checkdescr, checkqty, username,json); |
| | | 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工单批量关闭提交] |
| | | [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工单批量反关闭] |
| | | [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 |