liangkun 1 год назад
Родитель
Сommit
3d67494b63
3 измененных файлов: 32 добавлений и 33 удалений
  1. +7
    -5
      DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs
  2. +23
    -28
      DigitalSchoolApi/Controllers/YKTTrabs.cs
  3. +2
    -0
      DigitalSchoolApi/Models/FinaChargeStuYearItemEntity.cs

+ 7
- 5
DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs Просмотреть файл

@@ -80,16 +80,18 @@ namespace DigitalSchoolApi.Controllers
List<FinaChargeStuOrderEntity> stuorderlist = null;
if (isexcel)
{
stuorderlist = conn.Query<FinaChargeStuOrderEntity>("select stuno,yearno,orderid from FinaChargeStuOrder where Status=1 and OrderType=2").ToList();
stuorderlist = conn.Query<FinaChargeStuOrderEntity>(@"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<FinaChargeStuOrderEntity>("select stuno,yearno,orderid from FinaChargeStuOrder where Status=1 and OrderType=1").ToList();
stuorderlist = conn.Query<FinaChargeStuOrderEntity>(@"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(


+ 23
- 28
DigitalSchoolApi/Controllers/YKTTrabs.cs Просмотреть файл

@@ -792,40 +792,35 @@ namespace DigitalSchoolApi.Controllers
/// <summary>
/// 单张票据开具接口
/// </summary>
public static void InvoiceEBillMethodTwo(string OrderId)
public static void InvoiceEBillMethodTwo(FinaChargeStuOrderEntity orderEntity)
{
try
{
using (IDbConnection conn = new SqlConnection(_sqlConnection))
{
FinaChargeStuOrderEntity orderEntity = conn.QuerySingle<FinaChargeStuOrderEntity>("select * from FinaChargeStuOrder where orderid='" + OrderId + "'");

if (orderEntity.Status == 1)
{
List<FinaChargeStuOrderDetailEntity> stuEnrollFeeOrderDetailList =
conn.Query<FinaChargeStuOrderDetailEntity>(@"select a.*, b.InvoiceTypeCode from FinaChargeStuOrderDetail a
List<FinaChargeStuYearItemEntity> stuEnrollFeeOrderDetailList =
conn.Query<FinaChargeStuYearItemEntity>(@"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<string, FinaChargeStuOrderDetailEntity> item in groupDetail)
var groupDetail = stuEnrollFeeOrderDetailList.GroupBy(x => x.InvoiceTypeCode);
foreach (IGrouping<string, FinaChargeStuYearItemEntity> 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<string, FinaChargeStuOrderDetailEntity> stuEnrollFeeOrderDetailList)
private static void InvoiceEBillByTypeTwo(IDbConnection conn,FinaChargeStuOrderEntity orderEntity, string billCode, IGrouping<string, FinaChargeStuYearItemEntity> 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(","))
{


+ 2
- 0
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
}
}


Загрузка…
Отмена
Сохранить