using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
using System.IO;
|
using System.Collections;
|
using System.Diagnostics;
|
|
namespace EDI
|
{
|
public partial class FrmServer : Form
|
{
|
public FrmServer()
|
{
|
InitializeComponent();
|
}
|
|
public string HbakPath830 = @"E:\Õã½³¤»ª\CSV¸ñʽ\830±¸·Ý\";
|
public string HbakPath830_Er = @"E:\Õã½³¤»ª\CSV¸ñʽ\830±¸·Ý\";
|
public string HbakPath830_San = @"E:\Õã½³¤»ª\CSV¸ñʽ\830±¸·Ý\";
|
public string HbakPath862 = @"E:\Õã½³¤»ª\CSV¸ñʽ\862±¸·Ý\";
|
public string HbakPath862_Er = @"E:\Õã½³¤»ª\CSV¸ñʽ\862±¸·Ý\";
|
public string HbakPath862_San = @"E:\Õã½³¤»ª\CSV¸ñʽ\862±¸·Ý\";
|
public string HbakPath856 = @"E:\Õã½³¤»ª\CSV¸ñʽ\856\";
|
public string HbakPath856_Er = @"E:\Õã½³¤»ª\CSV¸ñʽ\856\";
|
public string HbakPath856_San = @"E:\Õã½³¤»ª\CSV¸ñʽ\856\";
|
|
/// <summary>
|
/// ±¸·Ý·¾¶
|
/// </summary>
|
public string HTo830Path = @"E:\Õã½³¤»ª\CSV¸ñʽ\830±¸·Ý\";
|
public string HTo830Path_Er = @"E:\Õã½³¤»ª\CSV¸ñʽ\830±¸·Ý\";
|
public string HTo830Path_San = @"E:\Õã½³¤»ª\CSV¸ñʽ\830±¸·Ý\";
|
public string HTo862Path = @"E:\Õã½³¤»ª\CSV¸ñʽ\862±¸·Ý\";
|
public string HTo862Path_Er = @"E:\Õã½³¤»ª\CSV¸ñʽ\862±¸·Ý\";
|
public string HTo862Path_San = @"E:\Õã½³¤»ª\CSV¸ñʽ\862±¸·Ý\";
|
public string HFrom856Path = @"E:\Õã½³¤»ª\CSV¸ñʽ\856±¸·Ý\";
|
public string HFrom856Path_Er = @"E:\Õã½³¤»ª\CSV¸ñʽ\856±¸·Ý\";
|
public string HFrom856Path_San = @"E:\Õã½³¤»ª\CSV¸ñʽ\856±¸·Ý\";
|
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
string MessageType = "";
|
string SenderIDTitle = "";
|
string SenderID = "";
|
string ReceiverIDTitle = "";
|
string ReceiverID = "";
|
string sWhereR = "";
|
string sWhereS = "";
|
public clsEnvelop BillNew = new clsEnvelop();
|
|
|
private void FrmServer_Load(object sender, EventArgs e)
|
{
|
initGrid();
|
txtHPath830.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath830", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath830_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath830_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath830_San.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath830_San", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath862.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath862", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath862_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath862_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath862_San.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath862_San", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath856.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath856", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath856_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath856_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
//txtHPath830.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath830", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
|
txtHBakPath830.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath830", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath830_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath830_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath830_San.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath830_San", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath862.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath862", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath862_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath862_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath862_San.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath862_San", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath856.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath856", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath856_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath856_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
|
//
|
DAL.ClsK3_User_View oUser = new DAL.ClsK3_User_View();
|
DAL.ClsK3_Warehouse_View oWH = new DAL.ClsK3_Warehouse_View();
|
DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View();
|
DAL.ClsK3_Department_View oDept = new DAL.ClsK3_Department_View();
|
DAL.ClsK3_Employee_View oYwy = new DAL.ClsK3_Employee_View();
|
txtHUserID.Tag = Pub_Class.ClsIni.ReadIni("BillInfo", "txtHUserID", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHEmpID.Tag = Pub_Class.ClsIni.ReadIni("BillInfo", "txtHEmpID", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHWHID.Tag = Pub_Class.ClsIni.ReadIni("BillInfo", "txtHWHID", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHYwyID.Tag = Pub_Class.ClsIni.ReadIni("BillInfo", "txtHYwyID", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHDeptID.Tag = Pub_Class.ClsIni.ReadIni("BillInfo", "txtHDeptID", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
|
if (oUser.GetInfoByID(DBUtility.ClsPub.isLong(txtHUserID.Tag)))
|
{
|
txtHUserID.Tag = oUser.omodel.HItemID.ToString();
|
txtHUserID.Text = oUser.omodel.HName;
|
}
|
else
|
{
|
txtHUserID.Tag = "";
|
txtHUserID.Text = "";
|
}
|
|
if (oWH.GetInfoByID(DBUtility.ClsPub.isLong(txtHWHID.Tag)))
|
{
|
txtHWHID.Tag = oWH.omodel.HItemID.ToString();
|
txtHWHID.Text = oWH.omodel.HName;
|
}
|
else
|
{
|
txtHWHID.Tag = "";
|
txtHWHID.Text = "";
|
}
|
|
|
if (oEmp.GetInfoByID(DBUtility.ClsPub.isLong(txtHEmpID.Tag)))
|
{
|
txtHEmpID.Tag = oEmp.omodel.HItemID.ToString();
|
txtHEmpID.Text = oEmp.omodel.HName;
|
}
|
else
|
{
|
txtHEmpID.Tag = "";
|
txtHEmpID.Text = "";
|
}
|
//
|
if (oDept.GetInfoByID(DBUtility.ClsPub.isLong(txtHDeptID.Tag)))
|
{
|
txtHDeptID.Tag = oDept.omodel.HItemID.ToString();
|
txtHDeptID.Text = oDept.omodel.HName;
|
}
|
else
|
{
|
txtHDeptID.Tag = "";
|
txtHDeptID.Text = "";
|
}
|
//
|
if (oYwy.GetInfoByID(DBUtility.ClsPub.isLong(txtHYwyID.Tag)))
|
{
|
txtHYwyID.Tag = oYwy.omodel.HItemID.ToString();
|
txtHYwyID.Text = oYwy.omodel.HName;
|
}
|
else
|
{
|
txtHYwyID.Tag = "";
|
txtHYwyID.Text = "";
|
}
|
|
}
|
|
private void initGrid()
|
{
|
DBUtility.Xt_BaseBillFun.initGridList(grdSub830, this.Name + "grdSub830");
|
DBUtility.Xt_BaseBillFun.initGridList(grdSub856, this.Name + "grdSub856");
|
DBUtility.Xt_BaseBillFun.initGridList(grdSub862, this.Name + "grdSub862");
|
DBUtility.Xt_BaseBillFun.initGridList(grdSubErr, this.Name + "grdSubErr");
|
DBUtility.Xt_BaseBillFun.initGridList(grdSubInvoice, this.Name + "grdSubInvoice");
|
DBUtility.Xt_BaseBillFun.initGridList(grdCumulative, this.Name + "grdCumulative");
|
}
|
|
private void cmdDataIn862_Click(object sender, EventArgs e)
|
{
|
FrmReceive oFrmReceive = new FrmReceive();
|
oFrmReceive.Show();
|
}
|
|
private void cmdDataIn830_Click(object sender, EventArgs e)
|
{
|
FrmReceive830 oFrmReceive830 = new FrmReceive830();
|
oFrmReceive830.Show();
|
}
|
|
private void cmdQuery_Click(object sender, EventArgs e)
|
{
|
Display();
|
}
|
|
//ÏÔʾ¼Ç¼
|
private void Display()
|
{
|
MessageType = txtMessageType.Text.ToString();
|
SenderIDTitle = txtSenderIDTitle.Text.ToString();
|
SenderID = txtSenderID.Text.ToString();
|
ReceiverIDTitle = txtSenderIDTitle.Text.ToString();
|
ReceiverID = txtReceiverID.Text.ToString();
|
sWhereR = "";
|
sWhereS = "";
|
if (MessageType.Trim() != "")
|
{
|
sWhereR = sWhereR + "MessageType='" + MessageType + "' and ";
|
sWhereS = sWhereS + "MessageType='" + MessageType + "' and ";
|
}
|
if (SenderIDTitle.Trim() != "")
|
{
|
sWhereR = sWhereR + "SenderIDTitle='" + SenderIDTitle + "' and ";
|
}
|
if (SenderID.Trim() != "")
|
{
|
sWhereR = sWhereR + "SenderID='" + SenderID + "' and ";
|
sWhereS = sWhereS + "SenderID='" + SenderID + "' and ";
|
}
|
if (ReceiverIDTitle.Trim() != "")
|
{
|
sWhereR = sWhereR + "ReceiverIDTitle='" + ReceiverIDTitle + "' and ";
|
}
|
if (ReceiverID.Trim() != "")
|
{
|
sWhereR = sWhereR + "ReceiverID='" + ReceiverID + "' and ";
|
sWhereS = sWhereS + "ReceiverID='" + ReceiverID + "' and ";
|
}
|
if (sWhereR.Length > 0)
|
{
|
sWhereR = " where " + sWhereR.Remove(sWhereR.Length - 4, 4);
|
}
|
|
if (sWhereS.Length > 0)
|
{
|
sWhereS = " where " + sWhereS.Remove(sWhereS.Length - 4, 4);
|
}
|
Display830();
|
Display862();
|
Display856();
|
DisplayErr();
|
DisplayInvoice();
|
DisplayCumulative();
|
}
|
|
//ÏÔʾ830
|
private void Display830()
|
{
|
try
|
{
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("select top 200 * from h_v_ZOCT_EnvelopR_830 order by EnvelopRID desc " + sWhereR, "h_v_ZOCT_EnvelopR_830");
|
if (Ds == null)
|
{
|
pubCls.Add_Log("¶ÁÈ¡830Öмä±íʧ°Ü!ûÓÐÊý¾Ý£¡", "¶ÁÈ¡Öмä±í", "Sysytem");
|
return;
|
}
|
grdSub830.DataSource = Ds.Tables[0];
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("¶ÁÈ¡830Öмä±íʧ°Ü!" + e.Message, "¶ÁÈ¡Öмä±í", "Error");
|
}
|
}
|
|
//ÏÔʾ862
|
private void Display862()
|
{
|
try
|
{
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("select top 200 * from h_v_ZOCT_EnvelopR_862 order by EnvelopRID desc " + sWhereR, "h_v_ZOCT_EnvelopR_862");
|
if (Ds == null)
|
{
|
pubCls.Add_Log("¶ÁÈ¡862Öмä±íʧ°Ü!ûÓÐÊý¾Ý£¡", "¶ÁÈ¡Öмä±í", "Sysytem");
|
return;
|
}
|
grdSub862.DataSource = Ds.Tables[0];
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("¶ÁÈ¡862Öмä±íʧ°Ü!" + e.Message, "¶ÁÈ¡Öмä±í", "Error");
|
}
|
}
|
|
//ÏÔʾ856
|
private void Display856()
|
{
|
try
|
{
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("select top 200 * from h_v_ZOCT_EnvelopS order by EnvelopSID desc " + sWhereS, "h_v_ZOCT_EnvelopS");
|
if (Ds == null)
|
{
|
pubCls.Add_Log("¶ÁÈ¡856Öмä±íʧ°Ü!ûÓÐÊý¾Ý£¡", "¶ÁÈ¡Öмä±í", "Sysytem");
|
return;
|
}
|
grdSub856.DataSource = Ds.Tables[0];
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("¶ÁÈ¡856Öмä±íʧ°Ü!" + e.Message, "¶ÁÈ¡Öмä±í", "Error");
|
}
|
}
|
|
//ÏÔʾErr
|
private void DisplayErr()
|
{
|
try
|
{
|
DataSet Ds;
|
string sWhere = "";
|
if (radioButton2.Checked == true)
|
{
|
sWhere = " where ²Ù×÷Ô±='Error' ";
|
}
|
Ds = oCn.RunProcReturn("select top 1000 * from h_v_System_log " + sWhere + " order by id desc ", "h_v_System_log");
|
if (Ds == null)
|
{
|
pubCls.Add_Log("¶ÁÈ¡ÈÕÖ¾±íʧ°Ü!ûÓÐÊý¾Ý£¡", "¶ÁÈ¡ÈÕÖ¾±í", "Sysytem");
|
return;
|
}
|
grdSubErr.DataSource = Ds.Tables[0];
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("¶ÁÈ¡ÈÕ־ʧ°Ü!" + e.Message, "¶ÁÈ¡ÈÕÖ¾±í", "Sysytem");
|
}
|
}
|
|
//ÏÔʾInvoice
|
private void DisplayInvoice()
|
{
|
try
|
{
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("select top 100 * from h_v_ZOCT_Invoice order by InvoiceID desc ", "h_v_ZOCT_Invoice");
|
if (Ds == null)
|
{
|
pubCls.Add_Log("¶ÁÈ¡Invoiceʧ°Ü!ûÓÐÊý¾Ý£¡", "¶ÁÈ¡Invoice±í", "Sysytem");
|
return;
|
}
|
grdSubInvoice.DataSource = Ds.Tables[0];
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("¶ÁÈ¡Invoiceʧ°Ü!" + e.Message, "¶ÁÈ¡Invoice±í", "Error");
|
}
|
}
|
|
//ÏÔʾCumulative
|
private void DisplayCumulative()
|
{
|
try
|
{
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("select top 100 * from h_v_ZOCT_Cumulative order by CumulativeID desc ", "h_v_ZOCT_Cumulative");
|
if (Ds == null)
|
{
|
pubCls.Add_Log("¶ÁÈ¡Cumulativeʧ°Ü!ûÓÐÊý¾Ý£¡", "¶ÁÈ¡Cumulative±í", "Sysytem");
|
return;
|
}
|
grdCumulative.DataSource = Ds.Tables[0];
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("¶ÁÈ¡Cumulativeʧ°Ü!" + e.Message, "¶ÁÈ¡Cumulative±í", "Error");
|
}
|
}
|
|
private void fq_Click(object sender, EventArgs e)
|
{
|
Display();
|
}
|
|
private void cmdStrat_Click(object sender, EventArgs e)
|
{
|
EDIStrat();
|
}
|
|
private void EDIStrat()
|
{
|
|
if (MessageBox.Show("È·¶¨ÒªÆô¶¯EDI·þÎñ£¿", "Ìáʾ", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
{
|
timer830.Enabled = true;
|
timer856.Enabled = true;
|
timer862.Enabled = true;
|
timerTableTo.Enabled = true;
|
timerToTable.Enabled = true;
|
//timerSend.Enabled = true;
|
timerReceive.Enabled = true;
|
lblHStatus.Text = "ÕýÔÚÔËÐÐ....";
|
tabPage6.BackColor = Color.Lavender;
|
}
|
|
}
|
|
private void EDIEnd()
|
{
|
if (MessageBox.Show("È·¶¨ÒªÆô¶¯EDI·þÎñ£¿", "Ìáʾ", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
{
|
timer830.Enabled = false;
|
timer856.Enabled = false;
|
timer862.Enabled = false;
|
timerTableTo.Enabled = false;
|
timerToTable.Enabled = false;
|
timerSend.Enabled = false;
|
timerReceive.Enabled = false;
|
lblHStatus.Text = "Í£Ö¹ÖÐ....";
|
tabPage6.BackColor = Color.White;
|
}
|
}
|
|
private void cmdStop_Click(object sender, EventArgs e)
|
{
|
EDIEnd();
|
}
|
|
|
int i830 = 0;
|
int i856 = 0;
|
int i862 = 0;
|
private void timer830_Tick(object sender, EventArgs e)
|
{
|
if (i830 > 5)
|
{
|
Receive830();
|
i830 = 0;
|
}
|
else
|
{
|
i830 = i830 + 1;
|
}
|
}
|
|
private void timer856_Tick(object sender, EventArgs e)
|
{
|
if (i856 > 5)
|
{
|
Send856();
|
i856 = 0;
|
}
|
else
|
{
|
i856 = i856 + 1;
|
}
|
}
|
|
private void timer862_Tick(object sender, EventArgs e)
|
{
|
if (i862 > 5)
|
{
|
Receive862();
|
i862 = 0;
|
}
|
else
|
{
|
i862 = i862 + 1;
|
}
|
}
|
|
/// <summary>
|
/// ½ÓÊÕ830 CSVÎļþµ½Êý¾Ý¿âÖмä±í
|
/// </summary>
|
private void Receive830()
|
{
|
try
|
{
|
|
timer830.Enabled = false;
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
|
//»ñȡδͬ²½µÄ830Êý¾Ý
|
DataSet oDs;
|
oDs = oCn.RunProcReturn("exec h_p_EDI_GetforMaxID ", "h_p_EDI_GetforMaxID");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
pubCls.Add_Log("²éѯ830±íÊý¾Ýʧ°Ü!ûÓÐÊý¾Ý£¡", "K3-830±í", "Sysytem");
|
}
|
else
|
{
|
for (int i = 0; i < oDs.Tables[0].Rows.Count; i++)
|
{
|
int HInterid = 0;
|
HInterid = DBUtility.ClsPub.isInt( oDs.Tables[0].Rows[i][0]);
|
oCn.RunProc("exec h_p_EDI_Getforintotable " + HInterid.ToString());
|
}
|
}
|
|
|
//for (int i = 1; i < 4; i++)
|
//{
|
// //¸ù¾ÝµØÖ· ÕÒµ½ CSVÎļþ¼Ð
|
// if (i == 1)
|
// {
|
// s830Path = txtHPath830.Text;
|
// HTo830Path = txtHBakPath830.Text;
|
// }
|
// else if (i == 2)
|
// {
|
// s830Path = txtHPath830_Er.Text;
|
// HTo830Path = txtHBakPath830_Er.Text;
|
// }
|
// else if (i == 3)
|
// {
|
// s830Path = txtHPath830_San.Text;
|
// HTo830Path = txtHBakPath830_San.Text;
|
// }
|
// else
|
// {
|
// s830Path = "";
|
// pubCls.Add_Log("½ÓÊÕ830CSVÎļþµ½Êý¾Ý¿âÖмä±íʧ°Ü!iÒì³££¡" , "CSVTo830Öмä±í", "Sysytem");
|
// break;
|
// }
|
// if (s830Path != "")
|
// {
|
// //¸ù¾ÝÎļþ¼Ð ¶Áȡȫ²¿CSVÎļþ
|
// TheFolder = new DirectoryInfo(s830Path);
|
// //±éÀúÎļþ
|
// foreach (FileInfo NextFile in TheFolder.GetFiles())
|
// {
|
// if (NextFile.Extension.ToUpper() == ".CSV")
|
// {
|
// System.Windows.Forms.Application.DoEvents();
|
// WriteCSVTo830Table(NextFile.FullName, NextFile.Name);
|
// System.Windows.Forms.Application.DoEvents();
|
// }
|
// }
|
// }
|
//}
|
timer830.Enabled = true;
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("²éѯ830±íÊý¾Ýʧ°Ü!" + e.Message, "K3-830±í", "Error");
|
timer830.Enabled = true;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾Ý·¾¶½« CSVдÈë 830±í
|
/// </summary>
|
/// <returns></returns>
|
private bool WriteCSVTo830Table(string sPath,string sFileName)
|
{
|
if (DBUtility.ClsPub.isStrNull(sPath) == "" )
|
{
|
pubCls.Add_Log("¸ù¾Ý·¾¶½«CSVдÈë830±íʧ°Ü,·¾¶¿Õ!", "·¾¶ToTable", "Sysytem");
|
return false;
|
}
|
try
|
{
|
int n = 0;
|
CsvStreamReader o = new CsvStreamReader(sPath);
|
clsEnvelop oEnvelop = new clsEnvelop();
|
BillNew = new clsEnvelop();
|
foreach (ArrayList oAL in o.rowAL)
|
{
|
n = n + 1;
|
if (n == 1)//±íÍ·
|
{
|
//oZOCT_EnvelopR.EnvelopRID = oAL[0].ToString();
|
//oZOCT_EnvelopR.GenerateID = oAL[0].ToString();
|
//oZOCT_EnvelopR.EnvelopRCompleted = oAL[0].ToString();
|
BillNew.omodel.EnvelopRFile = sPath;
|
BillNew.omodel.MessageTypeCode = oAL[0].ToString();
|
BillNew.omodel.MessageType = oAL[1].ToString();
|
BillNew.omodel.SenderIDTitle = oAL[2].ToString();
|
BillNew.omodel.SenderID = oAL[3].ToString();
|
BillNew.omodel.ReceiverIDTitle = oAL[4].ToString();
|
BillNew.omodel.ReceiverID = oAL[5].ToString();
|
|
}
|
if (n == 2)
|
{
|
BillNew.DetailColl830 = new List<clsEDI_DESADV>();
|
}
|
if (n >= 3)//±íÍ·
|
{
|
clsEDI_DESADV oSub = new clsEDI_DESADV();
|
//oSub.InterchangeControlNum = oAL[0].ToString();
|
//oSub.MessageReleaseNum = oAL[1].ToString();
|
//oSub.MessageReleaseDate = DateFormatToString(oAL[2].ToString());
|
//oSub.MessagePurpose = oAL[3].ToString();
|
//oSub.ScheduleType = oAL[4].ToString();
|
//oSub.HorizonStartDate = DateFormatToString(oAL[5].ToString());
|
//oSub.HorizonEndDate = DateFormatToString(oAL[6].ToString());
|
//oSub.CommentNote = oAL[7].ToString().Replace(Convert.ToChar("'"),Convert.ToChar("¡®"));
|
//oSub.ShipToGSDBCode = oAL[8].ToString();
|
//oSub.ShipFromGSDBCode = oAL[9].ToString();
|
//oSub.IntermediateConsignee = oAL[10].ToString();
|
//oSub.PartNum = oAL[11].ToString().Trim();
|
//oSub.PurchaseOrderNum = oAL[12].ToString();
|
//oSub.PartReleaseStatus = oAL[13].ToString();
|
//oSub.DockCode = oAL[14].ToString();
|
//oSub.LineFeed = oAL[15].ToString();
|
//oSub.ReserveLineFeed = oAL[16].ToString();
|
//oSub.ContactName = oAL[17].ToString().Replace(Convert.ToChar("'"), Convert.ToChar("¡®"));
|
//oSub.ContactTelephone = oAL[18].ToString();
|
//oSub.FabAuthQty = DBUtility.ClsPub.isDoule(oAL[19].ToString());
|
//oSub.FabAuthStartDate = DateFormatToString(oAL[20].ToString());
|
//oSub.FabAuthEndDate = DateFormatToString(oAL[21].ToString());
|
//oSub.MatAuthQty = DBUtility.ClsPub.isDoule(oAL[22].ToString());
|
//oSub.MatAuthStartDate = DateFormatToString(oAL[23].ToString());
|
//oSub.MatAuthEndDate = DateFormatToString(oAL[24].ToString());
|
//oSub.LastReceivedASNNum = oAL[25].ToString();
|
//oSub.LastShippedQty = DBUtility.ClsPub.isDoule(oAL[26].ToString());
|
//oSub.LastShippedDate = DateFormatToString(oAL[27].ToString());
|
//oSub.CumShippedQty = DBUtility.ClsPub.isDoule(oAL[28].ToString());
|
//oSub.CumStartDate = DateFormatToString(oAL[29].ToString());
|
//oSub.CumEndDate = DateFormatToString(oAL[30].ToString());
|
//oSub.ForecastCumQty = DBUtility.ClsPub.isDoule(oAL[31].ToString());
|
//oSub.ForecastNetQty = DBUtility.ClsPub.isDoule(oAL[32].ToString());
|
//oSub.UOM = oAL[33].ToString();
|
//oSub.ForecastStatus = oAL[34].ToString();
|
//oSub.ForecastDate = DateFormatToString(oAL[35].ToString());
|
//oSub.FlexibleForcastStartDate = DateFormatToString(oAL[36].ToString());
|
//oSub.FlexibleForcastEndDate = DateFormatToString(oAL[37].ToString());
|
//oSub.ForecastDateQualr = oAL[38].ToString();
|
BillNew.DetailColl830.Add(oSub);
|
}
|
}
|
Int64 sInterID = 0;
|
if (BillNew.AddBill830(ref DBUtility.ClsPub.sExeReturnInfo, ref sInterID,sPath,HTo830Path,sFileName))
|
{
|
pubCls.Add_Log("¸ù¾Ý·¾¶½«CSVдÈë830±í³É¹¦1 !" + sPath + " ," + DBUtility.ClsPub.sExeReturnInfo, "·¾¶ToTable", "Sysytem");
|
//
|
return true;
|
}
|
else
|
{
|
pubCls.Add_Log("¸ù¾Ý·¾¶½«CSVдÈë830±íʧ°Ü1 !" + sPath + " ," + DBUtility.ClsPub.sExeReturnInfo, "·¾¶ToTable", "Sysytem");
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("¸ù¾Ý·¾¶½«CSVдÈë830±íʧ°Ü!" + e.Message, "·¾¶ToTable", "Error");
|
return false;
|
}
|
}
|
|
|
|
/// <summary>
|
/// ¸ù¾Ý·¾¶½« CSVдÈë 862±í
|
/// </summary>
|
/// <returns></returns>
|
private bool WriteCSVTo862Table(string sPath, string sFileName)
|
{
|
if (DBUtility.ClsPub.isStrNull(sPath) == "" )
|
{
|
pubCls.Add_Log("¸ù¾Ý·¾¶½«CSVдÈë862±íʧ°Ü,·¾¶¿Õ!", "·¾¶ToTable", "Sysytem");
|
return false;
|
}
|
try
|
{
|
int n = 0;
|
CsvStreamReader o = new CsvStreamReader(sPath);
|
clsEnvelop oEnvelop = new clsEnvelop();
|
foreach (ArrayList oAL in o.rowAL)
|
{
|
n = n + 1;
|
if (n == 1)//±íÍ·
|
{
|
//oZOCT_EnvelopR.EnvelopRID = oAL[0].ToString();
|
//oZOCT_EnvelopR.GenerateID = oAL[0].ToString();
|
//oZOCT_EnvelopR.EnvelopRCompleted = oAL[0].ToString();
|
BillNew.omodel.EnvelopRFile = sPath;
|
BillNew.omodel.MessageTypeCode = oAL[0].ToString();
|
BillNew.omodel.MessageType = oAL[1].ToString();
|
BillNew.omodel.SenderIDTitle = oAL[2].ToString();
|
BillNew.omodel.SenderID = oAL[3].ToString();
|
BillNew.omodel.ReceiverIDTitle = oAL[4].ToString();
|
BillNew.omodel.ReceiverID = oAL[5].ToString();
|
|
}
|
if (n == 2)
|
{
|
BillNew.DetailColl = new List<clsZOCT_Detail862>();
|
}
|
if (n >= 3)//±íÍ·
|
{
|
clsZOCT_Detail862 oSub = new clsZOCT_Detail862();
|
oSub.InterchangeControlNum = oAL[0].ToString();
|
oSub.MessageReleaseNum = oAL[1].ToString();
|
oSub.MessageReleaseDate = DateFormatToString(oAL[2].ToString());
|
oSub.MessagePurpose = oAL[3].ToString();
|
oSub.ScheduleType = oAL[4].ToString();
|
oSub.HorizonStartDate = DateFormatToString(oAL[5].ToString());
|
oSub.HorizonEndDate = DateFormatToString(oAL[6].ToString());
|
oSub.MessageReferenceNum = oAL[7].ToString();
|
oSub.ShipToGSDBCode = oAL[8].ToString();
|
oSub.ShipFromGSDBCode = oAL[9].ToString();
|
oSub.IntermediateConsignee = oAL[10].ToString();
|
oSub.PartNum = oAL[11].ToString().Trim();
|
oSub.PurchaseOrderNum = oAL[12].ToString();
|
oSub.DockCode = oAL[13].ToString();
|
oSub.LineFeed = oAL[14].ToString();
|
oSub.ReserveLineFeed = oAL[15].ToString();
|
oSub.ContactName = oAL[16].ToString().Replace(Convert.ToChar("'"), Convert.ToChar("¡®"));
|
oSub.ContactTelephone = oAL[17].ToString();
|
oSub.LastReceivedASNNum = oAL[18].ToString();
|
oSub.LastShippedQTY = DBUtility.ClsPub.isDoule(oAL[19].ToString());
|
oSub.LastShippedDate = DateFormatToString(oAL[20].ToString());
|
oSub.CumShippedQTY = DBUtility.ClsPub.isDoule(oAL[21].ToString());
|
oSub.CumStartDate = DateFormatToString(oAL[22].ToString());
|
oSub.CumEndDate = DateFormatToString(oAL[23].ToString());
|
oSub.ForecastCumQTY = DBUtility.ClsPub.isDoule(oAL[24].ToString());
|
oSub.ForecastNetQTY = DBUtility.ClsPub.isDoule(oAL[25].ToString());
|
oSub.UOM = oAL[26].ToString();
|
oSub.ForecastStatus = oAL[27].ToString();
|
oSub.ForecastDate = DateFormatToString(oAL[28].ToString());
|
oSub.ForecastTime = DBUtility.ClsPub.isLong(oAL[29].ToString());
|
BillNew.DetailColl.Add(oSub);
|
}
|
}
|
//
|
Int64 sInterID = 0;
|
if (BillNew.AddBill(ref DBUtility.ClsPub.sExeReturnInfo, ref sInterID,sPath,HTo862Path,sFileName))
|
{
|
pubCls.Add_Log("¸ù¾Ý·¾¶½«CSVдÈë862±í³É¹¦,ÐÂÔöÍê³É!" + sPath + " ," + DBUtility.ClsPub.sExeReturnInfo, "·¾¶ToTable", "Sysytem");
|
return true;
|
}
|
else
|
{
|
pubCls.Add_Log("¸ù¾Ý·¾¶½«CSVдÈë862±íʧ°Ü,ÐÂÔöʧ°Ü!" + sPath + " ," + DBUtility.ClsPub.sExeReturnInfo, "·¾¶ToTable", "Sysytem");
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("¸ù¾Ý·¾¶½«CSVдÈë862±íʧ°Ü!" + e.Message, "·¾¶ToTable", "Error");
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// ÈÕÆÚת»» ÈÕÆÚתΪyyyyMMdd
|
/// </summary>
|
/// <param name="s"></param>
|
/// <returns></returns>
|
public string DateFormatToString(string s)
|
{
|
if (s.Trim() == "")
|
{
|
return "";
|
}
|
try
|
{
|
DateTime d = DateTime.ParseExact(s, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces); ;
|
return d.ToShortDateString();
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("ת»»ÈÕÆÚʧ°Ü£¡" + e.Message, "ת»»", "Error");
|
return "";
|
}
|
}
|
|
public bool MoveFile(string oldFile, string NewFile, ref string sReturn)
|
{
|
try
|
{
|
File.Move(oldFile, NewFile);
|
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
public bool CopyFile(string oldFile, string NewFile, ref string sReturn)
|
{
|
try
|
{
|
File.Copy(oldFile, NewFile);
|
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// ½ÓÊÕ862 CSVÎļþµ½Êý¾Ý¿âÖмä±í
|
/// </summary>
|
private void Receive862()
|
{
|
try
|
{
|
//DirectoryInfo TheFolder;
|
////½ÓÊÕ·¾¶
|
//string s862Path = "";
|
timer862.Enabled = false;
|
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
|
//»ñȡδͬ²½µÄ862Êý¾Ý
|
DataSet oDs;
|
oDs = oCn.RunProcReturn("exec h_p_EDI_GetjitMaxID ", "h_p_EDI_GetjitMaxID");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
pubCls.Add_Log("²éѯ862±íÊý¾Ýʧ°Ü!ûÓÐÊý¾Ý£¡", "K3-862±í", "Sysytem");
|
}
|
else
|
{
|
for (int i = 0; i < oDs.Tables[0].Rows.Count; i++)
|
{
|
int HInterid = 0;
|
HInterid =DBUtility.ClsPub.isInt( oDs.Tables[0].Rows[i][0]);
|
oCn.RunProc("exec h_p_EDI_Getjitintotable " + HInterid.ToString());
|
|
}
|
}
|
//for (int i = 1; i < 4; i++)
|
//{
|
// //¸ù¾ÝµØÖ· ÕÒµ½ CSVÎļþ¼Ð
|
// if (i == 1)
|
// {
|
// s862Path = txtHPath862.Text;
|
// HTo862Path = txtHBakPath862.Text;
|
// }
|
// else if (i == 2)
|
// {
|
// s862Path = txtHPath862_Er.Text;
|
// HTo862Path = txtHBakPath862_Er.Text;
|
// }
|
// else if (i == 3)
|
// {
|
// s862Path = txtHPath862_San.Text;
|
// HTo862Path = txtHBakPath862_San.Text;
|
// }
|
// else
|
// {
|
// s862Path = "";
|
// pubCls.Add_Log("½ÓÊÕ862CSVÎļþµ½Êý¾Ý¿âÖмä±íʧ°Ü!iÒì³££¡", "CSVTo862Öмä±í", "Sysytem");
|
// break;
|
// }
|
// if (s862Path != "")
|
// {
|
// //¸ù¾ÝÎļþ¼Ð ¶Áȡȫ²¿CSVÎļþ
|
// TheFolder = new DirectoryInfo(s862Path);
|
// //±éÀúÎļþ
|
// foreach (FileInfo NextFile in TheFolder.GetFiles())
|
// {
|
// if (NextFile.Extension.ToUpper() == ".CSV")
|
// {
|
// System.Windows.Forms.Application.DoEvents();
|
// WriteCSVTo862Table(NextFile.FullName, NextFile.Name);
|
// System.Windows.Forms.Application.DoEvents();
|
// }
|
// }
|
// }
|
|
//}
|
timer862.Enabled = true;
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("²éѯ862±íÊý¾Ýʧ°Ü!" + e.Message, "K3-862±í", "Error");
|
timer862.Enabled = true;
|
}
|
}
|
|
|
|
/// <summary>
|
/// ½«856Êý¾Ý¿âÖмä±í ÒýÈë CSVÎļþ
|
/// </summary>
|
private void Send856()
|
{
|
//½«Öмä±íÊý¾Ý ÒýÈëCSVÎļþ£¨±¸·ÝÎļþ¼Ð£©
|
try
|
{
|
DataSet ds;
|
ds = oCn.RunProcReturn("select top 50 EnvelopSID,MessageTypeCode from ZOCT_EnvelopS Where" +
|
" EnvelopSCompleted=0 " +
|
"order by EnvelopSID desc ", "ZOCT_EnvelopS");
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
//pubCls.Add_Log("ûÓÐҪдÈëCSVµÄ856£¬856Êý¾Ý!", "Öмä±íTo CSV", "Sysytem");
|
return;
|
}
|
else
|
{
|
timer856.Enabled = false;
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
{
|
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["MessageTypeCode"]) == "856")
|
{
|
System.Windows.Forms.Application.DoEvents();
|
Send856toCSV(DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["EnvelopSID"]));
|
System.Windows.Forms.Application.DoEvents();
|
}
|
}
|
timer856.Enabled = true;
|
}
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("»ñÈ¡856Öмä±íʧ°Ü!" + e.Message, "Öмä±íTo CSV", "Error");
|
timer856.Enabled = true;
|
}
|
|
|
}
|
|
private void Send856toCSV(Int64 iEnvelopRID)
|
{
|
if (iEnvelopRID < 0)
|
{
|
pubCls.Add_Log("ûÓÐҪдÈëCSVµÄ856£¬´íÎóµÄiEnvelopRID!" + iEnvelopRID.ToString(), "Öмä±íTo CSV", "Sysytem");
|
return;
|
}
|
if (iEnvelopRID == 642727)
|
{
|
iEnvelopRID = iEnvelopRID;
|
}
|
string s856Path = "";
|
SQLHelper.ClsCN oCnSub = new SQLHelper.ClsCN();
|
try
|
{
|
DataSet ds;
|
DataSet dsSub;
|
//oCnSub.BeginTran();
|
//¸ù¾ÝEnvelopRID»ñÈ¡ 856×Ó±íÐÅÏ¢
|
ds = oCnSub.RunProcReturn("select MessageTypeCode,MessageType,ReleaseVersion,ReceiverID,SenderID from ZOCT_EnvelopS where EnvelopSCompleted=0 and EnvelopSID=" + iEnvelopRID.ToString(), "ZOCT_EnvelopS");
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
pubCls.Add_Log("¶ÁÈ¡Öмä±íµÄ856ʧ°Ü£¬iEnvelopRID£º" + iEnvelopRID.ToString(), "Öмä±íTo CSV", "Error");
|
return;
|
}
|
else
|
{
|
if (ds.Tables[0].Rows[0]["SenderID"].ToString() == "ZZ:GS6ZA")
|
{
|
s856Path = txtHPath856_Er.Text;
|
HbakPath856 = txtHBakPath856_Er.Text;
|
}
|
else if (ds.Tables[0].Rows[0]["SenderID"].ToString() == "ZZ:EX7ZB")
|
{
|
s856Path = txtHPath856.Text;
|
HbakPath856 = txtHBakPath856.Text;
|
}
|
else
|
{
|
pubCls.Add_Log("¶ÁÈ¡Öмä±íµÄ856ʧ°Ü£¬´íÎóµÄSenderID£¬iEnvelopRID£º" + iEnvelopRID.ToString(), "Öмä±íTo CSV", "Error");
|
return;
|
}
|
}
|
dsSub = oCnSub.RunProcReturn("exec h_p_ZOCT_Detail856 " + iEnvelopRID.ToString(), "ZOCT_Detail856");
|
if (dsSub == null || dsSub.Tables[0].Rows.Count == 0)
|
{
|
pubCls.Add_Log("¶ÁÈ¡Öмä±í×Ó±íµÄ856ʧ°Ü£¬iEnvelopRID£º" + iEnvelopRID.ToString(), "Öмä±íTo CSV", "Error");
|
return;
|
}
|
string FileName = GetFileName(iEnvelopRID);
|
string FileDirectoryName = "";
|
FileDirectory(HbakPath856, s856Path, ref FileDirectoryName);
|
//Éú³ÉCSVÎļþ
|
if (SaveCSV(dsSub.Tables[0], ds.Tables[0], HbakPath856 + @"\" + FileDirectoryName + @"\" + FileName + @".csv"))
|
{
|
try
|
{
|
oCn.BeginTran();
|
//»ØÌîEnvelopRCompleted±ê¼Ç
|
oCn.RunProc("update ZOCT_EnvelopS set EnvelopSCompleted=1,envelopsfile='" + s856Path + @"\" + FileName + @".csv" + "' where EnvelopSID=" + iEnvelopRID.ToString());
|
//¸´ÖÆCSVÎļþµ½ EDIÎļþ¼Ð
|
if (CopyFile(HbakPath856 + @"\" + FileDirectoryName + @"\" + FileName + @".csv", s856Path + @"\" + FileName + @".csv", ref DBUtility.ClsPub.sExeReturnInfo) == false)
|
{
|
DBUtility.ClsPub.Add_Log("¸ù¾Ý·¾¶½«CSVдÈë856±íʧ°Ü,ÒÆ¶¯Îļþʧ°Ü!" + DBUtility.ClsPub.sExeReturnInfo, "·¾¶ToTable", "Error");
|
oCn.RollBack();
|
return;
|
}
|
oCn.Commit();
|
}
|
catch (Exception e1)
|
{
|
oCn.RollBack();
|
DBUtility.ClsPub.Add_Log("¸ù¾Ý·¾¶½«CSVдÈë856±íʧ°Ü,ÒÆ¶¯Îļþʧ°Ü2!" + DBUtility.ClsPub.sExeReturnInfo, "·¾¶ToTable", "Error");
|
return;
|
}
|
}
|
else
|
{
|
DBUtility.ClsPub.Add_Log("¸ù¾Ý·¾¶½«CSVдÈë856±íʧ°Ü,Éú³ÉÎļþʧ°Ü!" + DBUtility.ClsPub.sExeReturnInfo, "·¾¶ToTable", "Error");
|
return;
|
}
|
pubCls.Add_Log("³É¹¦Ð´ÈëCSVµÄ856£¬iEnvelopRID£º" + iEnvelopRID.ToString(), "Öмä±íTo CSV", "Sysytem");
|
//oCnSub.Commit();
|
}
|
catch (Exception e)
|
{
|
//oCnSub.RollBack();
|
pubCls.Add_Log("856Öмä±íдÈëCSVʧ°Ü!" + iEnvelopRID.ToString() + ":" + e.Message, "Öмä±íTo CSV", "Error");
|
}
|
}
|
|
private void FileDirectory(string BakFileName,string FileName,ref string FileDirectoryName)
|
{
|
string d = DBUtility.ClsPub.GetServerDate(0).Replace("-", "").Substring(0, 6);
|
FileDirectoryName = d;
|
if (Directory.Exists(BakFileName + @"\" + d))
|
{
|
return;
|
}
|
else
|
{
|
DirectoryInfo directoryInfo = new DirectoryInfo(BakFileName + @"\" + d);
|
directoryInfo.Create();
|
}
|
//=================================
|
if (Directory.Exists(FileName + @"\" + d))
|
{
|
return;
|
}
|
else
|
{
|
DirectoryInfo directoryInfo = new DirectoryInfo(FileName + @"\" + d);
|
directoryInfo.Create();
|
}
|
}
|
|
|
int iTableTo = 0;
|
int iToTable = 0;
|
|
private void timerTableTo_Tick(object sender, EventArgs e)
|
{
|
if (iTableTo > 5)
|
{
|
TableToK3();
|
iTableTo = 0;
|
}
|
else
|
{
|
iTableTo = iTableTo + 1;
|
}
|
}
|
|
/// <summary>
|
/// ½«Öмä±í830 862 Êý¾ÝдÈëK3
|
/// </summary>
|
private void TableToK3()
|
{
|
try
|
{
|
//»ñÈ¡ÐèÒª дÈëK3µÄ830 862Êý¾Ý Ñ»·
|
DataSet ds;
|
ds = oCn.RunProcReturn("select top 50 EnvelopRID,MessageTypeCode,EnvelopRFile from ZOCT_EnvelopR Where isnull(GenerateID,0)=0 " +
|
" and EnvelopRCompleted=0 " +
|
"order by EnvelopRID desc ", "ZOCT_EnvelopR");
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
pubCls.Add_Log("ûÓÐҪдÈëK3µÄ830£¬862Êý¾Ý!", "Öмä±íTo½ðµû", "Sysytem");
|
return;
|
}
|
else
|
{
|
timerTableTo.Enabled = false;
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
{
|
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["MessageTypeCode"]) == "830")
|
{
|
System.Windows.Forms.Application.DoEvents();
|
Table830ToK3(DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["EnvelopRID"]), DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["EnvelopRFile"]));
|
System.Windows.Forms.Application.DoEvents();
|
}
|
else if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["MessageTypeCode"]) == "862")
|
{
|
System.Windows.Forms.Application.DoEvents();
|
Table862ToK3(DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["EnvelopRID"]), DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["EnvelopRFile"]));
|
System.Windows.Forms.Application.DoEvents();
|
}
|
else
|
{
|
pubCls.Add_Log("·Ç830£¬862Öмä±íÊý¾Ý!", "Öмä±íTo½ðµû", "Sysytem");
|
continue;
|
}
|
}
|
timerTableTo.Enabled = true;
|
}
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("»ñÈ¡ÐèҪдÈëK3±íʧ°Ü!" + e.Message, "Öмä±íTo½ðµû", "Error");
|
timerTableTo.Enabled = true;
|
}
|
}
|
|
/// <summary>
|
/// ½«830Öмä±í дÈë ½ðµûÏúÊÛ¶©µ¥
|
/// </summary>
|
private void Table830ToK3(Int64 iInterID, string sAddr)
|
{
|
try
|
{
|
if (iInterID > 0)
|
{
|
if (iInterID == 1320003)
|
{
|
iInterID = iInterID;
|
}
|
oCn.RunProc("exec ZOCP_Handle830 " + iInterID.ToString());
|
oCn.RunProc("update ZOCT_EnvelopR set EnvelopRcompleted=1 where EnvelopRID=" + iInterID.ToString());
|
pubCls.Add_Log("³É¹¦Ð´Èë½ðµûÏúÊÛ¶©µ¥£¬830!ÄÚÂëΪ£º" + iInterID.ToString() + ",csv·¾¶£º" + sAddr, "Öмä±íTo½ðµû", "Sysytem");
|
}
|
else
|
{
|
pubCls.Add_Log("´íÎóµÄÖмä±íÄÚÂ룬830!ÄÚÂëΪ£º" + iInterID.ToString() + ",csv·¾¶£º" + sAddr, "Öмä±íTo½ðµû", "Sysytem");
|
}
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("830Öмä±íдÈë½ðµûÏúÊÛ¶©µ¥Ê§°Ü!" + iInterID.ToString() + ",±¨´íÐÅÏ¢:" + e.Message + ",csv·¾¶£º" + sAddr, "Öмä±íTo½ðµû", "Error");
|
}
|
}
|
|
|
/// <summary>
|
/// ½«862Öмä±í дÈë ½ðµû·¢»õ֪ͨµ¥
|
/// </summary>
|
private void Table862ToK3(Int64 iInterID, string sAddr)
|
{
|
try
|
{
|
if (iInterID > 0)
|
{
|
//
|
string Fbillno = "";
|
//µÝÈë Ö÷¹Ü£¬²Ö¿â£¬ÖƵ¥ÈË ÄÚÂë
|
oCn.RunProc("exec ZOCP_Handle862 " + iInterID.ToString() + "," + DBUtility.ClsPub.isLong(txtHEmpID.Tag).ToString() + "," + DBUtility.ClsPub.isLong(txtHWHID.Tag).ToString() + "," + DBUtility.ClsPub.isLong(txtHUserID.Tag).ToString() + "," + DBUtility.ClsPub.isLong(txtHDeptID.Tag).ToString() + "," + DBUtility.ClsPub.isLong(txtHYwyID.Tag).ToString());
|
//¸ù¾ÝÄÚÂë»ñÈ¡·¢»õ֪ͨµ¥ÄÚÂëºÍµ¥ºÅ
|
DataSet ds = oCn.RunProcReturn("select b.FBillNo from ZOCT_EnvelopR a inner join SEOutStock b on a.GenerateID=b.FInterID where a.EnvelopRID=" + iInterID.ToString(), "ZOCT_EnvelopR");
|
if (ds == null || ds.Tables[0].Rows.Count ==0)
|
{
|
return;
|
}
|
else
|
{
|
Fbillno = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["FBillNo"]);
|
}
|
//
|
pubCls.Add_Log("³É¹¦Ð´Èë½ðµû·¢»õ֪ͨµ¥£¬862!µ¥¾ÝºÅ£º" + Fbillno + "ÄÚÂëΪ£º" + iInterID.ToString() + ",csv·¾¶£º" + sAddr, "Öмä±íTo½ðµû", "Sysytem");
|
}
|
else
|
{
|
pubCls.Add_Log("´íÎóµÄÖмä±íÄÚÂ룬862!ÄÚÂëΪ£º" + iInterID.ToString() + ",csv·¾¶£º" + sAddr , "Öмä±íTo½ðµû", "Sysytem");
|
}
|
}
|
catch (Exception e)
|
{
|
//pubCls.Add_Log("862Öмä±íдÈë½ðµû·¢»õ֪ͨµ¥Ê§°Ü!" + iInterID.ToString() + ",csv·¾¶£º" + sAddr + ",±¨´íÐÅÏ¢:" + e.Message, "Öмä±íTo½ðµû", "Error");
|
return;
|
}
|
}
|
|
/// <summary>
|
/// ½«K3µ÷²¦µ¥Ð´ÈëÖмä±í856
|
/// </summary>
|
private void K3ToTable()
|
{
|
//»ñÈ¡ÐèÒª дÈëÖмä±íµÄ µ÷²¦µ¥ Ñ»·
|
try
|
{
|
DataSet ds;
|
ds = oCn.RunProcReturn("SELECT top 50 FInterID FROM ICStockBill WHERE FStatus = 1 AND FTranType = 41 AND " +
|
" Shouhuogc IS NOT NULL AND FHeadSelfD0145 <> '³É¹¦' " +
|
" AND NOT EXISTS(SELECT * FROM ZOCT_EnvelopS WHERE GenerateID = FInterID AND " +
|
" MessageTypeCode = '856' ) Order By FInterID desc ", "ZOCT_EnvelopR");
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
//pubCls.Add_Log("ûÓÐҪдÈë856µÄµ÷²¦µ¥£¬856Êý¾Ý!", "½ðµûToÖмä±í", "Sysytem");
|
return;
|
}
|
else
|
{
|
timerToTable.Enabled = false;
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
{
|
//½«µ÷²¦µ¥ °ü²ÄEntryID »ØÌî
|
if (UpDateEntryNoToLine(DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["FInterID"])) == true)
|
{
|
//
|
System.Windows.Forms.Application.DoEvents();
|
K3ToTable856(DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["FInterID"]));
|
System.Windows.Forms.Application.DoEvents();
|
}
|
}
|
timerToTable.Enabled = true;
|
}
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("²éѯдÈë856µÄµ÷²¦µ¥³ö´í£¬856Êý¾Ý!ÔÒò£º" + e.Message, "½ðµûToÖмä±í", "Error");
|
timerToTable.Enabled = true;
|
}
|
}
|
|
/// <summary>
|
/// ½«½ðµûµ÷²¦µÄ °ü²Ä»ØÌî ÐòºÅ
|
/// </summary>
|
/// <param name="iInterID"></param>
|
private bool UpDateEntryNoToLine(Int64 iInterID)
|
{
|
//
|
try
|
{
|
DataSet ds;
|
int m = 0;
|
ds = oCn.RunProcReturn("SELECT FEntryID,isnull(FEntrySelfD0174,'') BC FROM ICStockBillEntry where FinterID= " + iInterID.ToString() + " order by FEntryID desc", "ICStockBill");
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
pubCls.Add_Log("´íÎóµÄµ÷²¦µ¥£¬856Êý¾Ý!", "½ðµûToÖмä±í", "Sysytem");
|
return false;
|
}
|
else
|
{
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
{
|
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["BC"])!="")
|
{
|
m = m + 1;
|
}
|
oCn.RunProc("update ICStockBillEntry set FEntrySelfD0175='" + m.ToString() + "' where Finterid=" + iInterID.ToString() + " and FEntryID=" + DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["FentryID"]).ToString());
|
}
|
}
|
return true;
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("дÈë856µÄµ÷²¦µ¥³ö´í£¬856Êý¾Ý!ÔÒò£º" + e.Message, "½ðµûToÖмä±í", "Error");
|
return false;
|
}
|
}
|
|
|
/// <summary>
|
/// ½«½ðµûµ÷²¦µ¥ дÈë856Öмä±í
|
/// </summary>
|
private void K3ToTable856(Int64 iInterID)
|
{
|
try
|
{
|
if (iInterID > 0)
|
{
|
oCn.RunProc("exec ZOCP_Handle856 " + iInterID.ToString());
|
pubCls.Add_Log("µ÷²¦µ¥³É¹¦Ð´ÈëÖмä±í£¬856!ÄÚÂëΪ£º" + iInterID.ToString(), "½ðµûToÖмä±í", "Sysytem");
|
}
|
else
|
{
|
pubCls.Add_Log("´íÎóµÄµ÷²¦µ¥ÄÚÂ룬856!ÄÚÂëΪ£º" + iInterID.ToString(), "½ðµûToÖмä±í", "Sysytem");
|
}
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("½ðµûµ÷²¦µ¥Ð´Èë856Öмä±íʧ°Ü!" + iInterID.ToString() + e.Message , "½ðµûToÖмä±í", "Error");
|
}
|
}
|
|
private void timerToTable_Tick(object sender, EventArgs e)
|
{
|
if (iToTable > 5)
|
{
|
K3ToTable();
|
iToTable = 0;
|
}
|
else
|
{
|
iToTable = iToTable + 1;
|
}
|
}
|
|
private Int32 Fun_GetCol_830(string sCol)
|
{
|
return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdSub830);
|
}
|
|
private Int32 Fun_GetCol_862(string sCol)
|
{
|
return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdSub862);
|
}
|
|
private Int32 Fun_GetCol_856(string sCol)
|
{
|
return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdSub856);
|
}
|
|
private void grdSub830_DoubleClick(object sender, EventArgs e)
|
{
|
if (grdSub830.CurrentRow == null)
|
{
|
return;
|
}
|
FrmServerSub oSub = new FrmServerSub();
|
oSub.HInterID = DBUtility.ClsPub.isLong(grdSub830.CurrentRow.Cells[Fun_GetCol_830("EnvelopRID")].Value);
|
oSub.HType = "830";
|
oSub.ShowDialog();
|
}
|
|
private void grdSub862_DoubleClick(object sender, EventArgs e)
|
{
|
if (grdSub862.CurrentRow == null)
|
{
|
return;
|
}
|
FrmServerSub oSub = new FrmServerSub();
|
oSub.HInterID = DBUtility.ClsPub.isLong(grdSub862.CurrentRow.Cells[Fun_GetCol_862("EnvelopRID")].Value);
|
oSub.HType = "862";
|
oSub.ShowDialog();
|
}
|
|
private void grdSub856_DoubleClick(object sender, EventArgs e)
|
{
|
if (grdSub856.CurrentRow == null)
|
{
|
return;
|
}
|
FrmServerSub oSub = new FrmServerSub();
|
oSub.HInterID = DBUtility.ClsPub.isLong(grdSub856.CurrentRow.Cells[Fun_GetCol_856("EnvelopSID")].Value);
|
oSub.HType = "856";
|
oSub.ShowDialog();
|
}
|
|
private void tc_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
|
private void yl_Click(object sender, EventArgs e)
|
{
|
|
}
|
|
/// <summary>
|
/// ½«DataTableÖÐÊý¾ÝдÈëµ½CSVÎļþÖÐ
|
/// </summary>
|
/// <param name="dt">Ìṩ±£´æÊý¾ÝµÄDataTable</param>
|
/// <param name="fileName">CSVµÄÎļþ·¾¶</param>
|
public static bool SaveCSV(DataTable dt,DataTable dtMain, string fullPath)
|
{
|
try
|
{
|
FileInfo fi = new FileInfo(fullPath);
|
if (!fi.Directory.Exists)
|
{
|
fi.Directory.Create();
|
}
|
FileStream fs = new FileStream(fullPath, System.IO.FileMode.Create, System.IO.FileAccess.Write);
|
//StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.Default);
|
StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.Default);//¹Ø¼ü
|
string data = "";
|
//дÈë µÚÒ»ÐÐ
|
string sdata = "";
|
for (int i = 0; i < dtMain.Columns.Count; i++)
|
{
|
sdata += "" + dtMain.Rows[0][i].ToString() + "";
|
if (i < dtMain.Columns.Count - 1)
|
{
|
sdata += ",";
|
}
|
}
|
sw.WriteLine(sdata);
|
//д³ö ÁÐÃû³Æ
|
for (int i = 0; i < dt.Columns.Count; i++)
|
{
|
data += "" + dt.Columns[i].ColumnName.ToString().Replace("UOM2", "UOM").Replace("UOM1", "UOM").Replace("Packaging Type Code2", "Packaging Type Code") + "";
|
if (i < dt.Columns.Count - 1)
|
{
|
data += ",";
|
}
|
}
|
sw.WriteLine(data);
|
//д³ö¸÷ÐÐÊý¾Ý
|
for (int i = 0; i < dt.Rows.Count; i++)
|
{
|
data = "";
|
for (int j = 0; j < dt.Columns.Count; j++)
|
{
|
string str = dt.Rows[i][j].ToString();
|
str = string.Format("{0}", str);
|
data += str;
|
if (j < dt.Columns.Count - 1)
|
{
|
data += ",";
|
}
|
}
|
sw.WriteLine(data);
|
}
|
sw.Close();
|
fs.Close();
|
return true;
|
}
|
catch
|
{
|
return false;
|
}
|
}
|
|
|
|
|
private string GetFileName(Int64 sID)
|
{
|
return DateTime.Now.ToString().Replace("-","").Replace(":","").Replace(" ","") + "_856_F159B_" + sID.ToString();
|
}
|
|
private void cmdHPath830_Click(object sender, EventArgs e)
|
{
|
SaveFileDialog oSD = new SaveFileDialog();
|
oSD.ShowDialog();
|
if (oSD.FileName != "")
|
{
|
txtHPath830.Text = oSD.FileName;
|
}
|
}
|
|
private void button1_Click(object sender, EventArgs e)
|
{
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHPath830", txtHPath830.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHPath830_Er", txtHPath830_Er.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHPath830_San", txtHPath830_San.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHPath862", txtHPath862.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHPath862_Er", txtHPath862_Er.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHPath862_San", txtHPath862_San.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHPath856", txtHPath856.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHPath856_Er", txtHPath856_Er.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
//Pub_Class.ClsIni.WriteIni("PathInfo", "txtHPath830", txtHPath856.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHBakPath830", txtHBakPath830.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHBakPath830_Er", txtHBakPath830_Er.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHBakPath830_San", txtHBakPath830_San.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHBakPath862", txtHBakPath862.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHBakPath862_Er", txtHBakPath862_Er.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHBakPath862_San", txtHBakPath862_San.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHBakPath856", txtHBakPath856.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("PathInfo", "txtHBakPath856_Er", txtHBakPath856_Er.Text, DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
|
//
|
Pub_Class.ClsIni.WriteIni("BillInfo", "txtHUserID",DBUtility.ClsPub.isLong(txtHUserID.Tag).ToString(), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("BillInfo", "txtHEmpID", DBUtility.ClsPub.isLong(txtHEmpID.Tag).ToString(), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("BillInfo", "txtHWHID", DBUtility.ClsPub.isLong(txtHWHID.Tag).ToString(), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("BillInfo", "txtHDeptID", DBUtility.ClsPub.isLong(txtHDeptID.Tag).ToString(), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
Pub_Class.ClsIni.WriteIni("BillInfo", "txtHYwyID", DBUtility.ClsPub.isLong(txtHYwyID.Tag).ToString(), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
}
|
|
private void button2_Click(object sender, EventArgs e)
|
{
|
txtHPath830.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath830", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath830_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath830_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath830_San.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath830_San", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath862.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath862", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath862_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath862_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath862_San.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath862_San", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath856.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath856", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHPath856_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath856_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
//txtHPath830.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHPath830", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
|
|
|
txtHBakPath830.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath830", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath830_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath830_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath830_San.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath830_San", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath862.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath862", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath862_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath862_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath862_San.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath862_San", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath856.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath856", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHBakPath856_Er.Text = Pub_Class.ClsIni.ReadIni("PathInfo", "txtHBakPath856_Er", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
|
//
|
//
|
DAL.ClsK3_User_View oUser = new DAL.ClsK3_User_View();
|
DAL.ClsK3_Warehouse_View oWH = new DAL.ClsK3_Warehouse_View();
|
DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View();
|
DAL.ClsK3_Department_View oDept = new DAL.ClsK3_Department_View();
|
DAL.ClsK3_Employee_View oYwy = new DAL.ClsK3_Employee_View();
|
txtHUserID.Tag = Pub_Class.ClsIni.ReadIni("BillInfo", "txtHUserID", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHEmpID.Tag = Pub_Class.ClsIni.ReadIni("BillInfo", "txtHEmpID", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHWHID.Tag = Pub_Class.ClsIni.ReadIni("BillInfo", "txtHWHID", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHDeptID.Tag = Pub_Class.ClsIni.ReadIni("BillInfo", "txtHDeptID", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
txtHYwyID.Tag = Pub_Class.ClsIni.ReadIni("BillInfo", "txtHYwyID", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
|
if (oUser.GetInfoByID(DBUtility.ClsPub.isLong(txtHUserID.Tag)))
|
{
|
txtHUserID.Tag = oUser.omodel.HItemID.ToString();
|
txtHUserID.Text = oUser.omodel.HName;
|
}
|
else
|
{
|
txtHUserID.Tag = "";
|
txtHUserID.Text = "";
|
}
|
|
if (oWH.GetInfoByID(DBUtility.ClsPub.isLong(txtHWHID.Tag)))
|
{
|
txtHWHID.Tag = oWH.omodel.HItemID.ToString();
|
txtHWHID.Text = oWH.omodel.HName;
|
}
|
else
|
{
|
txtHWHID.Tag = "";
|
txtHWHID.Text = "";
|
}
|
|
|
if (oEmp.GetInfoByID(DBUtility.ClsPub.isLong(txtHEmpID.Tag)))
|
{
|
txtHEmpID.Tag = oEmp.omodel.HItemID.ToString();
|
txtHEmpID.Text = oEmp.omodel.HName;
|
}
|
else
|
{
|
txtHEmpID.Tag = "";
|
txtHEmpID.Text = "";
|
}
|
|
//
|
if (oDept.GetInfoByID(DBUtility.ClsPub.isLong(txtHDeptID.Tag)))
|
{
|
txtHDeptID.Tag = oDept.omodel.HItemID.ToString();
|
txtHDeptID.Text = oDept.omodel.HName;
|
}
|
else
|
{
|
txtHDeptID.Tag = "";
|
txtHDeptID.Text = "";
|
}
|
//
|
if (oYwy.GetInfoByID(DBUtility.ClsPub.isLong(txtHYwyID.Tag)))
|
{
|
txtHYwyID.Tag = oYwy.omodel.HItemID.ToString();
|
txtHYwyID.Text = oYwy.omodel.HName;
|
}
|
else
|
{
|
txtHYwyID.Tag = "";
|
txtHYwyID.Text = "";
|
}
|
|
|
}
|
|
private void button9_Click(object sender, EventArgs e)
|
{
|
DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View();
|
if (oEmp.RefreshViewForBig())
|
{
|
this.txtHEmpID.Text = oEmp.oModel.HName;
|
this.txtHEmpID.Tag = oEmp.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHEmpID.Text = "";
|
}
|
}
|
|
private void button10_Click(object sender, EventArgs e)
|
{
|
DAL.ClsK3_Warehouse_View oWH = new DAL.ClsK3_Warehouse_View();
|
if (oWH.RefreshViewForBig())
|
{
|
this.txtHWHID.Text = oWH.oModel.HName;
|
this.txtHWHID.Tag = oWH.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHWHID.Text = "";
|
}
|
}
|
|
private void button8_Click(object sender, EventArgs e)
|
{
|
DAL.ClsK3_User_View oUser = new DAL.ClsK3_User_View();
|
if (oUser.RefreshViewForBig())
|
{
|
this.txtHUserID.Text = oUser.oModel.HName;
|
this.txtHUserID.Tag = oUser.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHUserID.Text = "";
|
}
|
}
|
|
private void txtHUserID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHUserID.Text.Trim() == "")
|
{
|
txtHUserID.Tag = "";
|
}
|
}
|
|
private void txtHEmpID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHEmpID.Text.Trim() == "")
|
{
|
txtHEmpID.Tag = "";
|
}
|
}
|
|
private void txtHWHID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHWHID.Text.Trim() == "")
|
{
|
txtHWHID.Tag = "";
|
}
|
}
|
|
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
{
|
if (checkBox1.Checked)
|
{
|
DBUtility.ClsPub.CBCurYear = 9999;
|
}
|
else
|
{
|
DBUtility.ClsPub.CBCurYear = 0;
|
}
|
}
|
|
private void cmdHYwyID_Click(object sender, EventArgs e)
|
{
|
DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View();
|
if (oEmp.RefreshViewForBig())
|
{
|
this.txtHYwyID.Text = oEmp.oModel.HName;
|
this.txtHYwyID.Tag = oEmp.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHYwyID.Text = "";
|
}
|
}
|
|
private void cmdHDeptID_Click(object sender, EventArgs e)
|
{
|
DAL.ClsK3_Department_View oDept = new DAL.ClsK3_Department_View();
|
if (oDept.RefreshViewForBig())
|
{
|
this.txtHDeptID.Text = oDept.oModel.HName;
|
this.txtHDeptID.Tag = oDept.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHDeptID.Text = "";
|
}
|
}
|
|
private void txtHDeptID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHDeptID.Text.Trim() == "")
|
{
|
txtHDeptID.Tag = "";
|
}
|
}
|
|
private void txtHYwyID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHYwyID.Text.Trim() == "")
|
{
|
txtHYwyID.Tag = "";
|
}
|
}
|
|
int itimerReceive = 0;
|
private void timerReceive_Tick(object sender, EventArgs e)
|
{
|
try
|
{
|
if (itimerReceive > 1)
|
{
|
Process proc = null;
|
proc = new Process();
|
proc.StartInfo.FileName = @"D:\httpclient_v2.0\receive.bat";
|
proc.StartInfo.Arguments = string.Format("10");//this is argument
|
proc.StartInfo.CreateNoWindow = false;
|
//ÒþʽÔËÐÐ
|
proc.StartInfo.UseShellExecute = true;
|
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
//
|
proc.Start();
|
proc.WaitForExit();
|
|
itimerReceive = 0;
|
}
|
else
|
{
|
itimerReceive = itimerReceive + 1;
|
}
|
|
}
|
catch (Exception e1)
|
{
|
pubCls.Add_Log("½ÓÊÕ¿Âάѫʧ°Ü!" + e1.Message, "¿Âάѫ", "Error");
|
itimerReceive = 0;
|
}
|
}
|
|
int itimerSend = 0;
|
private void timerSend_Tick(object sender, EventArgs e)
|
{
|
try
|
{
|
if (itimerSend > 1)
|
{
|
Process proc = null;
|
proc = new Process();
|
proc.StartInfo.FileName = @"D:\httpclient_v2.0\send.bat";
|
proc.StartInfo.Arguments = string.Format("10");//this is argument
|
proc.StartInfo.CreateNoWindow = false;
|
//ÒþʽÔËÐÐ
|
proc.StartInfo.UseShellExecute = true;
|
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
//
|
proc.Start();
|
proc.WaitForExit();
|
itimerSend = 0;
|
}
|
else
|
{
|
itimerSend = itimerSend + 1;
|
}
|
}
|
catch (Exception e1)
|
{
|
pubCls.Add_Log("·¢ËÍ¿Âάѫʧ°Ü!" + e1.Message, "¿Âάѫ", "Error");
|
itimerSend = 0;
|
}
|
}
|
|
private void timerTableTo830_Tick(object sender, EventArgs e)
|
{
|
if (iTableTo > 5)
|
{
|
TableToK3830();
|
iTableTo = 0;
|
}
|
else
|
{
|
iTableTo = iTableTo + 1;
|
}
|
}
|
/// <summary>
|
/// ½«Öмä±í 830 Êý¾ÝдÈëK3
|
/// </summary>
|
private void TableToK3830()
|
{
|
try
|
{
|
//»ñÈ¡ÐèÒª дÈëK3µÄ830Êý¾Ý Ñ»·
|
DataSet ds;
|
ds = oCn.RunProcReturn("select * from EDI_delfor_master_info where issc=0", "EDI_delfor_master_info");
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
pubCls.Add_Log("ûÓÐҪдÈëK3µÄ830Êý¾Ý!", "Öмä±íTo½ðµû", "Sysytem");
|
return;
|
}
|
else
|
{
|
timerTableTo.Enabled = false;
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
{
|
Table830ToK3(DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["id"]));
|
}
|
timerTableTo.Enabled = true;
|
}
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("»ñÈ¡ÐèҪдÈëK3±íʧ°Ü!" + e.Message, "Öмä±íTo½ðµû", "Error");
|
timerTableTo.Enabled = true;
|
}
|
}
|
/// <summary>
|
/// ½«830Öмä±í дÈë ½ðµû²úÆ·Ô¤²âµ¥
|
/// </summary>
|
private void Table830ToK3(Int64 iInterID)
|
{
|
try
|
{
|
if (iInterID > 0)
|
{
|
oCn.RunProc("exec h_p_EDI_WriteIntoPPOrder " + iInterID.ToString());
|
oCn.RunProc("update EDI_delfor_master_info set issc=1 where id=" + iInterID.ToString());
|
pubCls.Add_Log("³É¹¦Ð´Èë½ðµû²úÆ·Ô¤²âµ¥£¬830!ÄÚÂëΪ£º" + iInterID.ToString(), "Öмä±íTo½ðµû", "Sysytem");
|
}
|
else
|
{
|
pubCls.Add_Log("´íÎóµÄÖмä±íÄÚÂ룬830!ÄÚÂëΪ£º" + iInterID.ToString(), "Öмä±íTo½ðµû", "Sysytem");
|
}
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("830Öмä±íдÈë½ðµû²úÆ·Ô¤²âµ¥Ê§°Ü!" + iInterID.ToString() + ",±¨´íÐÅÏ¢:" + e.Message, "Öмä±íTo½ðµû", "Error");
|
}
|
}
|
|
private void timerTableTo862_Tick(object sender, EventArgs e)
|
{
|
if (iTableTo > 5)
|
{
|
TableToK3862();
|
iTableTo = 0;
|
}
|
else
|
{
|
iTableTo = iTableTo + 1;
|
}
|
}
|
/// <summary>
|
/// ½«Öмä±í 862 Êý¾ÝдÈëK3
|
/// </summary>
|
private void TableToK3862()
|
{
|
try
|
{
|
//»ñÈ¡ÐèÒª дÈëK3µÄ862Êý¾Ý Ñ»·
|
DataSet ds;
|
ds = oCn.RunProcReturn("select * from EDI_deljit_master_info where issc=0", "EDI_delfor_master_info");
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
pubCls.Add_Log("ûÓÐҪдÈëK3µÄ862Êý¾Ý!", "Öмä±íTo½ðµû", "Sysytem");
|
return;
|
}
|
else
|
{
|
timerTableTo.Enabled = false;
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
{
|
Table862ToK3(DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["id"]));
|
}
|
timerTableTo.Enabled = true;
|
}
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("»ñÈ¡ÐèҪдÈëK3±íʧ°Ü!" + e.Message, "Öмä±íTo½ðµû", "Error");
|
timerTableTo.Enabled = true;
|
}
|
}
|
/// <summary>
|
/// ½«862Öмä±í дÈë ½ðµû·¢»õ֪ͨµ¥
|
/// </summary>
|
private void Table862ToK3(Int64 iInterID)
|
{
|
try
|
{
|
if (iInterID > 0)
|
{
|
oCn.RunProc("exec h_p_EDI_WriteIntoSeOutStock " + iInterID.ToString());
|
oCn.RunProc("update EDI_deljit_master_info set issc=1 where id=" + iInterID.ToString());
|
pubCls.Add_Log("³É¹¦Ð´Èë½ðµû²úÆ·Ô¤²âµ¥£¬862!ÄÚÂëΪ£º" + iInterID.ToString(), "Öмä±íTo½ðµû", "Sysytem");
|
}
|
else
|
{
|
pubCls.Add_Log("´íÎóµÄÖмä±íÄÚÂ룬862!ÄÚÂëΪ£º" + iInterID.ToString(), "Öмä±íTo½ðµû", "Sysytem");
|
}
|
}
|
catch (Exception e)
|
{
|
pubCls.Add_Log("862Öмä±íдÈë½ðµû·¢»õ֪ͨµ¥Ê§°Ü!" + iInterID.ToString() + ",±¨´íÐÅÏ¢:" + e.Message, "Öмä±íTo½ðµû", "Error");
|
}
|
}
|
}
|
}
|