chenhaozhe
3 天以前 89793cb2f9d4eb80582d0b5dda465881ff9a8382
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
    }
}