コード例 #1
0
        /// <summary>
        /// 检测是否允许出货
        /// </summary>
        private bool CheckSaleEnvr()
        {
            int intErrCode = 0;

            bool result = false;

            try
            {
                this.tbProgressInfo.Dispatcher.Invoke(new Action(() =>
                {
                    // 正在检测设备状态...
                    tbProgressInfo.Text = PubHelper.p_LangOper.GetStringBundle("Check_Device");
                }));

                #region 检测是否允许出货

                m_CheckSaleEnvirCode = BusinessEnum.ServerReason.Normal;

                m_CheckSaleEnvirCode = PubHelper.p_BusinOper.Device_CheckSaleEnvir_WxTakeCode(m_TakeCodeNum, m_TakeType, m_TakePaCode);

                #endregion

                #region  报准备出货

                string strSellStatus   = string.Empty;
                string strNoSellReason = string.Empty;
                if (m_CheckSaleEnvirCode == BusinessEnum.ServerReason.Normal)
                {
                    strSellStatus = "0";// 可吐货
                }
                else
                {
                    strSellStatus = "1";// 不能吐货
                    switch (m_CheckSaleEnvirCode)
                    {
                    case BusinessEnum.ServerReason.Err_NoStock:    // 库存不足
                        strNoSellReason = "1";
                        m_ErrInfo       = "";
                        break;

                    case BusinessEnum.ServerReason.Err_GoodsExist:    // 商品不存在
                        strNoSellReason = "0";
                        m_ErrInfo       = "";
                        break;

                    case BusinessEnum.ServerReason.Err_AsileStatus:    // 货到故障
                        strNoSellReason = "2";
                        m_ErrInfo       = "";
                        break;

                    default:
                        strNoSellReason = "3";
                        m_ErrInfo       = "";
                        break;
                    }
                }

                intErrCode = PubHelper.p_BusinOper.WxTakeCodeOper.ConfirmSellInfo(m_TakeCodeNum, strSellStatus, strNoSellReason);

                bool blnIsSell = false;
                if (m_CheckSaleEnvirCode == BusinessEnum.ServerReason.Normal)
                {
                    // 如果检测可以购买,但是提交吐货请求时出现故障,仍然暂停服务
                    if (intErrCode != 0)
                    {
                        m_ErrInfo = DictionaryHelper.Dictionary_WxTakeCode(intErrCode, m_CodeNum_Name);
                    }
                    else
                    {
                        blnIsSell = true;
                    }
                }

                result = blnIsSell;

                #endregion
            }
            catch
            {
                result = false;
            }
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 执行条形码扫描业务(2015-08-10)
        /// </summary>
        private bool PostBarCode(out bool isFindBarCode)
        {
            bool result = false;

            isFindBarCode = false;
            string strBarCodeData = string.Empty;
            string strErrCode     = string.Empty;

            try
            {
                int intErrCode = PubHelper.p_BusinOper.BarCodeOper.QueryBarCodeNum(out strBarCodeData, out strErrCode);

                if ((intErrCode == 0) && (!string.IsNullOrEmpty(strBarCodeData)))
                {
                    if ((m_CodeLen == 0) || ((m_CodeLen > 0) && (strBarCodeData.Length == m_CodeLen)))
                    {
                        isFindBarCode = true;

                        #region 寻到取货码

                        // 停止超时监控
                        StopMonOutTime();

                        m_TakeCodeNum = strBarCodeData;
                        this.tbProgressInfo.Dispatcher.Invoke(new Action(() =>
                        {
                            // 正在验证信息...
                            tbProgressInfo.Text = PubHelper.p_LangOper.GetStringBundle("WxTakeCode_Pay_Checking").Replace("{N}", m_CodeNum_Name);
                        }));

                        #region 提交请求

                        string _orderInfo = string.Empty;// 取货码|取货码类型|条码来源|价值金额|取货方式|取货货道号
                        intErrCode = PubHelper.p_BusinOper.WxTakeCodeOper.CheckTakeCodeInfo(strBarCodeData, out _orderInfo);

                        switch (intErrCode)
                        {
                        case 0:    // 提交成功
                            #region 解析相关数据

                            string[] hexOrderData = _orderInfo.Split('|');
                            if (hexOrderData.Length > 4)
                            {
                                result       = true;
                                m_TakeType   = hexOrderData[4];  // 取货方式 0:用户自主选货 1:指定货道出货 2:随机出货
                                m_TakePaCode = hexOrderData[5];  // 取货货道号
                                if ((m_TakeType == "1") || (m_TakeType == "3"))
                                {
                                    // 如果是指定货道出货或者指定商品出货
                                    if (string.IsNullOrEmpty(m_TakePaCode))
                                    {
                                        intErrCode = 99;
                                    }
                                }
                            }
                            else
                            {
                                intErrCode = 99;
                            }

                            #endregion
                            break;
                        }

                        #endregion

                        if (intErrCode != 0)
                        {
                            m_ErrInfo = DictionaryHelper.Dictionary_WxTakeCode(intErrCode, m_CodeNum_Name);
                        }

                        #endregion
                    }
                }
            }
            catch
            {
                isFindBarCode = false;
                result        = false;
            }

            return(result);
        }