1
duhe
2024-03-03 2d1dd7ea14fdf01d08ea52889037681dfb1a19cc
WebAPI/Controllers/SCGL/Sc_ICMOChangeBillController.cs
@@ -488,8 +488,10 @@
                    }
                    //检查源单是否存在
                    string sql = "select * from Sc_ICMOBillSub where HInterID = " + oBill.omodel.HMainSourceInterID + " and HEntryID =" + oBill.omodel.HMainSourceEntryID;
                    ds = oCN.RunProcReturn(sql, "Sc_ICMOBillSub");
                    string sql = "select * from Sc_ICMOBillMain as a " +
                        " inner join Sc_ICMOBillSub as b on a.HInterID = b.HInterID " +
                        " where b.HInterID = " + oBill.omodel.HMainSourceInterID + " and b.HEntryID =" + oBill.omodel.HMainSourceEntryID;
                    ds = oCN.RunProcReturn(sql, "Sc_ICMOBill");
                    if(ds==null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
@@ -498,14 +500,23 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "2")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:源单未处于审核状态!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.BeginTran();
                    //反写源单数据
                    sql = "exec h_p_Sc_ICMOBill_ReWriteByICMOChangeBill " + oBill.omodel.HInterID;
                    oCN.RunProc(sql);
                    //审核提交
                    if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        //反写源单数据
                        oCN.BeginTran();
                        sql = "exec h_p_Sc_ICMOBill_ReWriteByICMOChangeBill " + oBill.omodel.HInterID;
                        oCN.RunProc(sql);
                        oCN.Commit();
                        objJsonResult.code = "1";
@@ -516,6 +527,8 @@
                    }
                    else
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
@@ -547,6 +560,8 @@
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();