From 9167264eeb081fdbb94d8a1d2f76f35a6ccdd5fe Mon Sep 17 00:00:00 2001 From: 王 垚 <1402714037@qq.com> Date: 星期三, 06 四月 2022 11:02:33 +0800 Subject: [PATCH] nothing --- WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs | 667 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 661 insertions(+), 6 deletions(-) diff --git a/WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs b/WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs index 641a583..d354a67 100644 --- a/WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs +++ b/WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs @@ -4,6 +4,7 @@ using System.Collections; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; @@ -18,8 +19,14 @@ private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; + //鑾峰彇绯荤粺鍙傛暟 + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + + public DAL.ClsSc_MESMaterToSourceBill BillNew = new DAL.ClsSc_MESMaterToSourceBill(); //瀵瑰簲鍗曟嵁绫� + public DAL.ClsSc_MESMaterToSourceBill BillOld = new DAL.ClsSc_MESMaterToSourceBill(); //瀵瑰簲鍗曟嵁绫� + #region 涓婃枡鏀鹃敊鍗昗eb鍒楄〃鏌ヨ /// <summary> /// 杩斿洖鐢熶骇涓婃枡鍗曞垪琛� ///鍙傛暟锛歴tring sql銆� @@ -33,27 +40,27 @@ { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_Sc_MaterToSourceBillList " + sWhere, "h_v_Sc_MaterToSourceBillList"); + ds = oCN.RunProcReturn("select * from h_v_Sc_MaterToSourceBillMain " + sWhere, "h_v_Sc_MaterToSourceBillMain"); } else { - string sql1 = "select * from h_v_Sc_MaterToSourceBillList where 1 = 1 "; + string sql1 = "select * from h_v_Sc_MaterToSourceBillMain where 1 = 1 "; string sql = sql1 + sWhere; - ds = oCN.RunProcReturn(sql, "h_v_Sc_MaterToSourceBillList"); + ds = oCN.RunProcReturn(sql, "h_v_Sc_MaterToSourceBillMain"); } if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; - objJsonResult.data = null; + objJsonResult.data = ds.Tables[0]; return objJsonResult; } else { objJsonResult.code = "1"; objJsonResult.count = 1; - objJsonResult.Message = "Sucess锛�"; + objJsonResult.Message = "鏌ヨ鏁版嵁鎴愬姛锛�"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } @@ -67,10 +74,148 @@ return objJsonResult; } } + #endregion + + #region 涓婃枡闃查敊鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁 + [Route("Sc_MaterToSourceBill/Sc_MaterToSourceBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MaterToSourceBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MaterToSourceBillMain where hmainid= " + HID + " ", "h_v_Sc_MaterToSourceBillMain"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄤ笂鏂欓槻閿欏崟鏁版嵁" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region 涓婃枡闃查敊鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁(閰嶆枡璁板綍銆佹不鍏疯褰�) + [Route("Sc_MaterToSourceBill/Sc_MaterToSourceBillListProjectDetai")] + [HttpGet] + public object Sc_MaterToSourceBillListProjectDetai(string HInterID) + { + + DataSet ds, ds1; + List<object> list = new List<object>(); + string Swhere = ""; + try + { + if (HInterID != "" || HInterID != null) + { + Swhere = " and hmainid='" + HInterID + "'"; + } + else + { + Swhere = HInterID; + } + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鑾峰彇閰嶆枡璁板綍缂栬緫鏁版嵁 + string sql = "select 鏉″舰鐮� HBarCode,HMaterID,鐗╂枡浠g爜 HNumber,鐗╂枡鍚嶇О HName,瑙勬牸鍨嬪彿 HModel,HUnitID,璁¢噺鍗曚綅鍚嶇О HUnitName,鏁伴噺 HQty from h_v_Sc_MaterToSourceBillSub where 1 = 1 " + Swhere + ""; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MaterToSourceBillSub"); + //鑾峰彇娌诲叿璁板綍缂栬緫鏁版嵁 + //string sql1 = "select HMaterID, 閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HUnitID,鍗曚綅浠g爜 HUnitNumber,鍗曚綅鍚嶇О HUnitName,瀹為檯鐢ㄩ噺 HQty,鏍囧噯鐢ㄩ噺 HQtyMust,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName,琛ㄤ綋澶囨敞 HRemark from h_v_Sc_MouldMaintainBillList where 1 = 1 " + Swhere + ""; + //ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldMaintainBillList"); + list.Add(ds.Tables[0]); + //list.Add(ds1.Tables[0]); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.list = list; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region [涓婃枡闃查敊鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 寮�宸ュ崟鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("Sc_MaterToSourceBill/DeltetMaterToSourceBill")] + [HttpGet] + public object DeltetMaterToSourceBill(string HInterID, string UserName) + { + DBUtility.ClsPub.CurUserName = UserName; + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("MES_MaterToSourceBill_Delete", 1, false, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + if (lngBillKey == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + DAL.ClsSc_MESMaterToSourceBill oBill = new DAL.ClsSc_MESMaterToSourceBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } - // + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + else + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈壘鍒�"; + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + #region 鎶ュ伐骞冲彴涓婃枡闃查敊鍗曞脊绐楁煡鎵炬暟鎹� [Route("Sc_MaterToSourceBill/GetMESMaterToSourceFrom")] @@ -111,5 +256,515 @@ return objJsonResult; } #endregion + + #region 鎶ュ伐骞冲彴涓婃枡闃查敊涓�閿壂鐮佹柟娉� + [Route("Sc_MaterToSourceBill/get_CheckTypeByBarCode_Json")] + [HttpGet] + public object get_CheckTypeByBarCode_Json(string HBarCode,string HSourceID,string HICMOInterID,string HICMOEntryID) + { + + //鏍规嵁閫掑叆鐨勬潯鐮佸墠涓変綅锛屽垽鏂潯鐮佺被鍨嬶紙鐢熶骇璧勬簮銆佺墿鏂欐潯鐮侊級 + ds = oCN.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + HBarCode.Substring(0, 3) + "'", "Xt_BarCodeType"); + + //鏃犺繑鍥炴暟鎹垯涓虹墿鏂欐潯鐮� + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + //1.鏌ヨ鏉″舰鐮佸湪鏉$爜妗f琛ㄤ腑鏄惁瀛樺湪 + DataSet ds0 = oCN.RunProcReturn(" select HMaterID from Gy_BarCodeBill where HBarCode= '" + HBarCode + "'", "Gy_BarCodeBill"); + if (ds0 == null || ds0.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏉$爜妗f涓笉瀛樺湪姝ょ墿鏂欐潯鐮侊紝鏉$爜鏃犳晥锛�"; + return objJsonResult; + } + else + { + //2.鍖归厤鐢ㄦ枡娓呭崟鐨勭墿鏂欑紪鐮佹槸鍚︿竴鑷� + string sql = @"select '{0}' HBarCode,b.HMaterID,m.HNumber,m.HName,m.HModel,a.HQty HMQty, b.HQty,b.HUnitID,u.HName HUnitName from sc_PPbomBillMain a + inner join Sc_PPBomBillSub b on a.HInterID = b.HInterID + left join Gy_Material m on b.HMaterID = m.HItemID + left join Gy_Unit u on b.HUnitID = u.HItemID + where a.HICMOInterID = '{1}' and a.HICMOEntryID = '{2}'"; + sql = string.Format(sql,HBarCode, HICMOInterID, HICMOEntryID); + + + ds = oCN.RunProcReturn(sql, "Sc_PPBomBillSub"); + if (ds.Tables[0].Rows.Count > 0) //鏈夌敤鏂欐竻鍗曡褰� + { + //var dt0 = ds.Tables[0].AsEnumerable().Where<DataRow>(C => C["HMaterID"].ToString() == "133927").CopyToDataTable(); + DataTable dt = ds.Tables[0].AsEnumerable().Where<DataRow>(W => W["HMaterID"].ToString() == ds0.Tables[0].Rows[0]["HMaterID"].ToString()).CopyToDataTable(); //鍒ゆ柇褰撳墠鏁版嵁(涓�鏉℃垨澶氭潯)涓渶缁堝垽瀹氭槸鍚︽湁鍚堟牸 + if (dt == null || dt.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.Verify = "鐢ㄦ枡娓呭崟鐗╂枡鏉$爜"; + objJsonResult.data = dt; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠鐢熶骇璁㈠崟鏃犵敤鏂欐竻鍗曡褰曪紒"; + return objJsonResult; + } + } + } + else + { + string sBarBillName = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSourceName"]); + string sBarBillType = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0]["BarCodeType"]); + + //鍒ゆ柇鏉$爜绫诲瀷涓� 鍩虹璧勬枡鏉$爜 鎴� 婧愬崟鏉$爜 + if (sBarBillType == "鍩虹璧勬枡鏉$爜") + { + + //閮ㄩ棬鏉$爜 + if (sBarBillName == "鐢熶骇璧勬簮") + { + //DAL.ClsGy_Source_View dal = new DAL.ClsGy_Source_View(); + + //灏嗛�掑叆鐨勬潯鐮佸幓鎺夊墠涓変綅鍚庤浆鍖栨垚鏁村舰 + int ID; + if (int.TryParse(HBarCode.Remove(0, 3), out ID)) + { + if (int.Parse(HSourceID)!= ID) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐢熶骇璧勬簮鏉$爜涓庣敓浜ц鍗曠粦瀹氳祫婧愪笉鍖归厤锛�"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("Select * from Gy_Source Where HItemID='" + ID + "'", "Gy_Source"); + if(ds.Tables[0].Rows.Count>0) //if (dal.GetInfoByID(ID)) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇璧勬簮缁戝畾鏁版嵁鎴愬姛锛�"; + objJsonResult.Verify = "璧勬簮鏉$爜"; + objJsonResult.data = ds; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳晥璧勬簮鏉$爜锛�"; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "閿欒鐨勮祫婧愭潯鐮侊紒"; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳晥鍩虹璧勬枡鏉$爜锛�"; + return objJsonResult; + } + } + //婧愬崟鏉$爜 + else if (sBarBillType == "婧愬崟鏉$爜") + { + + + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳晥鏉$爜绫诲瀷锛�"; + return objJsonResult; + } + } + return objJsonResult; + } + #endregion + + #region 鎶ュ伐鍙颁笂鏂欓槻閿欎繚瀛� + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MaterToSourceBill/SaveGetMaterToSourceFrom")] + [HttpPost] + public object SaveGetMaterToSourceFrom([FromBody] JObject msg) + { + var _value = msg["msg"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string msg3 = sArray[1].ToString(); + string refSav = sArray[2].ToString(); + + //淇濆瓨鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("MES_MaterToSourceBill_Edit", 1, false, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + + string UserName = ""; + ListModels oListModels = new ListModels(); + try + { + //琛ㄥご鏁版嵁瀹炰緥鍖� + DAL.ClsSc_MESMaterToSourceBill oBill = new DAL.ClsSc_MESMaterToSourceBill(); + List<Model.ClsSc_MaterToSourceBillMain> lsmain = new List<Model.ClsSc_MaterToSourceBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sc_MaterToSourceBillMain(msg2); + + //閰嶆枡璁板綍琛ㄤ綋鏁版嵁瀹炰緥鍖� + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + msg3 = msg3.Substring(1, msg3.Length - 2); + msg3 = msg3.Replace("\\", ""); + msg3 = msg3.Replace("\n", ""); //\n + //msg2 = msg2.Replace("'", "鈥�"); + List<Model.ClsSc_MaterToSourceBillSub> ls = new List<Model.ClsSc_MaterToSourceBillSub>(); + ls = oListModels.getObjectByJson_Sc_MaterToSourceBillSub(msg3); + + //閰嶄欢椤硅〃浣撴暟鎹疄渚嬪寲 + + foreach (Model.ClsSc_MaterToSourceBillMain oItem in lsmain) + { + if (refSav == "Add") + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + } + if (refSav == "Update") + { + if (BillOld.ShowBill(oItem.HInterID, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if (BillOld.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + } + + UserName = oItem.HMaker; //鍒跺崟浜� + DBUtility.ClsPub.CurUserName = UserName; + oItem.HBillType = "3786"; + oItem.HBillSubType = "3786"; + + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); + oItem.HProcExchBillNo = ""; //娴佽浆鍗″彿 + oItem.HProcExchInterID = 0; //娴佽浆鍗′富鍐呯爜 + oItem.HProcExchEntryID = 0; //娴佽浆鍗″瓙鍐呯爜 + oItem.HProcID = 0; //宸ュ簭ID + oItem.HMainSourceBillNo =oItem.HSourceBillNo; + oItem.HMainSourceBillType = oItem.HSourceBillType; + oItem.HMainSourceInterID = oItem.HSourceInterID; + oItem.HMainSourceEntryID = oItem.HSourceEntryID; + + + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + + //寰幆閰嶆枡淇℃伅瀛愯〃 + int i = 0; + foreach (Model.ClsSc_MaterToSourceBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + oItemSub.HScanDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));// --鎵爜鏃堕棿 + oItemSub.HSourceBillNo = oItem.HSourceBillNo; + oItemSub.HSourceBillType = oItem.HSourceBillType; + oItemSub.HSourceInterID = oItem.HSourceInterID; + oItemSub.HSourceEntryID = oItem.HSourceEntryID; + oBill.DetailColl.Add(oItemSub); + + } + oBill.omodel = oItem; + } + + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + if (bResult) + { + objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //杩斿洖涓籌D + //绯荤粺鍙傛暟 鑷姩瀹℃牳 + string sReturn = ""; + if (oSystemParameter.ShowBill(ref sReturn) == true) + { + if (oSystemParameter.omodel.Sc_MaterToSourceBill_AutoCheck == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + objJsonResult.Verify = "Y"; + } + else + { + objJsonResult.Verify = "N"; + } + } + } + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //杩斿洖涓籌D + objJsonResult.Verify = "N"; + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + objJsonResult.data = 1; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + + #region [鎶ュ伐骞冲彴涓婃枡闃查敊鍗曞鏍搞�佸弽瀹℃牳] + /// <summary> + /// + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Sc_MaterToSourceBill/AuditProcessReportList")] + [HttpGet] + public object AuditProcessReportList(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "MES_MaterToSourceBill_Check"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //瀹℃牳鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + DAL.ClsSc_MESMaterToSourceBill oBill = new DAL.ClsSc_MESMaterToSourceBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鎻愪氦 + { + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍告垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion } } \ No newline at end of file -- Gitblit v1.9.1