| | |
| | | DAL.ClsGy_Shifts_Ctl oBill = new DAL.ClsGy_Shifts_Ctl(); |
| | | DAL.ClsGy_Shifts_View oBillHlp = new DAL.ClsGy_Shifts_View(); |
| | | |
| | | public DAL.ClsGy_WorkShift_Ctl BillOld1 = new DAL.ClsGy_WorkShift_Ctl(); //对åºåæ®ç±» çæ¬¡è¡¨2 |
| | | public DAL.ClsGy_WorkShift_Ctl BillNew1 = new DAL.ClsGy_WorkShift_Ctl(); //对åºåæ®ç±» çæ¬¡è¡¨2 |
| | | |
| | | #region çæ¬¡å表 |
| | | /// <summary> |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region çæ¬¡è¡¨2 |
| | | |
| | | #region çæ¬¡è¡¨2 æ°å¢/ç¼è¾ |
| | | [Route("Gy_ShiftsController/SaveGy_WorkShift")] |
| | | [HttpPost] |
| | | public object SaveGy_WorkShift([FromBody] JObject oMain) |
| | | { |
| | | var _value = oMain["oMain"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); //å表 |
| | | string refSav = sArray[2].ToString();//æä½æ¹å¼æ°æ®ç±»å 1æ·»å 3ä¿®æ¹ 2 å¤å¶ |
| | | string msg4 = sArray[3].ToString();//ç¨æ·å |
| | | |
| | | DBUtility.ClsPub.CurUserName = msg4; |
| | | |
| | | string s = ""; |
| | | try |
| | | { |
| | | //ç¼è¾æé |
| | | if (!DBUtility.ClsPub.Security_Log_second("Gy_WorkShift_Edit", 1, false, msg4)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ ä¿åæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | // Gy_WorkShift |
| | | DAL.ClsGy_WorkShift_Ctl oBill = new DAL.ClsGy_WorkShift_Ctl(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | msg2 = "[" + msg2.ToString() + "]"; |
| | | List<Model.ClsGy_WorkShiftMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_WorkShiftMain>>(msg2); |
| | | foreach (Model.ClsGy_WorkShiftMain oItem in lsmain) |
| | | { |
| | | if (refSav == "Update") |
| | | { |
| | | if (BillOld1.ShowBill(oItem.HInterID, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¤åæ®æè¯¯ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | // è¡¨ä½æ°æ® |
| | | //æ },{æ¥æåæ°ç» //廿ãåã |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | msg3 = "[" + msg3.ToString() + "]"; |
| | | List<Model.ClsGy_WorkShiftSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_WorkShiftSub>>(msg3); |
| | | int i = 0; |
| | | foreach (Model.ClsGy_WorkShiftSub oItemSub in ls) |
| | | { |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | //ä¿å |
| | | //ä¿å宿¯åå¤ç |
| | | 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 çæ¬¡è¡¨2 ç¼è¾åæ¾å表 |
| | | |
| | | [Route("Gy_ShiftsController/Edit_Gy_WorkShift")] |
| | | [HttpGet] |
| | | public object Edit_Gy_WorkShift(string HID) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | string sql = "select * from h_v_Gy_WorkShiftEdit where HInterID='" + HID + "'"; |
| | | ds = oCn.RunProcReturn(sql, "h_v_Gy_WorkShiftEdit"); |
| | | |
| | | //æ·»å åå |
| | | 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));//è·åå°DataColumnå对象çåå |
| | | } |
| | | |
| | | 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 çæ¬¡è¡¨2å表 |
| | | |
| | | [Route("Gy_ShiftsController/Get_Gy_WorkShiftList")] |
| | | [HttpGet] |
| | | public object Get_Gy_WorkShiftList(string sWhere, string HMaker) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | //æ¥çæé |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_WorkShift_Query", 1, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | string sql = "select * from h_v_Gy_WorkShiftList order by HInterID desc"; |
| | | ds = oCn.RunProcReturn(sql, "h_v_Gy_WorkShiftList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Gy_WorkShiftList where 1 = 1 "; |
| | | string sql = sql1 + sWhere + " order by HInterID desc"; |
| | | ds = oCn.RunProcReturn(sql, "h_v_Gy_WorkShiftList"); |
| | | } |
| | | |
| | | //æ·»å åå |
| | | 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));//è·åå°DataColumnå对象çåå |
| | | } |
| | | |
| | | 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 çæ¬¡è¡¨2 å é¤ |
| | | |
| | | [Route("Gy_ShiftsController/DeleteGy_WorkShift")] |
| | | [HttpGet] |
| | | public object DeleteGy_WorkShift(string HInterID, string user) |
| | | { |
| | | try |
| | | { |
| | | string s = ""; |
| | | DAL.ClsGy_WorkShift_Ctl BillOld = new DAL.ClsGy_WorkShift_Ctl(); |
| | | //æ¥çæé |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_WorkShift_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; |
| | | } |
| | | |
| | | |
| | | |
| | | oCn.BeginTran(); |
| | | |
| | | oCn.RunProc("delete from Gy_WorkShift where HInterID = " + HInterID); |
| | | oCn.RunProc("delete from Gy_WorkShiftSub where HInterID= " + HInterID); |
| | | |
| | | |
| | | oCn.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å 餿å"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCn.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region æ¾ç¤ºçæ¬¡ä¿¡æ¯ |
| | | /// <summary> |
| | | /// æ ¹æ®åºç¡èµæID æ¥æ¾è®°å½ |
| | | /// </summary> |
| | | [Route("Gy_ShiftsController/Get_HWorkShift")] |
| | | [HttpGet] |
| | | public object Get_HWorkShift(int HDeptID,int HCenterID) |
| | | { |
| | | try |
| | | { |
| | | ds = oCn.RunProcReturn("exec h_p_Gy_GetWorkShiftInfo '"+HDeptID+"','"+HCenterID+"'", "h_p_Gy_GetWorkShiftInfo"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æªæ¥è¯¢å°å½åçæ¬¡ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æåï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "è¿åçæ¬¡ä¿¡æ¯å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | } |