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/ProductModel")]
[ControllerGroup("制造模型", "在线接口")]
[ChannelActionFilter]
public class ProductModelController : ApiController
{
//定义全局信息返回变量
ToMessage mes = new ToMessage();
RedisHelper redis = new RedisHelper();
#region[存货类型接口]
///
/// 存货类型接口
///
///
[Route(template: "StockTypeSelect")]
[HttpGet]
public HttpResponseMessage StockTypeSelect()
{
try
{
mes = ProductModelBLL.StockTypeSelect();
}
catch (Exception e)
{
mes.code = "300";
mes.Message = e.Message;
}
return TJson.toJson(mes);
}
#endregion
#region[物料类型查询]
///
/// 物料类型查询
///
/// 物料类型编码
/// 物料类型名称
/// 存货类型编码
/// 页码
/// 每页显示条数
/// 排序字段
/// 排序规则
///
[Route(template: "MaterialTypeSearch")]
[HttpGet]
public HttpResponseMessage MaterialTypeSearch(string materialtypecode = null, string materialtypename = null, string stocktypecode = 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.MaterialTypeSearch(materialtypecode, materialtypename, stocktypecode, startNum, endNum, prop, order);
return TJson.toJson(mes);
}
#endregion
#region[物料类型新增编辑]
///
/// 物料类型新增编辑
///
/// 提交数据对象
///
[Route(template: "AddUpdateMaterialType")]
[HttpPost]
public HttpResponseMessage AddUpdateMaterialType([FromBody] JObject obj)
{
string materialtypeid = obj["id"].ToString(); //物料类型id(主键)
string materialtypecode = obj["materialtypecode"].ToString(); //物料类型编码
string materialtypename = obj["materialtypename"].ToString(); //物料类型名称
string stocktypecode = obj["stocktypecode"].ToString(); //存货类型编码
var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员
string OperType = obj["OperType"].ToString(); //操作类型
mes = ProductModelBLL.AddUpdateMaterialType(materialtypeid, materialtypecode, materialtypename, stocktypecode, username, OperType);
return TJson.toJson(mes);
}
#endregion
#region[物料类型删除]
///
/// 物料类型删除
///
/// 物料类型编码
///
[Route(template: "DeleteMaterialType")]
[HttpPost]
public HttpResponseMessage DeleteMaterialType(string materialtypecode)
{
mes = ProductModelBLL.DeleteMaterialType(materialtypecode);
return TJson.toJson(mes);
}
#endregion
#region[单位列表查询]
///
/// 单位列表查询
///
/// 页码
/// 每页显示条数
/// 排序字段
/// 排序规则
///
[Route(template: "UomSearch")]
[HttpGet]
public HttpResponseMessage UomSearch(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.UomSearch(startNum, endNum, prop, order);
return TJson.toJson(mes);
}
#endregion
#region[单位新增]
///
/// 单位新增
///
/// 单位提交数据
///
[Route(template: "UomAdd")]
[HttpPost]
public HttpResponseMessage UomAdd(List json)
{
var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员
mes = ProductModelBLL.UomAdd(username, json);
return TJson.toJson(mes);
}
#endregion
#region[单位删除]
///
/// 单位删除
///
/// 单位编码
///
[Route(template: "UomDelete")]
[HttpPost]
public HttpResponseMessage UomDelete(string uomcode)
{
mes = ProductModelBLL.UomDelete(uomcode);
return TJson.toJson(mes);
}
#endregion
#region[存货类型查找物料类型]
///
/// 存货类型查找物料类型
///
/// 存货类型编码
///
[Route(template: "StockTypeSelectMaterialType")]
[HttpGet]
public HttpResponseMessage StockTypeSelectMaterialType(string stocktypecode)
{
try
{
mes = ProductModelBLL.StockTypeSelectMaterialType(stocktypecode);
}
catch (Exception e)
{
mes.code = "300";
mes.Message = e.Message;
}
return TJson.toJson(mes);
}
#endregion
#region[单位下拉列表查询]
///
/// 单位下拉列表查询
///
///
[Route(template: "UomSelect")]
[HttpGet]
public HttpResponseMessage UomSelect()
{
mes = ProductModelBLL.UomSelect();
return TJson.toJson(mes);
}
#endregion
#region[存货档案查询]
///
/// 存货档案查询
///
/// 物料编码
/// 物料名称
/// 物料规格
/// 存货类型编码
/// 物料类型编码
/// 所属仓库编码
/// 页码
/// 每页显示条数
/// 排序字段
/// 排序规则
///
[Route(template: "InventoryFileSelect")]
[HttpGet]
public HttpResponseMessage InventoryFileSelect(string partcode = null, string partname = null, string partspec = null, string stocktypecode = null, string materialtypecode = null, string storehousecode = null, int page = 0, int rows = 0, string prop = null, string order = null)
{
var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //所属组织
var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //所属组织类型
int startNum = rows * (page - 1) + 1; //起始记录rowNum
int endNum = rows * page; //结束记录 rowNum
mes = ProductModelBLL.InventoryFileSelect(stu_torgcode, stu_torgtypecode,partcode, partname, partspec, stocktypecode, materialtypecode, storehousecode, startNum, endNum, prop, order);
return TJson.toJson(mes);
}
#endregion
#region[存货档案新增编辑]
///
/// 存货档案新增编辑
///
/// 提交数据对象
///
[Route(template: "AddUpdateInventoryFile")]
[HttpPost]
public HttpResponseMessage AddUpdateInventoryFile([FromBody] JObject obj)
{
string materialid = obj["id"].ToString(); //物料id(主键)
string materialcode = obj["materialcode"].ToString(); //物料编码
string materialname = obj["materialname"].ToString(); //物料名称
string materialspec = obj["materialspec"].ToString(); //物料规格
string uomcode = obj["uomcode"].ToString(); //单位编码
string warehousecode = obj["warehousecode"].ToString(); //所属仓库编码
string stocktypecode = obj["stocktypecode"].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, minstockqty, maxstockqty,is_batchno,is_fifo,is_incheck,is_outcheck, username, OperType);
return TJson.toJson(mes);
}
#endregion
#region[存货档案删除]
///
/// 存货档案删除
///
/// 物料编码
///
[Route(template: "DeleteInventoryFile")]
[HttpPost]
public HttpResponseMessage DeleteInventoryFile(string materialcode)
{
mes = ProductModelBLL.DeleteInventoryFile(materialcode);
return TJson.toJson(mes);
}
#endregion
#region[存货档案关联工艺路线查询]
///
/// 存货档案关联工艺路线查询
///
/// 物料编码
///
[Route(template: "InventoryFileAssociationRoute")]
[HttpGet]
public HttpResponseMessage InventoryFileAssociationRoute(string partcode)
{
var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //所属组织
var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //所属组织类型
mes = ProductModelBLL.InventoryFileAssociationRoute(stu_torgcode, stu_torgtypecode,partcode);
return TJson.toJson(mes);
}
#endregion
#region[存货档案关联工艺路线提交]
///
/// 存货档案关联工艺路线提交
///
/// 物料编码
/// 默认工艺路线编码
/// 提交数据对象
///
[Route(template: "SaveInventoryFile")]
[HttpPost]
public HttpResponseMessage SaveInventoryFile(string partcode, List json, string defaultroute_code = null)
{
var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //所属组织
var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //所属组织类型
var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员
mes = ProductModelBLL.SaveInventoryFile(stu_torgcode, stu_torgtypecode, partcode, defaultroute_code, username, json);
return TJson.toJson(mes);
}
#endregion
#region[物料清单主列表查询]
///
/// 物料清单主列表查询
///
/// 母件编码
/// 母件名称
/// 母件规格
/// 启用状态
/// 版本号
/// 创建人员
/// 创建日期
/// 页码
/// 分页条数
/// 排序字段
/// 排序规格
///
[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[物料清单编辑显示及预览]
///
/// 物料清单编辑显示及预览
///
/// Bom主表id
///
[Route(template: "BoIventorySelectView")]
[HttpGet]
public HttpResponseMessage BoIventorySelectView(string bomid)
{
mes = ProductModelBLL.BoIventorySelectView(bomid);
return TJson.toJson(mes);
}
#endregion
#region[物料清单新增时获取最大版本号]
///
/// 物料清单新增时获取最大版本号
///
/// 母件编码
///
[Route(template: "MaterielDetailedVsion")]
[HttpGet]
public HttpResponseMessage MaterielDetailedVsion(string parentpartcode)
{
mes = ProductModelBLL.MaterielDetailedVsion(parentpartcode);
return TJson.toJson(mes);
}
#endregion
#region[物料清单新增/编辑提交]
///
/// 物料清单新增/编辑提交
///
/// 提交数据
///
[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 objs = Newtonsoft.Json.JsonConvert.DeserializeObject>(worklist);
mes = ProductModelBLL.AddUpdateBoIventory(bomid,parentpartcode, parentpartname, parentpartspec, status, uomcode, quantity, startdate, version, username, opertype, objs);
return TJson.toJson(mes);
}
#endregion
#region[物料清单删除]
///
/// 物料清单删除
///
/// Bom主表id
///
[Route(template: "DeleteBoIventory")]
[HttpPost]
public HttpResponseMessage DeleteBoIventory(string bomid)
{
mes = ProductModelBLL.DeleteBoIventory(bomid);
return TJson.toJson(mes);
}
#endregion
#region[工序下拉查询接口]
///
/// 工序下拉查询接口
///
///
[Route(template: "StepSelect")]
[HttpGet]
public HttpResponseMessage StepSelect(string WorkShop)
{
mes = ProductModelBLL.StepSelect(WorkShop);
return TJson.toJson(mes);
}
#endregion
#region[工艺路线查询]
///
/// 工艺路线查询
///
/// 所属车间
/// 工艺路线编码
/// 工艺路线名称
/// 工艺路线描述
/// 创建人员
/// 页码
/// 每页显示条数
/// 排序字段
/// 排序规则
///
[Route(template: "RouteSearch")]
[HttpGet]
public HttpResponseMessage RouteSearch(string WorkShop=null,string routecode = null, string routename = null, string description = null, string createuser = null, int page = 0, int rows = 0, string prop = null, string order = null)
{
var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //所属组织
var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //所属组织类型
int startNum = rows * (page - 1) + 1; //起始记录rowNum
int endNum = rows * page; //结束记录 rowNum
mes = ProductModelBLL.RouteSearch(stu_torgcode, stu_torgtypecode, WorkShop, routecode, routename, description, createuser, startNum, endNum, prop, order);
return TJson.toJson(mes);
}
#endregion
#region[工艺路线预览]
///
/// 工艺路线预览
///
/// 工艺路线编码
///
[Route(template: "ViewRoute")]
[HttpGet]
public HttpResponseMessage ViewRoute(string routecode)
{
mes = ProductModelBLL.ViewRoute(routecode);
return TJson.toJson(mes);
}
#endregion
#region[工艺路线新增]
///
/// 工艺路线新增
///
/// 工艺路线id
/// 操作类型(新增)
/// 提交数据
///
[Route(template: "AddUpdateRoute")]
[HttpPost]
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);
return TJson.toJson(mes);
}
#endregion
#region[工艺路线删除]
///
/// 工艺路线删除
///
/// 工艺路线编码
///
[Route(template: "DeleteRoute")]
[HttpPost]
public HttpResponseMessage DeleteRoute(string routecode)
{
mes = ProductModelBLL.DeleteRoute(routecode);
return TJson.toJson(mes);
}
#endregion
#region[工艺路线关联产品查询]
///
/// 工艺路线关联产品查询
///
/// 物料编码
/// 物料名称
/// 物料规格
/// 存货类型编码
/// 物料类型编码
/// 所属仓库编码
///
[Route(template: "RputeInventorySearch")]
[HttpGet]
public HttpResponseMessage RputeInventorySearch(string partcode = null, string partname = null, string partspec = null, string stocktypecode = null, string materialtypecode = null, string storehousecode = null)
{
var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //所属组织
var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //所属组织类型
mes = ProductModelBLL.RputeInventorySearch(stu_torgcode, stu_torgtypecode, partcode, partname, partspec, stocktypecode, materialtypecode, storehousecode);
return TJson.toJson(mes);
}
#endregion
#region[工艺路线批量指定物料保存]
///
/// 工艺路线批量指定物料保存
///
/// 提交数据
///
[Route(template: "RouteBatchPartSave")]
[HttpPost]
public HttpResponseMessage RouteBatchPartSave([FromBody] JObject obj)
{
var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //所属组织
var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //所属组织类型
var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员
string routecode = obj["routecode"].ToString(); //工艺路线编码
string routepart = obj["routepart"].ToString(); //工艺路线绑定产品编码
string[] rolebatchpartcode = Array.ConvertAll(routepart.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[]
mes = ProductModelBLL.RouteBatchPartSave(stu_torgcode, stu_torgtypecode, username, routecode, rolebatchpartcode);
return TJson.toJson(mes);
}
#endregion
#region[工序查询]
///
/// 工序查询
///
/// 所属车间
/// 工序编码
/// 工序名称
/// 启用状态
/// 工序类型编码
/// 创建人员
/// 页码
/// 每页显示条数
/// 排序字段
/// 排序规则
///
[Route(template: "StepSearch")]
[HttpGet]
public HttpResponseMessage StepSearch(string WorkShop=null, string stepcode = null, string stepname = null, string enable = null, string steptypecode = null, string createuser = null, int page = 0, int rows = 0, string prop = null, string order = null)
{
var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //所属组织
var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //所属组织类型
int startNum = rows * (page - 1) + 1; //起始记录rowNum
int endNum = rows * page; //结束记录 rowNum
mes = ProductModelBLL.StepSearch(stu_torgcode, stu_torgtypecode, WorkShop, stepcode, stepname, enable, steptypecode, createuser, startNum, endNum, prop, order);
return TJson.toJson(mes);
}
#endregion
#region[工序新增编辑]
///
/// 工序新增编辑
///
/// 提交数据对象
///
[Route(template: "AddUpdateStep")]
[HttpPost]
public HttpResponseMessage AddUpdateStep([FromBody] JObject obj)
{
string stepid = obj["id"].ToString(); //工序id(主键)
string WorkShop = obj["WorkShop"].ToString(); //车间编码
string stepcode = obj["stepcode"].ToString(); //工序编码
string stepname = obj["stepname"].ToString(); //工序名称
string steptypecode = obj["steptypecode"].ToString(); //工序类型编码
string enable = obj["enable"].ToString(); //启用状态
string description = obj["description"].ToString(); //工序描述
var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员
string OperType = obj["OperType"].ToString(); //操作类型
mes = ProductModelBLL.AddUpdateStep(stepid, WorkShop,stepcode, stepname, steptypecode, enable, description, username, OperType);
return TJson.toJson(mes);
}
#endregion
#region[工序删除]
///
/// 工序删除
///
/// 工序编码
///
[Route(template: "DeleteStep")]
[HttpPost]
public HttpResponseMessage DeleteStep(string stepcode)
{
mes = ProductModelBLL.DeleteStep(stepcode);
return TJson.toJson(mes);
}
#endregion
#region[工序定义关联工作站查询]
///
/// 工序定义关联工作站查询
///
/// 工序编码
///
[Route(template: "StepAssociationEqp")]
[HttpGet]
public HttpResponseMessage StepAssociationEqp(string WorkShop, string stepcode)
{
mes = ProductModelBLL.StepAssociationEqp(WorkShop,stepcode);
return TJson.toJson(mes);
}
#endregion
#region [工序定义关联工作站提交]
///
/// 工序定义关联工作站提交
///
/// 所属组织编码(车间)
/// 工序编码
/// 提交数据
///
[Route(template: "SaveStepAssociationEqp")]
[HttpPost]
public HttpResponseMessage SaveStepAssociationEqp(string WorkShop, string stepcode, List json)
{
var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员
mes = ProductModelBLL.SaveStepAssociationEqp(WorkShop,stepcode, username, json);
return TJson.toJson(mes);
}
#endregion
#region[工序关联缺陷查询]
///
/// 工序关联缺陷查询
///
/// 工序编码
///
[Route(template: "StepAssociationDefect")]
[HttpGet]
public HttpResponseMessage StepAssociationDefect(string WorkShop, string stepcode)
{
mes = ProductModelBLL.StepAssociationDefect(WorkShop,stepcode);
return TJson.toJson(mes);
}
#endregion
#region[工序关联缺陷提交]
///
/// 工序关联缺陷提交
///
/// 工序编码
/// 提交数据
///
[Route(template: "SaveStepAssociationDefect")]
[HttpPost]
public HttpResponseMessage SaveStepAssociationDefect(string WorkShop, string stepcode, List json)
{
var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员
mes = ProductModelBLL.SaveStepAssociationDefect(WorkShop,stepcode, username, json);
return TJson.toJson(mes);
}
#endregion
#region[产品信息下拉框查询]
///
/// 产品信息下拉框查询
///
///
[Route(template: "PartSelect")]
[HttpGet]
public HttpResponseMessage PartSelect()
{
try
{
mes = ProductModelBLL.PartSelect();
}
catch (Exception e)
{
mes.code = "300";
mes.Message = e.Message;
}
return TJson.toJson(mes);
}
#endregion
#region[产品编码查找工艺路线下拉框]
///
/// 产品编码查找工艺路线下拉框
///
/// 产品编码
///
[Route(template: "PartSelectRpute")]
[HttpGet]
public HttpResponseMessage PartSelectRpute(string partcode)
{
try
{
var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //所属组织
var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //所属组织类型
mes = ProductModelBLL.PartSelectRpute(stu_torgcode, stu_torgtypecode,partcode);
}
catch (Exception e)
{
mes.code = "300";
mes.Message = e.Message;
}
return TJson.toJson(mes);
}
#endregion
#region[根据工艺路线编码查找关联工序集合]
///
/// 根据工艺路线编码查找关联工序集合
///
/// 工艺路线编码
///
[Route(template: "RouteSelectStep")]
[HttpGet]
public HttpResponseMessage RouteSelectStep(string routecode)
{
try
{
mes = ProductModelBLL.RouteSelectStep(routecode);
}
catch (Exception e)
{
mes.code = "300";
mes.Message = e.Message;
}
return TJson.toJson(mes);
}
#endregion
#region[根据工序线编码查找关联设备下拉框集合]
///
/// 根据工序线编码查找关联设备下拉框集合
///
/// 工序编码
///
[Route(template: "StepSelectEqp")]
[HttpGet]
public HttpResponseMessage StepSelectEqp(string stepcode)
{
mes = ProductModelBLL.StepSelectEqp(stepcode);
return TJson.toJson(mes);
}
#endregion
#region[根据工序线编码查找关联设备列表集合]
///
/// 根据工序线编码查找关联设备列表集合
///
/// 产品编码
/// 工艺路线编码
/// 工序编码
/// 工序类型
/// 页码
/// 每页显示条数
/// 排序字段
/// 排序规则
///
[Route(template: "StepSelectEqpList")]
[HttpGet]
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.StepSelectEqpList(partcode, routecode, stepcode, steptype, startNum, endNum, prop, order);
return TJson.toJson(mes);
}
#endregion
#region[节拍工价查询]
///
/// 节拍工价查询
///
/// 产品编码
/// 工艺路线编码
/// 工序编码
/// 设备编码
/// 页码
/// 每页显示条数
/// 排序字段
/// 排序规则
///
[Route(template: "BeatRateSearch")]
[HttpGet]
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)
{
var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //所属组织
var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //所属组织类型
int startNum = rows * (page - 1) + 1; //起始记录rowNum
int endNum = rows * page; //结束记录 rowNum
mes = ProductModelBLL.BeatRateSearch(stu_torgcode, stu_torgtypecode,partcode, routecode, stepcode, eqpcode, startNum, endNum, prop, order);
return TJson.toJson(mes);
}
#endregion
#region[节拍工价提交]
///
/// 节拍工价提交
///
/// 提交数据
///
[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[节拍工价删除]
///
/// 节拍工价删除
///
/// 产品编码
/// 工艺路线编码
/// 工序编码
/// 设备编码
///
[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
}
}