From 50fceef7f1d136e4992353465ba268e752f68c3a Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期二, 31 十二月 2024 15:59:23 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/Sc_ProcessMangementController.cs | 4478 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 4,375 insertions(+), 103 deletions(-) diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs index 3f3c0d0..b8babff 100644 --- a/WebAPI/Controllers/Sc_ProcessMangementController.cs +++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs @@ -6,10 +6,12 @@ using System.Collections.Generic; using System.Data; using System.Data.SqlClient; +using System.IO; using System.Web.Http; using WebAPI.DLL; using WebAPI.Models; using WebAPI.Service; +using Kingdee.BOS.WebApi.Client; namespace WebAPI.Controllers { @@ -18,8 +20,8 @@ public DBUtility.ClsPub.Enum_BillStatus BillStatus; private json objJsonResult = new json(); - - + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; @@ -32,12 +34,21 @@ { try { + List<object> a = new List<object>(); + foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢� + { + Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺� // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆 + a.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } //if (ds.Tables[0].Rows.Count != 0 || ds != null) //{ objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; objJsonResult.data = ds.Tables[0]; + objJsonResult.list = a; + return objJsonResult; //} //else @@ -98,6 +109,51 @@ return objJsonResult; } + #region 鏈亾宸ュ簭姹囨姤鍏ュ簱 + /// <summary> + /// 鏈亾宸ュ簭姹囨姤鍏ュ簱鍒楄〃 + /// </summary> + /// <param name="sWhere"></param> + /// <param name="user"></param> + /// <returns></returns> + [Route("Sc_ProcessMangement/Sc_ProcessReportList_Last")] + [HttpGet] + public object Sc_ProcessReportList_Last(string sWhere, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� + if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡璇㈡潈闄�!"; + objJsonResult.data = null; + return objJsonResult; + } + + string sql1 = "select * from h_v_Sc_ProcessReportList_Last where 1 = 1 and HLastProc='鏄�'"; + string sql = sql1 + sWhere + " order by hmainid desc"; + ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessReportList_Last"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + #region 宸ュ簭姹囨姤鍏ュ簱 /// <summary> /// 鑾峰彇宸ュ簭姹囨姤鍏ュ簱鍗曞垪琛� @@ -121,16 +177,11 @@ return objJsonResult; } - if (sWhere == null || sWhere.Equals("")) - { - ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc order by hmainid desc", "h_v_MES_StationOutBillList_LastProc"); - } - else - { - string sql1 = "select * from h_v_MES_StationOutBillList_LastProc where 1 = 1 "; - string sql = sql1 + sWhere + " order by hmainid desc"; - ds = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList_LastProc"); - } + + string sql1 = "select * from h_v_Sc_ProcessReportList_Last where 1 = 1 and HFstProc='鏄�' "; + string sql = sql1 + sWhere + " order by hmainid desc"; + ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessReportList_Last"); + objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; @@ -148,6 +199,287 @@ } } + #endregion + + #region 鏂帿灏� 鏈亾宸ュ簭姹囨姤鍒楄〃 姹囨姤 鍏ュ簱 + /// <summary> + /// 鐢熸垚 鐢熶骇姹囨姤鍗� + /// 鍚屾閲戣澏浜� 宸ュ簭姹囨姤鍏ュ簱鍗� 鍏ュ簱 + /// </summary> + /// <param name="InterID"></param> + /// <param name="user"></param> + /// <param name="BillNo"></param> + /// <param name="OrganizationID"></param> + /// <returns></returns> + //[Route("Sc_ProcessMangement/SRM_SaveICMOReportBill")] + //[HttpGet] + //public object SRM_SaveICMOReportBill(string InterID, string user, string BillNo, string OrganizationID) + //{ + // try + // { + // //鑾峰彇鐢熶骇姹囨姤鍗曟渶澶nterID鍜屽崟鎹彿 + // Int64 HInterID = DBUtility.ClsPub.CreateBillID("3711", ref DBUtility.ClsPub.sExeReturnInfo); + // string HBillNo = DBUtility.ClsPub.CreateBillCode("3711", ref DBUtility.ClsPub.sExeReturnInfo, true); + // //鑾峰彇缁勭粐浠g爜 + // string OrganizationNUM = oCN.RunProcReturn("select HNumber from Xt_ORGANIZATIONS where HItemID=" + OrganizationID, "Xt_ORGANIZATIONS").Tables[0].Rows[0]["HNumber"].ToString(); + // //鏍规嵁宸ュ簭姹囨姤鍗曚富ID鑾峰彇宸ュ簭姹囨姤鍏ュ簱鍗曠殑鏁版嵁 + // DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc"); + // DataRow dr = ds.Tables[0].Rows[0]; + + // //淇濆瓨 + // oCN.BeginTran(); + // DataSet DsTable = oCN.RunProcReturn($"select * from Sc_ICMOReportBillMain where HBillNo='{HBillNo}'", "Sc_ICMOReportBillMain"); + // if (DsTable.Tables[0].Rows.Count > 0) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "宸插叆搴�,璇蜂笉瑕侀噸澶嶅叆搴�"; + // objJsonResult.data = null; + // return objJsonResult; + // } + // //鐢熶骇姹囨姤鍗曚富琛� + // oCN.RunProc("Insert Into Sc_ICMOReportBillMain " + + // "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HBillStatus,HChecker,HCheckDate" + + // ",HYear,HPeriod,HRemark,HEmpID,HEmpNumber" + + // ",HGroupID,HDeptID,HDeptNumber" + + // ",HMainSourceBillNo,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillType" + + // ") " + + // " values('3711','3711'," + HInterID.ToString() + ",'" + BillNo + "',getdate(),'" + user + "',getdate(),2,'" + user + "',getdate()" + + // ",DATENAME(YEAR,GETDATE()),0,'','" + dr["HEmpID"].ToString() + "','" + dr["鎿嶄綔鍛樹唬鐮�"].ToString() + + // "','" + dr["HGroupID"].ToString() + "',0,''" + + // ",'" + BillNo.ToString() + "'," + InterID.ToString() + ", 0,'3791'" + + // ") "); + // //鐢熶骇姹囨姤鍗曞瓙琛� + // oCN.RunProc("Insert into Sc_ICMOReportBillSub " + + // " (HInterID,HEntryID,HMaterID,HMaterNumber" + + // ",HQty,HUnitID,HUnitNumber,HTimes,HSourceID" + + // ",HQtyMust,HWorkerID,HWorkerNumber,HBadCount,HWasterQty," + + // "HCloseMan,HCloseType,HRemark," + + // "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + // ",HICMOInterID,HICMOBillNo,HBarCode" + + // ") values(" + // + HInterID.ToString() + ",1," + dr["HMaterID"].ToString() + ",'" + dr["浜у搧浠g爜"].ToString() + "'" + + // "," + dr["鍚堟牸鏁伴噺"].ToString() + ",0,'',0,0" + + // "," + dr["鎺ユ敹鏁伴噺"].ToString() + "," + dr["HEmpID"].ToString() + ",'" + dr["鎿嶄綔鍛樹唬鐮�"].ToString() + "'," + dr["涓嶈壇鏁伴噺"].ToString() + "," + dr["鎶ュ簾鏁伴噺"].ToString() + + // ",'',0,''" + + // "," + InterID.ToString() + ",0,'" + BillNo.ToString() + "','3791',0,0" + + // ",0,0,''" + + // "," + dr["HICMOInterID"].ToString() + ",'" + dr["浠诲姟鍗�"].ToString() + "',''" + + // ") "); + // //鍚屾閲戣澏 + // //璁块棶閲戣澏 + // var loginRet = InvokeHelper.Login(); + // var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); + // if (isSuccess == 0) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鎿嶄綔澶辫触,閲戣澏璐﹀彿鐧诲綍寮傚父銆�" + loginRet; + // objJsonResult.data = null; + // return objJsonResult; + // } + // //鏍规嵁浠诲姟鍗曟煡鎵惧埌閲戣澏鐨勭敓浜ц鍗� + // DataSet ds1 = oCN.RunProcReturn("select * from h_v_TOERP_StationOutBillList_LastProc where HICMOEntryID=" + dr["HICMOEntryID"].ToString(), "h_v_TOERP_StationOutBillList_LastProc"); + // DataRow dr1 = ds1.Tables[0].Rows[0]; + + // JObject model = new JObject(); + // model.Add("FBillType", new JObject() { ["Fnumber"] = "SCHBD01_SYS" }); //鍗曟嵁绫诲瀷鐢熶骇姹囨姤鈥淪CHBD02_SYS鈥� 鍏ュ簱姹囨姤SCHBD01_SYS + // model.Add("FPrdOrgId", new JObject() { ["Fnumber"] = dr1["FPrdOrgNUMBER"].ToString() }); //鐢熶骇缁勭粐1 + // model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //鍗曟嵁鏃ユ湡1 + // model.Add("FBillNo", BillNo); + + // JArray Fentity = new JArray(); + + // foreach (DataRow item in ds.Tables[0].Rows) + // { + // JObject FentityModel = new JObject(); + // FentityModel.Add("FIsNew", false);// 婧愬崟绫诲瀷 + // FentityModel.Add("FReportType", new JObject() { ["Fnumber"] = dr1["FREPORTTYPENUMBER"].ToString() });//鐢熶骇姹囨姤绫诲瀷 + // FentityModel.Add("FSrcBillType", "PRD_MO");// 婧愬崟绫诲瀷 + // FentityModel.Add("FProductType", "1");// 浜у搧绫诲瀷 + // FentityModel.Add("FSrcBillNo", item["浠诲姟鍗�"].ToString());// 婧愬崟缂栧彿 + // FentityModel.Add("FSrcInterId", dr1["FMOID"].ToString());// 婧愬崟鍐呯爜 + // FentityModel.Add("FSrcEntryId", dr1["FMOENTRYID"].ToString());// 婧愬崟鍒嗗綍鍐呯爜銆� + // FentityModel.Add("FSRCENTRYSEQ", dr1["FMOENTRYSEQ"].ToString());// 婧愬崟鍒嗗綍琛屽彿 + // FentityModel.Add("FUNITID", new JObject() { ["Fnumber"] = dr1["FUNITNUMBER"].ToString() });//鍗曚綅 + // FentityModel.Add("FTimeUnitId", "1");//鏃堕棿鍗曚綅 + // FentityModel.Add("FWorkshipId", new JObject() { ["Fnumber"] = dr1["FWorkShopNUM"].ToString() }); // 鐢熶骇杞﹂棿 + // FentityModel.Add("FStandHourUnitId", "3600"); // 鍗曚綅鏍囧噯宸ユ椂鍗曚綅 + // FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = dr1["FMaterialNUM"].ToString() }); // 鐗╂枡缂栫爜 + // FentityModel.Add("FMoEntrySeq", dr1["FMOENTRYSEQ"].ToString());//鐢熶骇璁㈠崟琛屽彿 + // FentityModel.Add("FMoId", dr1["HICMOInterID"].ToString());//鐢熶骇璁㈠崟鍐呯爜 + // FentityModel.Add("FFinishQty", item["鎺ユ敹鏁伴噺"].ToString());//瀹屾垚鏁伴噺1 + // FentityModel.Add("FQuaQty", item["鍚堟牸鏁伴噺"].ToString());//鍚堟牸鏁伴噺1FFailQty + // FentityModel.Add("FFailQty", item["涓嶈壇鏁伴噺"].ToString());//涓嶅悎鏍兼暟閲� + // FentityModel.Add("FStockInOrgId ", new JObject() { ["Fnumber"] = OrganizationNUM });// 鍏ュ簱缁勭粐 + // FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = dr1["FStockNUM"].ToString() }); // 浠撳簱 + // FentityModel.Add("FMOBILLNO", dr1["FMOBILLNO"].ToString());// + // FentityModel.Add("FMOENTRYID", dr1["FMOENTRYID"].ToString());// + // FentityModel.Add("FOwnerTypeId", dr1["FOWNERTYPEID"].ToString()); //璐т富绫诲瀷锛欶OwnerTypeId(蹇呭~椤�) + // FentityModel.Add("FOwnerId", new JObject() { ["Fnumber"] = dr1["FOwnerNumber"].ToString() }); //璐т富锛欶OwnerId(蹇呭~椤�) + // FentityModel.Add("FBomId", new JObject() { ["F number"] = dr1["FBOMNUM"].ToString() }); //BOM鐗堟湰锛欶BomId(蹇呭~椤�) + // FentityModel.Add("FCostRate", dr1["FCostRate"].ToString());// 鎴愭湰鏉冮噸 + // FentityModel.Add("FISBACKFLUSH", dr1["FISBACKFLUSH"].ToString() == "1" ? true : false);// 鍊掑啿棰嗘枡 + // FentityModel.Add("FMOMAINENTRYID", dr1["FMOENTRYID"].ToString());// + // FentityModel.Add("FLot", new JObject() { ["FNumber"] = dr1["FBATCHNO"].ToString() }); //鎵瑰彿 + // JArray Fentity2 = new JArray(); + // JObject FentityModel2 = new JObject(); + // FentityModel2.Add("FEntity_Link_FFlowId", "f6e6eec3-5267-4f02-8593-b633da508a72"); + // FentityModel2.Add("FEntity_Link_FFlowLineId", "PRD_MO2MORPT"); + // FentityModel2.Add("FEntity_Link_FRuleId", "3"); + // FentityModel2.Add("FEntity_Link_FSTableId", "0"); + // FentityModel2.Add("FEntity_Link_FSTableName", "T_PRD_MOENTRY"); + // FentityModel2.Add("FEntity_Link_FSBillId", dr1["FMOID"].ToString()); + // FentityModel2.Add("FEntity_Link_FSId", dr1["FMOENTRYID"].ToString()); + // FentityModel2.Add("FEntity_Link_FBaseQuaQtyOld", item["鍚堟牸鏁伴噺"].ToString()); + // FentityModel2.Add("FEntity_Link_FBaseQuaQty", item["鍚堟牸鏁伴噺"].ToString()); + // Fentity2.Add(FentityModel2); + // } + // model.Add("FEntity", Fentity); //鏄庣粏淇℃伅 + // JObject jsonRoot = new JObject() + // { + // ["Creator"] = "", + // ["NeedUpDateFields"] = new JArray(), + // ["NeedReturnFields"] = new JArray(), + // ["IsDeleteEntry"] = "false", + // ["SubSystemId"] = "", + // ["IsVerifyBaseDataField"] = "false", + // //["IsAutoSubmitAndAudit"] = true,//鑷姩璋冪敤鎻愪氦鍜屽鏍稿姛鑳� + // ["Model"] = model + // }; + + // string result = InvokeHelper.Save("PRD_MORPT", JsonConvert.SerializeObject(jsonRoot));//淇濆瓨 + // //鍒ゆ柇淇濆瓨鏄惁鎴愬姛 + // if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") + // { + // LogService.Write("宸ュ簭姹囨姤鍗曞叆搴撻敊璇痡sonRoot:" + jsonRoot); + // oCN.RollBack(); + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = $"鐢熶骇姹囨姤鍏ュ簱鍗曞悓姝ラ噾铦朵簯澶辫触锛佸崟鍙�:{dr["鍗曟嵁鍙�"].ToString()}" + result; + // objJsonResult.data = null; + // return objJsonResult; + // } + // //鎻愪氦瀹℃牳 + // string result1 = string.Empty; + // string result2 = string.Empty; + // var fID = JObject.Parse(result)["Result"]["Id"].ToString(); + // var fBillNo = JObject.Parse(result)["Result"]["Number"].ToString(); + // var json = new + // { + // Ids = fID, + // }; + // result1 = InvokeHelper.Submit("PRD_MORPT", JsonConvert.SerializeObject(json));//鎻愪氦 + // result2 = InvokeHelper.Audit("PRD_MORPT", JsonConvert.SerializeObject(json));//鎻愪氦 + // if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") + // { + // oCN.RollBack(); + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = $"鐢熶骇姹囨姤鍗曞崟鍙凤細{fBillNo}锛屾彁浜ゅけ璐�" + result; + // objJsonResult.data = null; + // return objJsonResult; + // } + + // oCN.RunProc("update Sc_StationOutBillMain set HRelationQty=1 where HBillNo='" + BillNo + "'"); + + // oCN.Commit(); + // objJsonResult.code = "0"; + // objJsonResult.count = 1; + // objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + // objJsonResult.data = 1; + // return objJsonResult; + // } + // catch (Exception e) + // { + // oCN.RollBack(); + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "Exception锛�" + e.ToString(); + // objJsonResult.data = null; + // return objJsonResult; + // } + //} + #endregion + + + + /// <summary> + /// 鍏ュ簱鈥斺�旂敓浜ф眹鎶ュ崟 + /// </summary> + /// <param name="InterID">宸ュ簭姹囨姤鍗曚富ID</param> + /// <returns></returns> + [Route("Sc_ProcessMangement/SaveICMOReportBill_Batch")] + [HttpPost] + public object SaveICMOReportBill_Batch([FromBody] JObject msg) + { + var _value = msg["msg"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string InterID = sArray[0].ToString(); + string user = sArray[1].ToString(); + string BillNo = sArray[2].ToString(); + string OrganizationID = sArray[3].ToString(); + ArrayList InterIDArray = new ArrayList(InterID.Split(',')); + ArrayList BillNoArray = new ArrayList(BillNo.Split(',')); + try + { + string bResult; + string HMessage = ""; + string HSuccessBillNo = ""; + string HFailBillNo = ""; + WebAPI.Controllers.Sc_ProcessMangementController oBill = new WebAPI.Controllers.Sc_ProcessMangementController(); + if (InterIDArray.Count != BillNoArray.Count) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏁版嵁涓嶅畬鏁达紝鍐呯爜鏁伴噺涓嶇瓑浜庡崟鎹彿鏁伴噺"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + for (int i = 0; i < InterIDArray.Count;i++) + { + bResult = JsonConvert.SerializeObject(oBill.SaveICMOReportBill(InterIDArray[i].ToString(), user, BillNoArray[i].ToString(), OrganizationID)); + + //鍙嶅簭鍒楀寲 + bResult = "[" + bResult.ToString() + "]"; + + List<JsonResult> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JsonResult>>(bResult); + + if (list[0].count == 1) + { + HSuccessBillNo = HSuccessBillNo + BillNoArray[i].ToString()+"," + "\r\n" ; + } + else + { + HFailBillNo = HFailBillNo + BillNoArray[i].ToString() + ":" + list[0].Message + "," + "\r\n"; + } + HMessage = "姹囨姤鎴愬姛鍗曞彿锛�" + HSuccessBillNo + "\r\n" + " 姹囨姤澶辫触鍗曞彿锛�" + HFailBillNo; + } + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = HMessage; + 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; + } + } + + /// <summary> /// 鍏ュ簱鈥斺�旂敓浜ф眹鎶ュ崟 /// </summary> @@ -159,6 +491,12 @@ { try { + LogService.Write("鐢熶骇姹囨姤鍗曡繘鍏ュ悓姝ユ柟娉曪紝姹囨姤鍗曞彿锛�" + BillNo); + + string sErr = ""; + oSystemParameter.ShowBill(ref sErr); + + //鑾峰彇鐢熶骇姹囨姤鍗曟渶澶nterID鍜屽崟鎹彿 Int64 HInterID = DBUtility.ClsPub.CreateBillID("3711", ref DBUtility.ClsPub.sExeReturnInfo); string HBillNo = DBUtility.ClsPub.CreateBillCode("3711", ref DBUtility.ClsPub.sExeReturnInfo, true); @@ -166,31 +504,41 @@ string OrganizationNUM = oCN.RunProcReturn("select HNumber from Xt_ORGANIZATIONS where HItemID=" + OrganizationID, "Xt_ORGANIZATIONS").Tables[0].Rows[0]["HNumber"].ToString(); //鏍规嵁宸ュ簭姹囨姤鍗曚富ID鑾峰彇宸ュ簭姹囨姤鍏ュ簱鍗曠殑鏁版嵁 DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc"); + if (ds.Tables[0].Rows.Count <= 0) + { + LogService.Write("鐢熶骇姹囨姤鍗曞洖婊氾紝姹囨姤鍗曞彿锛�" + BillNo + " 鍘熷洜锛氱敓鎴愮敓浜ф眹鎶ュ崟杩囩▼涓病鏈夋煡璇㈠埌鍑虹珯鍗�"); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐢熸垚鐢熶骇姹囨姤鍗曡繃绋嬩腑娌℃湁鏌ヨ鍒板嚭绔欏崟"; + objJsonResult.data = null; + return objJsonResult; + } DataRow dr = ds.Tables[0].Rows[0]; - + //淇濆瓨 oCN.BeginTran(); - DataSet DsTable = oCN.RunProcReturn("select * from Sc_ICMOReportBillMain where HBillNo=" + HBillNo, "Sc_ICMOReportBillMain"); + DataSet DsTable = oCN.RunProcReturn($"select * from Sc_ICMOReportBillMain with(nolock) where HBillNo='{HBillNo}'", "Sc_ICMOReportBillMain"); if (DsTable.Tables[0].Rows.Count > 0) { + LogService.Write("鐢熶骇姹囨姤鍗曞洖婊氾紝姹囨姤鍗曞彿锛�" + BillNo + " 鍘熷洜锛氬凡鍏ュ簱,璇蜂笉瑕侀噸澶嶅叆搴�"); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "宸插叆搴�,璇蜂笉瑕侀噸澶嶅叆搴�"; objJsonResult.data = null; return objJsonResult; } - //鐢熶骇姹囨姤鍗曚富琛� - oCN.RunProc("Insert Into Sc_ICMOReportBillMain " + - "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HBillStatus,HChecker,HCheckDate" + - ",HYear,HPeriod,HRemark,HEmpID,HEmpNumber" + - ",HGroupID,HDeptID,HDeptNumber" + - ",HMainSourceBillNo,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillType" + - ") " + - " values('3711','3711'," + HInterID.ToString() + ",'" + BillNo + "',getdate(),'" + user + "',getdate(),2,'" + user + "',getdate()" + - ",DATENAME(YEAR,GETDATE()),0,'','" + dr["HEmpID"].ToString() + "','" + dr["鎿嶄綔鍛樹唬鐮�"].ToString() + - "','" + dr["HGroupID"].ToString() + "',0,''" + - ",'" + BillNo.ToString() + "'," + InterID.ToString() + ", 0,'3791'" + - ") "); + //鐢熶骇姹囨姤鍗曚富琛� + oCN.RunProc("Insert Into Sc_ICMOReportBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HBillStatus,HChecker,HCheckDate" + + ",HYear,HPeriod,HRemark,HEmpID,HEmpNumber" + + ",HGroupID,HDeptID,HDeptNumber" + + ",HMainSourceBillNo,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillType" + + ") " + + " values('3711','3711'," + HInterID.ToString() + ",'" + BillNo + "',getdate(),'" + user + "',getdate(),2,'" + user + "',getdate()" + + ",DATENAME(YEAR,GETDATE()),0,'','" + dr["HEmpID"].ToString() + "','" + dr["鎿嶄綔鍛樹唬鐮�"].ToString() + + "','" + dr["HGroupID"].ToString() + "',0,''" + + ",'" + BillNo.ToString() + "'," + InterID.ToString() + ", 0,'3791'" + + ") "); //鐢熶骇姹囨姤鍗曞瓙琛� oCN.RunProc("Insert into Sc_ICMOReportBillSub " + " (HInterID,HEntryID,HMaterID,HMaterNumber" + @@ -215,6 +563,7 @@ var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); if (isSuccess == 0) { + LogService.Write("鐢熶骇姹囨姤鍗曞洖婊氾紝姹囨姤鍗曞彿锛�" + BillNo + " 鍘熷洜锛氭搷浣滃け璐�,閲戣澏璐﹀彿鐧诲綍寮傚父"); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "鎿嶄綔澶辫触,閲戣澏璐﹀彿鐧诲綍寮傚父銆�" + loginRet; @@ -231,7 +580,7 @@ model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //鍗曟嵁鏃ユ湡1 model.Add("FHZYMESFLAG", "鏄�");// 鏄惁涓篗ES鍚屾 model.Add("FBillNo", BillNo); - + JArray Fentity = new JArray(); foreach (DataRow item in ds.Tables[0].Rows) @@ -255,6 +604,7 @@ FentityModel.Add("FFinishQty", item["鎺ユ敹鏁伴噺"].ToString());//瀹屾垚鏁伴噺1 FentityModel.Add("FQuaQty", item["鍚堟牸鏁伴噺"].ToString());//鍚堟牸鏁伴噺1FFailQty FentityModel.Add("FFailQty", item["涓嶈壇鏁伴噺"].ToString());//涓嶅悎鏍兼暟閲� + FentityModel.Add("FScrapQty", item["鎶ュ簾鏁伴噺"].ToString());//鎶ュ簾鏁伴噺 FentityModel.Add("FStockInOrgId ", new JObject() { ["Fnumber"] = OrganizationNUM });// 鍏ュ簱缁勭粐 FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = dr1["FStockNUM"].ToString() }); // 浠撳簱 FentityModel.Add("FMOID", dr1["FMOID"].ToString());// @@ -267,7 +617,10 @@ FentityModel.Add("FCostRate", dr1["FCostRate"].ToString());// 鎴愭湰鏉冮噸 FentityModel.Add("FISBACKFLUSH", dr1["FISBACKFLUSH"].ToString() == "1" ? true : false);// 鍊掑啿棰嗘枡 FentityModel.Add("FMOMAINENTRYID", dr1["FMOENTRYID"].ToString());// - FentityModel.Add("F_bsv_Base1", new JObject() { ["Fnumber"] = dr1["FPREBDONENUMBER"].ToString() }); //鍖呰鏍囪瘑 + if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�") + { + FentityModel.Add("F_bsv_Base1", new JObject() { ["Fnumber"] = dr1["FPREBDONENUMBER"].ToString() });//鍖呰鏍囪瘑 + } FentityModel.Add("FLot", new JObject() { ["FNumber"] = dr1["FBATCHNO"].ToString() }); //鎵瑰彿 FentityModel.Add("F_bsv_Text", dr1["宸ュ簭娴佽浆鍗″彿"].ToString()); //娴佽浆鍗″彿 JArray Fentity2 = new JArray(); @@ -298,12 +651,13 @@ //["IsAutoSubmitAndAudit"] = true,//鑷姩璋冪敤鎻愪氦鍜屽鏍稿姛鑳� ["Model"] = model }; - + string result = InvokeHelper.Save("PRD_MORPT", JsonConvert.SerializeObject(jsonRoot));//淇濆瓨 //鍒ゆ柇淇濆瓨鏄惁鎴愬姛 if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") { LogService.Write("宸ュ簭姹囨姤鍗曞叆搴撻敊璇痡sonRoot:" + jsonRoot); + LogService.Write("鐢熶骇姹囨姤鍗曚繚瀛樺け璐ワ紝姹囨姤鍗曞彿锛�" + BillNo + " 鍘熷洜锛�" + result); oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; @@ -324,20 +678,92 @@ result2 = InvokeHelper.Audit("PRD_MORPT", JsonConvert.SerializeObject(json));//鎻愪氦 if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") { + LogService.Write("鐢熶骇姹囨姤鍗曟彁浜ゅけ璐ワ紝姹囨姤鍗曞彿锛�" + BillNo + " 鍘熷洜锛�" + result1); oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = $"鐢熶骇姹囨姤鍗曞崟鍙凤細{fBillNo}锛屾彁浜ゅけ璐�" + result; + objJsonResult.Message = $"鐢熶骇姹囨姤鍗曞崟鍙凤細{fBillNo}锛屾彁浜ゅけ璐�" + result1; objJsonResult.data = null; return objJsonResult; } + oCN.RunProc("update Sc_StationOutBillMain set HRelationQty=1 where HBillNo='" + BillNo + "'"); + oCN.Commit(); + + LogService.Write("鐢熶骇姹囨姤鍗曚繚瀛樻垚鍔燂紝姹囨姤鍗曞彿锛�" + BillNo ); + objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; objJsonResult.data = 1; return objJsonResult; + } + catch (Exception e) + { + LogService.Write("鐢熶骇姹囨姤鍗曞悓姝ュ彂鐢熷紓甯革紝姹囨姤鍗曞彿锛�" + BillNo + " " + e.ToString()); + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 鍏ュ簱鈥斺�旂敓浜ф眹鎶ュ崟 + /// </summary> + /// <param name="InterID">宸ュ簭姹囨姤鍗曚富ID</param> + /// <returns></returns> + [Route("Sc_ProcessMangement/SaveProcdutInBill_Batch")] + [HttpPost] + public object SaveProcdutInBill_Batch([FromBody] JObject msg) + { + var _value = msg["msg"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string BillNo = sArray[0].ToString(); + BillNo = BillNo.Replace("\r\n", "").Replace("[ ", "").Replace("]", ""); + BillNo = BillNo.Replace("\\", "").Replace("\n", "").Replace("\"", ""); + BillNo = BillNo.Trim(); + ArrayList BillNoArray = new ArrayList(BillNo.Split(',')); + + try + { + string bResult; + string HMessage = ""; + string HSuccessBillNo = ""; + string HFailBillNo = ""; + WebAPI.Controllers.Sc_ProcessMangementController oBill = new WebAPI.Controllers.Sc_ProcessMangementController(); + + for (int i = 0; i < BillNoArray.Count; i++) + { + bResult = JsonConvert.SerializeObject(oBill.SaveProcdutInBill(BillNoArray[i].ToString().Trim())); + + //鍙嶅簭鍒楀寲 + bResult = "[" + bResult.ToString() + "]"; + + List<JsonResult> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JsonResult>>(bResult); + + if (list[0].count == 1) + { + HSuccessBillNo = HSuccessBillNo + BillNoArray[i].ToString() + "," + "\r\n"; + } + else + { + HFailBillNo = HFailBillNo + BillNoArray[i].ToString() + ":" + list[0].Message + "," + "\r\n"; + } + HMessage = "鍏ュ簱鎴愬姛鍗曞彿锛�" + HSuccessBillNo + "\r\n" + " 鍏ュ簱澶辫触鍗曞彿锛�" + HFailBillNo; + } + + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = HMessage; + objJsonResult.data = null; + return objJsonResult; + } catch (Exception e) { @@ -362,6 +788,7 @@ { try { + LogService.Write("鐢熶骇鍏ュ簱鍗曡繘鍏ュ悓姝ユ柟娉�:" + " 鍏ュ簱鍗曞彿锛�" + BillNo); //鑾峰彇鐢熶骇姹囨姤鍗曟渶澶nterID鍜屽崟鎹彿 Int64 HInterID = DBUtility.ClsPub.CreateBillID("1202", ref DBUtility.ClsPub.sExeReturnInfo); string HBillNo = DBUtility.ClsPub.CreateBillCode("1202", ref DBUtility.ClsPub.sExeReturnInfo, true); @@ -370,6 +797,20 @@ ////鏍规嵁宸ュ簭姹囨姤鍗曚富ID鑾峰彇宸ュ簭姹囨姤鍏ュ簱鍗曠殑鏁版嵁 //DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc"); //DataRow dr = ds.Tables[0].Rows[0]; + + //鍒ゆ柇鍏ュ簱鐨勫悎鏍兼暟閲忔槸鍚︿负0 + var DTable = oCN.RunProcReturn("select * from Sc_StationOutBillMain with(nolock) where HBillNo='" + BillNo + "' ", "Sc_StationOutBillMain").Tables[0]; + + if (double.Parse(DTable.Rows[0]["HQty"].ToString()) == 0) + { + LogService.Write("鍚屾閲戣澏鐢熶骇鐢熶骇鍏ュ簱鍗曞洖婊�--鍑虹珯鍗曞彿锛�" + BillNo + " 鍥炴粴鍘熷洜锛氬悎鏍兼暟閲忎负0,涓嶉渶瑕佸叆搴擄紒"); + objJsonResult.code = "1"; + objJsonResult.count = 2; + objJsonResult.Message = "鍚堟牸鏁伴噺涓�0,涓嶉渶瑕佸叆搴擄紒"; + objJsonResult.data = null; + return objJsonResult; + } + //淇濆瓨 oCN.BeginTran(); //鐢熶骇姹囨姤鍗曚富琛� @@ -408,6 +849,7 @@ var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); if (isSuccess == 0) { + LogService.Write("鍚屾閲戣澏鐢熶骇鍏ュ簱鍗曞洖婊�--鍑虹珯鍗曞彿锛�" + BillNo + " 鍥炴粴鍘熷洜锛氭搷浣滃け璐�,閲戣澏璐﹀彿鐧诲綍寮傚父"); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "鎿嶄綔澶辫触,閲戣澏璐﹀彿鐧诲綍寮傚父銆�" + loginRet; @@ -417,15 +859,85 @@ // //DataSet ds1 = oCN.RunProcReturn("select * from h_v_TOERPProcduct_LastProc where HLastProc = '鏄�' and hbillno='" + BillNo.ToString() + "'", "h_v_TOERPProcduct_LastProc"); DataSet ds1 = oCN.RunProcReturn("exec h_p_TOERPProcduct_LastProc '" + BillNo + "'", "h_p_TOERPProcduct_LastProc"); - DataRow dr1 = ds1.Tables[0].Rows[0]; - if (ds1.Tables[0].Rows.Count <= 0) + + if (ds1 == null || ds1.Tables[0].Rows.Count == 0) { + LogService.Write("鍚屾閲戣澏鐢熶骇鍏ュ簱鍗曞洖婊�--鍑虹珯鍗曞彿锛�" + BillNo + " 鍥炴粴鍘熷洜锛氭湭鎵惧埌瀵瑰簲鐨勬湰鍦版垨閲戣澏浜戠敓浜ф眹鎶ュ崟璁板綍;1.鏈煡璇㈠埌瀵瑰簲鐨勭敓浜ф眹鎶ュ崟锛�2.璇风‘淇濆綋鍓嶅伐搴忔槸鏈亾宸ュ簭3.姹囨姤鍗曞搴旂殑鍏ュ簱鏁伴噺宸叉弧 璇峰湪閲戣澏浜戞煡鐪嬪叆搴撹褰曪紒"); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈壘鍒板搴旂殑鏈湴鎴栭噾铦朵簯鐢熶骇姹囨姤鍗曡褰�;1.鏈煡璇㈠埌瀵瑰簲鐨勭敓浜ф眹鎶ュ崟锛�2.璇风‘淇濆綋鍓嶅伐搴忔槸鏈亾宸ュ簭3.姹囨姤鍗曞搴旂殑鍏ュ簱鏁伴噺宸叉弧 璇峰湪閲戣澏浜戞煡鐪嬪叆搴撹褰曪紒"; + objJsonResult.data = null; + return objJsonResult; + } + + DataRow dr1 = ds1.Tables[0].Rows[0]; + if (double.Parse(dr1[0].ToString()) <= 0) + { + LogService.Write("鍚屾閲戣澏鐢熶骇鍏ュ簱鍗曞洖婊�--鍑虹珯鍗曞彿锛�" + BillNo + " 鍥炴粴鍘熷洜锛氭湭鎵惧埌瀵瑰簲鐨勭敓浜ф眹鎶ュ崟璁板綍;1.鏈煡璇㈠埌瀵瑰簲鐨勭敓浜ф眹鎶ュ崟锛�2.璇风‘淇濆綋鍓嶅伐搴忔槸鏈亾宸ュ簭3.姹囨姤鍗曞搴旂殑鍏ュ簱鏁伴噺宸叉弧 璇峰湪閲戣澏浜戞煡鐪嬪叆搴撹褰曪紒"); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "鏈壘鍒板搴旂殑鐢熶骇姹囨姤鍗曡褰�;1.鏈煡璇㈠埌瀵瑰簲鐨勭敓浜ф眹鎶ュ崟锛�2.璇风‘淇濆綋鍓嶅伐搴忔槸鏈亾宸ュ簭3.姹囨姤鍗曞搴旂殑鍏ュ簱鏁伴噺宸叉弧 璇峰湪閲戣澏浜戞煡鐪嬪叆搴撹褰曪紒"; objJsonResult.data = null; return objJsonResult; } + + + string sErr = ""; + if (oSystemParameter.ShowBill(ref sErr)) + { + if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�") + { + + //鍒ゆ柇閲戣澏浜戞槸鍚﹀凡缁忔湁鍏ュ簱鐨勬暟鎹� + ds = oCN.RunProcReturn($@"select * from AIS20220308151944..T_PRD_INSTOCK where FBILLNO='{BillNo}'", "T_PRD_INSTOCK"); + + if (ds.Tables[0].Rows.Count > 0) + { + LogService.Write("鍚屾閲戣澏鐢熶骇鍏ュ簱鍗曞洖婊�--鍑虹珯鍗曞彿锛�" + BillNo + " 鍥炴粴鍘熷洜锛氬綋鍓嶅嚭绔欏崟鍙峰凡鍏ュ簱,璇蜂笉瑕侀噸鏂板叆搴�!"); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠鍑虹珯鍗曞彿宸插叆搴�,璇蜂笉瑕侀噸鏂板叆搴�!"; + objJsonResult.data = null; + return objJsonResult; + } + + //鍒ゆ柇閲戣澏浜戠敓浜ф眹鎶ュ崟 鏁伴噺 鏄惁 澶т簬 鏈亾鍑虹珯鏁伴噺 + ds = oCN.RunProcReturn($@"select sum(FFinishQty)-sum(FSTOCKINQUASELQTY)-(select HQty from Sc_StationOutBillMain with(nolock) where HBillNo='{BillNo}') + from AIS20220308151944..T_PRD_MORPT rpt3 + left join AIS20220308151944..T_PRD_MORPTENTRY rpt2 on rpt3.FID = rpt2.FID + left join AIS20220308151944..T_PRD_MORPTENTRY_A rpt1 on rpt2.FID = rpt1.FID + where F_bsv_Text=(select HProcExchBillNo from Sc_StationOutBillMain where HBillNo='{BillNo}')", "SumCount"); + + if (double.Parse(ds.Tables[0].Rows[0][0].ToString()) < 0) + { + LogService.Write("鍚屾閲戣澏鐢熶骇鍏ュ簱鍗曞洖婊�--鍑虹珯鍗曞彿锛�" + BillNo + " 鍥炴粴鍘熷洜锛氶噾铦朵簯姹囨姤鏁伴噺灏忎簬鏈湴鍑虹珯鏁伴噺!"); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "閲戣澏浜戞眹鎶ユ暟閲忓皬浜庢湰鍦板嚭绔欐暟閲�!"; + objJsonResult.data = null; + return objJsonResult; + } + + //鍒ゆ柇鍞竴ID鏄惁涓虹┖ + foreach (DataRow item in ds1.Tables[0].Rows) + { + if (item["HWYID"].ToString() == null || item["HWYID"].ToString() == "" || item["HWYID"].ToString() == "undefined") + { + LogService.Write("鍚屾閲戣澏鐢熶骇鍏ュ簱鍗曞洖婊�--鍑虹珯鍗曞彿锛�" + BillNo + " 鍥炴粴鍘熷洜锛氬敮涓�ID涓虹┖锛岃閲嶆柊鎵嬪姩鍏ュ簱鎴栬仈绯荤鐞嗗憳锛�"); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍞竴ID涓虹┖锛岃閲嶆柊鎵嬪姩鍏ュ簱鎴栬仈绯荤鐞嗗憳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + } + + + + + JObject model = new JObject(); model.Add("FBillType", new JObject() { ["FNumber"] = "SCRKD01_SYS" }); //鍗曟嵁绫诲瀷 @@ -458,7 +970,21 @@ FentityModel.Add("FBaseRealQty", item["鏁伴噺"].ToString());// FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");// FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["HPrdOrgNumber"].ToString() });// - FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 + + if (oSystemParameter.ShowBill(ref sErr)) + { + if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�") + { + if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ヨ壓璺嚎") + { + FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumbers"].ToString() }); // 浠撳簱 + } + else if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ュ簭") + { + FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 + } + } + } FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["HBatchNo"].ToString() }); //鎵瑰彿 FentityModel.Add("FISBACKFLUSH", "true");// FentityModel.Add("FWorkShopId1", new JObject() { ["FNumber"] = item["HWorkShopNumber"].ToString() }); // 鐢熶骇杞﹂棿 @@ -482,18 +1008,18 @@ FentityModel.Add("F_bsv_Base1", new JObject() { ["FNumber"] = item["HBZBS"].ToString() });// FentityModel.Add("F_BSV_TEXT", item["HLZKH"].ToString());// FentityModel.Add("F_BSV_TEXT1", item["HWYID"].ToString());// - //鎵瑰彿 - //FFLOWID FFLOWLINEID FRULEID FSTABLENAME - //f6e6eec3 - 5267 - 4f02 - 8593 - b633da508a72 3 PRD_MO2MORPT T_PRD_MOENTRY - //涓氬姟娴佺▼鍥撅細FEntity_Link_FFlowId - //鎺ㄨ繘璺嚎锛欶Entity_Link_FFlowLineId - //杞崲瑙勫垯锛欶Entity_Link_FRuleId - //婧愬崟琛ㄥ唴鐮侊細FEntity_Link_FSTableId - //婧愬崟琛細FEntity_Link_FSTableName - //婧愬崟鍐呯爜锛欶Entity_Link_FSBillId - //婧愬崟鍒嗗綍鍐呯爜锛欶Entity_Link_FSId - //鍘熷鎼哄甫閲忥細FEntity_Link_FBaseQuaQtyOld - //淇敼鎼哄甫閲忥細FEntity_Link_FBaseQuaQty + //鎵瑰彿 + //FFLOWID FFLOWLINEID FRULEID FSTABLENAME + //f6e6eec3 - 5267 - 4f02 - 8593 - b633da508a72 3 PRD_MO2MORPT T_PRD_MOENTRY + //涓氬姟娴佺▼鍥撅細FEntity_Link_FFlowId + //鎺ㄨ繘璺嚎锛欶Entity_Link_FFlowLineId + //杞崲瑙勫垯锛欶Entity_Link_FRuleId + //婧愬崟琛ㄥ唴鐮侊細FEntity_Link_FSTableId + //婧愬崟琛細FEntity_Link_FSTableName + //婧愬崟鍐呯爜锛欶Entity_Link_FSBillId + //婧愬崟鍒嗗綍鍐呯爜锛欶Entity_Link_FSId + //鍘熷鎼哄甫閲忥細FEntity_Link_FBaseQuaQtyOld + //淇敼鎼哄甫閲忥細FEntity_Link_FBaseQuaQty @@ -501,7 +1027,7 @@ JObject FentityModel2 = new JObject(); FentityModel2.Add("FEntity_Link_FFlowId", "f6e6eec3-5267-4f02-8593-b633da508a72"); FentityModel2.Add("FEntity_Link_FFlowLineId", "5"); - FentityModel2.Add("FEntity_Link_FRuleId", "PRD_MORPT2INSTOCK"); + FentityModel2.Add("FEntity_Link_FRuleId", "PRD_MORPT2INSTOCK"); FentityModel2.Add("FEntity_Link_FSTableName", "T_PRD_MORPTENTRY"); FentityModel2.Add("FEntity_Link_FSTableId", "0"); FentityModel2.Add("FEntity_Link_FSBillId", item["HSourceInterID"].ToString()); @@ -547,8 +1073,8 @@ string result = InvokeHelper.Save("PRD_INSTOCK", JsonConvert.SerializeObject(jsonRoot));//淇濆瓨 //鍒ゆ柇淇濆瓨鏄惁鎴愬姛 if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") - { - LogService.Write("鐢熶骇鍏ュ簱閿欒jsonRoot:" + jsonRoot); + { + LogService.Write("鐢熶骇鍏ュ簱淇濆瓨閿欒jsonRoot:" + jsonRoot + " 鍏ュ簱鍗曞彿锛�" + BillNo); oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; @@ -569,6 +1095,7 @@ //result2 = InvokeHelper.Audit("PRD_INSTOCK", JsonConvert.SerializeObject(json));//鎻愪氦 if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") { + LogService.Write("鐢熶骇鍏ュ簱鎻愪氦閿欒jsonRoot:" + jsonRoot + " 鍏ュ簱鍗曞彿锛�" + BillNo); oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; @@ -577,6 +1104,8 @@ return objJsonResult; } + oCN.RunProc("update Sc_StationOutBillMain set HRelationQty=1 where HBillNo='" + BillNo + "'"); + LogService.Write("鐢熶骇鍏ュ簱鍚屾鎴愬姛:" + " 鍏ュ簱鍗曞彿锛�" + BillNo); oCN.Commit(); objJsonResult.code = "0"; objJsonResult.count = 1; @@ -586,6 +1115,7 @@ } catch (Exception e) { + LogService.Write("鐢熶骇鍏ュ簱鍚屾鍙戠敓寮傚父:" + " 鍏ュ簱鍗曞彿锛�" + BillNo + " " + e.ToString()); oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; @@ -615,6 +1145,20 @@ ////鏍规嵁宸ュ簭姹囨姤鍗曚富ID鑾峰彇宸ュ簭姹囨姤鍏ュ簱鍗曠殑鏁版嵁 //DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc"); //DataRow dr = ds.Tables[0].Rows[0]; + + //鍒ゆ柇鏈鎶ュ簾鎬绘暟閲忔槸鍚︿负0 + var DTable = oCN.RunProcReturn("select isnull(sum(HWasterQty),0) HWasterQty from Sc_StationOutBillMain where HProcExchBillNo='" + BillNo + "' and HBFFlag=0 ", "Sc_StationOutBillMain").Tables[0]; + + if (double.Parse(DTable.Rows[0]["HWasterQty"].ToString()) == 0) + { + objJsonResult.code = "1"; + objJsonResult.count = 2; + objJsonResult.Message = "鎶ュ簾鏁伴噺涓�0,涓嶉渶瑕佸叆搴擄紒"; + objJsonResult.data = null; + return objJsonResult; + } + + //淇濆瓨 oCN.BeginTran(); //鐢熶骇姹囨姤鍗曚富琛� @@ -662,6 +1206,14 @@ // //DataSet ds1 = oCN.RunProcReturn("select * from h_v_TOERPProcduct_LastProc where HLastProc = '鏄�' and hbillno='" + BillNo.ToString() + "'", "h_v_TOERPProcduct_LastProc"); DataSet ds1 = oCN.RunProcReturn("exec h_p_TOERPProcduct_LastProc_BF '" + BillNo + "'", "h_p_TOERPProcduct_LastProc_BF"); + if (ds1.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎿嶄綔澶辫触,鏌ヤ笉鍒板搴旂殑鍑虹珯鍗曟嵁!"; + objJsonResult.data = null; + return objJsonResult; + } DataRow dr1 = ds1.Tables[0].Rows[0]; JObject model = new JObject(); @@ -695,7 +1247,21 @@ FentityModel.Add("FBaseRealQty", item["鏁伴噺"].ToString());// FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");// FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["HPrdOrgNumber"].ToString() });// - FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 + string sErr = ""; + if (oSystemParameter.ShowBill(ref sErr)) + { + if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�") + { + if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ヨ壓璺嚎") + { + FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumbers"].ToString() }); // 浠撳簱 + } + else if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ュ簭") + { + FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 + } + } + } FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["HBatchNo"].ToString() }); //鎵瑰彿 FentityModel.Add("FISBACKFLUSH", "true");// FentityModel.Add("FWorkShopId1", new JObject() { ["FNumber"] = item["HWorkShopNumber"].ToString() }); // 鐢熶骇杞﹂棿 @@ -710,7 +1276,7 @@ FentityModel.Add("FSrcInterId", item["HSourceInterID"].ToString());// FentityModel.Add("FBasePrdRealQty", item["鏁伴噺"].ToString());// FentityModel.Add("FIsFinished", "false");// - FentityModel.Add("FStockStatusId", new JObject() { ["FNumber"] = "KCZT01_SYS" }); // + FentityModel.Add("FStockStatusId", new JObject() { ["FNumber"] = "KCZT001" }); // FentityModel.Add("FSrcEntrySeq", item["HSourceSeQ"].ToString());// 婧愬崟鍒嗗綍琛屽彿 FentityModel.Add("FMOMAINENTRYID", item["HMOEntryID"].ToString());// FentityModel.Add("FKeeperTypeId", "BD_KeeperOrg"); @@ -814,8 +1380,10 @@ return objJsonResult; } - oCN.RunProc("update sc_stationoutbillmain set HBFFlag =1 where HProcExchBillNo = '" + BillNo + "'"); + //oCN.RunProc("update Sc_StationOutBillMain set HRelationQty=1 where HBillNo='" + BillNo + "'"); + oCN.Commit(); + oCN.RunProc("update sc_stationoutbillmain set HBFFlag =1 where HProcExchBillNo = '" + BillNo + "'"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; @@ -841,21 +1409,35 @@ /// <returns></returns> [Route("QCStockInCheckBill/set_SaveQCStockInCheckBill_Json")] [HttpGet] - public object set_SaveQCStockInCheckBill_Json(string HZJOrgNumber, string HMaterNumber, string HUnitNumber, + public object set_SaveQCStockInCheckBill_Json(string HZJOrgNumber, string HMaterNumber, string HUnitNumber, double HCheckQty, double HRightQty, double HBadQty, - string HCheckResult, string HSupNumber, string HWHNumber, - string HUseResult, Int64 HSeQ, Int64 HSourceInterID, + string HCheckResult, string HSupNumber, + string HUseResult, Int64 HSeQ, Int64 HSourceInterID, Int64 HSourceEntryID, string HSourceBillNo, string user, - Int64 HWHID, Int64 HSPID, Int64 HSupID, Int64 HKeeperID, + Int64 HWHID, Int64 HSPID, Int64 HSupID, Int64 HKeeperID, Int64 HMaterID, string HSourceBillType, Int64 HSLInterID, - Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ) + Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ, string HBillNo, Int64 HInterID, string HBatchNo) { try { //鑾峰彇鐢熶骇姹囨姤鍗曟渶澶nterID鍜屽崟鎹彿 - Int64 HInterID = DBUtility.ClsPub.CreateBillID("7503", ref DBUtility.ClsPub.sExeReturnInfo); - string HBillNo = DBUtility.ClsPub.CreateBillCode("7503", ref DBUtility.ClsPub.sExeReturnInfo, true); - + //Int64 HInterID = DBUtility.ClsPub.CreateBillID("7503", ref DBUtility.ClsPub.sExeReturnInfo); + //string HBillNo = DBUtility.ClsPub.CreateBillCode("7503", ref DBUtility.ClsPub.sExeReturnInfo, true); + + DataSet ds1 = oCN.RunProcReturn("select * from MES_AccessoriesList where HSourceBillNo = '" + HBillNo + "'", "MES_AccessoriesList"); + string HFileName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFileName"]); + string HFilePath = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFilePath"]); + + string path = HFilePath; + FileInfo fi = new FileInfo(path); + long len = fi.Length; + byte[] buffer = new byte[len]; + FileStream fs = new FileStream(path, FileMode.Open); + fs.Read(buffer, 0, (int)len); + //鏂囦欢IO娴� + string a = Convert.ToBase64String(buffer); + + //淇濆瓨 oCN.BeginTran(); //鐢熶骇姹囨姤鍗曚富琛� @@ -879,7 +1461,7 @@ ") values(" + HInterID.ToString() + ",1,'',''" + ",''," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "','" + HSourceBillType.ToString() + "'" + - ",0,0,0,0,''"+ + ",0,0,0,0,''" + ",'" + HCheckResult.ToString() + "','" + HCheckResult.ToString() + "','" + HKeeperID.ToString() + "',getdate()" + ") "); //鍚屾閲戣澏 @@ -894,54 +1476,58 @@ objJsonResult.data = null; return objJsonResult; } - + JObject model = new JObject(); model.Add("FBillTypeID", new JObject() { ["Fnumber"] = "JYD001_SYS" }); //鍗曟嵁绫诲瀷 鏉ユ枡妫�楠屽崟JYD001_SYS model.Add("FBusinessType", "1"); //涓氬姟绫诲瀷 model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //鍗曟嵁鏃ユ湡 - model.Add("FSourceOrgId", new JObject() { ["Fnumber"] = HZJOrgNumber.ToString() }); //鏉ユ簮缁勭粐 model.Add("FInspectOrgId", new JObject() { ["Fnumber"] = HZJOrgNumber.ToString() }); //璐ㄦ缁勭粐 + model.Add("FSourceOrgId", new JObject() { ["Fnumber"] = HZJOrgNumber.ToString() }); //鏉ユ簮缁勭粐 model.Add("FISSYNCED", "false");// 鏄惁宸插悓姝� + model.Add("F_PGKJ_Date", DateTime.Now.ToString("yyyy-MM-dd"));// 鎶ユ鏃ユ湡 model.Add("FBillNo", HBillNo); JArray Fentity = new JArray(); - JObject FentityModel = new JObject(); - FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = HMaterNumber.ToString() });// 鐗╂枡鍐呯爜 - FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = HUnitNumber.ToString() });//璁¢噺鍗曚綅鍐呯爜 - FentityModel.Add("FInspectQty", HCheckQty.ToString());// 妫�楠屾暟閲� - FentityModel.Add("FQualifiedQty", HRightQty.ToString());// 鍚堟牸鏁伴噺 - FentityModel.Add("FInspectResult", HCheckResult.ToString());// 妫�楠岀粨鏋� - FentityModel.Add("FQCStatus", "1");// 璐ㄦ鐘舵�� - FentityModel.Add("FIsRelated", false);// 涓嶈壇鍝佸叧鑱旀爣蹇� - FentityModel.Add("FSrcBillType0", "PUR_ReceiveBill");// 婧愬崟绫诲瀷 - FentityModel.Add("FBaseUnitId", new JObject() { ["Fnumber"] = HUnitNumber.ToString() });//鍩烘湰鍗曚綅 - FentityModel.Add("FBaseInspectQty", HCheckQty.ToString());//鍩烘湰鍗曚綅妫�楠屾暟閲� - FentityModel.Add("FSupplierId", new JObject() { ["Fnumber"] = HSupNumber.ToString() }); // 渚涘簲鍟� - FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = HWHNumber.ToString() }); // 浠撳簱 - FentityModel.Add("FInspectTimes","1"); // 妫�楠屾鏁� - FentityModel.Add("FTimeUnit","24");//鏃堕棿鍗曚綅 - FentityModel.Add("FSAMPLEDAMAGEBEARER","2");//鏍锋湰鐮村潖鎵挎媴鏂� - FentityModel.Add("FISFIRSTINSPECT", false);//棣栨 - FentityModel.Add("FBaseQualifiedQty", HRightQty.ToString());//鍩烘湰鍗曚綅鍚堟牸鏁� - FentityModel.Add("FCurrency", new JObject() { ["Fnumber"] = "PRE001" });//甯佸埆 - FentityModel.Add("FIsSplitRow ", false);// 鏄惁鎷嗗垎琛� + JObject FentityModel = new JObject(); + FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = HMaterNumber.ToString() });// 鐗╂枡鍐呯爜 + FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = HUnitNumber.ToString() });//璁¢噺鍗曚綅鍐呯爜 + FentityModel.Add("FInspectQty", HCheckQty.ToString());// 妫�楠屾暟閲� + FentityModel.Add("FQualifiedQty", HRightQty.ToString());// 鍚堟牸鏁伴噺 + FentityModel.Add("FUnqualifiedQty", HBadQty.ToString());// 涓嶅悎鏍兼暟閲� + FentityModel.Add("FInspectResult", HCheckResult.ToString());// 妫�楠岀粨鏋� + FentityModel.Add("FQCStatus", "1");// 璐ㄦ鐘舵�� + FentityModel.Add("FIsRelated", false);// 涓嶈壇鍝佸叧鑱旀爣蹇� + FentityModel.Add("FSrcBillType0", "PUR_ReceiveBill");// 婧愬崟绫诲瀷 + FentityModel.Add("FBaseUnitId", new JObject() { ["Fnumber"] = HUnitNumber.ToString() });//鍩烘湰鍗曚綅 + FentityModel.Add("FBaseInspectQty", HCheckQty.ToString());//鍩烘湰鍗曚綅妫�楠屾暟閲� + FentityModel.Add("FSupplierId", new JObject() { ["Fnumber"] = HSupNumber.ToString() }); // 渚涘簲鍟� + //FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = HWHNumber.ToString() }); // 浠撳簱 + FentityModel.Add("FInspectTimes", "1"); // 妫�楠屾鏁� + FentityModel.Add("FTimeUnit", "24");//鏃堕棿鍗曚綅 + FentityModel.Add("FSAMPLEDAMAGEBEARER", "2");//鏍锋湰鐮村潖鎵挎媴鏂� + FentityModel.Add("FISFIRSTINSPECT", false);//棣栨 + FentityModel.Add("FBaseQualifiedQty", HRightQty.ToString());//鍩烘湰鍗曚綅鍚堟牸鏁� + FentityModel.Add("FBaseAcceptQty", HRightQty.ToString());//鍩烘湰鍗曚綅鎺ユ敹鏁� + FentityModel.Add("FCurrency", new JObject() { ["Fnumber"] = "PRE001" });//甯佸埆 + FentityModel.Add("FIsSplitRow ", false);// 鏄惁鎷嗗垎琛� + FentityModel.Add("FLot", new JObject() { ["Fnumber"] = HBatchNo.ToString() });//鎵瑰彿 - JArray Fentity2 = new JArray(); - JObject FentityModel2 = new JObject(); - FentityModel2.Add("FPolicyMaterialId", new JObject() { ["Fnumber"] = HMaterNumber.ToString() });// 鐗╂枡鍐呯爜 - FentityModel2.Add("FPolicyStatus", "1"); //鐘舵�� - FentityModel2.Add("FPolicyQty", HRightQty.ToString()); //鏁伴噺 - FentityModel2.Add("FBasePolicyQty", HRightQty.ToString()); //鍩烘湰鍗曚綅鏁伴噺 - FentityModel2.Add("FUsePolicy", HUseResult.ToString()); //浣跨敤鍐崇瓥 - FentityModel2.Add("FIsCheck", false); //鏄惁鎶芥 - FentityModel2.Add("FIsDefectProcess", false); //涓嶈壇澶勭悊 - FentityModel2.Add("FCanSale", false); //鍙攢鍞� - FentityModel2.Add("FIsMRBReview", false); //MRP璇勫 - FentityModel2.Add("FIsReturn", false); //鍒ら�� - FentityModel2.Add("FIsRelatedDefect", false); //涓嶈壇鍝佸叧鑱旀爣蹇� - Fentity2.Add(FentityModel2); - FentityModel.Add("FPolicyDetail", Fentity2); + JArray Fentity2 = new JArray(); + JObject FentityModel2 = new JObject(); + FentityModel2.Add("FPolicyMaterialId", new JObject() { ["Fnumber"] = HMaterNumber.ToString() });// 鐗╂枡鍐呯爜 + FentityModel2.Add("FPolicyStatus", "1"); //鐘舵�� + FentityModel2.Add("FPolicyQty", HRightQty.ToString()); //鏁伴噺 + FentityModel2.Add("FBasePolicyQty", HRightQty.ToString()); //鍩烘湰鍗曚綅鏁伴噺 + FentityModel2.Add("FUsePolicy", HUseResult.ToString()); //浣跨敤鍐崇瓥 + FentityModel2.Add("FIsCheck", false); //鏄惁鎶芥 + FentityModel2.Add("FIsDefectProcess", false); //涓嶈壇澶勭悊 + FentityModel2.Add("FCanSale", false); //鍙攢鍞� + FentityModel2.Add("FIsMRBReview", false); //MRP璇勫 + FentityModel2.Add("FIsReturn", true); //鍒ら�� + FentityModel2.Add("FIsRelatedDefect", false); //涓嶈壇鍝佸叧鑱旀爣蹇� + Fentity2.Add(FentityModel2); + FentityModel.Add("FPolicyDetail", Fentity2); @@ -951,7 +1537,7 @@ FentityModel3.Add("FSrcBillType", "PUR_ReceiveBill"); //婧愬崟绫诲瀷 FentityModel3.Add("FSrcBillNo", HSLBillNo.ToString()); //鏀舵枡閫氱煡鍗曞崟鍙� FentityModel3.Add("FSrcInterId", HSLInterID.ToString()); //鏀舵枡閫氱煡鍗曚富ID - FentityModel3.Add("FSrcEntryId",HSLEntryID.ToString()); //鏀舵枡閫氱煡鍗曞瓙ID + FentityModel3.Add("FSrcEntryId", HSLEntryID.ToString()); //鏀舵枡閫氱煡鍗曞瓙ID FentityModel3.Add("FSrcEntrySeq", HSLSeQ.ToString()); //婧愬崟琛屽彿 FentityModel3.Add("FOrderType", new JObject() { ["FID"] = "PUR_PurchaseOrder" }); // 璁㈠崟绫诲瀷 FentityModel3.Add("FOrderBillNo", HSourceBillNo.ToString()); //璁㈠崟鍗曞彿 @@ -968,6 +1554,7 @@ FentityModel4.Add("FEntity_Link_FSTableName", "T_PUR_RECEIVEENTRY"); //鏀舵枡閫氱煡鍗曞瓙琛� FentityModel4.Add("FEntity_Link_FSBillId", HSLInterID.ToString()); //鏀舵枡閫氱煡鍗曚富鍐呯爜 FentityModel4.Add("FEntity_Link_FSId", HSLEntryID.ToString()); //鏀舵枡閫氱煡鍗曞瓙鍐呯爜 + FentityModel4.Add("FEntity_Link_FBaseAcceptQty", HRightQty.ToString()); // FentityModel4.Add("FEntity_Link_FBaseAcceptQtyOld", HRightQty.ToString()); // FentityModel4.Add("FEntity_Link_FBaseInspectQtyOld", HRightQty.ToString()); // FentityModel4.Add("FEntity_Link_FInspectQtyOld", HRightQty.ToString()); // @@ -998,7 +1585,7 @@ oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = $"鏉ユ枡妫�楠屽崟鍚屾閲戣澏浜戝け璐ワ紒鍗曞彿:{HBillNo.ToString()}" + result; + objJsonResult.Message = $"鏉ユ枡妫�楠屽崟鍚屾閲戣澏浜戝け璐ワ紒鍗曞彿:{HBillNo.ToString()}" + jsonRoot; objJsonResult.data = null; return objJsonResult; } @@ -1011,6 +1598,12 @@ { Ids = fID, }; + + K3CloudApiClient client = new K3CloudApiClient("http://47.96.97.237/k3cloud"); + // K3CloudApiClient client = new K3CloudApiClient("http://192.168.80.90/k3cloud/"); + + + result1 = InvokeHelper.Submit("QM_InspectBill", JsonConvert.SerializeObject(json));//鎻愪氦 result2 = InvokeHelper.Audit("QM_InspectBill", JsonConvert.SerializeObject(json));//鎻愪氦 if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") @@ -1021,6 +1614,20 @@ objJsonResult.Message = $"鏉ユ枡妫�楠屽崟鍙凤細{fBillNo}锛屾彁浜ゅけ璐�" + result; objJsonResult.data = null; return objJsonResult; + } + else + { + string jsonStr = "{" + + " \"FileName\":\"" + HFileName + "\"," + + " \"FormId\":\"QM_InspectBill\"," + + " \"IsLast\":\"true\"," + + " \"InterId\":\"" + HInterID + "\"," + + " \"BillNO\":\"" + HBillNo + "\"," + + " \"AliasFileName\":\"test\"," + + " \"SendByte\":\"" + a + "\"," + + "}"; + + var ret = client.AttachmentUpload(jsonStr); } oCN.Commit(); @@ -1040,7 +1647,57 @@ return objJsonResult; } } - #endregion + + + + + + + ///// <summary> + ///// 鐢熸垚閲戣澏浜戞潵鏂欐楠屽崟 + ///// </summary> + ///// <param name="InterID">宸ュ簭姹囨姤鍗曚富ID</param> + ///// <returns></returns> + //[Route("QCStockInCheckBill/set_SaveQCStockInCheckBill_Json")] + //[HttpGet] + //public object set_SaveQCStockInCheckBill_Json(string HZJOrgNumber, string HMaterNumber, string HUnitNumber, + // double HCheckQty, double HRightQty, double HBadQty, + // string HCheckResult, string HSupNumber, + // string HUseResult, Int64 HSeQ, Int64 HSourceInterID, + // Int64 HSourceEntryID, string HSourceBillNo, string user, + // Int64 HWHID, Int64 HSPID, Int64 HSupID, Int64 HKeeperID, + // Int64 HMaterID, string HSourceBillType, Int64 HSLInterID, + // Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ, string HBillNo, Int64 HInterID,ref string sErrMsg) + //{ + // WebS.WebService1 oWebs1 = new WebS.WebService1(); + + + // //oWebs1.Url = "http://localhost:9099/WebService1.asmx"; + // //K3CloudApiClient client = new K3CloudApiClient("http://192.168.80.90/k3cloud/"); + // if (oWebs1.set_SaveQcStockInCheckBill_New(HZJOrgNumber, HMaterNumber, HUnitNumber, HCheckQty, HRightQty, HBadQty + // , HCheckResult, HSupNumber, HUseResult, HSeQ, HSourceInterID + // , HSourceEntryID, HSourceBillNo, user, HWHID, HSPID + // , HSupID, HKeeperID, HMaterID, HSourceBillType, HSLInterID + // , HSLEntryID, HSLBillNo, HSLSeQ, HBillNo, HInterID + // , ref sErrMsg)) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 1; + // objJsonResult.Message = "鐢熸垚鍗曟嵁鎴愬姛锛�"; + // objJsonResult.data = null; + // return objJsonResult; + // } + // else + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鐢熸垚鍗曟嵁澶辫触锛�"; + // objJsonResult.data = sErrMsg; + // return objJsonResult; + // } + //} + + @@ -1069,7 +1726,7 @@ string HBillNo = DBUtility.ClsPub.CreateBillCode("7501", ref DBUtility.ClsPub.sExeReturnInfo, true); //淇濆瓨 - oCN.BeginTran(); + //oCN.BeginTran(); //鐢熸垚浜у搧妫�楠屽崟 //oCN.RunProc("Insert Into QC_POStockInCheckBillMain " + //"(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HBillStatus,HChecker,HCheckDate" + @@ -1123,6 +1780,7 @@ FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = HUnitNumber.ToString() });//璁¢噺鍗曚綅鍐呯爜 FentityModel.Add("FInspectQty", HCheckQty.ToString());// 妫�楠屾暟閲� FentityModel.Add("FQualifiedQty", HRightQty.ToString());// 鍚堟牸鏁伴噺 + FentityModel.Add("FUnqualifiedQty", HBadQty.ToString());// 涓嶅悎鏍兼暟閲� FentityModel.Add("FInspectResult", HCheckResult.ToString());// 妫�楠岀粨鏋� FentityModel.Add("FQCStatus", "1");// 璐ㄦ鐘舵�� FentityModel.Add("FIsRelated", false);// 涓嶈壇鍝佸叧鑱旀爣蹇� @@ -1130,7 +1788,7 @@ FentityModel.Add("FBaseUnitId", new JObject() { ["Fnumber"] = HUnitNumber.ToString() });//鍩烘湰鍗曚綅 FentityModel.Add("FBaseInspectQty", HCheckQty.ToString());//鍩烘湰鍗曚綅妫�楠屾暟閲� //FentityModel.Add("FSupplierId", new JObject() { ["Fnumber"] = HSupNumber.ToString() }); // 渚涘簲鍟� - FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = HWHNumber.ToString() }); // 浠撳簱 + //FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = HWHNumber.ToString() }); // 浠撳簱 FentityModel.Add("FInspectTimes", "1"); // 妫�楠屾鏁� FentityModel.Add("FTimeUnit", "24");//鏃堕棿鍗曚綅 FentityModel.Add("FSAMPLEDAMAGEBEARER", "2");//鏍锋湰鐮村潖鎵挎媴鏂� @@ -1150,11 +1808,42 @@ FentityModel2.Add("FIsDefectProcess", false); //涓嶈壇澶勭悊 FentityModel2.Add("FCanSale", false); //鍙攢鍞� FentityModel2.Add("FIsMRBReview", false); //MRP璇勫 - FentityModel2.Add("FIsReturn", false); //鍒ら�� + FentityModel2.Add("FIsReturn", true); //鍒ら�� FentityModel2.Add("FIsRelatedDefect", false); //涓嶈壇鍝佸叧鑱旀爣蹇� Fentity2.Add(FentityModel2); FentityModel.Add("FPolicyDetail", Fentity2); + + + JArray Fentity3 = new JArray(); + JObject FentityModel3 = new JObject(); + FentityModel3.Add("FDetailID", "0");// + FentityModel3.Add("FSrcBillType", "SFC_OperationReport"); //婧愬崟绫诲瀷 + FentityModel3.Add("FSrcBillNo", HSLBillNo.ToString()); //宸ュ簭姹囨姤鍗曞崟鍙� + FentityModel3.Add("FSrcInterId", HSLInterID.ToString()); //宸ュ簭姹囨姤鍗曚富ID + FentityModel3.Add("FSrcEntryId", HSLEntryID.ToString()); //宸ュ簭姹囨姤鍗曞瓙ID + FentityModel3.Add("FSrcEntrySeq", HSLSeQ.ToString()); //宸ュ簭姹囨姤鍗曡鍙� + FentityModel3.Add("FOrderType", new JObject() { ["FID"] = "PRD_MO" }); // 鐢熶骇璁㈠崟绫诲瀷 + FentityModel3.Add("FOrderBillNo", HSourceBillNo.ToString()); //鐢熶骇璁㈠崟鍗曞彿 + FentityModel3.Add("FOrderId", HSourceInterID.ToString()); //鐢熶骇璁㈠崟涓籌D + FentityModel3.Add("FOrderEntryId", HSourceEntryID.ToString()); //鐢熶骇璁㈠崟瀛怚D + FentityModel3.Add("FOrderEntrySeq", HSeQ.ToString()); //鐢熶骇璁㈠崟琛屽彿 + Fentity3.Add(FentityModel3); + FentityModel.Add("FReferDetail", Fentity3); + + + JArray Fentity4 = new JArray(); + JObject FentityModel4 = new JObject(); + FentityModel4.Add("FEntity_Link_FRuleId", "QM_OperRpt2Inspect"); //鍗曟嵁杞崲瑙勫垯 + FentityModel4.Add("FEntity_Link_FSTableName", "T_SFC_OPTRPTENTRY"); //宸ュ簭姹囨姤鍗曞瓙琛� + FentityModel4.Add("FEntity_Link_FSBillId", HSLInterID.ToString()); //宸ュ簭姹囨姤鍗曚富ID + FentityModel4.Add("FEntity_Link_FSId", HSLEntryID.ToString()); //宸ュ簭姹囨姤鍗曞瓙ID + FentityModel4.Add("FEntity_Link_FBaseAcceptQty", HRightQty.ToString()); // + FentityModel4.Add("FEntity_Link_FBaseAcceptQtyOld", HRightQty.ToString()); // + FentityModel4.Add("FEntity_Link_FBaseInspectQtyOld", HRightQty.ToString()); // + FentityModel4.Add("FEntity_Link_FInspectQtyOld", HRightQty.ToString()); // + Fentity4.Add(FentityModel4); + FentityModel.Add("FEntity_Link", Fentity4); //JArray Fentity3 = new JArray(); @@ -1173,6 +1862,10 @@ //FentityModel.Add("FReferDetail", Fentity3); Fentity.Add(FentityModel); model.Add("FEntity", Fentity); //鏄庣粏淇℃伅 + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds = oCN.RunProcReturn("select HCheckdate from Sc_ProcessReportMain where hbillno = '" + HSourceBillNo + "'", "Sc_ProcessReportMain"); + DateTime HCheckDate = DBUtility.ClsPub.isDate(ds.Tables[0].Rows[0]["HCheckdate"]); JObject jsonRoot = new JObject() { ["Creator"] = "", @@ -1181,6 +1874,7 @@ ["IsDeleteEntry"] = "false", ["SubSystemId"] = "", ["IsVerifyBaseDataField"] = "false", + ["F_PGKJ_Date"] = HCheckDate.ToString(), //["IsAutoSubmitAndAudit"] = true,//鑷姩璋冪敤鎻愪氦鍜屽鏍稿姛鑳� ["Model"] = model }; @@ -1390,6 +2084,7 @@ DataSet ds; try { + if (!DBUtility.ClsPub.Security_Log("Sc_ProcessPlan_Query", 1, false, user)) { objJsonResult.code = "0"; @@ -1410,6 +2105,7 @@ string sql = sql1 + sWhere + " order by hmainid desc "; ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessPlanList"); } + } catch (Exception e) { @@ -2507,6 +3203,115 @@ } } #endregion + + + #region 涓嶈壇鍝佸鐞嗗崟鍏抽棴/鍙嶅叧闂姛鑳� + [Route("Sc_ProcessMangement/CloseSc_ProcessMangement")] + [HttpGet] + public object CloseSc_ProcessMangement(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdCheckBill_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 = "QC_NoPassProdCheckBillMain"; + 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.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 (!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]["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 + + /// <summary> /// PDA宸ュ簭姹囨姤鍗曚繚瀛� @@ -4214,7 +5019,3474 @@ } } + #region 涓嶈壇鍝佽瘎瀹$敵璇峰崟 + #region 涓嶈壇鍝佽瘎瀹$敵璇峰崟 鏂板/缂栬緫 + [Route("Sc_ProcessMangement/SaveQC_NoPassProdRequestBill")] + [HttpPost] + public object SaveQC_NoPassProdRequestBill([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[1].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗 + string msg4 = sArray[2].ToString();//鐢ㄦ埛鍚� + + DBUtility.ClsPub.CurUserName = msg4; + + string UserName = ""; + string s = ""; + ListModels oListModels = new ListModels(); + try + { + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("QC_NoPassProdRequestBillMain_Edit", 1, false, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + // QC_NoPassProdRequestBill + DAL.ClsQC_NoPassProdRequestBill oBill = new DAL.ClsQC_NoPassProdRequestBill(); + List<Model.ClsQC_NoPassProdRequestBillMain> lsmain = new List<Model.ClsQC_NoPassProdRequestBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_QC_NoPassProdRequestBill(msg2); + foreach (Model.ClsQC_NoPassProdRequestBillMain oItem in lsmain) + { + if (refSav == "Add") + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (oBill.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 (oBill.ShowBill(oItem.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; + } + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + } + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "7512"; + oItem.HBillSubType = "7512"; + + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庨獙鏀� + bool bResult; + if (refSav == "Add") + { + + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else if (refSav == "Update") + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = false; + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + 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 涓嶈壇鍝佽瘎瀹$敵璇峰崟 缂栬緫鍥炴樉鍒楄〃 + + [Route("Sc_ProcessMangement/Edit_QC_NoPassProdRequestBill")] + [HttpGet] + public object Edit_QC_NoPassProdRequestBill(string HID) + { + try + { + List<object> columnNameList = new List<object>(); + + string sql = "select * from h_v_QC_NoPassProdRequestBillMainList where hmainid='" + HID + "'"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdRequestBillMainList"); + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓嶈壇鍝佽瘎瀹$敵璇峰崟 鍒楄〃 + + [Route("Sc_ProcessMangement/Get_QC_NoPassProdRequestBillList")] + [HttpGet] + public object Get_QC_NoPassProdRequestBillList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdRequestBillMain_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (sWhere == null || sWhere.Equals("")) + { + string sql = "select * from h_v_QC_NoPassProdRequestBillMainList order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdRequestBillMainList"); + } + else + { + string sql1 = "select * from h_v_QC_NoPassProdRequestBillMainList where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdRequestBillMainList"); + } + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓嶈壇鍝佽瘎瀹$敵璇峰崟 鍒犻櫎 + + [Route("Sc_ProcessMangement/DeleteQC_NoPassProdRequestBill")] + [HttpGet] + public object DeleteQC_NoPassProdRequestBill(string HInterID, string user) + { + try + { + string s = ""; + DAL.ClsQC_NoPassProdRequestBill BillOld = new DAL.ClsQC_NoPassProdRequestBill(); + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdRequestBillMain_Delete", 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 (BillOld.ShowBill(long.Parse(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; + } + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_QC_NoPassProdRequestBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdRequestBill_BeforeDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== + + + + oCN.BeginTran(); + + oCN.RunProc("delete from QC_NoPassProdRequestBillMain where HInterID = " + HInterID); + oCN.RunProc("delete from QC_NoPassProdRequestBillSub where HInterID= " + HInterID); + + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec h_p_QC_NoPassProdRequestBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_QC_NoPassProdRequestBill_AfterDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + s = ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //============================================================================================== + + 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("Sc_ProcessMangement/AuditQC_NoPassProdRequestBill")] + [HttpGet] + public object AuditQC_NoPassProdRequestBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdRequestBillMain_Check"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdRequestBill oBill = new DAL.ClsQC_NoPassProdRequestBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + 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) //瀹℃牳鎻愪氦 + { + oCN.BeginTran(); + + //璁板綍杩斿洖淇℃伅 + string msg = ""; + + + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_QC_NoPassProdRequestBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdRequestBill_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdRequestBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛锛�" + msg; + objJsonResult.data = null; + return objJsonResult; + } + else + { + oCN.RollBack(); + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_QC_NoPassProdRequestBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdRequestBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=========================================================== + + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdRequestBill_AfterUnCheckCtrl", CurUserName, 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) + { + oCN.RollBack(); + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + 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("Sc_ProcessMangement/CloseQC_NoPassProdRequestBill")] + [HttpGet] + public object CloseQC_NoPassProdRequestBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdRequestBillMain_Close"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //妫�鏌ユ潈闄� + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍏抽棴澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdRequestBill oBill = new DAL.ClsQC_NoPassProdRequestBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //鍏抽棴鍒ゆ柇 + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅叧闂垽鏂� + { + if (oBill.omodel.HCloseMan.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.CloseBill(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) //鍙嶅叧闂彁浜� + { + //鍙嶅叧闂彁浜� + if (oBill.CancelClose(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 + + #region 涓嶈壇鍝佽瘎瀹$敵璇峰崟 浣滃簾/鍙嶄綔搴� + /// <summary> + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">浣滃簾(0),鍙嶄綔搴�(1)</param> + /// <param name="CurUserName">浣滃簾浜�</param> + /// <returns></returns> + [Route("Sc_ProcessMangement/DeleteQC_NoPassProdRequestBill")] + [HttpGet] + public object DeleteQC_NoPassProdRequestBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdRequestBillMain_Drop"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //妫�鏌ユ潈闄� + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浣滃簾澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdRequestBill oBill = new DAL.ClsQC_NoPassProdRequestBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //浣滃簾鍒ゆ柇 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶄綔搴燂紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶄綔搴熷垽鏂� + { + if (oBill.omodel.HDeleteMan.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.Cancelltion(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) //鍙嶅叧闂彁浜� + { + //鍙嶅叧闂彁浜� + if (oBill.AbandonCancelltion(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 + + #endregion + + #region 涓嶈壇鍝佽瘎瀹″鐞嗗崟 + + #region 涓嶈壇鍝佽瘎瀹″鐞嗗崟 鏂板/缂栬緫 + [Route("Sc_ProcessMangement/SaveQC_NoPassProdDisposeBill")] + [HttpPost] + public object SaveQC_NoPassProdDisposeBill([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[1].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗 + string msg4 = sArray[2].ToString();//鐢ㄦ埛鍚� + + DBUtility.ClsPub.CurUserName = msg4; + + string UserName = ""; + string s = ""; + ListModels oListModels = new ListModels(); + try + { + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("QC_NoPassProdDisposeBillMain_Edit", 1, false, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + // QC_NoPassProdDisposeBill + DAL.ClsQC_NoPassProdDisposeBill oBill = new DAL.ClsQC_NoPassProdDisposeBill(); + List<Model.ClsQC_NoPassProdDisposeBillMain> lsmain = new List<Model.ClsQC_NoPassProdDisposeBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_QC_NoPassProdDisposeBill(msg2); + foreach (Model.ClsQC_NoPassProdDisposeBillMain oItem in lsmain) + { + if (refSav == "Add") + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (oBill.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 (oBill.ShowBill(oItem.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; + } + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + } + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "7514"; + oItem.HBillSubType = "7514"; + + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庨獙鏀� + bool bResult; + if (refSav == "Add") + { + + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else if (refSav == "Update") + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = false; + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + 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 涓嶈壇鍝佽瘎瀹″鐞嗗崟 缂栬緫鍥炴樉鍒楄〃 + + [Route("Sc_ProcessMangement/Edit_QC_NoPassProdDisposeBill")] + [HttpGet] + public object Edit_QC_NoPassProdDisposeBill(string HID) + { + try + { + List<object> columnNameList = new List<object>(); + + string sql = "select * from h_v_QC_NoPassProdDisposeBillMain_Edit where hmainid='" + HID + "'"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdDisposeBillMain_Edit"); + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓嶈壇鍝佽瘎瀹″鐞嗗崟 鍒楄〃 + + [Route("Sc_ProcessMangement/Get_QC_NoPassProdDisposeBillList")] + [HttpGet] + public object Get_QC_NoPassProdDisposeBillList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdDisposeBillMain_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (sWhere == null || sWhere.Equals("")) + { + string sql = "select * from h_v_QC_NoPassProdDisposeBillMainList order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdDisposeBillMainList"); + } + else + { + string sql1 = "select * from h_v_QC_NoPassProdDisposeBillMainList where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdDisposeBillMainList"); + } + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓嶈壇鍝佽瘎瀹″鐞嗗崟 鍒犻櫎 + + [Route("Sc_ProcessMangement/DeleteQC_NoPassProdDisposeBill")] + [HttpGet] + public object DeleteQC_NoPassProdDisposeBill(string HInterID, string user) + { + try + { + string s = ""; + DAL.ClsQC_NoPassProdDisposeBill BillOld = new DAL.ClsQC_NoPassProdDisposeBill(); + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdDisposeBillMain_Delete", 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 (BillOld.ShowBill(long.Parse(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; + } + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_QC_NoPassProdDisposeBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdDisposeBill_BeforeDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== + + + + oCN.BeginTran(); + + oCN.RunProc("delete from QC_NoPassProdDisposeBillMain where HInterID = " + HInterID); + oCN.RunProc("delete from QC_NoPassProdDisposeBillSub where HInterID= " + HInterID); + + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec h_p_QC_NoPassProdDisposeBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_QC_NoPassProdDisposeBill_AfterDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + s = ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //============================================================================================== + + 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("Sc_ProcessMangement/AuditQC_NoPassProdDisposeBill")] + [HttpGet] + public object AuditQC_NoPassProdDisposeBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdDisposeBillMain_Check"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdDisposeBill oBill = new DAL.ClsQC_NoPassProdDisposeBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + 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) //瀹℃牳鎻愪氦 + { + oCN.BeginTran(); + + //璁板綍杩斿洖淇℃伅 + string msg = ""; + + + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_QC_NoPassProdDisposeBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdDisposeBill_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdDisposeBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛锛�" + msg; + objJsonResult.data = null; + return objJsonResult; + } + else + { + oCN.RollBack(); + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_QC_NoPassProdDisposeBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdDisposeBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=========================================================== + + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdDisposeBill_AfterUnCheckCtrl", CurUserName, 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) + { + oCN.RollBack(); + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + 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("Sc_ProcessMangement/CloseQC_NoPassProdDisposeBill")] + [HttpGet] + public object CloseQC_NoPassProdDisposeBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdDisposeBillMain_Close"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //妫�鏌ユ潈闄� + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍏抽棴澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdDisposeBill oBill = new DAL.ClsQC_NoPassProdDisposeBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //鍏抽棴鍒ゆ柇 + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅叧闂垽鏂� + { + if (oBill.omodel.HCloseMan.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.CloseBill(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) //鍙嶅叧闂彁浜� + { + //鍙嶅叧闂彁浜� + if (oBill.CancelClose(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 + + #region 涓嶈壇鍝佽瘎瀹″鐞嗗崟 浣滃簾/鍙嶄綔搴� + /// <summary> + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">浣滃簾(0),鍙嶄綔搴�(1)</param> + /// <param name="CurUserName">浣滃簾浜�</param> + /// <returns></returns> + [Route("Sc_ProcessMangement/DeleteQC_NoPassProdDisposeBill")] + [HttpGet] + public object DeleteQC_NoPassProdDisposeBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdDisposeBillMain_Drop"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //妫�鏌ユ潈闄� + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浣滃簾澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdDisposeBill oBill = new DAL.ClsQC_NoPassProdDisposeBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //浣滃簾鍒ゆ柇 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶄綔搴燂紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶄綔搴熷垽鏂� + { + if (oBill.omodel.HDeleteMan.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.Cancelltion(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) //鍙嶅叧闂彁浜� + { + //鍙嶅叧闂彁浜� + if (oBill.AbandonCancelltion(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 + + #region 涓嶈壇鍝佽瘎瀹″鐞嗗崟 鍑虹珯鍗曚笅鎺ㄦ煡璇� + + [Route("Sc_ProcessMangement/Get_Sc_StationOutBill")] + [HttpGet] + public object Get_Sc_StationOutBill(string HID) + { + try + { + List<object> columnNameList = new List<object>(); + + string sql = "select * from h_v_MES_StationOutBillList where hmainid='" + HID + "'"; + ds = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList"); + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 涓嶈壇鍝佽瘎瀹″鐞嗛獙鏀跺崟 + + #region 涓嶈壇鍝佽瘎瀹″鐞嗛獙鏀跺崟 鏂板/缂栬緫 + [Route("Sc_ProcessMangement/SaveQC_NoPassProdDisposeCheckBill")] + [HttpPost] + public object SaveQC_NoPassProdDisposeCheckBill([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[1].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗 + string msg4 = sArray[2].ToString();//鐢ㄦ埛鍚� + + DBUtility.ClsPub.CurUserName = msg4; + + string UserName = ""; + string s = ""; + ListModels oListModels = new ListModels(); + try + { + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("QC_NoPassProdDisposeCheckBillMain_Edit", 1, false, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + // QC_NoPassProdDisposeCheckBill + DAL.ClsQC_NoPassProdDisposeCheckBill oBill = new DAL.ClsQC_NoPassProdDisposeCheckBill(); + List<Model.ClsQC_NoPassProdDisposeCheckBillMain> lsmain = new List<Model.ClsQC_NoPassProdDisposeCheckBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_QC_NoPassProdDisposeCheckBill(msg2); + foreach (Model.ClsQC_NoPassProdDisposeCheckBillMain oItem in lsmain) + { + if (refSav == "Add") + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (oBill.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 (oBill.ShowBill(oItem.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; + } + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + } + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "7515"; + oItem.HBillSubType = "7515"; + + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庨獙鏀� + bool bResult; + if (refSav == "Add") + { + + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else if (refSav == "Update") + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = false; + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + 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 涓嶈壇鍝佽瘎瀹″鐞嗛獙鏀跺崟 缂栬緫鍥炴樉鍒楄〃 + + [Route("Sc_ProcessMangement/Edit_QC_NoPassProdDisposeCheckBill")] + [HttpGet] + public object Edit_QC_NoPassProdDisposeCheckBill(string HID,int num,string HBillNo, string HInterID) + { + try + { + List<object> columnNameList = new List<object>(); + // num =1 浠h〃 鏂板椤甸潰杩涜閫夌潃婧愬崟 閫氳繃 鏌ヨ 澶勭悊鍗� 鎵惧嚭 鐢宠鍗� + //num =2 浠h〃 缂栬緫鍥炴樉 + if (num==1) + { + string sql1 = "select * from h_v_QC_NoPassProdDisposeBillMain_EditPlus where 澶勭悊鍗曟嵁鍙�='" + HBillNo + "' and hinterid='"+ HInterID + "'"; + ds = oCN.RunProcReturn(sql1, "h_v_QC_NoPassProdDisposeCheckBillMain_Edit"); + } + else if(num ==2) + { + string sql = "select * from h_v_QC_NoPassProdDisposeCheckBillMain_Edit where hmainid='" + HID + "'"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdDisposeCheckBillMain_Edit"); + } + + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓嶈壇鍝佽瘎瀹″鐞嗛獙鏀跺崟 鍒楄〃 + + [Route("Sc_ProcessMangement/Get_QC_NoPassProdDisposeCheckBillList")] + [HttpGet] + public object Get_QC_NoPassProdDisposeCheckBillList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdDisposeCheckBillMain_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (sWhere == null || sWhere.Equals("")) + { + string sql = "select * from h_v_QC_NoPassProdDisposeCheckBillMainList order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdDisposeCheckBillMainList"); + } + else + { + string sql1 = "select * from h_v_QC_NoPassProdDisposeCheckBillMainList where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdDisposeCheckBillMainList"); + } + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓嶈壇鍝佽瘎瀹″鐞嗛獙鏀跺崟 鍒犻櫎 + + [Route("Sc_ProcessMangement/DeleteQC_NoPassProdDisposeCheckBill")] + [HttpGet] + public object DeleteQC_NoPassProdDisposeCheckBill(string HInterID, string user) + { + try + { + string s = ""; + DAL.ClsQC_NoPassProdDisposeCheckBill BillOld = new DAL.ClsQC_NoPassProdDisposeCheckBill(); + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdDisposeCheckBillMain_Delete", 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 (BillOld.ShowBill(long.Parse(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; + } + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_QC_NoPassProdDisposeCheckBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdDisposeCheckBill_BeforeDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== + + + + oCN.BeginTran(); + + oCN.RunProc("delete from QC_NoPassProdDisposeCheckBillMain where HInterID = " + HInterID); + oCN.RunProc("delete from QC_NoPassProdDisposeCheckBillSub where HInterID= " + HInterID); + + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec h_p_QC_NoPassProdDisposeCheckBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_QC_NoPassProdDisposeCheckBill_AfterDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + s = ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //============================================================================================== + + 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("Sc_ProcessMangement/AuditQC_NoPassProdDisposeCheckBill")] + [HttpGet] + public object AuditQC_NoPassProdDisposeCheckBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdDisposeCheckBillMain_Check"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdDisposeCheckBill oBill = new DAL.ClsQC_NoPassProdDisposeCheckBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + 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) //瀹℃牳鎻愪氦 + { + oCN.BeginTran(); + + //璁板綍杩斿洖淇℃伅 + string msg = ""; + + + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_QC_NoPassProdDisposeCheckBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdDisposeCheckBill_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdDisposeCheckBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛锛�" + msg; + objJsonResult.data = null; + return objJsonResult; + } + else + { + oCN.RollBack(); + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_QC_NoPassProdDisposeCheckBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdDisposeCheckBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=========================================================== + + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdDisposeCheckBill_AfterUnCheckCtrl", CurUserName, 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) + { + oCN.RollBack(); + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + 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("Sc_ProcessMangement/CloseQC_NoPassProdDisposeCheckBill")] + [HttpGet] + public object CloseQC_NoPassProdDisposeCheckBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdDisposeCheckBillMain_Close"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //妫�鏌ユ潈闄� + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍏抽棴澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdDisposeCheckBill oBill = new DAL.ClsQC_NoPassProdDisposeCheckBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //鍏抽棴鍒ゆ柇 + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅叧闂垽鏂� + { + if (oBill.omodel.HCloseMan.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.CloseBill(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) //鍙嶅叧闂彁浜� + { + //鍙嶅叧闂彁浜� + if (oBill.CancelClose(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 + + #region 涓嶈壇鍝佽瘎瀹″鐞嗛獙鏀跺崟 浣滃簾/鍙嶄綔搴� + /// <summary> + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">浣滃簾(0),鍙嶄綔搴�(1)</param> + /// <param name="CurUserName">浣滃簾浜�</param> + /// <returns></returns> + [Route("Sc_ProcessMangement/DeleteQC_NoPassProdDisposeCheckBill")] + [HttpGet] + public object DeleteQC_NoPassProdDisposeCheckBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdDisposeCheckBillMain_Drop"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //妫�鏌ユ潈闄� + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浣滃簾澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdDisposeCheckBill oBill = new DAL.ClsQC_NoPassProdDisposeCheckBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //浣滃簾鍒ゆ柇 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶄綔搴燂紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶄綔搴熷垽鏂� + { + if (oBill.omodel.HDeleteMan.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.Cancelltion(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) //鍙嶅叧闂彁浜� + { + //鍙嶅叧闂彁浜� + if (oBill.AbandonCancelltion(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 + + #endregion + + #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟 + + #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟 鏂板/缂栬緫 + [Route("Sc_ProcessMangement/SaveQC_NoPassProdConclusionBill")] + [HttpPost] + public object SaveQC_NoPassProdConclusionBill([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[1].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗 + string msg4 = sArray[2].ToString();//鐢ㄦ埛鍚� + + DBUtility.ClsPub.CurUserName = msg4; + + string UserName = ""; + string s = ""; + ListModels oListModels = new ListModels(); + try + { + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("QC_NoPassProdConclusionBillMain_Edit", 1, false, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + // QC_NoPassProdConclusionBill + DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill(); + List<Model.ClsQC_NoPassProdConclusionBillMain> lsmain = new List<Model.ClsQC_NoPassProdConclusionBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_QC_NoPassProdConclusionBill(msg2); + foreach (Model.ClsQC_NoPassProdConclusionBillMain oItem in lsmain) + { + if (refSav == "Add") + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (oBill.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 (oBill.ShowBill(oItem.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; + } + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + } + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "7513"; + oItem.HBillSubType = "7513"; + + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庨獙鏀� + bool bResult; + if (refSav == "Add") + { + + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else if (refSav == "Update") + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = false; + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + 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 涓嶈壇鍝佽瘎瀹$粨璁哄崟 缂栬緫鍥炴樉鍒楄〃 + + [Route("Sc_ProcessMangement/Edit_QC_NoPassProdConclusionBill")] + [HttpGet] + public object Edit_QC_NoPassProdConclusionBill(string HID) + { + try + { + List<object> columnNameList = new List<object>(); + + string sql = "select * from h_v_QC_NoPassProdConclusionBillMain_Edit where hmainid='" + HID + "'"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdConclusionBillMain_Edit"); + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟 鍒楄〃 + + [Route("Sc_ProcessMangement/Get_QC_NoPassProdConclusionBillList")] + [HttpGet] + public object Get_QC_NoPassProdConclusionBillList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdConclusionBillMain_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (sWhere == null || sWhere.Equals("")) + { + string sql = "select * from h_v_QC_NoPassProdConclusionBillMainList order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdConclusionBillMainList"); + } + else + { + string sql1 = "select * from h_v_QC_NoPassProdConclusionBillMainList where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdConclusionBillMainList"); + } + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟 鍒犻櫎 + + [Route("Sc_ProcessMangement/DeleteQC_NoPassProdConclusionBill")] + [HttpGet] + public object DeleteQC_NoPassProdConclusionBill(string HInterID, string user) + { + try + { + string s = ""; + DAL.ClsQC_NoPassProdConclusionBill BillOld = new DAL.ClsQC_NoPassProdConclusionBill(); + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdConclusionBillMain_Delete", 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 (BillOld.ShowBill(long.Parse(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; + } + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_QC_NoPassProdConclusionBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdConclusionBill_BeforeDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== + + + + oCN.BeginTran(); + + oCN.RunProc("delete from QC_NoPassProdConclusionBillMain where HInterID = " + HInterID); + oCN.RunProc("delete from QC_NoPassProdConclusionBillSub where HInterID= " + HInterID); + + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec h_p_QC_NoPassProdConclusionBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_QC_NoPassProdConclusionBill_AfterDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + s = ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //============================================================================================== + + 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("Sc_ProcessMangement/AuditQC_NoPassProdConclusionBill")] + [HttpGet] + public object AuditQC_NoPassProdConclusionBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdConclusionBillMain_Check"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + 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) //瀹℃牳鎻愪氦 + { + oCN.BeginTran(); + + //璁板綍杩斿洖淇℃伅 + string msg = ""; + + + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_QC_NoPassProdConclusionBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdConclusionBill_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdConclusionBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛锛�" + msg; + objJsonResult.data = null; + return objJsonResult; + } + else + { + oCN.RollBack(); + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_QC_NoPassProdConclusionBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdConclusionBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=========================================================== + + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdConclusionBill_AfterUnCheckCtrl", CurUserName, 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) + { + oCN.RollBack(); + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + 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("Sc_ProcessMangement/CloseQC_NoPassProdConclusionBill")] + [HttpGet] + public object CloseQC_NoPassProdConclusionBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdConclusionBillMain_Close"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //妫�鏌ユ潈闄� + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍏抽棴澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //鍏抽棴鍒ゆ柇 + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅叧闂垽鏂� + { + if (oBill.omodel.HCloseMan.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.CloseBill(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) //鍙嶅叧闂彁浜� + { + //鍙嶅叧闂彁浜� + if (oBill.CancelClose(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 + + #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟 浣滃簾/鍙嶄綔搴� + /// <summary> + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">浣滃簾(0),鍙嶄綔搴�(1)</param> + /// <param name="CurUserName">浣滃簾浜�</param> + /// <returns></returns> + [Route("Sc_ProcessMangement/DeleteQC_NoPassProdConclusionBill")] + [HttpGet] + public object DeleteQC_NoPassProdConclusionBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "QC_NoPassProdConclusionBillMain_Drop"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //妫�鏌ユ潈闄� + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浣滃簾澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + 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); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //浣滃簾鍒ゆ柇 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶄綔搴燂紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶄綔搴熷垽鏂� + { + if (oBill.omodel.HDeleteMan.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.Cancelltion(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) //鍙嶅叧闂彁浜� + { + //鍙嶅叧闂彁浜� + if (oBill.AbandonCancelltion(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 + + #endregion } } \ No newline at end of file -- Gitblit v1.9.1