天津投入产出系统后端
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.

72 lines
2.6 KiB

7 months ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Http;
using WebAPI.App_Start;
using WebAPI.Models;
using Newtonsoft.Json.Converters;
using QMAPP.MD.Entity.Bucket;
namespace WebAPI.Controllers
{
/// <summary>
/// 注塑投料
/// </summary>
public class WareController : ApiController
{
/// <summary>
/// 泡沫投料种类
/// </summary>
/// <param name="BucketCode"></param>
/// <param name="RawMaterial"></param>
/// <returns></returns>
[HttpGet]
public Response<List<TypeList>> GetTypeList()
{
var result = new Response<List<TypeList>>();
var dic_list = new List<TypeList>();
var sqlScript = $"select * from T_MD_BucketMaterialClassPaomo where IsCheck = '0' ";
DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, sqlScript);
if (dataSet.Tables[0].Rows.Count >= 0)
{
foreach (DataRow row in dataSet.Tables[0].Rows)
{
var dic = new TypeList();
dic.Code = row["RawMaterial"].ToString();
dic.Name = row["MaterialName"].ToString();
dic_list.Add(dic);
}
}
result.Result = dic_list;
return result;
}
/// <summary>
/// 泡沫投料 插入
/// </summary>
/// <returns></returns>
//{"planNumber":"DP20230109004","materialName":"NBT催化剂3","materialCode":"C45050101","materialQty":"10","id":"admin","createTime":"2024-04-07 11:11:21"} 原料投入泡沫提交的参数这样可以吗
public async Task<IHttpActionResult> Insert()
{
var request = await this.Request.Content.ReadAsStringAsync();
var requeststr = request.Replace("\r", "").Replace("\n", "");
var resObj = JsonHelper.Instance.JsonToObj<ReceiveWare>(requeststr);
var sql = $"INSERT INTO [dbo].[T_MD_RawMaterialPaomo] ([PID], [planNumber], [materialName], [materialCode], [materialQty], [UserName], [CreateTime], [Remark1], [Remark2], [Remark3]) VALUES" +
4 months ago
$" (N'{Guid.NewGuid()}', N'{resObj.planNumber.Substring(0, 14)}', N'{resObj.materialName}', N'{resObj.materialCode}', N'{resObj.materialQty}', N'{resObj.id}', '{DateTime.Now}', NULL, NULL, NULL);";
7 months ago
SqlData.InsertWare(sql);
var Response = new Response();
return Ok(Response);
}
}
}