Example #1
0
        /// <summary>
        /// 执行接口的HTTP Transaction,该方法可以传入参数,返回HTTP Response Body、错误码和错误描述。需要在子类中实现
        /// </summary>
        /// <param name="pResp">返回HTTP Response Body</param>
        /// <param name="pMsg">错误描述,若返回成功则返回String.Empty</param>
        /// <param name="args">传入参数</param>
        /// <returns>返回错误码TError</returns>
        public override int DoTransaction(out HttpRespXmlBase pResp, out string pMsg, params object[] args)
        {
            try
            {
                #region temp variables
                pMsg  = string.Empty;
                pResp = null;
                int    errCode    = TError.RunGood.Int();
                int    errDict709 = TError.WCF_RunError.Int();
                string errMsg     = string.Empty;
                string ddMsg      = string.Empty;
                List <MisModel.Product_WMS_Interface> d709fList = null;
                string eid = string.Empty;                  // 主入库订单ID
                string pid = string.Empty;                  // 主采购单Id
                HttpReqXml_EntryOrderCreate reqBody = null; //请求xml
                #endregion
                #region handle arguments
                if (TError.RunGood.Int() != (errCode = ParseArguments(out eid, out pid, args)))
                {
                    errMsg = "params object[] args,非法入参";
                    C_WMS.Data.Utility.MyLog.Instance.Error("执行同步入库订单的HTTP会话失败 errCode={0}, msg={1}", errMsg, errMsg);
                    return(errCode);
                }
                #endregion
                #region Update Dict[709]
                var order = CWmsEntryOrderHandler.NewOrder(eid);
                order.Handler.UpdateDict709(order, TDict285_Values.EDeleted, TDict285_Values.EUnknown, true);
#if false
                if (TError.WCF_RunError.Int() ==
                    (errCode = Dict709Handle.UpdateRowVA_Order(TDict709_Value.EEntryOrder, eid, TDict285_Values.EDeleted, TDict285_Values.ENormal, out d709fList, out errCode, out pMsg)))
                {
                    C_WMS.Data.Utility.MyLog.Instance.Error("执行同步入库订单的HTTP会话,更新709失败: 入库单Id={0}, errCode={1}, errDict709={2}, errMsg={3}", eid, errCode, errDict709, errMsg);
                    return(errCode);
                }
#endif
                #endregion

                reqBody = CWmsDataFactory.GetReqXmlBody_EntryOrderCreate(eid, pid) as HttpReqXml_EntryOrderCreate; // get HTTP request body
                pResp   = Post(reqBody);                                                                           // Do http transaction

                #region handle response
                if (null == pResp)
                {
                    pMsg    = "HTTP会话异常,HTTP响应体为null";
                    errCode = TError.WCF_RunError.Int();
                    C_WMS.Data.Utility.MyLog.Instance.Error("执行同步入库订单的HTTP会话,服务器响应异常, message={0}", pMsg);
                }
                else if (!pResp.IsSuccess())
                {
                    pMsg    = pResp.message;
                    errCode = TError.Ser_ErrorPost.Int();
                    C_WMS.Data.Utility.MyLog.Instance.Error("执行同步入库订单的HTTP会话,服务器响应失败,message={0}", pMsg);
                }
                else
                {
                    errCode = Dict709Handle.UpdateRowVA_Order(TDict709_Value.EEntryOrder, eid, TDict285_Values.ENormal
                                                              , TDict285_Values.ENormal, out d709fList, out errCode, out pMsg);
                    C_WMS.Data.Utility.MyLog.Instance.Info("执行同步入库订单的HTTP会话完成,更新[709]:errCode={0}, errCode={1}, pMsg={2}", errCode, errCode, pMsg);
                }
                #endregion

                #region 推送钉钉通知
                ddMsg = (0 < errCode) ? ddMsg = string.Format(DingDingMsgFmtSuccess, eid) : ddMsg = string.Format(DingDingMsgFmtFailed, eid);
                mDlgtNotifySyncResult.BeginInvoke(CommonFrame.LoginUser.UserId.Int(), ddMsg, Acb_NotifySyncResult, mDlgtNotifySyncResult);
                #endregion

                return(errCode);
            }
            #region Handle exception
            catch (Exception ex)
            {
                pResp = null;
                pMsg  = ex.Message;
                C_WMS.Data.Utility.MyLog.Instance.Error(ex, "在{0}中发生异常", System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(TError.WCF_RunError.Int());
            }
            #endregion
        }
Example #2
0
        /// <summary>
        /// 根据同步通讯的结果更新709字典中对应的行的IsUpdateOK的值。
        /// 若重置成功则影响的行数(重置多行)或影响行的主键(重置单行);否则返回TError或0.
        /// </summary>
        /// <param name="pUpdateOK">value of 709.isUpdateOK</param>
        /// <returns></returns>
        public override int Update709(bool pUpdateOK)
        {
            var order = CWmsEntryOrderHandler.NewOrder(OrderId);

            return(order.Handler.UpdateDict709(order, (pUpdateOK) ? TDict285_Values.ENormal : TDict285_Values.EDeleted, TDict285_Values.EUnknown, false));
        }
Example #3
0
        /// <summary>
        /// 创建HttpReqXml_InventoryMonitoring对象
        /// </summary>
        /// <returns></returns>
        public override HttpReqXml_EntryOrderCreate NewRequestObj()
        {
            var order = CWmsEntryOrderHandler.NewOrder(OrderId);

            return(new HttpReqXml_EntryOrderCreate(order));
        }
Example #4
0
        /// <summary>
        /// 在执行同步操作之前,先重置709字典中对应的行,将IsUpdateOK的值置为同步失败。
        /// </summary>
        /// <returns></returns>
        public override int Reset709()
        {
            var order = CWmsEntryOrderHandler.NewOrder(OrderId);

            return(order.Handler.UpdateDict709(order, TDict285_Values.EDeleted, TDict285_Values.EUnknown, true));
        }