示例#1
0
        public HttpResponseMessage CheckScanCode(dynamic content)
        {
            HttpResponseMessage result = null;

            try
            {
                string                       sessionKey  = Convert.ToString(content.SessionKey);
                HttpSessionState             session     = HttpContext.Current.Application[sessionKey] as HttpSessionState;
                CnasHCSWorkflowInterface     wfLogic     = WFHelper.Instance.GetWFLogic(session);
                string                       barCode     = Convert.ToString(content.BarCode);
                Dictionary <string, string>  condition   = JsonHelper.GetJsonObject <Dictionary <string, string> >(content.ScanCodes.ToString());
                Dictionary <string, dynamic> resultData  = new Dictionary <string, dynamic>();
                SortedList                   checkResult = null;
                if (!string.IsNullOrEmpty(barCode))
                {
                    checkResult = wfLogic.CheckBusinessLogic(barCode, condition);
                    resultData.Add("Result", checkResult);
                }
                else
                {
                    resultData.Add("ResultMessage", "无法验证当前条码,重新扫描");
                }
                result = Request.CreateResponse <Dictionary <string, dynamic> >(HttpStatusCode.OK, resultData);
                return(result);
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex));
            }
        }
 /// <summary>
 /// 处理条码
 /// </summary>
 /// <param name="matchBarCode"></param>
 /// <returns></returns>
 private void HandleBarCode(string matchBarCode)
 {
     if (Modle == 1)
     {
         metBcuCode.Text = "";
         metBcuCode.Text = matchBarCode;
         if (_dic != null && _dic.Count > 1)
         {
             List <string> bcuList = OrderHelper.GetBcuPackForOrder();
             string        index4  = matchBarCode.Length > 4 ? matchBarCode.Substring(0, 5) : matchBarCode;
             if (bcuList.Contains(index4))
             {
                 resultLbl.Text = OrderHelper.GetDescribeString(2);
             }
             else
             {
                 SortedList tempResult = _cnasHCSWorkflowInterface01.CheckBusinessLogic(matchBarCode, _dic);
                 int        bResult    = -1;
                 int.TryParse(Convert.ToString(tempResult["result_Code"]), out bResult);
                 string bcc_barCode           = Convert.ToString(tempResult["barCode"]);
                 string bcc_barCodeObjectName = Convert.ToString(tempResult["barCodeObjectName"]);
                 string resultStr             = Convert.ToString(tempResult["result_Message"]);
                 if (bResult == 0)
                 {
                     if (!_dic.ContainsKey(bcc_barCodeObjectName))
                     {
                         _dic.Add(bcc_barCodeObjectName, bcc_barCodeObjectName.Length > 3 ? bcc_barCodeObjectName.Substring(0, 3) : bcc_barCodeObjectName);
                     }
                     //grid数据添加
                     AddDgv_BcuData(matchBarCode, bcc_barCode, bcc_barCodeObjectName);
                 }
                 resultLbl.Text = resultStr;
             }
         }
         else
         {
             resultLbl.Text = "内部码错误";
         }
     }
 }
示例#3
0
        /// <summary>
        /// 处理条码
        /// </summary>
        /// <param name="matchBarCode"></param>
        /// <returns></returns>
        private string HandleBarCode(string matchBarCode)
        {
            string result = string.Empty;

            if (!string.IsNullOrEmpty(matchBarCode))
            {
                if (_dataDic.Count > 1)
                {
                    List <string> bcuList = OrderHelper.GetBcuPackForOrder();
                    string        index4  = string.Empty;
                    if (BarCodeHelper.IsTempBCU(matchBarCode))
                    {
                        index4 = matchBarCode.Substring(0, 5);
                    }
                    else
                    {
                        index4 = matchBarCode.Substring(0, 3);
                    }
                    KeyValuePair <string, int> bcuItem = new KeyValuePair <string, int>();

                    if (bcuList.Contains(index4))
                    {
                        if (BarCodeHelper.IsOrderOutSet(txtOrderNum.Text))
                        {
                            if (BarCodeHelper.IsTempBCU(matchBarCode))
                            {
                                if (_outOrderBCUs.Count == 0)
                                {
                                    result = OrderHelper.GetDescribeString(5);
                                    return(result);
                                }
                                else
                                {
                                    bcuItem = _outOrderBCUs.FirstOrDefault(p => p.Key == matchBarCode);
                                    if (bcuItem.Key == null)
                                    {
                                        result = OrderHelper.GetDescribeString(3);
                                        return(result);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (BarCodeHelper.IsOutOrderBCU(matchBarCode))
                            {
                                result = "此订单不能发送外来器械包。";
                                return(result);
                            }
                        }
                        SortedList tempResult = _cnasHCSWorkflowInterface01.CheckBusinessLogic(matchBarCode, _dataDic);
                        int        bResult    = -1;
                        int.TryParse(Convert.ToString(tempResult["result_Code"]), out bResult);
                        string bcct_barCode           = Convert.ToString(tempResult["barCode"]);
                        string bcct_barCodeObjectName = Convert.ToString(tempResult["barCodeObjectName"]);
                        result = Convert.ToString(tempResult["result_Message"]);
                        string messageForBox    = Convert.ToString(tempResult["MessageBox_Message"]);
                        int    messageOperation = 1;

                        if (bResult == 0)
                        {
                            if (!string.IsNullOrEmpty(messageForBox) && int.TryParse(Convert.ToString(tempResult["Message_Operation"]), out messageOperation))
                            {
                                if (MessageBox.Show(messageForBox, "信息提示", (messageOperation == 1 ? MessageBoxButtons.OK : MessageBoxButtons.OKCancel), MessageBoxIcon.Information) != System.Windows.Forms.DialogResult.OK)
                                {
                                    result = string.Format("{0} --用户取消", messageForBox);
                                    return(result);
                                }
                                else
                                {
                                    result = string.Empty;
                                }
                            }

                            if (BarCodeHelper.IsOrderOutSet(OrderNum) && string.IsNullOrEmpty(result) && BarCodeHelper.IsOutOrderBCU(matchBarCode))
                            {
                                foreach (DataGridViewRow row in dgv_Instrument.Rows)
                                {
                                    row.Cells["send_count_now"].Value = row.Cells["num"].Value;
                                }
                            }

                            if (!_dataDic.ContainsKey(bcct_barCode))
                            {
                                _dataDic.Add(bcct_barCode, bcct_barCode.Length > 3 ? bcct_barCode.Substring(0, 3) : bcct_barCode);
                            }

                            if (!string.IsNullOrEmpty(bcct_barCode) && bcct_barCode.Contains("BCC"))
                            {
                                bcct_barCode = bcct_barCode.Substring(bcct_barCode.IndexOf("BCC"));
                            }

                            AddDgv_BcuData(matchBarCode, bcct_barCode, bcct_barCodeObjectName);                            //grid数据添加
                            if (BarCodeHelper.IsOrderOutSet(OrderNum) && BarCodeHelper.IsOutOrderBCU(matchBarCode) &&
                                bcuItem.Key == matchBarCode)
                            {
                                _outOrderBCUs[matchBarCode] = 1;
                            }
                        }
                    }
                    else
                    {
                        result = OrderHelper.GetDescribeString(1);
                    }
                }
            }
            else
            {
                result = "内部码错误";
            }


            return(result);
        }