duhe
2023-11-14 05e8bdc13ea69fd4abd2d313cb326d1b8ac9634a
WebAPI/Controllers/XSGL/Xs_SeOrderChangeBillController.cs
@@ -48,12 +48,12 @@
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Xs_SeOrderChangeBillList_Query order by 单据号 ", "h_v_Xs_SeOrderChangeBillList_Query");
                    ds = oCN.RunProcReturn("select * from h_v_Xs_SeOrderChangeBillList_Query order by 单据号 desc", "h_v_Xs_SeOrderChangeBillList_Query");
                }
                else
                {
                    string sql1 = "select * from h_v_Xs_SeOrderChangeBillList_Query where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by 单据号 ";
                    string sql = sql1 + sWhere + " order by 单据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_Xs_SeOrderChangeBillList_Query");
                }
@@ -311,6 +311,8 @@
        {
            try
            {
                string s = "";
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Xs_SeOrderChangeBill_Drop", 1, false, user))
                {
@@ -327,6 +329,24 @@
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "此单据有误!";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                //判断是否可编辑
                if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "此单据已经被审核,不允许删除!";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
@@ -473,10 +493,42 @@
                        return objJsonResult;
                    }
                    //检验源单是否存在
                    string sql = "select * from Xs_SeOrderBillMain as a " +
                        "inner join Xs_SeOrderBillSub as b on a.HInterID = b.HInterID " +
                        "where a.HInterID = " + oBill.omodel.HMainSourceInterID;
                    ds = oCN.RunProcReturn(sql, "Xs_SeOrderBill");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:源单不存在!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.BeginTran();
                    //反写销售订单数据
                    sql = "exec h_p_IF_SeOrderBill_ReWriteBySeOrderChangeBill " + oBill.omodel.HInterID;
                    oCN.RunProcReturn(sql, "h_p_IF_SeOrderBill_ReWriteBySeOrderChangeBill");
                    //信用控制
                    sql = "exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HMainSourceInterID;
                    ds = oCN.RunProcReturn(sql, "h_p_Kf_CheckSeOrderBill_CrediControl");
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核提交
                    if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        oCN.Commit();
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核成功";
@@ -485,6 +537,8 @@
                    }
                    else
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
@@ -516,6 +570,8 @@
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();