using Newtonsoft.Json;
|
using Newtonsoft.Json.Linq;
|
using Pub_Class;
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Data.SqlClient;
|
using System.Web.Http;
|
using WebAPI.Models;
|
|
namespace WebAPI.Controllers
|
{
|
public class Sc_RepairCodeBindingController : ApiController
|
{
|
private json objJsonResult = new json();
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
DataSet ds;
|
|
|
#region PDA返修码绑定模块,查找条码信息
|
[Route("Sc_RepairCodeBinding/BarcodeList")]
|
[HttpGet]
|
public object BarcodeList(string HBarCode,string HCodeType)
|
{
|
try
|
{
|
ds = oCN.RunProcReturn("exec h_p_Sc_RepairCodeBinding_BarCodeInfo '" + HBarCode + "','" + HCodeType + "'", "h_p_Sc_RepairCodeBinding_BarCodeInfo");
|
|
if (ds.Tables[0].Rows.Count != 0 || ds != null)
|
{
|
if (ClsPub.isLong(ds.Tables[0].Rows[0]["HIsSuccess"]) == 1)
|
{
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = ds.Tables[0].Rows[0]["HBackRemark"].ToString();
|
objJsonResult.data = ds.Tables[0];
|
return objJsonResult;
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = ds.Tables[0].Rows[0]["HBackRemark"].ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "条码:" + HBarCode + ",不在条码档案中,请核对条码是否已被删除。";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "Exception!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region PDA返修码绑定模块,绑定
|
[Route("Sc_RepairCodeBinding/BindBarCode")]
|
[HttpGet]
|
public object BindBarCode(string HBarCode_CP, string HBarCode_FX)
|
{
|
try
|
{
|
ds = oCN.RunProcReturn("exec h_p_Sc_RepairCodeBinding_Update '" + HBarCode_CP + "','" + HBarCode_FX + "'", "h_p_Sc_RepairCodeBinding_Update");
|
|
|
if (ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 0)
|
{
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = ds.Tables[0].Rows[0]["HBackRemark"].ToString();
|
objJsonResult.data = ds.Tables[0];
|
return objJsonResult;
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = ds.Tables[0].Rows[0]["HBackRemark"].ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "Exception!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
}
|
}
|