public override void EndOperationTransaction(EndOperationTransactionArgs e) { List <DynamicObject> objs = e.DataEntitys.ToList(); if (objs != null && objs.Count > 0) { foreach (var item in objs) { if (item != null) { DynamicObject oSource = item["F_HS_SaleOrderSource"] as DynamicObject; string orderSource = SQLUtils.GetFieldValue(oSource, "FNumber"); string documentStatus = SQLUtils.GetFieldValue(item, "DocumentStatus"); if (!string.IsNullOrWhiteSpace(orderSource) && !string.IsNullOrWhiteSpace(documentStatus)) { if ((orderSource.CompareTo("HCWebPendingOder") != 0 && orderSource.CompareTo("HCWebProcessingOder") != 0) && (documentStatus.CompareTo("C") != 0 || documentStatus.CompareTo("B") != 0)) { SynchroDataHelper.SynchroDataToHC(this.Context, this.DataType); break; } } } } } }
public void SynchroDataTo(Context ctx, SynchroDataType dataType, SynchroDirection direction) { HttpResponseResult result = null; try { if (direction == SynchroDirection.ToK3) { result = SynchroDataHelper.SynchroDataToK3(ctx, dataType); } if (direction == SynchroDirection.ToHC) { result = SynchroDataHelper.SynchroDataToHC(ctx, dataType); } if (result != null) { if (result.Success) { this.View.ShowErrMessage("", string.Format("同步{0}至{1}成功!", LogUtils.GetDataSourceTypeDesc(dataType), direction.ToString()) + result.Message, Kingdee.BOS.Core.DynamicForm.MessageBoxType.Error); } else { this.View.ShowErrMessage("", string.Format("同步{0}至{1}失败!", LogUtils.GetDataSourceTypeDesc(dataType), direction.ToString()) + result.Message, Kingdee.BOS.Core.DynamicForm.MessageBoxType.Error); } } else { this.View.ShowErrMessage("", string.Format("同步{0}至{1}失败!", LogUtils.GetDataSourceTypeDesc(dataType), direction.ToString()), Kingdee.BOS.Core.DynamicForm.MessageBoxType.Error); } } catch (Exception ex) { this.View.ShowErrMessage(ex.ToString(), string.Format("同步{0}至{1}失败!", LogUtils.GetDataSourceTypeDesc(dataType), direction.ToString()), Kingdee.BOS.Core.DynamicForm.MessageBoxType.Error); } }
/// <summary> /// 获取物流细节 /// </summary> /// <param name="ctx"></param> /// <param name="notices"></param> /// <returns></returns> public static Dictionary <string, T> GetLogisticsDetail <T>(Context ctx, List <DeliveryNotice> notices) { string messages = ""; Dictionary <string, T> dict = new Dictionary <string, T>(); // Set this to true to process a COD shipment and print a COD return Label if (notices != null && notices.Count > 0) { foreach (var notice in notices) { ProcessShipmentRequest request = CreateShipmentRequest(notice); LogXML("DeliveryNoitceNo:" + notice.FBillNo + " Request ", request, typeof(ProcessShipmentRequest)); ShipService service = new ShipService(); if (usePropertyFile()) { service.Url = getProperty("endpoint"); } // try { // Call the ship web service passing in a ProcessShipmentRequest and returning a ProcessShipmentReply ProcessShipmentReply reply = service.processShipment(request); LogXML("DeliveryNoitceNo:" + notice.FBillNo + " Reply ", reply, typeof(ProcessShipmentReply)); messages += GetNotifications(reply); if ((reply.HighestSeverity != NotificationSeverityType.ERROR) && (reply.HighestSeverity != NotificationSeverityType.FAILURE)) { notice.TraceEntry = GetShipmentReply(reply); //LogXML(reply, typeof(ProcessShipmentReply)); } RecordNotifications(ctx, reply); } catch (SoapException ex) { SynchroDataHelper.WriteSynchroLog(ctx, SynchroDataType.DeliveryNoticeBill, ex.Message + System.Environment.NewLine + ex.StackTrace); } catch (Exception ex) { SynchroDataHelper.WriteSynchroLog(ctx, SynchroDataType.DeliveryNoticeBill, ex.Message + System.Environment.NewLine + ex.StackTrace); } } } HttpResponseResult result = new HttpResponseResult(); result.Message = messages; dict.Add("result", (T)(Object)result); dict.Add("notices", (T)(Object)notices); return(dict); }
private static void RecordNotifications(Context ctx, ProcessShipmentReply reply) { if (reply != null) { SynchroDataHelper.WriteSynchroLog(ctx, SynchroDataType.DeliveryNoticeBill, GetNotifications(reply)); } else { SynchroDataHelper.WriteSynchroLog(ctx, SynchroDataType.DeliveryNoticeBill, "Fedex无响应"); } }
public void Run(Context ctx, Schedule schedule) { if (ctx.DBId.CompareTo(DataBaseConst.K3CloudDbId) == 0) { if (schedule == null) { return; } SynchroDataHelper.SynchroDataToHC(ctx, SynchroDataType.Inventroy); } }
public void Run(Context ctx, Schedule schedule) { //if (ctx.DBId.CompareTo(DataBaseConst.K3CloudDbId) == 0) //{ if (schedule == null) { return; } SynchroDataHelper.SynchroDataToHC(ctx, SynchroDataType.OnTheWay); //} }
public virtual HttpResponseResult SynK3Datas2HC(Context ctx, IEnumerable <AbsSynchroDataInfo> datas = null, FormOperation oper = null) { if (datas == null) { return(SynchroDataHelper.SynchroDataToHC(ctx, this.DataType, GetK3Datas(ctx), null, false, this.Direction)); } else { return(SynchroDataHelper.SynchroDataToHC(ctx, this.DataType, datas, null, false, this.Direction)); } }
public static List <DeliveryNotice> GetLogisticsTraceDetail(Context ctx, List <DeliveryNotice> notices) { if (notices != null && notices.Count > 0) { foreach (var notice in notices) { if (notice != null) { if (notice.TraceEntry != null && notice.TraceEntry.Count > 0) { foreach (var trace in notice.TraceEntry) { if (trace != null) { TrackRequest request = CreateTrackRequest(trace.FCarryBillNo); LogXML("trackingNumber:[" + trace.FCarryBillNo + "] Request", request, typeof(TrackRequest)); // TrackService service = new TrackService(); if (usePropertyFile()) { service.Url = getProperty("endpoint"); } // try { // Call the Track web service passing in a TrackRequest and returning a TrackReply TrackReply reply = service.track(request); LogXML("trackingNumber:[" + trace.FCarryBillNo + "] Reply", reply, typeof(TrackReply)); if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING) { ShowTrackReply(reply); notice.LocusEntry = GetLocusDetail(reply); } ShowNotifications(reply); } catch (SoapException ex) { SynchroDataHelper.WriteSynchroLog(ctx, SynchroDataType.DeliveryNoticeBill, ex.Message + System.Environment.NewLine + ex.StackTrace); } catch (Exception ex) { SynchroDataHelper.WriteSynchroLog(ctx, SynchroDataType.DeliveryNoticeBill, ex.Message + System.Environment.NewLine + ex.StackTrace); } } } } } } } return(notices); }
public void Run(Context ctx, Schedule schedule) { if (ctx.DBId.CompareTo(DataBaseConst.K3CloudDbId) == 0) { if (schedule == null) { return; } SynchroDataHelper.SynchroDataToK3(ctx, SynchroDataType.CustomerAddressByExcel); } }
public void Run(Context ctx, Schedule schedule) { if (ctx.DBId.CompareTo(DataBaseConst.K3CloudDbId) == 0) { if (schedule == null) { return; } SynchroDataHelper.SynchroDataToK3(ctx, SynchroDataType.SalesOrderPayStatus); } }
public virtual HttpResponseResult SynchroK3DataToWebSite(Context ctx, IEnumerable <AbsSynchroDataInfo> datas = null) { HttpResponseResult result = null; if (datas == null) { return(SynchroDataHelper.SynchroDataToHC(ctx, this.DataType, GetK3Datas(ctx, this.DyamicObjects, ref result), null, true, this.Direction)); } else { return(SynchroDataHelper.SynchroDataToHC(ctx, this.DataType, datas, null, true, this.Direction)); } }
public override void EndOperationTransaction(EndOperationTransactionArgs e) { base.EndOperationTransaction(e); List <DynamicObject> objs = e.DataEntitys.ToList(); if (objs == null || objs.Count < 0) { return; } if (GetK3Datas(this.Context, objs, ref result) != null) { List <AbsSynchroDataInfo> datas = GetK3Datas(this.Context, objs, ref result).ToList(); Dictionary <SynOperationType, IEnumerable <AbsSynchroDataInfo> > dict = new Dictionary <SynOperationType, IEnumerable <AbsSynchroDataInfo> >(); dict.Add(SynOperationType.SAVE, datas); result = SynchroDataHelper.SynchroDataToK3(this.Context, this.DataType, true, null, dict); } }
public override HttpResponseResult ExecuteSynchro(IEnumerable <AbsSynchroDataInfo> sourceDatas, List <SynchroLog> logs, SynOperationType operationType) { HttpResponseResult result = new HttpResponseResult(); List <K3SalOrderInfo> second = null; List <string> numbers = null; List <string> auditSuccNos = null; if (sourceDatas == null || sourceDatas.Count() == 0) { result = new HttpResponseResult(); result.Success = false; result.Message = "没有需要同步的数据!"; } if (operationType == SynOperationType.UPDATE) { try { second = sourceDatas.Select(o => (K3SalOrderInfo)o).ToList(); if (second != default(List <K3SalOrderInfo>)) { if (second.Count > 0) { numbers = new List <string>(); auditSuccNos = new List <string>(); foreach (var item in second) { if (IsExist(this.K3CloudContext, item)) { char isSameAdress = default(char); if (item.F_HS_IsSameAdress) { isSameAdress = '1'; } else { isSameAdress = '0'; } string uSql = string.Format(@"/*dialect*/ update T_SAL_ORDER set F_HS_PAYMENTSTATUS = '{0}',F_HS_SALEORDERSOURCE = '5a97d3123e9dff',F_HS_BillAddress = '{1}',F_HS_IsSameAdress = '{2}',F_HS_PaymentModeNew = '{4}' where FBILLNO = '{3}' and FDOCUMENTSTATUS != 'C' and FDOCUMENTSTATUS != 'D' and FDOCUMENTSTATUS != 'B' and FBILLNO <>''", item.F_HS_PaymentStatus, SQLUtils.DealQuotes(item.F_HS_BillAddress), isSameAdress, item.FBillNo, SQLUtils.GetPaymentMethodId(this.K3CloudContext, item.F_HS_PaymentModeNew)); int count = DBUtils.Execute(this.K3CloudContext, uSql); if (count > 0 && item.F_HS_PaymentStatus != null && item.F_HS_PaymentStatus.CompareTo("3") == 0) { numbers.Add(item.FBillNo); } } else { auditSuccNos.Add(item.FBillNo); result.Message += "编码为【" + item.FBillNo + "】的订单已经审核" + System.Environment.NewLine; result.Success = false; } } if (numbers != null && numbers.Count > 0) { //单据提交 result = ExecuteOperate(SynOperationType.SUBMIT, numbers, null, null); if (result != null && result.SuccessEntityNos != null && result.SuccessEntityNos.Count > 0) { //单据审核 result = ExecuteOperate(SynOperationType.AUDIT, result.SuccessEntityNos, null, null); if (result != null && result.SuccessEntityNos != null && result.SuccessEntityNos.Count > 0) { List <K3SalOrderInfo> auditOrders = null; //审核成功后的销售订单 if (result.Success) { auditOrders = GetSelectedSalOrders(first, result.SuccessEntityNos); } else { auditOrders = GetSelectedSalOrders(first, GetAuditedSalOrderNos(this.K3CloudContext, second)); } //第二次同步后的销售订单信息和第一次同步的销售订单信息合成新的销售订单列表信息(获取完整的销售订单信息) auditOrders = CombineSalOrder(second, auditOrders); //从redis再次获取数据 if (auditOrders == null || auditOrders.Count == 0) { //auditOrders = GetAuditedSalOrderDatas(ctx, second); if (second != null) { auditOrders = GetSalOrdersByDb(this.K3CloudContext, second.Select(o => o.FBillNo).ToList()); } } //同步收款单 if (auditOrders != null) { Dictionary <SynOperationType, IEnumerable <AbsSynchroDataInfo> > dict = new Dictionary <SynOperationType, IEnumerable <AbsSynchroDataInfo> >(); dict.Add(SynOperationType.SAVE, auditOrders); HttpResponseResult respone = SynchroDataHelper.SynchroDataToK3(this.K3CloudContext, SynchroDataType.ReceiveBill, true, null, dict); //收款单同步成功后删除销售订单记录 if (respone != null) { first.RemoveWhere(o => respone.SuccessEntityNos.Contains(o.FBillNo)); } } //更新客户下单次数 StatisticsOrderCount(this.K3CloudContext, result.SuccessEntityNos); //审核成功后删除Redis中的数据(销售订单第二次同步) RemoveRedisData(this.K3CloudContext, result.SuccessEntityNos); } } } } } else { LogUtils.WriteSynchroLog(this.K3CloudContext, this.DataType, "未找到需要同步的数据!"); } } catch (Exception ex) { LogUtils.WriteSynchroLog(this.K3CloudContext, this.DataType, "数据批量更新过程中出现异常,异常信息:" + ex.Message + System.Environment.NewLine + ex.StackTrace); } } return(result); }