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 FrmServerFZ : Form
{
//´´½¨NotifyIcon¶ÔÏó
NotifyIcon notifyicon = new NotifyIcon();
//´´½¨ÍÐÅÌͼ±ê¶ÔÏó
Icon ico = new Icon("ͬ²½³ÌÐò.ico");
//´´½¨ÍÐÅ̲˵¥¶ÔÏó
ContextMenu notifyContextMenu = new ContextMenu();
public FrmServerFZ()
{
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\";
///
/// ±¸·Ý·¾¶
///
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();
WMSWeb.WebService1 oWeb = new WMSWeb.WebService1();
private void FrmServerFZ_Load(object sender, EventArgs e)
{
initGrid();
//
}
private void initGrid()
{
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()
{
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()
{
}
//ÏÔʾ862
private void Display862()
{
}
//ÏÔʾ856
private void Display856()
{
}
//ÏÔʾ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("È·¶¨ÒªÆô¶¯Í¬²½·þÎñ£¿", "Ìáʾ", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
//if (material.Checked)
//{
// timertoOtherOut.Enabled = true;
//}
textnote.Text = "";
//timer830.Enabled = true;
//timer856.Enabled = true;
//timer862.Enabled = true;
//timerTableTo.Enabled = true;
//timerToTable.Enabled = true;
////timerSend.Enabled = true;
//timerReceive.Enabled = true;
timertoFengZhou.Enabled = true;
lblHStatus.Text = "ÕýÔÚÔËÐÐ....";
tabPage6.BackColor = Color.Lavender;
//txtNote.Text = "";
//txtNote1.Text = "";
////txtNote2.Text = "";
//txtNote3.Text = "";
////txtNote4.Text = "";
//txtNote5.Text = "";
////txtNote6.Text = "";
//txtNote7.Text = "";
}
}
private void EDIEnd()
{
if (MessageBox.Show("È·¶¨ÒªÔÝͣͬ²½·þÎñ£¿", "Ìáʾ", 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;
//timertoMaterial.Enabled = false;
//timertoCus.Enabled = false;
//timertoPrice.Enabled = false;
//timertoOtherIn.Enabled = false;
//timertoOtherOut.Enabled = false;
timertoFengZhou.Enabled = false;
lblHStatus.Text = "Í£Ö¹ÖÐ....";
tabPage6.BackColor = Color.White;
//txtNote.Text = "";
//txtNote1.Text = "";
//txtNote2.Text = "";
//txtNote3.Text = "";
//txtNote4.Text = "";
//txtNote5.Text = "";
//txtNote6.Text = "";
}
}
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)
{
}
private void timer862_Tick(object sender, EventArgs e)
{
if (i862 > 5)
{
Receive862();
i862 = 0;
}
else
{
i862 = i862 + 1;
}
}
///
/// ½ÓÊÕ830 CSVÎļþµ½Êý¾Ý¿âÖмä±í
///
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;
}
}
///
/// ¸ù¾Ý·¾¶½« CSVдÈë 830±í
///
///
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();
}
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;
}
}
///
/// ¸ù¾Ý·¾¶½« CSVдÈë 862±í
///
///
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();
}
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;
}
}
///
/// ÈÕÆÚת»» ÈÕÆÚתΪyyyyMMdd
///
///
///
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;
}
}
///
/// ½ÓÊÕ862 CSVÎļþµ½Êý¾Ý¿âÖмä±í
///
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;
}
}
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;
}
}
///
/// ½«Öмä±í830 862 Êý¾ÝдÈëK3
///
private void TableToK3()
{
}
///
/// ½«830Öмä±í дÈë ½ðµûÏúÊÛ¶©µ¥
///
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");
}
}
///
/// ½«K3µ÷²¦µ¥Ð´ÈëÖмä±í856
///
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;
}
}
///
/// ½«½ðµûµ÷²¦µÄ °ü²Ä»ØÌî ÐòºÅ
///
///
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;
}
}
///
/// ½«½ðµûµ÷²¦µ¥ дÈë856Öмä±í
///
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 void grdSub830_DoubleClick(object sender, EventArgs e)
{
//if (grdSub830.CurrentRow == null)
//{
// return;
//}
//FrmServerFZSub oSub = new FrmServerFZSub();
//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;
//}
//FrmServerFZSub oSub = new FrmServerFZSub();
//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;
//}
//FrmServerFZSub oSub = new FrmServerFZSub();
//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)
{
}
///
/// ½«DataTableÖÐÊý¾ÝдÈëµ½CSVÎļþÖÐ
///
/// Ìṩ±£´æÊý¾ÝµÄDataTable
/// CSVµÄÎļþ·¾¶
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();
}
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;
}
}
///
/// ½«Öмä±í 830 Êý¾ÝдÈëK3
///
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;
}
}
///
/// ½«830Öмä±í дÈë ½ðµû²úÆ·Ô¤²âµ¥
///
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;
}
}
///
/// ½«Öмä±í 862 Êý¾ÝдÈëK3
///
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;
}
}
///
/// ½«862Öмä±í дÈë ½ðµû·¢»õ֪ͨµ¥
///
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");
}
}
//http://10.1.200.100/WEB_FZ/WebService1.asmx
//http://localhost/WEB_FZ/WebService1.asmx
int Materialtime = 0;
// private void timertoMaterial_Tick(object sender, EventArgs e)
//{
// if (Materialtime > 1)
// {
// TableToK3Material();
// Materialtime = 0;
// }
// else
// {
// Materialtime = Materialtime + 1;
// }
// }
// ///
// /// ½«Öмä±í ÎïÁÏ Êý¾ÝдÈëK3
// ///
// private void TableToK3Material()
// {
// try
// {
// string txt = "";
// string tt = "";
// txtNote.Text = txt;
// //timertoMaterial.Enabled = false;
// textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½ÎïÁÏ»ù´¡×ÊÁÏ" + DateTime.Now.ToString()+tt;
// oWeb.set_SaveMaterial_CLD(ref tt,ref txt,ref DBUtility.ClsPub.sErrInfo);
// txtNote.Text = txt + DBUtility.ClsPub.sErrInfo;
// timertoMaterial.Enabled = true;
// textnote.Text = textnote.Text + ",ͬ²½ÎïÁÏ»ù´¡×ÊÁϽáÊø" + DateTime.Now.ToString()+tt;
// }
// catch (Exception e)
// {
// pubCls.Add_Log("»ñÈ¡ÐèҪдÈëK3ÎïÁϱíʧ°Ü!" + e.Message, "Öмä±íTo½ðµûÎïÁϱí", "Error");
// timertoMaterial.Enabled = true;
// }
// }
// int Custime = 0;
// private void timertoCus_Tick(object sender, EventArgs e)
// {
// if (Custime > 1)
// {
// TableToK3Cus();
// Custime = 0;
// }
// else
// {
// Custime = Custime + 1;
// }
// }
// ///
// /// ½«Öмä±í ¿Í»§ Êý¾ÝдÈëK3
// ///
// private void TableToK3Cus()
// {
// try
// {
// string txt = "";
// txtNote1.Text = txt;
// timertoCus.Enabled = false;
// //MessageBox.Show("1");
// textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½¿Í»§»ù´¡×ÊÁÏ" + DateTime.Now.ToString();
// oWeb.set_SaveCustomer_CLD(ref txt, ref DBUtility.ClsPub.sErrInfo);
// txtNote1.Text = txt;
// timertoCus.Enabled = true;
// textnote.Text = textnote.Text + ",ͬ²½¿Í»§»ù´¡×ÊÁϽáÊø" + DateTime.Now.ToString();
// }
// catch (Exception e)
// {
// pubCls.Add_Log("»ñÈ¡ÐèҪдÈëK3¿Í»§±íʧ°Ü!" + e.Message, "Öмä±íTo½ðµû¿Í»§±í", "Error");
// timertoCus.Enabled = true;
// }
// }
//int PriceTime = 0;
//private void timertoPrice_Tick(object sender, EventArgs e)
//{
// if (PriceTime > 1)
// {
// TableToK3Price();
// PriceTime = 0;
// }
// else
// {
// PriceTime = PriceTime + 1;
// }
//}
/////
///// ½«Öмä±íÏúÊÛ¼ÛÄ¿ Êý¾ÝдÈëK3
/////
//private void TableToK3Price()
//{
// try
// {
// string txt = "";
// string tt = " ";
// txtNote7.Text = txt;
// timertoCus.Enabled = false;
// //MessageBox.Show("1");
// textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½¼ÛÄ¿±í" + DateTime.Now.ToString();
// oWeb.set_SaveSellPrice_CLD_2(ref txt, ref DBUtility.ClsPub.sErrInfo, ref tt);
// txtNote7.Text = txt;
// timertoPrice.Enabled = true;
// textnote.Text = textnote.Text + ",ͬ²½¼ÛÄ¿±í½áÊø" + DateTime.Now.ToString() + DBUtility.ClsPub.sErrInfo + tt.ToString();
// }
// catch (Exception e)
// {
// pubCls.Add_Log("»ñÈ¡ÐèҪдÈëK3¼ÛÄ¿±íºÍÕÛ¿Û±íʧ°Ü!" + e.Message, "Öмä±íTo½ðµû¼ÛÄ¿ÕÛ¿Û±í", "Error");
// timertoPrice.Enabled = true;
// textnote.Text = textnote.Text + ",ͬ²½¼ÛÄ¿±í½áÊø" + DateTime.Now.ToString() + DBUtility.ClsPub.sErrInfo;
// }
//}
//int DisCountTime = 0;
//private void timertoDisCount_Tick_1(object sender, EventArgs e)
//{
// if (DisCountTime > 1)
// {
// TableToK3Discount();
// DisCountTime = 0;
// }
// else
// {
// DisCountTime = DisCountTime + 1;
// }
//}
//private void TableToK3Discount()
//{
// try
// {
// string tt = "";
// string txt = "";
// txtNote2.Text = txt;
// timertoDisCount.Enabled = false;
// textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½ÕÛ¿Û±í" + DateTime.Now.ToString();
// //MessageBox.Show("1");
// oWeb.set_SaveSellPrice_CLD_1(ref txt, ref DBUtility.ClsPub.sErrInfo, ref tt);
// txtNote2.Text = txt;
// timertoDisCount.Enabled = true;
// textnote.Text = textnote.Text + ",ͬ²½ÕÛ¿Û±í½áÊø" + DateTime.Now.ToString() + tt.ToString();
// }
// catch (Exception e)
// {
// pubCls.Add_Log("»ñÈ¡ÐèҪдÈëÕÛ¿Û±íʧ°Ü!" + e.Message, "Öмä±íTo½ðµûÕÛ¿Û±í", "Error");
// timertoDisCount.Enabled = true;
// }
//}
//int OtherInTime = 0;
//private void timertoOtherIn_Tick(object sender, EventArgs e)
//{
// if (OtherInTime > 1)
// {
// TableToK3OtherIn();
// OtherInTime = 0;
// }
// else
// {
// OtherInTime = OtherInTime + 1;
// }
//}
/////
///// ½«Öмä±íÆäËûÈë¿âµ¥ Êý¾ÝдÈëK3
/////
//private void TableToK3OtherIn()
//{
// try
// {
// string txt = "";
// string tt = "";
// txtNote3.Text = txt;
// timertoOtherIn.Enabled = false;
// textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½ÆäËûÈë¿âµ¥" + DateTime.Now.ToString();
// //MessageBox.Show("1");
// oWeb.set_SaveOrtherIn_CLD(ref tt,ref txt, ref DBUtility.ClsPub.sErrInfo);
// txtNote3.Text = txt + DBUtility.ClsPub.sErrInfo + tt;
// timertoOtherIn.Enabled = true;
// textnote.Text = textnote.Text + ",ͬ²½ÆäËûÈë¿âµ¥½áÊø" + DateTime.Now.ToString();
// }
// catch (Exception e)
// {
// pubCls.Add_Log("»ñÈ¡ÐèҪдÈëÆäËûÈë¿âµ¥Ê§°Ü!" + e.Message, "Öмä±íTo½ðµûÆäËûÈë¿â±í", "Error");
// timertoOtherIn.Enabled = true;
// }
//}
//int OtherOutTime = 0;
//private void timertoOtherOut_Tick(object sender, EventArgs e)
//{
// if (OtherOutTime > 1)
// {
// TableToK3OtherOut();
// OtherOutTime = 0;
// }
// else
// {
// OtherOutTime = OtherOutTime + 1;
// }
//}
/////
///// ½«Öмä±íÆäËû³ö¿âµ¥ Êý¾ÝдÈëK3
/////
//private void TableToK3OtherOut()
//{
// try
// {
// string txt = "";
// txtNote4.Text = txt;
// timertoOtherOut.Enabled = false;
// textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½ÆäËû³ö¿â±í" + DateTime.Now.ToString();
// oWeb.set_SaveOtherOut_CLD(ref txt, ref DBUtility.ClsPub.sErrInfo);
// txtNote4.Text = txt;
// timertoOtherOut.Enabled = true;
// textnote.Text = textnote.Text + ",ͬ²½ÆäËû³ö¿â±í½áÊø" + DateTime.Now.ToString();
// }
// catch (Exception e)
// {
// pubCls.Add_Log("»ñÈ¡ÐèҪдÈëK3ÆäËû³ö¿â±íʧ°Ü!" + e.Message, "Öмä±íTo½ðµûÆäËû³ö¿â±í", "Error");
// timertoOtherOut.Enabled = true;
// }
//}
//int SellOutTime = 0;
//private void timertoSellOut_Tick_1(object sender, EventArgs e)
//{
// if (SellOutTime > 1)
// {
// TableToK3SellOut();
// SellOutTime = 0;
// }
// else
// {
// SellOutTime = SellOutTime + 1;
// }
//}
////
///// ½«Öмä±íÏúÊÛ³ö¿âµ¥ Êý¾ÝдÈëK3
/////
//private void TableToK3SellOut()
//{
// try
// {
// string tt = " ";
// string txt = "";
// txtNote5.Text = txt;
// timertoSellOut.Enabled = false;
// textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½ÏúÊÛ³ö¿â±í" + DateTime.Now.ToString();
// textnote.Text = textnote.Text + oWeb.Url.ToString();
// oWeb.set_SaveSellOut_CLD(ref txt, ref DBUtility.ClsPub.sErrInfo, ref tt);
// txtNote5.Text = txt;
// timertoSellOut.Enabled = true;
// textnote.Text = textnote.Text + ",ͬ²½ÏúÊÛ³ö¿â±í½áÊø" + DateTime.Now.ToString() + DBUtility.ClsPub.sErrInfo + tt.ToString();
// }
// catch (Exception e)
// {
// pubCls.Add_Log("»ñÈ¡ÐèҪдÈëK3ÏúÊÛ³ö¿âµ¥Ê§°Ü!" + e.Message, "Öмä±íTo½ðµûÏúÊÛ³ö¿â±í", "Error");
// timertoSellOut.Enabled = true;
// }
//}
//int SellReturnTime = 0;
//private void timertoSellReturn_Tick_1(object sender, EventArgs e)
//{
// if (SellReturnTime > 1)
// {
// TableToK3SellReturn();
// SellReturnTime = 0;
// }
// else
// {
// SellReturnTime = SellReturnTime + 1;
// }
//}
////
///// ½«Öмä±íÏúÊÛÍË»õµ¥ Êý¾ÝдÈëK3
/////
//private void TableToK3SellReturn()
//{
// try
// {
// string txt = "";
// string tt = "";
// txtNote6.Text = txt;
// timertoSellReturn.Enabled = false;
// textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½ÏúÊÛÍË»õµ¥" + DateTime.Now.ToString();
// oWeb.set_SaveSellReturn_CLD(ref txt, ref DBUtility.ClsPub.sErrInfo, ref tt);
// txtNote6.Text = txt;
// timertoSellReturn.Enabled = true;
// textnote.Text = textnote.Text + ",ͬ²½ÏúÊÛÍË»õµ¥½áÊø" + DateTime.Now.ToString() + tt.ToString();
// }
// catch (Exception e)
// {
// pubCls.Add_Log("»ñÈ¡ÐèҪдÈëK3ÏúÊÛÍË»õµ¥Ê§°Ü!" + e.Message, "Öмä±íTo½ðµûÏúÊÛÍË»õµ¥", "Error");
// timertoSellReturn.Enabled = true;
// }
//}
private void timertoFengZhou_Tick(object sender, EventArgs e)
{
try
{
string tt = "";
string txt = "";
timertoFengZhou.Enabled = false;
if (chkMaterial.Checked == true)
{
textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½ÎïÁÏ»ù´¡×ÊÁÏ" + DateTime.Now.ToString();
oWeb.set_SaveMaterial_CLD(ref tt, ref txt, ref DBUtility.ClsPub.sErrInfo);
textnote.Text = textnote.Text + ",ͬ²½ÎïÁÏ»ù´¡×ÊÁϽáÊø" + DateTime.Now.ToString() + tt;
}
if (chkCustomer.Checked == true)
{
textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½¿Í»§»ù´¡×ÊÁÏ" + DateTime.Now.ToString();
oWeb.set_SaveCustomer_CLD(ref txt, ref DBUtility.ClsPub.sErrInfo);
textnote.Text = textnote.Text + ",ͬ²½ÎïÁϿͻ§×ÊÁϽáÊø" + DateTime.Now.ToString() + tt;
}
if (chkOtherIn.Checked == true)
{
textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½ÆäËûÈë¿â±í" + DateTime.Now.ToString();
oWeb.set_SaveOrtherIn_CLD(ref txt, ref DBUtility.ClsPub.sErrInfo, ref tt);
textnote.Text = textnote.Text + ",ͬ²½ÆäËûÈë¿â±í½áÊø" + DateTime.Now.ToString() + tt;
}
if (chkOtherOut.Checked == true)
{
textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½ÆäËû³ö¿â±í" + DateTime.Now.ToString();
oWeb.set_SaveOtherOut_CLD(ref txt, ref DBUtility.ClsPub.sErrInfo);
textnote.Text = textnote.Text + ",ͬ²½ÆäËû³ö¿â±í½áÊø" + DateTime.Now.ToString();
}
if (chkSellOut.Checked == true)
{
textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½ÏúÊÛ³ö¿â±í" + DateTime.Now.ToString();
oWeb.set_SaveSellOut_CLD(ref txt, ref DBUtility.ClsPub.sErrInfo, ref tt);
textnote.Text = textnote.Text + ",ͬ²½ÏúÊÛ³ö¿â±í½áÊø" + DateTime.Now.ToString() + tt;
txtNote5.Text = txt;
}
if (chkSellOutBack.Checked == true)
{
textnote.Text = textnote.Text + ",¿ªÊ¼Í¬²½ÏúÊÛÍË»õ±í" + DateTime.Now.ToString();
oWeb.set_SaveSellReturn_CLD(ref txt, ref DBUtility.ClsPub.sErrInfo, ref tt);
textnote.Text = textnote.Text + ",ͬ²½ÏúÊÛÍË»õ±í½áÊø" + DateTime.Now.ToString() + tt ;
txtNote.Text = txt;
}
timertoFengZhou.Enabled = true;
}
catch (Exception e1)
{
textnote.Text = textnote.Text + ",³ö´íÁË" + DateTime.Now.ToString() + e1.Message;
timertoFengZhou.Enabled = true;
}
}
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
switch (e.Button)
{
case System.Windows.Forms.MouseButtons.Left: //×ó»÷
//ÅжÏÊÇ·ñÒѾ×îС»¯ÓÚÍÐÅÌ
if (WindowState == FormWindowState.Minimized)
{
//»¹Ô´°ÌåÏÔʾ
WindowState = FormWindowState.Normal;
//¼¤»î´°Ìå²¢¸øÓèËü½¹µã
this.Activate();
//ÈÎÎñÀ¸ÇøÏÔʾͼ±ê
this.ShowInTaskbar = true;
//ÍÐÅÌÇøÍ¼±êÒþ²Ø
notifyicon.Visible = false;
}
break;
case System.Windows.Forms.MouseButtons.Right:
//MessageBox.Show("ÓÒ¼ü");
break;
}
}
private void FrmServerFZ_SizeChanged(object sender, EventArgs e)
{
//ÅжÏÊÇ·ñÑ¡ÔñµÄÊÇ×îС»¯°´Å¥
if (WindowState == FormWindowState.Minimized)
{
//ÍÐÅÌÏÔʾͼ±êµÈÓÚÍÐÅÌͼ±ê¶ÔÏó
//×¢ÒânotifyIcon1ÊǿؼþµÄÃû×Ö¶ø²»ÊǶÔÏóµÄÃû×Ö
notifyIcon1.Icon = ico;
//Òþ²ØÈÎÎñÀ¸ÇøÍ¼±ê
this.ShowInTaskbar = false;
//ͼ±êÏÔʾÔÚÍÐÅÌÇø
notifyicon.Visible = true;
}
}
}
}