一厂MES,含注塑,喷涂,冲孔
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.

106 lines
4.0 KiB

3 months ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
using Tools;
using Webservice;
using WebService.Model;
namespace WebService
{
/// <summary>
/// MistakeWebService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
// [System.Web.Script.Services.ScriptService]
public class MistakeWebService : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void CheckPaint(string app_id, string DeviceNo, string PartNo, string sign)
{
string errorReason = "";
JsonModel<NoModel> model = new JsonModel<NoModel>();
model.Result = "0";
model.ResultType = "Result";
model.ResultRowsCount = "0";
model.ErrReason = errorReason;
model.DataList = null;
#region 参数判断
if (string.IsNullOrWhiteSpace(app_id))
{
model.ErrReason = "缺少必要传入参数 app_id";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(DeviceNo))
{
model.ErrReason = "缺少必要传入参数 DeviceNo";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(PartNo))
{
model.ErrReason = "缺少必要传入参数 DeviceNo";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(sign))
{
model.ErrReason = "缺少必要传入参数 sign";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
bool access = Function.AppIDIsRight(app_id.Trim());
if (!access)
{
model.ErrReason = "APP接口调用标识不正确 远程服务器拒绝了此次连接请求";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
string[] param = { Function.app_secret.Trim(), DeviceNo.Trim(), PartNo.Trim() };
bool paramIsRight = Function.signIsRight(param, sign);
if (!paramIsRight)
{
model.ErrReason = "sign参数传输错误 远程服务器拒绝了此次连接请求";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
#endregion
DataTable dt = Function.IsMatchDeviceAndPart(DeviceNo, PartNo, out errorReason);
if (dt != null && dt.Rows.Count > 0)
{
model.Result = "1";
}
else
{
model.Result = "0";
}
model.ErrReason = errorReason;
model.ResultRowsCount = dt.Rows.Count.ToString();
model.DataList = null;
LogHelper.WriteSysLogBase("【加漆防错-油漆和油漆桶匹配】入参:DeviceNo:" + DeviceNo + ",PartNo:" + PartNo + ",出参:" + JSONTools.ScriptSerialize<JsonModel<NoModel>>(model), MethodBase.GetCurrentMethod().Name);
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
}
}
}