using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; namespace WebAPI.Controllers { //生产任务单Controller //数据库主表Sc_ICMOBillMain //数据库子表Sc_ICMOBillSub public class Sc_ICMOBillController : ApiController { public DBUtility.ClsPub.Enum_BillStatus BillStatus; private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; #region 生产任务单删除功能 [Route("Sc_ICMOBill/DeltetSc_ICMOReportBill")] [HttpGet] public object DeltetSc_ICMOReportBill(string HInterID,string user) { try { //判断是否有删除权限 if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBill_Drop", 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; } oCN.BeginTran();//开始事务 ds = oCN.RunProcReturn("select * from Sc_ICMOBillMain where HInterID=" + HInterID, "Sc_ICMOBillMain"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有数据,无法删除!"; objJsonResult.data = null; return objJsonResult; ; } oCN.RunProc("delete from Sc_ICMOBillMain where HInterID=" + HInterID); 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 } }