From 271fd450c3bc796dfcefcb72718f9b2327f31950 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Thu, 7 Aug 2025 11:58:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AE=B1=E7=A0=81=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=B8=8D=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E7=94=A8=E5=B0=8F=E7=B1=B3=E7=AE=B1=E7=A0=81=E8=A3=85=E7=AE=B1?= =?UTF-8?q?=EF=BC=8C=E7=94=A8WMS=E7=AE=B1=E7=A0=81=E8=A3=85=E7=AE=B1?= =?UTF-8?q?=E5=90=8E=E5=86=8D=E8=BD=AC=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebService/AppWebservice.asmx.cs | 41 +++++++++++++++++++------------- WebService/Function.cs | 17 ++++++------- 2 files changed, 34 insertions(+), 24 deletions(-) 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) {