using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using VueWebCoreApi.DLL.BLL;
using VueWebCoreApi.Tools;
namespace VueWebCoreApi.Controllers
{
[ApiExplorerSettings(GroupName = "SOP任务管理")]
[ApiController]
[Route("api/[controller]")]
public class SopSearchController : Controller
{
//定义全局信息返回变量
ToMessage mes = new ToMessage();
RedisCommon redis = new RedisCommon();
#region[MES工单查询]
///
/// MES工单查询
///
/// 工单状态码
/// 车间编码
/// 工单编号
/// 源单单号
/// 销售单号
/// 单据类型
/// 产品编码
/// 产品名称
/// 产品规格
/// 日期类型(计划开工(PS)、计划完工(PE)、预计交付(ED)、创建日期(CT))
/// 创建人员
/// 查询日期
/// 页码
/// 每页显示条数
/// 排序字段
/// 排序规则
///
[Route(template: "MesOrderSearch")]
[HttpGet]
public JsonResult MesOrderSearch(int page, int rows, string prop, string order, string mesorderstus = null, string wkshopcode = null, string mesordercode = null, string sourceorder = null, string saleordercode = null, string ordertype = null, string partcode = null, string partname = null, string partspec = null, string creatuser = null, string datatype = null, string searchdate = null)
{
string paydatestartdate = ""; //预计开工开始时间
string paydateenddate = ""; //预计开工结束时间
if (searchdate != "" && searchdate != null)
{
paydatestartdate = searchdate.Split('~')[0].ToString();
paydateenddate = searchdate.Split('~')[1].ToString();
}
int startNum = rows * (page - 1) + 1; //起始记录rowNum
int endNum = rows * page; //结束记录 rowNum
mes = SopSearchBLL.MesOrderSearch(mesorderstus, wkshopcode, mesordercode, sourceorder, saleordercode, ordertype, partcode, partname, partspec, startNum, creatuser, datatype, paydatestartdate, paydateenddate, endNum, prop, order);
return Json(mes);
}
#endregion
#region[MES工单编辑获取工序数据]
///
/// MES工单编辑获取工序数据
///
/// 源单id
/// 源单单号
/// 工单号
/// 数据来源:ERP/MES
///
[Route(template: "UpdateMesOrderStepSearch")]
[HttpGet]
public JsonResult UpdateMesOrderStepSearch(string sourceid, string sourcewo, string wocode, string data_sources)
{
mes = SopSearchBLL.UpdateMesOrderStepSearch(sourceid, sourcewo, wocode, data_sources);
return Json(mes);
}
#endregion
#region[MES工单查看工艺SOP]
///
/// MES工单查看工艺SOP
///
/// 产品编码
/// 工艺路线编码
/// 工序编码
///
[Route(template: "MesOrderProcessSopSearch")]
[HttpGet]
public JsonResult MesOrderProcessSopSearch(string materielcode, string routecode, string stepcode)
{
mes = SopSearchBLL.MesOrderProcessSopSearch(materielcode, routecode, stepcode);
return Json(mes);
}
#endregion
}
}