Пример #1
0
        private void button8_Click(object sender, EventArgs e)
        {
            SortedList scanCodes = new SortedList();

            CnasBaseData.SystemID = "1";

            if (!string.IsNullOrEmpty(paramTxt.Text))
            {
                string[] scanCode = paramTxt.Text.Split(',');
                for (int i = 0; i < scanCode.Length; i++)
                {
                    scanCodes.Add(scanCode[i], scanCode[i].Substring(0, 3));
                }

                HCSWF_dialog_container form = new HCSWF_dialog_container(scanCodes);
                //BaseForm form = WorkFlowDialogGenerator.Instance.GeneratorForm(scanCodes);

                form.ShowDialog();
            }
        }
Пример #2
0
        private string setbarcode(string indata)
        {
            string str_bcx = indata.Substring(0, 5);

            if (str_bcx == "BCXP9")
            {
                if (indata == "BCXP900000001")
                {
                    //确定开始提交(扫描万所有用户、流程、包等等)
                    #region 首先判断是否有人机交互参数需要选择,如果有需要调用HCSSM_parameters_select
                    string str_pdcode = SL_check["pd_code"].ToString();
                    //检查所有条码是否已经扫描完成
                    if (str_pdcode == "" || submitok() < 0)
                    {
                        //Cnas.wns.CnasMetroFramework.MetroMessageBox.Show(this, "请先选择流程,或者扫描完所有条码后提交!!!", "信息提示");
                        return("请先选择流程,或者扫描完所有条码后提交!!!");
                    }

                    HCSWF_dialog_container form = new HCSWF_dialog_container(SL_barcode, SL_check, CnasHCSWorkflowInterface01, Convert.ToString(SL_check["pd_code"]), SL_parametertmp02, dtpartvalue, SL_parametersinfo);
                    if (form.DialogResultStatus == 1)
                    {
                        if (!form.ViewData.ContainsKey("UserInfo"))
                        {
                            form.ViewData.Add("UserInfo", _userInfo);
                        }
                        form.ShowDialog();
                        if (form.DialogResultStatus == 1)
                        {
                            return("请确定扫描的条码!!!");
                        }
                        else if (form.DialogResultStatus == 3)
                        {
                            this.Close();
                        }
                        else
                        {
                            //Todo rui: refresh the SL_barcode and datagrid.
                            if (form.OutputParameters != null && form.OutputParameters.Count > 0)
                            {
                                configDialogParames = form.OutputParameters;
                            }
                            SL_barcode = form.ScanBarCodes;
                            if (configDialogParames != null && configDialogParames.ContainsKey("pd_par2"))
                            {
                                SL_parametertmp02   = (SortedList)configDialogParames["pd_par2"];
                                SL_check["pd_par2"] = SL_parametertmp02;
                            }
                            if (configDialogParames != null && configDialogParames.ContainsKey("Par2_info"))
                            {
                                SL_parametersinfo = (SortedList)configDialogParames["Par2_info"];
                            }
                            if (configDialogParames != null && configDialogParames.ContainsKey("DialogGridParamters"))
                            {
                                SortedList bccCodeList = (SortedList)configDialogParames["DialogGridParamters"];
                                DrawGridBccData(dgv_01, bccCodeList, out SL_barcode);
                            }
                        }
                    }
                    else
                    {
                        //开始人机交互参数选择界面
                        if (SL_parametertmp02.Count > 0 && SL_parametersinfo.Count == 0)
                        {
                            HCSSM_parameters_select HCSSM_parameters_select01 = new HCSSM_parameters_select(SL_check["pd_code"].ToString(), SL_parametertmp02, dtpartvalue);
                            HCSSM_parameters_select01.ShowDialog();
                            //获取parameter_02参数的交互值
                            if (HCSSM_parameters_select01.Int_rec < 0)
                            {
                                return("取消提交,参数选择未完成。");
                            }

                            SL_parametertmp02   = HCSSM_parameters_select01.SL_returnparametersvalue;
                            SL_parametersinfo   = HCSSM_parameters_select01.SL_returnparametersinfo;
                            SL_check["pd_par2"] = SL_parametertmp02;
                        }
                    }

                    #endregion


                    #region 开始提交给下一步流程
                    submitwf();

                    #endregion
                }
                else if (indata == "BCXP900000002")
                {
                    this.Close();
                }
                else if (indata == "BCXP900000003")
                {
                }
            }
            else if (str_bcx == "BCXP2")
            {
                //处理人机交互选择
            }
            else if (str_bcx == "BCXP1")
            {
                //系统参数,好像不用处理
            }
            else
            {
                //处理业务条码
                #region 处理业务条码
                string str_bcx02 = indata.Substring(0, 3);

                //判断是否是重复扫描同一个条码
                int int_ifexist = 0;
                for (int k = 0; k < SL_barcode.Count; k++)
                {
                    if (SL_barcode.GetKey(k).ToString().Substring(0, indata.Length) == indata)
                    {
                        int_ifexist++;
                    }
                }

                if (int_ifexist == 0)//
                {
                    #region 正常加入条码
                    if (str_bcx02 == "BCV")
                    {
                        #region 扫描流程
                        //判断是否已经有流程扫描
                        for (int j = 0; j < SL_barcode.Count; j++)
                        {
                            if (SL_barcode.GetByIndex(j).ToString().Substring(0, 3) == "BCV")
                            {
                                return("已经选择一个流程");
                            }
                        }

                        DataRow[] arrayDR = dtapppd.Select("pd_bcode='" + indata + "'");
                        if (arrayDR.Length == 0)
                        {
                            return("扫描的流程不属于该区域");
                        }
                        string str_pdid = "", str_pdcode = "", str_pdname = "", str_pdscan = "";
                        //if (arrayDR[0]["pd_id"] != null) str_pdid = arrayDR[0]["pd_id"].ToString();
                        if (arrayDR[0]["pd_code"] != null)
                        {
                            str_pdcode = arrayDR[0]["pd_code"].ToString();
                        }
                        if (arrayDR[0]["pd_name"] != null)
                        {
                            str_pdname = arrayDR[0]["pd_name"].ToString();
                        }
                        if (arrayDR[0]["pd_scan"] != null)
                        {
                            str_pdscan = arrayDR[0]["pd_scan"].ToString();
                        }

                        #region 处理参数,并且对参数分类
                        SL_parametertmp01.Clear();
                        SL_parametertmp02.Clear();
                        DataRow[] arrayDR01 = dtpdpart.Select("pd_code=" + str_pdcode);
                        foreach (DataRow dr in arrayDR01)
                        {
                            if (dr["par_name"] != null)
                            {
                                string str_parname01       = dr["par_name"].ToString();
                                string str_partype01       = dr["par_type"].ToString();
                                string str_par_description = dr["par_description"].ToString();
                                if (str_partype01 == "2")
                                {
                                    SL_parametertmp02.Add(str_parname01, str_par_description);
                                }
                                else
                                {
                                    SL_parametertmp01.Add(str_parname01, str_par_description);
                                }
                            }
                        }
                        #endregion

                        //将流程扫描允许条件放入集合SL_checkbarcode
                        SL_checkbarcode.Clear();
                        if (str_pdscan.Length > 0)
                        {
                            string[] strbarcode = str_pdscan.Split(';');
                            for (int i = 0; i < strbarcode.Length; i++)
                            {
                                if (strbarcode[i].Length > 0)
                                {
                                    SL_checkbarcode.Add(strbarcode[i].Substring(0, 3), strbarcode[i].Substring(3));
                                }
                            }
                        }
                        PD_Code                = str_pdcode;
                        SL_check["pd_code"]    = str_pdcode;        //流程代码
                        SL_check["pd_name"]    = str_pdname;        //流程名字
                        SL_check["pd_barcode"] = indata;            //流程编码
                        SL_check["pd_scan"]    = SL_checkbarcode;   //流程允许扫描代码
                        SL_check["pd_par1"]    = SL_parametertmp01; //所有流程参数为1的集合
                        SL_check["pd_par2"]    = SL_parametertmp02; //所有流程参数为2的集合

                        SL_barcode.Add(indata, "BCV");
                        return(addtodgv(indata, str_pdname));

                        #endregion
                    }
                    else
                    {
                        #region 扫描实体(并且判断改实体是不是到了该流程环节)
                        if (SL_check["pd_code"].ToString() == "" || SL_checkbarcode.Count == 0 || SL_checkbarcode[str_bcx02] == null)
                        {
                            return("没有扫流程条码或扫描规则不符合");   //没有扫流程条码、扫描规则不符合,不允许任何下一步动作
                        }
                        else
                        {
                            //判断实体允许数量
                            int int_scan = int.Parse(SL_checkbarcode[str_bcx02].ToString());
                            int_scan = int_scan == 0 ? 1 : int_scan;
                            int int_count = 0;
                            for (int i = 0; i < SL_barcode.Count; i++)
                            {
                                if (SL_barcode.GetByIndex(i).ToString().Substring(0, 3) == str_bcx02)
                                {
                                    int_count++;
                                }
                            }
                            if (int_count >= int_scan)//已经满足扫描码条件数量,不允许再扫描该条形码
                            {
                                return("已经满足扫描码条件数量");
                            }
                        }

                        //判断当前条码,是否符合当前流程环节
                        //if (str_bcx02 == "BCC" || str_bcx02 == "BCD" || str_bcx02 == "BCP" || str_bcx02 == "BCW")
                        SortedList sl_if01   = CnasHCSWorkflowInterface01.ifinwf(indata, SL_check["pd_code"].ToString(), CnasBaseData.SystemBaseData);
                        string     str_rec01 = sl_if01["rec_result"].ToString();
                        string     str_rec02 = sl_if01["rec_data01"].ToString();
                        string     str_rec03 = sl_if01["rec_data02"].ToString();
                        string     str_BCU   = sl_if01["BCU"].ToString();
                        if (str_rec01 != "1")
                        {
                            return(str_rec02);
                        }
                        else
                        {
                            if (str_bcx02 == "BCU" || str_bcx02 == "BCS")
                            {
                                //拼装BCU:BCC
                                indata = indata + ":" + str_rec02;
                            }
                            if (str_bcx02 == "BCP" || str_bcx02 == "BCW" || str_bcx02 == "BCZ")
                            {
                                //判断程序
                                CnasRemotCall reCnasRemotCall = new CnasRemotCall();
                                SortedList    condition       = new SortedList();
                                condition.Add(1, indata);
                                if (str_bcx02 == "BCP")
                                {
                                    string test01 = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-washing-program-sec004", condition);
                                    _washingprogramdt = reCnasRemotCall.RemotInterface.SelectData("HCS-washing-program-sec004", condition);
                                    if (_washingprogramdt == null || (_washingprogramdt != null && _washingprogramdt.Rows.Count == 0))
                                    {
                                        string test02 = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-sterilizer-program-sec004", condition);
                                        _sterilizerprogramdt = reCnasRemotCall.RemotInterface.SelectData("HCS-sterilizer-program-sec004", condition);
                                        if (_sterilizerprogramdt == null || (_sterilizerprogramdt != null && _sterilizerprogramdt.Rows.Count == 0))
                                        {
                                            return("灭菌或清洗程序错误,请联系管理员");
                                        }
                                        else
                                        {
                                            str_rec03 = Convert.ToString(_sterilizerprogramdt.Rows[0]["pr_name"]);
                                        }
                                    }
                                    else
                                    {
                                        str_rec03 = Convert.ToString(_washingprogramdt.Rows[0]["pr_name"]);
                                    }
                                }
                                condition.Add(2, CnasBaseData.SystemID);
                                if (str_bcx02 == "BCW")
                                {
                                    string test03 = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-washing-device-sec002", condition);
                                    _washingMachinedt = reCnasRemotCall.RemotInterface.SelectData("HCS-washing-device-sec002", condition);
                                    if (_washingMachinedt == null || (_washingMachinedt != null && _washingMachinedt.Rows.Count == 0))
                                    {
                                        return("清洗机器错误,请联系管理员");
                                    }
                                    else
                                    {
                                        str_rec03 = Convert.ToString(_washingMachinedt.Rows[0]["ca_name"]);
                                    }
                                }
                                if (str_bcx02 == "BCZ")
                                {
                                    string test04 = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-sterilizer-device-sec002", condition);
                                    _sterilizerMachinedt = reCnasRemotCall.RemotInterface.SelectData("HCS-sterilizer-device-sec002", condition);
                                    if (_sterilizerMachinedt == null || (_sterilizerMachinedt != null && _sterilizerMachinedt.Rows.Count == 0))
                                    {
                                        return("灭菌机器错误,请联系管理员");
                                    }
                                    else
                                    {
                                        str_rec03 = Convert.ToString(_sterilizerMachinedt.Rows[0]["ca_name"]);
                                    }
                                }
                            }
                            if (_washingMachinedt != null && _washingMachinedt.Rows.Count > 0 && _washingprogramdt != null && _washingprogramdt.Rows.Count > 0)
                            {
                                //验证清洗程序以及清洗机器
                                CnasRemotCall reCnasRemotCall = new CnasRemotCall();
                                SortedList    condition       = new SortedList();
                                condition.Add(1, _washingMachinedt.Rows[0]["id"]);
                                condition.Add(2, _washingprogramdt.Rows[0]["id"]);
                                string    test05 = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-washing-deviceprogram-sec003", condition);
                                DataTable dt     = reCnasRemotCall.RemotInterface.SelectData("HCS-washing-deviceprogram-sec002", condition);
                                if (dt == null || (dt != null && dt.Rows.Count == 0))
                                {
                                    return("扫码错误:清洗程序和清洗机器不匹配");
                                }
                            }
                            if (_sterilizerMachinedt != null && _sterilizerMachinedt.Rows.Count > 0 && _sterilizerprogramdt != null && _sterilizerprogramdt.Rows.Count > 0)
                            {
                                //验证灭菌程序以及灭菌机器
                                CnasRemotCall reCnasRemotCall = new CnasRemotCall();
                                SortedList    condition       = new SortedList();
                                condition.Add(1, _sterilizerMachinedt.Rows[0]["id"]);
                                condition.Add(2, _sterilizerprogramdt.Rows[0]["id"]);
                                string    test06 = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-sterilizer-deviceprogram-sec004", condition);
                                DataTable dt     = reCnasRemotCall.RemotInterface.SelectData("HCS-sterilizer-deviceprogram-sec004", condition);
                                if (dt == null || (dt != null && dt.Rows.Count == 0))
                                {
                                    return("扫码错误:灭菌程序和灭菌机器不匹配");
                                }
                            }
                            if (_washingMachinedt != null && _washingMachinedt.Rows.Count > 0 && _sterilizerprogramdt != null && _sterilizerprogramdt.Rows.Count > 0)
                            {
                                return("扫码错误:清洗机器不能采用灭菌程序");
                            }
                            if (_sterilizerMachinedt != null && _sterilizerMachinedt.Rows.Count > 0 && _washingprogramdt != null && _washingprogramdt.Rows.Count > 0)
                            {
                                return("扫码错误:灭菌机器不能采用清洗程序");
                            }
                            //做合拍验证
                            if (str_BCU != "")
                            {
                                //此处为需要创建BCU条码并且进行打印
                                //Print_BCU_Code(indata, str_BCU);
                            }

                            SL_barcode.Add(indata, str_bcx02);
                            #region 查找代码解释
                            string str_tmp01 = "未知编码";
                            if (str_rec03 == "")
                            {
                                DataRow[] arrayDR02 = CnasBaseData.SystemBaseData.Select("type_code='HCS_barcode_type' and key_code='" + str_bcx02 + "'");
                                if (arrayDR02.Length > 0)
                                {
                                    str_tmp01 = arrayDR02[0]["value_code"].ToString();
                                }
                            }
                            else
                            {
                                str_tmp01 = str_rec03;
                            }
                            #endregion
                            return(addtodgv(indata, str_tmp01));
                        }
                        #endregion
                    }

                    #endregion
                }
                else
                {
                    #region 处理重复扫描代码
                    //string strtmp = SL_barcode[indata].ToString();
                    for (int i = 0; i < dgv_01.Rows.Count; i++)
                    {
                        if (dgv_01.Rows[i].Cells["barcode"].Value.ToString() == indata)
                        {
                            dgv_01.Rows[i].Selected = true;
                            break;
                        }
                    }
                    return("该条码已经存在,帮助你找到。");

                    #endregion
                }
                #endregion
            }
            return("");
        }