diff --git a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs index fe11c5a..64d369b 100644 --- a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs +++ b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs @@ -80,16 +80,18 @@ namespace DigitalSchoolApi.Controllers List stuorderlist = null; if (isexcel) { - stuorderlist = conn.Query("select stuno,yearno,orderid from FinaChargeStuOrder where Status=1 and OrderType=2").ToList(); + stuorderlist = conn.Query(@"select StuNo,YearNo,FSYId,'ZFB' as PayMode from FinaChargeStuOrder where Status=1 and OrderType=2 + group by StuNo, YearNo, FSYId, PayMode").ToList(); } else { - stuorderlist = conn.Query("select stuno,yearno,orderid from FinaChargeStuOrder where Status=1 and OrderType=1").ToList(); + stuorderlist = conn.Query(@"select StuNo,YearNo,FSYId,'ZFB' as PayMode from FinaChargeStuOrder where Status=1 and OrderType=1 + group by StuNo, YearNo, FSYId, PayMode").ToList(); } foreach (var stuorderEntity in stuorderlist) { //开票 - Task.Run(() => YKTTrabs.InvoiceEBillMethodTwo(stuorderEntity.orderid)); + YKTTrabs.InvoiceEBillMethodTwo(stuorderEntity); } } } @@ -216,7 +218,7 @@ group by a.FSYear,b.StuNo ) aa left join if (PayFeeStatus==1) { //开票 - Task.Run(() => YKTTrabs.InvoiceEBillMethodTwo(Orderid)); + Task.Run(() => YKTTrabs.InvoiceEBillMethodTwo(item)); } using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { @@ -333,7 +335,7 @@ group by a.FSYear,b.StuNo ) aa left join from (select isnull(sum([FSBlance]),0) as [FSBlance],StuNo from [FinaChargeStuYear] group by StuNo) a left join FinaChargeStudent b on a.stuno=b.stuno where a.stuno='" + item.StuNo + "'"); //开票 - Task.Run(() => YKTTrabs.InvoiceEBillMethodTwo(Orderid)); + Task.Run(() => YKTTrabs.InvoiceEBillMethodTwo(item)); using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { conncore.Execute( diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index ec9d90a..73451f2 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -792,40 +792,35 @@ namespace DigitalSchoolApi.Controllers /// /// 单张票据开具接口 /// - public static void InvoiceEBillMethodTwo(string OrderId) + public static void InvoiceEBillMethodTwo(FinaChargeStuOrderEntity orderEntity) { try { using (IDbConnection conn = new SqlConnection(_sqlConnection)) { - FinaChargeStuOrderEntity orderEntity = conn.QuerySingle("select * from FinaChargeStuOrder where orderid='" + OrderId + "'"); - - if (orderEntity.Status == 1) - { - List stuEnrollFeeOrderDetailList = - conn.Query(@"select a.*, b.InvoiceTypeCode from FinaChargeStuOrderDetail a + List stuEnrollFeeOrderDetailList = + conn.Query(@"select a.*, b.InvoiceTypeCode from FinaChargeStuYearItem a join StuEnrollInvoiceTypeCode b on a.chargeItemcode = b.ProjectCode - where a.FCSOId = '" + orderEntity.Id + "'").ToList(); + where a.FSYId = '" + orderEntity.FSYId + "'").ToList(); - var groupDetail = stuEnrollFeeOrderDetailList.GroupBy(x => x.InvoiceTypeCode); - foreach (IGrouping item in groupDetail) + var groupDetail = stuEnrollFeeOrderDetailList.GroupBy(x => x.InvoiceTypeCode); + foreach (IGrouping item in groupDetail) + { + try { - try + using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { - using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) - { - conncore.Execute( - "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'typecode','开票typecode:" + item.Key + "',getdate())"); - } - InvoiceEBillByTypeTwo(conn, OrderId, orderEntity, item.Key, item); + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'typecode','开票typecode:" + item.Key + "',getdate())"); } - catch (Exception ex) + InvoiceEBillByTypeTwo(conn,orderEntity, item.Key, item); + } + catch (Exception ex) + { + using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { - using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) - { - conncore.Execute( - "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','开票异常:" + ex.Message + "',getdate())"); - } + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','开票异常:" + ex.Message + "',getdate())"); } } } @@ -1035,7 +1030,7 @@ namespace DigitalSchoolApi.Controllers } } - private static void InvoiceEBillByTypeTwo(IDbConnection conn, string OrderId, FinaChargeStuOrderEntity orderEntity, string billCode, IGrouping stuEnrollFeeOrderDetailList) + private static void InvoiceEBillByTypeTwo(IDbConnection conn,FinaChargeStuOrderEntity orderEntity, string billCode, IGrouping stuEnrollFeeOrderDetailList) { Encoding encoding = Encoding.UTF8; string StuName = conn.QuerySingle("select StuName from FinaChargeStudent where stuno='" + orderEntity.StuNo + "'").StuName; @@ -1081,8 +1076,8 @@ namespace DigitalSchoolApi.Controllers itemdetail.itemCode = itemEntity.ChargeItemCode; itemdetail.itemName = itemEntity.ChargeItemName; itemdetail.count = 1; - itemdetail.standard = Convert.ToDouble(itemEntity.YJAmount); - itemdetail.amt = Convert.ToDouble((itemEntity.SJAmount > itemEntity.YJAmount ? itemEntity.YJAmount : itemEntity.SJAmount)); + itemdetail.standard = Convert.ToDouble(itemEntity.Standard); + itemdetail.amt = Convert.ToDouble((itemEntity.SJAmount > itemEntity.Standard ? itemEntity.Standard : itemEntity.SJAmount)); itemdetailList.Add(itemdetail); } biParam.totalAmt = Convert.ToDouble(itemdetailList.Sum(m => m.amt)); @@ -1961,7 +1956,7 @@ namespace DigitalSchoolApi.Controllers { sb.Append($" STU_ROLL_CODE='{item.STU_ROLL_CODE}',"); } - sb.Append(@" CheckMark='" + (item.IS_NORMAL) + "',"); + sb.Append(@" InSchoolStatus='" + (item.IS_NORMAL) + "',"); //去掉最后一个逗号 if (sb.ToString().Contains(",")) { @@ -2106,7 +2101,7 @@ namespace DigitalSchoolApi.Controllers fieleSb.Append("Grade,"); sb.Append($" '{xsxx.ENROLL_GRADE.ToString().Substring(2)}',"); } - sb.Append(@" CheckMark='" + (xsxx.IS_NORMAL) + "',"); + sb.Append(@" InSchoolStatus='" + (xsxx.IS_NORMAL) + "',"); //去掉最后一个逗号 if (fieleSb.ToString().Contains(",") && sb.ToString().Contains(",")) { diff --git a/DigitalSchoolApi/Models/FinaChargeStuYearItemEntity.cs b/DigitalSchoolApi/Models/FinaChargeStuYearItemEntity.cs index 8a8a284..383d7bc 100644 --- a/DigitalSchoolApi/Models/FinaChargeStuYearItemEntity.cs +++ b/DigitalSchoolApi/Models/FinaChargeStuYearItemEntity.cs @@ -90,6 +90,8 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement public string ClassNo { get; set; } [NotMapped] public string DeptNo { get; set; } + [NotMapped] + public string InvoiceTypeCode { get; set; } #endregion } }