399 lines
14 KiB
C#
399 lines
14 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using SOH.Kernel;
|
|
using EAS.Services;
|
|
using SOH.BLL;
|
|
using SOH.Entities;
|
|
using EAS;
|
|
using EAS.Data;
|
|
using SOH.Data;
|
|
using SOH.Entities.DTO;
|
|
using System.Configuration;
|
|
using SOH.Configuration;
|
|
using System.Reflection;
|
|
using System.Drawing.Imaging;
|
|
using System.IO;
|
|
using System.Security.Cryptography;
|
|
using System.Web;
|
|
using SOH.KeFu;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json;
|
|
using System.Net;
|
|
using SOH.ShouFei;
|
|
|
|
namespace SOH.QianTai
|
|
{
|
|
[ModuleAttribute(ModuleID = "B0DCE850-865D-40E6-B222-643247784258", ModuleName = "待查人员管理")]
|
|
public partial class frmDaiChaRenYuan : SOH.Window.baseChildForm
|
|
{
|
|
public frmDaiChaRenYuan()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void frmDaiChaRenYuan_Load(object sender, EventArgs e)
|
|
{
|
|
dcryBind();
|
|
}
|
|
public void dcryBind()
|
|
{
|
|
dtogzbBindingSource.DataSource = ServiceContainer.GetService<IShouFei>().Getdjry(Convert.ToInt16(LoginUser.yydm), this.rb3_ZJF.Text);
|
|
}
|
|
|
|
private void tb1_TM_KeyUp(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string tmstr = this.tb1_TM.Text.Trim();
|
|
if (string.IsNullOrEmpty(tmstr) || tmstr.Length != 10)
|
|
{
|
|
MessageBox.Show("条码格式错误");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
int tm = 0;
|
|
if (Int32.TryParse(tmstr, out tm))
|
|
{
|
|
bool ifgr = tm.ToString("0000000000").StartsWith("1");
|
|
//以0开头的tm是个人的
|
|
if (!ifgr) //个人体检
|
|
{
|
|
t_grgzb b = ServiceContainer.GetService<It_grgzb>().GetGrgzbByTm(tm);
|
|
if (b == null)
|
|
{
|
|
return;
|
|
}
|
|
if (b.tmztz != 2)
|
|
{
|
|
MessageBox.Show("该人员不是正在体检人员不允许回收!");
|
|
return;
|
|
}
|
|
|
|
this.tbXM.Text = b.xm;
|
|
this.tbNL.Text = b.nl.ToString();
|
|
this.cbXB.SelectedIndex = b.xb;
|
|
this.cbHYZK.SelectedIndex = b.hyzk;
|
|
|
|
}
|
|
else//团检
|
|
{
|
|
t_ttgzb b = ServiceContainer.GetService<It_ttgzb>().GetModelBytm(tm);
|
|
if (b == null)
|
|
{
|
|
return;
|
|
}
|
|
if (b.tmztz != 2)
|
|
{
|
|
MessageBox.Show("该人员不是正在体检人员不允许回收!");
|
|
return;
|
|
}
|
|
this.tbXM.Text = b.xm;
|
|
this.tbNL.Text = b.nl.ToString();
|
|
this.tbYGH.Text = b.ygh.ToString();
|
|
this.tbBM.Text = b.ssbm.ToString();
|
|
this.cbXB.SelectedIndex = b.xb;
|
|
this.cbHYZK.SelectedIndex = b.hyzk;
|
|
}
|
|
List<t_tempdjxm> d = ServiceContainer.GetService<It_tempdjxm>().GetModelBytm(tm, 0);
|
|
ttempdjxmBindingSource.DataSource = d;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
private void btnQD_Click(object sender, EventArgs e)
|
|
{
|
|
string tmstr = this.tb1_TM.Text.Trim();
|
|
int tm = 0;
|
|
if (string.IsNullOrEmpty(tmstr) || tmstr.Length != 10)
|
|
{
|
|
MessageBox.Show("条码格式错误");
|
|
return;
|
|
}
|
|
if (dataGridView1.Rows.Count == 0)
|
|
{
|
|
MessageBox.Show("会员没有未查项目。");
|
|
return;
|
|
}
|
|
|
|
if (Int32.TryParse(tmstr, out tm))
|
|
{
|
|
bool ifgr = tm.ToString("0000000000").StartsWith("1");
|
|
if (tbXM.Text == "")
|
|
{
|
|
MessageBox.Show("请输入条码后回车查看需要待查人员!");
|
|
return;
|
|
}
|
|
if (ServiceContainer.GetService<It_tempdjxm>().Updatedjxm(tm, 3, -2).State == 1)
|
|
{
|
|
tb1_TM.Text = "";
|
|
tbXM.Text = "";
|
|
tbNL.Text = "";
|
|
cbHYZK.SelectedIndex = -1;
|
|
cbXB.SelectedIndex = -1;
|
|
tbYGH.Text = "";
|
|
tbBM.Text = "";
|
|
this.ttempdjxmBindingSource.Clear();
|
|
MessageBox.Show("回收成功!");
|
|
dcryBind();
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void tb2_TM_KeyUp(object sender, KeyEventArgs e)
|
|
{
|
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string tmstr = this.tb2_TM.Text.Trim();
|
|
if (string.IsNullOrEmpty(tmstr) || tmstr.Length != 10)
|
|
{
|
|
MessageBox.Show("条码格式错误");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
int tm = 0;
|
|
if (Int32.TryParse(tmstr, out tm))
|
|
{
|
|
bool ifgr = tm.ToString("0000000000").StartsWith("1");
|
|
//以0开头的tm是个人的
|
|
if (!ifgr) //个人体检
|
|
{
|
|
t_grgzb b = ServiceContainer.GetService<It_grgzb>().GetGrgzbByTm(tm);
|
|
if (b.tmztz != -2)
|
|
{
|
|
MessageBox.Show("该人员不是待检人员!");
|
|
return;
|
|
}
|
|
|
|
this.tbxm2.Text = b.xm;
|
|
this.tbnl2.Text = b.nl.ToString();
|
|
this.cbbxb2.SelectedIndex = b.xb;
|
|
this.cbbhyzk2.SelectedIndex = b.hyzk;
|
|
this.tbtjrq.Text = b.tjrq.ToString();
|
|
|
|
}
|
|
else//团检
|
|
{
|
|
t_ttgzb b = ServiceContainer.GetService<It_ttgzb>().GetModelBytm(tm);
|
|
if (b.tmztz != -2)
|
|
{
|
|
MessageBox.Show("该人员不是待检人员!");
|
|
return;
|
|
}
|
|
this.tbxm2.Text = b.xm;
|
|
this.tbnl2.Text = b.nl.ToString();
|
|
this.cbbxb2.SelectedIndex = b.xb;
|
|
this.cbbhyzk2.SelectedIndex = b.hyzk;
|
|
this.tbtjrq.Text = b.tjrq.ToString();
|
|
}
|
|
List<t_tempdjxm> d = ServiceContainer.GetService<It_tempdjxm>().GetModelBytm2(tm);
|
|
ttempdjxmBindingSource1.DataSource = d;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
string tmstr = this.tb2_TM.Text.Trim();
|
|
int tm = 0;
|
|
if (string.IsNullOrEmpty(tmstr) || tmstr.Length != 10)
|
|
{
|
|
MessageBox.Show("条码格式错误");
|
|
return;
|
|
}
|
|
if (dataGridView2.Rows.Count == 0)
|
|
{
|
|
MessageBox.Show("会员没有未查项目。");
|
|
return;
|
|
}
|
|
|
|
if (Int32.TryParse(tmstr, out tm))
|
|
{
|
|
bool ifgr = tm.ToString("0000000000").StartsWith("1");
|
|
if (tbxm2.Text == "")
|
|
{
|
|
MessageBox.Show("请输入条码后回车查看需要体检的人员!");
|
|
return;
|
|
}
|
|
if (ServiceContainer.GetService<It_tempdjxm>().Updatedjxm(tm, 0, 2).State == 1)
|
|
{
|
|
tb2_TM.Text = "";
|
|
tbxm2.Text = "";
|
|
tbnl2.Text = "";
|
|
|
|
cbbhyzk2.SelectedIndex = -1;
|
|
cbbxb2.SelectedIndex = -1;
|
|
tbygh2.Text = "";
|
|
tbbm2.Text = "";
|
|
this.ttempdjxmBindingSource1.Clear();
|
|
MessageBox.Show("体检状态设置成功!");
|
|
|
|
DialogResult result;
|
|
result = MessageBox.Show("需要打印待查导检单吗?", "补打", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
|
if (result == DialogResult.OK)
|
|
{
|
|
var vser = ServiceContainer.GetService<IShouFei>();
|
|
List<dto_tmdy> nody = vser.getycztm2(tm);
|
|
frmPrintDaoJianDan djd = new frmPrintDaoJianDan();
|
|
djd.init2(tm);
|
|
djd.print();
|
|
frmprinttm ftm = new frmprinttm();
|
|
ftm.init(tm, 1, 99999, nody);
|
|
ftm.print();
|
|
|
|
}
|
|
|
|
dcryBind();
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
private void rb3_ZJF_TextChanged(object sender, EventArgs e)
|
|
{
|
|
dcryBind();
|
|
}
|
|
|
|
private void btnCX1_Click(object sender, EventArgs e)
|
|
{
|
|
System.Configuration.Configuration conf = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Windows.Forms.Application.StartupPath + "\\local.ext");
|
|
// string sfzdkq = "";
|
|
if (conf.AppSettings.Settings.AllKeys.Contains("QYSFZDKQ"))
|
|
{
|
|
if (conf.AppSettings.Settings["QYSFZDKQ"].Value != "1")
|
|
{
|
|
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
|
return;
|
|
}
|
|
|
|
var group = conf.SectionGroups["object"];
|
|
if (group == null)
|
|
{
|
|
//group = new ConfigurationSectionGroup();
|
|
//conf.SectionGroups.Add("object", group);
|
|
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
|
return;
|
|
}
|
|
|
|
|
|
// ConfigurationSection section = new ConfigurationSection();
|
|
// group.Sections.Add("IDCard",)
|
|
|
|
|
|
MyAssemblySection section = group.Sections["ass"] as MyAssemblySection;
|
|
MyAssemblyElement myelement = null;
|
|
foreach (MyAssemblyElement element in section.MyAssemblyElements)
|
|
{
|
|
if (element.name == "IDCard")
|
|
{
|
|
myelement = element;
|
|
break;
|
|
}
|
|
}
|
|
if (myelement == null)
|
|
{
|
|
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
|
return;
|
|
}
|
|
var ass = Assembly.Load(myelement.assembly);
|
|
SOH.Interface.IIDCardRead idcard = ass.CreateInstance(myelement.type) as SOH.Interface.IIDCardRead;
|
|
int result = idcard.init();
|
|
if (result != 0)
|
|
{
|
|
MessageBox.Show("初始化读卡器失败!");
|
|
return;
|
|
|
|
}
|
|
result = idcard.read();
|
|
if (result != 0)
|
|
{
|
|
MessageBox.Show("读卡失败!");
|
|
return;
|
|
|
|
}
|
|
tbSFZH.Text = idcard.sfzh;
|
|
dtogzbBindingSource.DataSource = ServiceContainer.GetService<IShouFei>().GetdjryBySfzh(Convert.ToInt16(LoginUser.yydm), idcard.sfzh);
|
|
idcard.exit();
|
|
|
|
}
|
|
|
|
private void dataGridView3_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView3.CurrentRow.Index < 0)
|
|
{
|
|
return;
|
|
}
|
|
Entities.DTO.dto_gzb gzb = dataGridView3.Rows[dataGridView3.CurrentRow.Index].DataBoundItem as dto_gzb;
|
|
|
|
int tm = gzb.tm;
|
|
|
|
List<t_tempdjxm> d = ServiceContainer.GetService<It_tempdjxm>().GetModelBytm2(tm);
|
|
ttempdjxmBindingSource1.DataSource = d;
|
|
|
|
|
|
if (dataGridView2.Rows.Count == 0)
|
|
{
|
|
MessageBox.Show("会员没有未查项目。");
|
|
return;
|
|
}
|
|
if (ServiceContainer.GetService<It_tempdjxm>().Updatedjxm(tm, 0, 2).State == 1)
|
|
{
|
|
tb2_TM.Text = "";
|
|
tbxm2.Text = "";
|
|
tbnl2.Text = "";
|
|
|
|
cbbhyzk2.SelectedIndex = -1;
|
|
cbbxb2.SelectedIndex = -1;
|
|
tbygh2.Text = "";
|
|
tbbm2.Text = "";
|
|
this.ttempdjxmBindingSource1.Clear();
|
|
MessageBox.Show("体检状态设置成功!");
|
|
|
|
DialogResult result;
|
|
result = MessageBox.Show("需要打印待查导检单吗?", "补打", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
|
if (result == DialogResult.OK)
|
|
{
|
|
var vser = ServiceContainer.GetService<IShouFei>();
|
|
List<dto_tmdy> nody = vser.getycztm2(tm);
|
|
frmPrintDaoJianDan djd = new frmPrintDaoJianDan();
|
|
djd.init2(tm);
|
|
djd.print();
|
|
frmprinttm ftm = new frmprinttm();
|
|
ftm.init(tm, 1, 99999, nody);
|
|
ftm.print();
|
|
|
|
}
|
|
|
|
dcryBind();
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|