예제 #1
0
        protected override void QueryData(SinoSZPluginFramework.IApplication _application)
        {
            if (_application == null)
            {
                return;
            }

            string _errorMsg = "";

            if (!this.sinoSZUC_MD_Model_FieldList1.CheckItems(ref _errorMsg))
            {
                XtraMessageBox.Show(string.Format("选择查询结果不正确:{0}", _errorMsg), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!this.sinoSZUC_ConditionPanel1.CheckInput(ref _errorMsg))
            {
                XtraMessageBox.Show(string.Format("查询条件不正确:{0}", _errorMsg), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            MC_QueryRequsetFactory _rf = new MC_QueryRequsetFactory();

            _rf.QueryModelName = this.QueryModelName;
            this.sinoSZUC_ConditionPanel1.InsertConditions2QueryRequest(_rf);
            this.sinoSZUC_MD_Model_FieldList1.InsertResultFields2QueryRequest(_rf);

            MDQuery_Request _queryRequest = _rf.GetQueryRequest();

            if (_queryRequest.MainResultTable.Columns.Count < 1)
            {
                XtraMessageBox.Show("主表必须至少选择一个结果字段!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Dialog_TaskInfo _f = new Dialog_TaskInfo();

            if (_f.ShowDialog() == DialogResult.OK)
            {
                using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient())
                {
                    string _taskid = _msc.AddNewQueryTask(_f.Task_Name, _queryRequest);
                    if (_taskid != "")
                    {
                        XtraMessageBox.Show("此查询请求已经添加到查询任务中!请稍后在查询任务列表中查看查询结果!");
                        this.Close();
                    }
                    else
                    {
                        XtraMessageBox.Show("添加到查询任务失败!");
                    }
                }
            }
        }
예제 #2
0
        private string GetQueryTaskID(ref string rfname)
        {
            string _ret = "";

            rfname = "";
            string          Task_Name = "";
            string          _taskid   = "";
            MDQuery_Request _request;

            if (ResultData == null)
            {
                return("");
            }
            if (ResultData.Rows.Count < 1)
            {
                return("");
            }
            if (this.QueryModel.MainTable.GetColumnByName("FORM_ID") == null)
            {
                return("");
            }
            MDModel_Table_Column tc_FORM_ID       = this.QueryModel.MainTable.GetColumnByName("FORM_ID");
            MDModel_Table_Column tc_FORM_TYPE     = this.QueryModel.MainTable.GetColumnByName("FORM_TYPE");
            MDModel_Table_Column tc_I_E_PORT      = this.QueryModel.MainTable.GetColumnByName("I_E_PORT");
            MDModel_Table_Column tc_I_E_FLAG      = this.QueryModel.MainTable.GetColumnByName("I_E_FLAG");
            MDModel_Table_Column tc_I_E_DATETIME  = this.QueryModel.MainTable.GetColumnByName("I_E_DATETIME");
            MDModel_Table_Column tc_VE_CUSTOMS_NO = this.QueryModel.MainTable.GetColumnByName("VE_CUSTOMS_NO");
            DataRow _dr         = ResultData.Rows[0];
            string  _formType   = _dr[tc_FORM_TYPE.ColumnAlias].ToString().Trim();
            string  _formID     = _dr[tc_FORM_ID.ColumnAlias].ToString().Trim();
            string  _portCode   = _dr[tc_I_E_PORT.ColumnAlias].ToString().Trim();
            string  _customs_no = _dr[tc_VE_CUSTOMS_NO.ColumnAlias].ToString().Trim();

            _portCode = _portCode.Substring(0, 2);

            string   _IEFlag     = _dr[tc_I_E_FLAG.ColumnAlias].ToString().Trim();
            string   _IEFlagNum  = (_IEFlag == "I") ? "1" : "0";
            DateTime I_E_Date    = (DateTime)_dr[tc_I_E_DATETIME.ColumnAlias];
            DateTime Min_SB_Date = I_E_Date.AddMonths(-1);

            switch (_formType)
            {
            case "1":                           //清单
                return("");

            case "2":                           //报关单

                string _FormIDPre = _formID.Substring(0, 2);
                //采用改正过的算法
                //if (I_E_Date.Year == Min_SB_Date.Year)
                //{
                //        //生成一个单号
                //        _ret = string.Format("{0}{1}{2}{3}{4}", _portCode, _FormIDPre, I_E_Date.Year, _IEFlagNum, _formID);
                //}
                //else
                //{
                //        //生成两个单号
                //        string _d1 = string.Format("{0}{1}{2}{3}{4}", _portCode, _FormIDPre, I_E_Date.Year, _IEFlagNum, _formID);
                //        string _d2 = string.Format("{0}{1}{2}{3}{4}", _portCode, _FormIDPre, Min_SB_Date.Year, _IEFlagNum, _formID);
                //        _ret = string.Format("{0},{1}", _d1, _d2);
                //}

                //生成一个单号
                _ret      = string.Format("{0}{1}{2}", I_E_Date.Year, _IEFlagNum, _formID);
                _request  = CreateBGDQueryRequest(_ret);
                Task_Name = string.Format("查询车辆[{2}]于{1}进出口岸时所载货物的报关单[{0}]", _ret, I_E_Date.ToString("yyyy年MM月dd日"), _customs_no);
                rfname    = string.Format("报关单编号为[{0}]的查询任务", _ret);
                using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient())
                {
                    _taskid = _msc.AddNewQueryTask(Task_Name, _request);
                }
                return(_taskid);


            case "4":                           //转关单
                string _prestr = _formID.Substring(0, 4);
                if (_prestr == "1000" || _prestr == "5000")
                {
                    _request  = CreateZGDQueryRequest("@" + _formID, Min_SB_Date, I_E_Date);
                    Task_Name = string.Format("查询编号为{0}的转关单[{1}]", _ret, DateTime.Now.ToString("yyyyMMdd"));
                    using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient())
                    {
                        _taskid = _msc.AddNewQueryTask(Task_Name, _request);
                    }
                    return(_taskid);
                }
                break;
            }

            return("");
        }
예제 #3
0
        private string StartQueryOtherLib()
        {
            string          _ret      = "";
            string          Task_Name = "";
            string          _taskid   = "";
            MDQuery_Request _request;

            if (ResultData == null)
            {
                return("");
            }
            if (ResultData.Rows.Count < 1)
            {
                return("");
            }
            var _find = from _c in this.QueryModel.MainTable.Columns
                        where _c.ColumnName == "FORM_ID"
                        select _c;

            if (_find == null || _find.Count() < 1)
            {
                return("");
            }
            MDModel_Table_Column tc_FORM_ID       = this.QueryModel.MainTable.GetColumnByName("FORM_ID");
            MDModel_Table_Column tc_FORM_TYPE     = this.QueryModel.MainTable.GetColumnByName("FORM_TYPE");
            MDModel_Table_Column tc_I_E_PORT      = this.QueryModel.MainTable.GetColumnByName("I_E_PORT");
            MDModel_Table_Column tc_I_E_FLAG      = this.QueryModel.MainTable.GetColumnByName("I_E_FLAG");
            MDModel_Table_Column tc_I_E_DATETIME  = this.QueryModel.MainTable.GetColumnByName("I_E_DATETIME");
            MDModel_Table_Column tc_VE_CUSTOMS_NO = this.QueryModel.MainTable.GetColumnByName("VE_CUSTOMS_NO");
            DataRow _dr         = ResultData.Rows[0];
            string  _formType   = _dr[tc_FORM_TYPE.ColumnAlias].ToString().Trim();
            string  _formID     = _dr[tc_FORM_ID.ColumnAlias].ToString().Trim();
            string  _portCode   = _dr[tc_I_E_PORT.ColumnAlias].ToString().Trim();
            string  _customs_no = _dr[tc_VE_CUSTOMS_NO.ColumnAlias].ToString().Trim();

            _portCode = _portCode.Substring(0, 2);

            string   _IEFlag     = _dr[tc_I_E_FLAG.ColumnAlias].ToString().Trim();
            string   _IEFlagNum  = (_IEFlag == "I") ? "1" : "0";
            DateTime I_E_Date    = (DateTime)_dr[tc_I_E_DATETIME.ColumnAlias];
            DateTime Min_SB_Date = I_E_Date.AddMonths(-1);

            switch (_formType)
            {
            case "1":                           //清单
                XtraMessageBox.Show("本记录为清单,无法查询详细内容", "系统提示");
                return("");

            case "2":                           //报关单

                string _FormIDPre = _formID.Substring(0, 2);
                //生成一个单号
                _ret     = string.Format("{0}{1}{2}", I_E_Date.Year, _IEFlagNum, _formID);
                _request = CreateBGDQueryRequest2(I_E_Date, _IEFlagNum, _formID);
                string                _qvName = "HG_GDFS.海关报关单";
                MDModel_QueryModel    _qv     = MetaDataCache.GetQueryModelDefine(_qvName);
                frmSinoSZ_QueryResult _qr     = new frmSinoSZ_QueryResult(_qv, _request, false);
                _application.AddForm(Guid.NewGuid().ToString(), _qr);
                return(_taskid);


            case "4":                           //转关单
                string _prestr = _formID.Substring(0, 4);
                if (_prestr == "1000" || _prestr == "5000")
                {
                    _request  = CreateZGDQueryRequest("@" + _formID, Min_SB_Date, I_E_Date);
                    Task_Name = string.Format("查询编号为{0}的转关单[{1}]", _ret, DateTime.Now.ToString("yyyyMMdd"));
                    using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient())
                    {
                        _taskid = _msc.AddNewQueryTask(Task_Name, _request);
                    }
                    return(_taskid);
                }
                break;
            }

            return("");
        }