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.Threading.Tasks; using System.Web.Http; using WebAPI.App_Start; using WebAPI.Models; namespace WebAPI.Controllers { public class BeginShiftController : ApiController { public async Task Insert() { var request = await this.Request.Content.ReadAsStringAsync(); var requeststr = request.Replace("\r", "").Replace("\n", ""); var resObj = JsonHelper.Instance.JsonToObj(requeststr); var sql = $"select * from T_PA_InOutPut_BeginShift where ProductCode = '{resObj.ProductCode}' "; DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, sql); if (dataSet.Tables[0].Rows.Count <= 0) { var sql2 = $"INSERT INTO [dbo].[T_PA_InOutPut_BeginShift] ([PID], [ProductCode], [CreateUser], [CreateDate], [Remark1], [Remark2], [Remark3]) VALUES " + $"(NEWID(), '{resObj.ProductCode}', '{resObj.CreateUser}', '{DateTime.Now}', NULL, NULL, NULL);"; SqlData.InsertWare(sql2); } else { var ResponseNOK = new Response(); ResponseNOK.Code = 400; ResponseNOK.Message = "禁止重复操作!"; return Ok(ResponseNOK); } var Response = new Response(); return Ok(Response); } } }