|
|
@@ -510,6 +510,17 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
sqls.add("update feeder set fe_location='' where fe_location='"+dsl_location+"' and fe_code='"+fecode+"'");
|
|
|
}
|
|
|
}
|
|
|
+ //备料下料就删除数据
|
|
|
+ if(handleType.equals("备料下料")){
|
|
|
+ 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,"
|
|
|
+ +"msl_baseqty,msl_table,msl_needqty,msl_getqty,msl_remainqty,msl_fecode,msl_barcode,msl_linecode,msl_devcode,msl_status"
|
|
|
+ +",msl_indate,msl_ifcheck,msl_validtime,msl_invalidtime,msl_smtid,msl_inman,msl_cutman,msl_fprodcode,msl_usable,msl_madeqty,msl_aoimadeqty,MSL_QUAIFCHECK)"
|
|
|
+ +"select makesmtlocation_seq.nextval,dsl_maid,dsl_makecode,dsl_mcid,dsl_mccode,dsl_mmdetno,dsl_location,dsl_prodcode,dsl_repcode,dsl_fespec,"
|
|
|
+ +"dsl_baseqty,dsl_table,dsl_needqty,dsl_getqty,dsl_remainqty,dsl_fecode,dsl_barcode,dsl_linecode,dsl_devcode,dsl_status"
|
|
|
+ +",dsl_indate,dsl_ifcheck,dsl_validtime,dsl_invalidtime,dsl_smtid,dsl_inman,dsl_cutman,dsl_fprodcode,dsl_usable,dsl_madeqty,dsl_aoimadeqty," +
|
|
|
+ " DSL_QUAIFCHECK from devsmtlocation where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=-1 and dsl_location='"+dsl_location+"'");
|
|
|
+ sqls.add("delete from devsmtlocation where dsl_linecode='"+linecode+"' and dsl_makecode='"+ma_code+"' and dsl_status=-1 and dsl_location='"+dsl_location+"'");
|
|
|
+ }
|
|
|
baseDao.execute(sqls);
|
|
|
baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),handleType,"下料成功,"+(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:"",fecode);
|
|
|
return rsReturn.getResultList();
|
|
|
@@ -679,7 +690,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),handType,"全部下料成功,"+(dl_hasmake == -1 ? "工单":"产品")+":"+dl_macode,dl_linecode,"",0,dl_prodcode,"",dl_table,dl_hasmake == -1?dl_macode:"","");
|
|
|
}else{
|
|
|
//如果没有上料数据,则直接解除绑定不抛异常
|
|
|
- sqls.add("update deviceline set dl_macode='',dl_prodcode='',dl_statuscode='UNUSED',dl_status='未使用',dl_table='',dl_madeqty=0,dl_hasmake=0,dl_checkcount=0,dl_smtid=0,dl_actmadeqty=0 ,dl_quacheckcount=0 where dl_id="+dl_id);
|
|
|
+ sqls.add("update deviceline set dl_macode='',dl_prodcode='',dl_statuscode='UNUSED',dl_status='未使用',dl_table='',dl_madeqty=0,dl_hasmake=0,dl_checkcount=0,dl_smtid=0,dl_actmadeqty=0 ,dl_quacheckcount=0,dl_mainline=null where dl_id="+dl_id);
|
|
|
//操作记录表
|
|
|
sqls.add("insert into devicelinerecord(dlr_id,dlr_linecode,dlr_decode,dlr_macode,dlr_table,dlr_madeqty,dlr_actmadeqty,dlr_indate,dlr_inman,dlr_result,dlr_checkcount,dlr_smtid,dlr_prodcode,dlr_hasmake,DLR_QUACHECKCOUNT,dlr_mainline)"
|
|
|
+ "values(devicelinerecord_seq.nextval,'"+dl_linecode+"','"+dl_devcode+"','"+dl_macode+"','"+dl_table+"',"+madeqty+","+dl_madeqty+",sysdate,'"+SystemSession.getUser().getEm_name()+"','全部下料-解除绑定',"+dl_checkcount+","+dl_smtid+",'"+dl_prodcode+"',"+dl_hasmake+","+dl_quacheckcount+",'"+dl_mainline+"')");
|
|
|
@@ -1472,14 +1483,16 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
@Override
|
|
|
public Map<String, Object> diffData(String li_code, String ma_code, String table) {
|
|
|
String ma_prodcode=null;
|
|
|
- SqlRowList rs = baseDao.queryForRowSet("select dl_prodcode from deviceline where dl_linecode=? and dl_macode=? and dl_table=?",li_code,ma_code,table);
|
|
|
+ String mainline = "";
|
|
|
+ SqlRowList rs = baseDao.queryForRowSet("select dl_prodcode,dl_mainline from deviceline where dl_linecode=? and dl_macode=? and dl_table=?",li_code,ma_code,table);
|
|
|
if(rs.next()){
|
|
|
ma_prodcode = rs.getString("dl_prodcode");
|
|
|
+ mainline = rs.getGeneralString("dl_mainline");
|
|
|
}else{
|
|
|
throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"线别未绑定工单号(或产品编号)!");
|
|
|
}
|
|
|
//查询排位表id
|
|
|
- rs = baseDao.queryForRowSet("select ps_id from productsmt left join productsmtlocation on psl_psid=ps_id where ps_linecode=? and ps_prodcode=? and ps_statuscode='AUDITED' and psl_table=?",li_code,ma_prodcode,table);
|
|
|
+ rs = baseDao.queryForRowSet("select ps_id from productsmt left join productsmtlocation on psl_psid=ps_id where ps_linecode=? and ps_prodcode=? and ps_statuscode='AUDITED' and psl_table=?",StringUtil.hasText(mainline)?mainline:li_code,ma_prodcode,table);
|
|
|
if(rs.next()){
|
|
|
List<Map<String,Object>> list = null;
|
|
|
int ps_id = rs.getInt("ps_id");
|
|
|
@@ -1911,7 +1924,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
}
|
|
|
int ps_id = 0;
|
|
|
SqlRowList rs = null;
|
|
|
- rs = baseDao.queryForRowSet("select ps_id from deviceline left join productsmt on ps_linecode=dl_linecode and ps_prodcode=dl_prodcode and ps_table=dl_table where dl_linecode = ? and dl_macode = ? and dl_table = ?",dl_linecode,ma_code,table);
|
|
|
+ rs = baseDao.queryForRowSet("select ps_id from deviceline left join productsmt on ((nvl(dl_mainline,' ')<>' ' and ps_linecode=dl_mainline) or ps_linecode=dl_linecode) and ps_prodcode=dl_prodcode and ps_table=dl_table where dl_linecode = ? and dl_macode = ? and dl_table = ?",dl_linecode,ma_code,table);
|
|
|
if(rs.next()){
|
|
|
ps_id = rs.getInt("ps_id");
|
|
|
}
|
|
|
@@ -1920,7 +1933,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
+" dsl_fecode dsl_fespec ,dsl_baseqty from devsmtlocation left join ( select min(psl_detno) psl_detno,psl_location"
|
|
|
+" from productsmtlocation where psl_psid=? and psl_table =? group by psl_location )T "
|
|
|
+" on psl_location = dsl_location"
|
|
|
- +" where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and nvl(dsl_barcode,' ')= ' ' order by psl_detno asc",ps_id,table,dl_linecode,ma_code,table);
|
|
|
+ +" where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and nvl(dsl_barcode,' ')=' ' order by psl_detno asc",ps_id,table,dl_linecode,ma_code,table);
|
|
|
if (rs.next()) {
|
|
|
Map<String,Object> map = new HashMap <String, Object>();
|
|
|
map.put("count", rs.getResultList().size());
|
|
|
@@ -2639,7 +2652,11 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
if(StringUtil.hasText(hmacode)){
|
|
|
throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"备料线别["+liCode+"]对应的实际线别["+rs.getString("dl_mainline")+"],已经有绑定的工单:"+hmacode+"!");
|
|
|
}
|
|
|
- //转移到正式线别
|
|
|
+ //转移到正式线别,无备料数据不需要转移上线
|
|
|
+ int count = baseDao.getCount("select count(dsl_id) from devsmtlocation where nvl(dsl_status,0)=0 and dsl_linecode='"+liCode+"' and dsl_makecode='"+maCode+"' and dsl_table='"+dlTable+"'");
|
|
|
+ if(count == 0){
|
|
|
+ throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"无在线的备料数据,无法上线!");
|
|
|
+ }
|
|
|
// baseDao.execute("update deviceline set dl_macode=? ,dl_table=?,dl_hasmake=?,dl_smtid=?,dl_prodcode=?,
|
|
|
// dl_madeqty=0,dl_actmadeqty=0,dl_checkcount=0,dl_decode=?,dl_quacheckcount=0,dl_mainline=? where dl_linecode=?",
|
|
|
// ma_code,dl_table,has_make,rs0.getInt("ps_id"),ma_prodcode,rs0.getString("ps_devcode"),mainlicode,li_code);
|
|
|
@@ -2651,7 +2668,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
|
|
|
throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"备料线别["+liCode+"]备料对应的实际线别["+rs.getString("dl_mainline")+"],在线别表中不存在!");
|
|
|
}
|
|
|
}else{
|
|
|
- throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"线别["+liCode+"]+工单["+maCode+"]+板面["+dlTable+"],无备料数据!");
|
|
|
+ throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"线别["+liCode+"]+工单["+maCode+"]+板面["+dlTable+"],未进行备料绑定!");
|
|
|
}
|
|
|
return null;
|
|
|
}
|