Esempio n. 1
0
        /// <summary>
        /// 导入按钮的操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImport_Click(object sender, EventArgs e)
        {
            if (button1.Enabled == true)
            {
                OutUncompared();       //导出未匹配
            }
            if (this.dgvHisSend.RowCount < 1)
            {
                XtraMessageBox.Show("无可操作记录!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            IList <ImputPurchaseModel> result = new List <ImputPurchaseModel>();

            foreach (DataRow dgvr in dtRequestSend.Rows)
            {
                if (dgvr["ProductCode"] == null || dgvr["ProductCode"].ToString() == "")
                {
                    continue;
                }
                if ("0".Equals(dgvr["type"].ToString()))
                {
                    ImputPurchaseModel model = new ImputPurchaseModel();
                    model.EmedProductId = dgvr["emedProductId"].ToString();
                    model.EmedSpecId    = dgvr["emedSpecId"].ToString();
                    model.EmedModelId   = dgvr["emedModelId"].ToString();
                    model.EmedSenderId  = dgvr["emedSenderId"].ToString();
                    model.Psqymc        = dgvr["emedSenderName"].ToString();
                    model.Psqyjc        = dgvr["emedSenderEasy"].ToString();
                    model.Cgsl          = dgvr["RequestQty"].ToString();
                    model.Cpmc          = dgvr["ProductName"].ToString();
                    model.Scqymc        = dgvr["FactoryName"].ToString();
                    model.Scqyjc        = dgvr["factoryeasy"].ToString();
                    model.Bzdw          = dgvr["SpecUnit"].ToString();
                    model.Price         = dgvr["Price"].ToString();
                    model.Hcmc          = dgvr["InstruName"].ToString();
                    model.Zdbz          = dgvr["selfpackage"].ToString();
                    model.Brand         = dgvr["Brand"].ToString();
                    result.Add(model);
                }
            }
            if (result.Count < 1)
            {
                XtraMessageBox.Show("无可导入数据!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            //转到制定采购单
            FormPurchaseCreate frm = new FormPurchaseCreate("新建采购单", null, result);

            frm.ShowDialog();;
            frm.Dispose();
        }
Esempio n. 2
0
        //导出未匹配
        private void OutUncompared()
        {
            IList <ImputPurchaseModel> resultp = new List <ImputPurchaseModel>();

            foreach (DataRow dgvr in dtRequestSend.Rows)
            {
                if (!"0".Equals(dgvr["type"].ToString()))
                {
                    ImputPurchaseModel requestSendModel = new ImputPurchaseModel();
                    requestSendModel.Psqymc = dgvr["SenderName"].ToString();
                    requestSendModel.Hcbm   = dgvr["ProductCode"].ToString();
                    requestSendModel.Psqybm = dgvr["SenderCode"].ToString();
                    requestSendModel.Hcmc   = dgvr["ProductName"].ToString();
                    requestSendModel.Xhmc   = dgvr["ModeName"].ToString();
                    requestSendModel.Ggmc   = dgvr["Spec"].ToString();
                    requestSendModel.Cgsl   = dgvr["RequestQty"].ToString();
                    requestSendModel.Bzdw   = dgvr["SpecUnit"].ToString();
                    requestSendModel.Scqymc = dgvr["FactoryName"].ToString();
                    requestSendModel.State  = dgvr["state"].ToString();
                    requestSendModel.Hcmc   = dgvr["InstruName"].ToString();
                    requestSendModel.Brand  = dgvr["Brand"].ToString();

                    resultp.Add(requestSendModel);
                }
            }
            if (resultp.Count < 1)
            {
                return;
            }
            HisPlanErrorList frmHisPlanError = new HisPlanErrorList(resultp);

            frmHisPlanError.ShowDialog();
            //未匹配结构导出成功改变按钮颜色,隐藏未匹配数据

            if (!frmHisPlanError.flag)
            {
                button1.Enabled = false;

                dtRequestSend.DefaultView.RowFilter = "type='0'";
            }
        }