Pārlūkot izejas kodu

excel导入用友回写去掉事物,因为服务器上老报错。

西昌缴费二期
liangkun pirms 2 gadiem
vecāks
revīzija
6aed749435
1 mainītis faili ar 41 papildinājumiem un 17 dzēšanām
  1. +41
    -17
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs

+ 41
- 17
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshService.cs Parādīt failu

@@ -2295,7 +2295,7 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo
}
//数据筛查完毕,执行导入
//order主表记录查询
var orderlist = BaseRepository("CollegeMIS").FindList<StuEnrollFeeOrderEntity>("select * from StuEnrollFeeOrder where YearNo='" +(templateId=="1"? "20"+stufreshlist.FirstOrDefault(m=>m.StuNo== dr[1].ToString()).Grade: dr[0].ToString()) + "' and StuNo='" + dr[1].ToString() + "' and Status=999");
var orderlist = BaseRepository("CollegeMIS").FindList<StuEnrollFeeOrderEntity>("select * from StuEnrollFeeOrder where YearNo='" + (templateId == "1" ? "20" + stufreshlist.FirstOrDefault(m => m.StuNo == dr[1].ToString()).Grade : dr[0].ToString()) + "' and StuNo='" + dr[1].ToString() + "' and Status=999");
//查无订单新建
if (orderlist.Count() == 0)
{
@@ -2303,7 +2303,7 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo
db.BeginTrans();
StuEnrollFeeOrderEntity orderEntity = new StuEnrollFeeOrderEntity();
orderEntity.Create();
orderEntity.YearNo = templateId == "1" ? Convert.ToInt32("20" + stufreshlist.FirstOrDefault(m => m.StuNo == dr[1].ToString()).Grade): dr[0].ToInt();
orderEntity.YearNo = templateId == "1" ? Convert.ToInt32("20" + stufreshlist.FirstOrDefault(m => m.StuNo == dr[1].ToString()).Grade) : dr[0].ToInt();
orderEntity.StuNo = dr[1].ToString();
Random ran = new Random();
orderEntity.orderid = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000);
@@ -2389,8 +2389,7 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo

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;
@@ -2408,7 +2407,7 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo
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 + "'");
DataTable stuinfo = BaseRepository("YongyouDb").FindTable("select * from SCS_XSXX where XH='" + detailstuno + "'");
if (stuinfo.Rows.Count == 0)
{
//用友库无学生数据
@@ -2417,20 +2416,45 @@ where bb.StuNo not in (select b.StuNo from StuInfoBasic b where b.StuNo=bb.StuNo
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) " +
" values('001','" + newdetail.YearNo + "','" + newdetail.orderid + "-" + newdetail.YearNo + "','" + newdetail.orderid + "','" + XSID + "','" + newdetail.StuNo + "','" + XM + "','" + DateTime.Now.ToString("yyyyMMdd") + "','" + DateTime.Now.ToString("hhmmss") + "','20','4','" + newdetail.SJAmount + "','ExcelOffLine','" + SFZ + "','" + newdetail.SJAmount + "','1','','支付成功')";
dbyongyou.ExecuteBySql(strSql);
//日志
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++)
//判断用友订单是否存在记录
DataTable scs_orderlist = BaseRepository("YongyouDb").FindTable("select * from SCS_ORDER where KJND='" + newdetail.YearNo + "' and OR_ID='" + newdetail.orderid + "-" + newdetail.YearNo + "' and OR_NO='" + newdetail.orderid + "'");
if (scs_orderlist.Rows.Count == 0)
{
string sqldetail = "insert into SCS_ORDEL(GSDM,KJND,OR_ID,XH,SFND,SFXMDM,SFXMMC,JE,SFQJNM) " +
"values('001','" + newdetail.YearNo + "','" + newdetail.orderid + "-" + newdetail.YearNo + "','" + (i + 1) + "','" + newdetail.YearNo + "','" + orderdetaillist[i].ChargeItemID + "','" + orderdetaillist[i].ChargeItemName + "','" + orderdetaillist[i].SJAmount + "','" + newdetail.YearNo + "')";
dbyongyou.ExecuteBySql(sqldetail);
//用友库无订单记录
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) " +
" values('001','" + newdetail.YearNo + "','" + newdetail.orderid + "-" + newdetail.YearNo + "','" + newdetail.orderid + "','" + XSID + "','" + newdetail.StuNo + "','" + XM + "','" + DateTime.Now.ToString("yyyyMMdd") + "','" + DateTime.Now.ToString("hhmmss") + "','20','4','" + newdetail.SJAmount + "','ExcelOffLine','" + SFZ + "','" + newdetail.SJAmount + "','1','','支付成功')";
BaseRepository("YongyouDb").ExecuteBySql(strSql);
//日志
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) " +
"values('001','" + newdetail.YearNo + "','" + newdetail.orderid + "-" + newdetail.YearNo + "','" + (i + 1) + "','" + newdetail.YearNo + "','" + orderdetaillist[i].ChargeItemID + "','" + orderdetaillist[i].ChargeItemName + "','" + orderdetaillist[i].SJAmount + "','" + newdetail.YearNo + "')";
BaseRepository("YongyouDb").ExecuteBySql(sqldetail);
}
}
else
{
int xhnew = 0;
//获取序号
DataTable scs_ordel = BaseRepository("YongyouDb").FindTable("select * from SCS_ORDEL where OR_ID='" + newdetail.orderid + "-" + newdetail.YearNo + "' order by xh desc");
if (scs_ordel.Rows.Count > 0)
{
xhnew = Convert.ToInt32(scs_ordel.Rows[0]["XH"]);
}
//用友明细
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) " +
"values('001','" + newdetail.YearNo + "','" + newdetail.orderid + "-" + newdetail.YearNo + "','" + (xhnew + i + 1) + "','" + newdetail.YearNo + "','" + orderdetaillist[i].ChargeItemID + "','" + orderdetaillist[i].ChargeItemName + "','" + orderdetaillist[i].SJAmount + "','" + newdetail.YearNo + "')";
BaseRepository("YongyouDb").ExecuteBySql(sqldetail);
//更新主表
BaseRepository("YongyouDb").ExecuteBySql("update SCS_ORDER set AMOUNT=AMOUNT+" + orderdetaillist[i].SJAmount + " where KJND='" + newdetail.YearNo + "' and OR_ID='" + newdetail.orderid + "-" + newdetail.YearNo + "' and OR_NO='" + newdetail.orderid + "'");
}
}
dbyongyou.Commit();
}
//触发开具发票任务
//通过调用digitalschoolapi的接口实现任务触发


Notiek ielāde…
Atcelt
Saglabāt