public void ScanTM() { if (smtextBox1.Text.Trim().Length != 10) { ShowMeg(q(Msg_Type.msgnosbh));//"扫描的不是设备号条码" return; } MES_SY_GZZX_SBH sbhmodel = new MES_SY_GZZX_SBH(); sbhmodel.SBBH = smtextBox1.Text.Trim(); MES_SY_GZZX_SBH[] sbList = ServicModel.SY_GZZX_SBH.SELECT(sbhmodel, getToken()); if (sbList.Length == 1) { bool isGZZX_SB = false; for (int i = 0; i < Sbhlist.Length; i++) { if (sbList[0].SBBH == Sbhlist[i].SBBH) { isGZZX_SB = true; break; } } if (isGZZX_SB) { MES_PD_SCRW model = new MES_PD_SCRW(); model.SBBH = sbList[0].SBBH; model.ZPRQ = GetSystemDate(Date_Type.hour, 0, "yyyy-MM-dd");// DateTime.Now.ToString("yyyy-MM-dd"); //model.GC = getGC("value"); //model.GZZXBH = getUserInfo("gzzxvalue"); SBHID = model.SBBH; SELECT_MES_PD_SCRW Smodel;//SELEXT_LAST只查询最后一个任务,SELECT查询的是所有当天的任务.暂时只有负极和主线 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: Smodel = ServicModel.PD_SCRW.SELECT(model, getToken()); break; case Rigth_Type.fujicc: 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; } if (Smodel.MES_RETURN.TYPE == "E") { if (RigthType == Rigth_Type.baobiaocc || RigthType == Rigth_Type.dczztl_cc) { frmBaobiao form = new frmBaobiao(new MES_PD_SCRW_LIST(), model.SBBH, RigthType, sbList[0].SBMS); push(form, this); return; } else if (RigthType == Rigth_Type.baozhuangcc) { frmBaozhuang form = new frmBaozhuang(new MES_PD_SCRW_LIST(), model.SBBH, RigthType, sbList[0].SBMS); 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 + "设备号是" + sbList[0].SBMS + "对应的派单任务!!!", "消息框"); ShowMeg(string.Format(q(Msg_Type.msgnorw), Gzzx, sbList[0].SBMS)); return; } else if (Smodel.MES_PD_SCRW_LIST.Length == 1) { if (RigthType == Rigth_Type.fujitl) { ini.IniWriteValue(ini.Section_Machine, "fjsbh", smtextBox1.Text.Trim()); frmFujiTL_N fjtlform = new frmFujiTL_N(Smodel.MES_PD_SCRW_LIST, sbList[0].SBMS, sbList[0].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) { 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) { frmBaobiao form = new frmBaobiao(Smodel.MES_PD_SCRW_LIST[0], model.SBBH, RigthType, sbList[0].SBMS); push(form, this); } else if (RigthType == Rigth_Type.baozhuangcc) { frmBaozhuang form = new frmBaozhuang(new MES_PD_SCRW_LIST(), model.SBBH, RigthType, sbList[0].SBMS); 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) { if (RigthType == Rigth_Type.fujitl) { ini.IniWriteValue(ini.Section_Machine, "fjsbh", smtextBox1.Text.Trim()); frmFujiTL_N fjtlform = new frmFujiTL_N(Smodel.MES_PD_SCRW_LIST, sbList[0].SBMS, sbList[0].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(); } } else { ShowMeg(q(Msg_Type.msgsbhnomacthgzzz));//"扫描的设备号不是当前工作中心下的" } } else if (sbList.Length == 0) { ShowMeg(q(Msg_Type.msgscannosbh));//"扫描的不是设备号条码" return; } else { ShowMeg(q(Msg_Type.msgsystemerror));//"系统异常请联系管理员" return; } }
public void RWDSCAN(MES_PD_SCRW_LIST rw, int rigthID, string gc, string gzzx, int wllb, Form form1, string tmText) { form1.Close(); form1.Hide(); if (string.IsNullOrEmpty(gc)) { bool isValid = true; if (rigthID == 0) { isValid = false; } else { RigthType = (Rigth_Type)rigthID; if (RigthType == Rigth_Type.fujitl) { //frmFujiTL fjtlform = new frmFujiTL(Smodel.MES_PD_SCRW_LIST, sbList[0].SBMS, sbList[0].SBBH); //push(fjtlform); } 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(rw, rw.SBBH, RigthType); push(form, this); } else if (RigthType == Rigth_Type.ddjtl_cc) { frmTL2_2 form = new frmTL2_2(rw, rw.SBBH, RigthType); push(form, this); } else if (RigthType == Rigth_Type.zhuxiancc) { frmZX_CC form = new frmZX_CC(rw, rw.SBBH, RigthType); push(form, this); } else if (RigthType == Rigth_Type.baobiaocc || RigthType == Rigth_Type.dczztl_cc) { //frmBaobiao form = new frmBaobiao(rw, rw.SBBH, RigthType, rw.SBH,tmText); frmBaobiao form = new frmBaobiao(rw, rw.SBBH, RigthType, rw.SBH); push(form, this); } else if (RigthType == Rigth_Type.baozhuangcc) { frmBaozhuang form = new frmBaozhuang(new MES_PD_SCRW_LIST(), rw.SBBH, RigthType, rw.SBH); push(form, this); } else if (RigthType == Rigth_Type.zhuxiantl || RigthType == Rigth_Type.zhujizhengjitl) { frmZX_TL form = new frmZX_TL(rw, rw.SBBH, RigthType);; push(form, this); } } if (isValid) { } else { ShowMeg(q(Msg_Type.rwdexcept));//"获取任务单信息异常,请联系管理员" } } else { //扫描工单string gc,string gzzx,int wllb MES_SY_GZZX_SBH model = new MES_SY_GZZX_SBH(); model.GZZXBH = gzzx; model.GC = gc; model.WLLB = wllb; MES_SY_GZZX_SBH[] list = ServicModel.SY_GZZX_SBH.SELECT(model, getToken()); if (rigthID != 0) { RigthType = (Rigth_Type)rigthID; if (list.Length != 0) { frmFindSBH form = new frmFindSBH(list, gzzx, RigthType, tmText); push(form, this); } else { ShowMeg(gzzx + q(Msg_Type.sbhempty));//对应的设备号为空 } } else { ShowMeg(q(Msg_Type.rolegdexcept));//工单对应的权限异常,请联系管理员 } } }
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(); } }