天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

118 lines
5.1 KiB

using QMAPP.BLL.Sys;
using QMAPP.DAL.Sys;
using QMAPP.Entity.Sys;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPI.App_Start;
using WebAPI.Models;
namespace WebAPI.Controllers
{
public class PlanController : ApiController
{
public Response<List<OrderPlan_PaoMo>> GetList(string Type)
{
var result = new Response<List<OrderPlan_PaoMo>>();
List<OrderPlan_PaoMo> List_plan = new List<OrderPlan_PaoMo>();
//var time = Convert.ToDateTime(data);
//var sqlScript = $"select * from T_PP_ORDERPLAN_PAOMO where PLAN_DATE >='{time.AddDays(-2).ToString("yyyy-MM-dd")} 00:00:00' and PLAN_DATE <= '{time.ToString("yyyy-MM-dd")} 23:49:59'";
var sqlScript = "";
if (Type == "paomo")
{
//sqlScript = $"select top 10 * from T_PP_ORDERPLAN_PAOMO order by PLAN_DATE desc";
sqlScript = $"select p.*,m.MATERIAL_NAME from T_PP_ORDERPLAN_PAOMO p left join T_MD_MATERIAL m on m.MATERIAL_CODE = p.MATERIAL_CODE where p.PLAN_STATE = '0' order by p.PLAN_DATE desc,p.PLAN_NO";
}
else if (Type == "zhusu")
{
sqlScript = $"select p.*,m.MATERIAL_NAME from T_PP_ORDERPLAN_ZHUSU p left join T_MD_MATERIAL m on m.MATERIAL_CODE = p.MATERIAL_CODE where p.PLAN_STATE = '0' order by p.PLAN_DATE desc,p.PLAN_NO";
//sqlScript = $"select top 10 * from T_PP_ORDERPLAN_ZHUSU order by PLAN_DATE desc";
}
DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, sqlScript);
if (dataSet.Tables[0].Rows.Count > 0)
{
foreach (DataRow row in dataSet.Tables[0].Rows)
{
OrderPlan_PaoMo OrderPlan = new OrderPlan_PaoMo();
OrderPlan.PID = row["PID"].ToString();
//OrderPlan.PLAN_NO = row["PLAN_NO"].ToString();
OrderPlan.PLAN_NO = row["PLAN_NO"].ToString() + "\n" + row["MATERIAL_NAME"].ToString();
OrderPlan.PLAN_SEQ = row["PLAN_SEQ"].ToString();
OrderPlan.PLAN_STATE = row["PLAN_STATE"].ToString();
OrderPlan.MATERIAL_CODE = row["MATERIAL_CODE"].ToString();
OrderPlan.PBOM_CODE = row["PBOM_CODE"].ToString();
OrderPlan.ROUTE_CODE = row["ROUTE_CODE"].ToString();
OrderPlan.QTY = row["QTY"].ToString();
OrderPlan.COMPLETE_QTY = row["COMPLETE_QTY"].ToString();
OrderPlan.PLAN_DATE = row["PLAN_DATE"].ToString();
OrderPlan.SHIFT_CODE = row["SHIFT_CODE"].ToString();
List_plan.Add(OrderPlan);
}
result.Result = List_plan;
}
else
{
result.Code = 201;
result.Message = "用户信息不存在";
}
return result;
}
//public Response<List<OrderPlan_ZhuSu>> GetZhuSuList(string data)
//{
// var result = new Response<List<OrderPlan_ZhuSu>>();
// List<OrderPlan_ZhuSu> List_plan = new List<OrderPlan_ZhuSu>();
// //var sqlScript = $"select * from T_PP_ORDERPLAN_ZHUSU where PLAN_DATE >='{DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd")} 00:00:00' and PLAN_DATE <= '{DateTime.Now.ToString("yyyy-MM-dd")} 00:00:00'";
// var sqlScript = $"select top 10 * from T_PP_ORDERPLAN_ZHUSU order by PLAN_DATE desc";
// DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, sqlScript);
// if (dataSet.Tables[0].Rows.Count > 0)
// {
// foreach (DataRow row in dataSet.Tables[0].Rows)
// {
// OrderPlan_ZhuSu OrderPlan = new OrderPlan_ZhuSu();
// OrderPlan.PID = row["PID"].ToString();
// OrderPlan.PLAN_NO = row["PLAN_NO"].ToString();
// OrderPlan.PLAN_SEQ = row["PLAN_SEQ"].ToString();
// OrderPlan.PLAN_STATE = row["PLAN_STATE"].ToString();
// OrderPlan.MATERIAL_CODE = row["MATERIAL_CODE"].ToString();
// OrderPlan.PBOM_CODE = row["PBOM_CODE"].ToString();
// OrderPlan.ROUTE_CODE = row["ROUTE_CODE"].ToString();
// OrderPlan.QTY = row["QTY"].ToString();
// OrderPlan.COMPLETE_QTY = row["COMPLETE_QTY"].ToString();
// OrderPlan.PLAN_DATE = row["PLAN_DATE"].ToString();
// OrderPlan.SHIFT_CODE = row["SHIFT_CODE"].ToString();
// List_plan.Add(OrderPlan);
// }
// result.Result = List_plan;
// }
// else
// {
// result.Code = 201;
// result.Message = "用户信息不存在";
// }
// return result;
//}
}
}