Esempio n. 1
0
 /// <summary>
 /// 添加BCCT条码
 /// </summary>
 private void AddDgv_BcuData(string bcu, string bcct, string bccName)
 {
     if (!string.IsNullOrEmpty(bcu) && !string.IsNullOrEmpty(bcct))
     {
         bool isAdd = true;
         for (int i = 0; i < dgv_BcuData.Rows.Count; i++)
         {
             string b_bar_code = Convert.ToString(dgv_BcuData.Rows[i].Cells["b_bar_code"].Value);
             if (b_bar_code.Equals(bcu))
             {
                 isAdd = false;
                 dgv_BcuData.Rows[i].Selected = true;
                 resultLbl.Text = "该条码已经找到";
             }
         }
         if (isAdd)
         {
             int index = dgv_BcuData.Rows.Add();
             dgv_BcuData.Rows[index].Cells["bid"].Value          = index + 1;
             dgv_BcuData.Rows[index].Cells["b_bar_code"].Value   = bcu;
             dgv_BcuData.Rows[index].Cells["t_b_bar_code"].Value = bcct;
             dgv_BcuData.Rows[index].Cells["b_ca_name"].Value    = bccName;
             int type = BarCodeHelper.IsTempBCU(bcu) ? 22 : 21;                      //21是含有BCC的标准包。 22是
             dgv_BcuData.Rows[index].Cells["setTypeCol"].Value = type;
         }
     }
 }
Esempio n. 2
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);
        }