@ -219,6 +219,215 @@ namespace Webservice
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
}
}
/// <summary>
/// WMS箱码与小米箱码绑定
/// </summary>
/// <param name="app_id"></param>
/// <param name="boxCode"></param>
/// <param name="changeBoxCode"></param>
/// <param name="sign"></param>
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void ChangeBoxCode ( string app_id , string boxCode , string changeBoxCode , string sign )
{
string errorReason = "" ;
JsonModel < MKModel > model = new JsonModel < MKModel > ( ) ;
model . Result = "0" ;
model . ResultType = "Result" ;
model . ResultRowsCount = "0" ;
model . ErrReason = errorReason ;
model . DataList = null ;
LogHelper . WriteSysLogBase ( "WMS箱码与小米箱码绑定,入参boxCode=" + boxCode + ",changeBoxCode=" + changeBoxCode , MethodBase . GetCurrentMethod ( ) . Name ) ;
Context . Response . ContentType = "application/json; charset=utf-8" ;
//if (string.IsNullOrWhiteSpace(app_id))
//{
// model.ErrReason = "缺少必要传入参数 app_id";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
// return;
//}
if ( string . IsNullOrWhiteSpace ( boxCode ) )
{
model . ErrReason = "缺少必要传入参数 boxCode" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
if ( string . IsNullOrWhiteSpace ( changeBoxCode ) )
{
model . ErrReason = "缺少必要传入参数 changeBoxCode" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
var boxCodeList = boxCode . Split ( ';' ) ;
var changeBoxCodeList = changeBoxCode . Split ( ';' ) ;
//小米箱码格式验证
if ( ! changeBoxCode . Contains ( "PN" ) | | ! changeBoxCode . Contains ( "PKG" ) | | ! changeBoxCode . Contains ( "QTY" ) | | changeBoxCodeList . Length ! = 7 | | changeBoxCodeList [ 0 ] . Length ! = 1 6 | | changeBoxCodeList [ 1 ] . Length ! = 1 2 | | changeBoxCodeList [ 5 ] . Length ! = 1 6 )
{
model . ErrReason = "小米箱码标签格式不对" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
//Wms箱码格式验证
if ( ! boxCode . Contains ( ".0" ) | | ! boxCode . Contains ( "/" ) | | boxCodeList . Length ! = 7 | | boxCodeList [ 5 ] . Length ! = 1 0 )
{
model . ErrReason = "Wms箱码标签格式不对" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
string boxPartNo = boxCodeList [ 0 ] . Substring ( 0 , 1 0 ) ;
string changeBoxPartNo = changeBoxCodeList [ 0 ] . Substring ( 3 , 1 0 ) ;
//Wms箱码和小米箱码零件号验证
if ( boxPartNo ! = changeBoxPartNo )
{
model . Result = "0" ;
model . ErrReason = "Wms箱码和小米箱码零件号不符" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
List < MKModel > listInfo = new List < MKModel > ( ) ;
string errorReasonBoxData = "" ;
DataTable dtBoxNum = Function . GetCodeRecords ( boxCode , out errorReasonBoxData ) ;
string qtyValue = boxCodeList [ 1 ] ;
if ( dtBoxNum ! = null & & dtBoxNum . Rows . Count = = 0 )
{
model . ErrReason = "Wms箱单装箱数量为0,无法绑定" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
if ( dtBoxNum ! = null & & dtBoxNum . Rows . Count . ToString ( ) ! = qtyValue )
{
model . ErrReason = "Wms箱单不满箱无法绑定" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
if ( ! string . IsNullOrEmpty ( errorReasonBoxData ) )
{
model . ErrReason = errorReasonBoxData ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
listInfo = Tools . DataTableToList . ConvertTo < MKModel > ( dtBoxNum ) ;
if ( listInfo . Count > 1 )
{
if ( ! string . IsNullOrEmpty ( listInfo [ 0 ] . ChangeBoxCode ) )
{
model . ErrReason = "Wms箱码和小米箱码已绑定" ;
model . ResultRowsCount = listInfo . Count . ToString ( ) ;
model . DataList = listInfo ;
model . Result = "0" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
}
int updateNum = Function . BindBoxCodeAndChangeBoxCode ( boxCode , changeBoxCode , out errorReason ) ;
if ( ! string . IsNullOrEmpty ( errorReason ) )
{
model . Result = "0" ;
model . ErrReason = errorReason ;
}
else
{
dtBoxNum = Function . GetCodeRecords ( boxCode , out errorReasonBoxData ) ;
listInfo . Clear ( ) ;
listInfo = Tools . DataTableToList . ConvertTo < MKModel > ( dtBoxNum ) ;
model . ResultRowsCount = listInfo . Count . ToString ( ) ;
model . DataList = listInfo ;
model . Result = "1" ;
model . ErrReason = "" ;
}
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
}
/// <summary>
/// 获取小米箱码绑定数据
/// </summary>
/// <param name="app_id"></param>
/// <param name="boxCode"></param>
/// <param name="sign"></param>
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void GetMiBoxCodeData ( string app_id , string boxCode , string sign )
{
string errorReason = "" ;
JsonModel < MKModel > model = new JsonModel < MKModel > ( ) ;
model . Result = "0" ;
model . ResultType = "Result" ;
model . ResultRowsCount = "0" ;
model . ErrReason = errorReason ;
model . DataList = null ;
LogHelper . WriteSysLogBase ( "WMS箱码与小米箱码绑定,入参boxCode=" + boxCode , MethodBase . GetCurrentMethod ( ) . Name ) ;
Context . Response . ContentType = "application/json; charset=utf-8" ;
//if (string.IsNullOrWhiteSpace(app_id))
//{
// model.ErrReason = "缺少必要传入参数 app_id";
// Context.Response.Write(JSONTools.ScriptSerialize<JsonModel<MKModel>>(model));
// return;
//}
if ( string . IsNullOrWhiteSpace ( boxCode ) )
{
model . ErrReason = "缺少必要传入参数 boxCode" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
var boxCodeList = boxCode . Split ( ';' ) ;
//小米箱码格式验证
if ( ! boxCode . Contains ( "PN" ) | | ! boxCode . Contains ( "PKG" ) | | ! boxCode . Contains ( "QTY" ) | | boxCodeList . Length ! = 7 | | boxCodeList [ 0 ] . Length ! = 1 6 | | boxCodeList [ 1 ] . Length ! = 1 2 | | boxCodeList [ 5 ] . Length ! = 1 6 )
{
model . ErrReason = "小米箱码标签格式不对" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
List < MKModel > listInfo = new List < MKModel > ( ) ;
string errorReasonBoxData = "" ;
DataTable dtBoxNum = Function . GetMiCodeRecords ( boxCode , out errorReasonBoxData ) ;
if ( ! string . IsNullOrEmpty ( errorReasonBoxData ) )
{
model . ErrReason = errorReasonBoxData ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
listInfo = Tools . DataTableToList . ConvertTo < MKModel > ( dtBoxNum ) ;
if ( listInfo = = null )
{
model . ErrReason = "小米箱码未绑定" ;
model . Result = "0" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
return ;
}
model . ResultRowsCount = listInfo . Count . ToString ( ) ;
model . DataList = listInfo ;
model . Result = "1" ;
model . ErrReason = "" ;
Context . Response . Write ( JSONTools . ScriptSerialize < JsonModel < MKModel > > ( model ) ) ;
}
[WebMethod]
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void MD5Encrypt ( string str )
public void MD5Encrypt ( string str )