| using Newtonsoft.Json.Linq; | 
| using System; | 
| using System.Collections.Generic; | 
| using System.Data; | 
| using System.Web.Http; | 
| using WebAPI.Models; | 
| namespace WebAPI.Controllers | 
| { | 
|     /** | 
|      * 找货单单 | 
|      */ | 
|     public class LookingForBillController : ApiController | 
|     { | 
|         private json objJsonResult = new json(); | 
|         public DataSet ds = new DataSet(); | 
|         public WebServer webserver = new WebServer(); | 
|   | 
|   | 
|         /// <summary> | 
|         /// 根据包装单 返回此包装单内的相关信息 | 
|         /// </summary> | 
|         /// <returns></returns> | 
|         [Route("LookingFor/getPackUnionBillList")] | 
|         [HttpGet] | 
|         public object getPackUnionBillList(string HBarCode_Pack) | 
|         { | 
|             try | 
|             { | 
|                 ds = getPackUnionBillList_s(HBarCode_Pack); | 
|                 if (ds == null || Pub_Class.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0) | 
|                 { | 
|                     objJsonResult.code = "0"; | 
|                     objJsonResult.count = 0; | 
|                     objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString(); | 
|                     objJsonResult.data = ds.Tables[0]; | 
|                     return objJsonResult; | 
|                 } | 
|                 else | 
|                 {  | 
|                     objJsonResult.code = "1"; | 
|                     objJsonResult.count = 1; | 
|                     objJsonResult.Message = "扫码成功!"; | 
|                     objJsonResult.data = ds.Tables[0]; | 
|                     return objJsonResult;  | 
|                 } | 
|             } | 
|             catch (Exception ex) | 
|             {  | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 根据实物条码验证状态 | 
|         /// </summary> | 
|         /// <returns></returns> | 
|         [Route("LookingFor/getPackUnionBillListDetailed")] | 
|         [HttpGet] | 
|         public object getPackUnionBillListDetailed(string HBarCode) | 
|         { | 
|             try | 
|             { | 
|                 ds = getPackUnionBillListDetailed_s(HBarCode); | 
|                 if (ds == null || Pub_Class.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0) | 
|                 { | 
|                     objJsonResult.code = "0"; | 
|                     objJsonResult.count = 0; | 
|                     objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString(); | 
|                     objJsonResult.data = ds.Tables[0]; | 
|                     return objJsonResult; | 
|                 } | 
|                 else | 
|                 { | 
|                     objJsonResult.code = "1"; | 
|                     objJsonResult.count = 1; | 
|                     objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString(); | 
|                     objJsonResult.data = ds.Tables[0]; | 
|                     return objJsonResult; | 
|                 } | 
|             } | 
|             catch (Exception ex) | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 下架找货单根据销售订单 返回此销售订单内的相关信息 | 
|         /// </summary> | 
|         /// <returns></returns> | 
|         [Route("LookingFor/getSellOrderList")] | 
|         [HttpGet] | 
|         public object getSellOrderList(string HSourceBillNo) | 
|         { | 
|             try | 
|             { | 
|                 ds = getSellOrderList_s(HSourceBillNo); | 
|                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
|                 { | 
|                     objJsonResult.code = "0"; | 
|                     objJsonResult.count = 0; | 
|                     objJsonResult.Message = "没有返回任何记录!"; | 
|                     objJsonResult.data = null; | 
|                     return objJsonResult; | 
|                 } | 
|                 else | 
|                 { | 
|                     objJsonResult.code = "1"; | 
|                     objJsonResult.count = 1; | 
|                     objJsonResult.Message = "返回记录成功!"; | 
|                     objJsonResult.data = ds.Tables[0]; | 
|                     return objJsonResult; | 
|                 } | 
|             } | 
|             catch (Exception ex) | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 上架归还单根据实物条码 返回相关信息 | 
|         /// </summary> | 
|         /// <returns></returns> | 
|         [Route("LookingFor/getBarCodeDetails")] | 
|         [HttpGet] | 
|         public object getBarCodeDetails(string HBarCode) | 
|         { | 
|             try | 
|             { | 
|                 string sWhere = " Where HBarCode = '" + HBarCode.Trim() + "'"; | 
|                 ds = getBarCodeDetails_s(sWhere); | 
|                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
|                 { | 
|                     objJsonResult.code = "0"; | 
|                     objJsonResult.count = 0; | 
|                     objJsonResult.Message = "没有返回任何记录!"; | 
|                     objJsonResult.data = null; | 
|                     return objJsonResult; | 
|                 } | 
|                 else | 
|                 { | 
|                     objJsonResult.code = "1"; | 
|                     objJsonResult.count = 1; | 
|                     objJsonResult.Message = "返回记录成功!"; | 
|                     objJsonResult.data = ds.Tables[0]; | 
|                     return objJsonResult; | 
|                 } | 
|             } | 
|             catch (Exception ex) | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 生成下架找货单 | 
|         /// </summary> | 
|         /// <returns></returns> | 
|         [Route("LookingFor/set_SaveLookingForBill_Json")] | 
|         [HttpPost] | 
|         public object set_SaveLookingForBill_Json([FromBody]JObject oMain) | 
|         { | 
|             string oMainData = oMain["oMain"].ToString(); | 
|             oMainData = oMainData.Substring(8,oMainData.Length-9); | 
|             SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|             try | 
|             { | 
|                 List<LookingForBill> lsmain = new List<LookingForBill>(); | 
|                 ListModels oListModels = new ListModels(); | 
|                 List<LookingForBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LookingForBill>>(oMainData); | 
|                 oCN.BeginTran(); | 
|                 //var mainSql1 = "Insert Into Kf_LookingForReturnBillMain " + | 
|                 //    "(HInterID,HBillNo,HSourceInterID,HSourceBillNo,HCreateBy)" + | 
|                 //    " values" + | 
|                 //    "(" + list[0].HInterID + ",'" + list[0].HBillNo + "'," + list[0].HSourceInterID + ",'" + list[0].HSourceBillNo + "','" + list[0].HMaker + "')"; | 
|                 var mainSql = "Insert Into Kf_LookingForBillMain " + | 
|                     "(HInterID,HBillNo,HSourceInterID,HSourceBillNo,HWhID,HWhName,HSPID,HSPName,HGroupID,HGroup" + | 
|                     ",HSourceID,HSource,HCreateBy)" + | 
|                     " values" + | 
|                     "(" + list[0].HInterID + ",'" + list[0].HBillNo + "'," + list[0].HSourceInterID+ ",'" + list[0].HSourceBillNo + "'," + list[0].HWHID + ",'" + list[0].HWHName + "'," + list[0].HSPID + ",'" + list[0].HSPName + "'," + list[0].HGroupID + ",'" + list[0].HGroup + "'," | 
|                     + list[0].HSourceID + ",'" + list[0].HSource + "','" + list[0].HMaker + "')"; | 
|                 oCN.RunProc(mainSql); | 
|                 for (int i = 0; i < list.Count; i++) | 
|                 { | 
|                     var subSql = "Insert Into Kf_LookingForBillSub " + | 
|                     "(HWHID,HWHName,HSPID,HSPName,HMTONo,HQty,HMaterID,HMaterName,HMaterNumber,HMaterModel,HBarCode,HGroupID,HGroup,HSourceID,HSource,HCreateBy,HMainItemID)" + | 
|                     " values" + | 
|                     "(" + list[i].HWHID + ",'" + list[i].HWHName + "'," + list[i].HSPID + ",'" + list[i].HSPName + "','" + list[i].HMTONo + "',"+ list[i].HQty + "," | 
|                     + list[i].HMaterID + ",'"+ list[i].HMaterName + "','"+ list[i].HMaterNumber + "','"+ list[i].HMaterModel + "','" + list[i].HBarCode + "'," | 
|                     + list[i].HGroupID + ",'"+ list[i].HGroup + "',"+ list[i].HSourceID + ",'" + list[i].HSource + "','"+ list[i].HMaker + "',(select HItemID from Kf_LookingForBillMain where HBillNo = '" + list[i].HBillNo + "'))"; | 
|                     oCN.RunProc(subSql); | 
|                     var barCodeSql = "update Gy_BarCodeBill set HStatus='裁切中-" + list[i].HSource + "' where HBarCode = '"+ list[i].HBarCode + "'"; | 
|                     oCN.RunProc(barCodeSql); | 
|                 } | 
|                 oCN.Commit(); | 
|                 objJsonResult.code = "1"; | 
|                 objJsonResult.count = 1; | 
|                 objJsonResult.Message = "生成找货单成功!单据号为:" + list[0].HBillNo; | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 oCN.RollBack(); | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "上传失败!" + e.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 生成上架归还单 | 
|         /// </summary> | 
|         /// <returns></returns> | 
|         [Route("LookingFor/set_SaveLookingForReturnBill_Json")] | 
|         [HttpPost] | 
|         public object set_SaveLookingForReturnBill_Json([FromBody] JObject oMain) | 
|         { | 
|             string oMainData = oMain["oMain"].ToString(); | 
|             oMainData = oMainData.Substring(8, oMainData.Length - 9); | 
|             SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|             try | 
|             { | 
|                 List<LookingForBill> lsmain = new List<LookingForBill>(); | 
|                 ListModels oListModels = new ListModels(); | 
|                 List<LookingForBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LookingForBill>>(oMainData); | 
|                 string flag = ""; | 
|                 oCN.BeginTran(); | 
|                 var mainSql = "Insert Into Kf_LookingForReturnBillMain " + | 
|                     "(HInterID,HBillNo,HWhID,HWhName,HSPID,HSPName,HGroupID,HGroup" + | 
|                     ",HSourceID,HSource,HCreateBy)" + | 
|                     " values" + | 
|                     "(" + list[0].HInterID + ",'" + list[0].HBillNo + "'," + list[0].HWHID + ",'" + list[0].HWHName + "'," + list[0].HSPID + ",'" + list[0].HSPName + "'," + list[0].HGroupID + ",'" + list[0].HGroup + "'," | 
|                     + list[0].HSourceID + ",'" + list[0].HSource + "','" + list[0].HMaker + "')"; | 
|                 oCN.RunProc(mainSql); | 
|                 for (int i = 0; i < list.Count; i++) | 
|                 { | 
|                     var subSql = "Insert Into Kf_LookingForReturnBillSub " + | 
|                     "(HWHID,HWHName,HSPID,HSPName,HMTONo,HQty,HMaterID,HMaterName,HMaterNumber,HMaterModel,HBarCode,HGroupID,HGroup,HSourceID,HSource,HCreateBy,HMainItemID)" + | 
|                     " values" + | 
|                     "(" + list[i].HWHID + ",'" + list[i].HWHName + "'," + list[i].HSPID + ",'" + list[i].HSPName + "','" + list[i].HMTONo + "'," + list[i].HQty + "," | 
|                     + list[i].HMaterID + ",'" + list[i].HMaterName + "','" + list[i].HMaterNumber + "','" + list[i].HMaterModel + "','" + list[i].HBarCode + "'," | 
|                     + list[i].HGroupID + ",'" + list[i].HGroup + "'," + list[i].HSourceID + ",'" + list[i].HSource + "','" + list[i].HMaker + "',(select HItemID from Kf_LookingForReturnBillMain where HBillNo = '" + list[i].HBillNo + "'))"; | 
|                     oCN.RunProc(subSql); | 
|                     var barCodeSql = "update Gy_BarCodeBill set HStatus='" + list[i].HSPName + "-" + list[i].HWHName + "' where HBarCode = '" + list[i].HBarCode + "'"; | 
|                     oCN.RunProc(barCodeSql); | 
|                     //判断是否是托条码 | 
|                     if (JudgeIsBarCode_s(list[i].HBarCode)) | 
|                     { | 
|                         //如果是托条码更新托条码中的实物条码 | 
|                         //返回托条码中的实物条码 | 
|                         ds = GetHBarCode_s(list[i].HBarCode); | 
|                         int HCount = Pub_Class.ClsPub.isInt(ds.Tables[0].Rows.Count); | 
|                         for (int j = 0; j < HCount; j++) | 
|                         { | 
|                             string HSonBarCode = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[j][0]); | 
|                             var SonBarCodeSql = "update Gy_BarCodeBill set HStatus='" + list[i].HSPName + "-" + list[i].HWHName + "' where HBarCode = '" + HSonBarCode + "'"; | 
|                             oCN.RunProc(SonBarCodeSql); | 
|                         } | 
|                     } | 
|                 } | 
|                 oCN.Commit(); | 
|                 objJsonResult.code = "1"; | 
|                 objJsonResult.count = 1; | 
|                 objJsonResult.Message = "生成归还单成功!单据号为:" + list[0].HBillNo; | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 oCN.RollBack(); | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "上传失败!" + e.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 根据仓位二维码带出仓库仓位相关信息 | 
|         /// </summary> | 
|         /// <returns></returns> | 
|         [Route("LookingFor/getSpName_Json")] | 
|         [HttpGet] | 
|         public object getSpName_Json(string HBarCode) | 
|         { | 
|             try | 
|             { | 
|                 string[] sArray = HBarCode.Remove(0, 3).Split(';'); | 
|                 long HSpID = DBUtility.ClsPub.isLong(sArray[1]); | 
|                 long HWHID = DBUtility.ClsPub.isLong(sArray[0]); | 
|                 string sWhere = " Where HWHID = " + HWHID + " and HItemID = " + HSpID + ""; | 
|                 ds = getSpName_Json_s(sWhere); | 
|                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
|                 { | 
|                     objJsonResult.code = "0"; | 
|                     objJsonResult.count = 0; | 
|                     objJsonResult.Message = "没有返回任何记录!"; | 
|                     objJsonResult.data = null; | 
|                     return objJsonResult; | 
|                 } | 
|                 else | 
|                 { | 
|                     objJsonResult.code = "1"; | 
|                     objJsonResult.count = 1; | 
|                     objJsonResult.Message = "返回记录成功!"; | 
|                     objJsonResult.data = ds.Tables[0]; | 
|                     return objJsonResult; | 
|                 } | 
|             } | 
|             catch (Exception ex) | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 启用mes仓位,根据老仓库转换成新仓库 | 
|         /// </summary> | 
|         /// <returns></returns> | 
|         [Route("LookingFor/GetSpNameMES_Json")] | 
|         [HttpGet] | 
|         public object GetSpNameMES_Json(string HERPWHID) | 
|         { | 
|             try | 
|             { | 
|                 ds = GetSpNameMES_Json_s(HERPWHID); | 
|                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
|                 { | 
|                     objJsonResult.code = "0"; | 
|                     objJsonResult.count = 0; | 
|                     objJsonResult.Message = "请维护新老仓库对应表!"; | 
|                     objJsonResult.data = null; | 
|                     return objJsonResult; | 
|                 } | 
|                 else | 
|                 { | 
|                     objJsonResult.code = "1"; | 
|                     objJsonResult.count = 1; | 
|                     objJsonResult.Message = "返回记录成功!"; | 
|                     objJsonResult.data = ds.Tables[0]; | 
|                     return objJsonResult; | 
|                 } | 
|             } | 
|             catch (Exception ex) | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 待发区找货根据源单号 返回相关信息 | 
|         /// </summary> | 
|         /// <returns></returns> | 
|         //[Route("LookingFor/getWaitingLookingFor")] | 
|         //[HttpGet] | 
|         //public object GetWaitingLookingFor(string HBillType,string HBillNo,string HSourceBillNo,string HCreateBy,string BenginHCreateDate,string EndHCreateDate) | 
|         //{ | 
|         //    try | 
|         //    { | 
|         //        ds = GetWaitingLookingFor_s(HBillType, HBillNo, HSourceBillNo, HCreateBy, BenginHCreateDate, EndHCreateDate); | 
|         //        if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
|         //        { | 
|         //            objJsonResult.code = "0"; | 
|         //            objJsonResult.count = 0; | 
|         //            objJsonResult.Message = "没有返回任何记录!"; | 
|         //            objJsonResult.data = null; | 
|         //            return objJsonResult; | 
|         //        } | 
|         //        else | 
|         //        { | 
|         //            objJsonResult.code = "1"; | 
|         //            objJsonResult.count = 1; | 
|         //            objJsonResult.Message = "返回记录成功!"; | 
|         //            objJsonResult.data = ds.Tables[0]; | 
|         //            return objJsonResult; | 
|         //        } | 
|         //    } | 
|         //    catch (Exception ex) | 
|         //    { | 
|         //        objJsonResult.code = "0"; | 
|         //        objJsonResult.count = 0; | 
|         //        objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
|         //        objJsonResult.data = null; | 
|         //        return objJsonResult; | 
|         //    } | 
|         //} | 
|   | 
|         /// <summary> | 
|         /// 上下架单列表 | 
|         /// </summary> | 
|         /// <returns></returns> | 
|         [Route("LookingFor/GetLookingForBillList")] | 
|         [HttpGet] | 
|         public object GetLookingForBillList(string HBillType, string sWhere) | 
|         { | 
|             try | 
|             { | 
|                 if (HBillType == "ZHXJ") | 
|                 { | 
|                     ds = GetLookingForBillListXJ_s(sWhere); | 
|                 } | 
|                 else if (HBillType == "ZHSJ") | 
|                 { | 
|                     ds = GetLookingForBillListSJ_s(sWhere); | 
|                 } | 
|                 else | 
|                 { | 
|                     ds = GetLookingForBillList_s(sWhere); | 
|                 } | 
|                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
|                 { | 
|                     objJsonResult.code = "0"; | 
|                     objJsonResult.count = 0; | 
|                     objJsonResult.Message = "没有返回任何记录!"; | 
|                     objJsonResult.data = null; | 
|                     return objJsonResult; | 
|                 } | 
|                 else | 
|                 { | 
|                     objJsonResult.code = "1"; | 
|                     objJsonResult.count = 1; | 
|                     objJsonResult.Message = "返回记录成功!"; | 
|                     objJsonResult.data = ds.Tables[0]; | 
|                     return objJsonResult; | 
|                 } | 
|             } | 
|             catch (Exception ex) | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|   | 
|         //销售出库源单查货-根据销售订单查找实物所在库位 | 
|         [Route("LookingFor/GetSellOutFindSP")] | 
|         [HttpGet] | 
|         public object GetSellOutFindSP(string HbillNo)//h_p_Xs_SellOutFindSP | 
|         { | 
|             try | 
|             { | 
|                 ds = GetSellOutFindSP_s(HbillNo); | 
|                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
|                 { | 
|                     objJsonResult.code = "0"; | 
|                     objJsonResult.count = 0; | 
|                     objJsonResult.Message = "没有返回任何记录!"; | 
|                     objJsonResult.data = null; | 
|                     return objJsonResult; | 
|                 } | 
|                 else | 
|                 { | 
|                     objJsonResult.code = "1"; | 
|                     objJsonResult.count = 1; | 
|                     objJsonResult.Message = "返回记录成功!"; | 
|                     objJsonResult.data = ds.Tables[0]; | 
|                     return objJsonResult; | 
|                 } | 
|             } | 
|             catch (Exception ex) | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|   | 
|   | 
|         #region sql语句 | 
|   | 
|         public static DataSet getPackUnionBillList_s(string HBarCode_Pack) | 
|         { | 
|             return new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Kf_getPackUnionBillList " + "'"+HBarCode_Pack+"'", "h_p_Kf_getPackUnionBillList"); | 
|         } | 
|   | 
|         public static DataSet getPackUnionBillListDetailed_s(string HBarCode) | 
|         { | 
|             return new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Kf_getPackUnionBillListDetailed " + "'" + HBarCode + "'", "h_p_Kf_getPackUnionBillListDetailed"); | 
|         } | 
|   | 
|         public static DataSet getSellOrderList_s(string HSourceBillNo) | 
|         { | 
|             //同步销售订单 | 
|             new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_IFCLD_ERPSourceBillToLocal_SEOrderToICMO '" + HSourceBillNo+ "'", "h_p_IFCLD_ERPSourceBillToLocal_SEOrderToICMO"); | 
|             string sWhere = " Where HSourceBillNo = '" + HSourceBillNo.Trim() + "'"; | 
|             return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_getSellOrderList_s " + sWhere, "h_v_getSellOrderList_s"); | 
|         } | 
|   | 
|         public static DataSet getBarCodeDetails_s(string sWhere) | 
|         { | 
|             return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_getBarCodeDetails_s " + sWhere, "h_v_getBarCodeDetails_s"); | 
|         } | 
|   | 
|         //根据仓位二维码带出仓库仓位相关信息 | 
|         public static DataSet getSpName_Json_s(string sWhere) | 
|         { | 
|             return new SQLHelper.ClsCN().RunProcReturn("select HWHID,* from h_v_IF_StockPlace " + sWhere, "h_v_IF_StockPlace"); | 
|         } | 
|   | 
|         //启用mes仓位,根据老仓库转换成新仓库 | 
|         public static DataSet GetSpNameMES_Json_s(string HERPWHID) | 
|         { | 
|             return new SQLHelper.ClsCN().RunProcReturn("select HMESWHID,HMESWHNAME from Gy_ERPWHRelationMESWH where HERPWHID = " + HERPWHID + "", "Gy_ERPWHRelationMESWH"); | 
|         } | 
|   | 
|         //下架找货单列表 | 
|         public static DataSet GetLookingForBillListXJ_s(string sWhere) | 
|         { | 
|             return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_lookForBillListXJ ", "h_v_lookForBillListXJ"); | 
|         } | 
|   | 
|         //上架归还单列表 | 
|         public static DataSet GetLookingForBillListSJ_s(string sWhere) | 
|         { | 
|             return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_lookForBillListSJ ", "h_v_lookForBillListSJ"); | 
|         } | 
|   | 
|         //上下架单列表 | 
|         public static DataSet GetLookingForBillList_s(string sWhere) | 
|         { | 
|             return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_lookForBillList where 1 = 1 " + sWhere, "h_v_lookForBillList"); | 
|         } | 
|   | 
|         //判断是否是托条码 | 
|         public static bool JudgeIsBarCode_s(string HBarCode) | 
|         { | 
|             DataSet ds; | 
|             ds = new SQLHelper.ClsCN().RunProcReturn("Select HBarCodeType from Gy_BarCodeBill WITH (NOLOCK) Where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill"); | 
|             if (Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][0]) == "托盘条码") | 
|                 return true; | 
|             else | 
|             { | 
|                 return false; | 
|             } | 
|         } | 
|   | 
|         //返回托条码中的实物条码 | 
|         public static DataSet GetHBarCode_s(string HBarCode) | 
|         { | 
|             return new SQLHelper.ClsCN().RunProcReturn("select HBarCode from Sc_PackUnionBillMain a inner join Sc_PackUnionBillSub b on a.HInterID = b.HInterID Where a.HBarCode_Pack = '" + HBarCode + "'", "Sc_PackUnionBillMain"); | 
|         } | 
|   | 
|         //根据销售订单查找实物所在库位 | 
|         public static DataSet GetSellOutFindSP_s(string HbillNo) | 
|         { | 
|             return new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Xs_SellOutFindSP '" + HbillNo + "'", "h_p_Xs_SellOutFindSP"); | 
|         } | 
|   | 
|         //测试专用接口 | 
|         [Route("LookingFor/Test")] | 
|         [HttpGet] | 
|         public object Test(string HbillNo)//h_p_Xs_SellOutFindSP | 
|         { | 
|             DataSet ds; | 
|             ds = new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Xs_SellOutFindSP '" + HbillNo + "'", "h_p_Xs_SellOutFindSP"); | 
|   | 
|             if (Pub_Class.ClsPub.isLong(ds.Tables[0].Rows.Count) >= 0 ) | 
|             { | 
|                 objJsonResult.code = "1"; | 
|                 objJsonResult.count = 1; | 
|                 objJsonResult.Message = "true!"; | 
|                 objJsonResult.data = ds.Tables[0];//ds.Tables[0].Rows[1][0] | 
|                 return objJsonResult; | 
|             } | 
|             else | 
|             { | 
|                 objJsonResult.code = "0"; | 
|                 objJsonResult.count = 0; | 
|                 objJsonResult.Message = "false!"; | 
|                 objJsonResult.data = null; | 
|                 return objJsonResult; | 
|             } | 
|         } | 
|   | 
|   | 
|   | 
|         #endregion | 
|   | 
|     } | 
| } |