duhe
2023-11-15 015997e4efd5e5189498c9af00b7805919a676b2
特批申请单:审核时判断源单是否处于创建状态,不是则审核失败
1个文件已修改
59 ■■■■■ 已修改文件
WebAPI/Controllers/XSGL/Xs_ExceptiveCheckRequestBillController.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/XSGL/Xs_ExceptiveCheckRequestBillController.cs
@@ -468,9 +468,66 @@
                //进行需要进行的审核/反审核操作
                if (IsAudit == 0) //审核提交
                {
                    //检验源单是否存在
                    string sql = "";
                    if(oBill.omodel.HMainSourceBillType == "1401")
                    {
                        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;
                        }
                        else if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "1")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!原因:源单-销售订单未处于创建状态!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    else if(oBill.omodel.HMainSourceBillType == "1205")
                    {
                        sql = "select * from Kf_ICStockBillMain as a " +
                        "inner join Kf_ICStockBillSub as b on a.HInterID = b.HInterID " +
                        "where a.HInterID = " + oBill.omodel.HMainSourceInterID;
                        ds = oCN.RunProcReturn(sql, "Kf_ICStockBill");
                        if (ds == null || ds.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!原因:源单-销售出库单不存在!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "1")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!原因:源单-销售出库单未处于创建状态!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:源单不明确!!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.BeginTran();
                    //反写源单单据状态
                    string sql = "exec h_p_Xs_ExceptiveCheckRequestBill_ReWriteSourceStatus " + oBill.omodel.HMainSourceInterID + ",'" + oBill.omodel.HMainSourceBillType + "','" + CurUserName + "'";
                    sql = "exec h_p_Xs_ExceptiveCheckRequestBill_ReWriteSourceStatus " + oBill.omodel.HMainSourceInterID + ",'" + oBill.omodel.HMainSourceBillType + "','" + CurUserName + "'";
                    oCN.RunProc(sql);
                    if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)