| | |
| | | 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; |
| | |
| | | namespace VueWebApi.Controllers |
| | | { |
| | | |
| | | [RoutePrefix(prefix: "api/BasicSetting")] |
| | | [RoutePrefix(prefix: "api/ProductModel")] |
| | | [ControllerGroup("制造模型", "在线接口")] |
| | | [ChannelActionFilter] |
| | | public class ProductModelController : ApiController |
| | | { |
| | | //定义全局信息返回变量 |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[存类型查找物料类型] |
| | | #region[存货类型查找物料类型] |
| | | /// <summary> |
| | | /// 存类型查找物料类型 |
| | | /// 存货类型查找物料类型 |
| | | /// </summary> |
| | | /// <param name="stocktypecode">存货类型编码</param> |
| | | /// <returns></returns> |
| | |
| | | mes.code = "300"; |
| | | mes.Message = e.Message; |
| | | } |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[单位下拉列表查询] |
| | | /// <summary> |
| | | /// 单位下拉列表查询 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "UomSelect")] |
| | | [HttpGet] |
| | | public HttpResponseMessage UomSelect() |
| | | { |
| | | mes = ProductModelBLL.UomSelect(); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | string materialtypecode = obj["materialtypecode"].ToString(); //物料类型编码 |
| | | string minstockqty = obj["minstockqty"].ToString(); //最小库存 |
| | | string maxstockqty = obj["maxstockqty"].ToString(); //最大库存 |
| | | string is_batchno = obj["is_batchno"].ToString(); //是否批次管理 |
| | | string is_fifo = obj["is_fifo"].ToString(); //是否先进先出 |
| | | string is_incheck = obj["is_incheck"].ToString(); //是否入厂检验 |
| | | string is_outcheck = obj["is_outcheck"].ToString(); //是否出厂检验 |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | string OperType = obj["OperType"].ToString(); //操作类型 |
| | | mes = ProductModelBLL.AddUpdateInventoryFile(materialid, materialcode, materialname, materialspec, uomcode, warehousecode, stocktypecode, materialtypecode, minstockqty, maxstockqty, username, OperType); |
| | | mes = ProductModelBLL.AddUpdateInventoryFile(materialid, materialcode, materialname, materialspec, uomcode, warehousecode, stocktypecode, materialtypecode, minstockqty, maxstockqty,is_batchno,is_fifo,is_incheck,is_outcheck, username, OperType); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | /// 存货档案关联工艺路线提交 |
| | | /// </summary> |
| | | /// <param name="partcode">物料编码</param> |
| | | /// <param name="defaultroute_code">默认工艺路线编码</param> |
| | | /// <param name="json">提交数据对象</param> |
| | | /// <returns></returns> |
| | | [Route(template: "SaveInventoryFile")] |
| | | [HttpPost] |
| | | public HttpResponseMessage SaveInventoryFile(string partcode, List<ObjectData> json) |
| | | public HttpResponseMessage SaveInventoryFile(string partcode, List<ObjectData> json, string defaultroute_code = null) |
| | | { |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductModelBLL.SaveInventoryFile(partcode, username, json); |
| | | mes = ProductModelBLL.SaveInventoryFile(partcode, defaultroute_code, username, json); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region[物料清单主列表查询] |
| | | /// <summary> |
| | | /// 物料清单主列表查询 |
| | | /// </summary> |
| | | /// <param name="parentpartcode">母件编码</param> |
| | | /// <param name="parentpartname">母件名称</param> |
| | | /// <param name="parentpartspec">母件规格</param> |
| | | /// <param name="status">启用状态</param> |
| | | /// <param name="version">版本号</param> |
| | | /// <param name="createusername">创建人员</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: "BoIventorySelect")] |
| | | [HttpGet] |
| | | public HttpResponseMessage BoIventorySelect(string parentpartcode = null, string parentpartname = null,string parentpartspec=null,string parttype=null, string status = null, string version = null, string createusername = null, string createdate = null, int page = 0, int rows = 0, string prop = null, string order = null) |
| | | { |
| | | string createopendate = ""; //开始时间 |
| | | string createclosedate = ""; //结束时间 |
| | | if (createdate != "" && createdate != null) |
| | | { |
| | | createopendate = createdate.Split('~')[0].ToString(); |
| | | createclosedate = createdate.Split('~')[1].ToString(); |
| | | } |
| | | int startNum = rows * (page - 1) + 1; //起始记录rowNum |
| | | int endNum = rows * page; //结束记录 rowNum |
| | | mes = ProductModelBLL.BoIventorySelect(parentpartcode, parentpartname, parentpartspec, parttype, status, version, createusername, createopendate, createclosedate, startNum, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[物料清单编辑显示及预览] |
| | | /// <summary> |
| | | /// 物料清单编辑显示及预览 |
| | | /// </summary> |
| | | /// <param name="bomid">Bom主表id</param> |
| | | /// <returns></returns> |
| | | [Route(template: "BoIventorySelectView")] |
| | | [HttpGet] |
| | | public HttpResponseMessage BoIventorySelectView(string bomid) |
| | | { |
| | | mes = ProductModelBLL.BoIventorySelectView(bomid); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[物料清单新增时获取最大版本号] |
| | | /// <summary> |
| | | /// 物料清单新增时获取最大版本号 |
| | | /// </summary> |
| | | /// <param name="parentpartcode">母件编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MaterielDetailedVsion")] |
| | | [HttpGet] |
| | | public HttpResponseMessage MaterielDetailedVsion(string parentpartcode) |
| | | { |
| | | mes = ProductModelBLL.MaterielDetailedVsion(parentpartcode); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[物料清单新增/编辑提交] |
| | | /// <summary> |
| | | /// 物料清单新增/编辑提交 |
| | | /// </summary> |
| | | /// <param name="obj">提交数据</param> |
| | | /// <returns></returns> |
| | | [Route(template: "AddUpdateBoIventory")] |
| | | [HttpPost] |
| | | public HttpResponseMessage AddUpdateBoIventory([FromBody] JObject obj) |
| | | { |
| | | string bomid = obj["bomid"].ToString(); //母件id |
| | | string parentpartcode = obj["parentpartcode"].ToString(); //母件编码 |
| | | string parentpartname = obj["parentpartname"].ToString(); //母件名称 |
| | | string parentpartspec = obj["parentpartspec"].ToString(); //母件规格 |
| | | string status = obj["status"].ToString();//启用状态 |
| | | string uomcode = obj["uomcode"].ToString(); //计量单位编码 |
| | | string quantity = obj["quantity"].ToString(); //基础数量 |
| | | string startdate = obj["startdate"].ToString(); //启用日期 |
| | | string version = obj["version"].ToString(); //版本号 |
| | | string worklist = obj["worklist"].ToString(); //提交数据 |
| | | string opertype = obj["opertype"].ToString(); //提交类型 |
| | | string username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | List<BomSub> objs = Newtonsoft.Json.JsonConvert.DeserializeObject<List<BomSub>>(worklist); |
| | | mes = ProductModelBLL.AddUpdateBoIventory(bomid,parentpartcode, parentpartname, parentpartspec, status, uomcode, quantity, startdate, version, username, opertype, objs); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[物料清单删除] |
| | | /// <summary> |
| | | /// 物料清单删除 |
| | | /// </summary> |
| | | /// <param name="bomid">Bom主表id</param> |
| | | /// <returns></returns> |
| | | [Route(template: "DeleteBoIventory")] |
| | | [HttpPost] |
| | | public HttpResponseMessage DeleteBoIventory(string bomid) |
| | | { |
| | | mes = ProductModelBLL.DeleteBoIventory(bomid); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | #region[工序下拉查询接口] |
| | | /// <summary> |
| | | /// 工序下拉查询接口 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "StepSelect")] |
| | | [HttpGet] |
| | | public HttpResponseMessage StepSelect() |
| | | { |
| | | mes = ProductModelBLL.StepSelect(); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[工艺路线查询] |
| | | /// <summary> |
| | |
| | | |
| | | #region[工艺路线新增] |
| | | /// <summary> |
| | | /// 工艺路线新增编辑 |
| | | /// 工艺路线新增 |
| | | /// </summary> |
| | | /// <param name="id">工艺路线id</param> |
| | | /// <param name="opertype">操作类型(新增)</param> |
| | |
| | | /// <returns></returns> |
| | | [Route(template: "AddUpdateRoute")] |
| | | [HttpPost] |
| | | public HttpResponseMessage AddUpdateRoute(string id, string opertype, RoutEdit json) |
| | | public HttpResponseMessage AddUpdateRoute(string opertype, RoutEdit json,string id=null) |
| | | { |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductModelBLL.AddUpdateRoute(id, opertype, username, json); |
| | |
| | | #endregion |
| | | |
| | | #region[工序关联缺陷提交] |
| | | /// <summary> |
| | | /// 工序关联缺陷提交 |
| | | /// </summary> |
| | | /// <param name="stepcode">工序编码</param> |
| | | /// <param name="json">提交数据</param> |
| | | /// <returns></returns> |
| | | [Route(template: "SaveStepAssociationDefect")] |
| | | [HttpPost] |
| | | public HttpResponseMessage SaveStepAssociationDefect(string stepcode, List<ObjectData> json) |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[根据工序线编码查找关联设备集合] |
| | | #region[根据工序线编码查找关联设备下拉框集合] |
| | | /// <summary> |
| | | /// 根据工序线编码查找关联设备集合 |
| | | /// 根据工序线编码查找关联设备下拉框集合 |
| | | /// </summary> |
| | | /// <param name="stepcode">工序编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "StepSelectEqp")] |
| | | [HttpGet] |
| | | public HttpResponseMessage StepSelectEqp(string stepcode) |
| | | { |
| | | mes = ProductModelBLL.StepSelectEqp(stepcode); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[根据工序线编码查找关联设备列表集合] |
| | | /// <summary> |
| | | /// 根据工序线编码查找关联设备列表集合 |
| | | /// </summary> |
| | | /// <param name="partcode">产品编码</param> |
| | | /// <param name="routecode">工艺路线编码</param> |
| | | /// <param name="stepcode">工序编码</param> |
| | | /// <param name="steptype">工序类型</param> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">每页显示条数</param> |
| | | /// <param name="prop">排序字段</param> |
| | | /// <param name="order">排序规则</param> |
| | | /// <returns></returns> |
| | | [Route(template: "StepSelectEqp")] |
| | | [Route(template: "StepSelectEqpList")] |
| | | [HttpGet] |
| | | public HttpResponseMessage StepSelectEqp(string partcode, string routecode, string stepcode, int page = 0, int rows = 0, string prop = null, string order = null) |
| | | public HttpResponseMessage StepSelectEqpList(string partcode, string routecode, string stepcode,string steptype, 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 = ProductModelBLL.StepSelectEqp(partcode, routecode, stepcode, startNum, endNum, prop, order); |
| | | mes = ProductModelBLL.StepSelectEqpList(partcode, routecode, stepcode, steptype, startNum, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | /// 节拍工价查询 |
| | | /// </summary> |
| | | /// <param name="partcode">产品编码</param> |
| | | /// <param name="partname">产品名称</param> |
| | | /// <param name="partspec">产品规格</param> |
| | | /// <param name="routecode">工艺路线编码</param> |
| | | /// <param name="stepcode">工序编码</param> |
| | | /// <param name="eqpcode">设备编码</param> |
| | | /// <param name="eqpname">设备名称</param> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">每页显示条数</param> |
| | | /// <param name="prop">排序字段</param> |
| | |
| | | /// <returns></returns> |
| | | [Route(template: "BeatRateSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage BeatRateSearch(string partcode = null, string partname = null, string partspec = null, string routecode = null, string stepcode = null, string eqpcode = null, string eqpname = null, int page = 0, int rows = 0, string prop = null, string order = null) |
| | | public HttpResponseMessage BeatRateSearch(string partcode = null, string routecode = null, string stepcode = null, string eqpcode = 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 = ProductModelBLL.BeatRateSearch(partcode, partname, partspec, routecode, stepcode, eqpcode, eqpname, startNum, endNum, prop, order); |
| | | mes = ProductModelBLL.BeatRateSearch(partcode,routecode, stepcode, eqpcode, startNum, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[节拍工价提交] |
| | | /// <summary> |
| | | /// 节拍工价提交 |
| | | /// </summary> |
| | | /// <param name="obj">提交数据</param> |
| | | /// <returns></returns> |
| | | [Route(template: "SaveBeatRate")] |
| | | [HttpPost] |
| | | public HttpResponseMessage SaveBeatRate([FromBody] JObject obj) |
| | | { |
| | | string partcode = obj["partcode"].ToString(); //产品编码 |
| | | string routecode = obj["routecode"].ToString(); //工艺路线编码 |
| | | string stepcode = obj["stepcode"].ToString(); //工序编码 |
| | | string eqpcode = obj["eqpcode"].ToString(); //设备编码 |
| | | string wkshopcode = obj["wkshopcode"].ToString(); //生产车间编码 |
| | | string eqp_value = obj["eqp_value"].ToString(); //设备节拍 |
| | | string stand_value = obj["stand_value"].ToString(); //生产节拍 |
| | | string cavity_qty = obj["cavity_qty"].ToString(); //型腔数 |
| | | string unprice = obj["unprice"].ToString(); //计件单价 |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 |
| | | mes = ProductModelBLL.SaveBeatRate(partcode, routecode, stepcode, eqpcode, wkshopcode, eqp_value, stand_value, cavity_qty, unprice, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[节拍工价删除] |
| | | /// <summary> |
| | | /// 节拍工价删除 |
| | | /// </summary> |
| | | /// <param name="partcode">产品编码</param> |
| | | /// <param name="routecode">工艺路线编码</param> |
| | | /// <param name="stepcode">工序编码</param> |
| | | /// <param name="eqpcode">设备编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "DeleteBeatRate")] |
| | | [HttpPost] |
| | | public HttpResponseMessage DeleteBeatRate(string partcode,string routecode,string stepcode,string eqpcode) |
| | | { |
| | | mes = ProductModelBLL.DeleteBeatRate(partcode, routecode, stepcode, eqpcode); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |