| | |
| | | public class Gy_CarController : ApiController |
| | | { |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus; |
| | | public DAL.ClsGy_Car_Ctl_2 oBill = new DAL.ClsGy_Car_Ctl_2(); |
| | | |
| | | private json objJsonResult = new json(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #region è½¦è¾ å é¤ |
| | | [Route("Gy_CarController/DropGy_Car")] |
| | | [HttpGet] |
| | | public object dropGy_Car(string HItemID, string user) |
| | | { |
| | | try |
| | | { |
| | | string s = ""; |
| | | |
| | | //æ¥çæé |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_Car_Drop", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ å 餿éï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (HItemID == null || HItemID.Equals("")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HItemIDä¸è½ä¸ºç©ºï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (oBill.ShowBill(long.Parse(HItemID), ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¤åæ®æè¯¯ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //夿æ¯å¦å¯ç¼è¾ |
| | | if (oBill.oModel.HCheckEmp != "" && oBill.oModel.HCheckEmp != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¤åæ®å·²ç»è¢«å®¡æ ¸ï¼ä¸å
许å é¤ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //å é¤åæ§å¶========================================= |
| | | string sql1 = "exec h_p_Gy_Car_BeforeDelCtrl " + oBill.oModel.HInterID + ",'" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Gy_Car_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; |
| | | } |
| | | //================================================================================== |
| | | |
| | | //è¿è¡ ä¼è®¡æé´ ç»è´¦ çå¤æåæ§å¶ |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | oCN.RunProc("delete from Gy_Car where HItemID = " + HItemID); |
| | | |
| | | |
| | | //åå
¥æ¥å¿ |
| | | string Operation = "å é¤"; |
| | | string ComputerName = System.Net.Dns.GetHostName(); //设å¤åç§° |
| | | string WorkList = Operation + "åæ®ï¼åæ®å·ï¼" + oBill.oModel.HNumber; |
| | | string MvarReportTitle = oBill.MvarReportTitle; //模å |
| | | string SystemName = "LMES-" + MvarReportTitle + "模å"; |
| | | string IPAddress = ""; |
| | | //string IPAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList[0].ToString(); //IPå°å |
| | | //string IPAddress = System.Web.HttpContext.Current.Request.UserHostAddress; |
| | | |
| | | oCN.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + |
| | | "(getdate(),'" + user + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','" + IPAddress + "','" + Operation + "')" |
| | | ); |
| | | |
| | | |
| | | //å é¤åæ§å¶================================================================================== |
| | | string sql2 = "exec h_p_Gy_Car_AfterDelCtrl " + oBill.oModel.HItemID + ",'" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_Gy_Car_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 = "æ¨å·²å é¤åæ®å·ä¸º" + oBill.oModel.HNumber + "ç车è¾ï¼"; |
| | | 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 车è¾å表-å页 |
| | | [Route("Gy_Car/list_byPage")] |
| | |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | DAL.ClsGy_Car_Ctl_2 oBill = new DAL.ClsGy_Car_Ctl_2(); |
| | | List<Model.ClsGy_Car_Model_2> lsmain = new List<Model.ClsGy_Car_Model_2>(); |
| | | msg1 = msg1.Replace("\\", ""); |
| | | msg1 = msg1.Replace("\n", ""); //\n |