Exemplo n.º 1
0
        public void QuerydataBind()
        {
            //string ProjectId = cmb_project.SelectedValue.ToString();
            if (YuguType == "M")
            {
                mmtypeid = activity;
            }
            if (YuguType == "S")
            {
                systemid = activity;
            }
            string site     = cmb_site.SelectedValue.ToString();
            string partno   = cmb_partno.Text.Trim().ToString().ToLower();
            string PartName = cmb_dpname.Text.Trim().ToString().ToLower();
            string parttype = tb_type.Text.Trim().ToString().ToLower();

            StringBuilder sb = new StringBuilder();

            //if (ProjectId != string.Empty) sb.Append(" AND PROJECTID = '" + ProjectId + "'");
            if (site != string.Empty)
            {
                sb.Append(" AND CONTRACT = '" + site + "'");
            }
            if (partno != string.Empty)
            {
                sb.Append(" AND lower(part_no) like '%" + partno + "%'");
            }
            if (PartName != string.Empty)
            {
                sb.Append(" AND lower(part_spec) like '%" + PartName + "%'");
            }
            if (parttype != string.Empty)
            {
                sb.Append(" AND lower(part_type) like '%" + parttype + "%'");
            }

            if (YuguType == "S")
            {
                if (mmtypeid != "0")
                {
                    sb.Append(" and parentid=" + mmtypeid);
                }
                //sb.Append(" and systemid=" + activity);
            }
            if (YuguType == "M")
            {
                sb.Append(" and parentid=" + mmtypeid);
                //sb.Append(" and systemid=" + systemid);
            }
            //if(checkBox1.)
            //string sqlSelect = "SELECT '','',pp.*,'' FROM  PLM.MM_PART_TAB pp WHERE 1=1 and parentid= " + activity;
            string sqlSelect = "select t.ID 序号,t.part_no 零件号,t.part_type 零件类别,t.part_spec 零件规格,t.part_mat 材质,t.part_cert 证书,t.part_unit 单位,t.part_unitdensity 单位密度,t.part_densityunit 密度单位,t.part_level 等级,t.parentid,t.contract 域" +
                               ",'' as 预估量,'' as 预警系数,'' 连接件 from mm_part_tab t WHERE 1=1 ";
            string wheresql = sb.ToString();

            sqlSelect = sqlSelect + wheresql + " order by t.parentid,t.part_type";
            XmlOper.setXML("Type", mmtypeid);
            listviewBind(sqlSelect);
        }
Exemplo n.º 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string userName = tbUserName.Text.ToLower();

            if (string.IsNullOrEmpty(userName))
            {
                MessageBox.Show("登录名不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                tbUserName.Focus();
                return;
            }

            string passWord = tbPassword.Text;

            if (string.IsNullOrEmpty(passWord))
            {
                MessageBox.Show("登录密码不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                tbPassword.Focus();
                return;
            }

            string dbsever = string.Empty;

            if (this.comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show("请与数据库管理员联系配置数据库连接", "数据库连接问题", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                if (this.comboBox1.SelectedItem.ToString().Trim() == "正式库")
                {
                    dbsever = "OIDS";
                }
                else if (this.comboBox1.SelectedItem.ToString().Trim() == "测试库")
                {
                    dbsever = "OIDSNEW";
                }
                DataAccess.GetSeverName(dbsever);
                Framework.DataAccess.GetSeverName(dbsever);
            }

            bool loginState = User.Verify(userName, passWord);

            if (loginState)
            {
                LoginUserName = userName;
                XmlOper.setXML("Name", userName);
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("登录名或密码错误!", "小票查询", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Exemplo n.º 3
0
        public void QuerydataBindpara()
        {
            //string ProjectId = cmb_project.SelectedValue.ToString();
            //if (YuguType == "M") mmtypeid = activity;
            //if (YuguType == "S") systemid = activity;
            string        parttype     = cmb_partno.Text.Trim().ToString().ToLower();
            string        disciplineid = cmb_dpname.SelectedValue.ToString();
            string        projectzone  = tb_type.Text.Trim().ToLower();
            StringBuilder sb           = new StringBuilder();

            //if (ProjectId != string.Empty) sb.Append(" AND PROJECTID = '" + ProjectId + "'");
            if (mSite != string.Empty)
            {
                sb.Append(" AND CONTRACT = '" + mSite + "'");
            }
            if (projectzone != string.Empty)
            {
                sb.Append(" AND  lower(project_zone) like '%" + projectzone + "%'");
            }
            if (disciplineid != string.Empty)
            {
                sb.Append(" AND discipline  = " + disciplineid);
            }
            if (parttype != string.Empty)
            {
                sb.Append(" AND lower(part_type) like '%" + parttype + "%'");
            }

            //if (YuguType == "S")
            //{
            //    if (mmtypeid != "0")
            //        sb.Append(" and parentid=" + mmtypeid);
            //    //sb.Append(" and systemid=" + activity);
            //}
            //if (YuguType == "M")
            //{
            //    sb.Append(" and parentid=" + mmtypeid);
            //    //sb.Append(" and systemid=" + systemid);
            //}
            XmlOper.setXML("Type", mmtypeid);
            //if(checkBox1.)
            //string sqlSelect = "SELECT '','',pp.*,'' FROM  PLM.MM_PART_TAB pp WHERE 1=1 and parentid= " + activity;
            string sqlSelect = "select * from mm_part_para_view p where projectid='" + ProjectId + "' and p.operator='" + LoginUser + "'";
            string wheresql  = sb.ToString();

            sqlSelect = sqlSelect + wheresql + " order by p.part_no";
            listviewBindpara(sqlSelect);
        }
Exemplo n.º 4
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (dgv1.RowCount < 1)
            {
                return;
            }

            if (ProjectId == string.Empty)
            {
                MessageBox.Show("请选择项目");
                return;
            }

            int rowcou = dgv1.RowCount;

            if (rowcou == 0)
            {
                MessageBox.Show("请选择所要下发的材料", "操作提示");
                return;
            }

            rowcou = dgv1.RowCount;

            //for (int i = 0; i < rowcou; i++)
            //{

            //    if (dgv1.Rows[i].Cells["序号"].Value == null)
            //    {

            //        MessageBox.Show("第" + (i + 1) + "行请填写材料", "提示");
            //        return;
            //    }


            //}
            SetRowNo();
            try
            {
                for (int i = 0; i < rowcou; i++)
                {
                    #region 检查必填项以及数据的合法性
                    string rowid = dgv1.Rows[i].Cells["行"].Value.ToString();
                    if (dgv1.Rows[i].Cells["需求数量"].Value != null)
                    {
                        if (!BaseClass.validateNum(dgv1.Rows[i].Cells["需求数量"].Value.ToString().Trim()))
                        {
                            MessageBox.Show("第 " + rowid + " 行需求数量请填写数字", "提示");
                            dgv1.Rows[i].Selected = true;
                            return;
                        }
                        if (dgv1.Rows[i].Cells["需求数量"].Value.ToString().Trim().Contains("-"))
                        {
                            MessageBox.Show("第 " + rowid + " 行需求数量为负,请检查", "提示");
                            dgv1.Rows[i].Selected = true;
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("第 " + rowid + " 行请填写需求数量", "提示");
                        //dgv1.Rows[i].Selected = true;
                        dgv1.CurrentCell = dgv1.Rows[i].Cells["需求数量"];
                        return;
                    }

                    //if (dgv1.Rows[i].Cells["MEO_ERP"].Value != null)
                    //{
                    //    if (!BaseClass.validateNum(dgv1.Rows[i].Cells["MEO_ERP"].Value.ToString().Trim()))
                    //    {
                    //        MessageBox.Show("第 " + rowid + " 行MEO号请填写数字", "提示");
                    //        dgv1.Rows[i].Selected = true;
                    //        return;
                    //    }
                    //}
                    //else
                    //{
                    //    //if (MEOID != "0")
                    //    //{
                    //    //    MessageBox.Show("第 " + rowid + " 行请填写MEO号", "提示");
                    //    //    //dgv1.Rows[i].Selected = true;
                    //    //    dgv1.CurrentCell = dgv1.Rows[i].Cells["MEO_ERP"];
                    //    //    return;
                    //    //}
                    //}

                    if (dgv1.Rows[i].Cells["需求日期"].Value == null)
                    {
                        MessageBox.Show("第 " + rowid + " 行请填写需求日期", "提示");
                        dgv1.Rows[i].Selected = true;
                        return;
                    }
                    //if (dgv1.Rows[i].Cells["需求日期"].Value != null)
                    //{
                    //    if (Convert.ToDateTime(dgv1.Rows[i].Cells["需求日期"].Value.ToString()) < DateTime.Today)
                    //    {
                    //        MessageBox.Show("第 " + rowid + " 行需求日期不能小于当前日期", "提示");
                    //        dgv1.Rows[i].Selected = true;
                    //        return;
                    //    }
                    //}
                    if (dgv1.Rows[i].Cells["需求原因"].Value == null)
                    {
                        MessageBox.Show("第 " + rowid + " 行请填写需求原因", "提示");
                        dgv1.Rows[i].Selected = true;
                        return;
                    }

                    if (dgv1.Rows[i].Cells["MEO_ERP"].Value != null)
                    {
                        string partno = dgv1.Rows[i].Cells["零件号"].Value.ToString();
                        if (MEOsub.meomssExistERP(dgv1.Rows[i].Cells["MEO_ERP"].Value.ToString(), partno) == 0)
                        {
                            MessageBox.Show("第 " + rowid + " 行ERP中的MEO号不存在", "提示");
                            dgv1.Rows[i].Selected = true;
                            return;
                        }
                    }
                    #endregion
                }
                for (int i = 0; i < rowcou; i++)
                {
                    #region 循环保存数据
                    string   Rationid   = dgv1.Rows[i].Cells["Ration_id"].Value.ToString();
                    string   contractno = cmb_site.SelectedValue.ToString();
                    string   Partno     = dgv1.Rows[i].Cells["零件号"].Value.ToString();
                    Decimal  Reqqty     = Decimal.Parse(dgv1.Rows[i].Cells["需求数量"].Value.ToString());
                    DateTime ReqDate    = Convert.ToDateTime(dgv1.Rows[i].Cells["需求日期"].Value.ToString());
                    //string purpose = txt_purpose.Text.Trim().ToString();
                    string blockId    = cmb_block.SelectedValue.ToString();
                    string ReasonCode = dgv1.Rows[i].Cells["需求原因"].Value.ToString();
                    //string DesignCode = txt_designcode.Text.Trim().ToString();
                    string ReqNo  = dgv1.Rows[i].Cells["MEO_ERP"].Value.ToString();
                    string remark = dgv1.Rows[i].Cells["备注"].Value.ToString();
                    //string isInventory = chb_useInv.Checked == true ? "是" : "否";
                    string Partname = dgv1.Rows[i].Cells["零件描述"].Value.ToString();
                    string zyname   = dgv1.Rows[i].Cells["dt_zy"].Value.ToString();
                    string qyname   = dgv1.Rows[i].Cells["dt_qy"].Value.ToString();
                    string fxname   = dgv1.Rows[i].Cells["dt_fx"].Value.ToString();
                    string zlname   = dgv1.Rows[i].Cells["dt_zl"].Value.ToString();
                    Ration mp       = new Ration();
                    mp.PROJECT_ID  = ProjectId;
                    mp.RATION_ID   = Convert.ToInt32(Rationid);
                    mp.PART_NO     = Partno;
                    mp.ISSUED_QTY  = decimal.Round(Reqqty, 2);
                    mp.ISSUED_DATE = ReqDate;
                    //mp.IF_INVENTORY = isInventory;
                    //mp.PURPOSE = purpose;
                    mp.BLOCK_ID    = blockId;
                    mp.REASON_CODE = ReasonCode;
                    //mp.DESIGN_CODE = DesignCode;
                    mp.REMARK          = remark;
                    mp.INFORMATION     = remark;
                    mp.CONTRACT        = contractno;
                    mp.CREATER         = User.cur_user;
                    mp.PART_NAME       = Partname;
                    mp.ECPROJECTID     = ecprojectid;
                    mp.PART_ZONE       = qyname;
                    mp.PART_FX         = fxname;
                    mp.PART_DISCIPLINE = zyname;
                    mp.PART_TYPE       = zlname;
                    XmlOper.setXML("Block", blockId);
                    if (Rationid != "0")
                    {
                        //mp.RATION_ID = Convert.ToInt32(lbl_rationid.Text);
                        int n = mp.Update();
                    }
                    else
                    {
                        int n = mp.Add();
                    }
                    #endregion
                }
                MessageBox.Show("保存成功!!!");
            }
            catch (Exception err)
            {
                MessageBox.Show("错误原因:" + err.Message, "错误提示信息",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            //    QuerydataBind();
        }