| using System; | 
| using System.Collections.Generic; | 
| using System.Data; | 
| using System.Linq; | 
| using System.Net; | 
| using System.Net.Http; | 
| using System.Web.Http; | 
| using WebAPI; | 
| using WebAPI.Models; | 
|   | 
| namespace WebAPI.Controllers | 
| { | 
|     public class Sc_AssemblyBillController : ApiController | 
|     { | 
|         public Int64 HInterID;                  //本单ID | 
|         public string HBillNo;                  //本单单号 | 
|         public string HBillType = "3727";       //单据类型 | 
|         public WebServer webserver =new WebServer(); | 
|         public DataSet ds =new DataSet(); | 
|         string sBillNo = ""; | 
|         Int64 sInterID = 0; | 
|         string sICMOBillNo = ""; | 
|         string sCPBarCode = ""; | 
|         Int64 sCPMaterID = 0; | 
|         string sCPMaterName = ""; | 
|         private json objjson = new json(); | 
|   | 
|         //扫描成品条码 | 
|         [Route("Assembly/Get_Assembly_CPBarCode_Json")] | 
|         [HttpGet] | 
|         public object Get_Assembly_CPBarCode_Json(string sBarCode,string sBillType) | 
|         { | 
|             try | 
|             { | 
|                 DataTable dt_Main = new DataTable("Json"); | 
|                 dt_Main.Columns.Add("sICMOBillNo", typeof(string)); | 
|                 dt_Main.Columns.Add("sCPBarCode", typeof(string)); | 
|                 dt_Main.Columns.Add("sCPMaterID", typeof(Int64)); | 
|                 dt_Main.Columns.Add("sCPMaterName", typeof(string)); | 
|                 dt_Main.Columns.Add("sInterID", typeof(Int64)); | 
|                 dt_Main.Columns.Add("sBillNo", typeof(string)); | 
|   | 
|   | 
|   | 
|                 if (webserver.Get_Assembly_CPBarCode(sBarCode, sBillType, ref sICMOBillNo, ref sCPBarCode, ref sCPMaterID, ref sCPMaterName, ref sBillNo, ref sInterID, ref DBUtility.ClsPub.sErrInfo)) | 
|                 { | 
|                     //---------创建新行------------------------ | 
|                     DataRow dr_main = dt_Main.NewRow();//创建新行  | 
|                     dt_Main.Rows.Add(dr_main);//将新行加入到表中 | 
|                     dr_main["sICMOBillNo"] = DBUtility.ClsPub.isStrNull(sICMOBillNo); | 
|                     dr_main["sCPBarCode"] = DBUtility.ClsPub.isStrNull(sCPBarCode); | 
|                     dr_main["sCPMaterID"] = DBUtility.ClsPub.isLong(sCPMaterID); | 
|                     dr_main["sCPMaterName"] = DBUtility.ClsPub.isStrNull(sCPMaterName); | 
|                     dr_main["sInterID"] = DBUtility.ClsPub.isLong(sInterID); | 
|                     dr_main["sBillNo"] = DBUtility.ClsPub.isStrNull(sBillNo); | 
|   | 
|                     objjson.code = "0"; | 
|                     objjson.count = 1; | 
|                     objjson.Message = "获取成功"; | 
|                     objjson.data = dt_Main; | 
|                     return objjson; | 
|                 } | 
|                 else | 
|                 { | 
|                     objjson.code = "0"; | 
|                     objjson.count = 0; | 
|                     objjson.Message = "获取失败" + DBUtility.ClsPub.sErrInfo; | 
|                     objjson.data = null; | 
|                     return objjson; | 
|                 } | 
|             } | 
|             catch (Exception e) | 
|             { | 
|   | 
|                 objjson.code = "0"; | 
|                 objjson.count = 0; | 
|                 objjson.Message = "获取失败" + e.ToString(); | 
|                 objjson.data = null; | 
|                 return objjson; | 
|             } | 
|                 | 
|         } | 
|         //扫描配件条码 | 
|         [Route("Assembly/Get_Assembly_PJBarCode_Json")] | 
|         [HttpGet] | 
|         public object Get_Assembly_PJBarCode_Json(string sPJCode, string sCPCode, long sInterID, string sBillNo, string sMaker, long HWorkerID, string HSNNumber) | 
|         { | 
|             try | 
|             { | 
|                 DataTable dt_Main = new DataTable("Json"); | 
|                 dt_Main.Columns.Add("sPJCode", typeof(string)); | 
|                 dt_Main.Columns.Add("sCPCode", typeof(string)); | 
|                 dt_Main.Columns.Add("sInterID", typeof(Int64)); | 
|                 dt_Main.Columns.Add("sBillNo", typeof(string)); | 
|                 dt_Main.Columns.Add("sMaker", typeof(string)); | 
|                 dt_Main.Columns.Add("HWorkerID", typeof(Int64)); | 
|                 dt_Main.Columns.Add("HSNNumber", typeof(string)); | 
|   | 
|                 if (webserver.Get_Assembly_PJBarCode(sPJCode, sCPCode, sInterID, sBillNo, sMaker, HWorkerID, HSNNumber, ref DBUtility.ClsPub.sErrInfo)) | 
|                 { | 
|                     //---------创建新行------------------------ | 
|                     DataRow dr_main = dt_Main.NewRow();//创建新行  | 
|                     dt_Main.Rows.Add(dr_main);//将新行加入到表中 | 
|                     dr_main["sPJCode"] = DBUtility.ClsPub.isStrNull(sPJCode); | 
|                     dr_main["sCPCode"] = DBUtility.ClsPub.isStrNull(sCPCode); | 
|                     dr_main["sInterID"] = DBUtility.ClsPub.isLong(sInterID); | 
|                     dr_main["sBillNo"] = DBUtility.ClsPub.isStrNull(sBillNo); | 
|                     dr_main["sMaker"] = DBUtility.ClsPub.isStrNull(sMaker); | 
|                     dr_main["HWorkerID"] = DBUtility.ClsPub.isLong(HWorkerID); | 
|                     dr_main["HSNNumber"] = DBUtility.ClsPub.isStrNull(HSNNumber); | 
|   | 
|                     objjson.code = "0"; | 
|                     objjson.count = 1; | 
|                     objjson.Message = "获取成功"; | 
|                     objjson.data = dt_Main; | 
|                     return objjson; | 
|                 } | 
|                 else | 
|                 { | 
|                     objjson.code = "0"; | 
|                     objjson.count = 0; | 
|                     objjson.Message = "获取失败" + DBUtility.ClsPub.sErrInfo; | 
|                     objjson.data = null; | 
|                     return objjson; | 
|                 } | 
|             } | 
|             catch (Exception e) | 
|             { | 
|   | 
|                 objjson.code = "0"; | 
|                 objjson.count = 0; | 
|                 objjson.Message = "获取失败" + e.ToString(); | 
|                 objjson.data = null; | 
|                 return objjson; | 
|             } | 
|                 | 
|         } | 
|   | 
|         [Route("Assembly/DisBillEntryList_Mate_Webs_Json")] | 
|         [HttpGet] | 
|         public object DisBillEntryList_Mate_Webs_Json(long HInterID, string sBillType, string sWhere) | 
|         { | 
|             try | 
|             { | 
|                 ds = webserver.GetSc_AssemblyBill(HInterID, sBillType, sWhere); | 
|                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
|                 { | 
|   | 
|                     objjson.code = "0"; | 
|                     objjson.count = 0; | 
|                     objjson.Message = "没有返回任何记录!"; | 
|                     objjson.data = null; | 
|                     return objjson; | 
|                     //DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning); | 
|                 } | 
|                 else | 
|                 { | 
|                     objjson.code = "0"; | 
|                     objjson.count = 1; | 
|                     objjson.Message = "获取信息成功!"; | 
|                     objjson.data = ds.Tables[0]; | 
|                     return objjson; | 
|                 } | 
|             } | 
|             catch (Exception e) | 
|             { | 
|   | 
|                 objjson.code = "0"; | 
|                 objjson.count = 0; | 
|                 objjson.Message = "没有返回任何记录!" + e.ToString(); | 
|                 objjson.data = null; | 
|                 return objjson; | 
|             } | 
|         } | 
|         [Route("Assembly/Delete_Json")] | 
|         [HttpGet] | 
|         public object Delete_Json(long sInterID,string sBarCode) | 
|         { | 
|             string sErrMsg=string.Empty; | 
|             try | 
|             { | 
|                 if (webserver.set_DelSc_AssemblyBill(sInterID, sBarCode,ref sErrMsg)) | 
|                 { | 
|                     objjson.code = "0"; | 
|                     objjson.count = 1; | 
|                     objjson.Message = "删除成功!"; | 
|                     objjson.data = null; | 
|                     return objjson; | 
|                 } | 
|                 else | 
|                 { | 
|                     objjson.code = "0"; | 
|                     objjson.count = 0; | 
|                     objjson.Message = "删除失败!"; | 
|                     objjson.data = null; | 
|                     return objjson; | 
|                 } | 
|             } | 
|             catch (Exception) | 
|             { | 
|   | 
|                 objjson.code = "0"; | 
|                 objjson.count = 0; | 
|                 objjson.Message = "删除失败!"; | 
|                 objjson.data = null; | 
|                 return objjson; | 
|             } | 
|   | 
|         } | 
|   | 
|     } | 
|   | 
|   | 
| } |