diff --git a/WebService/AppWebservice.asmx.cs b/WebService/AppWebservice.asmx.cs index 9487064..5408ca4 100644 --- a/WebService/AppWebservice.asmx.cs +++ b/WebService/AppWebservice.asmx.cs @@ -65,9 +65,17 @@ namespace Webservice Context.Response.Write(JSONTools.ScriptSerialize>(model)); return; } - //箱码格式验证 + //小米箱码格式验证 + //var boxCodeList = boxCode.Split(';'); + //if (!boxCode.Contains("PN") || !boxCode.Contains("PKG") || !boxCode.Contains("QTY") || boxCodeList.Length != 7 || boxCodeList[0].Length != 16 || boxCodeList[1].Length != 12 || boxCodeList[5].Length != 16) + //{ + // model.ErrReason = "箱码标签格式不对"; + // Context.Response.Write(JSONTools.ScriptSerialize>(model)); + // return; + //} + //Wms箱码格式验证 var boxCodeList = boxCode.Split(';'); - if (!boxCode.Contains("PN") || !boxCode.Contains("PKG") || !boxCode.Contains("QTY") || boxCodeList.Length != 7 || boxCodeList[0].Length != 16 || boxCodeList[1].Length != 12 || boxCodeList[5].Length != 16) + if (!boxCode.Contains(".0") || !boxCode.Contains("/") || boxCodeList.Length != 7 || boxCodeList[5].Length != 10) { model.ErrReason = "箱码标签格式不对"; Context.Response.Write(JSONTools.ScriptSerialize>(model)); @@ -141,8 +149,9 @@ namespace Webservice return; } - //箱码和总成码零件验证 - string boxPartNo = boxCodeList[0].Substring(3,10); + //箱码和总成码零件号验证 分Wms箱码和小米箱码 + //string boxPartNo = boxCodeList[0].Substring(3,10); + string boxPartNo = boxCodeList[0].Substring(0, 10); string barCodePartNo = barCodeList[0].Substring(0, 10); if(boxPartNo != barCodePartNo) { @@ -192,19 +201,19 @@ namespace Webservice else { model.Result = "1"; - string qtyValue = "0"; - var boxCodeSplit = boxCode.Split(';'); - foreach (string part in boxCodeSplit) - { - if (part.StartsWith("QTY:")) - { - qtyValue = part.Substring(4); // 从"QTY:"后的字符开始截取 - } - } - if (listInfo.Count.ToString() == qtyValue) - { + //string qtyValue = "0"; + //var boxCodeSplit = boxCode.Split(';'); + //foreach (string part in boxCodeSplit) + //{ + // if (part.StartsWith("QTY:")) + // { + // qtyValue = part.Substring(4); // 从"QTY:"后的字符开始截取 + // } + //} + //if (listInfo.Count.ToString() == qtyValue) + //{ - } + //} } } Context.Response.Write(JSONTools.ScriptSerialize>(model)); diff --git a/WebService/Function.cs b/WebService/Function.cs index 57a33c5..50b2f01 100644 --- a/WebService/Function.cs +++ b/WebService/Function.cs @@ -368,13 +368,14 @@ namespace Webservice { errorReason = ""; var boxCodeSplit = boxCode.Split(';'); - foreach (string part in boxCodeSplit) - { - if (part.StartsWith("QTY:")) - { - qtyValue = part.Substring(4); // 从"QTY:"后的字符开始截取 - } - } + qtyValue = boxCodeSplit[1]; + //foreach (string part in boxCodeSplit) + //{ + // if (part.StartsWith("QTY:")) + // { + // qtyValue = part.Substring(4); // 从"QTY:"后的字符开始截取 + // } + //} DataTable dtBoxNum = GetCodeRecords(boxCode, out errorReason); if(dtBoxNum != null && dtBoxNum.Rows.Count.ToString() == qtyValue) @@ -397,7 +398,7 @@ namespace Webservice string boxCodeDB = dt.Rows[0]["BoxCode"].ToString(); if(string.IsNullOrEmpty(boxCodeDB)) { - string updateSql = @" update [dbo].[tb_Punch_Code_Record] set BoxCode='" + boxCode + "',pkg='"+qtyValue+"' where ID='" + id + "'"; + string updateSql = @" update [dbo].[tb_Punch_Code_Record] set BoxCode='" + boxCode + "',BoxCodeUpdateTime='" + DateTime.Now + "',pkg='" + qtyValue+"' where ID='" + id + "'"; updateNum = SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnString, CommandType.Text, updateSql, null); if (updateNum == 0) {