tijian_jichuang/Code/SOH.JianYan/frm_dycxhz.cs
2025-02-20 11:54:48 +08:00

86 lines
2.9 KiB
C#

using SOH.Kernel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SOH.Entities;
using EAS.Services;
using System.Linq;
namespace SOH.JianYan
{
[ModuleAttribute(ModuleID = "C53E054A-2951-410D-9474-4B52306999C7", ModuleName = "当日抽血汇总")]
public partial class frm_dycxhz : SOH.Window.baseChildForm
{
public frm_dycxhz()
{
InitializeComponent();
}
private void btn_cx_Click(object sender, EventArgs e)
{
DateTime cxrq = dtp_cxrq.Value.Date;
var vser = ServiceContainer.GetService<SOH.BLL.IJianYan>();
string cxtj = vser.getCXTJ(cxrq);
var ysdt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(cxtj);
if(ysdt.Rows.Count==0&&ysdt.Columns.Count==0)
{
ysdt.Columns.Add("tm", typeof(Int64));
ysdt.Columns.Add("xm", typeof(string));
ysdt.Columns.Add("jytm", typeof(string));
ysdt.Columns.Add("zhxmmc", typeof(string));
ysdt.Columns.Add("cxsj", typeof(DateTime));
ysdt.Columns.Add("ygxm", typeof(string));
}
DataTable dt = ysdt;
DataTable dtys = ysdt;
//select tt.tm as tm ,tt.xm as xm ,sqd.jytm as jytm,xm.zhxmmc as zhxmmc ,sqd.cxsj as cxsj,isnull(yg.xm,'') as ygxm from t_ttgzb tt
var ysls= dtys.AsEnumerable().Select(t => new
{
tm = t.Field<Int64>("tm"),
xm = t.Field<string>("xm"),
jytm = t.Field<string>("jytm"),
zhxmmc = t.Field<string>("zhxmmc"),
cxsj = t.Field<DateTime>("cxsj"),
ygxm = t.Field<string>("ygxm")
}).ToList();
ysls.GroupBy(t => new
{
tm = t.tm,
xm = t.xm,
jytm = t.jytm,
cxsj = t.cxsj,
ygxm = t.ygxm
}).ToList().ForEach(t => {
DataRow dr = dt.NewRow();
dr["tm"] = t.Key.tm;
dr["xm"] = t.Key.xm;
dr["jytm"] = t.Key.jytm;
dr["cxsj"] = t.Key.cxsj;
dr["ygxm"] = t.Key.ygxm;
ysls.Where(p => p.tm == t.Key.tm && p.xm == t.Key.xm && p.jytm == t.Key.jytm && p.cxsj == t.Key.cxsj && p.ygxm == t.Key.ygxm).ToList().ForEach(p=> {
dr["zhxmmc"] = dr["zhxmmc"]+ p.zhxmmc + " ";
});
dt.Rows.Add(dr);
});
FastReport.Report r = new FastReport.Report();
r.Load(Application.StartupPath + "\\report\\cxtj.frx");
r.RegisterData(dt, "cxtj");
r.Preview = printpreview;
r.Refresh();
r.Show();
}
private void frm_dycxhz_Load(object sender, EventArgs e)
{
}
}
}