一厂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.
 
 
 
 
 

792 lines
33 KiB

using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Web.Script.Services;
using System.Web.Services;
using Tools;
using WebService.Model;
namespace Webservice
{
/// <summary>
/// AppWebservice 的摘要说明
/// </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 AppWebservice : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void MD5Encrypt(string str)
{
string errorReason = "";
JsonModel<NoModel> model = new JsonModel<NoModel>();
model.Result = "0";
model.ResultType = "List";
model.ResultRowsCount = "0";
model.ErrReason = errorReason;
model.DataList = null;
List<NoModel> res = new List<NoModel>();
if (!string.IsNullOrWhiteSpace(str))
{
DataTable dt = new DataTable();
dt.Columns.Add("result");
DataRow dr = dt.NewRow();
dr[0] = Function.MD5Encryption(str);
dt.Rows.Add(dr);
res = Tools.DataTableToList.ConvertTo<NoModel>(dt);
model.Result = "1";
model.ResultRowsCount = "1";
model.DataList = res;
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
}
else
{
model.ErrReason = "缺少必要的传入参数 服务器拒绝了此次连接请求";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
}
/// <summary>
/// 根据塑料粒子条码查询加料信息
/// lx 20190527
/// </summary>
/// <param name="app_id"></param>
/// <param name="particleCode"></param>
/// <param name="sign"></param>
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void GetInfoByParticles(string app_id, string particleCode, string sign)
{
string errorReason = "";
JsonModel<InfoModel> model = new JsonModel<InfoModel>();
model.Result = "0";
model.ResultType = "Result";
model.ResultRowsCount = "0";
model.ErrReason = errorReason;
model.DataList = null;
LogHelper.WriteSysLogBase("根据塑料粒子查询加料信息,入参particleCode=" + particleCode, MethodBase.GetCurrentMethod().Name);
#region 参数判断
if (string.IsNullOrWhiteSpace(app_id))
{
model.ErrReason = "缺少必要传入参数 app_id";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<InfoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(particleCode))
{
model.ErrReason = "缺少必要传入参数 particleCode";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<InfoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(sign))
{
model.ErrReason = "缺少必要传入参数 sign";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<InfoModel>>(model));
return;
}
bool access = Function.AppIDIsRight(app_id.Trim());
if (!access)
{
model.ErrReason = "APP接口调用标识不正确 远程服务器拒绝了此次连接请求";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<InfoModel>>(model));
return;
}
string[] param = { Function.app_secret.Trim(), particleCode.Trim() };
bool paramIsRight = Function.signIsRight(param, sign);
if (!paramIsRight)
{
model.ErrReason = "sign参数传输错误 远程服务器拒绝了此次连接请求";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<InfoModel>>(model));
return;
}
#endregion
#region 解析塑料粒子条码
//解析塑料粒子条码,长度为20的为一维码,否则为二维码
//二维码样例Z-340.180411.000001;5000;S35001;20180411;P1710401.[#Line#];180411;
//第一个分号之前的数据,即Z-340.180411.000001; Z-340为零件号,180411为批次号,000001为流水号
//一维码前十位为零件号,tb_Product PartNo,11~16位为批次
string stockNo = ""; //存货代码
string batchNo = ""; //批次
string partNo = ""; //零件号
Function.GetCode(particleCode, out stockNo, out batchNo, out partNo);
#endregion
if (!string.IsNullOrWhiteSpace(stockNo) || !string.IsNullOrWhiteSpace(partNo))
{
DataTable dt = Function.GetInfoByParticles(stockNo, partNo, out errorReason);
List<InfoModel> listInfo = new List<InfoModel>();
if (dt.Rows.Count < 1)
{
model.Result = "0";
errorReason = "根据零件号:" + partNo + "查询不到塑料粒子信息";
}
else
{
model.Result = "1";
InfoModel info = new InfoModel();
info.Code = dt.Rows[0]["StockNo"].ToString(); ;
info.Name = dt.Rows[0]["ProductName"].ToString();
info.Type = dt.Rows[0]["PartNo"].ToString();
info.CarType = "塑料粒子";
info.Color = dt.Rows[0]["ColorName"].ToString();
info.Batch = batchNo;
info.Stock = "";
listInfo.Add(info);
}
model.ErrReason = errorReason;
model.ResultRowsCount = dt.Rows.Count.ToString();
model.DataList = listInfo;
LogHelper.WriteSysLogBase("APP根据塑料粒子查询加料信息,入参particleCode=" + particleCode + ",出参:" + JSONTools.ScriptSerialize<JsonModel<InfoModel>>(model), MethodBase.GetCurrentMethod().Name);
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<InfoModel>>(model));
}
else
{
model.Result = "0";
model.ErrReason = "塑料粒子条码格式错误,无法解析";
model.ResultRowsCount = "0";
model.DataList = null;
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<InfoModel>>(model));
}
}
/// <summary>
/// 料筒与塑料粒子关系绑定
/// lx 20190527
/// </summary>
/// <param name="app_id"></param>
/// <param name="particleCode">塑料粒子</param>
/// /// <param name="drumCode">料筒</param>
/// <param name="sign"></param>
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void BindparticleCodeAndDrum(string app_id, string particleCode, string drumCode, 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;
LogHelper.WriteSysLogBase("料筒与塑料粒子关系绑定,入参particleCode=" + particleCode + "drumCode=" + drumCode, MethodBase.GetCurrentMethod().Name);
#region 参数判断
if (string.IsNullOrWhiteSpace(app_id))
{
model.ErrReason = "缺少必要传入参数 app_id";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(particleCode))
{
model.ErrReason = "缺少必要传入参数 particleCode";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(drumCode))
{
model.ErrReason = "缺少必要传入参数 drumCode";
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(), particleCode.Trim(), drumCode.Trim() };
bool paramIsRight = Function.signIsRight(param, sign);
if (!paramIsRight)
{
model.ErrReason = "sign参数传输错误 远程服务器拒绝了此次连接请求";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
#endregion
#region 20200927注销:查询当前料筒是否已经绑定塑料粒子和注塑机,如果有绑定则提示解绑;如果没绑定注塑机,绑定了塑料粒子,则解绑之前的塑料粒子
//bool isBind = Function.QueryIsBind(particleCode, drumCode, out errorReason);
//if (isBind)
//{
// model.ErrReason = errorReason;
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
// return;
//}
#endregion
#region 解绑之前的塑料粒子
Function.UnBindParticleAndDrum(drumCode, out errorReason);
#endregion
int res = Function.BindparticleCodeAndDrum(particleCode, drumCode, out errorReason);
if (res < 1)
{
model.Result = "0";
}
else
{
model.Result = "1";
}
model.ErrReason = errorReason;
model.ResultRowsCount = res.ToString();
model.DataList = null;
LogHelper.WriteSysLogBase("APP料筒与塑料粒子关系绑定,入参particleCode=" + particleCode + "drumCode=" + drumCode + ",出参:" + JSONTools.ScriptSerialize<JsonModel<NoModel>>(model), MethodBase.GetCurrentMethod().Name);
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
}
/// <summary>
/// 根据注塑机条码查询计划信息
/// lx 20190527
/// </summary>
/// <param name="app_id"></param>
/// <param name="machineCode"></param>
/// <param name="sign"></param>
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void GetPlan(string app_id, string machineCode, string sign)
{
string errorReason = "";
JsonModel<PlanModel> model = new JsonModel<PlanModel>();
model.Result = "0";
model.ResultType = "Result";
model.ResultRowsCount = "0";
model.ErrReason = errorReason;
model.DataList = null;
LogHelper.WriteSysLogBase("根据注塑机条码查询计划信息,入参machineCode=" + machineCode, MethodBase.GetCurrentMethod().Name);
#region 参数判断
//if (string.IsNullOrWhiteSpace(app_id))
//{
// model.ErrReason = "缺少必要传入参数 app_id";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<PlanModel>>(model));
// return;
//}
//if (string.IsNullOrWhiteSpace(machineCode))
//{
// model.ErrReason = "缺少必要传入参数 machineCode";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<PlanModel>>(model));
// return;
//}
//if (string.IsNullOrWhiteSpace(sign))
//{
// model.ErrReason = "缺少必要传入参数 sign";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<PlanModel>>(model));
// return;
//}
//bool access = Function.AppIDIsRight(app_id.Trim());
//if (!access)
//{
// model.ErrReason = "APP接口调用标识不正确 远程服务器拒绝了此次连接请求";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<PlanModel>>(model));
// return;
//}
//string[] param = { Function.app_secret.Trim(), machineCode.Trim() };
//bool paramIsRight = Function.signIsRight(param, sign);
//if (!paramIsRight)
//{
// model.ErrReason = "sign参数传输错误 远程服务器拒绝了此次连接请求";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<PlanModel>>(model));
// return;
//}
#endregion
DataTable dt = Function.GetPlan(machineCode, out errorReason);
List<PlanModel> listInfo = new List<PlanModel>();
if (dt.Rows.Count < 1)
{
model.Result = "0";
}
else
{
model.Result = "1";
listInfo = Tools.DataTableToList.ConvertTo<PlanModel>(dt);
}
model.ErrReason = errorReason;
model.ResultRowsCount = dt.Rows.Count.ToString();
model.DataList = listInfo;
LogHelper.WriteSysLogBase("APP根据注塑机条码查询计划信息,入参machineCode=" + machineCode + ",出参:" + JSONTools.ScriptSerialize<JsonModel<PlanModel>>(model), MethodBase.GetCurrentMethod().Name);
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<PlanModel>>(model));
}
/// <summary>
/// 根据料筒条码查询加料信息
/// </summary>
/// <param name="app_id"></param>
/// <param name="drumCode"></param>
/// <param name="sign"></param>
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void GetMaterialInfo(string app_id, string drumCode, string sign)
{
string errorReason = "";
JsonModel<MaterialInfoModel> model = new JsonModel<MaterialInfoModel>();
model.Result = "0";
model.ResultType = "Result";
model.ResultRowsCount = "0";
model.ErrReason = errorReason;
model.DataList = null;
LogHelper.WriteSysLogBase("根据料筒条码查询加料信息,入参drumCode=" + drumCode, MethodBase.GetCurrentMethod().Name);
#region 参数判断
if (string.IsNullOrWhiteSpace(app_id))
{
model.ErrReason = "缺少必要传入参数 app_id";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MaterialInfoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(drumCode))
{
model.ErrReason = "缺少必要传入参数 drumCode";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MaterialInfoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(sign))
{
model.ErrReason = "缺少必要传入参数 sign";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MaterialInfoModel>>(model));
return;
}
bool access = Function.AppIDIsRight(app_id.Trim());
if (!access)
{
model.ErrReason = "APP接口调用标识不正确 远程服务器拒绝了此次连接请求";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MaterialInfoModel>>(model));
return;
}
string[] param = { Function.app_secret.Trim(), drumCode.Trim() };
bool paramIsRight = Function.signIsRight(param, sign);
if (!paramIsRight)
{
model.ErrReason = "sign参数传输错误 远程服务器拒绝了此次连接请求";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MaterialInfoModel>>(model));
return;
}
#endregion
DataTable dt = Function.GetMaterialInfo(drumCode, out errorReason);
if (dt != null && dt.Rows.Count > 0)
{
string cylinderBarCode = dt.Rows[0][0].ToString();
string stockNo = ""; //存货代码
string batchNo = ""; //批次
string partNo = ""; //零件号
Function.GetCode(cylinderBarCode, out stockNo, out batchNo, out partNo);
if (!string.IsNullOrWhiteSpace(stockNo) || !string.IsNullOrWhiteSpace(partNo))
{
DataTable dt_info = Function.GetInfoByParticles(stockNo, partNo, out errorReason);
List<MaterialInfoModel> listInfo = new List<MaterialInfoModel>();
if (dt.Rows.Count < 1)
{
model.Result = "0";
}
else
{
model.Result = "1";
MaterialInfoModel info = new MaterialInfoModel();
if (dt_info != null && dt_info.Rows.Count > 0)
{
info.Code = dt_info.Rows[0]["PartNo"].ToString();
info.Name = dt_info.Rows[0]["ProductName"].ToString();
}
info.Batch = batchNo;
listInfo.Add(info);
}
model.ErrReason = errorReason;
model.ResultRowsCount = dt.Rows.Count.ToString();
model.DataList = listInfo;
LogHelper.WriteSysLogBase("APP根据料筒条码查询加料信息,入参drumCode=" + drumCode + ",出参:" + JSONTools.ScriptSerialize<JsonModel<MaterialInfoModel>>(model), MethodBase.GetCurrentMethod().Name);
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MaterialInfoModel>>(model));
}
else
{
model.Result = "0";
model.ResultType = "Result";
model.ResultRowsCount = "0";
model.ErrReason = "未获取到加料信息";
model.DataList = null;
LogHelper.WriteSysLogBase("APP根据料筒条码查询加料信息,入参drumCode=" + drumCode + ",出参:" + JSONTools.ScriptSerialize<JsonModel<MaterialInfoModel>>(model), MethodBase.GetCurrentMethod().Name);
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MaterialInfoModel>>(model));
}
}
else
{
model.Result = "0";
model.ResultType = "Result";
model.ResultRowsCount = "0";
model.ErrReason = "未获取到条码信息";
model.DataList = null;
LogHelper.WriteSysLogBase("APP根据料筒条码查询加料信息,入参drumCode=" + drumCode + ",出参:" + JSONTools.ScriptSerialize<JsonModel<MaterialInfoModel>>(model), MethodBase.GetCurrentMethod().Name);
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MaterialInfoModel>>(model));
}
}
/// <summary>
/// 注塑机与料筒关系绑定
/// lx 20190527
/// </summary>
/// <param name="app_id"></param>
/// <param name="machineCode"></param>
/// <param name="drumCode"></param>
/// <param name="sign"></param>
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void BindMachineAndDrum(string app_id, string machineCode, string drumCode, 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;
LogHelper.WriteSysLogBase("注塑机与料筒关系绑定,入参machineCode=" + machineCode + "drumCode=" + drumCode, MethodBase.GetCurrentMethod().Name);
#region 参数判断
if (string.IsNullOrWhiteSpace(app_id))
{
model.ErrReason = "缺少必要传入参数 app_id";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(machineCode))
{
model.ErrReason = "缺少必要传入参数 machineCode";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(drumCode))
{
model.ErrReason = "缺少必要传入参数 drumCode";
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(), machineCode.Trim(), drumCode.Trim() };
bool paramIsRight = Function.signIsRight(param, sign);
if (!paramIsRight)
{
model.ErrReason = "sign参数传输错误 远程服务器拒绝了此次连接请求";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
#endregion
int res = Function.BindMachineAndDrum(machineCode, drumCode, out errorReason);
if (res < 1)
{
model.Result = "0";
}
else
{
model.Result = "1";
}
model.ErrReason = errorReason;
model.ResultRowsCount = res.ToString();
model.DataList = null;
LogHelper.WriteSysLogBase("APP注塑机与料筒关系绑定,入参machineCode=" + machineCode + "drumCode=" + drumCode + ",出参:" + JSONTools.ScriptSerialize<JsonModel<NoModel>>(model), MethodBase.GetCurrentMethod().Name);
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
}
/// <summary>
/// 料筒清空关系解绑
/// lx 20190527
/// </summary>
/// <param name="app_id"></param>
/// <param name="drumCode"></param>
/// <param name="sign"></param>
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void ClearDrum(string app_id, string drumCode, 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;
LogHelper.WriteSysLogBase("注塑机与料筒关系绑定,入参drumCode=" + drumCode, MethodBase.GetCurrentMethod().Name);
#region 参数判断
if (string.IsNullOrWhiteSpace(app_id))
{
model.ErrReason = "缺少必要传入参数 app_id";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(drumCode))
{
model.ErrReason = "缺少必要传入参数 drumCode";
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(), drumCode.Trim() };
bool paramIsRight = Function.signIsRight(param, sign);
if (!paramIsRight)
{
model.ErrReason = "sign参数传输错误 远程服务器拒绝了此次连接请求";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
#endregion
//int res = Function.ClearDrum(drumCode, out errorReason);
bool res = Function.UnBindParticleAndDrum(drumCode, out errorReason);
if (res == false)
{
model.Result = "0";
}
else
{
model.Result = "1";
}
model.ErrReason = errorReason;
model.ResultRowsCount = res.ToString();
model.DataList = null;
LogHelper.WriteSysLogBase("APP注塑机与料筒关系绑定,入参drumCode=" + drumCode + ",出参:" + JSONTools.ScriptSerialize<JsonModel<NoModel>>(model), MethodBase.GetCurrentMethod().Name);
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
}
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void UnBindStationAndCylinder(string app_id, string machineCode, string drumCode, 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(machineCode))
{
model.ErrReason = "缺少必要传入参数 machineCode";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
if (string.IsNullOrWhiteSpace(drumCode))
{
model.ErrReason = "缺少必要传入参数 drumCode";
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
return;
}
#endregion
LogHelper.WriteSysLogBase("注塑机与料筒关系解绑,入参machineCode="+ machineCode +",drumCode=" + drumCode, MethodBase.GetCurrentMethod().Name);
bool res = Function.UnBindStationAndCylinder(machineCode, drumCode, out errorReason);
if (res == false)
{
model.Result = "0";
}
else
{
model.Result = "1";
}
LogHelper.WriteSysLogBase("注塑机与料筒关系解绑,入参machineCode=" + machineCode + ",drumCode=" + drumCode + "。出参:" + JSONTools.ScriptSerialize<JsonModel<NoModel>>(model), MethodBase.GetCurrentMethod().Name);
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
}
/// <summary>
/// 注塑机与料筒关系绑定(双色机)
/// lx 20200922
/// </summary>
/// <param name="app_id"></param>
/// <param name="machineCode"></param>
/// <param name="drumCode"></param>
/// <param name="sign"></param>
//[WebMethod]
//[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
//public void BindMachineAndDrum2(string app_id, string machineCode, string drumCode1, string drumCode2, 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;
// LogHelper.WriteSysLogBase("注塑机与料筒关系绑定,入参machineCode=" + machineCode + "drumCode1=" + drumCode1 +"drumCode2=" + drumCode2, MethodBase.GetCurrentMethod().Name);
// #region 参数判断
// if (string.IsNullOrWhiteSpace(app_id))
// {
// model.ErrReason = "缺少必要传入参数 app_id";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
// return;
// }
// if (string.IsNullOrWhiteSpace(machineCode))
// {
// model.ErrReason = "缺少必要传入参数 机台号";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
// return;
// }
// if (string.IsNullOrWhiteSpace(drumCode1))
// {
// model.ErrReason = "缺少必要传入参数 料筒1";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
// return;
// }
// if (string.IsNullOrWhiteSpace(drumCode2))
// {
// model.ErrReason = "缺少必要传入参数 料筒2";
// 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(), machineCode.Trim(), drumCode1.Trim(), drumCode2.Trim() };
// bool paramIsRight = Function.signIsRight(param, sign);
// if (!paramIsRight)
// {
// model.ErrReason = "sign参数传输错误 远程服务器拒绝了此次连接请求";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
// return;
// }
// #endregion
// int res = Function.BindMachineAndDrum2(machineCode, drumCode1, drumCode2, out errorReason);
// if (res < 1)
// {
// model.Result = "0";
// }
// else
// {
// model.Result = "1";
// }
// model.ErrReason = errorReason;
// model.ResultRowsCount = res.ToString();
// model.DataList = null;
// LogHelper.WriteSysLogBase("APP注塑机与料筒关系绑定,入参machineCode=" + machineCode + "drumCode1=" + drumCode1 + "drumCode2=" + drumCode2 + ",出参:" + JSONTools.ScriptSerialize<JsonModel<NoModel>>(model), MethodBase.GetCurrentMethod().Name);
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
//}
}
}