|
|
@@ -351,10 +351,10 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
showSmtError(APIErrorCode.DATA_NOT_FOUND,"机台+工单+站位["+code+"]无上料数据,无需下料",handleType,linecode,"",pr_code,"",bool,table);
|
|
|
}
|
|
|
rsReturn = baseDao.queryForRowSet("select max(dsl_location) dsl_location,max(dsl_remainqty) dsl_remainqty,max(dsl_id) dsl_id,max(dsl_barcode) dsl_barcode,max(dsl_fespec) dsl_fespec,max(dsl_prodcode) dsl_prodcode,wm_concat(nvl(dsl_barcode,dsl_prodcode)) dsl_return from devsmtlocation "
|
|
|
- + " where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_location =? and dsl_table =? ",linecode,map.get("DL_MACODE"),dsl_location,map.get("DL_TABLE"));
|
|
|
+ + " where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_location =? and dsl_table =? ",linecode,map.get("DL_MACODE"),dsl_location,table);
|
|
|
if(rsReturn.next()){
|
|
|
rs = baseDao.queryForRowSet("select sum(dsl_remainqty) dsl_remainqty,max(dsl_id) dsl_id, count(1) cn from"
|
|
|
- +" devsmtlocation where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_table=? and dsl_location =? ",linecode,ma_code,map.get("DL_TABLE"),dsl_location);
|
|
|
+ +" devsmtlocation where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_table=? and dsl_location =? ",linecode,ma_code,table,dsl_location);
|
|
|
if(rs.next()){
|
|
|
remain = rs.getDouble("dsl_remainqty"); //将第一个料卷剩余料加给第二个料卷
|
|
|
if(rs.getInt("cn") == 1){
|
|
|
@@ -363,20 +363,32 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
}
|
|
|
}else{
|
|
|
sqls.add("update barcode set bar_place=1,bar_forcastremain=0,bar_remain=0 where bar_code in (select dsl_barcode from devsmtlocation"
|
|
|
- +" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location='"+dsl_location+"' and dsl_table ='"+map.get("DL_TABLE")+"' and dsl_id<>"+rs.getInt("dsl_id")+") and bar_place='"+ma_code+"'");
|
|
|
+ +" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location='"+dsl_location+"' and dsl_table ='"+table+"' and dsl_id<>"+rs.getInt("dsl_id")+") and bar_place='"+ma_code+"'");
|
|
|
sqls.add("update barcode set bar_place=1,bar_forcastremain="+remain+",bar_remain="+remain+ " where bar_code=(select dsl_barcode from devsmtlocation "
|
|
|
+" where dsl_id="+rs.getInt("dsl_id")+" and dsl_linecode='"+linecode+"' and dsl_location='"+dsl_location+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_table= '"+map.get("DL_TABLE")+"' ) and bar_place='"+ma_code+"'");
|
|
|
}
|
|
|
- sqls.add("update devsmtlocation set dsl_status=-1,dsl_cutman='"+SystemSession.getUser().getEm_name()+"',dsl_invalidtime=sysdate"
|
|
|
- +" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+dsl_location+"' and dsl_table='"+map.get("DL_TABLE")+"'");
|
|
|
- baseDao.execute(sqls);
|
|
|
+ //记录湿敏元器件下料,更新为暴露中@add xiaost 20200302,并且记录湿敏元器件日志
|
|
|
+ sqls.add("update msdbarcode set MB_EXPOSURETIME=nvl(mb_exposuretime,0) + round((sysdate - nvl(MB_ACTIONDATE,sysdate)) * 24.0 * 60.0,2) " +
|
|
|
+ " ,mb_status='暴露中',MB_ACTIONDATE=sysdate ,mb_planoventime=0 where mb_barcode in(select dsl_barcode from devsmtlocation" +
|
|
|
+ " where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+dsl_location+"' and dsl_table='"+table+"')"+
|
|
|
+ " and mb_status='已上线'");
|
|
|
+ sqls.add("insert into MSDLog(ms_id,ms_date,ms_barcode,ms_level,ms_lifetime,ms_action,"+
|
|
|
+ " ms_man,ms_location,ms_prodcode,ms_planoventime,ms_oventime,MS_REMARK) "+
|
|
|
+ " select msdlog_seq.nextval,sysdate,mb_barcode,mb_msdlevel,round((nvl(mb_floorlife,0.0) * 60.0 - nvl(mb_exposuretime,0)),2),'下料','" +
|
|
|
+ SystemSession.getUser().getEm_name()+"','',mb_prodcode,0,0,'线别:"+linecode+",工单:"+ma_code+",板面:"+table+",站位:"+dsl_location+",下料'"+
|
|
|
+ " from msdbarcode where mb_barcode in (select dsl_barcode from devsmtlocation where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+dsl_location+"' and dsl_table='"+table+"')"+
|
|
|
+ " and mb_status='暴露中'");
|
|
|
+
|
|
|
+ sqls.add("update devsmtlocation set dsl_status=-1,dsl_cutman='"+SystemSession.getUser().getEm_name()+"',dsl_invalidtime=sysdate"
|
|
|
+ +" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+dsl_location+"' and dsl_table='"+table+"'");
|
|
|
+ baseDao.execute(sqls);
|
|
|
//记录日志下料
|
|
|
rs = baseDao.queryForRowSet("select dl_macode,dl_hasmake from deviceline where dl_linecode =?",linecode);
|
|
|
int has_make=0;
|
|
|
if(rs.next()){
|
|
|
has_make=rs.getInt("dl_hasmake");
|
|
|
}
|
|
|
- baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"下料","下料成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code+",料卷号或站位:"+code,linecode,dsl_location,0,pr_code,rsReturn.getString("dsl_return"),map.get("DL_TABLE"),has_make == -1?ma_code:"");
|
|
|
+ baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"下料","下料成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code+",料卷号或站位:"+code,linecode,dsl_location,0,pr_code,rsReturn.getString("dsl_return"),table,has_make == -1?ma_code:"");
|
|
|
return rsReturn.getResultList();
|
|
|
}else{
|
|
|
showSmtError(APIErrorCode.DATA_NOT_FOUND,"机台+工单+"+code+" 无上料数据,无需下料",handleType,linecode,dsl_location,pr_code,"",bool,table);
|
|
|
@@ -450,6 +462,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
List<String> sqls = new ArrayList<String>();
|
|
|
//dsl_usable=2的直接更新bar_place为1,remain为0
|
|
|
sqls.add("update barcode set bar_place=1,bar_forcastremain=0,bar_remain=0 where exists (select 1 from devsmtlocation where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_table='"+dl_table+"' and nvl(dsl_usable,0) = 2 and dsl_barcode = bar_code)");
|
|
|
+
|
|
|
rs = baseDao.queryForRowSet("select dsl_location,cn,dsl_remainqty,dsl_id,dsl_barcode,dsl_baseqty,case when "+actAddQty+">0 then round(dsl_baseqty*(1+0.01*"+lossrate+")*(1/"+pcbacount+")*"+actAddQty+",4) else 0 end remainAddQty " +
|
|
|
"from (select dsl_location,count(1)cn,sum(dsl_remainqty)dsl_remainqty,max(dsl_id)dsl_id,max(dsl_barcode)dsl_barcode," +
|
|
|
"max(dsl_baseqty)dsl_baseqty " +
|
|
|
@@ -502,6 +515,19 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
}else{
|
|
|
sqls.add("update make set ma_smtbqty ="+dl_madeqty+" where ma_code = '"+dl_macode+"'");
|
|
|
}
|
|
|
+ //更新湿敏条码状态为暴露中,操作日志为全部下料
|
|
|
+ //记录湿敏元器件下料,更新为暴露中@add xiaost 20200302,并且记录湿敏元器件日志
|
|
|
+ sqls.add("update msdbarcode set MB_EXPOSURETIME=nvl(mb_exposuretime,0) + round((sysdate - nvl(MB_ACTIONDATE,sysdate)) * 24.0 * 60.0,2) " +
|
|
|
+ " ,mb_status='暴露中',MB_ACTIONDATE=sysdate ,mb_planoventime=0 where mb_barcode in(select dsl_barcode from devsmtlocation" +
|
|
|
+ " where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_status=0 )"+
|
|
|
+ " and mb_status='已上线'");
|
|
|
+ sqls.add("insert into MSDLog(ms_id,ms_date,ms_barcode,ms_level,ms_lifetime,ms_action,"+
|
|
|
+ " ms_man,ms_location,ms_prodcode,ms_planoventime,ms_oventime,MS_REMARK) "+
|
|
|
+ " select msdlog_seq.nextval,sysdate,mb_barcode,mb_msdlevel,round((nvl(mb_floorlife,0.0) * 60.0 - nvl(mb_exposuretime,0)),2),'下料','" +
|
|
|
+ SystemSession.getUser().getEm_name()+"','',mb_prodcode,0,0,'线别:"+dl_linecode+",工单:"+dl_macode+",全部下料'"+
|
|
|
+ " from msdbarcode where mb_barcode in (select dsl_barcode from devsmtlocation where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_status=0 )"+
|
|
|
+ " and mb_status='暴露中'");
|
|
|
+
|
|
|
//更新成下料将数据导入至makesmtlocation
|
|
|
sqls.add("update devsmtlocation set dsl_status=-1,dsl_invalidtime=sysdate,dsl_cutman='"+SystemSession.getUser().getEm_name()+"' where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_status=0 and dsl_usable<>2");
|
|
|
sqls.add("insert into makesmtlocation(msl_id,msl_maid,msl_makecode,msl_mcid,msl_mccode,msl_mmdetno,msl_location,msl_prodcode,msl_repcode,msl_fespec,"
|
|
|
@@ -577,7 +603,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
showSmtError(APIErrorCode.BUSINESS_FAILED,"不允许接同一个料卷号",handleType,linecode,location,ps_prodcode,"料卷"+bar_code,bool,table);
|
|
|
}
|
|
|
}
|
|
|
- rs1=baseDao.queryForRowSet("select bar_prodcode,bar_place,bar_remain,bar_code from barcode where bar_code=?",bar_code);
|
|
|
+ rs1=baseDao.queryForRowSet("select bar_prodcode,nvl(bar_place,1)bar_place,bar_remain,bar_code from barcode where bar_code=?",bar_code);
|
|
|
if(rs1.next()){
|
|
|
rs = baseDao.queryForRowSet("select psl_baseqty,psl_prodcode,psl_repcode,psl_feeder,psl_id from productsmtlocation "
|
|
|
+" where psl_psid=? and psl_location=? and psl_table=? and (psl_prodcode=? or psl_repcode=?)",map.get("PS_ID"),location,map.get("DL_TABLE"),rs1.getString("bar_prodcode"),rs1.getString("bar_prodcode"));
|
|
|
@@ -715,7 +741,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
showSmtError(APIErrorCode.BUSINESS_FAILED,"站位未上料无需换料",handleType,linecode,location,ps_prodcode,"",bool,table);
|
|
|
}
|
|
|
|
|
|
- rs2 = baseDao.queryForRowSet("select bar_remain,bar_place,bar_prodcode,bar_code from barcode where bar_code=?",bar_code);
|
|
|
+ rs2 = baseDao.queryForRowSet("select bar_remain,nvl(bar_place,1)bar_place,bar_prodcode,bar_code from barcode where bar_code=?",bar_code);
|
|
|
if(rs2.next()){
|
|
|
rs = baseDao.queryForRowSet("select psl_baseqty,psl_prodcode,psl_repcode,psl_feeder,psl_id from productsmtlocation "
|
|
|
+" where psl_psid=? and psl_location=? and psl_table=? and (psl_prodcode=? or psl_repcode=?)",map.get("PS_ID"),location,map.get("DL_TABLE"),rs2.getString("bar_prodcode"),rs2.getString("bar_prodcode"));
|
|
|
@@ -791,7 +817,19 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
sqls.add("update barcode set bar_place=1,bar_forcastremain="+remain+",bar_remain="+remain+ " where bar_code=(select dsl_barcode from devsmtlocation "
|
|
|
+" where dsl_id="+rs.getInt("dsl_id")+" and dsl_linecode='"+linecode+"' and dsl_location='"+location+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_table= '"+map.get("DL_TABLE")+"' ) and bar_place='"+ma_code+"'");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ //记录湿敏元器件下料,更新为暴露中@add xiaost 20200302,并且记录湿敏元器件日志
|
|
|
+ sqls.add("update msdbarcode set MB_EXPOSURETIME=nvl(mb_exposuretime,0) + round((sysdate - nvl(MB_ACTIONDATE,sysdate)) * 24.0 * 60.0,2) " +
|
|
|
+ " ,mb_status='暴露中',MB_ACTIONDATE=sysdate ,mb_planoventime=0 where mb_barcode in(select dsl_barcode from devsmtlocation" +
|
|
|
+ " where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+location+"' and dsl_table='"+table+"'" +")"+
|
|
|
+ " and mb_status='已上线'");
|
|
|
+ sqls.add("insert into MSDLog(ms_id,ms_date,ms_barcode,ms_level,ms_lifetime,ms_action,"+
|
|
|
+ " ms_man,ms_location,ms_prodcode,ms_planoventime,ms_oventime,MS_REMARK) "+
|
|
|
+ " select msdlog_seq.nextval,sysdate,mb_barcode,mb_msdlevel,round((nvl(mb_floorlife,0.0) * 60.0 - nvl(mb_exposuretime,0)),2),'下料','" +
|
|
|
+ SystemSession.getUser().getEm_name()+"','',mb_prodcode,0,0,'线别:"+linecode+",工单:"+ma_code+",板面:"+table+",站位:"+location+",换料'"+
|
|
|
+ " from msdbarcode where mb_barcode in (select dsl_barcode from devsmtlocation where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+location+"' and dsl_table='"+table+"')"+
|
|
|
+ " and mb_status='暴露中'");
|
|
|
+
|
|
|
rs = baseDao.queryForRowSet("select wm_concat(dsl_barcode) dsl_barcode from"
|
|
|
+" devsmtlocation where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_table='"+map.get("DL_TABLE")+"' and dsl_location ='"+location+"' and nvl(dsl_barcode,' ') <> ' '");
|
|
|
String barcode = null;
|
|
|
@@ -811,6 +849,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
}else{
|
|
|
baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"换料","换料成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code+","+"料卷号:"+barcode+"下料",linecode,location,0,ps_prodcode,"料卷:"+barcode,map.get("DL_TABLE"),has_make == -1?ma_code:"");
|
|
|
}
|
|
|
+
|
|
|
sqls.add("update devsmtlocation set dsl_status=-1,dsl_cutman='"+SystemSession.getUser().getEm_name()+"',dsl_invalidtime=sysdate "
|
|
|
+" where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=0 and dsl_location ='"+location+"' and dsl_table='"+map.get("DL_TABLE")+"'");
|
|
|
baseDao.execute(sqls);
|
|
|
@@ -1011,8 +1050,17 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
baseDao.execute("update barcode set bar_place=1"
|
|
|
+" where exists(select 1 from devsmtlocation where dsl_linecode=? and dsl_makecode=? and dsl_barcode=bar_code "
|
|
|
+" and dsl_table=? and dsl_status=0 and dsl_usable<>2) and bar_place=? and (bar_remain<0 or bar_remain=0)",dl_linecode,ma_oldcode,dl_table,ma_oldcode);//原制造单号
|
|
|
-
|
|
|
- baseDao.execute("update devsmtlocation set dsl_status=-1, dsl_invalidtime=sysdate,dsl_cutman='"+SystemSession.getUser().getEm_name()+"'"
|
|
|
+ //更新湿敏条码状态为暴露中,操作日志为全部下料
|
|
|
+ //记录湿敏元器件下料,更新为暴露中@add xiaost 20200302,并且记录湿敏元器件日志
|
|
|
+ baseDao.execute("update msdbarcode set MB_EXPOSURETIME=nvl(mb_exposuretime,0) + round((sysdate - nvl(MB_ACTIONDATE,sysdate)) * 24.0 * 60.0,2) " +
|
|
|
+ " ,mb_status='暴露中',MB_ACTIONDATE=sysdate ,mb_planoventime=0 where mb_barcode in(select dsl_barcode from devsmtlocation left join barcode on bar_code=dsl_barcode where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+ma_oldcode+"' and dsl_status=0 and dsl_table = '"+dl_table+"' and dsl_usable<>2 and dsl_invalidtime is null and bar_place='1' and (bar_remain<0 or bar_remain=0)) and mb_status='已上线'");
|
|
|
+ baseDao.execute("insert into MSDLog(ms_id,ms_date,ms_barcode,ms_level,ms_lifetime,ms_action,"+
|
|
|
+ " ms_man,ms_location,ms_prodcode,ms_planoventime,ms_oventime,MS_REMARK) "+
|
|
|
+ " select msdlog_seq.nextval,sysdate,mb_barcode,mb_msdlevel,round((nvl(mb_floorlife,0.0) * 60.0 - nvl(mb_exposuretime,0)),2),'下料','" +
|
|
|
+ SystemSession.getUser().getEm_name()+"','',mb_prodcode,0,0,'线别:"+dl_linecode+",工单:"+ma_oldcode+",切换工单'"+
|
|
|
+ " from msdbarcode where mb_barcode in(select dsl_barcode from devsmtlocation left join barcode on bar_code=dsl_barcode where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_table = ? and dsl_usable<>2 and dsl_invalidtime is null and bar_place='1' and (bar_remain<0 or bar_remain=0)) and mb_status='暴露中'",dl_linecode,ma_oldcode,dl_table);
|
|
|
+
|
|
|
+ baseDao.execute("update devsmtlocation set dsl_status=-1, dsl_invalidtime=sysdate,dsl_cutman='"+SystemSession.getUser().getEm_name()+"'"
|
|
|
+" where dsl_linecode=? and dsl_makecode=? and dsl_status=0 and dsl_table = ? and dsl_usable<>2 and dsl_invalidtime is null",dl_linecode,ma_oldcode,dl_table);//原工单号
|
|
|
|
|
|
baseDao.execute("insert into makesmtlocation(msl_id,msl_maid,msl_makecode,msl_mcid,msl_mccode,msl_mmdetno,msl_location,msl_prodcode,msl_repcode,msl_fespec,"
|