|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from h_v_Kf_POStockInBackBillList where hmainid=" + HInterID + " and 单据号='" + HBillNo + "'", "h_v_Kf_POStockInBackBillList"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增 | 
|---|
|  |  |  | if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//新增 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //保存前控制========================================= | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec h_p_Kf_POStockInBackBill_BeforeSaveCtrl " + HInterID, "h_p_Kf_POStockInBackBill_BeforeSaveCtrl"); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //保存子表 | 
|---|
|  |  |  | objJsonResult = AddBillSub(msg3, HInterID, OperationType, user); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //采购退料单新增回填退料通知单关联数量 | 
|---|
|  |  |  | oCN.RunProc("exec h_p_Kf_UpDateRelation_POStockInBackToPOInStockBack_Add " + HInterID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (objJsonResult.code == "0") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Kf_POStockInBackBill/DeltetKf_POStockInBackBill")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object DeleteKf_POStockInBackBill(string Hmainid, string HsupId,string user) | 
|---|
|  |  |  | public object DeltetKf_POStockInBackBill(string HInterID, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | DataSet dss; | 
|---|
|  |  |  | //string ModRightNameCheck = "Sc_ProcessReport_check"; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //删除权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBackBill_Delete", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无删除权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (string.IsNullOrWhiteSpace(Hmainid)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "Hmainid为空!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oCN.BeginTran();//开始事务 | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from Kf_ICStockBillMain a inner join Kf_ICStockBillSub b on a.HInterID=b.HInterID where a.HInterID= '" + Hmainid + "'", "Kf_ICStockBillMain"); | 
|---|
|  |  |  | dss = oCN.RunProcReturn("exec h_p_Cg_POInStockBillMain '" + user + " '", "h_p_Cg_POInStockBillMain"); | 
|---|
|  |  |  | var sReturn = ""; | 
|---|
|  |  |  | string HBillNo = ""; | 
|---|
|  |  |  | if (DBUtility.ClsPub.isLong(dss.Tables[0].Rows[0]["HBack"]) != 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | sReturn = DBUtility.ClsPub.isStrNull(dss.Tables[0].Rows[0]["HBackRemark"]).ToString(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = sReturn; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有数据,无法删除!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //删除前控制========================================= | 
|---|
|  |  |  | string sql1 = "exec h_p_Kf_POStockInBackBill_BeforeDelCtrl " + Hmainid + ",'" + HBillNo + "','" + user + "'"; | 
|---|
|  |  |  | string sql1 = "exec h_p_Kf_POStockInBackBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'"; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql1, "h_p_Kf_POStockInBackBill_BeforeDelCtrl"); | 
|---|
|  |  |  | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //================================================================================== | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (ds.Tables[0].Rows.Count == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RunProc("delete Kf_ICStockBillSub where HInterID=" + Hmainid); | 
|---|
|  |  |  | oCN.RunProc("delete Kf_ICStockBillMain where HInterID=" + Hmainid); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RunProc($"delete Kf_ICStockBillSub where HInterID={ Hmainid}and HEntryID={HsupId}"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oCN.Commit();//提交事务 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string sReturn = ""; | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); | 
|---|
|  |  |  | oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //删除后控制================================================================================== | 
|---|
|  |  |  | string sql2 = "exec h_p_Kf_POStockInBackBill_AfterDelCtrl " + Hmainid + ",'" + HBillNo + "','" + user + "'"; | 
|---|
|  |  |  | string sql2 = "exec h_p_Kf_POStockInBackBill_AfterDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'"; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql2, "h_p_Kf_POStockInBackBill_AfterDelCtrl"); | 
|---|
|  |  |  | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //============================================================================================== | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "数据删除成功!"; | 
|---|
|  |  |  | objJsonResult.Message = "删除成功!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "删除失败!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.Message = "Exception!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 根据基础资料ID 查找记录 | 
|---|