private void InternalRejectSync() { #region 获取需要同步的数据 this.pInternalReject.Tag = false; DataTable dt = Maticsoft.DBUtility.DbHelperSQL.Query("select * from [VCDB].[dbo].VInternalReject").Tables[0]; #region 获取配置 string account = ConfigurationManager.AppSettings["account"].ToString(); string key = ConfigurationManager.AppSettings["key"].ToString(); string system = ConfigurationManager.AppSettings["system"].ToString(); OpenBookAPI.OpenBookAPISoapClient client = new OpenBookAPI.OpenBookAPISoapClient(); this.pInternalReject.Maximum = dt.Rows.Count; this.pInternalReject.Value = 0; #endregion for (int i = 0; i < dt.Rows.Count; i++) { #region my键 OpenBookAPI.ArrayOfString keys = new OpenBookAPI.ArrayOfString(); keys.Add("INTERNALREJECTNUMBER"); keys.Add("JOBNO"); keys.Add("PARTNO"); keys.Add("PARTDESCRIPTION"); keys.Add("QTYREJECTED"); keys.Add("CAUSEDOPNO"); keys.Add("CAUSEDOPDESC"); keys.Add("DATEREJECTED"); keys.Add("FAULTCODEFAMILY"); keys.Add("PROBLEM"); keys.Add("STATUS"); keys.Add("CLOSEDDATE"); keys.Add("CAUSEDOPERATOR"); #endregion #region 值 OpenBookAPI.ArrayOfString values = new OpenBookAPI.ArrayOfString(); values.Add(Convert.ToString(dt.Rows[i]["RejectNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["JobNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PartNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PartDescription"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["RejectedQty"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["OperationNo"]).Trim()); values.Add(""); values.Add(""); values.Add(Convert.ToString(dt.Rows[i]["FaultCode"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["ProblemDescription"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Status"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["ClosedDate"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["RejectedBy"]).Trim()); #endregion try { string result = client.SyncDataWithValueArrayForDNA(account, key, system, "Internal Rejects", keys, values); if (result.Equals("succefull.")) { #region 记录同步日志 string sql = @"INSERT INTO [VCDB].[dbo].[InternalReject_SyncLog] ([RejectNo] ,[JobNo] ,[PartNo] ,[PartDescription] ,[RejectedQty] ,[OperationNo] ,[Operation] ,[ClosedDate] ,[RejectedBy] ,[FaultCode] ,[Fault] ,[Status] ,[ProblemDescription] ,[PreventativeAction] ,[CorrectiveAction] ,[LastSyncTime]) VALUES ('{0}' ,'{1}' ,'{2}' ,'{3}' ,'{4}' ,'{5}' ,'{6}' ,'{7}' ,'{8}' ,'{9}' ,'{10}' ,'{11}' ,'{12}' ,'{13}' ,'{14}' ,'{15}')"; Maticsoft.DBUtility.DbHelperSQL.ExecuteSql(String.Format(sql.Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["RejectNo"])) ? "" : Convert.ToString(dt.Rows[i]["RejectNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["JobNo"])) ? "" : Convert.ToString(dt.Rows[i]["JobNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PartNo"])) ? "" : Convert.ToString(dt.Rows[i]["PartNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PartDescription"])) ? "" : Convert.ToString(dt.Rows[i]["PartDescription"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["RejectedQty"])) ? "" : Convert.ToString(dt.Rows[i]["RejectedQty"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["OperationNo"])) ? "" : Convert.ToString(dt.Rows[i]["OperationNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Operation"])) ? "" : Convert.ToString(dt.Rows[i]["Operation"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["ClosedDate"])) ? "" : Convert.ToString(dt.Rows[i]["ClosedDate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["RejectedBy"])) ? "" : Convert.ToString(dt.Rows[i]["RejectedBy"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["FaultCode"])) ? "" : Convert.ToString(dt.Rows[i]["FaultCode"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Fault"])) ? "" : Convert.ToString(dt.Rows[i]["Fault"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Status"])) ? "" : Convert.ToString(dt.Rows[i]["Status"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["ProblemDescription"])) ? "" : Convert.ToString(dt.Rows[i]["ProblemDescription"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PreventativeAction"])) ? "" : Convert.ToString(dt.Rows[i]["PreventativeAction"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["CorrectiveAction"])) ? "" : Convert.ToString(dt.Rows[i]["CorrectiveAction"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") )); #endregion } } catch (Exception ex) { MessageBox.Show(ex.Message, "error"); break; } this.pInternalReject.Value = i; } ListenInternalReject(); #endregion }
public void QuotationSyncStart() { #region 获取需要同步的数据 this.pQuotation.Tag = false; DataTable dt = Maticsoft.DBUtility.DbHelperSQL.Query("select * from [VCDB].[dbo].Vqtuotation").Tables[0]; #region 获取配置 string account = ConfigurationManager.AppSettings["account"].ToString(); string key = ConfigurationManager.AppSettings["key"].ToString(); string system = ConfigurationManager.AppSettings["system"].ToString(); OpenBookAPI.OpenBookAPISoapClient client = new OpenBookAPI.OpenBookAPISoapClient(); this.pQuotation.Value = 0; this.pQuotation.Maximum = dt.Rows.Count; #endregion for (int i = 0; i < dt.Rows.Count; i++) { #region my键 OpenBookAPI.ArrayOfString keys = new OpenBookAPI.ArrayOfString(); keys.Add("CUSTOMERNAME"); keys.Add("DATERECEIVED"); keys.Add("CUSTOMERENQUIRYNUMBER"); keys.Add("QUOTATIONREQUIRED"); keys.Add("ITEMDATERECEIVED"); keys.Add("QUOTEDBYNAME"); keys.Add("QUANTITY"); keys.Add("NETTOTAL"); keys.Add("PARTNUMBER"); keys.Add("CUSTOMERID"); keys.Add("QUOTATIONNUMBER"); keys.Add("CONTACT"); keys.Add("NOTE"); keys.Add("LINENUMBER"); keys.Add("QUOTATIONITEMSTATUS"); keys.Add("PARTID"); keys.Add("DRAWINGISSUE"); keys.Add("PARTISSUE"); keys.Add("PARTDESCRIPTION"); keys.Add("DRAWINGNUMBER"); keys.Add("UNITPRICE"); keys.Add("UNIT"); keys.Add("CURRENCY"); #endregion #region 值 OpenBookAPI.ArrayOfString values = new OpenBookAPI.ArrayOfString(); values.Add(Convert.ToString(dt.Rows[i]["Customer"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["EnquiryDate"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["EnquiryNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["RequiredDate"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["SubmittedDate"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["QuotedBy"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Quantity"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["NetValue"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PartNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["CustomerCode"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["QuoteNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["ContactName"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Notes"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["LineNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Status"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["IRN"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["DrawingIssue"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PartIssue"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PartDescription"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["DrawingNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["UnitPrice"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Unit"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Currency"]).Trim()); #endregion try { string result = client.SyncDataWithValueArrayForDNA(account, key, system, "Quotations", keys, values); if (result.Equals("succefull.")) { #region 记录同步日志 string sql = @"INSERT INTO [VCDB].[dbo].[Quotation_SyncLog] ([Customer] ,[EnquiryDate] ,[EnquiryNo] ,[RequiredDate] ,[SubmittedDate] ,[QuotedBy] ,[Quantity] ,[NetValue] ,[PartNo] ,[CustomerCode] ,[QuoteNo] ,[LineNo] ,[ContactName] ,[Notes] ,[Status] ,[IRN] ,[DrawingIssue] ,[PartIssue] ,[PartDescription] ,[DrawingNo] ,[UnitPrice] ,[Unit] ,[Currency] ,[LastSyncTime]) VALUES ('{0}' ,'{1}' ,'{2}' ,'{3}' ,'{4}' ,'{5}' ,'{6}' ,'{7}' ,'{8}' ,'{9}' ,'{10}' ,'{11}' ,'{12}' ,'{13}' ,'{14}' ,'{15}' ,'{16}' ,'{17}' ,'{18}' ,'{19}' ,'{20}' ,'{21}' ,'{22}' ,'{23}')"; Maticsoft.DBUtility.DbHelperSQL.ExecuteSql(String.Format(sql.Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Customer"])) ? "" : Convert.ToString(dt.Rows[i]["Customer"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["EnquiryDate"])) ? "" : Convert.ToString(dt.Rows[i]["EnquiryDate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["EnquiryNo"])) ? "" : Convert.ToString(dt.Rows[i]["EnquiryNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["RequiredDate"])) ? "" : Convert.ToString(dt.Rows[i]["RequiredDate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["SubmittedDate"])) ? "" : Convert.ToString(dt.Rows[i]["SubmittedDate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["QuotedBy"])) ? "" : Convert.ToString(dt.Rows[i]["QuotedBy"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Quantity"])) ? "" : Convert.ToString(dt.Rows[i]["Quantity"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["NetValue"])) ? "" : Convert.ToString(dt.Rows[i]["NetValue"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PartNo"])) ? "" : Convert.ToString(dt.Rows[i]["PartNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["CustomerCode"])) ? "" : Convert.ToString(dt.Rows[i]["CustomerCode"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["QuoteNo"])) ? "" : Convert.ToString(dt.Rows[i]["QuoteNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["LineNo"])) ? "" : Convert.ToString(dt.Rows[i]["LineNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["ContactName"])) ? "" : Convert.ToString(dt.Rows[i]["ContactName"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Notes"])) ? "" : Convert.ToString(dt.Rows[i]["Notes"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Status"])) ? "" : Convert.ToString(dt.Rows[i]["Status"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["IRN"])) ? "" : Convert.ToString(dt.Rows[i]["IRN"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["DrawingIssue"])) ? "" : Convert.ToString(dt.Rows[i]["DrawingIssue"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PartIssue"])) ? "" : Convert.ToString(dt.Rows[i]["PartIssue"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PartDescription"])) ? "" : Convert.ToString(dt.Rows[i]["PartDescription"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["DrawingNo"])) ? "" : Convert.ToString(dt.Rows[i]["DrawingNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["UnitPrice"])) ? "" : Convert.ToString(dt.Rows[i]["UnitPrice"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Unit"])) ? "" : Convert.ToString(dt.Rows[i]["Unit"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Currency"])) ? "" : Convert.ToString(dt.Rows[i]["Currency"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") )); #endregion } } catch (Exception ex) { MessageBox.Show(ex.Message, "error"); break; } this.pQuotation.Value = i; } ListenQuotation(); #endregion }
private void DespatchesSync() { #region 获取需要同步的数据 this.pDespatches.Tag = false; DataTable dt = Maticsoft.DBUtility.DbHelperSQL.Query("select * from [VCDB].[dbo].VDespatches").Tables[0]; #region 获取配置 string account = ConfigurationManager.AppSettings["account"].ToString(); string key = ConfigurationManager.AppSettings["key"].ToString(); string system = ConfigurationManager.AppSettings["system"].ToString(); OpenBookAPI.OpenBookAPISoapClient client = new OpenBookAPI.OpenBookAPISoapClient(); this.pDespatches.Maximum = dt.Rows.Count; this.pDespatches.Value = 0; #endregion for (int i = 0; i < dt.Rows.Count; i++) { #region my键 OpenBookAPI.ArrayOfString keys = new OpenBookAPI.ArrayOfString(); keys.Add("CUSTOMERNAME"); keys.Add("DELIVERYDATE"); keys.Add("JOBNO"); keys.Add("PARTNO"); keys.Add("DELIVERYNUMBER"); keys.Add("INVOICEVALUE"); keys.Add("DNLINENO"); keys.Add("DELIVERYQUANTITY"); keys.Add("PARTDESRIPTION"); keys.Add("INVOICENUMBER"); keys.Add("CUSTOMERREF"); keys.Add("PROMISEDDATE"); keys.Add("CUSTOMERREQDATE"); keys.Add("PARTID"); keys.Add("ORDERITEMNO"); keys.Add("ORDERNUMBER"); keys.Add("CURRENCY"); keys.Add("MATCAT"); keys.Add("REQDATEADHERENCE"); #endregion #region 值 OpenBookAPI.ArrayOfString values = new OpenBookAPI.ArrayOfString(); values.Add(Convert.ToString(dt.Rows[i]["Customer"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["DeliveryDate"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["JobNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PartNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["DeliverNoteNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["InvoiceValue"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["LineNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["DeliveryQty"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PartDescription"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["InvoiceNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["CustomerNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PromiseDate"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["RequiredDate"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["IRN"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["SOLineNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["OrderNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Currency"]).Trim()); values.Add(""); values.Add(""); #endregion try { string result = client.SyncDataWithValueArrayForDNA(account, key, system, "Despatch", keys, values); if (result.Equals("succefull.")) { #region 记录同步日志 string sql = @"INSERT INTO [VCDB].[dbo].[Despatches_SyncLog] ([Customer] ,[DeliveryDate] ,[SONo] ,[JobNo] ,[PartNo] ,[DeliverNoteNo] ,[InvoiceValue] ,[LineNo] ,[DeliveryQty] ,[PartDescription] ,[InvoiceNo] ,[CustomerNo] ,[PromiseDate] ,[RequiredDate] ,[IRN] ,[SOLineNo] ,[OrderNo] ,[Currency] ,[Category] ,[LastSyncTime]) VALUES ('{0}' ,'{1}' ,'{2}' ,'{3}' ,'{4}' ,'{5}' ,'{6}' ,'{7}' ,'{8}' ,'{9}' ,'{10}' ,'{11}' ,'{12}' ,'{13}' ,'{14}' ,'{15}' ,'{16}' ,'{17}' ,'{18}' ,'{19}')"; Maticsoft.DBUtility.DbHelperSQL.ExecuteSql(String.Format(sql.Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Customer"])) ? "" : Convert.ToString(dt.Rows[i]["Customer"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["DeliveryDate"])) ? "" : Convert.ToString(dt.Rows[i]["DeliveryDate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["SONo"])) ? "" : Convert.ToString(dt.Rows[i]["SONo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["JobNo"])) ? "" : Convert.ToString(dt.Rows[i]["JobNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PartNo"])) ? "" : Convert.ToString(dt.Rows[i]["PartNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["DeliverNoteNo"])) ? "" : Convert.ToString(dt.Rows[i]["DeliverNoteNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["InvoiceValue"])) ? "" : Convert.ToString(dt.Rows[i]["InvoiceValue"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["LineNo"])) ? "" : Convert.ToString(dt.Rows[i]["LineNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["DeliveryQty"])) ? "" : Convert.ToString(dt.Rows[i]["DeliveryQty"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PartDescription"])) ? "" : Convert.ToString(dt.Rows[i]["PartDescription"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["InvoiceNo"])) ? "" : Convert.ToString(dt.Rows[i]["InvoiceNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["CustomerNo"])) ? "" : Convert.ToString(dt.Rows[i]["CustomerNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PromiseDate"])) ? "" : Convert.ToString(dt.Rows[i]["PromiseDate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["RequiredDate"])) ? "" : Convert.ToString(dt.Rows[i]["RequiredDate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["IRN"])) ? "" : Convert.ToString(dt.Rows[i]["IRN"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["SOLineNo"])) ? "" : Convert.ToString(dt.Rows[i]["SOLineNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["OrderNo"])) ? "" : Convert.ToString(dt.Rows[i]["OrderNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Currency"])) ? "" : Convert.ToString(dt.Rows[i]["Currency"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Category"])) ? "" : Convert.ToString(dt.Rows[i]["Category"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") )); #endregion } } catch (Exception ex) { MessageBox.Show(ex.Message, "error"); break; } this.pDespatches.Value = i; } ListenDespatches(); #endregion }
public void SalesSyncStart() { try { #region 获取需要同步的数据 this.pSales.Tag = false; DataTable dt = Maticsoft.DBUtility.DbHelperSQL.Query("select * from [VCDB].[dbo].Vsalse").Tables[0]; #region 获取配置 string account = ConfigurationManager.AppSettings["account"].ToString(); string key = ConfigurationManager.AppSettings["key"].ToString(); string system = ConfigurationManager.AppSettings["system"].ToString(); OpenBookAPI.OpenBookAPISoapClient client = new OpenBookAPI.OpenBookAPISoapClient(); this.pSales.Maximum = dt.Rows.Count; this.pSales.Value = 0; #endregion for (int i = 0; i < dt.Rows.Count; i++) { #region 同步数据 #region 键 OpenBookAPI.ArrayOfString keys = new OpenBookAPI.ArrayOfString(); keys.Add("CUSTOMERNAME"); keys.Add("CUSTOMERID"); keys.Add("SALESORDERNO"); keys.Add("ORDERITEMNO"); keys.Add("CUSTOMERORDERNO"); keys.Add("PARTID"); keys.Add("PARTNO"); keys.Add("DESCRIPTION"); keys.Add("ACTUALQUANTITY"); keys.Add("RECEIVEDDATE"); keys.Add("BOOKBY"); keys.Add("NETVALUE"); keys.Add("NETDISCOUNT"); keys.Add("ONHOLD"); keys.Add("CUSTOMERREQUIREDDATE"); keys.Add("CURRENCY"); keys.Add("UNITPRICE"); keys.Add("STATUS"); keys.Add("MATCAT"); keys.Add("OTIF"); keys.Add("BOOKINDATE"); #endregion #region 值 OpenBookAPI.ArrayOfString values = new OpenBookAPI.ArrayOfString(); values.Add(Convert.ToString(dt.Rows[i]["Customer"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["CustomerCode"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["SONo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["LineNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["OrderNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["IRN"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PartNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Description"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Quantity"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["OrderDate"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["CreatedBy"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["NetValue"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["NetDiscount"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["OnHold"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["RequiredDate"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Currency"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["UnitPrice"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Status"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Category"]).Trim()); values.Add(""); values.Add(""); #endregion try { string result = client.SyncDataWithValueArrayForDNA(account, key, system, "Sales", keys, values); #endregion if (result.Equals("succefull.")) { #region 记录同步日志 string sql = @"INSERT INTO [VCDB].[dbo].[Sales_SyncLog] ([Customer] ,[CustomerCode] ,[SONo] ,[LineNo] ,[OrderNo] ,[IRN] ,[PartNo] ,[PartIssue] ,[Description] ,[Quantity] ,[OrderDate] ,[CreatedBy] ,[NetValue] ,[NetDiscount] ,[OnHold] ,[RequiredDate] ,[Currency] ,[UnitPrice] ,[Status] ,[Category] ,[LastSyncTime]) VALUES ('{0}' ,'{1}' ,'{2}' ,'{3}' ,'{4}' ,'{5}' ,'{6}' ,'{7}' ,'{8}' ,'{9}' ,'{10}' ,'{11}' ,'{12}' ,'{13}' ,'{14}' ,'{15}' ,'{16}' ,'{17}' ,'{18}' ,'{19}' ,'{20}')"; Maticsoft.DBUtility.DbHelperSQL.ExecuteSql(String.Format(sql.Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Customer"])) ? "" : Convert.ToString(dt.Rows[i]["Customer"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["CustomerCode"])) ? "" : Convert.ToString(dt.Rows[i]["CustomerCode"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["SONo"])) ? "" : Convert.ToString(dt.Rows[i]["SONo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["LineNo"])) ? "" : Convert.ToString(dt.Rows[i]["LineNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["OrderNo"])) ? "" : Convert.ToString(dt.Rows[i]["OrderNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["IRN"])) ? "" : Convert.ToString(dt.Rows[i]["IRN"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PartNo"])) ? "" : Convert.ToString(dt.Rows[i]["PartNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PartIssue"])) ? "" : Convert.ToString(dt.Rows[i]["PartIssue"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Description"])) ? "" : Convert.ToString(dt.Rows[i]["Description"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Quantity"])) ? "" : Convert.ToString(dt.Rows[i]["Quantity"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["OrderDate"])) ? "" : Convert.ToString(dt.Rows[i]["OrderDate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["CreatedBy"])) ? "" : Convert.ToString(dt.Rows[i]["CreatedBy"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["NetValue"])) ? "" : Convert.ToString(dt.Rows[i]["NetValue"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["NetDiscount"])) ? "" : Convert.ToString(dt.Rows[i]["NetDiscount"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["OnHold"])) ? "" : Convert.ToString(dt.Rows[i]["OnHold"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["RequiredDate"])) ? "" : Convert.ToString(dt.Rows[i]["RequiredDate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Currency"])) ? "" : Convert.ToString(dt.Rows[i]["Currency"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["UnitPrice"])) ? "" : Convert.ToString(dt.Rows[i]["UnitPrice"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Status"])) ? "" : Convert.ToString(dt.Rows[i]["Status"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Category"])) ? "" : Convert.ToString(dt.Rows[i]["Category"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") )); } } catch (Exception ex) { MessageBox.Show(ex.Message, "error"); break; } #endregion this.pSales.Value = i; } ListenSales(); #endregion } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void PurchaseSync() { #region 获取需要同步的数据 this.pPurchase.Tag = false; DataTable dt = Maticsoft.DBUtility.DbHelperSQL.Query("select * from [VCDB].[dbo].VPurchase").Tables[0]; #region 获取配置 string account = ConfigurationManager.AppSettings["account"].ToString(); string key = ConfigurationManager.AppSettings["key"].ToString(); string system = ConfigurationManager.AppSettings["system"].ToString(); OpenBookAPI.OpenBookAPISoapClient client = new OpenBookAPI.OpenBookAPISoapClient(); this.pPurchase.Maximum = dt.Rows.Count; this.pPurchase.Value = 0; #endregion for (int i = 0; i < dt.Rows.Count; i++) { #region my键 OpenBookAPI.ArrayOfString keys = new OpenBookAPI.ArrayOfString(); keys.Add("PONUMBER"); keys.Add("SUPPLIERNAME"); keys.Add("PODATE"); keys.Add("POLINEITEM"); keys.Add("MATERIALCODE"); keys.Add("MATERIALDESCRPITION"); keys.Add("UNITS"); keys.Add("SPECIFICATION"); keys.Add("PARTNUMBER"); keys.Add("QUANTITY"); keys.Add("UNITPRICE"); keys.Add("NETVALUE"); keys.Add("DATEREQUIRED"); keys.Add("ASSOCIATEDJOB"); keys.Add("ITEMNOTE"); keys.Add("PINVOICE"); keys.Add("GINQTY"); keys.Add("GINRECEIVEDDATE"); keys.Add("TOTALQTYRECEIVED"); keys.Add("CREATEDBY"); keys.Add("STATUS"); keys.Add("TYPE"); keys.Add("NOMINALCODE"); #endregion #region 值 OpenBookAPI.ArrayOfString values = new OpenBookAPI.ArrayOfString(); values.Add(Convert.ToString(dt.Rows[i]["PONo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Supplier"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PODate"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["LineNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["MaterialCode"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["MaterialDescription"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["UnitofPurchase"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Specification"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PartNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Quantity"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["UnitPrice"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["NetPrice"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["RequiredDate"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["JobNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["ItemNote"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["PurchaseInvoice"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["GINQty"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["GINDate"]).Trim()); values.Add(""); values.Add(Convert.ToString(dt.Rows[i]["CreatedBy"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Status"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Type"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Nominal"]).Trim()); #endregion try { string result = client.SyncDataWithValueArrayForDNA(account, key, system, "Purchasing", keys, values); if (result.Equals("succefull.")) { #region 记录同步日志 string sql = @"INSERT INTO [VCDB].[dbo].[Purchase_SyncLog] ([PONo] ,[Supplier] ,[PODate] ,[LineNo] ,[MaterialCode] ,[MaterialDescription] ,[UnitofPurchase] ,[Specification] ,[PartNo] ,[Quantity] ,[UnitPrice] ,[NetPrice] ,[RequiredDate] ,[JobNo] ,[ItemNote] ,[PurchaseInvoice] ,[GINQty] ,[GINDate] ,[QtyReceived] ,[CreatedBy] ,[Status] ,[Type] ,[Nominal] ,[LastSyncTime]) VALUES ('{0}' ,'{1}' ,'{2}' ,'{3}' ,'{4}' ,'{5}' ,'{6}' ,'{7}' ,'{8}' ,'{9}' ,'{10}' ,'{11}' ,'{12}' ,'{13}' ,'{14}' ,'{15}' ,'{16}' ,'{17}' ,'{18}' ,'{19}' ,'{20}' ,'{21}' ,'{22}' ,'{23}')"; Maticsoft.DBUtility.DbHelperSQL.ExecuteSql(String.Format(sql.Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PONo"])) ? "" : Convert.ToString(dt.Rows[i]["PONo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Supplier"])) ? "" : Convert.ToString(dt.Rows[i]["Supplier"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PODate"])) ? "" : Convert.ToString(dt.Rows[i]["PODate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["LineNo"])) ? "" : Convert.ToString(dt.Rows[i]["LineNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["MaterialCode"])) ? "" : Convert.ToString(dt.Rows[i]["MaterialCode"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["MaterialDescription"])) ? "" : Convert.ToString(dt.Rows[i]["MaterialDescription"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["UnitofPurchase"])) ? "" : Convert.ToString(dt.Rows[i]["UnitofPurchase"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Specification"])) ? "" : Convert.ToString(dt.Rows[i]["Specification"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PartNo"])) ? "" : Convert.ToString(dt.Rows[i]["PartNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Quantity"])) ? "" : Convert.ToString(dt.Rows[i]["Quantity"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["UnitPrice"])) ? "" : Convert.ToString(dt.Rows[i]["UnitPrice"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["NetPrice"])) ? "" : Convert.ToString(dt.Rows[i]["NetPrice"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["RequiredDate"])) ? "" : Convert.ToString(dt.Rows[i]["RequiredDate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["JobNo"])) ? "" : Convert.ToString(dt.Rows[i]["JobNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["ItemNote"])) ? "" : Convert.ToString(dt.Rows[i]["ItemNote"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["PurchaseInvoice"])) ? "" : Convert.ToString(dt.Rows[i]["PurchaseInvoice"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["GINQty"])) ? "" : Convert.ToString(dt.Rows[i]["GINQty"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["GINDate"])) ? "" : Convert.ToString(dt.Rows[i]["GINDate"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["QtyReceived"])) ? "" : Convert.ToString(dt.Rows[i]["QtyReceived"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["CreatedBy"])) ? "" : Convert.ToString(dt.Rows[i]["CreatedBy"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Status"])) ? "" : Convert.ToString(dt.Rows[i]["Status"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Type"])) ? "" : Convert.ToString(dt.Rows[i]["Type"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Nominal"])) ? "" : Convert.ToString(dt.Rows[i]["Nominal"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") )); #endregion } } catch (Exception ex) { MessageBox.Show(ex.Message, "error"); break; } this.pPurchase.Value = i; } ListenPurchase(); #endregion }
private void OperationsSync() { #region 获取需要同步的数据 this.pQuotation.Tag = false; DataTable dt = Maticsoft.DBUtility.DbHelperSQL.Query("select * from [VCDB].[dbo].VOperations").Tables[0]; #region 获取配置 string account = ConfigurationManager.AppSettings["account"].ToString(); string key = ConfigurationManager.AppSettings["key"].ToString(); string system = ConfigurationManager.AppSettings["system"].ToString(); OpenBookAPI.OpenBookAPISoapClient client = new OpenBookAPI.OpenBookAPISoapClient(); this.pOperations.Maximum = dt.Rows.Count; this.pOperations.Value = 0; #endregion for (int i = 0; i < dt.Rows.Count; i++) { #region my键 OpenBookAPI.ArrayOfString keys = new OpenBookAPI.ArrayOfString(); keys.Add("JOBNO"); keys.Add("OPERATIONNO"); keys.Add("ASSEMBLYNO"); keys.Add("OPERATIONTYPE"); keys.Add("DESCRIPTION"); keys.Add("SETUPTIME"); keys.Add("ESTIMATEDTIME"); keys.Add("TIMETAKEN"); keys.Add("WORKCENTRENO"); keys.Add("WORKCENTRENAME"); keys.Add("STATUS"); #endregion #region 值 OpenBookAPI.ArrayOfString values = new OpenBookAPI.ArrayOfString(); values.Add(Convert.ToString(dt.Rows[i]["JobNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["OperationNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["AssemblyNo"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["OperationType"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["Description"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["SetupTime"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["EstimatedTime"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["TimeTaken"]).Trim()); values.Add(Convert.ToString(dt.Rows[i]["WorkCentreNo"]).Trim()); values.Add(""); values.Add(Convert.ToString(dt.Rows[i]["Status"]).Trim()); #endregion try { string result = client.SyncDataWithValueArrayForDNA(account, key, system, "Operations", keys, values); if (result.Equals("succefull.")) { #region 记录同步日志 string sql = @"INSERT INTO [VCDB].[dbo].[Operations_SyncLog] ([JobNo] ,[OperationNo] ,[AssemblyNo] ,[OperationType] ,[Description] ,[SetupTime] ,[EstimatedTime] ,[TimeTaken] ,[WorkCentreNo] ,[WorkCentreName] ,[Status] ,[LastSyncTime]) VALUES ('{0}' ,'{1}' ,'{2}' ,'{3}' ,'{4}' ,'{5}' ,'{6}' ,'{7}' ,'{8}' ,'{9}' ,'{10}' ,'{11}')"; Maticsoft.DBUtility.DbHelperSQL.ExecuteSql(String.Format(sql.Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["JobNo"])) ? "" : Convert.ToString(dt.Rows[i]["JobNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["OperationNo"])) ? "" : Convert.ToString(dt.Rows[i]["OperationNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["AssemblyNo"])) ? "" : Convert.ToString(dt.Rows[i]["AssemblyNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["OperationType"])) ? "" : Convert.ToString(dt.Rows[i]["OperationType"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Description"])) ? "" : Convert.ToString(dt.Rows[i]["Description"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["SetupTime"])) ? "" : Convert.ToString(dt.Rows[i]["SetupTime"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["EstimatedTime"])) ? "" : Convert.ToString(dt.Rows[i]["EstimatedTime"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["TimeTaken"])) ? "" : Convert.ToString(dt.Rows[i]["TimeTaken"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["WorkCentreNo"])) ? "" : Convert.ToString(dt.Rows[i]["WorkCentreNo"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), "", String.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Status"])) ? "" : Convert.ToString(dt.Rows[i]["Status"]).Replace("'", "''").Replace("\r", "").Replace("\n", ""), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") )); #endregion } } catch (Exception ex) { MessageBox.Show(ex.Message, "error"); break; } this.pOperations.Value = i; } ListenOperations(); #endregion }