Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userName       = theUserManager.getUserName();
            string      sql11          = "select nvl(item_flag,'N') from data_plan where plan_code='" + Request["planCode"].ToString() + "' ";

            if (dc.GetValue(sql11) == "Y")
            {
                showAlert(this, "计划已库房确认,不能替换!");
                return;
            }

            //先删除
            BomReplaceFactory.MW_INSERT_SJBOMSOTHMUTI("DELETE", Request["so"].ToString(), "", "", userName, Request.UserHostAddress,
                                                      Request["planCode"].ToString(), "", "", "", Request["plineCode"].ToString(), cmbGroup.Text, "", "");

            //逐条新增
            string sql = "select a.oldpart ,b.pt_desc2 oldpart_name, a.newpart ,c.pt_desc2 newpart_name,a.sl,d.location_code  from sjbomthset a"
                         + " left outer join copy_pt_mstr b on a.oldpart=b.pt_part"
                         + " left outer join copy_pt_mstr c on a.newpart=c.pt_part"
                         + " left join DATA_PLAN_STANDARD_BOM d on a.oldpart = d.item_code and plan_code='" + Request["planCode"].ToString() + "' "
                         + " where (so='" + Request["so"].ToString() + "' or so='" + thgxjx
                         + "') and settype='1' and usetime<=to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd') and endtime>=to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd') and thgroup='" + cmbGroup.Text + "'";
            DataTable dt = dc.GetTable(sql);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                BomReplaceFactory.MW_INSERT_SJBOMSOTHMUTI("ADD", Request["so"].ToString(), dt.Rows[i]["oldpart"].ToString(),
                                                          dt.Rows[i]["newPart"].ToString(), userName, Request.UserHostAddress, Request["planCode"].ToString(),
                                                          dt.Rows[i]["location_code"].ToString(), dt.Rows[i]["location_code"].ToString(), "", Request["plineCode"].ToString(), cmbGroup.Text,
                                                          dt.Rows[i]["sl"].ToString(), "");
            }
        }
Example #2
0
        protected void gridMultiPlace_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
        {
            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userName       = theUserManager.getUserName();


            string THEGROUP = gridMultiPlace.GetRowValues(e.VisibleIndex, "THEGROUP") as string;
            string flag     = gridMultiPlace.GetRowValues(e.VisibleIndex, "FLAG") as string;
            string JHDM     = gridMultiPlace.GetRowValues(e.VisibleIndex, "JHDM") as string;
            string SO       = gridMultiPlace.GetRowValues(e.VisibleIndex, "SO") as string;

            //删除
            if (e.ButtonID == "Delete")
            {
                string sql = "delete from  SJBOMTHMUTICFM  where jhdm='" + JHDM + "' and so='" + SO + "' and THEGROUP='" + THEGROUP + "' ";
                dc.ExeSql(sql);
            }

            //加入替换
            if (e.ButtonID == "Replace")
            {
                BomReplaceFactory.MW_INSERT_SJBOMSOTHMUTI("KFCONFIRM", SO, "", "", userName, Request.UserHostAddress, JHDM, "", "", "", cmbPline.Value.ToString(), THEGROUP, "", "");
                //BomReplaceFactory.PL_INSERT_SJBOMSOTH("ADD", SO, LJDM1, LJDM2, "", "", "", userName, Request.UserHostAddress, JHDM, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), GWDM, "0", "", "0", cmbPline.Value.ToString());
            }

            //确认
            if (e.ButtonID == "Confirm")
            {
                string sql = "update SJBOMTHMUTICFM set qrsj=sysdate,qryh='" + userName + "',flag='2' where jhdm='" + JHDM + "' and THEGROUP='" + THEGROUP + "' ";
                dc.ExeSql(sql);
            }

            setCondition();
        }
Example #3
0
        protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            string MachineName   = Request.UserHostAddress;
            string hostIPAddress = Page.Request.UserHostAddress;

            //IPHostEntry hostInfo = System.Net.Dns.GetHostByAddress(hostIPAddress);
            MachineName = hostIPAddress;

            //删除原来记录
            string sql = "DELETE FROM RST_QAD_BOMPART_LQ_TEMP where ABOM_USER='******'";

            dc.ExeSql(sql);

            //批量生成
            if (listPlan.Items.Count > 0)
            {
                for (int i = 0; i < listPlan.Items.Count; i++)
                {
                    string str = listPlan.Items[i].Text;
                    BomReplaceFactory.QAD_CREATE_PRTPART_LQ(str, MachineName);
                }
            }

            sql = "select ABOM_JHDM ,ABOM_COMP ,ABOM_DESC ,ABOM_WKCTR ,ABOM_QTY ,SJ_FLAG  from RST_QAD_BOMPART_LQ where ABOM_USER='******' order by SJ_FLAG DESC,ABOM_JHDM,ABOM_WKCTR";
            Session["mmsMaterialSend001"] = sql;
            ASPxGridView1.DataSource      = dc.GetTable(sql);
            ASPxGridView1.DataBind();
        }
Example #4
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            //ASPxGridView atl1 = (ASPxGridView)sender;
            List <object> rowid = grid.GetSelectedFieldValues("ROWID");
            //List<object> planCode = grid.GetSelectedFieldValues("JHDM");
            //List<object> oldPart = grid.GetSelectedFieldValues("LJDM1");
            //List<object> newPart = grid.GetSelectedFieldValues("LJDM2");
            //List<object> SO = grid.GetSelectedFieldValues("SO");
            //List<object> locationCode = grid.GetSelectedFieldValues("GWMC");
            //List<object> isTrue = grid.GetSelectedFieldValues("ISTRUE");


            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userName       = theUserManager.getUserName();
            string      companyCode    = theUserManager.getCompanyCode();

            for (int i = 0; i < rowid.Count; i++)
            {
                string planCode     = dc.GetValue("select jhdm from sjbomsoth where rowid='" + rowid[i].ToString() + "'");
                string SO           = dc.GetValue("select SO from sjbomsoth where rowid='" + rowid[i].ToString() + "'");;
                string oldPart      = dc.GetValue("select LJDM1 from sjbomsoth where rowid='" + rowid[i].ToString() + "'");;
                string newPart      = dc.GetValue("select LJDM2 from sjbomsoth where rowid='" + rowid[i].ToString() + "'");;
                string locationCode = dc.GetValue("select GWMC from sjbomsoth where rowid='" + rowid[i].ToString() + "'");

                string sql = "select IS_JHOFFLINE('" + planCode.ToString() + "','" + SO.ToString()
                             + "','" + plineCode.ToString() + "') from dual";
                if (dc.GetValue(sql) == "1")
                {
                    Response.Write("<script>alert('计划已经全部下线,不能删除');</script>");
                    continue;
                }
                sql = "select IS_JHONLINE('" + planCode.ToString() + "','" + SO.ToString()
                      + "','" + plineCode + "') from dual";

                //yxh 修改 增加未确认的直接删除逻辑
                {
                }
                //如果已经确认,删除将提交确认流程 xuying 2016.9.9
                //if (isTrue[i].ToString() == "1") {
                if (dc.GetValue(sql) == "1")
                {
                    Response.Write("<script>alert('计划已上线,进入审批流程');</script>");
                    BomReplaceFactory.MW_MODIFY_SJBOMTHCFM_DEL("ADD", planCode.ToString(), SO.ToString(), oldPart.ToString(),
                                                               newPart.ToString(), userName, locationCode.ToString(), plineCode);
                }
                else
                {
                    sql = "delete FROM SJBOMSOTH WHERE JHDM='" + planCode.ToString() + "' and ljdm1='" + oldPart.ToString()
                          + "' and ljdm2='" + newPart.ToString() + "' and so='" + SO.ToString() + "' AND GWMC='" + locationCode.ToString()
                          + "' AND GZDD='" + plineCode + "' and ygmc='" + userName + "'";
                    dc.ExeSql(sql);
                }
            }

            setCondition("");
        }
Example #5
0
        protected void ASPxGridView2_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userName       = theUserManager.getUserName();

            BomReplaceFactory.MW_CREATE_BOMCOMPRST("NOOP", txtSO1.Text, txtPlanCode1.Text, txtSO2.Text, txtPlanCode2.Text, userName);

            //显示改制bom
            initBom();
        }
Example #6
0
        protected void BtnConfirm_Click(object sender, EventArgs e)
        {
            //一对一替换确定
            string thisPart    = cmbPart1.Text.Trim().ToUpper();    // cmbPart.Value.ToString();
            string thisPartNew = cmbPartNew1.Text.Trim().ToUpper(); //cmbPartNew.Value.ToString();
            string check1      = CheckNoQAD.Value.ToString().ToUpper();
            //校验零件
            string sql = "select count(1) from copy_pt_mstr where pt_phantom=0 and pt_status in ('a','A','b','B','d','D','e','E','l','L','m','M','p','P','t','T') and pt_group in ('raw','RAW','M') and upper(pt_part)='" + thisPart + "'";

            if (dc.GetValue(sql) == "0")
            {
                Response.Write("<script>alert('BOM零件" + thisPart + "非法!');</script>");
                return;
            }
            if (check1 == "TRUE")
            {
                sql = "select count(1) from atpubkflpart t where gzdd='" + cmbPline.Value.ToString() + "' and part_type='1' and upper(part)='" + thisPartNew + "'";
                if (dc.GetValue(sql) == "0")
                {
                    Response.Write("<script>alert('替换零件" + thisPartNew + "非法!');</script>");
                    return;
                }
            }
            else
            {
                sql = "select count(1) from copy_pt_mstr where pt_phantom=0 and pt_status in ('a','A','b','B','d','D','e','E','l','L','m','M','p','P','t','T') and pt_group in ('raw','RAW','M') and upper(pt_part)='" + thisPartNew + "'";
                if (dc.GetValue(sql) == "0")
                {
                    Response.Write("<script>alert('替换零件" + thisPartNew + "非法!');</script>");
                    return;
                }
            }

            string thisPe = txtPe.Text.Trim();
            //站点
            string thisSite = cmbPline.Value.ToString();
            //登录人
            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userNmae       = theUserManager.getUserName();

            string thisFromDate = DateFrom.Date.ToString("yyyy-MM-dd");
            string thisToDate   = DateTo.Date.ToString("yyyy-MM-dd");
            string thisXL       = txtXl.Text.Trim();

            for (int i = 0; i < ListConfig.Items.Count; i++)
            {
                string thisSO = ListConfig.Items[i].Value.ToString().ToUpper();

                BomReplaceFactory.MW_MODIFY_SJBOMTHSET("ADD", thisPart, thisPartNew, thisSO, thisPe, thisSite, userNmae, thisFromDate, thisToDate, "", "0", thisXL);
            }

            Response.Write("<script>alert('新增成功!');window.opener.location.href = '../mmsReplaceRelationshipSet/mmsReplaceRelationshipSet.aspx';window.location.href = '../mmsReplaceRelationshipSet/mmsReplaceRelationshipSetNew.aspx';</script>");
        }
Example #7
0
        protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            string MachineName   = Request.UserHostAddress;
            string hostIPAddress = Page.Request.UserHostAddress;

            //IPHostEntry hostInfo = System.Net.Dns.GetHostByAddress(hostIPAddress);
            MachineName = hostIPAddress;
            string sql = "delete FROM rst_qad_movepartcal where machinename='" + MachineName + "'";

            dc.ExeSql(sql);


            sql = "SELECT DISTINCT plan_code,plan_so,plan_qty FROM data_plan WHERE to_date(to_char(begin_date,'YYYY-MM-DD'),'yyyy-mm-dd')>=to_date('" + datePlanDate.Text
                  + "','yyyy-mm-dd') and to_date(to_char(begin_date,'YYYY-MM-DD'),'yyyy-mm-dd')<=to_date('" + datePlanDateTo.Text + "','yyyy-mm-dd') and pline_code='" + cmbPline.Value.ToString() + "'  and plan_type='A'  ";
            DataTable dt = dc.GetTable(sql);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                BomReplaceFactory.QAD_CREATE_MOVEPARTCAL(cmbPline.Value.ToString(), dt.Rows[i]["plan_so"].ToString(),
                                                         dt.Rows[i]["plan_code"].ToString(), dt.Rows[i]["plan_qty"].ToString(), MachineName);
            }

            string condition = "";

            if (txtStoreman.Text != "")
            {
                condition += " and upper(abom_bgy)>=upper('" + txtStoreman.Text + "') and upper(abom_bgy)<=upper('" + txtStoreman2.Text + "') ";
            }
            if (txtGwdm.Text != "")
            {
                condition += " and upper(ABOM_WKCTR)=upper('" + txtGwdm.Text + "')";
            }
            if (txtLj.Text != "")
            {
                condition += " and upper(ABOM_COMP)=upper('" + txtLj.Text + "')";
            }

            sql = "SELECT ABOM_COMP  ,ABOM_WKCTR ,ABOM_KW ,SUM(ABOM_QTY) ABOM_QTY,abom_desc,abom_bgy from rst_qad_movepartcal where machinename='" + MachineName + "' ";
            if (CheckSn.Checked)
            {
                sql += condition + " and abom_comp in(select upper(ljdm) from atpubomthreset where to_char(rqsj,'yyyy-mm')='" + datePlanDate.Text.Substring(0, 7) + "')";
            }
            else
            {
                sql = sql + condition;
            }

            sql += " GROUP BY ABOM_COMP,ABOM_WKCTR,ABOM_KW,abom_desc,abom_bgy ORDER BY ABOM_COMP,ABOM_WKCTR";

            Session["mmsMaterialRequisitionQry001"] = sql;
            ASPxGridView1.DataSource = dc.GetTable(sql);
            ASPxGridView1.DataBind();
        }
Example #8
0
        protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            //判断是否有人在转换,如果是退出,提示随后再加
            string    sql = "select bomrunning,bomuser from atpusysstate1";
            DataTable dt  = dc.GetTable(sql);

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0][0].ToString() == "1")
                {
                    return;
                }
            }

            //加入转换用户
            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userName       = theUserManager.getUserName();

            sql = "update atpusysstate1 set bomuser='******',bomrunning=1";

            //删除原来记录
            sql = "DELETE FROM RST_QAD_MOVEPART";
            dc.ExeSql(sql);

            string MachineName = Request.UserHostAddress;

            //批量生成
            if (listPlan.Items.Count > 0)
            {
                for (int i = 0; i < listPlan.Items.Count; i++)
                {
                    string   str      = listPlan.Items[i].Text;
                    string[] strs     = str.Split(';');
                    string   planCode = strs[0].ToString();
                    string   so       = strs[1].ToString();
                    string   qty      = strs[2].ToString();

                    BomReplaceFactory.QAD_CREATE_MOVEPART_LQ2(cmbPline.Value.ToString(), so, planCode, qty);
                }
            }
            string qadsite = dc.GetValue("select FUNC_GET_PLANSITE( '" + cmbPline.Value.ToString() + "', 'D') from dual");

            sql = "SELECT ABOM_COMP  ,ABOM_WKCTR ,ABOM_KW ,SUM(ABOM_QTY) QTY1 from rst_qad_movepart WHERE gzdd='" + qadsite
                  + "' GROUP BY ABOM_COMP,ABOM_WKCTR,ABOM_KW ORDER BY ABOM_COMP,ABOM_WKCTR";
            //sql = "SELECT ABOM_COMP  ,ABOM_WKCTR ,ABOM_KW ,SUM(ABOM_QTY) QTY1 from rst_qad_movepart WHERE abom_user='******' GROUP BY ABOM_COMP,ABOM_WKCTR,ABOM_KW ORDER BY ABOM_COMP,ABOM_WKCTR";
            Session["mmsMaterialMoveLineside001"] = sql;
            ASPxGridView1.DataSource = dc.GetTable(sql);
            ASPxGridView1.DataBind();
        }
Example #9
0
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            //确认
            //ASPxGridView atl1 = (ASPxGridView)sender;
            List <object> rowid = grid.GetSelectedFieldValues("ROWID");
            //List<object> planCode = grid.GetSelectedFieldValues("JHDM");
            //List<object> oldPart = grid.GetSelectedFieldValues("LJDM1");
            //List<object> newPart = grid.GetSelectedFieldValues("LJDM2");
            //List<object> SO = grid.GetSelectedFieldValues("SO");
            //List<object> locationCode = grid.GetSelectedFieldValues("GWMC");

            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userName       = theUserManager.getUserName();
            string      companyCode    = theUserManager.getCompanyCode();

            for (int i = 0; i < rowid.Count; i++)
            {
                string planCode     = dc.GetValue("select jhdm from sjbomsoth where rowid='" + rowid[i].ToString() + "'");
                string SO           = dc.GetValue("select SO from sjbomsoth where rowid='" + rowid[i].ToString() + "'");;
                string oldPart      = dc.GetValue("select LJDM1 from sjbomsoth where rowid='" + rowid[i].ToString() + "'");;
                string newPart      = dc.GetValue("select LJDM2 from sjbomsoth where rowid='" + rowid[i].ToString() + "'");;
                string locationCode = dc.GetValue("select GWMC from sjbomsoth where rowid='" + rowid[i].ToString() + "'");

                //string sql = "select IS_JHONLINE('" + planCode.ToString() + "','" + SO.ToString()
                //    + "','" + plineCode + "') from dual";
                //string retVal = dc.GetValue(sql);
                string sql = "select IS_JHPASSGW('" + planCode.ToString() + "','" + SO.ToString() + "','" + locationCode + "') from dual";
                if (dc.GetValue(sql) == "0")//未经过该工位的可以进行替换确认
                {
                    sql = "update SJBOMSOTH set istrue=1,qrygmc='" + userName + "' WHERE to_date(to_char(LRSJ,'yyyy-mm-dd'),'yyyy-mm-dd')>=to_date('" + DateFrom.Text
                          + "','yyyy-mm-dd') AND to_date(to_char(LRSJ,'yyyy-mm-dd'),'yyyy-mm-dd')<=to_date('" + DateTo.Text
                          + "','yyyy-mm-dd') AND GZDD='" + plineCode + "' and istrue<>1 and ygmc='" + userName + "' and jhdm='" + planCode.ToString()
                          + "' and ljdm1='" + oldPart.ToString() + "' and gwmc='" + locationCode.ToString() + "'";

                    dc.ExeSql(sql);
                }
                else
                {
                    //修改 yxh

                    Response.Write("<script>alert('计划已上线且经过该工位,将提交给调度确认');</script>");
                    BomReplaceFactory.MW_MODIFY_SJBOMTHCFM("ADD", planCode, SO, oldPart, newPart,
                                                           userName, locationCode, plineCode);
                }
            }

            setCondition("");
        }
Example #10
0
        protected void gridOnePlace_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
        {
            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userName       = theUserManager.getUserName();


            string QRYH  = gridOnePlace.GetRowValues(e.VisibleIndex, "QRYH") as string;
            string flag  = gridOnePlace.GetRowValues(e.VisibleIndex, "FLAG") as string;
            string JHDM  = gridOnePlace.GetRowValues(e.VisibleIndex, "JHDM") as string;
            string SO    = gridOnePlace.GetRowValues(e.VisibleIndex, "SO") as string;
            string LJDM1 = gridOnePlace.GetRowValues(e.VisibleIndex, "LJDM1") as string;
            string LJDM2 = gridOnePlace.GetRowValues(e.VisibleIndex, "LJDM2") as string;
            string GWDM  = gridOnePlace.GetRowValues(e.VisibleIndex, "GWDM") as string;

            //删除
            if (e.ButtonID == "Delete")
            {
                string sql = "delete from  sjbomthcfm  where jhdm='" + JHDM + "' and so='" + SO + "' and ljdm1='" + LJDM1
                             + "' and upper(gwdm)='" + GWDM + "'";
                dc.ExeSql(sql);
            }

            //加入替换
            if (e.ButtonID == "Replace")
            {
                string sql     = "select is_zdgys('" + JHDM + "','" + SO + "','" + LJDM1 + "','" + cmbPline.Value.ToString() + "') from dual";
                string isZdgys = dc.GetValue(sql);

                if (isZdgys == "1")
                {
                    Response.Write("<script>alert('已经指定供应商,不能替换" + LJDM1 + "');</script>");
                    return;
                }
                BomReplaceFactory.PL_INSERT_SJBOMSOTH("ADD1", SO, LJDM1, LJDM2, "", "", "", userName, Request.UserHostAddress, JHDM, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), GWDM, "0", "", "0", cmbPline.Value.ToString());
            }

            //确认
            if (e.ButtonID == "Confirm")
            {
                string sql = "update sjbomthcfm set qrsj=sysdate,qryh='" + userName + "',flag='2' where jhdm='" + JHDM + "' and so='" + SO + "' and ljdm1='" + LJDM1 + "' and gwdm='" + GWDM + "'";
                dc.ExeSql(sql);
            }

            setCondition();
        }
Example #11
0
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            //全部确认
            //string planCode = gridPlan.SelectedItem.GetValue("PLAN_CODE").ToString();
            //string so = gridPlan.SelectedItem.GetValue("PLAN_SO").ToString();
            string planCode = Plan_code;
            string so       = Plan_so;

            string sql = "select IS_JHOFFLINE('" + planCode + "','" + so + "','" + plineCode + "') from dual";

            if (dc.GetValue(sql) == "1")
            {
                Response.Write("<script>alert('计划已下线!');</script>");
                return;
            }

            sql = "select nvl(item_flag,'N') from data_plan where plan_code='" + planCode + "' ";
            if (dc.GetValue(sql) == "Y")
            {
                Response.Write("<script>alert('计划已库房确认,不能替换!');</script>");
                return;
            }

            sql = "select distinct thgroup  from sjbomsothmuti where gzdd='" + plineCode + "' and jhdm='" + planCode
                  + "' and so='" + so + "'";
            DataTable dt = dc.GetTable(sql);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                //判断是否可以替换
                if (isCanConfirm(dt.Rows[i][0].ToString(), planCode, so) && isCanConfirm2(dt.Rows[i][0].ToString(), planCode, so))
                {
                    BomReplaceFactory.MW_INSERT_SJBOMSOTHMUTI("CFM", so, "", "", userName, Request.UserHostAddress, planCode, "", "", "", plineCode, dt.Rows[i][0].ToString(), "", "");
                    Response.Write("<script>alert('处理成功!');</script>");
                }
                else
                {
                    //提交调度确认
                    Response.Write("<script>alert('计划已上线,将提交给调度确认!');</script>");
                    BomReplaceFactory.MW_MODIFY_SJBOMTHMUTICFM("ADD", planCode, so, dt.Rows[i][0].ToString(), userName, plineCode);
                    Response.Write("<script>alert('已提交!');</script>");
                }
            }
        }
Example #12
0
        protected void CmdCopy_Click(object sender, EventArgs e)
        {
            List <object> theSetType = ASPxGridView1.GetSelectedFieldValues("SETTYPE");
            List <object> theOldPart = ASPxGridView1.GetSelectedFieldValues("OLDPART");
            List <object> theNewPart = ASPxGridView1.GetSelectedFieldValues("NEWPART");
            List <object> thePeFile  = ASPxGridView1.GetSelectedFieldValues("PEFILE");
            List <object> theUseTime = ASPxGridView1.GetSelectedFieldValues("USETIME");
            List <object> theEndTime = ASPxGridView1.GetSelectedFieldValues("ENDTIME");
            List <object> theXl      = ASPxGridView1.GetSelectedFieldValues("XL");
            List <object> theGroup   = ASPxGridView1.GetSelectedFieldValues("THGROUP");

            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userName       = theUserManager.getUserName();
            string      companyCode    = theUserManager.getCompanyCode();

            for (int i = 0; i < theSetType.Count; i++)
            {
                if (theSetType[i].ToString() == "1")
                {
                    for (int j = 0; j < ListToSo.Items.Count; j++)
                    {
                        BomReplaceFactory.MW_MODIFY_SJBOMTHSET("ADD3", theOldPart[i].ToString(), theNewPart[i].ToString()
                                                               , ListToSo.Items[i].Value.ToString(), thePeFile[i].ToString(), cmbPline.Value.ToString()
                                                               , userName, Convert.ToDateTime(theUseTime[i]).ToString("yyyy-MM-dd"),
                                                               Convert.ToDateTime(theEndTime[i]).ToString("yyyy-MM-dd"), theGroup[i].ToString(), "0", theXl[i].ToString());
                    }
                }
                if (theSetType[i].ToString() == "0")
                {
                    for (int j = 0; j < ListToSo.Items.Count; j++)
                    {
                        BomReplaceFactory.MW_MODIFY_SJBOMTHSET("ADD", theOldPart[i].ToString(), theNewPart[i].ToString()
                                                               , ListToSo.Items[i].Value.ToString(), thePeFile[i].ToString(), cmbPline.Value.ToString()
                                                               , userName, Convert.ToDateTime(theUseTime[i]).ToString("yyyy-MM-dd")
                                                               , Convert.ToDateTime(theEndTime[i]).ToString("yyyy-MM-dd"), "", "0", theXl[i].ToString());
                    }
                }
            }

            Response.Write("<script>alert('复制成功!');</script>");
        }
Example #13
0
        protected void grid_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            //删除
            string isTrue   = e.Values["ISTRUE"].ToString();
            string planCode = gridPlan.SelectedItem.GetValue("PLAN_CODE").ToString();
            string so       = gridPlan.SelectedItem.GetValue("PLAN_SO").ToString();
            string theGroup = gridPlan.SelectedItem.GetValue("THGROUP").ToString();
            //判断是否已经确认,删除确认过的替换关系增加调度确认功能 20100318
            string sql = "select IS_JHONLINE('" + planCode + "','" + so
                         + "','" + plineCode + "') from dual";

            //if (isTrue == "1")
            if (dc.GetValue(sql) == "1")//计划已上线
            {
                Response.Write("<script>alert('计划已上线,删除将提交调度.');</script>");
                BomReplaceFactory.MW_MODIFY_SJBOMTHMUTICFM_DEL("ADD", planCode, so, theGroup, userName, plineCode);
            }
            else
            {
                BomReplaceFactory.MW_INSERT_SJBOMSOTHMUTI("DELETE", so, "", "", userName, Request.UserHostAddress, planCode, "", "", "", plineCode, theGroup, "", "");
            }
        }
Example #14
0
        protected void ASPxCallback1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            //按组号确认
            string par = e.Parameter as string;

            string[] parstr   = par.Split(';');
            string   so       = parstr[0];
            string   planCode = parstr[1];
            string   theGroup = parstr[2];

            if (isCanConfirm(theGroup, planCode, so) && isCanConfirm2(theGroup, planCode, so))
            {
                BomReplaceFactory.MW_INSERT_SJBOMSOTHMUTI("CFM", so, "", "", userName, Request.UserHostAddress, planCode, "", "", "", plineCode, theGroup, "", "");
            }
            else
            {
                //如果已经上线,提交调度确认20061202
                Response.Write("<script>alert('计划已上线,将提交给调度确认!');</script>");
                BomReplaceFactory.MW_MODIFY_SJBOMTHMUTICFM("ADD", planCode, so, theGroup, userName, plineCode);
                Response.Write("<script>alert('已提交!');</script>");
            }
        }
Example #15
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userName       = theUserManager.getUserName();

            //已经上线的计划需要走流程确认
            if (PubLogic.isEngOnline(LabPlanCode.Text, LabSO.Text, LabOldPart.Text, LabNewPart.Text, LabLocation.Text, LabPlineCode.Text))
            {
                Response.Write("<script>alert('计划已上线,将提交给调度确认.');</script>");

                BomReplaceFactory.MW_MODIFY_SJBOMTHCFM("ADD", LabPlanCode.Text, LabSO.Text, LabOldPart.Text, LabNewPart.Text,
                                                       userName, LabLocation.Text, LabPlineCode.Text);
            }
            else
            {
                string sql = "select nvl(item_flag,'N') from data_plan where plan_code='" + LabPlanCode.Text + "' ";
                if (dc.GetValue(sql) == "Y")
                {
                    Response.Write("<script>alert('计划已库房确认,不能替换!');</script>");
                    return;
                }
                //判断是否指定供应商
                if (PubLogic.isZdgys(LabPlanCode.Text, LabSO.Text, LabOldPart.Text, LabPlineCode.Text))
                {
                    Response.Write("<script>alert('已经指定供应商,不能替换!');</script>");
                }
                else
                {
                    BomReplaceFactory.PL_INSERT_SJBOMSOTH("ADD", LabSO.Text, LabOldPart.Text, LabNewPart.Text, "", "", "",
                                                          userName, Request.UserHostAddress, LabPlanCode.Text, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), LabLocation.Text, LabNum.Text,
                                                          "", "0", LabPlineCode.Text);

                    Response.Write("<script>alert('替换成功');</script>");
                }
            }
        }
Example #16
0
        protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string thisPart     = e.Values["OLDPART"].ToString();
            string thisPartNew  = e.Values["NEWPART"].ToString();
            string thisSO       = e.Values["SO"].ToString();
            string thisPe       = e.Values["PEFILE"].ToString();
            string thisSite     = e.Values["SITE"].ToString();
            string userNmae     = e.Values["CREATEUSER"].ToString();
            string thisFromDate = Convert.ToDateTime(e.Values["USETIME"]).ToString("yyyy-MM-dd");
            string thisToDate   = Convert.ToDateTime(e.Values["ENDTIME"]).ToString("yyyy-MM-dd");
            string thisGroup    = e.Values["THGROUP"].ToString();

            if (Session["qryFlag"].ToString() == "single")
            {
                BomReplaceFactory.MW_MODIFY_SJBOMTHSET("DELETE", thisPart, thisPartNew, thisSO, thisPe, thisSite, userNmae, thisFromDate, thisToDate, "", "", "");
                setConditionSingle();
            }
            if (Session["qryFlag"].ToString() == "multi")
            {
                BomReplaceFactory.MW_MODIFY_SJBOMTHSET("DELETE2", thisPart, thisPartNew, thisSO, thisPe, thisSite, userNmae, thisFromDate, thisToDate, thisGroup, "", "");
                setConditionMulti();
            }
            e.Cancel = true;
        }
Example #17
0
        protected void ASPxCallback2_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            //按组删除
            string par = e.Parameter as string;

            string[] parstr   = par.Split(';');
            string   so       = parstr[0];
            string   planCode = parstr[1];
            string   theGroup = parstr[2];

            string sql = "select IS_JHONLINE('" + planCode.ToString() + "','" + so.ToString() + "','" + plineCode + "') from dual";

            //判断是否已经确认,删除确认过的替换关系增加调度确认功能 20100318
            //string sql = "select istrue from sjbomsothmuti where gzdd='" + plineCode + "' and jhdm='" + planCode + "' and so='" + so + "' and thgroup='" + theGroup + "'";
            if (dc.GetValue(sql) == "1")
            {
                Response.Write("<script>alert('组号" + theGroup + "的替换关系已经上线,删除将提交调度.');</script>");
                BomReplaceFactory.MW_MODIFY_SJBOMTHMUTICFM_DEL("ADD", planCode, so, theGroup, userName, plineCode);
            }
            else
            {
                BomReplaceFactory.MW_INSERT_SJBOMSOTHMUTI("DELETE", so, "", "", userName, Request.UserHostAddress, planCode, "", "", "", plineCode, theGroup, "", "");
            }
        }
Example #18
0
        protected void grid_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            //由计划显示替换关系
            string par = e.Parameters as string;

            string[] parstr = par.Split(';');

            string flag = parstr[2];

            if (flag == "init")
            {
                string so       = parstr[0];
                string planCode = parstr[1];

                Plan_code = planCode;
                Plan_so   = so;

                string sql = "select '" + planCode + "' plan_code,ljdm1 ,gwmc ,ljdm2 ,gwmc1 ,gxmc1 ,sl ,ygmc ,lrsj ,thgroup ,istrue  "
                             + "from sjbomsothmuti where gzdd='" + plineCode + "' and jhdm='" + planCode + "' and so='" + so + "'";
                (sender as ASPxGridView).DataSource = dc.GetTable(sql);
                (sender as ASPxGridView).DataBind();

                (sender as ASPxGridView).Columns[0].FixedStyle = DevExpress.Web.ASPxGridView.GridViewColumnFixedStyle.Left;
            }

            //全部确认
            if (flag == "all")
            {
                //全部确认
                try
                {
                    DateTime beginDate = DatePlan.Date;// DateTime.Parse(parstr[0].ToString());
                    int      str1 = 0, str2 = 0, str3 = 0;
                    showAlert(this, "开始处理!");
                    string    sql12 = "select PLAN_CODE ,PLAN_SO ,PLAN_QTY ,CUSTOMER_NAME ,ONLINE_QTY  FROM DATA_PLAN WHERE BEGIN_DATE=to_date('" + beginDate.ToString("yyyy-MM-dd") + "','yyyy-mm-dd') AND PLINE_CODE='" + Request["plineCode"].ToString() + "' ORDER BY BEGIN_DATE,PLAN_CODE";
                    DataTable dt12  = dc.GetTable(sql12);
                    for (int j = 0; j < dt12.Rows.Count; j++)
                    {
                        string planCode = dt12.Rows[j][0].ToString();
                        string so       = dt12.Rows[j][1].ToString();
                        string sql      = "select IS_JHOFFLINE('" + planCode + "','" + so + "','" + plineCode + "') from dual";
                        if (dc.GetValue(sql) == "1")
                        {
                            //Response.Write("<script>alert('计划已下线!');</script>");
                            str1 = 1;
                            continue;
                        }

                        sql = "select nvl(item_flag,'N') from data_plan where plan_code='" + planCode + "' ";
                        if (dc.GetValue(sql) == "Y")
                        {
                            str1 = 1;
                            //Response.Write("<script>alert('计划已库房确认,不能替换!');</script>");
                            continue;
                        }

                        sql = "select distinct thgroup  from sjbomsothmuti where gzdd='" + plineCode + "' and jhdm='" + planCode
                              + "' and so='" + so + "'";
                        DataTable dt = dc.GetTable(sql);
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            //判断是否可以替换
                            if (isCanConfirm(dt.Rows[i][0].ToString(), planCode, so) && isCanConfirm2(dt.Rows[i][0].ToString(), planCode, so))
                            {
                                BomReplaceFactory.MW_INSERT_SJBOMSOTHMUTI("CFM", so, "", "", userName, Request.UserHostAddress, planCode, "", "", "", plineCode, dt.Rows[i][0].ToString(), "", "");
                                //Response.Write("<script>alert('处理成功!');</script>");
                            }
                            else
                            {
                                //提交调度确认
                                //Response.Write("<script>alert('计划已上线,将提交给调度确认!');</script>");
                                BomReplaceFactory.MW_MODIFY_SJBOMTHMUTICFM("ADD", planCode, so, dt.Rows[i][0].ToString(), userName, plineCode);
                                //Response.Write("<script>alert('已提交!');</script>");
                                str2 = 1;
                            }
                        }
                    }
                    if (str2 == 1)
                    {
                        grid.JSProperties.Add("cpAlertContent", "计划已上线,将提交给调度确认!");
                        //Response.Write("<script>alert('计划已上线,将提交给调度确认!');</script>");
                    }
                    if (str1 == 1)
                    {
                        grid.JSProperties.Add("cpAlertContent", "存在未处理计划!");
                        //Response.Write("<script>alert('存在未处理计划!');</script>");
                    }
                    else
                    {
                        grid.JSProperties.Add("cpAlertContent", "处理成功!");
                        //Response.Write("<script>alert('处理成功!');</script>");
                    }
                }
                catch (Exception e1)
                {
                    grid.JSProperties.Add("cpAlertContent", "处理失败" + e1.Message.ToString() + "!");
                }
            }
        }
Example #19
0
        protected void gridMaterial_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
        {
            string oldPart      = gridMaterial.GetRowValues(e.VisibleIndex, "ITEM_CODE").ToString();
            string newPart      = gridMaterial.GetRowValues(e.VisibleIndex, "NEWPART").ToString();
            string locationCode = gridMaterial.GetRowValues(e.VisibleIndex, "LOCATION_CODE").ToString();
            string itemQty      = gridMaterial.GetRowValues(e.VisibleIndex, "ITEM_QTY").ToString();

            string planCode  = Session["planCode"].ToString();
            string so        = Session["so"].ToString();
            string plineCode = cmbPline.Value.ToString();

            gridMaterial.JSProperties.Add("cpCallbackName", e.ButtonID.ToString());

            //一对一替换
            if (e.ButtonID == "OneReplace")
            {
                userManager theUserManager = (userManager)Session["theUserManager"];
                string      userName       = theUserManager.getUserName();

                ////已经上线的计划需要走流程确认
                //if (PubLogic.isEngOnline(planCode, so, oldPart, newPart, locationCode, plineCode))
                //{

                //    gridMaterial.JSProperties.Add("cpAlertContent", "计划已上线,将提交给调度确认.");

                //    BomReplaceFactory.MW_MODIFY_SJBOMTHCFM("ADD", planCode, so, oldPart, newPart,
                //        userName, locationCode, plineCode);
                //}
                //else
                {
                    //string sql = "select nvl(item_flag,'N') from data_plan where plan_code='" + planCode + "' ";
                    //if (dc.GetValue(sql) == "Y")
                    //{
                    //    gridMaterial.JSProperties.Add("cpAlertContent", "计划已库房确认,不能替换!");
                    //    return;
                    //}
                    string sql = "select nvl(third_flag,'N') from data_plan where plan_code='" + planCode + "' ";
                    if (dc.GetValue(sql) == "P")
                    {
                        gridMaterial.JSProperties.Add("cpAlertContent", "计划正参与三方计算,不能替换!");
                        return;
                    }
                    //判断是否指定供应商
                    if (PubLogic.isZdgys(planCode, so, oldPart, cmbPline.Value.ToString()))
                    {
                        gridMaterial.JSProperties.Add("cpAlertContent", "已经指定供应商,不能替换!");
                        return;
                    }
                    BomReplaceFactory.PL_INSERT_SJBOMSOTH("ADD", so, oldPart, newPart, "", "", "",
                                                          userName, Request.UserHostAddress, planCode, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), locationCode, itemQty,
                                                          "", "0", plineCode);

                    //gridMaterial.JSProperties.Add("cpAlertContent", "替换成功");
                }

                gridMaterial.DataSource = dc.GetTable(Session["gridMaterial"].ToString());
                gridMaterial.DataBind();
            }
            //多对多替换
            if (e.ButtonID == "MultiReplace")
            {
                gridMaterial.JSProperties.Add("cpplineCode", plineCode);
                gridMaterial.JSProperties.Add("cpplanCode", planCode);
                gridMaterial.JSProperties.Add("cpso", so);
                gridMaterial.JSProperties.Add("cpitemCode", oldPart);
                gridMaterial.JSProperties.Add("cpnewPart", newPart);
                gridMaterial.JSProperties.Add("cplocationCode", locationCode);
                gridMaterial.JSProperties.Add("cpitemQty", itemQty);
            }
        }
Example #20
0
        protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            //判断是否有人在转换,如果是退出,提示随后再加
            string    sql = "select bomrunning,bomuser from atpusysstate1";
            DataTable dt  = dc.GetTable(sql);

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0][0].ToString() == "1")
                {
                    return;
                }
            }

            //加入转换用户
            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userName       = theUserManager.getUserName();

            sql = "update atpusysstate1 set bomuser='******',bomrunning=1";
            dc.ExeSql(sql);

            //删除原来记录
            sql = "DELETE FROM RST_QAD_MOVEPART";
            dc.ExeSql(sql);

            string MachineName = Request.UserHostAddress;

            //批量生成
            if (listPlan.Items.Count > 0)
            {
                for (int i = 0; i < listPlan.Items.Count; i++)
                {
                    string   str      = listPlan.Items[i].Text;
                    string[] strs     = str.Split(';');
                    string   planCode = strs[0].ToString();
                    string   so       = strs[1].ToString();
                    string   qty      = strs[2].ToString();

                    BomReplaceFactory.QAD_CREATE_MOVEPART(cmbPline.Value.ToString(), so, planCode, qty);
                }
            }


            //----------------2016.10.25 ADD 生成txt文件-------------------
            string qadsite = dc.GetValue("select FUNC_GET_PLANSITE( '" + cmbPline.Value.ToString() + "', 'D') from dual");

            sql = "SELECT ABOM_COMP  ,ABOM_WKCTR ,ABOM_KW ,SUM(ABOM_QTY) QTY1 from rst_qad_movepart WHERE gzdd='" + qadsite
                  + "' GROUP BY ABOM_COMP,ABOM_WKCTR,ABOM_KW ORDER BY ABOM_COMP,ABOM_WKCTR";
            Session["mmsMaterialMove001"] = sql;
            ASPxGridView1.DataSource      = dc.GetTable(sql);
            ASPxGridView1.DataBind();

            //生成txt文件
            if (!Directory.Exists("C:\\TRANLIST"))
            {
                Directory.CreateDirectory("C:\\TRANLIST");
            }

            //文件名
            string ThisWjmc = "";

            if (cmbPline.Value.ToString() == "E")
            {
                ThisWjmc = "TL" + datePlanDate.Date.ToString("yyMMdd") + "B-" + System.DateTime.Now.ToString("HHmmss");
            }
            //TL20031219DCEC-B.TXT
            else if (cmbPline.Value.ToString() == "W")
            {
                ThisWjmc = "TL" + datePlanDate.Date.ToString("yyMMdd") + "C-" + System.DateTime.Now.ToString("HHmmss");
            }
            else if (cmbPline.Value.ToString() == "ISZ")
            {
                ThisWjmc = "TL" + datePlanDate.Date.ToString("yyMMdd") + "Z-" + System.DateTime.Now.ToString("HHmmss");
            }
            else if (cmbPline.Value.ToString() == "R")
            {
                ThisWjmc = "TL" + datePlanDate.Date.ToString("yyMMdd") + "R-" + System.DateTime.Now.ToString("HHmmss");
            }


            string theWriteFile = "";

            sql = "SELECT DISTINCT GZDD FROM RST_QAD_MOVEPART ORDER BY GZDD";
            dt  = dc.GetTable(sql);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string theQadSite = dt.Rows[i][0].ToString();
                if (qadsite == "R")
                {
                    theWriteFile = "R" + theQadSite.Substring(theQadSite.Length - 1, 1) + ThisWjmc;
                }
                else
                {
                    theWriteFile = ThisWjmc;
                }

                FileStream   fs1 = new FileStream("C:\\TRANLIST\\" + theWriteFile + ".txt", FileMode.Create, FileAccess.Write); //创建写入文件
                StreamWriter sw  = new StreamWriter(fs1);
                sw.WriteLine("移仓单号,地点,生效日期,子零件,缺省库位,车间库位,数量,");                                                                 //开始写入值

                sql = "SELECT ABOM_COMP 零件 ,ABOM_WKCTR 工位,ABOM_KW 库位,SUM(ABOM_QTY) 数量 from rst_qad_movepart WHERE GZDD='" + theQadSite
                      + "' GROUP BY ABOM_COMP,ABOM_WKCTR,ABOM_KW ORDER BY ABOM_COMP,ABOM_WKCTR";
                DataTable dt2 = dc.GetTable(sql);
                for (int j = 0; j < dt2.Rows.Count; j++)
                {
                    string Line1 = "";
                    Line1 = Line1 + theWriteFile + ",";
                    Line1 = Line1 + theQadSite + ",";
                    Line1 = Line1 + Convert.ToDateTime(txtAccountDate.Text).ToString("yyyy/mm/dd") + ",";

                    Line1 = Line1 + dt2.Rows[j][0].ToString() + ",";
                    Line1 = Line1 + dt2.Rows[j][2].ToString() + ",";

                    Line1 = Line1 + dt2.Rows[j][1].ToString() + ",";
                    Line1 = Line1 + dt2.Rows[j][3].ToString() + ",";

                    sw.WriteLine(Line1);
                    //sw.NewLine = Line1;
                }

                sw.Close();
                fs1.Close();
            }

            sql = "update atpusysstate1 set bomrunning=0";
            dc.ExeSql(sql);

            ASPxGridView1.JSProperties.Add("cpCallbackValue", theWriteFile + ".txt");
        }
Example #21
0
        protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            string MachineName   = Request.UserHostAddress;
            string hostIPAddress = Page.Request.UserHostAddress;

            //IPHostEntry hostInfo = System.Net.Dns.GetHostByAddress(hostIPAddress);
            MachineName = hostIPAddress;

            string sql = "delete FROM rst_qad_prtpart where dyyh='" + MachineName + "'";

            dc.ExeSql(sql);

            //按日期生成
            if (cmbPlan.Text == "" && listPlan.Items.Count == 0)
            {
                sql = "SELECT DISTINCT plan_code,plan_so,plan_qty FROM data_plan WHERE TO_CHAR(begin_date,'YYYYMMDD')='" + datePlanDate.Text
                      + "'and run_flag='Y' and pline_code='" + cmbPline.Value.ToString() + "'";
                DataTable dt = dc.GetTable(sql);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    BomReplaceFactory.QAD_CREATE_PRTPART("CAL", cmbPline.Value.ToString(), dt.Rows[i]["plan_so"].ToString(),
                                                         dt.Rows[i]["plan_code"].ToString(), dt.Rows[i]["plan_qty"].ToString(), MachineName);
                }
            }
            //按计划生成
            if (cmbPlan.Text != "" && listPlan.Items.Count == 0)
            {
                string planNum = "1";
                if (txtQTY.Text != "")
                {
                    planNum = txtQTY.Text;
                }

                BomReplaceFactory.QAD_CREATE_PRTPART("ONE", cmbPline.Value.ToString(), txtSo.Text, cmbPlan.Value.ToString()
                                                     , planNum, MachineName);
            }


            //批量生成
            if (listPlan.Items.Count > 0)
            {
                for (int i = 0; i < listPlan.Items.Count; i++)
                {
                    string   str      = listPlan.Items[i].Text;
                    string[] strs     = str.Split(';');
                    string   planCode = strs[0].ToString();
                    string   so       = strs[1].ToString();
                    string   qty      = strs[2].ToString();

                    BomReplaceFactory.QAD_CREATE_PRTPART("CAL", cmbPline.Value.ToString(), so,
                                                         planCode, qty, MachineName);
                }
            }

            sql = "select ljbgy,ljdm,ljmc,ljgw,flgw ,ljdd ,SUM(ljsl) ljsl1,thljdm ,OLDLJDM  ,get_zdbygw('" + cmbPline.Value.ToString()
                  + "',flgw) flgw1 ,bz ,ljgys  from rst_qad_prtpart t  where 1=1 ";
            string sqlDetail = "select t.jhdm,t.so,t.ljbgy,t.ljdm,t.ljmc,t.ljgw,t.flgw ,t.ljdd ,t.ljsl,t.thljdm ,OLDLJDM  ,get_zdbygw('" + cmbPline.Value.ToString()
                               + "',t.flgw) flgw1 ,bz ,ljgys,aa.zsl  from rst_qad_prtpart t LEFT JOIN (SELECT a.ljbgy,a.ljdm,a.ljmc,a.ljgw,a.flgw,a.ljdd, SUM(a.ljsl) AS zsl FROM rst_qad_prtpart a WHERE GZDD = '" + cmbPline.Value.ToString() + "'"
                               + " AND DYYH = '" + MachineName + "' GROUP BY a.ljbgy,a.ljdm,a.ljmc,a.ljgw,a.flgw,a.ljdd) aa ON t.ljbgy=aa.ljbgy AND t.ljdm=aa.ljdm AND t.ljmc=aa.ljmc "
                               + " AND t.ljgw=aa.ljgw AND t.flgw=aa.flgw AND t.ljdd=aa.ljdd where 1=1 ";

            string condition = "";

            if (txtStoreman.Text != "")
            {
                condition += " and upper(t.ljbgy)>=upper('" + txtStoreman.Text + "') and upper(t.ljbgy)<=upper('" + txtStoreman2.Text + "') ";
            }
            if (txtGwdm.Text != "")
            {
                condition += " and upper(t.ljgw)=upper('" + txtGwdm.Text + "')";
            }
            if (txtLj.Text != "")
            {
                condition += " and upper(t.ljdm)=upper('" + txtLj.Text + "')";
            }
            if (cmbPlan.Text != "" && listPlan.Items.Count == 0 && CheckSn.Checked)
            {
                condition += " and so='" + txtSo.Text + "' and jhdm='" + cmbPlan.Value.ToString() + "'";
            }
            sql       = sql + condition + " and gzdd='" + cmbPline.Value.ToString() + "' and dyyh='" + MachineName + "' GROUP BY ljbgy,ljdm ,ljmc ,ljgw ,flgw,ljdd ,ljgys ,thljdm ,oldljdm,bz  order by ljbgy,ljgw,flgw,ljdm";
            sqlDetail = sqlDetail + condition + " and gzdd='" + cmbPline.Value.ToString() + "' and dyyh='" + MachineName + "' ";

            Session["RequisitionDetail"]         = sqlDetail;
            Session["mmsMaterialRequisition001"] = sql;
            ASPxGridView1.DataSource             = dc.GetTable(sql);
            ASPxGridView1.DataBind();
        }
Example #22
0
        protected void ASPxCallback3_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            //全部确认
            try
            {
                string   par    = e.Parameter as string;
                string[] parstr = par.Split(';');
                //string planCode = parstr[1];
                //string so = parstr[0];
                DateTime beginDate = DateTime.Parse(parstr[0].ToString());
                int      str1 = 0, str2 = 0, str3 = 0;
                showAlert(this, "开始处理!");
                string    sql12 = "select PLAN_CODE ,PLAN_SO ,PLAN_QTY ,CUSTOMER_NAME ,ONLINE_QTY  FROM DATA_PLAN WHERE BEGIN_DATE=to_date('" + beginDate.ToString("yyyy-MM-dd") + "','yyyy-mm-dd') AND PLINE_CODE='" + Request["plineCode"].ToString() + "' ORDER BY BEGIN_DATE,PLAN_CODE";
                DataTable dt12  = dc.GetTable(sql12);
                for (int j = 0; j < dt12.Rows.Count; j++)
                {
                    string planCode = dt12.Rows[j][0].ToString();
                    string so       = dt12.Rows[j][1].ToString();
                    string sql      = "select IS_JHOFFLINE('" + planCode + "','" + so + "','" + plineCode + "') from dual";
                    if (dc.GetValue(sql) == "1")
                    {
                        //Response.Write("<script>alert('计划已下线!');</script>");
                        str1 = 1;
                        continue;
                    }

                    sql = "select nvl(item_flag,'N') from data_plan where plan_code='" + planCode + "' ";
                    if (dc.GetValue(sql) == "Y")
                    {
                        str1 = 1;
                        //Response.Write("<script>alert('计划已库房确认,不能替换!');</script>");
                        continue;
                    }

                    sql = "select distinct thgroup  from sjbomsothmuti where gzdd='" + plineCode + "' and jhdm='" + planCode
                          + "' and so='" + so + "'";
                    DataTable dt = dc.GetTable(sql);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        //判断是否可以替换
                        if (isCanConfirm(dt.Rows[i][0].ToString(), planCode, so) && isCanConfirm2(dt.Rows[i][0].ToString(), planCode, so))
                        {
                            BomReplaceFactory.MW_INSERT_SJBOMSOTHMUTI("CFM", so, "", "", userName, Request.UserHostAddress, planCode, "", "", "", plineCode, dt.Rows[i][0].ToString(), "", "");
                            //Response.Write("<script>alert('处理成功!');</script>");
                        }
                        else
                        {
                            //提交调度确认
                            //Response.Write("<script>alert('计划已上线,将提交给调度确认!');</script>");
                            BomReplaceFactory.MW_MODIFY_SJBOMTHMUTICFM("ADD", planCode, so, dt.Rows[i][0].ToString(), userName, plineCode);
                            //Response.Write("<script>alert('已提交!');</script>");
                            str2 = 1;
                        }
                    }
                }
                if (str2 == 1)
                {
                    showAlert(this, "计划已上线,将提交给调度确认!");
                    //Response.Write("<script>alert('计划已上线,将提交给调度确认!');</script>");
                }
                if (str1 == 1)
                {
                    showAlert(this, "存在未处理计划!");
                    //Response.Write("<script>alert('存在未处理计划!');</script>");
                }
                else
                {
                    showAlert(this, "处理成功!");
                    //Response.Write("<script>alert('处理成功!');</script>");
                }
            }
            catch (Exception e1)
            {
                Response.Write("<script>alert('处理失败" + e1.Message.ToString() + "!');</script>");
            }
        }
Example #23
0
        //protected void cmbPartNew_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        //{
        //    bool checkNoQAD = Convert.ToBoolean(e.Parameter);
        //    if (checkNoQAD)
        //    {
        //        string sql = "select part pt_part,'非QAD件' pt_desc from atpubkflpart t where gzdd='" + cmbPline.Value.ToString() + "' and part_type='1'";
        //        dc.setTheSql(sql);
        //        (sender as ASPxComboBox).DataSource = dc.GetTable();
        //        (sender as ASPxComboBox).ValueField = "pt_part";
        //        (sender as ASPxComboBox).TextField = "pt_desc";
        //        (sender as ASPxComboBox).DataBind();
        //    }
        //    else
        //    {
        //        string sql = "select pt_part, pt_DESC2 pt_desc from copy_pt_mstr where pt_phantom=0 and pt_status in ('a','A','b','B','d','D','e','E','l','L','m','M','p','P','t','T') and pt_group in ('raw','RAW','M') order by pt_part";
        //        dc.setTheSql(sql);
        //        (sender as ASPxComboBox).DataSource = dc.GetTable();
        //        (sender as ASPxComboBox).ValueField = "pt_part";
        //        (sender as ASPxComboBox).TextField = "pt_desc";
        //        (sender as ASPxComboBox).DataBind();
        //    }
        //}
        //protected void cmbPartNew2_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        //{
        //    bool checkNoQAD2 = Convert.ToBoolean(e.Parameter);
        //    if (checkNoQAD2)
        //    {
        //        string sql = "select part pt_part,'非QAD件' pt_desc from atpubkflpart t where gzdd='" + cmbPline.Value.ToString() + "' and part_type='1'";
        //        dc.setTheSql(sql);
        //        (sender as ASPxComboBox).DataSource = dc.GetTable();
        //        (sender as ASPxComboBox).ValueField = "pt_part";
        //        (sender as ASPxComboBox).TextField = "pt_desc";
        //        (sender as ASPxComboBox).DataBind();
        //    }
        //    else
        //    {
        //        string sql = "select pt_part, pt_DESC2 pt_desc from copy_pt_mstr where pt_phantom=0 and pt_status in ('a','A','b','B','d','D','e','E','l','L','m','M','p','P','t','T') and pt_group in ('raw','RAW','M') order by pt_part";
        //        dc.setTheSql(sql);
        //        (sender as ASPxComboBox).DataSource = dc.GetTable();
        //        (sender as ASPxComboBox).ValueField = "pt_part";
        //        (sender as ASPxComboBox).TextField = "pt_desc";
        //        (sender as ASPxComboBox).DataBind();
        //    }
        //}
        protected void BtnConfirm2_Click(object sender, EventArgs e)
        {
            //多对多替换
            string thisPe = txtPe2.Text.Trim();
            //站点
            string thisSite = cmbPline.Value.ToString();
            //登录人
            userManager theUserManager = (userManager)Session["theUserManager"];
            string      userNmae       = theUserManager.getUserName();

            int maxCount = Math.Max(lstPtFrom.Items.Count, lstPtTo.Items.Count);
            int minCount = Math.Min(lstPtFrom.Items.Count, lstPtTo.Items.Count);

            string thisPart, thisPartNew;
            string thisFromDate = DateFrom2.Date.ToString("yyyy-MM-dd");
            string thisToDate   = DateTo2.Date.ToString("yyyy-MM-dd");
            string thisXL       = txtXl.Text.Trim();
            string thisSL;

            //检查零件
            for (int i = 0; i < ListConfig.Items.Count; i++)
            {
                string thisSO = ListConfig.Items[i].Value.ToString();

                //多对多替换如果是3个零件换成5个零件,则插入5条记录,前3条一个对一个,后两条原零件为空
                for (int fromCount = 0; fromCount < maxCount; fromCount++)
                {
                    if (lstPtFrom.Items.Count == maxCount)
                    {
                        thisPart = lstPtFrom.Items[fromCount].Value.ToString();
                    }
                    else if (fromCount < minCount)
                    {
                        thisPart = lstPtFrom.Items[fromCount].Value.ToString();
                    }
                    else
                    {
                        thisPart = "";
                    }

                    if (lstPtTo.Items.Count == maxCount)
                    {
                        string temp = lstPtTo.Items[fromCount].Value.ToString();
                        thisPartNew = temp.Split(';')[0].ToString();
                        thisSL      = temp.Split(';')[1].ToString();
                    }
                    else if (fromCount < minCount)
                    {
                        string temp = lstPtTo.Items[fromCount].Value.ToString();
                        thisPartNew = temp.Split(';')[0].ToString();
                        thisSL      = temp.Split(';')[1].ToString();
                    }
                    else
                    {
                        thisPartNew = "";
                        thisSL      = "0";
                    }

                    string check1 = CheckNoQAD2.Value.ToString().ToUpper();
                    //校验零件
                    string sql = "";
                    if (thisPart.Trim() != "")
                    {
                        sql = "select count(1) from copy_pt_mstr where pt_phantom=0 and pt_status in ('a','A','b','B','d','D','e','E','l','L','m','M','p','P','t','T') and pt_group in ('raw','RAW','M') and upper(pt_part)='" + thisPart + "'";
                        if (dc.GetValue(sql) == "0")
                        {
                            Response.Write("<script>alert('BOM零件" + thisPart + "非法!');</script>");
                            return;
                        }
                    }
                    if (thisPartNew.Trim() != "")
                    {
                        if (check1 == "TRUE")
                        {
                            sql = "select count(1) from atpubkflpart t where gzdd='" + cmbPline.Value.ToString() + "' and part_type='1' and upper(part)='" + thisPartNew + "'";
                            if (dc.GetValue(sql) == "0")
                            {
                                Response.Write("<script>alert('替换零件" + thisPartNew + "非法!');</script>");
                                return;
                            }
                        }
                        else
                        {
                            sql = "select count(1) from copy_pt_mstr where pt_phantom=0 and pt_status in ('a','A','b','B','d','D','e','E','l','L','m','M','p','P','t','T') and pt_group in ('raw','RAW','M') and upper(pt_part)='" + thisPartNew + "'";
                            if (dc.GetValue(sql) == "0")
                            {
                                Response.Write("<script>alert('替换零件" + thisPartNew + "非法!');</script>");
                                return;
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < ListConfig.Items.Count; i++)
            {
                //对每个SO执行一个删除
                string thisSO = ListConfig.Items[i].Value.ToString();
                BomReplaceFactory.MW_MODIFY_SJBOMTHSET("DELETE2", "", "", thisSO, thisPe, thisSite, userNmae, thisFromDate, thisToDate, "", "", "");


                //得到组号
                //BomReplaceFactory.FUNC_GET_NEWSID("MT",out id);
                dataConn theDataConn = new dataConn();
                theDataConn.theComd.CommandType = CommandType.StoredProcedure;
                theDataConn.theComd.CommandText = "FUNC_GET_NEWSID";

                theDataConn.theComd.Parameters.Add("in_type", OracleDbType.Varchar2).Value    = "MT";
                theDataConn.theComd.Parameters.Add("id", OracleDbType.Varchar2, 50).Direction = ParameterDirection.Output;

                theDataConn.OpenConn();
                theDataConn.theComd.ExecuteNonQuery();
                string id = theDataConn.theComd.Parameters["id"].Value.ToString();
                theDataConn.CloseConn();

                //多对多替换如果是3个零件换成5个零件,则插入5条记录,前3条一个对一个,后两条原零件为空
                for (int fromCount = 0; fromCount < maxCount; fromCount++)
                {
                    if (lstPtFrom.Items.Count == maxCount)
                    {
                        thisPart = lstPtFrom.Items[fromCount].Value.ToString();
                    }
                    else if (fromCount < minCount)
                    {
                        thisPart = lstPtFrom.Items[fromCount].Value.ToString();
                    }
                    else
                    {
                        thisPart = "";
                    }


                    if (lstPtTo.Items.Count == maxCount)
                    {
                        string temp = lstPtTo.Items[fromCount].Value.ToString();
                        thisPartNew = temp.Split(';')[0].ToString();
                        thisSL      = temp.Split(';')[1].ToString();
                    }
                    else if (fromCount < minCount)
                    {
                        string temp = lstPtTo.Items[fromCount].Value.ToString();
                        thisPartNew = temp.Split(';')[0].ToString();
                        thisSL      = temp.Split(';')[1].ToString();
                    }
                    else
                    {
                        thisPartNew = "";
                        thisSL      = "0";
                    }

                    //根据so循环插入记录
                    BomReplaceFactory.MW_MODIFY_SJBOMTHSET("ADD2", thisPart, thisPartNew, thisSO, thisPe, thisSite, userNmae, thisFromDate, thisToDate, id, thisSL, thisXL);
                }
            }

            Response.Write("<script>alert('新增成功!');window.opener.location.href = '../mmsReplaceRelationshipSet/mmsReplaceRelationshipSet.aspx';window.location.href = '../mmsReplaceRelationshipSet/mmsReplaceRelationshipSetNew.aspx';</script>");
        }
Example #24
0
        protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            string MachineName   = Request.UserHostAddress;
            string hostIPAddress = Page.Request.UserHostAddress;

            //IPHostEntry hostInfo = System.Net.Dns.GetHostByAddress(hostIPAddress);
            MachineName = hostIPAddress;

            //删除原来记录
            string sql = "DELETE FROM RST_QAD_BOMPART_LQ_TEMP where ABOM_USER='******'";

            dc.ExeSql(sql);
            //逐行显示 YXH2016/12/17 21:15
            #region  逐行显示

            DataTable dt1 = new DataTable();
            dt1.Columns.Add("ABOM_JHDM");
            dt1.Columns.Add("ABOM_COMP");
            dt1.Columns.Add("ABOM_DESC");
            dt1.Columns.Add("ABOM_WKCTR");
            dt1.Columns.Add("ABOM_QTY");
            dt1.Columns.Add("SJ_FLAG");
            //批量生成
            if (listPlan.Items.Count > 0)
            {
                for (int i = 0; i < listPlan.Items.Count; i++)
                {
                    string str = listPlan.Items[i].Text;
                    BomReplaceFactory.QAD_CREATE_PRTPART_LQ(str, MachineName);
                    string    sqlSo = "select t.plan_code,a.plan_so ABOM_COMP from ms_sfjit_plan_log t  left join data_plan a on a.plan_code=t.plan_code where t.SF_JIT_ID='" + str + "' and t.PLAN_CODE IN (SELECT plan_code FROM data_plan WHERE LQ_FLAG='Y') ";
                    DataTable dt    = dc.GetTable(sqlSo);
                    if (dt.Rows.Count < 1)
                    {
                        return;
                    }
                    for (int s = 0; s < dt.Rows.Count; s++)
                    {
                        dt1.Rows.Add(dt.Rows[s][0], dt.Rows[s][1], "", "", "", "");

                        string    sqlSn   = "select sn  from data_product where plan_code='" + dt.Rows[s][0].ToString() + "'";
                        DataTable dt2     = dc.GetTable(sqlSn);
                        int       integer = dt2.Rows.Count / 6;

                        for (int n = 0; n <= integer; n++)
                        {
                            DataRow dr2 = dt1.NewRow();
                            for (int m = 0; m < 6; m++)
                            {
                                dr2[m] = dt2.Rows[m + n * 6][0];
                                if (m > dt2.Rows.Count - 2 - 6 * n)
                                {
                                    break;
                                }
                            }
                            dt1.Rows.Add(dr2);
                        }
                    }
                    string sqlDh = "select ABOM_JHDM ,ABOM_COMP ,ABOM_DESC ,ABOM_WKCTR ,sum(ABOM_QTY) ABOM_QTY ,SJ_FLAG  from RST_QAD_BOMPART_LQ where ABOM_USER='******' "
                                   + " group by ABOM_JHDM ,ABOM_COMP ,ABOM_DESC ,ABOM_WKCTR,SJ_FLAG order by SJ_FLAG DESC,ABOM_JHDM,ABOM_WKCTR";
                    DataTable dt3 = dc.GetTable(sqlDh);
                    if (dt3.Rows.Count < 1)
                    {
                        return;
                    }
                    dt1.Rows.Add("MES单号", "零件代码", "零件名称", "工位", "数量", "是否随机件");
                    for (int x = 0; x < dt3.Rows.Count; x++)
                    {
                        dt1.Rows.Add(dt3.Rows[x][0], dt3.Rows[x][1], dt3.Rows[x][2], dt3.Rows[x][3], dt3.Rows[x][4], dt3.Rows[x][5]);
                    }
                }
            }

            #endregion
            Session["MaterialSend_YXH"] = dt1;
            ASPxGridView1.DataSource    = dt1;
            ASPxGridView1.DataBind();
        }