296 lines
10 KiB
C#
296 lines
10 KiB
C#
using SOH.Kernel;
|
|
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.Entities;
|
|
using EAS.Services;
|
|
using SOH.BLL;
|
|
using SOH.Data;
|
|
|
|
namespace SOH.Queuing.Setting
|
|
{
|
|
[ModuleAttribute(ModuleID = "17775FC4-87BB-4237-A0E6-55DDBF367C24", ModuleName = "排队科室设置")]
|
|
public partial class frmpd_ks : SOH.Window.baseChildForm
|
|
{
|
|
string ksid = "";
|
|
public frmpd_ks()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void frmpd_ks_Load(object sender, EventArgs e)
|
|
{
|
|
dgv_pdks.AutoGenerateColumns = false;
|
|
myinit();
|
|
}
|
|
|
|
private void myinit()
|
|
{
|
|
//throw new NotImplementedException();
|
|
ccb_JQLB.DataSource = SOH.Entities.DTO.dto_khlx.khlxs;
|
|
var vser = ServiceContainer.GetService<IPaiDuiJiaoHao>();
|
|
List<pd_wlks> kss = vser.getwlkss();
|
|
pdwlksBindingSource.DataSource = kss;
|
|
List<pd_jianqu> jqs = vser.getJianqulist(false);
|
|
List<Pd_louceng> lcs = vser.getLouceng(false);
|
|
cbb_jq.DataSource = jqs;// lcs;
|
|
cbb_lc.DataSource = lcs;
|
|
kss.ForEach(t => {
|
|
var jq = jqs.FirstOrDefault(j => j.id == t.jq_id);
|
|
if (jq != null)
|
|
t.jq_Name = jq.jqmc;
|
|
var lc = lcs.FirstOrDefault(l => l.Id == t.lc_id);
|
|
if (lc != null)
|
|
t.lc_Name = lc.Lcmc;
|
|
});
|
|
|
|
}
|
|
|
|
private void btn_new_Click(object sender, EventArgs e)
|
|
{
|
|
clear();
|
|
ksid = "0";
|
|
}
|
|
|
|
private void clear()
|
|
{
|
|
txt_zsrs.Text = txt_pdsx.Text = ksid = txt_bz.Text = txt_jdpdrs.Text = txt_ksmc.Text = txt_zcpdsj.Text = txt_zjf.Text = lab_img_x.Text=lab_img_y.Text= lab_img_h.Text=lab_img_w.Text="";
|
|
//throw new NotImplementedException();
|
|
}
|
|
|
|
private void btn_add_Click(object sender, EventArgs e)
|
|
{
|
|
if (ksid != "0")
|
|
{
|
|
MessageBox.Show("请先单击新建按钮!");
|
|
return;
|
|
}
|
|
int zdpdrs = 0;
|
|
int zcpdsj = 0;
|
|
int zspdrs = 0;
|
|
int pdsx = 0;
|
|
if (!int.TryParse(txt_zsrs.Text, out zspdrs))
|
|
{
|
|
MessageBox.Show("请认真填写最少排队人数!");
|
|
return;
|
|
}
|
|
if (!int.TryParse(txt_pdsx.Text, out pdsx))
|
|
{
|
|
MessageBox.Show("请认真填写最少排队顺序!");
|
|
return;
|
|
}
|
|
int.TryParse(txt_jdpdrs.Text, out zdpdrs);
|
|
int.TryParse(txt_zcpdsj.Text, out zcpdsj);
|
|
if (zdpdrs == 0)
|
|
{
|
|
MessageBox.Show("请认真填写最多排队人数!");
|
|
return;
|
|
}
|
|
if (zcpdsj == 0)
|
|
{
|
|
MessageBox.Show("请认真填写最长排除时间!");
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(txt_ksmc.Text))
|
|
{
|
|
MessageBox.Show("科室名称不能为空!");
|
|
return;
|
|
}
|
|
int lcid = 0;
|
|
int jqid = 0;
|
|
if (!int.TryParse(cbb_jq.SelectedValue.ToString(), out jqid))
|
|
{
|
|
MessageBox.Show("检区不能为空!");
|
|
return;
|
|
}
|
|
if (!int.TryParse(cbb_lc.SelectedValue.ToString(), out lcid))
|
|
{
|
|
MessageBox.Show("楼层不能为空!");
|
|
return;
|
|
}
|
|
pd_wlks wlks = new pd_wlks();
|
|
wlks.id = 0;
|
|
wlks.ksmc = txt_ksmc.Text;
|
|
wlks.zjf = txt_zjf.Text;
|
|
wlks.zdpdrs = zdpdrs;
|
|
wlks.zcpdsj = zcpdsj;
|
|
wlks.bz = txt_bz.Text;
|
|
wlks.xb = Convert.ToInt32(this.cbbxb.SelectedIndex);
|
|
wlks.isOpen = Convert.ToInt32(this.cbbOpen.SelectedIndex);
|
|
wlks.pdsx = pdsx;
|
|
wlks.zspdrs = zspdrs;
|
|
wlks.lc_id = lcid;
|
|
wlks.jq_id = jqid;
|
|
wlks.img_x = 0;
|
|
wlks.img_y = 0;
|
|
wlks.img_w = 100;
|
|
wlks.img_h = 100;
|
|
wlks.khlx = (int)ccb_JQLB.SelectedValue;
|
|
addorupdate(wlks);
|
|
}
|
|
|
|
private void addorupdate(pd_wlks wlks)
|
|
{
|
|
var ksid = wlks.id;
|
|
//throw new NotImplementedException();
|
|
var vser = ServiceContainer.GetService<IPaiDuiJiaoHao>();
|
|
OperationResult or = vser.tjxgtjks(wlks);
|
|
if (or.State != 1)
|
|
{
|
|
MessageBox.Show(or.Message);
|
|
return;
|
|
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("操作成功");
|
|
wlks = Newtonsoft.Json.JsonConvert.DeserializeObject<pd_wlks>(or.Message);
|
|
if (ksid == 0)
|
|
{
|
|
|
|
pdwlksBindingSource.Add(wlks);
|
|
}
|
|
else
|
|
{
|
|
myinit();
|
|
}
|
|
clear();
|
|
}
|
|
}
|
|
|
|
private void btn_xg_Click(object sender, EventArgs e)
|
|
{
|
|
if (ksid == "0" || string.IsNullOrEmpty(ksid))
|
|
{
|
|
MessageBox.Show("请先选择要修改的科室!");
|
|
return;
|
|
}
|
|
int zdpdrs = 0;
|
|
int zcpdsj = 0;
|
|
int.TryParse(txt_jdpdrs.Text, out zdpdrs);
|
|
int.TryParse(txt_zcpdsj.Text, out zcpdsj);
|
|
int zspdrs = 0;
|
|
int pdsx = 0;
|
|
if (!int.TryParse(txt_zsrs.Text, out zspdrs))
|
|
{
|
|
MessageBox.Show("请认真填写最少排队人数!");
|
|
return;
|
|
}
|
|
if (!int.TryParse(txt_pdsx.Text, out pdsx))
|
|
{
|
|
MessageBox.Show("请认真填写最少排队顺序!");
|
|
return;
|
|
}
|
|
if (zdpdrs == 0)
|
|
{
|
|
MessageBox.Show("请认真填写最多排队人数!");
|
|
return;
|
|
}
|
|
if (zcpdsj == 0)
|
|
{
|
|
MessageBox.Show("请认真填写最长排除时间!");
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(txt_ksmc.Text))
|
|
{
|
|
MessageBox.Show("科室名称不能为空!");
|
|
return;
|
|
}
|
|
int lcid = 0;
|
|
int jqid = 0;
|
|
if(!int.TryParse(cbb_jq.SelectedValue.ToString(),out jqid))
|
|
{
|
|
MessageBox.Show("检区不能为空!");
|
|
return;
|
|
}
|
|
if (!int.TryParse(cbb_lc.SelectedValue.ToString(), out lcid))
|
|
{
|
|
MessageBox.Show("楼层不能为空!");
|
|
return;
|
|
}
|
|
pd_wlks wlks = new pd_wlks();
|
|
wlks.id = int.Parse(ksid);
|
|
wlks.ksmc = txt_ksmc.Text;
|
|
wlks.zjf = txt_zjf.Text;
|
|
wlks.zdpdrs = zdpdrs;
|
|
wlks.zcpdsj = zcpdsj;
|
|
wlks.bz = txt_bz.Text;
|
|
wlks.xb = Convert.ToInt32(this.cbbxb.SelectedIndex);
|
|
wlks.isOpen = Convert.ToInt32(this.cbbOpen.SelectedIndex);
|
|
wlks.pdsx = pdsx;
|
|
wlks.zspdrs = zspdrs;
|
|
wlks.lc_id = lcid;
|
|
wlks.jq_id = jqid;
|
|
wlks.khlx = (int)ccb_JQLB.SelectedValue;
|
|
wlks.img_x = Convert.ToInt32(lab_img_x.Text);
|
|
wlks.img_y = Convert.ToInt32(lab_img_y.Text);
|
|
wlks.img_h = Convert.ToInt32(lab_img_h.Text);
|
|
wlks.img_w = Convert.ToInt32(lab_img_w.Text);
|
|
addorupdate(wlks);
|
|
// this.cbbxb.SelectedIndex = Convert.ToInt32(dgvt_zhxm.Rows[e.RowIndex].Cells["xb"].Value);
|
|
}
|
|
|
|
private void btn_sc_Click(object sender, EventArgs e)
|
|
{
|
|
if (ksid == "0" || string.IsNullOrEmpty(ksid))
|
|
{
|
|
MessageBox.Show("请先选择要删除的科室!");
|
|
return;
|
|
}
|
|
var vser = ServiceContainer.GetService<IPaiDuiJiaoHao>();
|
|
OperationResult or = vser.deletewlks(ksid);
|
|
MessageBox.Show(or.Message);
|
|
if (or.State == 1)
|
|
{
|
|
//pdwlksBindingSource.Remove(pdwlksBindingSource[pdwlksBindingSource.Find("id", int.Parse(ksid))]);
|
|
myinit();
|
|
}
|
|
}
|
|
|
|
private void dgv_pdks_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
dgv_pdks.ClearSelection();
|
|
dgv_pdks.Rows[e.RowIndex].Selected = true;
|
|
pd_wlks wlks = dgv_pdks.SelectedRows[0].DataBoundItem as pd_wlks;
|
|
ksid = wlks.id.ToString();
|
|
txt_ksmc.Text = wlks.ksmc;
|
|
txt_bz.Text = wlks.bz;
|
|
txt_jdpdrs.Text = wlks.zdpdrs.ToString();
|
|
txt_zcpdsj.Text = wlks.zcpdsj.ToString();
|
|
txt_zjf.Text = wlks.zjf;
|
|
this.cbbxb.SelectedIndex = Convert.ToInt32(dgv_pdks.Rows[e.RowIndex].Cells["xb"].Value);
|
|
this.cbbOpen.SelectedIndex = Convert.ToInt32(dgv_pdks.Rows[e.RowIndex].Cells["isOpen"].Value);
|
|
txt_pdsx.Text = wlks.pdsx.ToString();
|
|
txt_zsrs.Text = wlks.zspdrs.ToString();
|
|
cbb_jq.SelectedValue = wlks.jq_id;
|
|
cbb_lc.SelectedValue = wlks.lc_id;
|
|
ccb_JQLB.SelectedValue = wlks.khlx;
|
|
lab_img_x.Text = wlks.img_x.ToString();
|
|
lab_img_y.Text = wlks.img_y.ToString();
|
|
lab_img_h.Text = wlks.img_h.ToString();
|
|
lab_img_w.Text = wlks.img_w.ToString();
|
|
}
|
|
|
|
private void txt_ksmc_Leave(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_zjf.Text.Trim()))
|
|
{
|
|
try
|
|
{
|
|
txt_zjf.Text = SOH.Common.ChnToPinYin.HeadFirst(txt_ksmc.Text);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
EAS.Loggers.Logger.Error(ex.Message);
|
|
EAS.Loggers.Logger.Info(ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|