From c48c7746efa89e3cbf38e089d20cd9029c2ce1c8 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期五, 07 六月 2024 09:52:37 +0800 Subject: [PATCH] 模具点检单PDA 扫条码没有返回数据,核对匹配字段 --- WebAPI/Controllers/Kf_EntrustInBillController.cs | 725 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 694 insertions(+), 31 deletions(-) diff --git a/WebAPI/Controllers/Kf_EntrustInBillController.cs b/WebAPI/Controllers/Kf_EntrustInBillController.cs index d8da958..83ea244 100644 --- a/WebAPI/Controllers/Kf_EntrustInBillController.cs +++ b/WebAPI/Controllers/Kf_EntrustInBillController.cs @@ -1,8 +1,11 @@ 锘縰sing Model; using Newtonsoft.Json.Linq; using System; +using Pub_Class; +using System.Collections; using System.Collections.Generic; using System.Data; +using System.Data.SqlClient; using System.Linq; using System.Net; using System.Net.Http; @@ -35,15 +38,18 @@ public bool sRedBlueFlag = false; public bool SourceFlag = false; //public string sSourceType = "1601"; - // public bool sRedBlue = false; + // public bool sRedBlue = false; public WebServer webserver = new WebServer(); public DataSet ds = new DataSet(); public ClsGy_BarCodeBill_WMS_Model_View oView = new ClsGy_BarCodeBill_WMS_Model_View(); public ClsKF_PonderationBillMain_Temp model = new ClsKF_PonderationBillMain_Temp(); public ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); - private JsonResult objJsonResult = new JsonResult(); + private json objJsonResult = new json(); + public DAL.ClsCg_POInStockBill BillOld = new DAL.ClsCg_POInStockBill(); public WebS.WebService1 oWebs = new WebS.WebService1(); public WebS.ClsKf_ICStockBill_WMS WebSoBar = new WebS.ClsKf_ICStockBill_WMS(); + public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + /// <summary> /// 濮斿鍏ュ簱/鎵潯鐮�/鐩存帴璋僿ebservice @@ -82,24 +88,11 @@ try { ds = webserver.GetKf_PonderationBillMain_TempList(HBillType, sWhere); - if (ds == null || ds.Tables[0].Rows.Count <= 0) - { - - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; - objJsonResult.data = null; - return objJsonResult; - //DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning); - } - else - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; - objJsonResult.data = ds.Tables[0]; - return objJsonResult; - } + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; } catch (Exception e) { @@ -119,7 +112,7 @@ [HttpGet] public Object get_CheckTypeByBarCode_All_Json(string sCode, Int64 sInterID, string sBillNo, string sMaker, Int64 WhID, Int64 SPID, Double sQty, bool sRedBlue, bool SourceFlag, string sSourceBillNo, string sSourceType, Int64 HOWNERID, string sExpressNumber) { - oBar = webserver.get_CheckTypeByBarCode_All(sCode, sInterID, HBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID,sExpressNumber, ref DBUtility.ClsPub.sErrInfo); + oBar = webserver.get_CheckTypeByBarCode_All(sCode, sInterID, HBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, sExpressNumber, ref DBUtility.ClsPub.sErrInfo); if (oBar == null) { objJsonResult.code = "0"; @@ -178,13 +171,14 @@ return objJsonResult; } } + /// <summary> /// 鐢熸垚濮斿鍏ュ簱鍗� /// </summary> /// <returns></returns> [Route("Kf_EntrustInBill/set_SaveEntrustInBill_Json")] [HttpPost] - public object set_SaveEntrustInBill_Json([FromBody]JObject oMain) + public object set_SaveEntrustInBill_Json([FromBody] JObject oMain) { var _value = oMain["oMain"].ToString(); string msg1 = _value.ToString(); @@ -223,7 +217,7 @@ if (webserver.set_SaveEntrustInBill_New(websLsmain, sSourceBillType, ref DBUtility.ClsPub.sErrInfo)) { - objJsonResult.code = "0"; + objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "鐢熸垚濮斿鍏ュ簱鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�"; objJsonResult.data = null; @@ -255,7 +249,7 @@ /// <returns></returns> [Route("Kf_EntrustInBill/set_SaveEntrustInBill_New_Json")] [HttpPost] - public object set_SaveEntrustInBill_New_Json([FromBody]JObject oMain) + public object set_SaveEntrustInBill_New_Json([FromBody] JObject oMain) { var _value = oMain["oMain"].ToString(); string msg1 = _value.ToString(); @@ -275,7 +269,7 @@ websLsmain.HDate = lsmain[0].HDate; websLsmain.HBillNo = lsmain[0].HBillNo; websLsmain.HBillType = lsmain[0].HBillType; - websLsmain.HBillerID = DBUtility.ClsPub.isLong(DBUtility.ClsPub.CurUserID); + websLsmain.HBillerID = lsmain[0].HBillerID; websLsmain.HDeptID = lsmain[0].HDeptID; websLsmain.HEmpID = lsmain[0].HEmpID; websLsmain.HRemark = ""; @@ -288,7 +282,7 @@ websLsmain.HMainSourceBillType = "1103"; websLsmain.HMangerID = lsmain[0].HMangerID; websLsmain.HWHID = lsmain[0].HWHID; - websLsmain.HExplanation = ""; + websLsmain.HExplanation = lsmain[0].HExplanation; string sSourceBillType = "1103"; @@ -296,7 +290,8 @@ { objJsonResult.code = "0"; objJsonResult.count = 1; - objJsonResult.Message = "鐢熸垚濮斿鍏ュ簱鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�"; + objJsonResult.Message = DBUtility.ClsPub.sErrInfo; //鎴愬姛锛� + //objJsonResult.Message = "鐢熸垚濮斿鍏ュ簱鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�"; objJsonResult.data = null; return objJsonResult; } @@ -304,7 +299,8 @@ { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "涓婁紶澶辫触锛�" + DBUtility.ClsPub.sErrInfo; + objJsonResult.Message = DBUtility.ClsPub.sErrInfo; //澶辫触锛� + //objJsonResult.Message = "涓婁紶澶辫触锛�" + DBUtility.ClsPub.sErrInfo; objJsonResult.data = websLsmain; return objJsonResult; } @@ -398,7 +394,7 @@ /// <returns></returns> [Route("Kf_EntrustInBill/set_SaveEntrustInBackBill_Json")] [HttpPost] - public object set_SaveEntrustInBackBill_Json([FromBody]JObject oMain) + public object set_SaveEntrustInBackBill_Json([FromBody] JObject oMain) { var _value = oMain["oMain"].ToString(); string msg1 = _value.ToString(); @@ -425,7 +421,8 @@ { objJsonResult.code = "0"; objJsonResult.count = 1; - objJsonResult.Message = "鐢熸垚濮斿鍏ュ簱(绾㈠瓧)鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�"; + objJsonResult.Message = DBUtility.ClsPub.sErrInfo; //鎴愬姛锛� + //objJsonResult.Message = "鐢熸垚濮斿鍏ュ簱(绾㈠瓧)鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�"; objJsonResult.data = null; return objJsonResult; } @@ -433,7 +430,8 @@ { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "涓婁紶澶辫触锛�" + DBUtility.ClsPub.sErrInfo; + objJsonResult.Message = DBUtility.ClsPub.sErrInfo; //澶辫触锛� + //objJsonResult.Message = "涓婁紶澶辫触锛�" + DBUtility.ClsPub.sErrInfo; objJsonResult.data = null; return objJsonResult; } @@ -448,5 +446,670 @@ return objJsonResult; } } + + #region 濮斿鍔犲伐鍏ュ簱鍗� 鍒犻櫎 + + /// </summary> + [Route("Kf_EntrustInBill/DeleteKf_EntrustInBill")] + [HttpGet] + public object DeleteKf_EntrustInBill(string HInterID, string user) + { + try + { + string s = ""; + DAL.ClsKf_OtherInBill oBill = new DAL.ClsKf_OtherInBill(); + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Kf_EntrustInBill_Drop", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (HInterID == null || HInterID.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + if (oBill.ShowBill(long.Parse(HInterID), ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽鍒犻櫎锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + + oCN.BeginTran(); + + oCN.RunProc("delete from Kf_ICStockBillMain where HInterID = " + HInterID); + oCN.RunProc("delete from Kf_ICStockBillSub where HInterID= " + HInterID); + + + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 濮斿鍔犲伐鍏ュ簱鍗� 瀹℃牳/鍙嶅鏍� + /// <summary> + /// + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Kf_EntrustInBill/AuditKf_EntrustInBill")] + [HttpGet] + public object AuditKf_EntrustInBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊鏍告潈闄� + if (!DBUtility.ClsPub.Security_Log("Kf_EntrustInBill_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬鏍�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + + ClsPub.CurUserName = user; + BillOld.MvarItemKey = "Kf_ICStockBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳 + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //瀹℃牳鍗曟嵁 + if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍� + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜鍙嶅鏍革紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍙嶅鏍革紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + + //鍙嶅鏍稿崟鎹� + if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閲囪喘鍏ュ簱鍗� 鍏抽棴/鍙嶅叧闂姛鑳� + [Route("Kf_EntrustInBill/CloseKf_EntrustInBill")] + [HttpGet] + public object CloseKf_EntrustInBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Kf_EntrustInBill_Close", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬叧闂�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + BillOld.MvarItemKey = "Kf_ICStockBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 鍏抽棴 2 鍙嶅叧闂� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴 + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + //if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + //鍏抽棴鍗曟嵁 + if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂� + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + //if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!"; + // objJsonResult.data = null; + // return objJsonResult; + //} + if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸啀鍙嶅叧闂�!"; + objJsonResult.data = null; + return objJsonResult; + } + //鍙嶅叧闂崟鎹� + if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + + #region 閲囪喘鍏ュ簱鍗� 浣滃簾/鍙嶄綔搴熷姛鑳� + [Route("Kf_EntrustInBill/DropKf_EntrustInBill")] + [HttpGet] + public object DropKf_EntrustInBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈変綔搴熸潈闄� + if (!DBUtility.ClsPub.Security_Log("Kf_EntrustInBill_Drop", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愪綔搴�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + BillOld.MvarItemKey = "Kf_ICStockBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 浣滃簾 2 鍙嶄綔搴� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾 + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶉渶瑕佸啀浣滃簾!"; + objJsonResult.data = null; + return objJsonResult; + } + //浣滃簾鍗曟嵁 + if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶄綔搴� + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸啀鍙嶄綔搴�!"; + objJsonResult.data = null; + return objJsonResult; + } + //鍙嶄綔搴熷崟鎹� + if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 濮斿鍑哄簱 + /// <summary> + /// 濮斿鍑哄簱/鎻愪氦/鐩存帴璋冪敤webservice + /// </summary> + /// <returns></returns> + [Route("Kf_EntrustInBill/set_SaveEntrustOutBill_Json")] + [HttpPost] + public object set_SaveEntrustOutBill_Json([FromBody] JObject oMain) + { + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + try + { + List<Model.ClsKf_EntrustInBillMain> lsmain = new List<Model.ClsKf_EntrustInBillMain>(); + ListModels oListModels = new ListModels(); + lsmain = oListModels.getEntrustInBillMainByJson(msg1); + lsmain[0].HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + lsmain[0].HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); + lsmain[0].HBillType = "1211"; + + WebAPI.WebS.ClsKf_EntrustInBillMain websLsmain = new WebS.ClsKf_EntrustInBillMain(); + + websLsmain.HInterID = lsmain[0].HInterID; + websLsmain.HInnerBillNo = ""; + websLsmain.HDate = lsmain[0].HDate; + websLsmain.HBillNo = lsmain[0].HBillNo; + websLsmain.HBillType = lsmain[0].HBillType; + websLsmain.HBillerID = DBUtility.ClsPub.isLong(DBUtility.ClsPub.CurUserID); + websLsmain.HDeptID = lsmain[0].HDeptID; + websLsmain.HEmpID = lsmain[0].HEmpID; + websLsmain.HRemark = ""; + websLsmain.HRedBlueFlag = lsmain[0].HRedBlueFlag; + websLsmain.HMaker = lsmain[0].HMaker; + websLsmain.HSupID = lsmain[0].HSupID; + websLsmain.HSecManagerID = lsmain[0].HSecManagerID; + websLsmain.HSCWHID = lsmain[0].HSCWHID; + websLsmain.HKeeperID = lsmain[0].HKeeperID; + websLsmain.HMainSourceBillType = "1604"; + websLsmain.HMangerID = lsmain[0].HMangerID; + websLsmain.HWHID = lsmain[0].HWHID; + websLsmain.HExplanation = lsmain[0].HExplanation; + websLsmain.HBillType = "1211";//鍥哄畾鍊� + + string sSourceBillType = "1604"; + + if (webserver.set_SaveEntrustInBill_New(websLsmain, sSourceBillType, ref DBUtility.ClsPub.sErrInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鐢熸垚濮斿鍑哄簱鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "涓婁紶澶辫触锛�" + DBUtility.ClsPub.sErrInfo; + objJsonResult.data = websLsmain; + return objJsonResult; + } + } + catch (Exception e) + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "涓婁紶澶辫触锛佸紓甯�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 濮斿鍑哄簱 鎵弿婧愬崟锛屽皢婧愬崟淇℃伅鍐欏叆鏉$爜涓存椂琛� + /// </summary> + /// <param name="HSourceBillNo"></param> + /// <returns></returns> + [Route("Kf_EntrustInBill/GetWW_PPBomBillMainByHSourceBillNo")] + [HttpGet] + public object GetWW_PPBomBillMainByHSourceBillNo(string HSourceBillType, string HSourceBillNo, Int64 sInterID, string sBillNo) + { + try + { + string sWhere = " Where 鍗曟嵁鍙� like '%" + HSourceBillNo.Trim() + "%'"; + if (HSourceBillType == "1604") + { + ds = oCN.RunProcReturn("Select HBillNo,HSupID,s.HName HSupName from WW_PPBomBillMain a left join Gy_Supplier s on a.HSupID=s.HItemID Where HBillNo='" + HSourceBillNo+"'", "WW_PPBomBillMain"); + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍,婧愬崟绫诲瀷鏈夐敊璇紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; + objJsonResult.data = null; + return objJsonResult; + //DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning); + } + else + { + if (webserver.set_SavePonderationBillMain_Temp_Source_Fast(sInterID, sBillNo, "1211", HSourceBillNo, HSourceBillType, "钃濆瓧", ref DBUtility.ClsPub.sErrInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍐欏叆涓存椂琛ㄥけ璐ワ紒" + DBUtility.ClsPub.sErrInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion } } -- Gitblit v1.9.1