|
|
@@ -1004,7 +1004,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
SqlRowList rs = null;
|
|
|
SqlRowList rs0 = null;
|
|
|
String ma_prodcode = null,ma_oldcode=null,dl_table=null,dev_code=null;
|
|
|
- int ma_qty=0,dl_madeqty;
|
|
|
+ int ma_qty=0,dl_madeqty,dl_quacheckcount=0;
|
|
|
Integer ma_id =0;
|
|
|
Integer dl_id = 0;
|
|
|
int has_make=0;
|
|
|
@@ -1016,7 +1016,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
if(dl_actmadeqty<0){
|
|
|
throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"产出数不允许小于0");
|
|
|
}else{
|
|
|
- rs=baseDao.queryForRowSet("select dl_id,nvL(dl_madeqty,0)dl_madeqty,ma_qty,ma_smtqty,dl_table,dl_decode,dl_macode,dl_hasmake,dl_statuscode,dl_prodcode from deviceline left join make on ma_code=dl_macode where "
|
|
|
+ rs=baseDao.queryForRowSet("select dl_id,nvL(dl_madeqty,0)dl_madeqty,ma_qty,ma_smtqty,dl_table,dl_decode,dl_macode,dl_hasmake,dl_statuscode,dl_prodcode,nvl(dl_quacheckcount,0) dl_quacheckcount from deviceline left join make on ma_code=dl_macode where "
|
|
|
+" dl_linecode=? and nvl(dl_macode,' ')<>' ' ",dl_linecode);
|
|
|
if(rs.next()){
|
|
|
has_make=rs.getInt("dl_hasmake");
|
|
|
@@ -1029,6 +1029,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
ma_oldcode = rs.getString("dl_macode");
|
|
|
//限制原工单不允许和新工单一致
|
|
|
dl_id = rs.getInt("dl_id");
|
|
|
+ dl_quacheckcount = rs.getInt("dl_quacheckcount");
|
|
|
if(rs.getInt("dl_hasmake") == -1){
|
|
|
if(dl_actmadeqty < dl_madeqty || dl_actmadeqty > (rs.getInt("ma_qty")-rs.getInt("ma_smtqty"))){
|
|
|
throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"数量必须介于产出数和未完成贴片数之间");
|
|
|
@@ -1149,8 +1150,8 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
baseDao.execute("update deviceline set dl_macode=? , dl_table=? ,dl_statuscode='UNUSED' , dl_status='未使用',dl_madeqty=0,dl_prodcode=?,dl_hasmake=?,dl_checkcount=0,dl_actmadeqty=0 ,dl_smtid=?,dl_quacheckcount=0 where dl_linecode=? ",ma_code,table,ma_prodcode,has_noma?0:-1,rs.getInt("ps_id"),dl_linecode);
|
|
|
//操作记录表
|
|
|
//1.记录原工单下料的情况
|
|
|
- baseDao.execute("insert into devicelinerecord(dlr_id,dlr_linecode,dlr_decode,dlr_macode,dlr_table,dlr_madeqty,dlr_actmadeqty,dlr_indate,dlr_inman,dlr_result)"
|
|
|
- + "values(devicelinerecord_seq.nextval,'"+dl_linecode+"','"+dev_code+"','"+ma_oldcode+"','"+dl_table+"',"+dl_madeqty+","+dl_actmadeqty+",sysdate,'"+SystemSession.getUser().getEm_name()+"','工单切换全部下料')");
|
|
|
+ baseDao.execute("insert into devicelinerecord(dlr_id,dlr_linecode,dlr_decode,dlr_macode,dlr_table,dlr_madeqty,dlr_actmadeqty,dlr_indate,dlr_inman,dlr_result,dlr_quacheckcount)"
|
|
|
+ + "values(devicelinerecord_seq.nextval,'"+dl_linecode+"','"+dev_code+"','"+ma_oldcode+"','"+dl_table+"',"+dl_madeqty+","+dl_actmadeqty+",sysdate,'"+SystemSession.getUser().getEm_name()+"','工单切换全部下料',"+dl_quacheckcount+")");
|
|
|
//2.记录新工单切换工单绑定
|
|
|
baseDao.execute("insert into devicelinerecord(dlr_id,dlr_linecode,dlr_decode,dlr_macode,dlr_table,dlr_madeqty,dlr_actmadeqty,dlr_indate,"
|
|
|
+" dlr_inman,dlr_result)"
|
|
|
@@ -2157,7 +2158,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> quaGetUnCheckLocation(String linecode) {
|
|
|
- return quaUnLoading(linecode);
|
|
|
+ return quaUnLoading(linecode,0);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -2167,7 +2168,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
if(rs.next()){
|
|
|
baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"品质校验","重新校验",linecode,"",0,rs.getString("dl_prodcode"),"",rs.getString("dl_table"),Integer.valueOf(returnMake(linecode,rs.getString("dl_prodcode"),rs.getString("dl_table")).get("hasmake").toString()) == -1 ? returnMake(linecode,rs.getString("dl_prodcode"),rs.getString("dl_table")).get("macode"):"");
|
|
|
}
|
|
|
- return quaUnLoading(linecode);
|
|
|
+ return quaUnLoading(linecode,1);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -2218,9 +2219,9 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"品质校验",meg+",料号:"+prodcode,linecode,location,i,map.get("DL_PRODCODE"),prodcode,map.get("DL_TABLE"),Integer.valueOf(returnMake(linecode,dl_prodcode,map.get("DL_TABLE")).get("hasmake").toString()) == -1 ? returnMake(linecode,dl_prodcode,map.get("DL_TABLE")).get("macode"):"");
|
|
|
//ps_id,table,linecode,ma_code,table
|
|
|
Map<String,Object> mapR = new HashMap <String, Object>();
|
|
|
- rs=baseDao.queryForRowSet("select * from (select psl_location,psl_prodcode from(select min(psl_detno)psl_detno,psl_location,wm_concat(psl_prodcode)psl_prodcode from productsmtlocation "
|
|
|
- +" where psl_psid=? and psl_table=? and psl_location in (select distinct dsl_location from devsmtlocation where "
|
|
|
- +" dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and nvl(dsl_quaifcheck,0) = 0) "
|
|
|
+ rs=baseDao.queryForRowSet("select * from (select psl_location from (select min(psl_detno)psl_detno,psl_location from productsmtlocation "
|
|
|
+ +" where psl_psid=? and psl_table=? and psl_location not in (select distinct dsl_location from devsmtlocation where "
|
|
|
+ +" dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and dsl_quaifcheck = -1) "
|
|
|
+" group by psl_location order by psl_detno asc)) where rownum<=20 ",ps_id,table,linecode,ma_code,table);
|
|
|
if(rs.next()){
|
|
|
mapR.put("NotCheckLocation", rs.getResultList());
|
|
|
@@ -2228,8 +2229,8 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
mapR.put("NotCheckLocation", "");
|
|
|
}
|
|
|
rs=baseDao.queryForRowSet("select count(1) cn from (select distinct psl_location from productsmtlocation where psl_psid=? and psl_table=? and "
|
|
|
- +" psl_location in (select distinct dsl_location from devsmtlocation where "
|
|
|
- +" dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and nvl(dsl_quaifcheck,0) = 0)) ",ps_id,table,linecode,ma_code,table);
|
|
|
+ +" psl_location not in (select distinct dsl_location from devsmtlocation where "
|
|
|
+ +" dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and dsl_quaifcheck = -1)) ",ps_id,table,linecode,ma_code,table);
|
|
|
if(rs.next()){
|
|
|
mapR.put("NotCheckCount", rs.getInt("cn"));
|
|
|
}else{
|
|
|
@@ -2240,8 +2241,8 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
+" not in(select dsl_location,dsl_fprodcode from devsmtlocation where dsl_linecode=? "
|
|
|
+" and dsl_makecode=? and dsl_status=0 and dsl_quaifcheck=-1)",Integer.class,ps_id,table,linecode,ma_code);
|
|
|
if(psl_id == null || psl_id == 0){
|
|
|
- /*baseDao.execute("update deviceline set dl_quacheckcount=nvl(dl_quacheckcount,0)+1 where dl_id=?",dl_id);
|
|
|
- baseDao.execute("update devsmtlocation set dsl_quaifcheck = 0 where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0",linecode,ma_code,table);*/
|
|
|
+ baseDao.execute("update deviceline set dl_quacheckcount=nvl(dl_quacheckcount,0)+1 where dl_id=?",dl_id);
|
|
|
+ baseDao.execute("update devsmtlocation set dsl_quaifcheck = 0 where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0",linecode,ma_code,table);
|
|
|
baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"品质校验","完成一次校验",linecode,"",0,map.get("DL_PRODCODE"),"",map.get("DL_TABLE"),Integer.valueOf(returnMake(linecode,dl_prodcode,map.get("DL_TABLE")).get("hasmake").toString()) == -1 ? returnMake(linecode,dl_prodcode,map.get("DL_TABLE")).get("macode"):"");
|
|
|
}
|
|
|
}
|
|
|
@@ -2249,7 +2250,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
}
|
|
|
|
|
|
//因为需要调用两次,所以封装了一个获取未校验站位的方法
|
|
|
- private Map<String, Object> quaUnLoading(String linecode){
|
|
|
+ private Map<String, Object> quaUnLoading(String linecode,int recheck){
|
|
|
SqlRowList rs = null;
|
|
|
Object macode = null;
|
|
|
Object table = null;
|
|
|
@@ -2261,24 +2262,36 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
table = rs.getString("dl_table");
|
|
|
ps_prodcode = rs.getString("dl_prodcode");
|
|
|
}
|
|
|
- //未校验站位前二十条、、wm_concat(psl_prodcode)psl_prodcode
|
|
|
- rs=baseDao.queryForRowSet("select * from (select psl_location,psl_prodcode from (select min(psl_detno)psl_detno,psl_location,wm_concat(psl_prodcode)psl_prodcode from productsmtlocation left join productsmt on ps_id=psl_psid "
|
|
|
- +" where ps_linecode = ? and ps_prodcode = ? and psl_table = ? and psl_location in (select distinct dsl_location from devsmtlocation where "
|
|
|
- +" dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and nvl(dsl_quaifcheck,0) = 0) "
|
|
|
- +" group by psl_location order by psl_detno)) where rownum<=20 ",linecode,ps_prodcode,table,linecode,macode,table);
|
|
|
- if(rs.next()){
|
|
|
- mapR.put("NotCheckLocation", rs.getResultList());
|
|
|
+ //是否存在有校验记录,或者点了重新校验recheck==1
|
|
|
+ int cn = baseDao.getJdbcTemplate().queryForObject("select count(1) from devsmtlocation where " +
|
|
|
+ " dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and dsl_quaifcheck = -1 ",Integer.class,linecode,macode,table);
|
|
|
+ if(recheck==1 || cn>0) {
|
|
|
+ //未校验站位前二十条
|
|
|
+ rs = baseDao.queryForRowSet("select * from (select psl_location,psl_prodcode "
|
|
|
+ + " from (select min(psl_detno)psl_detno,psl_location,wm_concat(psl_prodcode)psl_prodcode "
|
|
|
+ + " from productsmtlocation left join productsmt on ps_id=psl_psid "
|
|
|
+ + " where ps_linecode = ? and ps_prodcode = ? and psl_table = ? "
|
|
|
+ + " and psl_location not in (select distinct dsl_location from devsmtlocation where "
|
|
|
+ + " dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and dsl_quaifcheck = -1) "
|
|
|
+ + " group by psl_location order by psl_detno)"
|
|
|
+ + " ) where rownum<=20 ", linecode, ps_prodcode, table, linecode, macode, table);
|
|
|
+ if (rs.next()) {
|
|
|
+ mapR.put("NotCheckLocation", rs.getResultList());
|
|
|
+ } else {
|
|
|
+ mapR.put("NotCheckLocation", "");
|
|
|
+ }
|
|
|
+ //未校验站位数量
|
|
|
+ rs = baseDao.queryForRowSet("select count(1) cn from (select distinct psl_location from productsmtlocation left join productsmt on ps_id=psl_psid where ps_linecode = ? and "
|
|
|
+ + " ps_prodcode = ? and psl_table = ? and psl_location not in (select distinct dsl_location from devsmtlocation where "
|
|
|
+ + " dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and dsl_quaifcheck = -1)) ", linecode, ps_prodcode, table, linecode, macode, table);
|
|
|
+ if (rs.next()) {
|
|
|
+ mapR.put("NotCheckCount", rs.getInt("cn"));
|
|
|
+ } else {
|
|
|
+ mapR.put("NotCheckCount", 0);
|
|
|
+ }
|
|
|
}else{
|
|
|
mapR.put("NotCheckLocation", "");
|
|
|
- }
|
|
|
- //未校验站位数量
|
|
|
- rs=baseDao.queryForRowSet("select count(1) cn from (select distinct psl_location from productsmtlocation left join productsmt on ps_id=psl_psid where ps_linecode = ? and "
|
|
|
- +" ps_prodcode = ? and psl_table = ? and psl_location in (select distinct dsl_location from devsmtlocation where "
|
|
|
- +" dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and nvl(dsl_quaifcheck,0) = 0)) ",linecode,ps_prodcode,table,linecode,macode,table);
|
|
|
- if(rs.next()){
|
|
|
- mapR.put("NotCheckCount", rs.getInt("cn"));
|
|
|
- }else{
|
|
|
- mapR.put("NotCheckCount",0);
|
|
|
+ mapR.put("NotCheckCount", 0);
|
|
|
}
|
|
|
return mapR;
|
|
|
}
|