示例#1
0
        /// <summary>
        /// 查找匹配的TroneOrder.Id
        /// </summary>
        /// <param name="sms"></param>
        /// <returns>tbl_trone_orderItem</returns>
        private tbl_trone_orderItem FindTroneOrder(ISMS_DataItem sms)
        {
            var _allCfg = tbl_trone_orderItem.QueryByTroneIdWithCache(dBase, sms.trone_id);

            if (_allCfg == null || _allCfg.Count() == 0)
                return null;

            foreach (var cfg in _allCfg)
            {
                if (cfg.is_unknow)
                    continue;
                if (!AutoMapPush.IsMatch(cfg, sms.ori_order))
                    continue;
                return cfg;
            }
            return null;
        }
示例#2
0
        private void DoPush(LightDataModel.tbl_troneItem trone)
        {
            //throw new NotImplementedException();
            if (!_MrItem.IsMatch || trone == null)
                return;

            var syncFlag = SyncFlag;
            if (syncFlag == E_CP_SYNC_MODE.Auto)
            {
                if (_MrItem.linkid.IndexOf("test", StringComparison.OrdinalIgnoreCase) != -1)
                    syncFlag = E_CP_SYNC_MODE.ForceHide;
                else if (_MrItem.linkid.IndexOf("ceshi", StringComparison.OrdinalIgnoreCase) != -1)
                    syncFlag = E_CP_SYNC_MODE.ForceHide;
            }


            var logFile = Server.MapPath(string.Format("~/PushLog/{0:yyyyMMdd}.log", DateTime.Today));
            var sb = new StringBuilder(250);
            var apiPush = new HTAPIPusher()
            {
                dBase = dBase,
                Trone = trone,
                LogFile = logFile,
                PushFlag = syncFlag,
                TrackLog = sb
            };

            if (apiPush.LoadCPAPI())
            {
                try
                {
                    apiPush.PushObject = _MrItem;
                    if (apiPush.DoPush())
                        return;
                }
#if !DEBUG
                catch (Exception ex)
                {
                    Shotgun.Library.SimpleLogRecord.WriteLog("api_push_error", ex.ToString());
                }
#endif
                finally
                {
                }
            }


            var cp = new AutoMapPush();
            cp.dBase = dBase;
            cp.Trone = trone;
            cp.PushFlag = syncFlag;
            cp.TrackLog = sb;
            //cp.UnionUserId = -1;
            cp.LogFile = logFile;

            if (!cp.LoadCPAPI())
            {
                WriteTrackLog(sb);
                return;
            }

            cp.PushObject = _MrItem;
            if (cp.DoPush() && _MrItem.cp_id != 34)
            {
                if (_MoItem != null && HasMoTroneOrderId)
                {
                    _MoItem.syn_flag = _MrItem.syn_flag != 0;
                    _MoItem.trone_order_id = _MrItem.trone_order_id;
                    _MoItem.report_flag = true;

                    try { _MoItem.SaveToDatabase(dBase); }
                    catch { }
                }
                return;
            }
            if (!cp.IsSuccess)
                sb.AppendLine(cp.ErrorMesage);
            WriteTrackLog(sb);




        }