Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnrollFeeOrder/StuEnrollFeeOrderEntity.csZobrazit soubor
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.csZobrazit soubor
@@ -11,6 +11,7 @@ using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Learun.Cache.Base;
using Learun.Cache.Factory;
@@ -2208,22 +2209,22 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo
//获取学生数据
if (templateId == "1")//新生
{
stufreshlist = BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>("select StuNo,StuName from StuInfoFresh");
stufreshlist = BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>("select StuNo,StuName,PayFeeStatus from StuInfoFresh");
}
else//老生
{
stuinfobasiclist = BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>("select StuNo,StuName from StuInfoBasic");
//老生缴费初始化记录
stuinfobasicpayfeelist = BaseRepository("CollegeMIS").FindList<StuInfoBasic_PayFeeEntity>("select StuNo,PayYear from StuInfoBasic_PayFee");
stuinfobasicpayfeelist = BaseRepository("CollegeMIS").FindList<StuInfoBasic_PayFeeEntity>("select StuNo,PayYear,PayStatus from StuInfoBasic_PayFee");
}
List<StuEnrollFeeOrderEntity> insertedorderlist = new List<StuEnrollFeeOrderEntity>();
var orderlist = BaseRepository("CollegeMIS").FindList<StuEnrollFeeOrderEntity>("select * from StuEnrollFeeOrder where YearNo='" + dr[0].ToString() + "' and StuNo='" + dr[1].ToString() + "' and Status=999");
//查无订单新建
if (orderlist.Count() == 0)
{
var db = BaseRepository("CollegeMIS");
db.BeginTrans();
StuEnrollFeeOrderEntity orderEntity = new StuEnrollFeeOrderEntity();
var orderdetails = db.FindList<StuEnrollFeeOrderDetailEntity>("select * from StuEnrollFeeOrderDetail where OrderId='" + orderEntity.Id + "' and ChargeItemID='" + dr[4].ToString() + "'");
//判断是否存在缴费明细
if (orderdetails.Count() == 0)
{
//写入订单详情表
StuEnrollFeeOrderDetailEntity orderDetailEntity = new StuEnrollFeeOrderDetailEntity();
//orderEntity.YJAmount =db.FindList<StuEnrollFeeOrderDetailEntity>("select * from StuEnrollFeeOrderDetail where OrderId='"+orderEntity.Id+"'").Sum(m=>m.YJAmount);
//orderEntity.SJAmount = db.FindList<StuEnrollFeeOrderDetailEntity>("select * from StuEnrollFeeOrderDetail where OrderId='" + orderEntity.Id + "'").Sum(m => m.SJAmount);
//db.Update(orderEntity);
//db.Commit();
}
if (insertedorderlist.Count(m => m.orderid == orderEntity.orderid) == 0)
insertedorderlist.Add(orderEntity);
}
}
catch (Exception ex)
{
@@ -2287,11 +2380,61 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo
failDt.Rows.Add(dr.ItemArray);
}
}
//用友回写
foreach (var detail in insertedorderlist)
{
var dbyongyou = BaseRepository("YongyouDb");
dbyongyou.BeginTrans();
//此处订单列表内金额不是实时数据,需要再次查询
var newdetail = BaseRepository("CollegeMIS").FindEntity<StuEnrollFeeOrderEntity>(m => m.orderid == detail.orderid);
//newdetail.Status = 1;
//newdetail.YJAmount = 0;
//newdetail.SJAmount = 0;
//BaseRepository("CollegeMIS").Update(newdetail);
//缴费状态更新
//新老生判断
if (BaseRepository("CollegeMIS").FindList<StuInfoFreshEntity>("select stuno from StuInfoFresh where StuNo='" + newdetail.StuNo + "' and grade='" + newdetail.YearNo.ToString().Substring(2) + "'").Count() > 0)
{
BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoFresh set PayFeeStatus='1' where StuNo='" + newdetail.StuNo + "'");
}
else
{
BaseRepository("CollegeMIS").ExecuteBySql("update StuInfoBasic_PayFee set PayStatus='1' where StuNo='" + newdetail.StuNo + "' and PayYear='" + newdetail.YearNo + "'");
}
string detailstuno = newdetail.StuNo;
DataTable stuinfo = dbyongyou.FindTable("select * from SCS_XSXX where XH='" + detailstuno + "'");
if (stuinfo.Rows.Count==0)
{
//用友库无学生数据
continue;
}
string XSID = stuinfo.Rows[0]["XSID"].ToString();
string XM = stuinfo.Rows[0]["XM"].ToString();
string SFZ = stuinfo.Rows[0]["SFZ"].ToString();
string strSql = "insert into SCS_ORDER(GSDM,KJND,OR_ID,OR_NO,XSID,ZDRDM,ZDRMC,ZDRQ,ZDSJ,ZFZT,CHANNELTYPE,AMOUNT,PAYTYPE,IDCARD,realamount,moneytype,BZ,pstring) " +
BaseRepository().ExecuteBySql("insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),122,'yongyou','用友回写SCS_ORDER完成',getdate())");
//用友明细
List<StuEnrollFeeOrderDetailEntity> orderdetaillist = BaseRepository("CollegeMIS").FindList<StuEnrollFeeOrderDetailEntity>("select * from StuEnrollFeeOrderDetail where OrderId='" + newdetail.Id + "'").ToList();
for (int i = 0; i < orderdetaillist.Count; i++)
{
string sqldetail = "insert into SCS_ORDEL(GSDM,KJND,OR_ID,XH,SFND,SFXMDM,SFXMMC,JE,SFQJNM) " +
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csprojZobrazit soubor