| | |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.IO; |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using System.Windows.Forms; |
| | | using WebAPI.Models; |
| | | using WebAPI.Controllers.SCGL.æ¥è®¡å管ç; |
| | | using System.Text.RegularExpressions; |
| | | |
| | | namespace WebAPI.Controllers.项ç®ç®¡ç.å·¥ä½ä»»å¡ |
| | | namespace WebAPI.Controllers.å·¥èµç®¡ç.æ£è¡¥é¡¹ç®è´¹ç¨å |
| | | { |
| | | public class Pay_DuSubsidyItemBillController : ApiController |
| | | { |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus;//åæ®ç¶æï¼æ°å¢ï¼ä¿®æ¹ï¼æµè§ï¼æ´æ°åä»·ï¼åæ´ï¼ |
| | | private json objJsonResult = new json(); |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus; |
| | | public const string ModName = "2233"; //åæ®ç±»å |
| | | public const string ModCaption = "æ£è¡¥é¡¹ç®è´¹ç¨å"; //åæ®åç§° |
| | | public const string ModRightName = "Pay_DuSubsidyItemBill"; |
| | | public const string ModRightNameList = ModRightName + "List"; //å表 |
| | | public const string ModRightNameEdit = ModRightName + "_Edit"; //ç¼è¾ |
| | | public const string ModRightNameCheck = ModRightName + "_Check"; //å®¡æ ¸ |
| | | public const string ModRightNameClose = ModRightName + "_Close"; //å
³é |
| | | public const string ModRightNameDelete = ModRightName + "_Delete"; //ä½åº |
| | | public const string ModRightNameDrop = ModRightName + "_Drop"; //å é¤ |
| | | public const string ModRightNameMoney = ModRightName + "_Money"; //éé¢ |
| | | public const string ModRightNameQty = ModRightName + "_Qty"; //æ°é |
| | | public DataSet ds = new DataSet(); |
| | | public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill(); |
| | | string user_LongShan = ""; |
| | | string HName_LongShan = ""; |
| | | private json objJsonResult = new json(); |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | public DAL.ClsPay_DuSubsidyItemBill oBill = new DAL.ClsPay_DuSubsidyItemBill(); |
| | | public DAL.ClsPay_DuSubsidyItemBill BillOld = new DAL.ClsPay_DuSubsidyItemBill(); |
| | | DAL.ClsGy_Employee_View oEmp = new DAL.ClsGy_Employee_View(); |
| | | DAL.ClsGy_Department_View oDept = new DAL.ClsGy_Department_View(); |
| | | DAL.ClsGy_Group_View oGroup = new DAL.ClsGy_Group_View(); |
| | | DAL.ClsGy_ORGANIZATIONS_View oOrg = new DAL.ClsGy_ORGANIZATIONS_View(); |
| | | DAL.ClsGy_DuSubsidyItem_View oDuSItem = new DAL.ClsGy_DuSubsidyItem_View(); |
| | | |
| | | |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨åå表 |
| | | /// <summary> |
| | | /// è·åæ£è¡¥é¡¹ç®è´¹ç¨ååè¡¨ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("Pay_DuSubsidyItemBillController/GetPay_DuSubsidyItemBillList_Json")] |
| | | [HttpGet] |
| | | public object GetPay_DuSubsidyItemBillList_Json(string sWhere, string HMaker) |
| | | { |
| | | try |
| | | { |
| | | //夿æé |
| | | if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¨æ²¡æè¯¥æ¨¡åæé,请ä¸ç®¡çåèç³»ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //è¿ååè¡¨ä¿¡æ¯ |
| | | ds = oCn.RunProcReturn("select * from h_v_Pay_DuSubsidyItemBillList where 1=1 " + sWhere + " order by hmainid desc", "h_v_Pay_DuSubsidyItemBillList"); |
| | | List<object> columnNameList = new List<object>(); |
| | | //æ·»å åå |
| | | 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 = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æåï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¥è¯¢å表信æ¯å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨åå é¤ |
| | | /// <summary> |
| | | /// å 餿£è¡¥é¡¹ç®è´¹ç¨å |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("Pay_DuSubsidyItemBillController/GetPay_DuSubsidyItemBill_Delete_Json")] |
| | | [HttpGet] |
| | | public object GetPay_DuSubsidyItemBill_Delete_Json(Int64 HInterID, string HMaker) |
| | | { |
| | | try |
| | | { |
| | | //夿æé |
| | | if (!DBUtility.ClsPub.Security_Log(ModRightNameDrop, 3, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¨æ²¡æè¯¥æ¨¡åå é¤åè½æé,请ä¸ç®¡çåèç³»ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //夿å卿§ |
| | | if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | //夿ä¼è®¡ææ¯å¦åç |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //å é¤åæ§å¶ |
| | | DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_DuSubsidyItemBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_DuSubsidyItemBill_BeforeDelCtrl"); |
| | | if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å é¤åå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å é¤å¤±è´¥ï¼" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //å é¤åæ®ï¼å
å«å é¤åæ§å¶ãåå
¥æ¥å¿ï¼ |
| | | if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Pay_DuSubsidyItemBill_AfterDelCtrl", HMaker, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å é¤å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å 餿£è¡¥é¡¹ç®è´¹ç¨åæåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | 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 |
| | | |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨åå®¡æ ¸/åå®¡æ ¸ |
| | | /// <summary> |
| | | /// å®¡æ ¸/åå®¡æ ¸æ£è¡¥é¡¹ç®è´¹ç¨å |
| | | /// </summary> |
| | | /// <param name="HInterID">忮ID</param> |
| | | /// <param name="Type">å®¡æ ¸(1),åå®¡æ ¸(2)</param> |
| | | /// <param name="HMaker">å®¡æ ¸äºº</param> |
| | | /// <returns></returns> |
| | | [Route("Pay_DuSubsidyItemBillController/GetPay_DuSubsidyItemBill_Check_Json")] |
| | | [HttpGet] |
| | | public object GetPay_DuSubsidyItemBill_Check_Json(Int64 HInterID, int Type, string HMaker) |
| | | { |
| | | try |
| | | { |
| | | //夿æé |
| | | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¨æ²¡æè¯¥æ¨¡åå®¡æ ¸/åå®¡æ ¸åè½æé,请ä¸ç®¡çåèç³»ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //夿å卿§ |
| | | if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | //夿ä¼è®¡ææ¯å¦åç |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //Type 1 å®¡æ ¸ 2 åå®¡æ ¸ |
| | | if (Type == 1) |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·²å®¡æ ¸ï¼ä¸è½åæ¬¡å®¡æ ¸ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | 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; |
| | | } |
| | | //å®¡æ ¸åæ§å¶ |
| | | DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_DuSubsidyItemBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_DuSubsidyItemBill_BeforeCheckCtrl"); |
| | | if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸åå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥ï¼" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //å®¡æ ¸åæ® |
| | | if (!oBill.CheckBill(HInterID, oBill.omodel.HBillNo, "h_p_Pay_DuSubsidyItemBill_AfterCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åæ®å·ï¼" + oBill.omodel.HBillNo + " å®¡æ ¸æåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªå®¡æ ¸ï¼ä¸éè¦åå®¡æ ¸ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //åå®¡æ ¸åæ§å¶ |
| | | DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_DuSubsidyItemBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_DuSubsidyItemBill_BeforeUnCheckCtrl"); |
| | | if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åå®¡æ ¸åå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åå®¡æ ¸å¤±è´¥ï¼" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //åå®¡æ ¸åæ® |
| | | if (!oBill.AbandonCheck(HInterID, oBill.omodel.HBillNo, "h_p_Pay_DuSubsidyItemBill_AfterUnCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åå®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åæ®å·ï¼" + oBill.omodel.HBillNo + " åå®¡æ ¸æåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | 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 |
| | | |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨åå
³é/åå
³é |
| | | /// <summary> |
| | | /// å
³é/åå
³éæ£è¡¥é¡¹ç®è´¹ç¨å |
| | | /// </summary> |
| | | /// <param name="HInterID">忮ID</param> |
| | | /// <param name="Type">å
³é(1),åå
³é(2)</param> |
| | | /// <param name="HMaker">å
³é人</param> |
| | | /// <returns></returns> |
| | | [Route("Pay_DuSubsidyItemBillController/GetPay_DuSubsidyItemBill_Close_Json")] |
| | | [HttpGet] |
| | | public object GetPay_DuSubsidyItemBill_Close_Json(Int64 HInterID, int Type, string HMaker) |
| | | { |
| | | try |
| | | { |
| | | //夿æé |
| | | if (!DBUtility.ClsPub.Security_Log(ModRightNameClose, 3, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¨æ²¡æè¯¥æ¨¡åå
³é/åå
³éåè½æé,请ä¸ç®¡çåèç³»ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //夿å卿§ |
| | | if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | //夿ä¼è®¡ææ¯å¦åç |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //Type 1 å
³é 2 åå
³é |
| | | if (Type == 1) |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已å
³éï¼ä¸è½å次å
³éï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //å
³éåæ® |
| | | if (!oBill.CloseBill(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å
³é失败!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åæ®å·ï¼" + oBill.omodel.HBillNo + " å
³éæåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªå
³éï¼ä¸éè¦åå
³éï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //åå
³éåæ® |
| | | if (!oBill.CancelClose(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åå
³é失败!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åæ®å·ï¼" + oBill.omodel.HBillNo + " åå
³éæåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | 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 |
| | | |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨åä½åº/åä½åº |
| | | /// <summary> |
| | | /// ä½åº/åä½åºæ£è¡¥é¡¹ç®è´¹ç¨å |
| | | /// </summary> |
| | | /// <param name="HInterID">忮ID</param> |
| | | /// <param name="Type">ä½åº(1),åä½åº(2)</param> |
| | | /// <param name="HMaker">ä½åºäºº</param> |
| | | /// <returns></returns> |
| | | [Route("Pay_DuSubsidyItemBillController/GetPay_DuSubsidyItemBill_Cancelltion_Json")] |
| | | [HttpGet] |
| | | public object GetPay_DuSubsidyItemBill_Cancelltion_Json(Int64 HInterID, int Type, string HMaker) |
| | | { |
| | | try |
| | | { |
| | | //夿æé |
| | | if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 3, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¨æ²¡æè¯¥æ¨¡åä½åº/åä½åºåè½æé,请ä¸ç®¡çåèç³»ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //夿å卿§ |
| | | if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | //夿ä¼è®¡ææ¯å¦åç |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //Type 1 ä½åº 2 åä½åº |
| | | if (Type == 1) |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已ä½åºï¼ä¸è½å次ä½åºï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //ä½åºåæ® |
| | | if (!oBill.Cancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä½åºå¤±è´¥!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åæ®å·ï¼" + oBill.omodel.HBillNo + " ä½åºæåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªä½åºï¼ä¸éè¦åä½åºï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //åä½åºåæ® |
| | | if (!oBill.AbandonCancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åä½åºå¤±è´¥!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åæ®å·ï¼" + oBill.omodel.HBillNo + " åä½åºæåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | 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 |
| | | |
| | | |
| | | |
| | | |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨å æ°å¢/ç¼è¾ |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨å è¡¨å¤´æ°æ® |
| | |
| | | var _value = sMainSub["sMainSub"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | //å¼å§äºå¡ |
| | | oCN.BeginTran(); |
| | | oCn.BeginTran(); |
| | | //ä¿å主表 |
| | | objJsonResult = AddBillMain_Pay_DuSubsidyItemBill(msg1); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | oCN.RollBack(); |
| | | oCn.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | oCN.Commit(); |
| | | oCn.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æ°å¢åæ®æåï¼"; |
| | |
| | | |
| | | //if (OperationType == 2) |
| | | //{ |
| | | // ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain"); |
| | | // ds = oCn.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain"); |
| | | // if (ds.Tables[0].Rows.Count > 0) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | |
| | | // } |
| | | //} |
| | | |
| | | ds = oCN.RunProcReturn("select * from Pay_DuSubsidyItemBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_DuSubsidyItemBillMain"); |
| | | ds = oCn.RunProcReturn("select * from Pay_DuSubsidyItemBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_DuSubsidyItemBillMain"); |
| | | |
| | | if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//æ°å¢ |
| | | { |
| | |
| | | "')"; |
| | | |
| | | //主表 |
| | | oCN.RunProc(sql); |
| | | oCn.RunProc(sql); |
| | | LogService.Write("ç¨æ·:" + user + ",æ¥æ:" + DateTime.Now + ",æ°å¢æ£è¡¥é¡¹ç®è´¹ç¨å:" + HBillNo); |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "æ°å¢æ£è¡¥é¡¹ç®è´¹ç¨åï¼" + HBillNo + "','LMES-æ£è¡¥é¡¹ç®è´¹ç¨å模å','" + DBUtility.ClsPub.IPAddress + "','æ°å¢åæ®'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "æ°å¢æ£è¡¥é¡¹ç®è´¹ç¨åï¼" + HBillNo + "','LMES-æ£è¡¥é¡¹ç®è´¹ç¨å模å','" + DBUtility.ClsPub.IPAddress + "','æ°å¢åæ®'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) //ç¼è¾ |
| | | { |
| | |
| | | "', HUpdateDate = '" + HUpdaterDate + |
| | | "' where HInterID = " + HInterID; |
| | | |
| | | oCN.RunProc(sql); |
| | | oCn.RunProc(sql); |
| | | |
| | | //å é¤å表 |
| | | oCN.RunProc("delete from Pay_DuSubsidyItemBillSub where HInterID= " + HInterID); |
| | | oCn.RunProc("delete from Pay_DuSubsidyItemBillSub where HInterID= " + HInterID); |
| | | //è®°å½æ¥å¿ |
| | | LogService.Write("ç¨æ·:" + user + ",æ¥æ:" + DateTime.Now + ",ä¿®æ¹æ£è¡¥é¡¹ç®è´¹ç¨å:" + HBillNo); |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "ä¿®æ¹æ£è¡¥é¡¹ç®è´¹ç¨åï¼" + HBillNo + "','LMES-æ£è¡¥é¡¹ç®è´¹ç¨å模å','" + DBUtility.ClsPub.IPAddress + "','ä¿®æ¹åæ®'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "ä¿®æ¹æ£è¡¥é¡¹ç®è´¹ç¨åï¼" + HBillNo + "','LMES-æ£è¡¥é¡¹ç®è´¹ç¨å模å','" + DBUtility.ClsPub.IPAddress + "','ä¿®æ¹åæ®'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | //ä¿åå表 |
| | | objJsonResult = AddBillSub1_Pay_DuSubsidyItemBill(msg3, HInterID, HBillNo, OperationType); |
| | |
| | | ",'" + HRemark + |
| | | "')"; |
| | | |
| | | oCN.RunProc(sql); |
| | | oCn.RunProc(sql); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨å ç¼è¾-页é¢èµå¼ |
| | | /// <summary> |
| | | ///åæ°ï¼string HInterIDã |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("exec h_p_Pay_DuSubsidyItemBill_EditInit " + HInterID, "h_p_Pay_DuSubsidyItemBill_EditInit"); |
| | | ds = oCn.RunProcReturn("exec h_p_Pay_DuSubsidyItemBill_EditInit " + HInterID, "h_p_Pay_DuSubsidyItemBill_EditInit"); |
| | | tableList.Add(ds.Tables[0]); |
| | | tableList.Add(ds.Tables[1]); |
| | | |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨å æ¥è¯¢ |
| | | [Route("Pay_DuSubsidyItemBill/list")] |
| | | [HttpGet] |
| | | public object getDuSubsidyItemBillList(string sWhere, string user) |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨å æ°æ®å¯¼å
¥ |
| | | #region è·å导å
¥æä»¶çæ°æ® |
| | | [Route("Pay_DuSubsidyItemBill/Pay_DuSubsidyItemBillimport")] |
| | | [HttpPost] |
| | | public object Pay_DuSubsidyItemBillimport() |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | var WorkBookName = HttpContext.Current.Request["WorkBookName"]; |
| | | DBUtility.ClsPub.HOrgID = long.Parse(HttpContext.Current.Request["HOrgID"]); |
| | | //è·åæä»¶åç§° |
| | | var file = HttpContext.Current.Request.Files[0]; |
| | | //è·åæä»¶ç©çè·¯å¾ |
| | | string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName); |
| | | //ä¿åæä»¶ |
| | | file.SaveAs(ExcelPath); |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Pay_DuSubsidyItemBillList order by hmainid desc", "h_v_Pay_DuSubsidyItemBillList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Pay_DuSubsidyItemBillList where 1 = 1 "; |
| | | string sql = sql1 + sWhere + " order by hmainid desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Pay_DuSubsidyItemBillList"); |
| | | } |
| | | NpoiHelper np = new NpoiHelper(); |
| | | DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 2, WorkBookName); |
| | | |
| | | //å 餿件 |
| | | File.Delete(ExcelPath); |
| | | |
| | | //å建临æ¶è¡¨ |
| | | DataTable tb2 = new DataTable("dt2"); |
| | | DataTable tb3 = new DataTable("dt3"); |
| | | |
| | | //æ·»å åå |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++) |
| | | { |
| | | tb2.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString()); |
| | | } |
| | | |
| | | //æ·»å æ°æ® |
| | | for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++) |
| | | { |
| | | DataRow row = tb2.NewRow(); |
| | | for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++) |
| | | { |
| | | row[j] = ExcelDs.Tables[0].Rows[i][j].ToString(); |
| | | } |
| | | tb2.Rows.Add(row); |
| | | } |
| | | //è·å导å
¥æä»¶ååéåï¼ç¨äºåç«¯å¨æå |
| | | List<object> columnNameList = new List<object>(); |
| | | //æ·»å åå |
| | | foreach (DataColumn col in tb2.Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//è·åå°DataColumnå对象çåå |
| | | } |
| | | |
| | | var error = ""; |
| | | |
| | | //æ¥è¯¢æ£è¡¥é¡¹ç®è´¹ç¨å没æçå |
| | | if (!tb2.Columns.Contains("æ¥æ")) |
| | | error += "æ²¡ææ¾å°ãæ¥æãçæ é¢,"; |
| | | if (!tb2.Columns.Contains("å¹´")) |
| | | error += "æ²¡ææ¾å°ãå¹´ãçæ é¢,"; |
| | | if (!tb2.Columns.Contains("æ")) |
| | | error += "æ²¡ææ¾å°ãæãçæ é¢,"; |
| | | if (!tb2.Columns.Contains("ç»ç»ä»£ç ")) |
| | | error += "æ²¡ææ¾å°ãç»ç»ä»£ç ãçæ é¢,"; |
| | | if (!tb2.Columns.Contains("ç»ç»")) |
| | | error += "æ²¡ææ¾å°ãç»ç»ãçæ é¢,"; |
| | | if (!tb2.Columns.Contains("é¨é¨ä»£ç ")) |
| | | error += "æ²¡ææ¾å°ãé¨é¨ä»£ç ãçæ é¢,"; |
| | | if (!tb2.Columns.Contains("é¨é¨åç§°")) |
| | | error += "æ²¡ææ¾å°ãé¨é¨åç§°ãçæ é¢,"; |
| | | if (!tb2.Columns.Contains("çç»ä»£ç ")) |
| | | error += "æ²¡ææ¾å°ãçç»ä»£ç ãçæ é¢,"; |
| | | if (!tb2.Columns.Contains("çç»")) |
| | | error += "æ²¡ææ¾å°ãçç»ãçæ é¢,"; |
| | | if (!tb2.Columns.Contains("è¡¨å¤´å¤æ³¨")) |
| | | error += "æ²¡ææ¾å°ãè¡¨å¤´å¤æ³¨ãçæ é¢,"; |
| | | if (!tb2.Columns.Contains("èå代ç ")) |
| | | error += "æ²¡ææ¾å°ãèå代ç ãçæ é¢,"; |
| | | if (!tb2.Columns.Contains("èååç§°")) |
| | | error += "æ²¡ææ¾å°ãèååç§°ãçæ é¢,"; |
| | | ////è·åææçæ£è¡¥é¡¹ç®ï¼å¤å®å¯¼å
¥æä»¶ä¸æªå
å«çæ£è¡¥é¡¹ç® |
| | | //DataSet ds_DuSubsidyItem; |
| | | //ds_DuSubsidyItem = oCn.RunProcReturn("select * from Gy_DuSubsidyItem", "Gy_DuSubsidyItem"); |
| | | //if (ds_DuSubsidyItem.Tables[0] != null) |
| | | //{ |
| | | // for (int i = 0; i < ds_DuSubsidyItem.Tables[0].Rows.Count; i++) |
| | | // { |
| | | // string DuSubsidyItem = ds_DuSubsidyItem.Tables[0].Rows[i]["HName"] == null ? "" : ds_DuSubsidyItem.Tables[0].Rows[i]["HName"].ToString(); |
| | | // if (!tb2.Columns.Contains(DuSubsidyItem)) |
| | | // error += "æ²¡ææ¾å°ã" + DuSubsidyItem + "ãçæ é¢,"; |
| | | // } |
| | | //} |
| | | |
| | | if (error.Length > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"Excel模æ¿åå¨é误,{error}\r\n"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult = (json)Checkdata(tb2); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCn.BeginTran(); |
| | | //å é¤ä¸´æ¶è¡¨æ°æ® |
| | | oCn.RunProc("delete from diyipi_Pay_DuSubsidyItemBill"); |
| | | |
| | | //临æ¶è¡¨æ·»å æ°æ® |
| | | for (int i = 0; i < tb2.Rows.Count; i++) |
| | | { |
| | | if (tb2.Rows[i]["èå代ç "].ToString() != "") |
| | | { |
| | | //æ ¹æ®ä»£ç è·åè¡¨æ°æ® |
| | | oOrg.GetInfoByNumber(tb2.Rows[i]["ç»ç»ä»£ç "].ToString()); |
| | | oDept.GetInfoByNumber(tb2.Rows[i]["é¨é¨ä»£ç "].ToString()); |
| | | oGroup.GetInfoByNumber(tb2.Rows[i]["çç»ä»£ç "].ToString()); |
| | | oEmp.GetInfoByNumber(tb2.Rows[i]["èå代ç "].ToString()); |
| | | |
| | | //è·åå
ç |
| | | Int64 HOrgID = oOrg.omodel.HItemID; |
| | | Int64 HDeptID = oDept.omodel.HItemID; |
| | | Int64 HGroupID = oGroup.omodel.HItemID; |
| | | Int64 HEmpID = oEmp.omodel.HItemID; |
| | | |
| | | for (int j = 12; j < tb2.Columns.Count - 1; j++) |
| | | { |
| | | oDuSItem.GetInfoByName(tb2.Columns[j].ColumnName); |
| | | Int64 HDuSID = oDuSItem.omodel.HItemID; |
| | | string HDuSNumber = oDuSItem.omodel.HNumber; |
| | | string HDuSName = oDuSItem.omodel.HName; |
| | | double HMoney = double.Parse(tb2.Rows[i][tb2.Columns[j].ColumnName].ToString()); |
| | | |
| | | string sql = "insert into diyipi_Pay_DuSubsidyItemBill(HDate,HYear,HPeriod,HOrgID,HOrgNumber,HOrgName,HDeptID,HDeptNumber,HDeptName" + |
| | | ",HGroupID,HGroupNumber,HGroupName,HRemarkMain,HEmpID,HEmpNumber,HEmpName,HDuSubsidyItemID,HDuSubsidyItemNumber,HDuSubsidyItemName,HMoney,HRemarkSub) " + |
| | | "values(" + |
| | | "'" + tb2.Rows[i]["æ¥æ"].ToString() + |
| | | "'," + int.Parse(tb2.Rows[i]["å¹´"].ToString()) + |
| | | "," + int.Parse(tb2.Rows[i]["æ"].ToString()) + |
| | | "," + HOrgID + |
| | | ",'" + tb2.Rows[i]["ç»ç»ä»£ç "].ToString() + |
| | | "','" + tb2.Rows[i]["ç»ç»"].ToString() + |
| | | "'," + HDeptID + |
| | | ",'" + tb2.Rows[i]["é¨é¨ä»£ç "].ToString() + |
| | | "','" + tb2.Rows[i]["é¨é¨åç§°"].ToString() + |
| | | "'," + HGroupID + |
| | | ",'" + tb2.Rows[i]["çç»ä»£ç "].ToString() + |
| | | "','" + tb2.Rows[i]["çç»"].ToString() + |
| | | "','" + tb2.Rows[i]["è¡¨å¤´å¤æ³¨"].ToString() + |
| | | "'," + HEmpID + |
| | | ",'" + tb2.Rows[i]["èå代ç "].ToString() + |
| | | "','" + tb2.Rows[i]["èååç§°"].ToString() + |
| | | "'," + HDuSID + |
| | | ",'" + HDuSNumber + |
| | | "','" + HDuSName + |
| | | "'," + HMoney + |
| | | ",'" + tb2.Rows[i]["表ä½å¤æ³¨"] + |
| | | "')"; |
| | | oCn.RunProc(sql); |
| | | } |
| | | } |
| | | |
| | | } |
| | | oCn.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.Message = error; |
| | | objJsonResult.data = tb2; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨å å é¤ |
| | | /// <summary> |
| | | ///åæ°ï¼string HInterIDã |
| | | ///è¿åå¼ï¼objectã |
| | | /// </summary> |
| | | [Route("Pay_DuSubsidyItemBill/delete")] |
| | | |
| | | #region æ£æ¥å¯¼å
¥æä»¶çæ°æ® |
| | | private object Checkdata(DataTable dt) |
| | | { |
| | | bool b = false; |
| | | string sErrMsg = ""; |
| | | string sMsg = ""; |
| | | for (int i = 0; i <= dt.Rows.Count - 1; i++) |
| | | { |
| | | string HDeptNumber = ""; |
| | | string HGroupNumber = ""; |
| | | string HEmpNumber = ""; |
| | | double HMoney = 0; |
| | | |
| | | HDeptNumber = DBUtility.ClsPub.isStrNull(dt.Rows[i]["é¨é¨ä»£ç "].ToString()); |
| | | HGroupNumber = DBUtility.ClsPub.isStrNull(dt.Rows[i]["çç»ä»£ç "].ToString()); |
| | | HEmpNumber = DBUtility.ClsPub.isStrNull(dt.Rows[i]["èå代ç "].ToString()); |
| | | if (HEmpNumber != "") |
| | | { |
| | | int index = i + 1; //è®°å½å½åæ£éªæ°æ®ä½äºå¯¼å
¥æä»¶ç第å è¡ |
| | | |
| | | //å®¡æ ¸ä»£ç æ¯å¦åç |
| | | if (!DBUtility.ClsPub.AllowNumber(HDeptNumber)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "é¨é¨ä»£ç ä¸ä¸è½åºç°è¿ç»â.âå¹¶ä¸é¦ä½æ«ä½ä¸è½ä¸ºâ.âï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (!DBUtility.ClsPub.AllowNumber(HGroupNumber)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "çç»ä»£ç ä¸ä¸è½åºç°è¿ç»â.âå¹¶ä¸é¦ä½æ«ä½ä¸è½ä¸ºâ.âï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (!DBUtility.ClsPub.AllowNumber(HEmpNumber)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "èå代ç ä¸ä¸è½åºç°è¿ç»â.âå¹¶ä¸é¦ä½æ«ä½ä¸è½ä¸ºâ.âï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //å¾å°é¨é¨å
ç |
| | | if (!oDept.GetInfoByNumber(HDeptNumber)) |
| | | { |
| | | sMsg = "[" + HDeptNumber + "]é¨é¨ä¸åå¨"; |
| | | if (sErrMsg.Contains(sMsg) == false) |
| | | { |
| | | sErrMsg = sErrMsg + "[" + HDeptNumber + "]é¨é¨ä¸åå¨\r\n"; |
| | | } |
| | | b = true; |
| | | } |
| | | //å¾å°çç»å
ç |
| | | if (!oGroup.GetInfoByNumber(HGroupNumber)) |
| | | { |
| | | sMsg = "[" + HGroupNumber + "]çç»ä¸åå¨"; |
| | | if (sErrMsg.Contains(sMsg) == false) |
| | | { |
| | | sErrMsg = sErrMsg + "[" + HGroupNumber + "]çç»ä¸åå¨\r\n"; |
| | | } |
| | | b = true; |
| | | } |
| | | |
| | | //å¾å°èåå
ç |
| | | if (!oEmp.GetInfoByNumber(HEmpNumber)) |
| | | { |
| | | sMsg = "[" + HEmpNumber + "]èåä¸åå¨"; |
| | | if (sErrMsg.Contains(sMsg) == false) |
| | | { |
| | | sErrMsg = sErrMsg + "[" + HEmpNumber + "]èåä¸åå¨\r\n"; |
| | | } |
| | | b = true; |
| | | } |
| | | //æ£éªå¯¼å
¥æä»¶ä¸çæ£è¡¥é¡¹ç®æ¯å¦åå¨ã弿¯å¦åæ³ |
| | | for(int j=12; j < dt.Columns.Count-1; j++) |
| | | { |
| | | //æ£éªå¯¼å
¥æä»¶ä¸çæ£è¡¥é¡¹ç®æ¯å¦åå¨ |
| | | if (!oDuSItem.GetInfoByName(dt.Columns[j].ColumnName)) |
| | | { |
| | | sMsg = "[" + dt.Columns[j].ColumnName + "]æ£è¡¥é¡¹ç®ä¸åå¨"; |
| | | if (sErrMsg.Contains(sMsg) == false) |
| | | { |
| | | sErrMsg = sErrMsg + "[" + dt.Columns[j].ColumnName + "]æ£è¡¥é¡¹ç®ä¸åå¨\r\n"; |
| | | } |
| | | b = true; |
| | | } |
| | | //æ£éªå¯¼å
¥æä»¶ä¸çæ£è¡¥é¡¹ç®å¼æ¯å¦åæ³ |
| | | if ( !Regex.IsMatch( dt.Rows[i][dt.Columns[j].ColumnName].ToString(), @"^\d+(\.\d+)?$")) |
| | | { |
| | | sMsg = "[" + dt.Columns[j].ColumnName + "]æ°æ®æ ¼å¼é误ï¼è¯·è¾å
¥éè´æ°"; |
| | | if (sErrMsg.Contains(sMsg) == false) |
| | | { |
| | | sErrMsg = sErrMsg + "[" + dt.Columns[j].ColumnName + "]æ°æ®æ ¼å¼é误ï¼è¯·è¾å
¥éè´æ°\r\n"; |
| | | } |
| | | b = true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (b == true) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = sErrMsg; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = sErrMsg; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨å ä¿å导å
¥æ°æ® |
| | | [Route("Pay_DuSubsidyItemBill/Pay_DuSubsidyItemBillSaveImport")] |
| | | [HttpGet] |
| | | public object deleteDuSubsidyItemBill(string HInterID, string user) |
| | | public object Pay_DuSubsidyItemBillSaveImport(string user) |
| | | { |
| | | try |
| | | { |
| | | //æ¥çæé |
| | | if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_Delete", 1, false, user)) |
| | | if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ å 餿éï¼"; |
| | | objJsonResult.Message = "æ æ°å¢æéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (HInterID == null || HInterID.Equals("")) |
| | | //è·å临æ¶è¡¨æ°æ® |
| | | ds = oCn.RunProcReturn("select * from diyipi_Pay_DuSubsidyItemBill order by HDate desc,HYear desc,HPeriod desc,HOrgID desc,HDeptID desc,HGroupID desc,HRemarkMain desc,HEmpID desc", "diyipi_Pay_DuSubsidyItemBill"); |
| | | if (ds==null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterIDä¸è½ä¸ºç©ºï¼"; |
| | | objJsonResult.Message = "ä¿åå¤±è´¥ï¼æ°æ®æªå¯¼å
¥æåï¼è¯·éæ°å¯¼å
¥æ°æ®ï¼ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //ä¿åæ°æ® |
| | | oCn.BeginTran(); |
| | | DataTable dt = ds.Tables[0]; |
| | | Pay_DuSubsidyItemBillMain mainTable = new Pay_DuSubsidyItemBillMain(); |
| | | List<Pay_DuSubsidyItemBillSub> subTable = new List<Pay_DuSubsidyItemBillSub>(); |
| | | int HOrgID = 0; |
| | | int HYear = 0; |
| | | int HPeriod = 0; |
| | | string compareText = ""; |
| | | |
| | | oCN.BeginTran(); |
| | | for (int i = 0; i < dt.Rows.Count; i++) |
| | | { |
| | | string compareText1 = dt.Rows[i]["HDate"].ToString() + |
| | | "" + dt.Rows[i]["HYear"].ToString() + |
| | | "" + dt.Rows[i]["HPeriod"].ToString() + |
| | | "" + dt.Rows[i]["HOrgID"].ToString() + |
| | | "" + dt.Rows[i]["HDeptID"].ToString() + |
| | | "" + dt.Rows[i]["HGroupID"].ToString() + |
| | | "" + dt.Rows[i]["HRemarkMain"].ToString() + |
| | | "" + dt.Rows[i]["HEmpID"].ToString(); |
| | | if(compareText != compareText1) |
| | | { |
| | | if (subTable.Count>0) |
| | | { |
| | | objJsonResult = SaveImport_AddBillMain(mainTable, subTable, HOrgID, HYear, HPeriod, user); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | mainTable = new Pay_DuSubsidyItemBillMain(); |
| | | subTable.Clear(); |
| | | } |
| | | compareText = compareText1; |
| | | mainTable.HDate = dt.Rows[i]["HDate"].ToString(); |
| | | mainTable.HDeptID = int.Parse(dt.Rows[i]["HDeptID"].ToString()); |
| | | mainTable.HGroupID = int.Parse(dt.Rows[i]["HGroupID"].ToString()); |
| | | mainTable.HRemark = dt.Rows[i]["HRemarkMain"].ToString(); |
| | | mainTable.HMaker = user; |
| | | mainTable.HMakerDate = DateTime.Now.ToString("yyyy-MM-dd"); |
| | | HOrgID = int.Parse(dt.Rows[i]["HOrgID"].ToString()); |
| | | HYear = int.Parse(dt.Rows[i]["HYear"].ToString()); |
| | | HPeriod = int.Parse(dt.Rows[i]["HPeriod"].ToString()); |
| | | } |
| | | |
| | | oCN.RunProc("delete from Pay_DuSubsidyItemBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("delete from Pay_DuSubsidyItemBillSub where HInterID= " + HInterID); |
| | | Pay_DuSubsidyItemBillSub oSub = new Pay_DuSubsidyItemBillSub(); |
| | | oSub.HEmpID = int.Parse(dt.Rows[i]["HEmpID"].ToString()); |
| | | oSub.HDuSubsidyItemID = int.Parse(dt.Rows[i]["HDuSubsidyItemID"].ToString()); |
| | | oSub.HQty = 0; |
| | | oSub.HPrice = 0; |
| | | oSub.HMoney = double.Parse(dt.Rows[i]["HMoney"].ToString()); |
| | | oSub.HRemark = dt.Rows[i]["HRemarkSub"].ToString(); |
| | | subTable.Add(oSub); |
| | | } |
| | | |
| | | oCN.Commit(); |
| | | //æ·»å æå䏿¬¡è®°å½ |
| | | if (subTable.Count > 0) |
| | | { |
| | | objJsonResult = SaveImport_AddBillMain(mainTable, subTable, HOrgID, HYear, HPeriod, user); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | mainTable = new Pay_DuSubsidyItemBillMain(); |
| | | subTable.Clear(); |
| | | } |
| | | |
| | | |
| | | oCn.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨å å®¡æ ¸/åå®¡æ ¸ |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="HInterID">忮ID</param> |
| | | /// <param name="IsAudit">å®¡æ ¸(0),åå®¡æ ¸(1)</param> |
| | | /// <param name="CurUserName">å®¡æ ¸äºº</param> |
| | | /// <returns></returns> |
| | | [Route("Pay_DuSubsidyItemBill/AuditPay_DuSubsidyItemBill")] |
| | | [HttpGet] |
| | | public object AuditPay_DuSubsidyItemBill(string HInterID, int Type, string user) |
| | | #region æ·»å æ£è¡¥é¡¹ç®è´¹ç¨å 主表 |
| | | public json SaveImport_AddBillMain(Pay_DuSubsidyItemBillMain mainTable, List<Pay_DuSubsidyItemBillSub> subTable, int HOrgID, int Year, int Period, string user) |
| | | { |
| | | string HComputerName = SystemInformation.ComputerName; //设å¤åç§° |
| | | |
| | | try |
| | | { |
| | | //夿æ¯å¦æå®¡æ ¸æé |
| | | if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_Check", 1, false, user)) |
| | | List<Pay_DuSubsidyItemBillMain> mainList = new List<Pay_DuSubsidyItemBillMain>(); |
| | | mainList.Add(mainTable); |
| | | |
| | | |
| | | int HYear = Year; |
| | | int HPeriod = Period; |
| | | string HBillType = "2233"; |
| | | string HBillSubType = ""; |
| | | int HBillStatus = 1; |
| | | |
| | | int HAutoSaveFlag = 0; |
| | | |
| | | |
| | | Int64 HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string HBillNo = DBUtility.ClsPub.CreateBillCode(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | | string HDate = mainList[0].HDate; |
| | | string HInnerBillNo = ""; |
| | | int HGroupID = mainList[0].HGroupID; |
| | | int HDeptID = mainList[0].HDeptID; |
| | | string HExplanation = ""; |
| | | string HRemark = mainList[0].HRemark; |
| | | |
| | | |
| | | string HMaker = mainList[0].HMaker; |
| | | string HMakerDate = mainList[0].HMakerDate; |
| | | |
| | | ds = oCn.RunProcReturn("select * from Pay_DuSubsidyItemBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_DuSubsidyItemBillMain"); |
| | | |
| | | //ä¸»è¡¨æ·»å æ°æ® |
| | | string sql = "insert into Pay_DuSubsidyItemBillMain" + |
| | | "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HGroupID,HDeptID,HExplanation,HAutoSaveFlag,HRemark,HMaker,HMakeDate) " + |
| | | "values(" + |
| | | "" + HYear + |
| | | "," + HPeriod + |
| | | ",'" + HBillType + |
| | | "','" + HBillSubType + |
| | | "'," + HBillStatus + |
| | | "," + HInterID + |
| | | ",'" + HBillNo + |
| | | "','" + HDate + |
| | | "','" + HInnerBillNo + |
| | | "'," + HGroupID + |
| | | "," + HDeptID + |
| | | ",'" + HExplanation + |
| | | "'," + HAutoSaveFlag + |
| | | ",'" + HRemark + |
| | | "','" + HMaker + |
| | | "','" + HMakerDate + |
| | | "')"; |
| | | |
| | | //主表 |
| | | oCn.RunProc(sql); |
| | | LogService.Write("ç¨æ·:" + user + ",æ¥æ:" + DateTime.Now + ",æ°å¢æ£è¡¥é¡¹ç®è´¹ç¨å:" + HBillNo); |
| | | oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "æ°å¢æ£è¡¥é¡¹ç®è´¹ç¨åï¼" + HBillNo + "','LMES-æ£è¡¥é¡¹ç®è´¹ç¨å模å','" + DBUtility.ClsPub.IPAddress + "','æ°å¢åæ®'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | |
| | | //ä¿åå表 |
| | | objJsonResult = SaveImport_AddBillSub(subTable, HInterID,HBillNo); |
| | | |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æéå®¡æ ¸!"; |
| | | objJsonResult.Message = 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 = "Pay_DuSubsidyItemBillMain"; |
| | | 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]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·²å®¡æ ¸!ä¸éè¦åå®¡æ ¸!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //å®¡æ ¸åæ® |
| | | if (!BillOld.CheckBill(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]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已åå®¡æ ¸!ä¸éè¦ååå®¡æ ¸!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //åå®¡æ ¸åæ® |
| | | if (!BillOld.AbandonCheck(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.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æ§è¡æåï¼"; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ§è¡å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨å å
³é/åå
³éåè½ |
| | | [Route("Pay_DuSubsidyItemBill/ClosePay_DuSubsidyItemBill")] |
| | | [HttpGet] |
| | | public object ClosePay_DuSubsidyItemBill(string HInterID, int Type, string user) |
| | | #region æ·»å æ£è¡¥é¡¹ç®è´¹ç¨å å表 |
| | | public json SaveImport_AddBillSub(List<Pay_DuSubsidyItemBillSub> DetailColl, Int64 HInterID, string HBillNo) |
| | | { |
| | | try |
| | | int i = 0; //ä½ä¸ºå表å
ç |
| | | foreach (Pay_DuSubsidyItemBillSub oSub in DetailColl) |
| | | { |
| | | //夿æ¯å¦æå 餿é |
| | | if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_Close", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æéå
³é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | i++; //åä¸ä¸ªä¸»è¡¨ä¸çå表çå
ç èªå¢ |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | int HEntryID = i; |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Pay_DuSubsidyItemBillMain"; |
| | | oCN.BeginTran();//å¼å§äºå¡ |
| | | int HEmpID = oSub.HEmpID; |
| | | int HDuSubsidyItemID = oSub.HDuSubsidyItemID; |
| | | double HQty = oSub.HQty; |
| | | double HPrice = oSub.HPrice; |
| | | double HMoney = oSub.HMoney; |
| | | string HRemark = oSub.HRemark; |
| | | |
| | | //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; |
| | | } |
| | | } |
| | | string sql = "insert into Pay_DuSubsidyItemBillSub" + |
| | | "(HInterID,HEntryID,HEmpID,HDuSubsidyItemID,HQty,HPrice,HMoney,HRemark) " + |
| | | "values(" + |
| | | "" + HInterID + |
| | | "," + HEntryID + |
| | | "," + HEmpID + |
| | | "," + HDuSubsidyItemID + |
| | | "," + HQty + |
| | | "," + HPrice + |
| | | "," + HMoney + |
| | | ",'" + HRemark + |
| | | "')"; |
| | | |
| | | oCN.Commit();//æäº¤äºå¡ |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æ§è¡æåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | oCn.RunProc(sql); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ§è¡å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨å ä½åº/åä½åºåè½ |
| | | [Route("Pay_DuSubsidyItemBill/DropPay_DuSubsidyItemBill")] |
| | | #endregion |
| | | |
| | | #region æ£è¡¥é¡¹ç®è´¹ç¨å_è´¹ç¨æ¨ªåæ¾ç¤º è·åæ£è¡¥é¡¹ç® |
| | | [Route("Pay_DuSubsidyItemBill_KS/getInitGrid_KS")] |
| | | [HttpGet] |
| | | public object DropPay_DuSubsidyItemBill(string HInterID, int Type, string user) |
| | | public object getInitGrid_KS() |
| | | { |
| | | try |
| | | { |
| | | //夿æ¯å¦æä½åºæé |
| | | if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_Drop", 1, false, user)) |
| | | //è·åæªç¦ç¨çæ£è¡¥é¡¹ç® |
| | | string sql = "select * from Gy_DuSubsidyItem where HStopFlag = 0"; |
| | | ds = oCn.RunProcReturn(sql, "Gy_DuSubsidyItem"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æéä½åº!"; |
| | | objJsonResult.Message = "æªæ¾å°ç¸å
³æ£è¡¥é¡¹ç®ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | //å¤çæ£è¡¥é¡¹ç® |
| | | List<object> columnNameList = new List<object>(); |
| | | for(int i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | string field = ds.Tables[0].Rows[i]["HItemID"].ToString(); |
| | | string title = ds.Tables[0].Rows[i]["HName"].ToString(); |
| | | string dataType = "decimal(18,2)"; |
| | | string ColmString = "{\"field\":\"" + field + "\",\"title\":\"" + title + "\",\"dataType\":\"" + dataType + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString)); |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Pay_DuSubsidyItemBillMain"; |
| | | 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]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已ä½åº!ä¸éè¦åä½åº!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //ä½åºåæ® |
| | | if (!BillOld.Cancelltion(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]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已åä½åº!ä¸éè¦ååä½åº!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //åä½åºåæ® |
| | | if (!BillOld.AbandonCancelltion(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.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æ§è¡æåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ§è¡å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |