张松男
8 months ago
14 changed files with 656 additions and 58 deletions
@ -0,0 +1,99 @@ |
|||
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; |
|||
|
|||
namespace WebAPI.Controllers |
|||
{ |
|||
/// <summary>
|
|||
/// 泡沫、注塑点检
|
|||
/// </summary>
|
|||
public class MachineController : ApiController |
|||
{ |
|||
/// <summary>
|
|||
/// 点检录入
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public async Task<IHttpActionResult> InsertZhusu() |
|||
{ |
|||
var request = await this.Request.Content.ReadAsStringAsync(); |
|||
|
|||
var requeststr = request.Replace("\r", "").Replace("\n", ""); |
|||
|
|||
var resObj = JsonHelper.Instance.JsonToObj<ReceiveMachine>(requeststr); |
|||
|
|||
var group = "";//班次
|
|||
switch (resObj.groupValue) |
|||
{ |
|||
case "1": |
|||
group = "三班"; |
|||
break; |
|||
case "2": |
|||
group = "白班"; |
|||
break; |
|||
case "3": |
|||
group = "二班"; |
|||
break; |
|||
} |
|||
var item = resObj.dataList[resObj.dataList.Count - 1]; |
|||
|
|||
|
|||
for (var i = 0; i < resObj.dataList.Count - 1; i++) |
|||
{ |
|||
var t = new MachineValue(); |
|||
t.UserName = resObj.id; |
|||
t.MachineCode = resObj.dataList[i].PID; |
|||
t.Name = resObj.dataList[i].Content; |
|||
t.Type = resObj.dataList[i].Type; |
|||
t.Group = group; |
|||
t.UserName = resObj.id; |
|||
|
|||
if (resObj.dataList[i].Type == "3") |
|||
{ |
|||
t.MValue = resObj.dataList[i].putMachine[0].SelectName; |
|||
t.PValue = resObj.dataList[i].putMachine[1].SelectName; |
|||
} |
|||
else |
|||
{ |
|||
if (resObj.dataList[i].Type == "1") |
|||
{ |
|||
switch (resObj.dataList[i].SelectValue) |
|||
{ |
|||
case "1": |
|||
t.MValue = "状态良好"; |
|||
break; |
|||
case "2": |
|||
t.MValue = "正在处理"; |
|||
break; |
|||
case "3": |
|||
t.MValue = "状态不好或损毁"; |
|||
break; |
|||
case "4": |
|||
t.MValue = "停机状态"; |
|||
break; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
t.MValue = resObj.dataList[i].SelectValue; |
|||
} |
|||
} |
|||
|
|||
var sqlScript = $"INSERT INTO [dbo].[T_MD_PutMachineValueZhusu] ([PID], [MachineCode], [Name], [Type], [MValue], [Group], [UserName], [CreateData], [Remark1], [Remark2], [Remark3], [PValue]) VALUES (" + |
|||
$"N'{Guid.NewGuid()}', N'{t.MachineCode}', N'{t.Name}', N'{t.Type}', N'{t.MValue}', N'{t.Group}', N'{t.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fffffff")}', NULL, NULL, NULL, N'{t.PValue}');"; |
|||
|
|||
|
|||
SqlData.InsertWare(sqlScript); |
|||
} |
|||
|
|||
var Response = new Response(); |
|||
|
|||
return Ok(Response); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,71 @@ |
|||
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" + |
|||
$" (N'{Guid.NewGuid()}', N'{resObj.planNumber}', N'{resObj.materialName}', N'{resObj.materialCode}', N'{resObj.materialQty}', N'{resObj.id}', '{DateTime.Now}', NULL, NULL, NULL);"; |
|||
|
|||
SqlData.InsertWare(sql); |
|||
|
|||
var Response = new Response(); |
|||
|
|||
return Ok(Response); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,72 @@ |
|||
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 WareHouseController : ApiController |
|||
{ |
|||
|
|||
//T_MD_RawMaterial 投料信息
|
|||
//T_MD_BUCKETINFO 料筒信息
|
|||
//T_MD_BucketMaterial 料筒绑定
|
|||
//T_MD_BucketMaterialClass 零件号绑定
|
|||
[HttpGet] |
|||
public Response IsPass(string BucketCode, string RawMaterial) |
|||
{ |
|||
var result = new Response(); |
|||
|
|||
var sqlScript = $"select * from T_MD_BucketMaterial where BucketCode = '{BucketCode}' and RawMaterial = '{RawMaterial}' and IsCheck = '0' "; |
|||
DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, sqlScript); |
|||
|
|||
if (dataSet.Tables[0].Rows.Count <= 0) |
|||
{ |
|||
result.Code = 201; |
|||
result.Message = "料筒与原料不符!"; |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
// {"batchCode": "20240407",
|
|||
// "bucketCode": "1500T-9",
|
|||
// "createTime": "2024-04-07 14:43:47",
|
|||
// "id": 1,
|
|||
// "itemCode": "I01022501",
|
|||
// "planNumber": "DP20230109004",
|
|||
// "referenceCode": "123",
|
|||
// "supplierCode": "001",
|
|||
// "weight": "10"
|
|||
//}
|
|||
|
|||
public async Task<IHttpActionResult> Insert() |
|||
{ |
|||
var request = await this.Request.Content.ReadAsStringAsync(); |
|||
|
|||
var requeststr = request.Replace("\r", "").Replace("\n", ""); |
|||
|
|||
var resObj = JsonHelper.Instance.JsonToObj<ReceiveWareHouse>(requeststr); |
|||
|
|||
|
|||
var sql = $"INSERT INTO[dbo].[T_MD_RawMaterial] ([PID], [BucketCode], [PartCode], [BatchCode], [SerialCode], [IsCheck], [CREATEUSER], [CREATEDATE], [planNumber], [supplierCode], [weight]) VALUES" + |
|||
$" ('{Guid.NewGuid()}', '{resObj.bucketCode}', '{resObj.itemCode}', '{resObj.batchCode}', '{resObj.referenceCode}', '0', '{resObj.id}', '{DateTime.Now}', '{resObj.planNumber}', '{resObj.supplierCode}', '{resObj.weight}');"; |
|||
|
|||
|
|||
SqlData.InsertWare(sql); |
|||
|
|||
var Response = new Response(); |
|||
|
|||
return Ok(Response); |
|||
} |
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
|
|||
namespace WebAPI.Models |
|||
{ |
|||
public class InsertMachineValue |
|||
{ |
|||
public string MachineCode { get; set; } |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,63 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
|
|||
namespace WebAPI.Models |
|||
{ |
|||
public class OrderPlan_PaoMo |
|||
{ |
|||
public string PID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划号
|
|||
/// </summary>
|
|||
public string PLAN_NO { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划顺序号
|
|||
/// </summary>
|
|||
public string PLAN_SEQ { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划状态
|
|||
/// </summary>
|
|||
public string PLAN_STATE { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
public string MATERIAL_CODE { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 绑定BOM
|
|||
/// </summary>
|
|||
public string PBOM_CODE { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 绑定工艺路线
|
|||
/// </summary>
|
|||
public string ROUTE_CODE { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划数量
|
|||
/// </summary>
|
|||
public string QTY { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 完成数
|
|||
/// </summary>
|
|||
public string COMPLETE_QTY { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划日期
|
|||
/// </summary>
|
|||
public string PLAN_DATE { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划班次
|
|||
/// </summary>
|
|||
public string SHIFT_CODE { get; set; } |
|||
|
|||
} |
|||
} |
@ -0,0 +1,63 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
|
|||
namespace WebAPI.Models |
|||
{ |
|||
public class OrderPlan_ZhuSu |
|||
{ |
|||
public string PID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划号
|
|||
/// </summary>
|
|||
public string PLAN_NO { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划顺序号
|
|||
/// </summary>
|
|||
public string PLAN_SEQ { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划状态
|
|||
/// </summary>
|
|||
public string PLAN_STATE { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
public string MATERIAL_CODE { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 绑定BOM
|
|||
/// </summary>
|
|||
public string PBOM_CODE { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 绑定工艺路线
|
|||
/// </summary>
|
|||
public string ROUTE_CODE { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划数量
|
|||
/// </summary>
|
|||
public string QTY { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 完成数
|
|||
/// </summary>
|
|||
public string COMPLETE_QTY { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划日期
|
|||
/// </summary>
|
|||
public string PLAN_DATE { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划班次
|
|||
/// </summary>
|
|||
public string SHIFT_CODE { get; set; } |
|||
|
|||
} |
|||
} |
@ -0,0 +1,47 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
|
|||
namespace WebAPI.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 泡沫投料
|
|||
/// </summary>
|
|||
public class ReceiveWare |
|||
{ |
|||
/// <summary>
|
|||
/// 计划号
|
|||
/// </summary>
|
|||
public string planNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 原料名称
|
|||
/// </summary>
|
|||
public string materialName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 原料名称
|
|||
/// </summary>
|
|||
public string materialCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 投料数量
|
|||
/// </summary>
|
|||
public string materialQty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 投料人
|
|||
/// </summary>
|
|||
public string id { get; set; } |
|||
|
|||
public string createTime { get; set; } |
|||
} |
|||
|
|||
public class TypeList |
|||
{ |
|||
public string Code { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,52 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
|
|||
namespace WebAPI.Models |
|||
{ |
|||
public class ReceiveWareHouse |
|||
{ |
|||
/// <summary>
|
|||
/// 料筒号
|
|||
/// </summary>
|
|||
public string bucketCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 批次号
|
|||
/// </summary>
|
|||
public string batchCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 投料人
|
|||
/// </summary>
|
|||
public string id { get; set; } |
|||
|
|||
public string createTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
public string itemCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 计划号
|
|||
/// </summary>
|
|||
public string planNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 参考号
|
|||
/// </summary>
|
|||
public string referenceCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 供应商编码
|
|||
/// </summary>
|
|||
public string supplierCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 投料值
|
|||
/// </summary>
|
|||
public string weight { get; set; } |
|||
} |
|||
} |
Loading…
Reference in new issue