| | |
| | | /// <returns></returns> |
| | | [Route("Kf_POStockInBackBill/DeltetKf_POStockInBackBill")] |
| | | [HttpGet] |
| | | public object DeleteKf_POStockInBackBill(string Hmainid, string HsupId, string HQty, string HSourceInterID, string HSourceEntryID, string user) |
| | | public object DeleteKf_POStockInBackBill(string Hmainid, string HsupId,string user) |
| | | { |
| | | DataSet ds; |
| | | DataSet dss; |
| | |
| | | } |
| | | 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 " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Cg_POInStockBillMain"); |
| | | 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.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Kf_POStockInBackBill_BeforeDelCtrl " + Hmainid + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Kf_POStockInBackBill_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; |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | if (ds.Tables[0].Rows.Count == 1) |
| | | { |
| | | oCN.RunProc("delete Kf_ICStockBillSub where HInterID=" + Hmainid); |
| | |
| | | oCN.RunProc($"delete Kf_ICStockBillSub where HInterID={ Hmainid}and HEntryID={HsupId}"); |
| | | } |
| | | oCN.Commit();//提交事务 |
| | | |
| | | |
| | | //删除后控制================================================================================== |
| | | string sql2 = "exec h_p_Kf_POStockInBackBill_AfterDelCtrl " + Hmainid + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_Kf_POStockInBackBill_AfterDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | sReturn = "删除后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + sReturn; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + sReturn; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //============================================================================================== |
| | | |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "数据删除成功!"; |