Browse Source

重复问题测试

master
ruoxing.wang 3 days ago
parent
commit
a194fa620b
  1. 58
      WebService/Function.cs
  2. 15
      WebService/WMSWebService.asmx.cs

58
WebService/Function.cs

@ -611,6 +611,8 @@ namespace Webservice
} }
} }
private static readonly object _obj = new object();
private static string _scanCode2 = string.Empty;
public static string WMSSpraying(string barcode, int isPass, string stcokNo, string partNo, string batchNo) public static string WMSSpraying(string barcode, int isPass, string stcokNo, string partNo, string batchNo)
{ {
JsonModel<NoModel> model = new JsonModel<NoModel>(); JsonModel<NoModel> model = new JsonModel<NoModel>();
@ -619,9 +621,17 @@ namespace Webservice
model.ResultRowsCount = "0"; model.ResultRowsCount = "0";
model.ErrReason = ""; model.ErrReason = "";
model.DataList = null; model.DataList = null;
string sql33 = "";
try try
{ {
lock (_obj)
{
if (_scanCode2 == barcode)
{
LogHelper.WriteLog("a扫码[" + barcode + "]重复了,连续两次扫码相同,第一次还未执行完成,进行第二次扫码.");
}
_scanCode2 = barcode;
#region 目前全部存储一维码,将二维码转换为一维码 #region 目前全部存储一维码,将二维码转换为一维码
if (barcode.Contains(".")) if (barcode.Contains("."))
@ -768,6 +778,7 @@ namespace Webservice
order by TimeStamp desc order by TimeStamp desc
"; ";
string sqlConnString = ConfigurationManager.ConnectionStrings["SqlConnStringForeign"].ConnectionString; string sqlConnString = ConfigurationManager.ConnectionStrings["SqlConnStringForeign"].ConnectionString;
sql33 = sql_color;
DataTable dtColor = SqlHelper.GetDataDateTable(sqlConnString, CommandType.Text, sql_color, null); DataTable dtColor = SqlHelper.GetDataDateTable(sqlConnString, CommandType.Text, sql_color, null);
if (dtColor != null && dtColor.Rows.Count > 0) if (dtColor != null && dtColor.Rows.Count > 0)
{ {
@ -775,6 +786,7 @@ namespace Webservice
if (!string.IsNullOrWhiteSpace(color)) if (!string.IsNullOrWhiteSpace(color))
{ {
string sql_colorCode = @" SELECT ColorNo FROM tb_Color WHERE ColorCode = '" + color + @"' "; string sql_colorCode = @" SELECT ColorNo FROM tb_Color WHERE ColorCode = '" + color + @"' ";
sql33 = sql_colorCode;
DataTable dtColorCode = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql_colorCode, null); DataTable dtColorCode = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql_colorCode, null);
if (dtColorCode != null && dtColorCode.Rows.Count > 0) if (dtColorCode != null && dtColorCode.Rows.Count > 0)
{ {
@ -858,6 +870,7 @@ namespace Webservice
OR LTrim(RTrim(Side_2_BC12))= @barcode OR LTrim(RTrim(Side_2_BC12))= @barcode
"; ";
string sqlConnString = ConfigurationManager.ConnectionStrings["SqlConnStringForeign"].ConnectionString; string sqlConnString = ConfigurationManager.ConnectionStrings["SqlConnStringForeign"].ConnectionString;
sql33 = sql_color;
DataTable dtColor = SqlHelper.GetDataDateTable(sqlConnString, CommandType.Text, sql_color, null); DataTable dtColor = SqlHelper.GetDataDateTable(sqlConnString, CommandType.Text, sql_color, null);
if (dtColor != null && dtColor.Rows.Count > 0) if (dtColor != null && dtColor.Rows.Count > 0)
{ {
@ -867,6 +880,7 @@ namespace Webservice
if (!string.IsNullOrWhiteSpace(bc_color)) if (!string.IsNullOrWhiteSpace(bc_color))
{ {
string sql_colorCode = @" SELECT ColorNo FROM tb_Color WHERE ColorCode = '" + bc_color + @"' and ColorQQCode='" + cc_color + @"' and ColorDQCode='" + pr_color + @"'"; string sql_colorCode = @" SELECT ColorNo FROM tb_Color WHERE ColorCode = '" + bc_color + @"' and ColorQQCode='" + cc_color + @"' and ColorDQCode='" + pr_color + @"'";
sql33 = sql_colorCode;
DataTable dtColorCode = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql_colorCode, null); DataTable dtColorCode = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql_colorCode, null);
if (dtColorCode != null && dtColorCode.Rows.Count > 0) if (dtColorCode != null && dtColorCode.Rows.Count > 0)
{ {
@ -877,6 +891,7 @@ namespace Webservice
} }
string sql = @"select PaintNo from tb_StockToPaintNo where StockNo='" + barcode.Substring(0, 10) + @"' and PaintCode='" + colorCode + @"'"; string sql = @"select PaintNo from tb_StockToPaintNo where StockNo='" + barcode.Substring(0, 10) + @"' and PaintCode='" + colorCode + @"'";
sql33 = sql;
DataTable dt = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null); DataTable dt = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
if (dt != null && dt.Rows.Count > 0) if (dt != null && dt.Rows.Count > 0)
{ {
@ -972,10 +987,10 @@ namespace Webservice
string jsonParam = " [{\"ServiceType\":\"AddMesData\",\"OperName\":\"ADMIN\"}]"; string jsonParam = " [{\"ServiceType\":\"AddMesData\",\"OperName\":\"ADMIN\"}]";
 IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
     //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式  //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 
     timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss"; timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss";
     //timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd"; //timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd";
string strJson = "[25," + JsonConvert.SerializeObject(list, Formatting.Indented, timeConverter) + "]"; string strJson = "[25," + JsonConvert.SerializeObject(list, Formatting.Indented, timeConverter) + "]";
//string strJson = "[25," + JsonHelper.<List<WMS03Model>>(list) + "]"; //string strJson = "[25," + JsonHelper.<List<WMS03Model>>(list) + "]";
@ -1024,16 +1039,30 @@ namespace Webservice
return JSONTools.ScriptSerialize<JsonModel<NoModel>>(model); return JSONTools.ScriptSerialize<JsonModel<NoModel>>(model);
#endregion #endregion
}
} }
catch (Exception ex) catch (Exception ex)
{ {
LogHelper.WriteLogManager(ex); LogHelper.WriteLogManager(ex);
if (ex.Message.Contains("syntax"))
{
LogHelper.WriteLog("查询语句错误,执行语句为:" + sql33);
}
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name); LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
model.ErrReason = ex.Message; model.ErrReason = ex.Message;
return JSONTools.ScriptSerialize<JsonModel<NoModel>>(model); return JSONTools.ScriptSerialize<JsonModel<NoModel>>(model);
} }
finally
{
_scanCode2 = string.Empty;
}
} }
private static readonly object _obj2 = new object();
private static string _scanCode = string.Empty;
public static string WMSSprayingReturnNo(string barcode, int isPass, string stcokNo, string partNo, string batchNo,string userName) public static string WMSSprayingReturnNo(string barcode, int isPass, string stcokNo, string partNo, string batchNo,string userName)
{ {
JsonModel<PartInfoModel> model = new JsonModel<PartInfoModel>(); JsonModel<PartInfoModel> model = new JsonModel<PartInfoModel>();
@ -1045,6 +1074,15 @@ namespace Webservice
try try
{ {
lock (_obj2)
{
if (_scanCode == barcode)
{
LogHelper.WriteLog("扫码[" + barcode + "]重复了,连续两次扫码相同,第一次还未执行完成,进行第二次扫码.");
}
_scanCode = barcode;
#region 目前全部存储一维码,将二维码转换为一维码 #region 目前全部存储一维码,将二维码转换为一维码
LogHelper.WriteSysLogBase("WMS接口:条码:" + barcode + ",转换一维码开始调入时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), MethodBase.GetCurrentMethod().Name); LogHelper.WriteSysLogBase("WMS接口:条码:" + barcode + ",转换一维码开始调入时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), MethodBase.GetCurrentMethod().Name);
@ -1503,6 +1541,12 @@ namespace Webservice
return JSONTools.ScriptSerialize<JsonModel<PartInfoModel>>(model); return JSONTools.ScriptSerialize<JsonModel<PartInfoModel>>(model);
#endregion #endregion
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1511,6 +1555,10 @@ namespace Webservice
model.ErrReason = ex.Message; model.ErrReason = ex.Message;
return JSONTools.ScriptSerialize<JsonModel<PartInfoModel>>(model); return JSONTools.ScriptSerialize<JsonModel<PartInfoModel>>(model);
} }
finally
{
_scanCode = string.Empty;
}
} }
/// <summary> /// <summary>

15
WebService/WMSWebService.asmx.cs

@ -47,7 +47,7 @@ namespace Webservice
//model.DataList = null; //model.DataList = null;
//Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model)); //Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<NoModel>>(model));
Context.Response.ContentType = "application/json; charset=utf-8";
string errorReason = ""; string errorReason = "";
JsonModel<NoModel> model = new JsonModel<NoModel>(); JsonModel<NoModel> model = new JsonModel<NoModel>();
@ -85,16 +85,7 @@ namespace Webservice
Context.Response.Write(res); Context.Response.Write(res);
} }
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public string WMSSprayingForAppForTest(string barcode)
{
string errorReason = string.Empty;
WMSSprayingForApp(barcode);
if (string.IsNullOrEmpty(errorReason))
return "true";
return errorReason;
}
[WebMethod] [WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)] [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public string WMSSprayingForCSForTest(string barcode, int isOK) public string WMSSprayingForCSForTest(string barcode, int isOK)
@ -412,6 +403,8 @@ namespace Webservice
//{ //{
// WMSSprayingForAppReturnNo(barcode,"system"); // WMSSprayingForAppReturnNo(barcode,"system");
//} //}
[WebMethod] [WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)] [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void WMSSprayingForAppReturnNo(string barcode,string userName) public void WMSSprayingForAppReturnNo(string barcode,string userName)

Loading…
Cancel
Save