using Newtonsoft.Json.Linq;
|
using System;
|
using System.Collections.Generic;
|
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/BasicSetting")]
|
[ControllerGroup("制造模型", "在线接口")]
|
public class ProductModelController : ApiController
|
{
|
//定义全局信息返回变量
|
ToMessage mes = new ToMessage();
|
RedisHelper redis = new RedisHelper();
|
|
#region[存货类型接口]
|
/// <summary>
|
/// 存货类型接口
|
/// </summary>
|
/// <returns></returns>
|
[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[物料类型查询]
|
/// <summary>
|
/// 物料类型查询
|
/// </summary>
|
/// <param name="materialtypecode">物料类型编码</param>
|
/// <param name="materialtypename">物料类型名称</param>
|
/// <param name="stocktypecode">存货类型编码</param>
|
/// <param name="page">页码</param>
|
/// <param name="rows">每页显示条数</param>
|
/// <param name="prop">排序字段</param>
|
/// <param name="order">排序规则</param>
|
/// <returns></returns>
|
[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[物料类型新增编辑]
|
/// <summary>
|
/// 物料类型新增编辑
|
/// </summary>
|
/// <param name="obj">提交数据对象</param>
|
/// <returns></returns>
|
[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[物料类型删除]
|
/// <summary>
|
/// 物料类型删除
|
/// </summary>
|
/// <param name="materialtypecode">物料类型编码</param>
|
/// <returns></returns>
|
[Route(template: "DeleteMaterialType")]
|
[HttpPost]
|
public HttpResponseMessage DeleteMaterialType(string materialtypecode)
|
{
|
mes = ProductModelBLL.DeleteMaterialType(materialtypecode);
|
return TJson.toJson(mes);
|
}
|
#endregion
|
|
|
|
|
|
#region[单位列表查询]
|
/// <summary>
|
/// 单位列表查询
|
/// </summary>
|
/// <param name="page">页码</param>
|
/// <param name="rows">每页显示条数</param>
|
/// <param name="prop">排序字段</param>
|
/// <param name="order">排序规则</param>
|
/// <returns></returns>
|
[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[单位新增]
|
/// <summary>
|
/// 单位新增
|
/// </summary>
|
/// <param name="json">单位提交数据</param>
|
/// <returns></returns>
|
[Route(template: "UomAdd")]
|
[HttpPost]
|
public HttpResponseMessage UomAdd(List<Uom> json)
|
{
|
var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员
|
mes = ProductModelBLL.UomAdd(username,json);
|
return TJson.toJson(mes);
|
}
|
#endregion
|
|
#region[单位删除]
|
/// <summary>
|
/// 单位删除
|
/// </summary>
|
/// <param name="uomcode">单位编码</param>
|
/// <returns></returns>
|
[Route(template: "UomDelete")]
|
[HttpPost]
|
public HttpResponseMessage UomDelete(string uomcode)
|
{
|
mes = ProductModelBLL.UomDelete(uomcode);
|
return TJson.toJson(mes);
|
}
|
#endregion
|
|
#region[存类型查找物料类型]
|
/// <summary>
|
/// 存类型查找物料类型
|
/// </summary>
|
/// <param name="stocktypecode">存货类型编码</param>
|
/// <returns></returns>
|
[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[存货档案查询]
|
/// <summary>
|
/// 存货档案查询
|
/// </summary>
|
/// <param name="partcode"></param>
|
/// <param name="partname"></param>
|
/// <param name="partspec"></param>
|
/// <param name="stocktypecode"></param>
|
/// <param name="materialtypecode"></param>
|
/// <param name="storehousecode"></param>
|
/// <param name="page"></param>
|
/// <param name="rows"></param>
|
/// <param name="prop"></param>
|
/// <param name="order"></param>
|
/// <returns></returns>
|
[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)
|
{
|
int startNum = rows * (page - 1) + 1; //起始记录rowNum
|
int endNum = rows * page; //结束记录 rowNum
|
mes = ProductModelBLL.InventoryFileSelect(partcode, partname, partspec, stocktypecode, materialtypecode, storehousecode, startNum, endNum, prop, order);
|
return TJson.toJson(mes);
|
}
|
#endregion
|
|
#region[存货档案新增编辑]
|
/// <summary>
|
/// 存货档案新增编辑
|
/// </summary>
|
/// <param name="obj">提交数据对象</param>
|
/// <returns></returns>
|
[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 materialtypecode = obj["materialtypecode"].ToString(); //物料类型编码
|
string minstockqty = obj["minstockqty"].ToString(); //最小库存
|
string maxstockqty = obj["maxstockqty"].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);
|
return TJson.toJson(mes);
|
}
|
#endregion
|
|
#region[存货档案删除]
|
/// <summary>
|
/// 存货档案删除
|
/// </summary>
|
/// <param name="materialcode">物料编码</param>
|
/// <returns></returns>
|
[Route(template: "DeleteInventoryFile")]
|
[HttpPost]
|
public HttpResponseMessage DeleteInventoryFile(string materialcode)
|
{
|
mes = ProductModelBLL.DeleteInventoryFile(materialcode);
|
return TJson.toJson(mes);
|
}
|
#endregion
|
|
#region[存货档案关联工艺路线查询]
|
/// <summary>
|
/// 存货档案关联工艺路线查询
|
/// </summary>
|
/// <param name="partcode">物料编码</param>
|
/// <returns></returns>
|
[Route(template: "InventoryFileAssociationRoute")]
|
[HttpGet]
|
public HttpResponseMessage InventoryFileAssociationRoute(string partcode)
|
{
|
mes = ProductModelBLL.InventoryFileAssociationRoute(partcode);
|
return TJson.toJson(mes);
|
}
|
#endregion
|
|
#region[存货档案关联工艺路线提交]
|
|
#endregion
|
|
}
|
}
|