From ab146c91c1862a5eb6b4d156e7cae1926afa6ec5 Mon Sep 17 00:00:00 2001 From: zzr99 <1940172413@qq.com> Date: 星期五, 10 九月 2021 14:59:15 +0800 Subject: [PATCH] 设备点检计划单、编辑点检计划+设备点检记录单、编辑点检记录 --- WebAPI/Controllers/LookingForBillController.cs | 266 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 243 insertions(+), 23 deletions(-) diff --git a/WebAPI/Controllers/LookingForBillController.cs b/WebAPI/Controllers/LookingForBillController.cs index 8bbba99..119212f 100644 --- a/WebAPI/Controllers/LookingForBillController.cs +++ b/WebAPI/Controllers/LookingForBillController.cs @@ -186,19 +186,25 @@ ListModels oListModels = new ListModels(); List<LookingForBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LookingForBill>>(oMainData); oCN.BeginTran(); - var mainSql = "Insert Into LookingForBillMain " + - "(HInterID,HBillNo,HSourceInterID,HSourceBillNo,HCreateBy)" + + //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].HMaker + "')"; + "(" + 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 LookingForBillSub " + - "(HWHID,HWHName,HSPID,HSPName,HBillType,HMTONo,HQty,HMaterID,HMaterName,HMaterNumber,HMaterModel,HBarCode,HGroupID,HGroup,HSourceID,HSource,HIsStatus,HStatus,HCreateBy,HMainItemID)" + + 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 + "','1253','" + list[i].HMTONo + "',"+ list[i].HQty + "," + "(" + 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 LookingForBillMain where HBillNo = '"+ list[i].HBillNo + "'))"; + + 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); @@ -237,23 +243,40 @@ 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 LookingForBillMain " + - "(HInterID,HBillNo,HSourceInterID,HSourceBillNo,HCreateBy)" + + 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].HSourceInterID + ",'" + list[0].HSourceBillNo + "','" + list[0].HMaker + "')"; + "(" + 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 LookingForBillSub " + - "(HWHID,HWHName,HSPID,HSPName,HBillType,HMTONo,HQty,HMaterID,HMaterName,HMaterNumber,HMaterModel,HBarCode,HGroupID,HGroup,HSourceID,HSource,HIsStatus,HStatus,HCreateBy,HMainItemID)" + + 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 + "','1252','" + list[i].HMTONo + "'," + list[i].HQty + "," + "(" + 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 LookingForBillMain where HBillNo = '" + list[i].HBillNo + "'))"; + + 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='鍦ㄥ簱' where HBarCode = '" + list[i].HBarCode + "'"; + 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"; @@ -286,7 +309,7 @@ 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 + ""; + string sWhere = " Where HWHID = " + HWHID + " and HItemID = " + HSpID + ""; ds = getSpName_Json_s(sWhere); if (ds == null || ds.Tables[0].Rows.Count <= 0) { @@ -316,16 +339,138 @@ } /// <summary> - /// 寰呭彂鍖烘壘璐ф牴鎹簮鍗曞彿 杩斿洖鐩稿叧淇℃伅 + /// 鍚敤mes浠撲綅锛屾牴鎹�佷粨搴撹浆鎹㈡垚鏂颁粨搴� /// </summary> /// <returns></returns> - [Route("LookingFor/getWaitingLookingFor")] + [Route("LookingFor/GetSpNameMES_Json")] [HttpGet] - public object GetWaitingLookingFor(string HBillType,string HBillNo,string HSourceBillNo,string HCreateBy,string BenginHCreateDate,string EndHCreateDate) + public object GetSpNameMES_Json(string HERPWHID) { try { - ds = GetWaitingLookingFor_s(HBillType, HBillNo, HSourceBillNo, HCreateBy, BenginHCreateDate, EndHCreateDate); + 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"; @@ -368,6 +513,7 @@ 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"); @@ -378,15 +524,89 @@ 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 * from h_v_IF_StockPlace " + sWhere, "h_v_IF_StockPlace"); + return new SQLHelper.ClsCN().RunProcReturn("select HWHID,* from h_v_IF_StockPlace " + sWhere, "h_v_IF_StockPlace"); } - public static DataSet GetWaitingLookingFor_s(string HBillType, string HBillNo, string HSourceBillNo,string HCreateBy,string BenginHCreateDate,string EndHCreateDate) + + //鍚敤mes浠撲綅锛屾牴鎹�佷粨搴撹浆鎹㈡垚鏂颁粨搴� + public static DataSet GetSpNameMES_Json_s(string HERPWHID) { - return new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_lookForBillList " + "'" + HBillType + "','" + HBillNo + "','" + HSourceBillNo + "','" + HCreateBy + "','" + HCreateBy + "','" + HCreateBy + "','" + BenginHCreateDate + "','" + EndHCreateDate + "'", "h_p_lookForBillList"); + 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 } -- Gitblit v1.9.1