public static bool PunchAppdOperation_SaveData(Punch_Confirm_Remedy_Bean model, Dictionary <string, string> oAssDic, string btnName, string FlowStepOpinion, out long seccessCount, out string msg, string flowCode = "", string flowSN = "", string flowSeq = "", string FlowLogBatNo = "", string FlowLogID = "", Dictionary <string, string> toUserData = null) { seccessCount = 0; msg = ""; Punch_Confirm_Remedy_Bean datas = new Punch_Confirm_Remedy_Bean(); try { FlowExpress flow = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID, false); string strFlowLogID = flow.FlowCurrLastLogID; //string strFlowLogID=PunchUpdate.getFlowLogID(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID); //FlowExpress flow = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID); //FlowExpress flow = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), strFlowLogID); DbHelper db = new DbHelper(Aattendant._AattendantDBName); CommandHelper sb = db.CreateCommandHelper(); DbConnection cn = db.OpenConnection(); DbTransaction tx = cn.BeginTransaction(); Punch_Confirm_Remedy_Bean dataBean = new Punch_Confirm_Remedy_Bean() { FlowCaseID = model.FlowCaseID, CompID = model.CompID, EmpID = model.EmpID, EmpName = model.EmpName, DutyDate = model.DutyDate, DutyTime = model.DutyTime, PunchDate = model.PunchDate, PunchTime = model.PunchTime, PunchConfirmSeq = model.PunchConfirmSeq, DeptID = model.DeptID, DeptName = model.DeptName, OrganID = model.OrganID, OrganName = model.OrganName, FlowOrganID = model.FlowOrganID, FlowOrganName = model.FlowOrganName, ConfirmStatus = model.ConfirmStatus, PunchRemedySeq = model.PunchRemedySeq, RemedyReasonID = model.RemedyReasonID, RemedyReasonCN = model.RemedyReasonCN, RemedyPunchTime = model.RemedyPunchTime, AbnormalFlag = model.AbnormalFlag, AbnormalReasonID = model.AbnormalReasonID, AbnormalReasonCN = model.AbnormalReasonCN, AbnormalDesc = model.AbnormalDesc, Remedy_MAFT10_FLAG = model.Remedy_MAFT10_FLAG, Remedy_AbnormalFlag = model.Remedy_AbnormalFlag, Remedy_AbnormalReasonID = model.Remedy_AbnormalReasonID, Remedy_AbnormalReasonCN = model.Remedy_AbnormalReasonCN, Remedy_AbnormalDesc = model.Remedy_AbnormalDesc, LastChgComp = model.LastChgComp, LastChgID = model.LastChgID, LastChgDate = model.LastChgDate, //Remedy RemedyPunchFlag = model.RemedyPunchFlag, BatchFlag = model.BatchFlag, PORemedyStatus = model.PORemedyStatus, RejectReason = model.RejectReason, RejectReasonCN = model.RejectReasonCN, ValidDateTime = model.ValidDateTime, ValidCompID = model.ValidCompID, ValidID = model.ValidID, ValidName = model.ValidName }; try { SqlCommand.PunchAppdOperation_UpdatePunchRemedyLog(dataBean, ref sb); SqlCommand.PunchAppdOperation_UpdatePunchConfirm(dataBean, ref sb); //內部判定結案or駁回 SqlCommand.PunchAppdOperation_UpdateHROtherFlowLog(dataBean.FlowCaseID, dataBean.ConfirmStatus == "4" ? "3" : "2", ref sb); if (dataBean.PORemedyStatus == "2")//沒結案(送簽中) { OBFlowUtility.InsertHROtherFlowLogCommand(dataBean.FlowCaseID, CustVerify.addone(FlowLogBatNo), CustVerify.FlowLogIDadd(FlowLogID), "P", dataBean.EmpID, dataBean.OrganID, dataBean.FlowOrganID, UserInfo.getUserInfo().UserID, flowCode, flowSN, CustVerify.addone(flowSeq), toUserData["SignLine"], toUserData["SignIDComp"], toUserData["SignID"], toUserData["SignOrganID"], toUserData["SignFlowOrganID"], "1", false, ref sb); } else if (dataBean.PORemedyStatus == "3" || dataBean.PORemedyStatus == "4")//結案 { FlowUtility.ChangeFlowFlag(dataBean.FlowCaseID, flowCode, flowSN, UserInfo.getUserInfo().CompID, UserInfo.getUserInfo().UserID, "0", ref sb); } //======(test錯誤的存在)======= //sb.Append("test錯誤的存在"); msg = "注定失敗"; return(false); //======(test錯誤的存在)======= seccessCount = db.ExecuteNonQuery(sb.BuildCommand(), tx); //執行新增,成功筆數回傳,並做Transaction機制 if (seccessCount > 0) { if (FlowExpress.IsFlowVerify(flow.FlowID, flow.FlowCurrLastLogID, btnName, oAssDic, FlowStepOpinion)) { tx.Commit(); //成功Transaction直接Commit } else { tx.Rollback(); //失敗Transaction Rollback msg = "永豐流程寫入失敗"; } } else { tx.Rollback(); //失敗Transaction Rollback msg = "審核失敗,更新0筆資料"; } } catch (Exception ex) { tx.Rollback(); //失敗Transaction Rollback msg = ex.Message; throw ex; } } catch (Exception ex) { //tx.Rollback(); //失敗Transaction Rollback msg = ex.Message; return(false); } return(true); }
protected void Page_Load(object sender, EventArgs e) { FlowExpress oFlow = new FlowExpress(); if (Util.getRequestQueryStringKey("ProxyType", "", true) == "SEMI") { //助理無審核權 labNotAllowVerify.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_AssistantNotAllowVerify); labNotAllowVerify.Visible = true; return; } if (!IsPostBack) { //設定 TabContainer 樣式 labCustForm.Text = WorkRS.Resources.FlowVerifyTab_CustForm; labFlowVerify.Text = WorkRS.Resources.FlowVerifyTab_FlowVerify; btnFlowAttach.ucBtnCaption = WorkRS.Resources.FlowVerifyTab_FlowAttach; labFlowStepInfo.Text = string.Format(" [{0}-{1}] ", oFlow.FlowCurrStepID, oFlow.FlowCurrStepName); btnSaveTempOpinion.Text = WorkRS.Resources.FlowVerifyTab_SaveFlowTempOpinion; //檢查 LogStatus if (oFlow.FlowCurrLogIsClose) { labNotAllowVerify.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowLogClosed); labNotAllowVerify.Visible = true; return; } else { ucLightBox.ucLightBoxMsg = string.Format(RS.Resources.Msg_Waiting1, WorkRS.Resources.FlowVerifyTab_btnBack); btnBack.Text = WorkRS.Resources.FlowVerifyTab_btnBack; btnBack.OnClientClick = ucLightBox.ucShowClientJS + string.Format("location.href='{0}';return false;", _FlowTodoUrl); //回上一頁 2017.02.23 調整 //強制切到[tabCustForm] TabMainContainer.ActiveTabIndex = 0; int intTabAreaHeight = oFlow.FlowVerifyPopupHeight; int intTabAreaWidth = oFlow.FlowVerifyPopupWidth; if (oFlow.FlowVerifyPopupWidth > 0) { TabMainContainer.Width = Unit.Pixel(oFlow.FlowVerifyPopupWidth); } //載入 CustFormUrl 並設定顯示範圍 string strFlowVerifyCustFormURL = string.Format("{0}?FlowID={1}&FlowLogID={2}", Util.getFixURL(oFlow.FlowVerifyCustFormURL), oFlow.FlowID, oFlow.FlowLogID); for (int i = 0; i < oFlow.FlowKeyFieldList.Count(); i++) { if (oFlow.FlowKeyFieldList[i].ToUpper() != "_AUTONO") { strFlowVerifyCustFormURL += string.Format("&{0}={1}", oFlow.FlowKeyFieldList[i], oFlow.FlowKeyValueList[i]); } } CustFormFrame.Attributes["src"] = strFlowVerifyCustFormURL; CustFormFrame.Attributes["width"] = (intTabAreaWidth - 50).ToString(); CustFormFrame.Attributes["height"] = (intTabAreaHeight - 5).ToString(); //流程附件 btnFlowAttach.Visible = false; if (oFlow.FlowCurrStepAttachMaxQty > 0) { btnFlowAttach.Visible = true; //btnFlowAttach.ucBtnCssClass = "Util_clsBtnGray"; btnFlowAttach.ucAttachDB = oFlow.FlowAttachDB; btnFlowAttach.ucAttachID = string.Format(FlowExpress._FlowAttachIDFormat, oFlow.FlowID, oFlow.FlowLogID); btnFlowAttach.ucAttachFileMaxQty = oFlow.FlowCurrStepAttachMaxQty; btnFlowAttach.ucAttachFileMaxKB = oFlow.FlowCurrStepAttachMaxKB; btnFlowAttach.ucAttachFileTotKB = oFlow.FlowCurrStepAttachTotKB; //btnFlowAttach.Refresh(); } //流程記錄(強制 [不顯示案件表頭][不自動展開]) string strFlowLogDisplayURL = string.Format("{0}?FlowID={1}&FlowCaseID={2}&FlowLogID={3}&IsShowCaseHeader=N&IsAutoRefresh=N", FlowExpress._FlowLogDisplayURL, oFlow.FlowID, oFlow.FlowCaseID, oFlow.FlowLogID); FlowLogFrame.Attributes["src"] = strFlowLogDisplayURL; FlowLogFrame.Attributes["width"] = (intTabAreaWidth - 20).ToString(); Util.setJS_SetFrameHeight(FlowLogFrame.ID); //上一關意見 labPrevStepOpinion.Text = WorkRS.Resources.FlowVerifyTab_PrevStepOpinion; gvFlowPrevStepLog.ucDataQryTable = FlowExpress.getSecondLastFlowLogData(oFlow.FlowID, oFlow.FlowCaseID); gvFlowPrevStepLog.ucDataKeyList = "FlowID,FlowLogID".Split(','); Dictionary <string, string> dicDisp = new Dictionary <string, string>(); dicDisp.Add("FlowStepName", WorkRS.Resources.FlowLogMsg_StepName + "@C"); //關卡 dicDisp.Add("AssignToName", WorkRS.Resources.FlowLogMsg_AssignTo + "@C"); //處理者 dicDisp.Add("FlowStepBtnCaption", WorkRS.Resources.FlowLogMsg_VerifyBtn + "@C"); //動作 dicDisp.Add("LogUpdDateTime", WorkRS.Resources.FlowLogMsg_UpdDateTime + "@T"); //時間 dicDisp.Add("FlowStepOpinion", WorkRS.Resources.FlowLogMsg_VerifyOpinion + "@L"); //意見 gvFlowPrevStepLog.ucDataDisplayDefinition = dicDisp; gvFlowPrevStepLog.ucSortEnabled = false; gvFlowPrevStepLog.ucSeqNoEnabled = false; gvFlowPrevStepLog.ucDisplayOnly = true; gvFlowPrevStepLog.Refresh(true); //常用片語 ucCommPhrase.ucTargetClientID = txtFlowOpinion.ClientID + "_txtData"; ucCommPhrase.Refresh(); //流程片語 2017.03.03 ucFlowPhrase.ucIsVisibleWhenNoData = false; ucFlowPhrase.ucSearchBoxWaterMarkText = WorkRS.Resources.FlowPhrase_WaterMarkText; ucFlowPhrase.ucDBName = FlowExpress._FlowSysDB; ucFlowPhrase.ucPKID = oFlow.FlowID; ucFlowPhrase.ucPKKind = "FlowCustProperty"; ucFlowPhrase.ucPropID = "Phrase"; ucFlowPhrase.ucTargetClientID = txtFlowOpinion.ClientID + "_txtData"; ucFlowPhrase.Refresh(); //流程意見 labFlowOpinion.Text = WorkRS.Resources.FlowVerifyTab_FlowOpinion; txtFlowOpinion.ucDispEnteredWordsObjClientID = dispFlowOpinion.ClientID; txtFlowOpinion.ucWidth = Convert.ToInt16(intTabAreaWidth / 2) - 70; txtFlowOpinion.ucRows = (ucFlowPhrase.Visible) ? 12 : 13; //根據是否有 [流程片語] 自動調整 txtFlowOpinion.ucMaxLength = oFlow.FlowOpinionMaxLength; txtFlowOpinion.ucTextData = FlowExpress.getFlowOpenLogVerifyInfo(oFlow).Rows[0]["FlowStepOpinion"].ToString(); txtFlowOpinion.Refresh(); ucCommUserAdminButton.Visible = false; //預設隱藏[常用人員]維護按鈕 2017.04.28 //流程按鈕 DataTable dtBtn = Util.getDataTable(FlowExpress.getFlowOpenLogVerifyInfo(oFlow).Rows[0]["FlowStepBtnInfoJSON"].ToString()); string strBtnSeqNo = ""; for (int i = 0; i < dtBtn.Rows.Count; i++) { strBtnSeqNo = (i + 1).ToString().PadLeft(2, '0'); Button oBtn = (Button)Util.FindControlEx(TabMainContainer, "btnVerify" + strBtnSeqNo); if (oBtn != null) { if (!ucCommUserAdminButton.Visible) { Dictionary <string, string> oAssTo = Util.getDictionary(dtBtn.Rows[i]["FlowStepBtnAssignToList"].ToString()); if (!oAssTo.IsNullOrEmpty() && oAssTo.First().Key == "*" && oAssTo.First().Value.ToUpper() == "ANY") { ucCommUserAdminButton.Visible = true; //流程按鈕有用到[常用人員]才顯示相關維護按鈕 2017.04.28 } } oBtn.Text = dtBtn.Rows[i]["FlowStepBtnCaption"].ToString(); oBtn.CommandName = dtBtn.Rows[i]["FlowStepBtnID"].ToString(); oBtn.CommandArgument = (dtBtn.Rows[i]["FlowStepBtnIsNeedOpinion"].ToString().ToUpper() == "Y") ? "Y" : "N"; //是否需輸入意見 oBtn.Visible = true; } } } } //!IsPostBack //事件訂閱 ucModalPopup1.onClose += ucModalPopup1_onClose; ucCommUserAdminButton.onLaunch += AdminButton_onLaunchClose; ucCommUserAdminButton.onClose += AdminButton_onLaunchClose; ucCommPhraseAdminButton.onLaunch += AdminButton_onLaunchClose; ucCommPhraseAdminButton.onClose += AdminButton_onLaunchClose; }
/// <summary> /// 申請後送簽流程 /// </summary> /// <param name="model">畫面model</param> /// <param name="datas">回傳資料</param> /// <param name="msg">回傳訊息</param> /// <returns>bool</returns> public static bool PunchUpdateModify_SaveData(Punch_Confirm_Remedy_Bean model, out long seccessCount, out string msg) { bool result = false; seccessCount = 0; msg = ""; bool validResult = false; Punch_Confirm_Remedy_Bean datas = new Punch_Confirm_Remedy_Bean(); string validMsg = ""; try { Dictionary <string, string> empData = new Dictionary <string, string>(); Dictionary <string, string> toUserData = new Dictionary <string, string>(); Dictionary <string, string> ValidUserData = new Dictionary <string, string>(); string flowCode = ""; string flowSN = ""; bool nextIsLastFlow = false; string meassge = ""; FlowExpress flow = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/")); string KeyValue = "";//字串 string ShowValue = ""; string strFlowCaseID = ""; DbHelper db = new DbHelper(Aattendant._AattendantDBName); CommandHelper sb = db.CreateCommandHelper(); DbConnection cn = db.OpenConnection(); DbTransaction tx = cn.BeginTransaction(); Punch_Confirm_Remedy_Bean dataBean = new Punch_Confirm_Remedy_Bean() { FlowCaseID = model.FlowCaseID, CompID = model.CompID, EmpID = model.EmpID, EmpName = model.EmpName, DutyDate = model.DutyDate, DutyTime = model.DutyTime, PunchDate = model.PunchDate, PunchTime = model.PunchTime, PunchConfirmSeq = model.PunchConfirmSeq, DeptID = model.DeptID, DeptName = model.DeptName, OrganID = model.OrganID, OrganName = model.OrganName, FlowOrganID = model.FlowOrganID, FlowOrganName = model.FlowOrganName, MAFT10_FLAG = model.MAFT10_FLAG, ConfirmStatus = model.ConfirmStatus, PunchRemedySeq = model.PunchRemedySeq, RemedyReasonID = model.RemedyReasonID, RemedyReasonCN = model.RemedyReasonCN, RemedyPunchTime = model.RemedyPunchTime, AbnormalFlag = model.AbnormalFlag, AbnormalReasonID = model.AbnormalReasonID, AbnormalReasonCN = model.AbnormalReasonCN, AbnormalDesc = model.AbnormalDesc, Remedy_MAFT10_FLAG = model.Remedy_MAFT10_FLAG, Remedy_AbnormalFlag = model.Remedy_AbnormalFlag, Remedy_AbnormalReasonID = model.Remedy_AbnormalReasonID, Remedy_AbnormalReasonCN = model.Remedy_AbnormalReasonCN, Remedy_AbnormalDesc = model.Remedy_AbnormalReasonID == "99" ? model.Remedy_AbnormalDesc : "", LastChgComp = model.LastChgComp, LastChgID = model.LastChgID, LastChgDate = model.LastChgDate, //Remedy RemedyPunchFlag = model.RemedyPunchFlag, BatchFlag = model.BatchFlag, PORemedyStatus = model.PORemedyStatus, RejectReason = model.RejectReason, RejectReasonCN = model.RejectReasonCN, ValidDateTime = model.ValidDateTime, //ValidTime = model.ValidTime, ValidCompID = model.ValidCompID, ValidID = model.ValidID, ValidName = model.ValidName }; OBFlowUtility.QueryFlowDataAndToUserData_First(dataBean.CompID, dataBean.OrganID, dataBean.FlowOrganID, dataBean.EmpID, dataBean.EmpID, dataBean.PunchDate, out empData, out toUserData, out flowCode, out flowSN, out nextIsLastFlow, out meassge, "PO01", "PO"); Punch_Confirm_Remedy_Model validInfo = new Punch_Confirm_Remedy_Model() { CompID = toUserData["SignIDComp"], EmpID = toUserData["SignID"] }; validResult = GetValidInfo(validInfo, out datas, out validMsg); if (!validResult) { throw new Exception(validMsg); } dataBean.ValidCompID = toUserData["SignIDComp"]; dataBean.ValidID = toUserData["SignID"]; dataBean.ValidName = datas.ValidName; KeyValue = dataBean.CompID + "," + dataBean.EmpID + "," + dataBean.PunchDate + "," + dataBean.PunchRemedySeq; ShowValue = dataBean.CompID + "," + dataBean.EmpID + "," + dataBean.PunchDate + "," + dataBean.PunchTime; ValidUserData = CustVerify.getEmpID_Name_Dictionary(toUserData["SignID"], toUserData["SignIDComp"]); if (FlowExpress.IsFlowInsVerify(flow.FlowID, KeyValue.Split(","), ShowValue.Split(","), nextIsLastFlow ? "btnSendLast" : "btnSend", ValidUserData, "")) { strFlowCaseID = FlowExpress.getFlowCaseID(flow.FlowID, KeyValue); dataBean.FlowCaseID = strFlowCaseID; SqlCommand.PunchUpdateModify_InsertPunchRemedyLog(dataBean, ref sb); OBFlowUtility.ChangeFlowFlag(strFlowCaseID, flowCode, flowSN, dataBean.ValidCompID, dataBean.ValidID, "1", ref sb); OBFlowUtility.InsertHROtherFlowLogCommand(strFlowCaseID, "1", strFlowCaseID + "." + "1".PadLeft(5, '0'), "P", dataBean.EmpID, dataBean.OrganID, dataBean.FlowOrganID, dataBean.ValidID, flowCode, flowSN, "1", "1", toUserData["SignIDComp"], toUserData["SignID"], toUserData["SignOrganID"], toUserData["SignFlowOrganID"], "1", false, ref sb); try { //================ //sb.Append("錯誤製造"); //================= seccessCount = db.ExecuteNonQuery(sb.BuildCommand(), tx); //執行新增,成功筆數回傳,並做Transaction機制 tx.Commit(); //成功Transaction直接Commit } catch (Exception) { FlowExpress.IsFlowCaseDeleted(flow.FlowID, strFlowCaseID, true); //送簽用IsFlowCaseDeleted //審核用IsFlowRollBack tx.Rollback(); //失敗Transaction Rollback throw; } result = true; } } catch (Exception ex) { msg = ex.Message; } return(result); }