private void btn_Click(object sender, EventArgs e) { Button btn = (Button)sender; string sbbh = Convert.ToString(btn.Tag); MES_PD_SCRW model = new MES_PD_SCRW(); model.SBBH = sbbh; //model.ZPRQ = DateTime.Now.ToString("yyyy-MM-dd"); model.ZPRQ = Convert.ToDateTime(ServicModel.PUBLIC_FUNC.GET_TIME(getToken())).ToString("yyyy-MM-dd"); string sydt = ""; SBHID = model.SBBH; SELECT_MES_PD_SCRW Smodel; switch (RigthType) { case Rigth_Type.gangketl_cc: Smodel = ServicModel.PD_SCRW.SELECT_LAST(model, getToken()); break; case Rigth_Type.jidiantitl_cc: Smodel = ServicModel.PD_SCRW.SELECT_LAST(model, getToken()); break; case Rigth_Type.fujitl: sydt = GetSystemDate(Date_Type.hour, -4, "yyyy-MM-dd");//Convert.ToDateTime(ServicModel.PUBLIC_FUNC.GET_TIME(getToken())).AddHours(-4).ToString("yyyy-MM-dd");//系统减4个小时 model.ZPRQ = sydt; Smodel = ServicModel.PD_SCRW.SELECT(model, getToken()); break; case Rigth_Type.fujicc: sydt = GetSystemDate(Date_Type.hour, -4, "yyyy-MM-dd");//Convert.ToDateTime(ServicModel.PUBLIC_FUNC.GET_TIME(getToken())).AddHours(-4).ToString("yyyy-MM-dd");//系统减4个小时 model.ZPRQ = sydt; Smodel = ServicModel.PD_SCRW.SELECT_LAST(model, getToken()); break; case Rigth_Type.zhengjicc: Smodel = ServicModel.PD_SCRW.SELECT_LAST(model, getToken()); break; case Rigth_Type.zhuxiantl: Smodel = ServicModel.PD_SCRW.SELECT(model, getToken()); break; case Rigth_Type.zhujizhengjitl: Smodel = ServicModel.PD_SCRW.SELECT(model, getToken()); break; case Rigth_Type.zhuxiancc: Smodel = ServicModel.PD_SCRW.SELECT_LAST(model, getToken()); break; case Rigth_Type.baobiaocc: Smodel = ServicModel.PD_SCRW.SELECT_LAST(model, getToken()); break; case Rigth_Type.dczztl_cc: Smodel = ServicModel.PD_SCRW.SELECT_LAST(model, getToken()); break; case Rigth_Type.baozhuangcc: Smodel = ServicModel.PD_SCRW.SELECT_LAST(model, getToken()); break; case Rigth_Type.ddjtl_cc: Smodel = ServicModel.PD_SCRW.SELECT_LAST(model, getToken()); break; default: Smodel = ServicModel.PD_SCRW.SELECT_LAST(model, getToken()); break; } //如果是E的时候只有包标、组合电池、包装可以进入投料产出界面,在界面上扫描工单和托盘码生成相应的任务 if (Smodel.MES_RETURN.TYPE == "E") { if (RigthType == Rigth_Type.baobiaocc || RigthType == Rigth_Type.dczztl_cc) { if (string.IsNullOrEmpty(Tm)) { frmBaobiao form = new frmBaobiao(new MES_PD_SCRW_LIST(), model.SBBH, RigthType, btn.Text); push(form, this); } else { frmBaobiao form = new frmBaobiao(new MES_PD_SCRW_LIST(), model.SBBH, RigthType, btn.Text, Tm); push(form, this); } return; } else if (RigthType == Rigth_Type.baozhuangcc) { if (string.IsNullOrEmpty(Tm)) { frmBaozhuang form = new frmBaozhuang(new MES_PD_SCRW_LIST(), model.SBBH, RigthType, btn.Text); push(form, this); } else { frmBaozhuang form = new frmBaozhuang(new MES_PD_SCRW_LIST(), model.SBBH, RigthType, btn.Text, Tm); push(form, this); } return; } else { //MessageBox.Show(Smodel.MES_RETURN.MESSAGE, "消息框"); ShowMeg(Smodel.MES_RETURN.MESSAGE); return; } } if (Smodel.MES_PD_SCRW_LIST.Length == 0) { //MessageBox.Show("找不到工作中心是" + Gzzx + "设备号是" + btn.Text + "对应的派单任务!!!", "消息框"); ShowMeg(string.Format(q(Msg_Type.msgnorw), Gzzx, btn.Text)); return; } else if (Smodel.MES_PD_SCRW_LIST.Length == 1) { if (RigthType == Rigth_Type.fujitl) { ini.IniWriteValue(ini.Section_Machine, "fjsbh", sbbh); frmFujiTL_N fjtlform = new frmFujiTL_N(Smodel.MES_PD_SCRW_LIST, btn.Text, sbbh); push(fjtlform, this); } else if (RigthType == Rigth_Type.gangketl_cc || RigthType == Rigth_Type.jidiantitl_cc || RigthType == Rigth_Type.mfqqingxi || RigthType == Rigth_Type.gmgtl_cc || RigthType == Rigth_Type.fujifengkoujitl_cc || RigthType == Rigth_Type.zhengjifengkoujitl_cc) { //frmTL2 form = new frmTL2(Smodel.MES_PD_SCRW_LIST[0], model.SBBH, RigthType); //push(form); frmTL2_1 form = new frmTL2_1(Smodel.MES_PD_SCRW_LIST[0], model.SBBH, RigthType); push(form, this); } else if (RigthType == Rigth_Type.ddjtl_cc) { frmTL2_2 form = new frmTL2_2(Smodel.MES_PD_SCRW_LIST[0], model.SBBH, RigthType); push(form, this); } else if (RigthType == Rigth_Type.zhuxiancc) { frmZX_CC form = new frmZX_CC(Smodel.MES_PD_SCRW_LIST[0], model.SBBH, RigthType); push(form, this); } else if (RigthType == Rigth_Type.baobiaocc || RigthType == Rigth_Type.dczztl_cc) { if (string.IsNullOrEmpty(Tm)) { frmBaobiao form = new frmBaobiao(Smodel.MES_PD_SCRW_LIST[0], model.SBBH, RigthType, btn.Text); push(form, this); } else { frmBaobiao form = new frmBaobiao(Smodel.MES_PD_SCRW_LIST[0], model.SBBH, RigthType, btn.Text, Tm); push(form, this); } } else if (RigthType == Rigth_Type.baozhuangcc) { if (string.IsNullOrEmpty(Tm)) { frmBaozhuang form = new frmBaozhuang(new MES_PD_SCRW_LIST(), model.SBBH, RigthType, btn.Text); push(form, this); } else { frmBaozhuang form = new frmBaozhuang(new MES_PD_SCRW_LIST(), model.SBBH, RigthType, btn.Text, Tm); push(form, this); } } else if (RigthType == Rigth_Type.zhuxiantl || RigthType == Rigth_Type.zhujizhengjitl) { frmZX_TL form = new frmZX_TL(Smodel.MES_PD_SCRW_LIST[0], model.SBBH, RigthType);; push(form, this); } } else if (Smodel.MES_PD_SCRW_LIST.Length > 1)//查询到的任务大于1的只有负极投料和主线投料 { if (RigthType == Rigth_Type.fujitl) { ini.IniWriteValue(ini.Section_Machine, "fjsbh", sbbh); frmFujiTL_N fjtlform = new frmFujiTL_N(Smodel.MES_PD_SCRW_LIST, btn.Text, sbbh); push(fjtlform, this); } else if (RigthType == Rigth_Type.zhuxiantl || RigthType == Rigth_Type.zhujizhengjitl) { frmZX_TL form = new frmZX_TL(Smodel.MES_PD_SCRW_LIST[0], model.SBBH, RigthType); push(form, this); } this.Close(); } }