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 CoreFS.CA06;using Pur.Entity;
using Core.Mes.Client.Comm.Control;
using Pur.Entity.configureEntity;
using Infragistics.Win.UltraWinGrid;
using System.Collections;
using Core.Mes.Client.Comm.Tool;
using System.Data.OracleClient;
using com.hnshituo.pur.vo;
using System.Text.RegularExpressions;
using Infragistics.Win;
using Infragistics.Win.UltraWinEditors;
using com.hnshituo.sel.vo;
using Core.Mes.Client.Comm.Server;
using Pur.Pop_upWindow;
using CoreFS.SA06;
using Pur.configure;
using Pur.PublicTools;
using Core.Mes.Client.Comm.Format;
namespace Pur
{
public partial class SupplierManagement : FrmPmsBase
{
//地址(国家省份)信息
DataTable regions;
//附件上传
String fileName = "";
public SupplierManagement()
{
InitializeComponent();
this.IsLoadUserView = true;
}
private void SupplierManagement_Load(object sender, EventArgs e)
{
init();
GetPUR_SUPP();
ultraExpandableGroupBox1.Expanded = false;
ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[0];
GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { });
GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { });
GridHelper.SetExcludeColumnsActive(ultraGrid3.DisplayLayout.Bands[0], new string[] { "certPath" });
GridHelper.SetExcludeColumnsActive(ultraGrid4.DisplayLayout.Bands[0], new string[] { });
string basecode = "1217";
DataTable dt = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { basecode }, this.ob);
dt = dt.AsEnumerable().Where(p => p["VALIDFLAG"].ToString().Equals("1")).CopyToDataTable();
Combo_Rate.DataSource = dt;
Combo_Rate.DisplayMember = "BASENAME";
Combo_Rate.ValueMember = "BASECODE";
//ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
//ultraGrid2.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
//ultraGrid3.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
}
#region toolbar菜单
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
GetPUR_SUPP();
break;
case "Add":
AddPUR_SUPP();
break;
case "Update":
UpdPUR_SUPP();
break;
case "Delete":
DelPUR_SUPP();
break;
case "close":
CloPUR_SUPP();
break;
case "Enable":
EnaPUR_SUPP();
break;
case "Pending":
PenPUR_SUPP();
break;
case "ShenXIao":
ShenPUR_SUPP();
break;
case "ChangePWD":
ChangePWD();
break;
case "doExcel":
doExcel();
break;
}
}
//导出Excel
private void doExcel()
{
try
{
this.Cursor = Cursors.Default;
ArrayList alUltraGrid = new ArrayList();
alUltraGrid.Add(ultraGrid1);
ArrayList alSheeft = new ArrayList();
alSheeft.Add("供应商清单");
if (ultraGrid1.Rows.Count > 0)
{
GridHelper.ulGridToExcel(alUltraGrid, alSheeft, "供应商清单");//导出excel
}
else
{
MessageUtil.ShowTips("无可导出明细!");
}
}
catch (Exception e)
{
MessageUtil.ShowTips("导出失败" + e.Message);
}
finally
{
this.Cursor = Cursors.Default;
}
}
///
/// 修改供应商密码
///
private void ChangePWD()
{
UltraGridRow uRow = ultraGrid1.ActiveRow;
if (uRow == null)
{
MessageUtil.ShowTips("请选择供应商");
return;
}
String strSuppCode = uRow.Cells["suppCode"].Value.ToString().Trim();
String strSuppName = uRow.Cells["suppName"].Value.ToString().Trim();
if (String.IsNullOrEmpty(strSuppCode))
{
MessageUtil.ShowTips("选择供应商的编号为空!");
return;
}
FrmSuppChangePassword frm = new FrmSuppChangePassword(strSuppName, strSuppCode,this.ob);
frm.ShowDialog();
}
#endregion
#region toolbar菜单事件
///
/// 生效
///
private void ShenPUR_SUPP()//生效
{
try
{
UltraGridRow uRow = ultraGrid1.ActiveRow;
if (uRow == null)
{
MessageUtil.ShowTips("请选择供应商");
return;
}
ArrayList list = new ArrayList();
Supp Supp_Entity = new Supp();
Supp_Entity.SuppCode = uRow.Cells["suppCode"].Value.ToString();
Supp_Entity.Status = "4";
Supp_Entity.Validflag = "1";
Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
Supp_Entity.UpdateTime = System.DateTime.Now;
Supp sc = this.execute("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { Supp_Entity.SuppCode });
if (sc == null)
{
MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据不存在或异常,或请刷新页面再操作");
return;
}
if (sc.SuspendStatus == "1")
{
MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】被暂挂,或请刷新页面再操作");
return;
}
if (sc.Status == "4")
{
MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】已生效,或请刷新页面再操作");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("确定生效供应商【" + Supp_Entity.SuppCode + "】?") == DialogResult.No)
{
return;
}
CoreResult re = this.execute("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
if (re.Resultcode != 0)
{
MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
return;
}
// 作废数据到计量系统
string json = JSONFormat.Format(Supp_Entity);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
ccp.MethodName = "logicDelete";
ccp.ServerParams = new object[] { json };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("生效信息成功!");
GetPUR_SUPP();
ConfigureClassCommon.doActiveSelRow(ultraGrid1, "suppCode", Supp_Entity.SuppCode);
}
catch (Exception e)
{
MessageUtil.ShowTips("操作失败:"+e);
}
}
///
/// 暂挂
///
private void PenPUR_SUPP()//暂挂
{
ultraGrid1.UpdateData();
UltraGridRow uRow = ultraGrid1.ActiveRow;
if (uRow.Cells["SuspendStatus"].Value.ToString() == "暂挂")
{
MessageUtil.ShowTips("信息已暂挂,无需再次操作!");
return;
}
Supp Supp_Entity = new Supp();
Supp_Entity.SuppCode = uRow.Cells["suppCode"].Value.ToString();
Supp_Entity.SuspendStatus = "1";
Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
Supp_Entity.UpdateTime = System.DateTime.Now;
Supp sc = this.execute("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { Supp_Entity.SuppCode });
if (sc == null)
{
MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据不存在或异常,或请刷新页面再操作");
return;
}
if (sc.Validflag == "0")
{
MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据可能被废除,或请刷新页面再操作");
return;
}
if (sc.SuspendStatus == "1")
{
MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】已被被暂挂,无需重复操作,或请刷新页面再操作");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("确定暂挂供应商【" + Supp_Entity.SuppCode + "】?") == DialogResult.No)
{
return;
}
CoreResult re= this.execute("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
if (re.Resultcode != 0)
{
MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
return;
}
Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("暂挂信息成功!");
GetPUR_SUPP();
ConfigureClassCommon.doActiveSelRow(ultraGrid1, "suppCode", Supp_Entity.SuppCode);
}
///
/// 启用
///
private void EnaPUR_SUPP()//启用
{
ultraGrid1.UpdateData();
ArrayList list = new ArrayList();
UltraGridRow uRow = ultraGrid1.ActiveRow;
if (uRow.Cells["SuspendStatus"].Value.ToString() == "正常")
{
MessageUtil.ShowTips("该供应商已启用,无需再次操作!");
return;
}
Supp Supp_Entity = new Supp();
Supp_Entity.SuppCode = uRow.Cells["suppCode"].Value.ToString();
Supp_Entity.SuspendStatus = "0";
Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
Supp_Entity.UpdateTime = System.DateTime.Now;
Supp sc = this.execute("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { Supp_Entity.SuppCode });
if (sc == null)
{
MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据不存在或异常,或请刷新页面再操作");
return;
}
if (sc.Validflag == "0")
{
MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据可能被废除,或请刷新页面再操作");
return;
}
if (sc.SuspendStatus == "0")
{
MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】已启用,无需重复操作,或请刷新页面再操作");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("确定启用供应商【" + Supp_Entity.SuppCode + "】?") == DialogResult.No)
{
return;
}
CoreResult re = this.execute("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
if (re.Resultcode != 0)
{
MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
return;
}
MessageUtil.ShowTips("启用成功!");
GetPUR_SUPP();
ConfigureClassCommon.doActiveSelRow(ultraGrid1, "suppCode", Supp_Entity.SuppCode);
}
///
/// 关闭
///
private void CloPUR_SUPP()//关闭
{
this.Close();
}
///
/// 删除
///
private void DelPUR_SUPP()//删除
{
if (SQ == 1)
{
UltraGridRow uRow = ultraGrid1.ActiveRow;
if (uRow == null)
{
MessageUtil.ShowTips("请选择供应商进行操作");
return;
}
String strSuppCode = uRow.Cells["suppCode"].Value.ToString().Trim();
if (String.IsNullOrEmpty(strSuppCode))
{
MessageUtil.ShowTips("请选择供应商编码不能为空");
return;
}
string resStr = "";
resStr = this.execute("com.hnshituo.pur.configure.service.SuppService", "SuppIsUsing", new object[] { uRow.Cells["suppCode"].Value.ToString() });//删除操作
if (resStr != "")
{
MessageUtil.ShowTips("供应商在" + resStr + "中使用,若物料中使用,请先取消物料和供应商的关联,若已在任务单中使用,请先完成招标,否则将不予作废");
return;
}
ultraGrid1.UpdateData();
ArrayList list = new ArrayList();
Supp Supp_Entity = new Supp();
Supp_Entity.SuppCode = strSuppCode;
Supp_Entity.Validflag = "0";
Supp_Entity.DeleteName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
Supp_Entity.DeleteUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
Supp_Entity.DeleteTime = System.DateTime.Now;
if (MessageUtil.ShowYesNoAndQuestion("确定要作废供应商【" + uRow.Cells["suppName"].Value.ToString() + "】?") == DialogResult.No)
{
return;
}
CoreResult rt = this.execute("com.hnshituo.pur.configure.service.SuppService", "delete_Supp", new object[] { Supp_Entity });
if (rt.Resultcode != 0)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("操作失败!:" + rt.Resultmsg);
}
// 生效数据到计量系统
string json = JSONFormat.Format(Supp_Entity);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
ccp.MethodName = "logicDelete";
ccp.ServerParams = new object[] { json };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("操作成功!");
GetPUR_SUPP();
}
else if (SQ == 2)
{
UltraGridRow uge = ultraGrid2.ActiveRow;
SuppBank Banks = new SuppBank();
Banks.Id = uge.Cells["id"].Value.ToString();
if (MessageUtil.ShowYesNoAndQuestion("确定要删除该司在【" + uge.Cells["bankName"].Value.ToString() + "】的账号信息?") == DialogResult.No)
{
return;
}
CoreResult rt = this.execute("com.hnshituo.pur.configure.service.SuppBankService", "delete_SuppBank", new object[] { Banks });
if (rt.Resultcode != 0)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("删除失败!" + rt.Resultmsg);
return;
}
Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("删除信息成功!");
SuppBank YY = new SuppBank();
YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
DataTable dt = this.execute("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY, 0, 0 });
GridHelper.CopyDataToDatatable(dt, dataTable2, true);
}
else if (SQ == 3)
{
UltraGridRow uge = ultraGrid3.ActiveRow;
SuppAptitude Aptis = new SuppAptitude();
Aptis.Id = uge.Cells["id"].Value.ToString();
if (MessageUtil.ShowYesNoAndQuestion("确定要删除供应商资质【" + uge.Cells["certNo"].Value.ToString() + "】信息?") == DialogResult.No)
{
return;
}
//CoreResult re = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "delete", new object[] { Aptis });
CoreResult rt = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "delete_SuppAptitude", new object[] { Aptis });
if (rt.Resultcode != 0)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("删除失败!" + rt.Resultmsg);
return;
}
Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("删除信息成功!");
SuppAptitude YY = new SuppAptitude();
YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
DataTable dt1 = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { YY, 0, 0 });
GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
}
else if (SQ == 0)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("请点击你要删除的信息!");
return;
}
else if(SQ == 5)
{
if (MessageUtil.ShowYesNoAndQuestion("确定要删除改供应商评级?") == DialogResult.No)
{
return;
}
UltraGridRow uge5 = ultraGrid5.ActiveRow;
CoreResult cr = this.execute("com.hnshituo.pur.configure.service.SuppRateService", "doDelete", new object[] { uge5.Cells["id"].Value.ToString().Trim() });
if (cr.Resultcode != 0)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("删除失败!" + cr.Resultmsg);
return;
}
MessageUtil.ShowWarning("删除成功!");
GetPUR_SUPP();
}
}
///添加资质信息时修改
private void UpdateSupp()
{
UltraGridRow uge = ultraGrid1.ActiveRow;
if (uge == null)
{
MessageUtil.ShowTips("请选择供应商");
return;
}
String StrnewsuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
Supp Supp_Entity1 = new Supp();
Supp_Entity1.SuppCode = StrnewsuppCode;
Supp_Entity1.SuppLicNum = this.txt_SUPPLICNUM.Text;
if (txt_SUPPSTARTDATE.Text == "" || txt_SUPPSTARTDATE.Text == null)
{
txt_SUPPSTARTDATE.Text = "";
}
else
{
Supp_Entity1.SuppStartDate = Convert.ToDateTime(this.txt_SUPPSTARTDATE.Text).ToShortDateString();
}
if (txt_SUPPENDDATE.Text == "" || txt_SUPPENDDATE.Text == null)
{
txt_SUPPENDDATE.Text = "";
}
else
{
Supp_Entity1.SuppEndDate = Convert.ToDateTime(this.txt_SUPPENDDATE.Text).ToShortDateString();
}
if (txt_SUPPTAXSTARTDATE.Text == "" || txt_SUPPTAXSTARTDATE.Text == null)
{
txt_SUPPTAXSTARTDATE.Text = "";
}
else
{
Supp_Entity1.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPTAXSTARTDATE.Text).ToShortDateString();
}
if (txt_SUPPTAXENDDATE.Text == "" || txt_SUPPTAXENDDATE.Text == null)
{
txt_SUPPTAXENDDATE.Text = "";
}
else
{
Supp_Entity1.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPTAXENDDATE.Text).ToShortDateString();
}
if (txt_SUPPLICSTARTDATE.Text == "" || txt_SUPPLICSTARTDATE.Text == null)
{
txt_SUPPLICSTARTDATE.Text = "";
}
else
{
Supp_Entity1.SuppLicStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
}
if (txt_SUPPLICENDDATE.Text == "" || txt_SUPPLICENDDATE.Text == null)
{
txt_SUPPLICENDDATE.Text = "";
}
else
{
Supp_Entity1.SuppLicEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
}
////Supp_Entity1.OrgCode = txt_ORGCODE.Text;
////Supp_Entity1.SuppTaxId = txt_SUPPTAXID.Text;
////CoreResult rt = this.execute("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity1 });
//GetPUR_SUPP();
}
///
/// 更新
///
private void UpdPUR_SUPP()//更新
{
UltraGridRow uge = ultraGrid1.ActiveRow;
if (uge == null)
{
MessageUtil.ShowTips("请选择供应商");
return;
}
String StrnewsuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
Supp sc = this.execute("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { StrnewsuppCode });
if (sc == null)
{
MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据不存在或异常,或请刷新页面再操作");
return;
}
if (sc.Validflag == "0")
{
MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据可能被废除,或请刷新页面再操作");
return;
}
if (sc.SuspendStatus == "1")
{
MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】被暂挂,无权限增删改,或请刷新页面再操作");
return;
}
try
{
if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[0])
{
//校验名称重复
Supp Supp_Entity = new Supp();
Supp_Entity.SuppName = txt_SUPPNAME.Text.Trim();
Supp_Entity.Validflag = "1";
string strsuppname = uge.Cells["SuppName"].Value.ToString().Trim();
if (!Supp_Entity.SuppName.Equals(strsuppname))
{
if (isExsitRow("com.hnshituo.pur.configure.service.SuppService", Supp_Entity)>0)
{
MessageUtil.ShowTips("添加失败:数据库中已存在相同的供应商名称");
return;
}
}
//校验组织机构代码重复
Supp Supp_Entity1 = new Supp();
Supp_Entity.OrgCode = txt_ORGCODE.Text.ToString().Trim();
Supp_Entity.Validflag = "1";
string strorgCode = ultraGrid1.ActiveRow.Cells["orgCode"].Value.ToString().Trim();
if (!Supp_Entity.OrgCode.Equals(strorgCode))
{
if (isExsitRow("com.hnshituo.pur.configure.service.SuppService", Supp_Entity) > 0)
{
MessageUtil.ShowTips("添加失败: 数据库中已存在相同的组织机构代码");
return;
}
}
if (testSupp() == false)
{
return;
}
if (!StrnewsuppCode.Equals(txt_SUPPCODE.Text.ToString().Trim()))
{
MessageBox.Show("供应商编号不允许修改", "提示");
txt_SUPPCODE.Focus();
return;
}
Supp_Entity.SuppCode = StrnewsuppCode;
Supp_Entity.SuppName = txt_SUPPNAME.Text.Trim();
//Supp_Entity.OrgCode = txt_ORGCODE.Text;//组织结构代码
Supp_Entity.OrgCode = txt_SUPPLICNUM.Text;
Supp_Entity.SuppShortName = txt_SUPPSHORTNAME.Text;
//Supp_Entity.SuppTaxId = txt_SUPPTAXID.Text;//税号
Supp_Entity.SuppTaxId = txt_SUPPLICNUM.Text;
Supp_Entity.SuppCharacter = cop_suppType.Text;
Supp_Entity.SuppRegistrarName = txt_SUPPREGISTRARNAME.Text;
//Supp_Entity.SuppNationality = txt_SUPPNATIONALITY.Text;
Supp_Entity.SuppNationalityCode = txt_SUPPNATIONALITY.Value == null ? null : txt_SUPPNATIONALITY.Value.ToString().Trim();
//Supp_Entity.SuppProvince = txt_SUPPPROVINCE.Text;
Supp_Entity.SuppProvinceCode = txt_SUPPPROVINCE.Value == null ? null : txt_SUPPPROVINCE.Value.ToString().Trim();
Supp_Entity.SuppCity = txt_SUPPCITY.Text;
//Supp_Entity.SuppOfficeProvince = txt_SUPPOFFICEPROVINCE.Text;
Supp_Entity.SuppOfficeProvinceCode = txt_SUPPOFFICEPROVINCE.Value == null ? null : txt_SUPPOFFICEPROVINCE.Value.ToString().Trim();
//if (txt_SUPPSTARTDATE.Text == "" || txt_SUPPSTARTDATE.Text == null)
//{
// txt_SUPPSTARTDATE.Text = "";
//}
//else
//{
// Supp_Entity.SuppStartDate = Convert.ToDateTime(this.txt_SUPPSTARTDATE.Text).ToShortDateString();
//}
//if (txt_SUPPENDDATE.Text == "" || txt_SUPPENDDATE.Text==null)
//{
// txt_SUPPENDDATE.Text = "";
//}
//else
//{
// Supp_Entity.SuppEndDate = Convert.ToDateTime(this.txt_SUPPENDDATE.Text).ToShortDateString();
//}
//if (txt_SUPPTAXSTARTDATE.Text == "" || txt_SUPPTAXSTARTDATE.Text == null)
//{
// txt_SUPPTAXSTARTDATE.Text = "";
//}
//else
//{
// Supp_Entity.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPTAXSTARTDATE.Text).ToShortDateString();
//}
//if (txt_SUPPTAXENDDATE.Text == "" || txt_SUPPTAXENDDATE.Text == null)
//{
// txt_SUPPTAXENDDATE.Text = "";
//}
//else
//{
// Supp_Entity.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPTAXENDDATE.Text).ToShortDateString();
//}
if (txt_SUPPLICSTARTDATE.Text == "" || txt_SUPPLICSTARTDATE.Text == null)
{
txt_SUPPLICSTARTDATE.Text = "";
}
else
{
Supp_Entity.SuppStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
Supp_Entity.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
Supp_Entity.SuppLicStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
}
if (txt_SUPPLICENDDATE.Text == "" || txt_SUPPLICENDDATE.Text== null)
{
txt_SUPPLICENDDATE.Text = "";
}
else
{
Supp_Entity.SuppEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
Supp_Entity.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
Supp_Entity.SuppLicEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
}
Supp_Entity.SuppLicNum = this.txt_SUPPLICNUM.Text;//营业执照
Supp_Entity.SuppOperateScope = txt_SUPPOPERATESCOPE.Text;
Supp_Entity.SupplierLinkMan = txt_SUPPLIERLINKMAN.Text;
Supp_Entity.SuppContactCellPhone = txt_SUPPCONTACTCELLPHONE.Text;
Supp_Entity.SuppContactEmail = txt_SUPPCONTACTEMAIL.Text;
Supp_Entity.SuppContactFax = txt_SUPPCONTACTFAX.Text;
Supp_Entity.SuppContactTel = txt_SUPPCONTACTTEL.Text;
Supp_Entity.SuppContactTitle = txt_SUPPCONTACTTITLE.Text;
Supp_Entity.SuppIsInternal = txt_SUPPISINTERNAL.Value==null?"0":txt_SUPPISINTERNAL.Value.ToString();
Supp_Entity.SuppIsManufacturer = txt_SUPPISMANUFACTURER.Value == null ? "0" : txt_SUPPISMANUFACTURER.Value.ToString();
Supp_Entity.SuppIsSubCompany = txt_SUPPISSUBCOMPANY.Value == null ? "0" : txt_SUPPISSUBCOMPANY.Value.ToString();
Supp_Entity.SuppIndustryType = txt_SUPPINDUSTRYTYPE.Text;
Supp_Entity.SuppRegCapCurrency = txt_SUPPREGCAPCURRENCY.Text.ToString().Trim();
Supp_Entity.SuppType = txt_suppType.Value.ToString().Trim();
double bSuppRegCapital = 0;
double.TryParse(txt_SUPPREGCAPITAL.Text,out bSuppRegCapital);
Supp_Entity.SuppRegCapital = bSuppRegCapital;
Supp_Entity.SuppRelationGrade = txt_SUPPRELATIONGRADE.Text;
Supp_Entity.SuppPerGrade = txt_SUPPPERGRADE.Value == null ? null : txt_SUPPPERGRADE.Value.ToString().Trim();
Supp_Entity.SuppAddress = txt_SUPPADDRESS.Text;
Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
Supp_Entity.UpdateTime = System.DateTime.Now;
Supp_Entity.SuppAddPostal = txt_postAdd.Text.Trim();
Supp_Entity.AccountCw = txt_account_cw.Text.Trim();
Supp_Entity.BalanceCode = txt_balanceCode.Text.ToString().Trim();
if (txt_suppTaxRate.Value.ToString().Trim() == null || txt_suppTaxRate.Value.ToString().Trim() == "")
{
MessageUtil.ShowTips("请选择税率");
txt_suppTaxRate.Focus();
//return;
}
Supp_Entity.SuppTaxRate = txt_suppTaxRate.Value.ToString().Trim();
if (MessageBox.Show("是否需要修改供应商【" + strsuppname + "】的信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
CoreResult rt = this.execute("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
if (rt.Resultcode != 0)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("修改信息失败:" + rt.Resultmsg);
return;
}
// 更新数据到计量系统
string json = JSONFormat.Format(Supp_Entity);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
ccp.MethodName = "update";
ccp.ServerParams = new object[] { json };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改成功!");
GetPUR_SUPP();
ConfigureClassCommon.doActiveSelRow(ultraGrid1, "SUPPNAME", strsuppname);
}
}
else if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[1])
{
UltraGridRow ugc = ultraGrid2.ActiveRow;
if (ugc == null)
{
MessageUtil.ShowTips("请选择供应商开户行");
return;
}
SuppBank Banks = new SuppBank();
Banks.Id = ugc.GetCellValue("id").ToString().Trim();
if (String.IsNullOrEmpty(Banks.Id))
{
MessageUtil.ShowTips("请选择供应商开户行编码为空");
return;
}
Banks.BankAccount = txt_BANKACCOUNT.Text.Trim();
Banks.BankName = txt_BANKNAME.Text.Trim();
Banks.PayTypeName = txtPayType.Text.Trim();
if (String.IsNullOrEmpty(Banks.BankAccount))
{
MessageUtil.ShowTips("开户行账号不能为空");
txt_BANKACCOUNT.Focus();
return;
}
if (String.IsNullOrEmpty(Banks.BankName))
{
MessageUtil.ShowTips("开户行名称不能为空");
txt_BANKNAME.Focus();
return;
}
if (!StringUtil.IsOnlyLetterAndDigit(Banks.BankAccount))
{
MessageUtil.ShowWarning("开户行账号只能包含字母与数字");
txt_BANKACCOUNT.Focus();
return;
}
Banks.SuppCode = StrnewsuppCode;
Banks.SuppName = uge.Cells["suppName"].Value.ToString().Trim();
Banks.SuppShortName = uge.Cells["suppShortName"].Value.ToString().Trim();
if (MessageBox.Show("确定修改供应商【" + Banks.SuppName + "】的该条开户行?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
CoreResult rt = this.execute("com.hnshituo.pur.configure.service.SuppBankService", "doUpdate", new object[] { Banks });
if (rt.Resultcode != 0)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改失败!" + rt.Resultmsg);
return;
}
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改成功!");
SuppBank YY = new SuppBank();
YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
DataTable dt = this.execute("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY, 0, 0 });
GridHelper.CopyDataToDatatable(dt, dataTable2, true);
ConfigureClassCommon.doActiveSelRow(ultraGrid2, "BANKACCOUNT", Banks.BankAccount);
}
}
else if ((ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[2]))
{
SuppAptitude Aptis = new SuppAptitude();
Aptis.CertDesc = txt_CERTDESC.Text;
Aptis.CertiConstraint = txt_ap_constraint.Text;
Aptis.CertiOfficer = txt_CERTIOFFICER.Text;
Aptis.CertNo = txt_CERTNO.Text;
Aptis.CertType = txt_ap_type.Text;
Aptis.CertValidStart =Convert.ToDateTime(txt_CERTVALID_start.Value);
Aptis.CertValidEnd = Convert.ToDateTime(txt_CERTVALID_end.Value);
Aptis.SuppCode = StrnewsuppCode;
Aptis.SuppName = uge.Cells["suppName"].Value.ToString();
Aptis.SuppShortName = uge.Cells["suppShortName"].Value.ToString();
Aptis.CertNoV = txt_certNo_v.Text.ToString().Trim();
Aptis.CertPath = txt_certPath.Text.ToString().Trim();
Aptis.CertPathOld = txt_certpath_old.Text.ToString().Trim();
Aptis.Id = ultraGrid3.ActiveRow.Cells["id"].Text.ToString().Trim();
if (MessageBox.Show("是否需要修改供应商ID为[" + Aptis.SuppCode + "]的资质信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
CoreResult rt1 = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "doUpdate", new object[] { Aptis });
if (rt1.Resultcode != 0)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("修改失败!" + rt1.Resultmsg);
return;
}
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改成功!");
SuppAptitude YY = new SuppAptitude();
YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
DataTable dt1 = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { YY, 0, 0 });
GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
ConfigureClassCommon.doActiveSelRow(ultraGrid3, "CERTNOV", Aptis.CertNoV);
}
}
}
catch (Exception e)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改信息失败!"+ e);
return;
}
}
///
/// 新增
///
private void AddPUR_SUPP()//新增
{
try
{
if (ultraTabControl1.SelectedTab.Text == ultraTabControl1.Tabs[0].Text )
{
if (txt_SUPPNAME.Value == null)
{
MessageUtil.ShowWarning("供应商名称不能为空");
return;
}
Supp Supp_Entity = new Supp();
Supp_Entity.SuppName = txt_SUPPNAME.Text.Trim();
//信息验证
//if (isExsitRow("com.hnshituo.pur.configure.service.SuppService", Supp_Entity) > 0)
//{
// MessageUtil.ShowTips("添加失败 " + "数据库中已存在相同的供应商名称");
// return;
//}
if (TestSupp() == false)
{
return;
}
Supp_Entity.SuppCode = txt_SUPPCODE.Text.ToString().Trim();
Supp_Entity.Account = txt_SUPPCODE.Text.ToString().Trim().ToLower();
//Supp_Entity.OrgCode = txt_ORGCODE.Text;
Supp_Entity.OrgCode = txt_SUPPLICNUM.Text;//组织机构代码
Supp_Entity.SuppShortName = txt_SUPPSHORTNAME.Text;
//Supp_Entity.SuppTaxId = txt_SUPPTAXID.Text;
Supp_Entity.SuppTaxId = txt_SUPPLICNUM.Text;//税号
Supp_Entity.SuppCharacter = cop_suppType.Text;
Supp_Entity.SuppRegistrarName = txt_SUPPREGISTRARNAME.Text;
//Supp_Entity.SuppNationality = txt_SUPPNATIONALITY.Text;
Supp_Entity.SuppNationalityCode = txt_SUPPNATIONALITY.Value==null?null:txt_SUPPNATIONALITY.Value.ToString().Trim();
//Supp_Entity.SuppProvince = txt_SUPPPROVINCE.Text;
Supp_Entity.SuppProvinceCode = txt_SUPPPROVINCE.Value == null ? null : txt_SUPPPROVINCE.Value.ToString().Trim();
Supp_Entity.SuppCity = txt_SUPPCITY.Text;
//Supp_Entity.SuppOfficeProvince = txt_SUPPOFFICEPROVINCE.Text;
Supp_Entity.SuppOfficeProvinceCode = txt_SUPPOFFICEPROVINCE.Value == null ? null : txt_SUPPOFFICEPROVINCE.Value.ToString().Trim();
Supp_Entity.SuppStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Value).ToShortDateString();
Supp_Entity.SuppEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Value).ToShortDateString();
Supp_Entity.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Value).ToShortDateString();
Supp_Entity.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Value).ToShortDateString();
Supp_Entity.SuppLicStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Value).ToShortDateString();
Supp_Entity.SuppLicEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Value).ToShortDateString();
Supp_Entity.SuppLicNum = this.txt_SUPPLICNUM.Text;
Supp_Entity.SuppOperateScope = txt_SUPPOPERATESCOPE.Text;
Supp_Entity.SupplierLinkMan = txt_SUPPLIERLINKMAN.Text;
Supp_Entity.SuppContactCellPhone = txt_SUPPCONTACTCELLPHONE.Text;
Supp_Entity.SuppContactEmail = txt_SUPPCONTACTEMAIL.Text;
Supp_Entity.SuppContactFax = txt_SUPPCONTACTFAX.Text;
Supp_Entity.SuppContactTel = txt_SUPPCONTACTTEL.Text;
Supp_Entity.SuppContactTitle = txt_SUPPCONTACTTITLE.Text;
Supp_Entity.SuppIsInternal = txt_SUPPISINTERNAL.Value == null ? null : txt_SUPPISINTERNAL.Value.ToString();
Supp_Entity.SuppIsManufacturer = txt_SUPPISMANUFACTURER.Value == null ? null : txt_SUPPISMANUFACTURER.Value.ToString();
Supp_Entity.SuppIsSubCompany = txt_SUPPISSUBCOMPANY.Value == null ? null : txt_SUPPISSUBCOMPANY.Value.ToString();
Supp_Entity.SuppIndustryType = txt_SUPPINDUSTRYTYPE.Text;
Supp_Entity.SuppRegCapCurrency = txt_SUPPREGCAPCURRENCY.Value.ToString();
Supp_Entity.SuppRegCapital =txt_SUPPREGCAPITAL.Value==null?0:Convert.ToInt32(txt_SUPPREGCAPITAL.Text);
Supp_Entity.SuppRelationGrade = txt_SUPPRELATIONGRADE.Text;
Supp_Entity.SuppPerGrade = txt_SUPPPERGRADE.Value == null ? null : txt_SUPPPERGRADE.Value.ToString().Trim();
Supp_Entity.SuppAddress = txt_SUPPADDRESS.Text;
Supp_Entity.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
Supp_Entity.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
Supp_Entity.CreateTime = System.DateTime.Now;
Supp_Entity.SuppType = txt_suppType.Value.ToString().Trim();
Supp_Entity.Status = "1";
Supp_Entity.SuspendStatus = "0";
Supp_Entity.Validflag = "1";
Supp_Entity.SuppAddPostal = txt_postAdd.Text.Trim();
Supp_Entity.AccountCw = txt_account_cw.Text.Trim();
if (txt_suppTaxRate.Value.ToString().Trim() == null || txt_suppTaxRate.Value.ToString().Trim() == "")
{
MessageUtil.ShowTips("请选择税率");
txt_suppTaxRate.Focus();
return;
}
Supp_Entity.SuppTaxRate = txt_suppTaxRate.Value.ToString().Trim();
Supp_Entity.BalanceCode = txt_balanceCode.Text.ToString().Trim();
CoreResult cr = this.execute("com.hnshituo.pur.configure.service.SuppService", "insert_Supp", new object[] { Supp_Entity });
if (cr.Resultcode != 0)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!"+cr.Resultmsg);
return;
}
// 添加数据到计量系统
string json = JSONFormat.Format(Supp_Entity);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
ccp.MethodName = "insert";
ccp.ServerParams = new object[] { json };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
MessageUtil.ShowWarning("添加成功!");
GetPUR_SUPP();
Pur.configure.ConfigureClassCommon.doActiveSelRow(ultraGrid1, "SuppName", Supp_Entity.SuppName);
}
else if (ultraTabControl1.SelectedTab.Text == ultraTabControl1.Tabs[3].Text)
{
UltraGridRow uge = ultraGrid1.ActiveRow;
SuppRate suppRate = new SuppRate();
suppRate.Id = System.Guid.NewGuid().ToString("N");
suppRate.SuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
suppRate.Rate = Combo_Rate.Text;
suppRate.RateYear = txt_Rate_Year.Text;
suppRate.ValidFlag = "1";
suppRate.CreateName = UserInfo.GetUserName();
suppRate.CreateTime = System.DateTime.Now;
CoreResult cr = this.execute("com.hnshituo.pur.configure.service.SuppRateService", "doInsert", new object[] { suppRate });
if (cr.Resultcode != 0)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!" + cr.Resultmsg);
return;
}
MessageUtil.ShowWarning("添加成功!");
GetPUR_SUPP();
} else
{
UltraGridRow uge = ultraGrid1.ActiveRow;
if (uge == null)
{
MessageUtil.ShowTips("请选择需要新增银行或者资质信息的供应商");
return;
}
String StrnewsuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
if (uge.Cells["SuspendStatus"].Value.ToString() == "暂挂")
{
MessageUtil.ShowTips("信息已暂挂,无权限进行增删!");
return;
}
Supp sc = this.execute("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { StrnewsuppCode });
if (sc == null)
{
MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据不存在或异常,或请刷新页面再操作");
return;
}
if (sc.Validflag == "0")
{
MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据可能被废除,或请刷新页面再操作");
return;
}
if (sc.SuspendStatus == "1")
{
MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】被暂挂,无权限增删改,或请刷新页面再操作");
return;
}
if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[1])
{
String strAccount = txt_BANKACCOUNT.Text.Trim();
String strAccountName = txt_BANKNAME.Text.Trim();
String strPay = "";
if(txtPayType.Text.Trim()!=""||txtPayType.Text.Trim()!=null)
{
strPay = txtPayType.Text.Trim();
}
if (String.IsNullOrEmpty(strAccount))
{
MessageUtil.ShowWarning("开户行账号不能为空");
txt_BANKACCOUNT.Focus();
return;
}
if (String.IsNullOrEmpty(strAccountName))
{
MessageUtil.ShowWarning("开户行名称不能为空");
txt_BANKNAME.Focus();
return;
}
if (!StringUtil.IsOnlyLetterAndDigit(strAccount))
{
MessageUtil.ShowWarning("开户行账号只能包含字母与数字");
txt_BANKACCOUNT.Focus();
return;
}
SuppBank Banks = new SuppBank();
Banks.BankAccount = strAccount;
Banks.BankName = strAccountName;
Banks.PayTypeName = strPay;
Banks.SuppCode = uge.Cells["suppCode"].Value.ToString().Trim();
Banks.SuppName = uge.Cells["suppName"].Value.ToString().Trim();
Banks.SuppShortName = uge.Cells["suppShortName"].Value.ToString().Trim();
Banks.Id = uge.Cells["suppCode"].Value.ToString() + strAccount;
Banks.Validflag = "1";
SuppBank CC2= new SuppBank();
CC2.SuppCode = StrnewsuppCode;
CC2.PayTypeName = strPay;
CC2.Validflag = "1";
int count2 = this.execute("com.hnshituo.pur.configure.service.SuppBankService", "count", new object[] { CC2 });
if (count2 > 0)
{
MessageUtil.ShowTips("该供应商的有效开户行信息只能有一个,请先作废该供应商当前有效的开户行信息再添加");
return;
}
CoreResult rt = this.execute("com.hnshituo.pur.configure.service.SuppBankService", "insert_SuppBank", new object[] { Banks });
if (rt.Resultcode != 0)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!" + rt.Resultmsg);
return;
}
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加成功!");
SuppBank YY = new SuppBank();
YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
DataTable dt = this.execute("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY, 0, 0 });
GridHelper.CopyDataToDatatable(dt, dataTable2, true);
ConfigureClassCommon.doActiveSelRow(ultraGrid2, "BANKACCOUNT", Banks.BankAccount);
}
else
{
//if (txt_CERTNO.Value == null)
//{
// MessageUtil.ShowWarning("证书编号不能为空");
// return;
//}
//SuppAptitude CC = new SuppAptitude();
//CC.SuppCode = uge.Cells["suppCode"].Value.ToString();
//DataTable dtC1 = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { CC, 0, 0 });
//for (int i = 0; i < dtC1.Rows.Count; i++)
//{
// if (dtC1.Rows[i]["CertNo"].Equals(txt_CERTNO.Text))
// {
// MessageUtil.ShowTips("证书编号不能重复,请核实后在操作!");
// return;
// }
//}
//SuppAptitude Aptis = new SuppAptitude();
//Aptis.CertDesc = txt_CERTDESC.Text;
//Aptis.CertiConstraint = txt_ap_constraint.Text;
//Aptis.CertiOfficer = txt_CERTIOFFICER.Text;
//Aptis.CertNo = txt_CERTNO.Text;
//Aptis.CertType = txt_ap_type.Text;
//Aptis.CertValidStart = Convert.ToDateTime(txt_CERTVALID_start.Value);
//Aptis.CertValidEnd = Convert.ToDateTime(txt_CERTVALID_end.Value);
//Aptis.SuppCode = uge.Cells["suppCode"].Value.ToString();
//Aptis.SuppName = uge.Cells["suppName"].Value.ToString();
//Aptis.SuppShortName = uge.Cells["suppShortName"].Value.ToString();
//Aptis.ArchCode = txt_arch_code.Text;
////Aptis.Id = uge.Cells["suppCode"].Value.ToString() + txt_CERTNO.Text;//后台生成
////txt_certNo_v.Text = uge.Cells["CERTNOV"].Value.ToString();
////txt_certpath_old.Text = uge.Cells["CERTPATHOLD"].Value.ToString();
////craftImg.Text = uge.Cells["CERTPATH"].Value.ToString();
//Aptis.CertNoV = txt_certNo_v.Text.ToString().Trim();
//Aptis.CertPath = txt_certPath.Text.ToString().Trim();
//Aptis.CertPathOld = txt_certpath_old.Text.ToString().Trim();
//CoreResult rt1 = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "insert_SuppAptitude", new object[] { Aptis });
//if (rt1.Resultcode != 0)
//{
// Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!" + rt1.Resultmsg);
// return;
//}
//Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加成功!");
//SuppAptitude YY = new SuppAptitude();
//YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
//DataTable dt1 = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { YY, 0, 0 });
//GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
//ConfigureClassCommon.doActiveSelRow(ultraGrid3, "CERTNOV", Aptis.CertNoV);
//Info();
//UpdateSupp();
MessageUtil.ShowTips("请点击上传按钮!");
return;
}
}
}
catch (Exception e)
{
Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!"+e);
return;
}
}
///
/// 查询
///
private void GetPUR_SUPP()//查询
{
try
{
dataTable1.Clear();
dataTable2.Clear();
dataTable3.Clear();
dataTable4.Clear();
Supp suppE = new Supp();
suppE.SuppName = textBox1.Text.ToString().Trim();
suppE.SupplierLinkMan = textBox2.Text.ToString().Trim();
suppE.SuppCode = textBox3.Text.ToString().Trim();
if (Qstatus.SelectedIndex != -1)
{
suppE.Status = Qstatus.Value.ToString().Trim();
}
if (QsuspendStatus.SelectedIndex != -1)
{
suppE.SuspendStatus = QsuspendStatus.Value.ToString().Trim();
}
if (cop_suppType.SelectedIndex != -1)
{
suppE.SuppType = cop_suppType.Value.ToString().Trim();
}
suppE.Validflag = "1";
DataTable dt = this.execute("com.hnshituo.pur.configure.service.SuppService", "get_Supp", new object[] { suppE, 0, 0 });
GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);//绑定物料分类表
foreach (UltraGridRow urg in ultraGrid1.Rows)
{
if (urg.Cells["end"].Value.Equals("1"))
{
urg.Appearance.BackColor = Color.Red;
}
if (urg.Cells["end"].Text.Equals("2"))
{
urg.Appearance.BackColor = Color.Yellow;
}
}
GridHelper.RefreshAndAutoSize(ultraGrid1);
}
catch (Exception ex)
{
MessageUtil.ShowTips("查询失败:"+ex);
}
}
#endregion
#region 控件事件
///
/// 点击表格事件
///
///
///
int SQ = 0;//判断删除前点击那个界面
private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
{
ClearTab();
UltraGridRow uge = ultraGrid2.ActiveRow;
if (uge == null)
return;
txt_BANKACCOUNT.Text = uge.Cells["BANKACCOUNT"].Value.ToString();
txt_BANKNAME.Text = uge.Cells["BANKNAME"].Value.ToString();
}
private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
{
ClearTab();
UltraGridRow uge = ultraGrid3.ActiveRow;
if (uge == null)
return;
txt_CERTNO.Text = uge.Cells["CERTNO"].Value.ToString();
txt_CERTDESC.Text = uge.Cells["CERTDESC"].Value.ToString();
txt_CERTIOFFICER.Text = uge.Cells["CERTIOFFICER"].Value.ToString();
txt_ap_constraint.Text = uge.Cells["CERTICONSTRAINT"].Value.ToString();
txt_ap_type.Text = uge.Cells["CERTTYPE"].Value.ToString();
txt_CERTVALID_start.Value = uge.Cells["CERTVALIDSTART"].Value.ToString();
txt_CERTVALID_end.Value = uge.Cells["CERTVALIDEND"].Value.ToString();
txt_certNo_v.Text = uge.Cells["CERTNOV"].Value.ToString();
txt_certpath_old.Text = uge.Cells["CERTPATHOLD"].Value.ToString();
txt_certPath.Text = uge.Cells["CERTPATH"].Value.ToString();
txt_arch_code.Text = uge.Cells["archCode"].Value.ToString();
}
private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
{
dataTable2.Clear();
dataTable3.Clear();
dataTable4.Clear();
ClearTab();
ClearTabM();
ClearTab5();
UltraGridRow uge = ultraGrid1.ActiveRow;
if (uge == null)
return;
Supp suppone = new Supp();
suppone.SuppCode = uge.Cells["SUPPCODE"].Value.ToString();
Supp suppone_entity = this.execute("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { uge.Cells["SUPPCODE"].Value.ToString() });
txt_SUPPISSUBCOMPANY.Value = suppone_entity.SuppIsSubCompany;//创建时间
txt_SUPPISMANUFACTURER.Value = suppone_entity.SuppIsManufacturer;//创建人
txt_SUPPISINTERNAL.Value = suppone_entity.SuppIsInternal;//采购管理科室描叙
txt_SUPPADDRESS.Text = suppone_entity.SuppAddress;//供应商名称
txt_SUPPRELATIONGRADE.Value = suppone_entity.SuppRelationGrade;//供应商代码
txt_SUPPPERGRADE.Value = suppone_entity.SuppPerGrade;//是否暂挂1:暂挂 0:正常
txt_SUPPREGCAPCURRENCY.Value = suppone_entity.SuppRegCapCurrency;//废除时间
txt_SUPPREGCAPITAL.Value = suppone_entity.SuppRegCapital;//废除人
txt_SUPPLICENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppLicEndDate);//采购管理部门描叙
txt_SUPPTAXENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppTaxEndDate);//管理科室代码
txt_SUPPLICSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppLicStartDate);//采购管理部门代码
txt_SUPPENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppEndDate);//管理部门代码
txt_SUPPSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppStartDate);//供应商信用等级
txt_SUPPTAXSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppTaxStartDate);//管理部门描叙
txt_SUPPOPERATESCOPE.Text = suppone_entity.SuppOperateScope;//采购管理科室代码
txt_SUPPLICNUM.Text = suppone_entity.SuppLicNum;//管理科室描叙
txt_SUPPCITY.Text = suppone_entity.SuppCity;//供应商联系人职务
txt_SUPPREGISTRARNAME.Text = suppone_entity.SuppRegistrarName;//供应商联系人电话
txt_SUPPSHORTNAME.Text = suppone_entity.SuppShortName;//供应商地址邮编
txt_ORGCODE.Text = suppone_entity.OrgCode;//供应商地址
txt_SUPPPROVINCE.Value = suppone_entity.SuppProvinceCode;//供应商省份
cop_suppType.Text = suppone_entity.SuppCharacter;//供应商联系人传真
txt_SUPPNAME.Text = suppone_entity.SuppName;//供应商合作关系等级
txt_SUPPINDUSTRYTYPE.Text = suppone_entity.SuppIndustryType;//修改人
txt_SUPPOFFICEPROVINCE.Value = suppone_entity.SuppOfficeProvinceCode;//供应商办公省份
txt_SUPPNATIONALITY.Value = suppone_entity.SuppNationalityCode;//供应商国家
txt_SUPPTAXID.Text = suppone_entity.SuppTaxId;//供应商联系人名称
txt_SUPPCODE.Text = suppone_entity.SuppCode;//供应商评定等级
txt_suppType.Value = suppone_entity.SuppType;
txt_SUPPCONTACTTITLE.Text = suppone_entity.SuppContactTitle;//供应商联系人职务
txt_SUPPCONTACTTEL.Text = suppone_entity.SuppContactTel;//供应商联系人电话
txt_SUPPCONTACTFAX.Text = suppone_entity.SuppContactFax;//供应商联系人传真
txt_SUPPCONTACTCELLPHONE.Text = suppone_entity.SuppContactCellPhone;//供应商联系人手机
txt_SUPPCONTACTEMAIL.Text = suppone_entity.SuppContactEmail;//供应商联系人EMAIL
txt_SUPPLIERLINKMAN.Text = suppone_entity.SupplierLinkMan;//供应商联系人名称
txt_suppTaxRate.Value = suppone_entity.SuppTaxRate;//税率
txt_postAdd.Text = suppone_entity.SuppAddPostal;
txt_account_cw.Text = suppone_entity.AccountCw;
txt_balanceCode.Text = suppone_entity.BalanceCode;//结算代码
String strSuppCode=uge.Cells["suppCode"].Value.ToString();
getSuppAptitude(strSuppCode,"");
SuppBank YY1 = new SuppBank();
YY1.SuppCode = strSuppCode;
YY1.Validflag = "1";
DataTable dt = this.execute("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY1, 0, 0 });
GridHelper.CopyDataToDatatable(dt, dataTable2, true);
GridHelper.RefreshAndAutoSize(ultraGrid2);
MatEntity mat = new MatEntity();
mat.Remark2 = strSuppCode;
mat.Validflag = "1";
DataTable dt_mat = this.execute("com.hnshituo.pur.configure.service.MatService", "getMat", new object[] { mat});
GridHelper.CopyDataToDatatable(dt_mat, dataTable4, true);
GridHelper.RefreshAndAutoSize(ultraGrid4);
SuppRate suppRate = new SuppRate();
suppRate.SuppCode = strSuppCode;
suppRate.ValidFlag = "1";
DataTable dt_rate = this.execute("com.hnshituo.pur.configure.service.SuppRateService", "find", new object[] { suppRate, 0, 0 });
GridHelper.CopyDataToDatatable(dt_rate, dataTable5, true);
GridHelper.RefreshAndAutoSize(ultraGrid5);
}
private void ClearTabM()
{
publicPms.clearOldData(ultraTabPageControl1,new string[]{});
//txt_SUPPISSUBCOMPANY.SelectedIndex = -1;//创建时间
//txt_SUPPISMANUFACTURER.SelectedIndex = -1;//创建人
//txt_SUPPISINTERNAL.SelectedIndex = -1;//采购管理科室描叙
//txt_SUPPADDRESS.Clear();//供应商名称
//txt_SUPPRELATIONGRADE.SelectedIndex = -1;//供应商代码
//txt_SUPPPERGRADE.SelectedIndex = -1;
//txt_SUPPREGCAPCURRENCY.SelectedIndex = -1;//废除时间
//txt_SUPPREGCAPITAL.Clear();//废除人
txt_SUPPLICENDDATE.Value = DateTime.Now.AddYears(2);//采购管理部门描叙
txt_SUPPTAXENDDATE.Value = DateTime.Now.AddYears(2);//管理科室代码
//txt_SUPPLICSTARTDATE.Value = DateTime.Now;//采购管理部门代码
txt_SUPPENDDATE.Value = DateTime.Now.AddYears(2);//管理部门代码
//txt_SUPPSTARTDATE.Value = DateTime.Now; ;//供应商信用等级
//txt_SUPPTAXSTARTDATE.Value = DateTime.Now; ;//管理部门描叙
//txt_SUPPOPERATESCOPE.Clear();//采购管理科室代码
//txt_SUPPLICNUM.Clear();//管理科室描叙
//txt_SUPPCITY.Clear();//供应商联系人职务
//txt_SUPPREGISTRARNAME.Clear();//供应商联系人电话
//txt_SUPPSHORTNAME.Clear();//供应商地址邮编
//txt_ORGCODE.Clear();//供应商地址
//txt_SUPPPROVINCE.SelectedIndex = -1;//供应商省份
//cop_suppType.Clear();//供应商联系人传真
//txt_SUPPNAME.Clear();//供应商合作关系等级
//txt_SUPPINDUSTRYTYPE.Clear();//修改人
//txt_SUPPOFFICEPROVINCE.SelectedIndex = -1;//供应商办公省份
//txt_SUPPNATIONALITY.SelectedIndex = -1;//供应商国家
//txt_SUPPTAXID.Clear();//供应商联系人名称
//txt_SUPPCODE.Clear();//供应商评定等级
//txt_suppType.SelectedIndex = -1;
//txt_SUPPCONTACTTITLE.Clear();//供应商联系人职务
//txt_SUPPCONTACTTEL.Clear();//供应商联系人电话
//txt_SUPPCONTACTFAX.Clear();//供应商联系人传真
//txt_SUPPCONTACTCELLPHONE.Clear();//供应商联系人手机
//txt_SUPPCONTACTEMAIL.Clear();//供应商联系人EMAIL
//txt_SUPPLIERLINKMAN.Clear();//供应商联系人名称
//txt_suppTaxRate.SelectedIndex = -1;//税率
//txt_postAdd.Clear();
//txt_account_cw.Clear();
}
private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
{
this.ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[0];
SQ = 1;
}
private void ultraGrid2_ClickCell(object sender, ClickCellEventArgs e)
{
SQ = 2;
this.ultraTabControl1.SelectedTab = ultraTabPageControl3.Tab;
}
private void ultraGrid3_ClickCell(object sender, ClickCellEventArgs e)
{
SQ = 3;
this.ultraTabControl1.SelectedTab = ultraTabPageControl4.Tab;
}
private void ultraGrid5_ClickCell(object sender, ClickCellEventArgs e)
{
SQ = 5;
this.ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[3];
}
private void txt_SUPPLICSTARTDATE_BeforeDropDown(object sender, CancelEventArgs e)
{
}
/////
///// 洲际筛选事件
/////
/////
/////
//private void txt_island_ValueChanged(object sender, EventArgs e)
//{
// try
// {
// String strisland = txt_island.Text.ToString().Trim();
// //AdminRegion ar = new AdminRegion();
// //ar.Validflag = "1";
// //DataTable dt = this.execute("com.hnshituo.pur.configure.service.AdminRegionService", "find", new object[] { ar, 0, 0 });
// //FillComboxItems(txt_island, dt, "regionNo", "regionNm", "regionType='A'");
// FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType='A' AND regionNm like '%" + strisland + "%'");
// }
// catch(Exception ex)
// {
// //MessageUtil.ShowTips("地点数据加载失败");
// }
//}
///
/// 根据洲际对省份和国家进行筛选
///
///
///
private void txt_island_SelectionChanged(object sender, EventArgs e)
{
try
{
String strisland = txt_island.Value.ToString().Trim();
FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType='AC' AND pRegionNo like '" + strisland + "%'");
FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND pRegionNo like '" + strisland + "%'");
}
catch (Exception ex)
{
//MessageUtil.ShowTips("地点数据加载失败");
}
}
/////
///// 国家选择事件
/////
/////
/////
//private void txt_SUPPNATIONALITY_ValueChanged(object sender, EventArgs e)
//{
// try
// {
// String strsuppNationName = txt_SUPPNATIONALITY.Text.ToString().Trim();
// FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType ='AC' AND regionNm like '%" + strsuppNationName + "%'");
// }
// catch (Exception ex)
// {
// }
//}
///
/// 国家选择事件对省份进行晒选
///
///
///
private void txt_SUPPNATIONALITY_SelectionChanged(object sender, EventArgs e)
{
try
{
String strsuppNationCode = txt_SUPPNATIONALITY.Value.ToString().Trim();
//FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType = 'A' AND regionNo like '" + strsuppNationCode.Substring(0,1) + "%'");
FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND pRegionNo like '%" + strsuppNationCode + "%'");
}
catch(Exception ex)
{}
//}
/////
///// 省份选择事件
/////
/////
/////
//private void txt_SUPPPROVINCE_ValueChanged(object sender, EventArgs e)
//{
// try
// {
// String strproName = txt_SUPPPROVINCE.Text.ToString().Trim();
// FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND regionNm like '%" + strproName + "%'");
// }
// catch (Exception ex)
// {
// }
}
///
/// 省份选择对洲际和国家进行筛选
///
///
///
private void txt_SUPPPROVINCE_SelectionChanged(object sender, EventArgs e)
{
try
{
String txt_SUPPPROVINCECode = txt_SUPPPROVINCE.Value.ToString().Trim();
String tr1 = txt_SUPPPROVINCECode.Substring(0,1);
String tr2 = txt_SUPPPROVINCECode.Substring(0,3);
//FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType = 'A' AND regionNo like '" + tr1 + "%'");
FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType='AC' AND regionNo like '" + tr2 + "%'");
}
catch (Exception ex)
{ }
}
/////
///// 办公国家选择(对办公地点进行筛选)
/////
/////
/////
//private void txt_SUPPOFFICEPROVINCENATION_ValueChanged(object sender, EventArgs e)
//{
// try
// {
// String strsuppNationName = txt_SUPPOFFICEPROVINCENATION.Text.ToString().Trim();
// FillComboxItems(txt_SUPPOFFICEPROVINCENATION, regions, "regionNo", "regionNm", "regionType ='AC' AND regionNm like '%" + strsuppNationName + "%'");
// }
// catch (Exception ex)
// {
// }
//}
private void txt_SUPPOFFICEPROVINCENATION_SelectionChanged(object sender, EventArgs e)
{
try
{
String strsuppNationCode = txt_SUPPOFFICEPROVINCENATION.Value.ToString().Trim();
FillComboxItems(txt_SUPPOFFICEPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND pRegionNo like '%" + strsuppNationCode + "%'");
}
catch (Exception ex)
{ }
}
#endregion
#region 正则表达式
/**
* 是否为小数
*
* */
public bool Isdecimal(string str)
{
decimal y;
return decimal.TryParse(str, out y);
}
///
/// 是否为整数
///
///
///
public bool IsInts(string str)
{
int y;
return int.TryParse(str, out y);
}
///
/// 手机/电话号码的验证
///
///
///
public bool isTelPhoneNum(String str)
{
//return Regex.IsMatch(str, @"^1[358][0-9]{9}$") || Regex.IsMatch(str, @"^(\d{3.4}-)\d{7,8}$|1[358][0-9]{9}$");
return Regex.IsMatch(str, @"^(\d{3,4}-)\d{7,8}$|1[358][0-9]{9}$");
//Regex rx = new Regex(@"((d{3,4})|d{3,4}-)?d{7,8}(-d{3})*");
// return rx.IsMatch(str);
}
//身份证的验证
public bool isId(String str)
{
return Regex.IsMatch(str, @"^\d{15}|\d{18}$");
}
//邮箱的验证
public bool isEmail(String str)
{
return Regex.IsMatch(str, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$");
}
///
/// 判断数据库中是否存在相同的列
///
///
///
/// true存在
public int isExsitRow(string strJavaPackName, object o)
{
DataTable dt = this.execute(strJavaPackName, "find", new object[] { o, 0, 0 });
if (dt != null && dt.Rows.Count > 0)//存在相同的行
{
return dt.Rows.Count;
}
return 0;
}
#endregion
#region 初始化
public void init()
{
try
{
txt_SUPPISSUBCOMPANY.Value = "0";
txt_SUPPISMANUFACTURER.Value = "0";
txt_SUPPISINTERNAL.Value = "0";
Qstatus.SelectedIndex = 0;
QsuspendStatus.SelectedIndex = 1;
//加载下拉列表数据
//加载国家身份下拉框
AdminRegion ar = new AdminRegion();
ar.Validflag = "1";
regions = this.execute("com.hnshituo.pur.configure.service.AreaService", "find", new object[] { ar, 0, 0 });
FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType='A'");
FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType='AC'");
FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/')");
FillComboxItems(txt_SUPPOFFICEPROVINCENATION, regions, "regionNo", "regionNm", "regionType='AC'");
FillComboxItems(txt_SUPPOFFICEPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/')");
//加载税率下拉框
DataTable dt1 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1109" }, this.ob);
ConfigureClassCommon.FilComboboxAdd(txt_suppTaxRate, dt1, "memo", "baseName", "validflag NOT in ('0')",true,"","");
//加载供应商等级下拉框
DataTable dt2 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1217" }, this.ob);
ConfigureClassCommon.FilComboboxAdd(txt_SUPPPERGRADE, dt2, "baseCode", "baseName", "validflag NOT in ('0')",false,"","");
//供应商货币类型
DataTable dt3 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1001" }, this.ob);
ConfigureClassCommon.FilComboboxAdd(txt_SUPPREGCAPCURRENCY, dt3, "baseCode", "baseName", "validflag NOT in ('0')", false, "", "");
//付款方式
DataTable dt5 = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceBillManage.QueryPAY_TYPE_NAME", new Object[] { }, this.ob);
ConfigureClassCommon.FilComboboxAdd(txtPayType, dt5, "BASECODE", "BASENAME", "validflag NOT in ('0')", false, "", "");
//供应商类别
DataTable dt4 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1231" }, this.ob);
ConfigureClassCommon.FilComboboxAdd(txt_suppType, dt4, "baseCode", "baseName", "validflag NOT in ('0')", false, "", "");
ConfigureClassCommon.FilComboboxAdd(cop_suppType, dt4, "baseCode", "baseName", "validflag NOT in ('0')", true, "全部", " ");
cop_suppType.SelectedIndex = 0;
//设定gd不可编辑
ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
ultraGrid2.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
ultraGrid3.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
}
catch (Exception ex)
{
MessageUtil.ShowTips("界面加载初始化数据失败");
}
}
#endregion
// private void QueryPayType()
// {
// try
// {
// txtPayType.Items.Clear();
// DataTable dt = PublicServer.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceBillManage.QueryPAY_TYPE_NAME",
//new Object[] { }, ob);
// if (dt == null || dt.Rows.Count == 0)
// {
// return;
// }
// txtPayType.DataSource = dt;
// txtPayType.DisplayMember = "BASENAME";
// txtPayType.ValueMember = "BASECODE";
// }
// catch (Exception e)
// {
// MessageUtil.ShowWarning(e.Message);
// return;
// }
// }
#region 公共函数
///
/// 清空tab页控件值
///
private void ClearTab()
{
txt_BANKACCOUNT.Text = "";
txt_BANKNAME.Text = "";
txt_CERTNO.Text = "";
txt_CERTDESC.Text = "";
txt_CERTIOFFICER.Text = "";
txt_ap_constraint.Text = "";
txt_ap_type.Text = "";
txt_CERTVALID_start.Text = "";
txt_certPath.Text = "";
txt_certpath_old.Text = "";
txt_certNo_v.Text = "";
txt_CERTVALID_start.Value = DateTime.Now.AddDays(1).ToString();
txt_CERTVALID_end.Value = DateTime.Now.AddYears(1).ToString();
}
private void ClearTab5()
{
publicPms.clearOldData(ultraTabPageControl4);
}
///
/// 初始化Combox数据,加入数据筛选
///
/// ComboBox控件
/// DataTable
/// RowFilter条件
public static void FillComboxItems(UltraComboEditor cmbx, DataTable dt, string valueCol, string textCol, string filterCondition)
{
if (dt != null && dt.Rows.Count > 0)
{
DataView dvw = dt.DefaultView;
dvw.RowFilter = filterCondition;
ArrayList aryTmp = new ArrayList();
aryTmp.Add(new ValueListItem(" "," "));
for (int i = 0; i < dvw.Count; i++)
{
aryTmp.Add(new ValueListItem( dvw[i][valueCol].ToString(),dvw[i][textCol].ToString()));
}
cmbx.DataSource = aryTmp;
cmbx.DisplayMember = "DisplayText";
cmbx.ValueMember = "DataValue";
}
}
///
/// 校验供方数据
///
///
private bool testSupp()// 校验供方数据
{
if (String.IsNullOrEmpty(txt_SUPPCODE.Text.Trim()))
{
MessageBox.Show("请输入供应商编号", "提示");
txt_SUPPCODE.Focus();
//return false;
}
if (txt_SUPPCODE.Text.Trim().Length>11)
{
MessageBox.Show("请输入供应商编号最多10位(建议采用10位)", "提示");
txt_SUPPCODE.Focus();
//return false;
}
if (!StringUtil.IsOnlyLetterAndDigit(txt_SUPPCODE.Text.Trim()))
{
MessageUtil.ShowTips("供应商编码只允许数字和字母组合");
txt_SUPPCODE.Focus();
// return false;
}
if (String.IsNullOrEmpty(txt_SUPPNAME.Text.Trim()))
{
MessageBox.Show("请输入供应商名称", "提示");
txt_SUPPNAME.Focus();
//return false;
}
if (txt_SUPPNAME.Text.Trim().Length>120)
{
MessageBox.Show("请输入供应商名称最多120位", "提示");
txt_SUPPNAME.Focus();
//return false;
}
//if (String.IsNullOrEmpty(txt_SUPPREGISTRARNAME.Text.Trim()))
//{
// MessageBox.Show("请输入供应商法人", "提示");
// txt_SUPPREGISTRARNAME.Focus();
// return false;
//}
if (String.IsNullOrEmpty(txt_ORGCODE.Text.Trim()))
{
MessageBox.Show("请输入组织机构代码", "提示");
txt_ORGCODE.Focus();
//return false;
}
if (String.IsNullOrEmpty(txt_SUPPTAXID.Text.Trim()))
{
MessageBox.Show("请输入供应商税号", "提示");
txt_SUPPTAXID.Focus();
//return false;
}
if (String.IsNullOrEmpty(txt_SUPPLICNUM.Text.Trim()))
{
MessageBox.Show("请输入供应商营业执照", "提示");
txt_SUPPLICNUM.Focus();
//return false;
}
//手机号码验证
if (!string.IsNullOrEmpty(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()))
{
MessageBox.Show("请输入有效的手机号码", "提示");
txt_SUPPCONTACTCELLPHONE.Focus();
//return false;
}
//电话号码验证
if (!string.IsNullOrEmpty(txt_SUPPCONTACTTEL.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTTEL.Text.ToString().Trim()))
{
MessageBox.Show("请输入有效的电话号码", "提示");
txt_SUPPCONTACTTEL.Focus();
//return false;
}
//传真验证
if (!string.IsNullOrEmpty(txt_SUPPCONTACTFAX.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTFAX.Text.ToString().Trim()))
{
MessageBox.Show("请输入有效的传真号码", "提示");
txt_SUPPCONTACTFAX.Focus();
//return false;
}
//邮箱验证
if (!string.IsNullOrEmpty(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()) && !isEmail(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()))
{
MessageBox.Show("请输入有效的邮箱", "提示");
txt_SUPPCONTACTEMAIL.Focus();
//return false;
}
if (txt_SUPPCODE.Text.ToString().Trim().Length < 6)
{
MessageUtil.ShowTips("供应商编号需大于6位");
txt_SUPPCODE.Focus();
//return false;
}
if (txt_SUPPCODE.Text.ToString().Trim().Length >10)
{
MessageUtil.ShowTips("供应商编号需小于等于10位");
txt_SUPPCODE.Focus();
//return false;
}
if (txt_SUPPREGCAPCURRENCY.Text == "")
{
MessageUtil.ShowTips("供应商货币类型不能为空");
txt_SUPPREGCAPCURRENCY.Focus();
//return false;
}
if (String.IsNullOrEmpty(txt_SUPPSTARTDATE.Text))
{
MessageUtil.ShowTips("供应商生效开始时间不能为空");
txt_SUPPSTARTDATE.Focus();
//return false;
}
if (String.IsNullOrEmpty(txt_SUPPENDDATE.Text))
{
MessageUtil.ShowTips("供应商生效结束时间不能为空");
txt_SUPPENDDATE.Focus();
//return false;
}
if (String.IsNullOrEmpty(txt_SUPPTAXSTARTDATE.Text))
{
MessageUtil.ShowTips("供应商税号有效开始时间不能为空");
txt_SUPPTAXSTARTDATE.Focus();
//return false;
}
if (String.IsNullOrEmpty(txt_SUPPTAXENDDATE.Text))
{
MessageUtil.ShowTips("供应商税号生效结束时间不能为空");
txt_SUPPTAXENDDATE.Focus();
//return false;
}
if (String.IsNullOrEmpty(txt_SUPPLICSTARTDATE.Text))
{
MessageUtil.ShowTips("供应商执照有效开始时间不能为空");
txt_SUPPLICSTARTDATE.Focus();
//return false;
}
if (String.IsNullOrEmpty(txt_SUPPLICENDDATE.Text))
{
MessageUtil.ShowTips("供应商执照生效结束时间不能为空");
txt_SUPPLICENDDATE.Focus();
//return false;
}
if (txt_suppTaxRate.SelectedIndex == -1)
{
MessageUtil.ShowTips("供应商税率不能为空");
txt_suppTaxRate.Focus();
//return false;
}
if (txt_suppType.SelectedIndex == -1)
{
MessageUtil.ShowTips("供应商类型不能为空");
txt_suppType.Focus();
//return false;
}
if (String.IsNullOrEmpty(txt_postAdd.Text.Trim()))
{
MessageUtil.ShowTips("供应商邮编不能为空");
txt_postAdd.Focus();
//return false;
}
if (!String.IsNullOrEmpty(txt_account_cw.Text.Trim()))
{
if (txt_account_cw.Text.Trim().Length > 10)
{
MessageUtil.ShowTips("财务供应商编码最多10位");
txt_account_cw.Focus();
//return false;
}
if (!StringUtil.IsOnlyLetterAndDigit(txt_account_cw.Text.Trim()))
{
MessageUtil.ShowTips("财务供应商编码只允许数字和字母组合");
txt_account_cw.Focus();
// return false;
}
}
return true;
}
///
/// 校验供方数据
///
///
private bool TestSupp()// 校验供方数据
{
if (String.IsNullOrEmpty(txt_SUPPCODE.Text.Trim()))
{
MessageBox.Show("请输入供应商编号", "提示");
txt_SUPPCODE.Focus();
//return false;
}
if (txt_SUPPCODE.Text.Trim().Length > 11)
{
MessageBox.Show("请输入供应商编号最多10位(建议采用10位)", "提示");
txt_SUPPCODE.Focus();
//return false;
}
if (!StringUtil.IsOnlyLetterAndDigit(txt_SUPPCODE.Text.Trim()))
{
MessageUtil.ShowTips("供应商编码只允许数字和字母组合");
txt_SUPPCODE.Focus();
// return false;
}
if (String.IsNullOrEmpty(txt_SUPPNAME.Text.Trim()))
{
MessageBox.Show("请输入供应商名称", "提示");
txt_SUPPNAME.Focus();
return false;
}
if (txt_SUPPNAME.Text.Trim().Length > 120)
{
MessageBox.Show("请输入供应商名称最多120位", "提示");
txt_SUPPNAME.Focus();
return false;
}
//if (String.IsNullOrEmpty(txt_SUPPREGISTRARNAME.Text.Trim()))
//{
// MessageBox.Show("请输入供应商法人", "提示");
// txt_SUPPREGISTRARNAME.Focus();
// return false;
//}
if (String.IsNullOrEmpty(txt_ORGCODE.Text.Trim()))
{
MessageBox.Show("请输入组织机构代码", "提示");
txt_ORGCODE.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_SUPPTAXID.Text.Trim()))
{
MessageBox.Show("请输入供应商税号", "提示");
txt_SUPPTAXID.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_SUPPLICNUM.Text.Trim()))
{
MessageBox.Show("请输入供应商营业执照", "提示");
txt_SUPPLICNUM.Focus();
return false;
}
//手机号码验证
if (!string.IsNullOrEmpty(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()))
{
MessageBox.Show("请输入有效的手机号码", "提示");
txt_SUPPCONTACTCELLPHONE.Focus();
return false;
}
//电话号码验证
if (!string.IsNullOrEmpty(txt_SUPPCONTACTTEL.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTTEL.Text.ToString().Trim()))
{
MessageBox.Show("请输入有效的电话号码", "提示");
txt_SUPPCONTACTTEL.Focus();
return false;
}
//传真验证
if (!string.IsNullOrEmpty(txt_SUPPCONTACTFAX.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTFAX.Text.ToString().Trim()))
{
MessageBox.Show("请输入有效的传真号码", "提示");
txt_SUPPCONTACTFAX.Focus();
return false;
}
//邮箱验证
if (!string.IsNullOrEmpty(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()) && !isEmail(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()))
{
MessageBox.Show("请输入有效的邮箱", "提示");
txt_SUPPCONTACTEMAIL.Focus();
return false;
}
if (txt_SUPPCODE.Text.ToString().Trim().Length < 6)
{
MessageUtil.ShowTips("供应商编号需大于6位");
txt_SUPPCODE.Focus();
return false;
}
if (txt_SUPPCODE.Text.ToString().Trim().Length > 10)
{
MessageUtil.ShowTips("供应商编号需小于等于10位");
txt_SUPPCODE.Focus();
return false;
}
if (txt_SUPPREGCAPCURRENCY.Text == "")
{
MessageUtil.ShowTips("供应商货币类型不能为空");
txt_SUPPREGCAPCURRENCY.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_SUPPSTARTDATE.Text))
{
MessageUtil.ShowTips("供应商生效开始时间不能为空");
txt_SUPPSTARTDATE.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_SUPPENDDATE.Text))
{
MessageUtil.ShowTips("供应商生效结束时间不能为空");
txt_SUPPENDDATE.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_SUPPTAXSTARTDATE.Text))
{
MessageUtil.ShowTips("供应商税号有效开始时间不能为空");
txt_SUPPTAXSTARTDATE.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_SUPPTAXENDDATE.Text))
{
MessageUtil.ShowTips("供应商税号生效结束时间不能为空");
txt_SUPPTAXENDDATE.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_SUPPLICSTARTDATE.Text))
{
MessageUtil.ShowTips("供应商执照有效开始时间不能为空");
txt_SUPPLICSTARTDATE.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_SUPPLICENDDATE.Text))
{
MessageUtil.ShowTips("供应商执照生效结束时间不能为空");
txt_SUPPLICENDDATE.Focus();
return false;
}
if (txt_suppTaxRate.SelectedIndex == -1)
{
MessageUtil.ShowTips("供应商税率不能为空");
txt_suppTaxRate.Focus();
return false;
}
if (txt_suppType.SelectedIndex == -1)
{
MessageUtil.ShowTips("供应商类型不能为空");
txt_suppType.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_postAdd.Text.Trim()))
{
MessageUtil.ShowTips("供应商邮编不能为空");
txt_postAdd.Focus();
return false;
}
if (!String.IsNullOrEmpty(txt_account_cw.Text.Trim()))
{
if (txt_account_cw.Text.Trim().Length > 10)
{
MessageUtil.ShowTips("财务供应商编码最多10位");
txt_account_cw.Focus();
return false;
}
if (!StringUtil.IsOnlyLetterAndDigit(txt_account_cw.Text.Trim()))
{
MessageUtil.ShowTips("财务供应商编码只允许数字和字母组合");
txt_account_cw.Focus();
return false;
}
}
return true;
}
#endregion
#region 附件上传
private void craftImg_EditorButtonClick(object sender, EditorButtonEventArgs e)
{
try
{
UltraGridRow row = ultraGrid3.ActiveRow;
string filePathOld = row.GetValue("certPathOld");
if (e.Button.Key.ToLower().Equals("select"))
{
FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
down.DeleteButton.Visible = false;
down.ShowDialog();
}
}
catch (Exception ex)
{
MessageUtil.ShowTips("操作失败:" + ex);
}
}
private void txt_certPath_EditorButtonClick(object sender, EditorButtonEventArgs e)
{
try
{
if (e.Button.Key.ToLower().Equals("insert"))
{
OpenFileDialog file = new OpenFileDialog();
file.Multiselect = false;
DialogResult drStat;
drStat = file.ShowDialog();
if (drStat == DialogResult.OK)
{
fileName = file.FileName;
string filena = System.IO.Path.GetFileName(fileName);
string certNo = filena.Split('.')[0];
String filePathlocal = System.IO.Path.GetFullPath(fileName);
txt_certPath.Text = filena;
txt_certpath_local.Text = filePathlocal;
txt_CERTNO.Text = certNo;
}
}
}
catch (Exception ex)
{
MessageUtil.ShowTips("操作失败:" + ex);
}
}
//上传按钮
private void btn_submitAppend_Click(object sender, EventArgs e)
{
try
{
if (ultraGrid1.ActiveRow == null)
{
MessageUtil.ShowTips("未选择供应商");
return;
}
if (txt_ap_type.SelectedIndex == -1)
{
MessageUtil.ShowTips("证书类型不能为空");
txt_ap_type.Focus();
return;
}
if (txt_ap_constraint.SelectedIndex == -1)
{
MessageUtil.ShowTips("证书强制类型不能为空");
txt_ap_constraint.Focus();
return;
}
if (String.IsNullOrEmpty(txt_CERTVALID_start.Text))
{
MessageUtil.ShowTips("证书有效期开始时间不能为空");
txt_CERTVALID_start.Focus();
return;
}
if (String.IsNullOrEmpty(txt_CERTVALID_end.Text))
{
MessageUtil.ShowTips("证书有效期结束时间不能为空");
txt_CERTVALID_end.Focus();
return;
}
Info();
UpdateSupp();
MessageUtil.ShowTips("添加成功");
ClearTab5();
}
catch (Exception ex)
{
MessageBox.Show("添加失败");
}
////刷新界面并激活当前行
//Relocate(sat);
}
private bool testSuppAptitude()
{
if (String.IsNullOrEmpty(txt_certPath.Text.Trim()))
{
MessageUtil.ShowTips("证书文件不能为空");
txt_certPath.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_certpath_local.Text.Trim()))
{
MessageUtil.ShowTips("证书本地地址不能为空");
txt_certpath_local.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_CERTNO.Text.Trim()))
{
MessageUtil.ShowTips("证书文件名不能为空");
txt_CERTNO.Focus();
return false;
}
if (String.IsNullOrEmpty(txt_certPath.Text.Trim()))
{
MessageUtil.ShowTips("证书文件不能为空");
txt_certPath.Focus();
return false;
}
if(txt_ap_constraint.SelectedIndex==-1)
{
MessageUtil.ShowTips("证书强制类型不能为空");
txt_ap_constraint.Focus();
return false;
}
if(txt_ap_type.SelectedIndex==-1)
{
MessageUtil.ShowTips("证书类型不能为空");
txt_ap_type.Focus();
return false;
}
return true;
}
private void Relocate(SuppAptitude sat)
{
getSuppAptitude(sat.SuppCode, sat.CertPath);
}
/////
///// 加载文件事件
/////
/////
/////
//private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
//{
// try
// {
// ultraGrid3.UpdateData();
// UltraGridRow row = ultraGrid3.ActiveRow;
// string filePathOld = row.GetValue("certPathOld");
// string strId = row.GetValue("id");
// string filePathNew = "";
// if (e.Button.Key.ToLower().Equals("select"))
// {
// FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
// down.DeleteButton.Visible = false;
// down.ShowDialog();
// }
// else if (e.Button.Key.ToLower().Equals("insert"))
// {
// if (ultraGrid1.ActiveRow == null)
// {
// MessageUtil.ShowTips("未选择供方信息");
// return;
// }
// string strsuppCode = ultraGrid1.ActiveRow.GetValue("suppCode");
// string guid = Guid.NewGuid().ToString("N").ToUpper();
// //FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
// //down.ctrlFileDown1.FilePath = filePathOld;
// //if (down.ctrlFileDown1.List.Count > 0)
// //{
// // MessageUtil.ShowWarning("只能上传一份文件!");
// // return;
// //}
// List list = new List();
// FileBean bean = new FileBean();
// OpenFileDialog file = new OpenFileDialog();
// file.Multiselect = false;
// DialogResult drStat;
// drStat = file.ShowDialog();
// if (drStat == DialogResult.OK)
// {
// string fileName = file.FileName;
// string filena = System.IO.Path.GetFileName(fileName);
// string certNo = filena.Split('.')[0];
// //if (!certNo.ToUpper().Contains("CT"))
// //{
// // MessageUtil.ShowWarning("资质文件号文件名头两位需为CT!");
// // return;
// //}
// filePathNew = "Pms/CERT/" + strsuppCode + "/" + guid + "/";
// SuppAptitude sat = new SuppAptitude();
// sat.SuppCode = strsuppCode;
// sat.CertNo = certNo;
// sat.CertPath = filena;
// sat.CertPathOld = filePathNew + filena;
// sat.CertNoV = guid;
// sat.Id = strId;
// if (GetCraftFileCraftNoCnt(certNo, strsuppCode) > 0)
// {
// if (MessageUtil.ShowYesNoAndQuestion("系统已存在该资质文件,是否确认覆盖" + certNo + "?") == DialogResult.No)
// {
// return;
// }
// }
// //更新资质行记录
// if (SaveCert(sat) == false) return;
// bean = new FileBean();
// bean.setFileName(filena);
// bean.setPathName(filePathNew);
// bean.setFile(FileHelper.FileToArray(fileName));
// list.Add(bean);
// bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
// if (isSuccess)
// {
// MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
// ultraGrid3.ActiveRow.Cells["certPathOld"].Value = sat.CertPathOld;
// }
// else
// {
// MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
// }
// //刷新界面并激活当前行
// Relocate(sat.CertNo);
// }
// }
// }
// catch (Exception ex)
// {
// MessageUtil.ShowTips("操作失败:" + ex);
// }
//}
/////
///// 加载文件事件
/////
/////
/////
//private void txt_certPath_EditorButtonClick(object sender, EditorButtonEventArgs e)
//{
// try
// {
// //ultraGrid3.UpdateData();
// //UltraGridRow row = ultraGrid3.ActiveRow;
// string filePathOld = txt_certpath_old.Text.ToString().Trim();
// //string strId = row.GetValue("id");
// string filePathNew = "";
// if (e.Button.Key.ToLower().Equals("select"))
// {
// FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
// down.DeleteButton.Visible = false;
// down.ShowDialog();
// }
// else if (e.Button.Key.ToLower().Equals("insert"))
// {
// if (ultraGrid1.ActiveRow == null)
// {
// MessageUtil.ShowTips("未选择供方信息");
// return;
// }
// string strsuppCode = ultraGrid1.ActiveRow.GetValue("suppCode");
// string guid = Guid.NewGuid().ToString("N").ToUpper();
// //FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
// //down.ctrlFileDown1.FilePath = filePathOld;
// //if (down.ctrlFileDown1.List.Count > 0)
// //{
// // MessageUtil.ShowWarning("只能上传一份文件!");
// // return;
// //}
// List list = new List();
// FileBean bean = new FileBean();
// OpenFileDialog file = new OpenFileDialog();
// file.Multiselect = false;
// DialogResult drStat;
// drStat = file.ShowDialog();
// if (drStat == DialogResult.OK)
// {
// string fileName = file.FileName;
// string filena = System.IO.Path.GetFileName(fileName);
// string certNo = filena.Split('.')[0];
// //if (!certNo.ToUpper().Contains("CT"))
// //{
// // MessageUtil.ShowWarning("资质文件号文件名头两位需为CT!");
// // return;
// //}
// filePathNew = "Pms/CERT/" + strsuppCode + "/" + guid + "/";
// SuppAptitude sat = new SuppAptitude();
// sat.SuppCode = strsuppCode;
// sat.CertNo = certNo;
// txt_CERTNO.Text = certNo;
// sat.CertPath = filena;
// txt_certPath.Text = filena;
// sat.CertPathOld = filePathNew + filena;
// txt_certpath_old.Text = filePathNew + filena;
// sat.CertNoV = guid;
// txt_certNo_v.Text = guid;
// //sat.Id = strId;
// if (GetCraftFileCraftNoCnt(certNo, strsuppCode) > 0)
// {
// if (MessageUtil.ShowYesNoAndQuestion("系统已存在该资质文件,是否确认覆盖" + certNo + "?") == DialogResult.No)
// {
// return;
// }
// }
// //更新资质行记录
// //if (SaveCert(sat) == false) return;
// bean = new FileBean();
// bean.setFileName(filena);
// bean.setPathName(filePathNew);
// bean.setFile(FileHelper.FileToArray(fileName));
// list.Add(bean);
// bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
// if (isSuccess)
// {
// MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
// //ultraGrid3.ActiveRow.Cells["certPathOld"].Value = sat.CertPathOld;
// }
// else
// {
// MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
// }
// //刷新界面并激活当前行
// //Relocate(sat.CertNo);
// }
// }
// }
// catch (Exception ex)
// {
// MessageUtil.ShowTips("操作失败:" + ex);
// }
//}
///
/// 判断是否之前已提交相同的文件
///
///
///
private int GetCraftFileCraftNoCnt(string craftNo, string suppCode)
{
SuppAptitude sat = new SuppAptitude();
sat.SuppCode = suppCode;
sat.CertNo = craftNo;
int dt = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "count", new object[] { sat });
return dt;
}
///
/// 保存资质信息行
///
///
///
private bool SaveCert(SuppAptitude sat)
{
CoreResult re = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "doUpdate", new object[] { sat });
if (re.Resultcode == 0)
{
return true;
}
else
{
MessageUtil.ShowTips("上传失败:" + re.Resultmsg);
return false;
}
}
//获取供应商文件
private void getSuppAptitude(String strSuppCode, string craftNo)
{
SuppAptitude YY = new SuppAptitude();
YY.SuppCode = strSuppCode;
DataTable dt1 = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "findAptitude", new object[] { YY});
GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
GridHelper.RefreshAndAutoSize(ultraGrid3);
if (!String.IsNullOrEmpty(craftNo))
{
ConfigureClassCommon.doActiveSelRow(ultraGrid3, "certNo", craftNo);
}
}
#endregion
private void Info()
{
if (txt_ap_type.Value != null)
{
if (txt_ap_type.Value.Equals("1"))
{
txt_SUPPLICNUM.Text = txt_arch_code.Text.ToString();//营业执照
txt_SUPPLICSTARTDATE.Text = txt_CERTVALID_start.Text.ToString();
txt_SUPPLICENDDATE.Text = txt_CERTVALID_end.Text.ToString();
}
else if (txt_ap_type.Value.Equals("2"))
{
txt_ORGCODE.Text = txt_arch_code.Text.ToString();//组织机构代码证
txt_SUPPSTARTDATE.Text = txt_CERTVALID_start.Text.ToString();
txt_SUPPENDDATE.Text = txt_CERTVALID_end.Text.ToString();
}
else if (txt_ap_type.Value.Equals("3"))
{
txt_SUPPTAXID.Text = txt_arch_code.Text.ToString();//税务登记证
txt_SUPPTAXSTARTDATE.Text = txt_CERTVALID_start.Text.ToString();
txt_SUPPTAXENDDATE.Text = txt_CERTVALID_end.Text.ToString();
}
}
}
private void ultraGrid5_AfterRowActivate(object sender, EventArgs e)
{
UltraGridRow uge5 = ultraGrid5.ActiveRow;
Combo_Rate.Text = uge5.Cells["rate"].Value.ToString2().Trim();
txt_Rate_Year.Text = uge5.Cells["rateYear"].Value.ToString2().Trim();
}
private void upLoadFile_Click(object sender, EventArgs e)
{
if (ultraGrid1.ActiveRow == null)
{
MessageUtil.ShowTips("未选择供应商");
return;
}
string strSuppCode = ultraGrid1.ActiveRow.GetValue("SuppCode");
string strSuppName = ultraGrid1.ActiveRow.GetValue("SuppName");
if (String.IsNullOrEmpty(strSuppCode))
{
}
String filena = txt_certPath.Text.ToString().Trim();
if (String.IsNullOrEmpty(filena) || String.IsNullOrEmpty(fileName))
{
MessageUtil.ShowTips("请选择待上传文件");
return;
}
if (testSuppAptitude() == false)
{
return;
}
SuppAptitude sat = new SuppAptitude();
sat.SuppCode = strSuppCode;
sat.SuppName = strSuppName;
String filePathNew = "Pms/CERT/SUPP/" + strSuppCode + "/";
sat.CertPath = filena;
sat.CertPathOld = filePathNew + filena;
sat.CreateUserid = UserInfo.GetUserID();
sat.CreateName = UserInfo.GetUserName();
sat.ArchCode = txt_arch_code.Text.Trim();
sat.CreateTime = DateTime.Now;
sat.CertNo = txt_CERTNO.Text.Trim();
sat.CertiOfficer = txt_CERTIOFFICER.Text.Trim();
if (txt_ap_type.SelectedIndex == -1)
{
MessageUtil.ShowTips("证书类型不能为空");
txt_ap_type.Focus();
return;
}
sat.CertType = txt_ap_type.Value.ToString().Trim();
if (txt_ap_constraint.SelectedIndex == -1)
{
MessageUtil.ShowTips("证书强制类型不能为空");
txt_ap_constraint.Focus();
return;
}
sat.CertiConstraint = txt_ap_constraint.Value.ToString().Trim();
if (String.IsNullOrEmpty(txt_CERTVALID_start.Text))
{
MessageUtil.ShowTips("证书有效期开始时间不能为空");
txt_CERTVALID_start.Focus();
return;
}
if (String.IsNullOrEmpty(txt_CERTVALID_end.Text))
{
MessageUtil.ShowTips("证书有效期结束时间不能为空");
txt_CERTVALID_end.Focus();
return;
}
sat.CertValidStart = DateTime.Parse(Convert.ToDateTime(txt_CERTVALID_start.Value).ToShortDateString() + " 00:00:00");
sat.CertValidEnd = DateTime.Parse(Convert.ToDateTime(txt_CERTVALID_end.Value).ToShortDateString() + " 23:59:59");
sat.Validflag = "1";
sat.CertDesc = txt_CERTDESC.Text.Trim();
if (GetCraftFileCraftNoCnt(filena, strSuppCode) > 0)
{
MessageUtil.ShowTips("供应商已存在该附件文件:" + filena);
return;
}
List list = new List();
FileBean bean = new FileBean();
bean = new FileBean();
bean.setFileName(filena);
bean.setPathName(filePathNew);
bean.setFile(FileHelper.FileToArray(fileName));
list.Add(bean);
bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
if (isSuccess)
{
//开始写数据库
CoreResult crt = this.execute("com.hnshituo.pur.configure.service.SuppAptitudeService", "insert_SuppAptitude", new object[] { sat });
if (crt.Resultcode != 0)
{
MessageUtil.ShowTips("上传失败:" + crt.Resultmsg);
}
else
{
Info();
UpdateSupp();
MessageUtil.ShowTips("上传成功");
ClearTab5();
}
}
else
{
MessageBox.Show("上传失败");
}
//刷新界面并激活当前行
Relocate(sat);
}
}
}