|
@ -1,5 +1,6 @@ |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Data; |
|
|
using System.Data; |
|
|
|
|
|
using System.Linq; |
|
|
using System.Reflection; |
|
|
using System.Reflection; |
|
|
using System.Runtime.Remoting.Contexts; |
|
|
using System.Runtime.Remoting.Contexts; |
|
|
using System.Text; |
|
|
using System.Text; |
|
@ -64,6 +65,14 @@ namespace Webservice |
|
|
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model)); |
|
|
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model)); |
|
|
return; |
|
|
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<JsonModel<MKModel>>(model)); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
//if (string.IsNullOrWhiteSpace(barCode))
|
|
|
//if (string.IsNullOrWhiteSpace(barCode))
|
|
|
//{
|
|
|
//{
|
|
|
// model.ErrReason = "缺少必要传入参数 barCode";
|
|
|
// model.ErrReason = "缺少必要传入参数 barCode";
|
|
@ -91,19 +100,75 @@ namespace Webservice |
|
|
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
|
|
|
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
|
|
|
// return;
|
|
|
// return;
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
string errorReasonBoxData = ""; |
|
|
|
|
|
DataTable dt = Function.GetCodeRecords(boxCode, out errorReasonBoxData); |
|
|
|
|
|
List<MKModel> listInfo = new List<MKModel>(); |
|
|
|
|
|
|
|
|
|
|
|
if (dt.Rows.Count < 1) |
|
|
|
|
|
{ |
|
|
|
|
|
model.Result = "0"; |
|
|
|
|
|
model.ResultRowsCount = "0"; |
|
|
|
|
|
model.DataList = null; |
|
|
|
|
|
if (string.IsNullOrEmpty(errorReasonBoxData)) |
|
|
|
|
|
{ |
|
|
|
|
|
model.ErrReason = "箱码包含总成数量为零"; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
model.ErrReason = errorReasonBoxData; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
listInfo = Tools.DataTableToList.ConvertTo<MKModel>(dt); |
|
|
|
|
|
model.ResultRowsCount = listInfo.Count.ToString(); |
|
|
|
|
|
model.DataList = listInfo; |
|
|
|
|
|
} |
|
|
|
|
|
if(!string.IsNullOrEmpty(barCode)) |
|
|
|
|
|
{ |
|
|
|
|
|
#region 数据合法性判断
|
|
|
|
|
|
//总成码格式验证
|
|
|
|
|
|
var barCodeList = barCode.Split(';'); |
|
|
|
|
|
if (!barCode.Contains("S104") || !barCode.Contains(".") || barCodeList[0].Length != 17 || barCodeList[1].Length != 4 || barCodeList[2].Length != 4) |
|
|
|
|
|
{ |
|
|
|
|
|
model.ErrReason = "总成条码格式不对或不存在"; |
|
|
|
|
|
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model)); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//箱码和总成码零件验证
|
|
|
|
|
|
string boxPartNo = boxCodeList[0].Substring(3,10); |
|
|
|
|
|
string barCodePartNo = barCodeList[0].Substring(0, 10); |
|
|
|
|
|
if(boxPartNo != barCodePartNo) |
|
|
|
|
|
{ |
|
|
|
|
|
model.ErrReason = "箱码和总成条码零件号不符"; |
|
|
|
|
|
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model)); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
int updateNum = Function.BindBoxCodeAndBarCode(boxCode, barCode, out errorReason); |
|
|
int updateNum = Function.BindBoxCodeAndBarCode(boxCode, barCode, out errorReason); |
|
|
|
|
|
|
|
|
DataTable dt = Function.GetCodeRecords(boxCode, out errorReason); |
|
|
dt = Function.GetCodeRecords(boxCode, out errorReasonBoxData); |
|
|
List<MKModel> listInfo = new List<MKModel>(); |
|
|
|
|
|
|
|
|
|
|
|
if (dt.Rows.Count < 1) |
|
|
if (dt.Rows.Count < 1) |
|
|
{ |
|
|
{ |
|
|
model.Result = "0"; |
|
|
model.Result = "0"; |
|
|
model.ResultRowsCount = "0"; |
|
|
model.ResultRowsCount = "0"; |
|
|
model.DataList = null; |
|
|
model.DataList = null; |
|
|
model.ErrReason = errorReason; |
|
|
if (string.IsNullOrEmpty(errorReasonBoxData)) |
|
|
|
|
|
{ |
|
|
|
|
|
model.ErrReason = "箱码包含总成数量为零"; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
model.ErrReason = errorReasonBoxData; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -113,10 +178,10 @@ namespace Webservice |
|
|
model.DataList = listInfo; |
|
|
model.DataList = listInfo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (updateNum == 0 && !string.IsNullOrEmpty(barCode)) |
|
|
if (!string.IsNullOrEmpty(errorReason) && !string.IsNullOrEmpty(barCode)) |
|
|
{ |
|
|
{ |
|
|
model.Result = "0"; |
|
|
model.Result = "0"; |
|
|
model.ErrReason = "箱码和总成码绑定失败"; |
|
|
model.ErrReason = errorReason; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -132,11 +197,10 @@ namespace Webservice |
|
|
} |
|
|
} |
|
|
if (listInfo.Count.ToString() == qtyValue) |
|
|
if (listInfo.Count.ToString() == qtyValue) |
|
|
{ |
|
|
{ |
|
|
model.ErrReason = "已满箱"; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model)); |
|
|
Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|