Browse Source

SMT添加料盘飞达解绑

callm 5 years ago
parent
commit
e12d3e2111

+ 18 - 0
src/com/uas/mes/api/pda/PdaSMTController.java

@@ -301,4 +301,22 @@ public class PdaSMTController extends BaseApiController{
 	public ModelMap getFeederLocation(String fe_code){
 		return success(pdaSMTService.getFeederLocation(fe_code));
 	}
+
+	/**
+	 SMT-根据站位查询料盘
+	 */
+	@RequestMapping(value="/getBarcodeByFeeder.action")
+	public ModelMap getBarcodeByFeeder(String fe_code){
+		return success(pdaSMTService.getBarcodeByFeeder(fe_code));
+	}
+
+	/**
+	 SMT-解绑料盘飞达
+	 */
+	@RequestMapping(value="/unBindFeeder.action")
+	public ModelMap unBindFeeder(String fe_code){
+		return success(pdaSMTService.unBindFeeder(fe_code));
+	}
+
+
 }

+ 4 - 0
src/com/uas/mes/pda/service/PdaSMTService.java

@@ -69,4 +69,8 @@ public interface PdaSMTService {
 	Map<String, Object> bindFeederBarcode(String barcode,String fe_code);
 
 	Map<String, Object> getFeederLocation(String fe_code);
+
+	Map<String, Object> getBarcodeByFeeder(String fe_code);
+
+	Map<String, Object> unBindFeeder(String fe_code);
 }

+ 116 - 74
src/com/uas/mes/pda/service/impl/PdaSMTServiceImpl.java

@@ -152,12 +152,12 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				+ "dlr_madeqty,dlr_actmadeqty,dlr_indate,dlr_inman,dlr_result,dlr_prodcode,dlr_smtid,dlr_hasmake)"
 				+ "values(devicelinerecord_seq.nextval,?,?,?,?,0,0,sysdate,?,?,?,?,?)",
 				li_code,rs0.getString("ps_devcode"),ma_code,dl_table,SystemSession.getUser().getEm_name(),"机台绑定",ma_prodcode,rs0.getInt("ps_id"),has_make);
-		
+
 		//记录绑定SMT人员操作日志
-		baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"机台绑定","绑定成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code,li_code,"",0,ma_prodcode,"",dl_table,has_make == -1?ma_code:"");			
+		baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"机台绑定","绑定成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code,li_code,"",0,ma_prodcode,"",dl_table,has_make == -1?ma_code:"");
 		return mapReturn;
 	}
-	
+
 	@Override
 	//获取料站排位表数据
 	public List<Map<String, Object>> getSmtLocation(int ps_id,String dl_table) {
@@ -259,7 +259,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					if(bar_code.toString().contains(rs.getString("psl_prodcode"))){
 						pr_code = rs.getString("psl_prodcode");
 					}else{
-						String [] stringArr= rs.getString("repcode").split(","); 
+						String [] stringArr= rs.getString("repcode").split(",");
 						for (String s : stringArr) {
 							if (bar_code.toString().contains(s)) {
 								pr_code = s;
@@ -270,7 +270,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 						}
 					}
 					rs = baseDao.queryForRowSet("select nvl(pr_zxbzs,0) pr_zxbzs from product where pr_code = ?",pr_code);
-					if(rs.next()){								
+					if(rs.next()){
 						bar_remain = rs.getDouble("pr_zxbzs");
 					}
 				}else{
@@ -318,7 +318,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		mapR.put("DSL_PRODCODE", pr_code);
 		mapR.put("DSL_REMAINQTY", bar_remain);
 		mapR.put("DSL_FESPEC", rs.getString("psl_feeder"));
-		
+
 		 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) "
@@ -342,7 +342,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		}
 		return mapR;
 	}
-     
+
 	/**
 	 * 确认下料
 	 */
@@ -390,7 +390,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			if(rs.next()){
 				remain = rs.getDouble("dsl_remainqty");  //将第一个料卷剩余料加给第二个料卷
 					if(rs.getInt("cn") == 1){
-						if(rsReturn.getString("dsl_barcode") !=null && !("").equals(rsReturn.getString("dsl_barcode"))){							
+						if(rsReturn.getString("dsl_barcode") !=null && !("").equals(rsReturn.getString("dsl_barcode"))){
 							sqls.add("update barcode set bar_place=1,bar_forcastremain="+remain+",bar_remain="+remain+" where bar_code='"+rsReturn.getString("dsl_barcode")+"' and bar_place='"+ma_code+"'");
 						}
 					}else{
@@ -417,7 +417,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				    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:"");
 				    return rsReturn.getResultList();
 			}else{
-				showSmtError(APIErrorCode.DATA_NOT_FOUND,"机台+工单+"+code+" 无上料数据,无需下料",handleType,linecode,dsl_location,pr_code,"",bool,table);			
+				showSmtError(APIErrorCode.DATA_NOT_FOUND,"机台+工单+"+code+" 无上料数据,无需下料",handleType,linecode,dsl_location,pr_code,"",bool,table);
 			}
 		}
 		return null;
@@ -466,7 +466,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 							}
 						}
 					}
-				}				
+				}
 			}else{
 				throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"当前线别+板面无在线工单,无需全部下料!");
 			}
@@ -476,10 +476,10 @@ public class PdaSMTServiceImpl implements PdaSMTService {
     	//获取产品拼板
   		rs = baseDao.queryForRowSet("select nvl(max(pr_pcbacount),1)pcbacount,nvl(max(pr_lossrate),0)lossrate from product where pr_code=?",dl_prodcode);
   		if(rs.next()){
-  			pcbacount = rs.getGeneralInt("pcbacount"); 
+  			pcbacount = rs.getGeneralInt("pcbacount");
   			lossrate = rs.getGeneralDouble("lossrate");
   		}
-  		
+
 		int actAddQty = dl_madeqty-madeqty;  //实际填的产出数大于系统提示的产出数
 		//分多种情况,如果有多条数据的,查询出最大dsl_id 的数据,最后那卷料更新barcode  bar_remain ;累加
 		//如果有多条数据的,其他料卷bar_remain=0;
@@ -491,11 +491,11 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		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 from devsmtlocation where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and dsl_usable<>2 group by dsl_location)",dl_linecode,dl_macode,dl_table);
 		if(rs.hasNext()){
 			double remainAddQty,dsl_remainqty;
-			String dsl_location; 
+			String dsl_location;
 			while(rs.next()){
 				remainAddQty = 0;
 				dsl_remainqty = rs.getDouble("dsl_remainqty");
-				dsl_location = rs.getString("dsl_location");				
+				dsl_location = rs.getString("dsl_location");
 				remainAddQty = rs.getDouble("remainAddQty");
 				dsl_remainqty -= remainAddQty;
 				if(rs.getInt("cn")==1){//只有一条记录
@@ -538,14 +538,14 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					//接料原料卷数量更新成0,接料实际操作是将原料卷剩余料拼到新料卷中
 					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='"+dl_linecode+"' and dsl_makecode='"+dl_macode+"' and dsl_status=0 and dsl_location='"+rs.getString("dsl_location")+"' and dsl_id<>"+rs.getInt("dsl_id")+") and bar_place='"+dl_macode+"'");
 					//多条记录接料料卷
-					sqls.add("update barcode set bar_place=1,bar_forcastremain="+dsl_remainqty+",bar_remain="+dsl_remainqty+" where bar_code=(select dsl_barcode from devsmtlocation where dsl_id="+rs.getInt("dsl_id")+") and bar_place='"+dl_macode+"'");					
+					sqls.add("update barcode set bar_place=1,bar_forcastremain="+dsl_remainqty+",bar_remain="+dsl_remainqty+" where bar_code=(select dsl_barcode from devsmtlocation where dsl_id="+rs.getInt("dsl_id")+") and bar_place='"+dl_macode+"'");
 				}
 			}
-			//更新工单的SMT贴片数	
+			//更新工单的SMT贴片数
 			if(("A").equals(dl_table)){
-				sqls.add("update make set ma_smtaqty ="+dl_madeqty+" where ma_code = '"+dl_macode+"'");										
+				sqls.add("update make set ma_smtaqty ="+dl_madeqty+" where ma_code = '"+dl_macode+"'");
 			}else{
-				sqls.add("update make set ma_smtbqty ="+dl_madeqty+" where ma_code = '"+dl_macode+"'");									
+				sqls.add("update make set ma_smtbqty ="+dl_madeqty+" where ma_code = '"+dl_macode+"'");
 			}
 			//更新成下料将数据导入至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");
@@ -570,7 +570,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			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)"
 					+ "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+")");
 			baseDao.execute(sqls);
-			 //记录日志全部下料	
+			 //记录日志全部下料
 		    baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"全部下料","全部下料成功,"+(dl_hasmake == -1 ? "工单":"产品")+":"+dl_macode+"没有上料数据,解除绑定",dl_linecode,"",0,dl_prodcode,"",dl_table,dl_hasmake == -1?dl_macode:"");
 			//throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"线别["+dl_linecode+"]+工单["+dl_macode+"]未上料,无需下料");
 		}
@@ -618,7 +618,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		String type="barcode";
 			rs = baseDao.queryForRowSet("select dsl_barcode,dsl_repcode from devSMTLocation where dsl_linecode=?  and  dsl_makecode=? and dsl_location=? and dsl_table =?  and dsl_status=0 and dsl_barcode=?",linecode,ma_code,location,map.get("DL_TABLE"),bar_code);
 		if(rs.next()){
-			if(isBarcode){				
+			if(isBarcode){
 				showSmtError(APIErrorCode.BUSINESS_FAILED,"不允许接同一个料卷号",handleType,linecode,location,ps_prodcode,"料卷"+bar_code,bool,table);
 			}
 		}
@@ -648,7 +648,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					if(bar_code.toString().contains(rs.getString("psl_prodcode"))){
 						pr_code = rs.getString("psl_prodcode");
 					}else{
-						String [] stringArr= rs.getString("repcode").split(","); 
+						String [] stringArr= rs.getString("repcode").split(",");
 						for (String s : stringArr) {
 							if (bar_code.toString().contains(s)) {
 								pr_code = s;
@@ -659,7 +659,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					   }
 					}
 					rs = baseDao.queryForRowSet("select nvl(pr_zxbzs,0) pr_zxbzs from product where pr_code = ?",pr_code);
-					if(rs.next()){								
+					if(rs.next()){
 						bar_remain = rs.getDouble("pr_zxbzs");
 					}
 				}else{
@@ -689,7 +689,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				 usable = 1;
 				 //记录下料
 				 if(!isBarcodePre){
-					 if(dsl_barcode != null && !("").equals(dsl_barcode)){						 
+					 if(dsl_barcode != null && !("").equals(dsl_barcode)){
 						 baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"接料","接料成功,料卷:"+dsl_barcode+"下料,"+(("product").equals(type)?"物料编号":"料卷号")+":"+bar_code+"上料",linecode,location,0,ps_prodcode,"料卷"+dsl_barcode,map.get("DL_TABLE"),has_make == -1?ma_code:"");
 					 }else{
 						 baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"接料","接料成功,物料编号:"+dsl_prodcode+"下料,"+(("product").equals(type)?"物料编号":"料卷号")+":"+bar_code+"上料",linecode,location,0,ps_prodcode,"物料"+dsl_prodcode,map.get("DL_TABLE"),has_make == -1?ma_code:"");
@@ -697,7 +697,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				 }
 			}
 		    if(("barcode").equals(type)){
-				 baseDao.execute("update barcode set bar_place = ? where bar_code = ?",ma_code,bar_code);	
+				 baseDao.execute("update barcode set bar_place = ? where bar_code = ?",ma_code,bar_code);
 			}
 			baseDao.execute("insert into devsmtlocation (dsl_id,dsl_maid,dsl_makecode,dsl_location,dsl_prodcode,dsl_repcode,dsl_fespec,dsl_baseqty,dsl_table,dsl_needqty,dsl_getqty,dsl_remainqty,dsl_barcode,dsl_linecode,dsl_devcode,dsl_status, dsl_indate,dsl_inman,dsl_ifcheck,dsl_fprodcode,dsl_usable,dsl_validtime)values( DEVSMTLOCATION_SEQ.nextval,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,sysdate,?,?,?,?,?)",map.get("MA_ID"),ma_code,location,pr_code,rs2.getString("repcode"),
 					rs2.getString("psl_feeder"),rs2.getDouble("psl_baseqty"),map.get("DL_TABLE"),rs2.getDouble("psl_baseqty")*ma_qty,
@@ -715,14 +715,14 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		}
 		//记录日志接料
 		baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"接料","接料成功,"+(has_make == -1 ? "工单":"产品")+":"+ma_code+","+(("product").equals(type)?"物料编号":"料卷号")+":"+bar_code,linecode,location,0,ps_prodcode,(("product").equals(type)?"物料":"料卷")+":"+bar_code,map.get("DL_TABLE"),has_make == -1?ma_code:"");
-		Map<String,Object> mapReturn = new HashMap <String, Object>(); 
+		Map<String,Object> mapReturn = new HashMap <String, Object>();
 		mapReturn.put("DSL_LOCATION",location);
 		mapReturn.put("DSL_BARCODE",(("product").equals(type)?"":bar_code));
 		mapReturn.put("DSL_PRODCODE",pr_code);
 		mapReturn.put("DSL_REMAINQTY",bar_remain);
 		mapReturn.put("DSL_FESPEC",rs2.getString("psl_feeder"));
 		return mapReturn;
-			
+
 	}
 
 	/**
@@ -745,7 +745,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		Object bar_code = map1.get("dsl_barcode"),ma_code = map.get("DL_MACODE"),table = map.get("DL_TABLE");
 		Object dsl_fecode= map1.get("dsl_fecode");
 		Object location = map1.get("dsl_location"),linecode= map.get("DL_LINECODE");
-		
+
 		rs=baseDao.queryForRowSet("select dl_macode,dl_statuscode,dl_hasmake,dl_prodcode from deviceline where dl_linecode=?",linecode);
 		if(rs.next()){
 			has_make=rs.getInt("dl_hasmake");
@@ -760,7 +760,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		if(!rs.next()){
 			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);
 		if(rs2.next()){
 			rs = baseDao.queryForRowSet("select psl_baseqty,psl_prodcode,psl_repcode,psl_feeder,psl_id from productsmtlocation "
@@ -787,7 +787,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					if(bar_code.toString().contains(rs.getString("psl_prodcode"))){
 						pr_code = rs.getString("psl_prodcode");
 					}else{
-						String [] stringArr= rs.getString("repcode").split(","); 
+						String [] stringArr= rs.getString("repcode").split(",");
 						for (String s : stringArr) {
 							if (bar_code.toString().contains(s)) {
 								pr_code = s;
@@ -798,7 +798,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 						}
 					}
 					rs = baseDao.queryForRowSet("select nvl(pr_zxbzs,0) pr_zxbzs from product where pr_code = ?",pr_code);
-					if(rs.next()){								
+					if(rs.next()){
 						bar_remain = rs.getDouble("pr_zxbzs");
 					}
 				}else{
@@ -827,7 +827,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		}
 		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"),location);
-		if(rs.next()){	
+		if(rs.next()){
 				remain = rs.getDouble("dsl_remainqty");  //将第一个料卷剩余料加给第二个料卷
 			if(rs.getInt("cn") == 1){
 				sqls.add("update barcode set bar_place=1,bar_forcastremain="+remain+",bar_remain="+remain+" where bar_place='"+ma_code+"' and exists(select 1 from devsmtlocation where dsl_id = "+rs.getString("dsl_id")+" and dsl_barcode = bar_code)");
@@ -837,7 +837,7 @@ 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+"'");
 			}
-			    
+
 		    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;
@@ -861,7 +861,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					+" 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);
 		}else{
-			showSmtError(APIErrorCode.DATA_NOT_FOUND,"机台+工单+站位["+map1.get("dsl_location")+" ]无上料数据,无需换料",handleType,linecode,location,ps_prodcode,"",bool,table);			
+			showSmtError(APIErrorCode.DATA_NOT_FOUND,"机台+工单+站位["+map1.get("dsl_location")+" ]无上料数据,无需换料",handleType,linecode,location,ps_prodcode,"",bool,table);
 		}
 		rs=baseDao.queryForRowSet("select wm_concat(psl_repcode) repcode ,count(1) cn,max(psl_prodcode)psl_prodcode,count(1) cn ,max(psl_feeder) psl_feeder, max(psl_baseqty) psl_baseqty from productsmtlocation "
 				+"where psl_psid=? and psl_location=? and psl_table=?",map.get("PS_ID"),location,map.get("DL_TABLE"));
@@ -885,7 +885,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		if(checkMsdBarCode(bar_code)){
 			updateMsdbarcodeOnLine(bar_code);
 		}
-	    Map<String,Object> mapReturn = new HashMap <String, Object>(); 
+	    Map<String,Object> mapReturn = new HashMap <String, Object>();
 		mapReturn.put("DSL_LOCATION",location);
 		mapReturn.put("DSL_BARCODE",("product").equals(type)?"":bar_code);
 		mapReturn.put("DSL_PRODCODE",pr_code);
@@ -912,7 +912,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				+" on psl_location = dsl_location"
 				+" where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0  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<String,Object> map = new HashMap <String, Object>();
 			map.put("count", rs.getResultList().size());
 			map.put("record", rs.getResultList());
 			return map;
@@ -934,7 +934,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
         List<String> sqls = new ArrayList<String>();
         if(dl_actmadeqty == null || ("").equals(dl_actmadeqty)){
     	   dl_actmadeqty=0;
-       }   
+       }
        //先判断传过来的值dl_madeqty,必须大于0,并且介于dl_madeqty和ma_qty之间
   		if(dl_actmadeqty<0){
   			throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"产出数不允许小于0");
@@ -965,9 +965,9 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		if(dl_table.equals(table) && ma_oldcode.equals(ma_code)){
 			throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"无法切换至相同的产品代码+版面");
 		}
-  		
+
   		int actAddQty = dl_actmadeqty-dl_madeqty;  //实际填的产出数大于系统提示的产出数
-		
+
   		if(has_noma){//无工单
   			ma_prodcode = ma_code;
   		}else{
@@ -982,15 +982,15 @@ public class PdaSMTServiceImpl implements PdaSMTService {
     	//获取产品拼板
   		rs = baseDao.queryForRowSet("select nvl(max(pr_pcbacount),1)pcbacount,nvl(max(pr_lossrate),0)lossrate from product where pr_code=?",ma_prodcode);
   		if(rs.next()){
-  			pcbacount = rs.getGeneralInt("pcbacount"); 
+  			pcbacount = rs.getGeneralInt("pcbacount");
   			lossrate = rs.getGeneralDouble("lossrate");
   		}
     	//如果actAddQty大于0,多扣料
 		rs = baseDao.queryForRowSet("select dsl_location,cn,dsl_remainqty, dsl_id,dsl_barcode,dsl_baseqty,round(dsl_baseqty*(1+0.01*"+lossrate+")*(1/"+pcbacount+")*"+actAddQty+",4)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 from devsmtlocation where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 group by dsl_location)",dl_linecode,ma_oldcode,dl_table);
 		if(rs.hasNext()){
 			double remainAddQty,dsl_remainqty;
-			String dsl_location; 
-			while(rs.next()){  
+			String dsl_location;
+			while(rs.next()){
 				remainAddQty = rs.getDouble("remainAddQty");
 				dsl_remainqty = rs.getDouble("dsl_remainqty") - remainAddQty;
 				dsl_location = rs.getString("dsl_location");
@@ -1026,7 +1026,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			sqls.add("UPDATE devsmtlocation SET DSL_MADEQTY=ceil((dsl_getqty-DSL_REMAINQTY)/round(nvl(dsl_baseqty,0)*(1+0.01*"+lossrate+")*(1/"+pcbacount+"),4))  where dsl_linecode='"+dl_linecode+"' and dsl_makecode='"+ma_oldcode+"' and dsl_usable=1 and dsl_status=0");
     	}
 		//更新工单的SMT贴片数
-		sqls.add("update make set ma_smtqty = nvl(ma_smtqty,0)+"+dl_actmadeqty+" where ma_code = '"+ma_oldcode+"'");						
+		sqls.add("update make set ma_smtqty = nvl(ma_smtqty,0)+"+dl_actmadeqty+" where ma_code = '"+ma_oldcode+"'");
 			rs = baseDao.queryForRowSet("select psl_id,psl_baseqty,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=?",dl_linecode,ma_prodcode,table);
 		    if(rs.next()){
 			    rs0 = baseDao.queryForRowSet("select wm_concat(distinct dsl_location) dsl_location,count(1)cn from devsmtlocation "
@@ -1053,14 +1053,14 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 						   baseDao.execute("update barcode set bar_place=?"
 									+" 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_invalidtime is null and dsl_usable<>2) and bar_place=?",ma_code,dl_linecode,ma_code,table,ma_oldcode);//原制造单号
-							 	
+
 						    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()+"'"
 									+" 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,"
 								+"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)"
@@ -1085,7 +1085,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 								has_make =-1; //有工单
 							}
 							baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"工单切换","切换成功,切换至"+(has_make == -1 ? "工单":"产品")+":"+ma_code,dl_linecode,"",0,ma_prodcode,"",table,has_make == -1?ma_code:"");
-							Map<String,Object> map = new HashMap <String, Object>(); 
+							Map<String,Object> map = new HashMap <String, Object>();
 							map.put("DL_ID",dl_id);
 							map.put("DL_DECODE",dev_code);
 							map.put("DL_LINECODE",dl_linecode);
@@ -1111,7 +1111,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			}
 		return null;
 	}
-	
+
 	@Override
 	@Transactional
 	public Map<String, Object> startSmt(String deviceLineMake,boolean force) {
@@ -1131,7 +1131,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			}
 			ma_prodcode=rs.getString("dl_prodcode");
 		}
-		
+
 		if(force){//强制启动不限制
 			op = "强制启动";
 		}
@@ -1160,8 +1160,8 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		if(rs1.next()){
 			baseDao.execute("update devsmtlocation set dsl_validtime=sysdate where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_status=0 and dsl_usable=1 and dsl_validtime is null",map.get("DL_LINECODE"),map.get("DL_MACODE"),map.get("DL_TABLE"));
 			baseDao.execute("update deviceline set dl_statuscode='STARTED',dl_status='已启动' where dl_linecode=? and dl_macode=?",map.get("DL_LINECODE"),map.get("DL_MACODE"));
-			rs0 = baseDao.queryForRowSet("select dl_id,dl_decode,dl_linecode,dl_status, dl_statuscode,dl_macode,dl_table,dl_prodcode from deviceline where dl_linecode=? and dl_macode = ?",map.get("DL_LINECODE"),map.get("DL_MACODE"));	
-			if(rs0.next()){	
+			rs0 = baseDao.queryForRowSet("select dl_id,dl_decode,dl_linecode,dl_status, dl_statuscode,dl_macode,dl_table,dl_prodcode from deviceline where dl_linecode=? and dl_macode = ?",map.get("DL_LINECODE"),map.get("DL_MACODE"));
+			if(rs0.next()){
 				Map<String,Object> map1 = new HashMap <String, Object>();
 	        	 map1=rs0.getCurrentMap();
 	        	 map1.put("MA_ID", map.get("MA_ID"));
@@ -1173,12 +1173,12 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			 				,rs1.getString("ps_id"),rs.getString("DL_TABLE"));
 	        	 map2.put("deviceline", map1);
 	        	 map2.put("smtlocation", rsdev.getResultList());
-	        	 
+
 	        	//操作记录表
 	 			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,'"+rs0.getString("dl_linecode")+"','"+rs0.getString("dl_decode")+"','"+rs0.getString("dl_macode")+"','"+rs0.getString("dl_table")+"',"+rs0.getGeneralInt("dl_madeqty")+","+rs0.getGeneralInt("dl_madeqty")+",sysdate,'"+SystemSession.getUser().getEm_name()+"','"+op+"')");
 	 			//记录日志机台启动
-			    baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),op,"启动成功,"+(has_make == -1 ? "工单":"产品")+":"+rs0.getString("dl_macode"),rs0.getString("dl_linecode"),"",0,rs0.getString("dl_prodcode"), ("强制启动").equals(op)?(("").equals(unloadLocation)?"":"未上料站位:"+unloadLocation)+(("").equals(errorLocation)?"":"错误站位:"+errorLocation):"",rs0.getString("dl_table"),has_make == -1?map.get("DL_MACODE"):"");			
+			    baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),op,"启动成功,"+(has_make == -1 ? "工单":"产品")+":"+rs0.getString("dl_macode"),rs0.getString("dl_linecode"),"",0,rs0.getString("dl_prodcode"), ("强制启动").equals(op)?(("").equals(unloadLocation)?"":"未上料站位:"+unloadLocation)+(("").equals(errorLocation)?"":"错误站位:"+errorLocation):"",rs0.getString("dl_table"),has_make == -1?map.get("DL_MACODE"):"");
 			    return map2;
 			}
 		}else{
@@ -1186,7 +1186,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		}
 		return null;
 	}
-	
+
 	@Override
 	public Map<String,Object> stopSmt(String deviceLineMake) {
 		Map<Object, Object> map = FlexJsonUtil.fromJson(deviceLineMake);
@@ -1208,8 +1208,8 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		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,'"+rs.getString("dl_linecode")+"','"+rs.getString("dl_decode")+"','"+rs.getString("dl_macode")+"','"+rs.getString("dl_table")+"',"+rs.getGeneralInt("dl_madeqty")+","+rs.getGeneralInt("dl_madeqty")+",sysdate,'"+SystemSession.getUser().getEm_name()+"','暂停机台')");
 		//记录日志机台暂停
-	    baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"暂停机台","暂停成功,"+(has_make == -1 ? "工单":"产品")+":"+rs.getString("dl_macode"),rs.getString("dl_linecode"),"",0,rs.getString("dl_prodcode"),"",rs.getString("dl_table"),has_make == -1?map.get("DL_MACODE"):"");			
-			
+	    baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"暂停机台","暂停成功,"+(has_make == -1 ? "工单":"产品")+":"+rs.getString("dl_macode"),rs.getString("dl_linecode"),"",0,rs.getString("dl_prodcode"),"",rs.getString("dl_table"),has_make == -1?map.get("DL_MACODE"):"");
+
 		//暂停机台也重新刷新排位表数据
 		SqlRowList rs1 = 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=?",map.get("DL_LINECODE"),ma_prodcode,rs.getString("dl_table"));
 		if(rs1.next()){
@@ -1226,7 +1226,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"线别+产品对应的站位表不存在");
 		}
 	}
-	
+
 	//判断工单是否存在
 	private Map<String,Object> judgeMake (String ma_code){
 		SqlRowList rs = null;
@@ -1263,19 +1263,19 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		 if(rs.next()){
 			 ma_prodcode = rs.getString("dl_prodcode");
 		 }else{
-			 throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"线别未绑定工单号(或产品编号)!"); 
+			 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);
 		 if(rs.next()){
 			 List<Map<String,Object>> list = null;
 			 int ps_id = rs.getInt("ps_id");
-			 Map<String,Object> map = new HashMap <String, Object>(); 
+			 Map<String,Object> map = new HashMap <String, Object>();
 			 //未上站位:站位、首选料、替代料
 			 rs = baseDao.queryForRowSet("select psl_location,psl_prodcode,TRIM(both ',' FROM replace(','||wm_concat(psl_repcode)||',',','||psl_prodcode||',','')) psl_repcode,min(psl_detno) psl_detno 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 "
 								+" ) group by psl_location,psl_prodcode order by psl_detno ",ps_id,table,li_code,ma_code,table);
-			 if(rs.next()){ 
+			 if(rs.next()){
 				 list = rs.getResultList();
 				 map.put("unuse", list);
 				 map.put("unusecount",list.size());
@@ -1296,7 +1296,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			 throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"线别+产品对应的站位表不存在!");
 		 }
 	}
-	
+
 	@Override
 	public Map<String, Object> checkData(String dsl,String deviceLineMake) {
 		Map<Object, Object> map = FlexJsonUtil.fromJson(deviceLineMake);
@@ -1331,12 +1331,12 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 				if(ps_id == null ||ps_id == 0){
 					throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"线别+产品对应的站位表不存在!");
 				}else if(ps_id!=rs.getInt("dl_smtid")){//更新排位表ID
-					
+
 				}
 				baseDao.execute("update devsmtlocation set dsl_ifcheck=-1 where dsl_linecode=? and dsl_makecode=? and dsl_location=? and dsl_status=0",linecode,ma_code,location);
 			}
         }
-		//成功失败都记录日志 
+		//成功失败都记录日志
 		 int i=0;String meg = "校验成功";
 		 if(!success){
 			 i =-1;
@@ -1384,13 +1384,13 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		inoutNo = inoutNo.toUpperCase();
 		rs = baseDao
 				.queryForRowSet("select * from (select  ma_code from make where ma_code like ? "
-						+ "order by ma_id desc) where rownum<=10","%"+inoutNo+"%");	
+						+ "order by ma_id desc) where rownum<=10","%"+inoutNo+"%");
 		if (rs.next()) {
 			return rs.getResultList();
 		}
 		return null;
 	}
-		
+
 		/**
 		 * 针对输入的排位图的产品编号进行模糊查询
 		 */
@@ -1410,7 +1410,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		@Override
 		//接料前对原物料的校验
 		public void joinForecastDataCheck(String dsl, String deviceLineMake) {
-			SqlRowList rs = null; 
+			SqlRowList rs = null;
 			Map<Object, Object> map = FlexJsonUtil.fromJson(deviceLineMake);
 			Map<Object, Object> map1 = FlexJsonUtil.fromJson(dsl);
 	        Object linecode = map.get("DL_LINECODE");
@@ -1506,7 +1506,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			}
 			return null;
 		}
-		
+
 		//重新校验
 		@Override
 		public Map<String, Object> startCheck(String linecode) {
@@ -1516,8 +1516,8 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					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 unLoading(linecode);
-		}	
-		
+		}
+
 		//因为需要调用两次,所以封装了一个获取未校验站位的方法
 		private Map<String, Object> unLoading(String linecode){
 			SqlRowList rs = null;
@@ -1589,7 +1589,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			}
 			return mapR;
 		}
-	//用此方法来判断料卷是否我们自己的条码	
+	//用此方法来判断料卷是否我们自己的条码
 	private Boolean isOurBarcode(Object dsl_barcode){
 		SqlRowList rs = baseDao.queryForRowSet("select bar_prodcode from barcode where bar_code = ?",dsl_barcode);
 		if(rs.next()){
@@ -1650,7 +1650,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					+" 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);
 			if (rs.next()) {
-				Map<String,Object> map = new HashMap <String, Object>(); 
+				Map<String,Object> map = new HashMap <String, Object>();
 				map.put("count", rs.getResultList().size());
 				map.put("record", rs.getResultList());
 				return map;
@@ -1677,14 +1677,14 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 					+" where dsl_linecode=? and dsl_makecode=? and dsl_table=? and dsl_id not in (select min(dsl_id) from devsmtlocation "
 					+ "where dsl_linecode = ? and dsl_makecode =? and dsl_table = ? group by dsl_location) order by dsl_indate desc",dl_linecode,ma_code,table,dl_linecode,ma_code,table);
 			if (rs.next()) {
-				Map<String,Object> map = new HashMap <String, Object>(); 
+				Map<String,Object> map = new HashMap <String, Object>();
 				map.put("count", rs.getResultList().size());
 				map.put("record", rs.getResultList());
 				return map;
 			} else {
 				throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"无对应接料数据");
 			}
-		
+
 		}
 	/**
 	 * @author wuyx
@@ -1879,7 +1879,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 		public void updateMakePrepare(String id) {
 			baseDao.updateByCondition("MakePrepare","mp_pstatus = '已领料'","mp_id = "+id+"");
 		}
-		
+
 		@Override
 		public Map<String, Object> barcodeGetLocation(String barcode,String devicelineinfo) {
 			Map<String, Object> location = new HashMap<String, Object>();
@@ -1971,8 +1971,50 @@ public class PdaSMTServiceImpl implements PdaSMTService {
                 map.put("fe_code",fe_code);
                 map.put("fe_location",baseDao.getFieldDataByCondition("feeder","fe_location","fe_code='"+fe_code+"'"));
             }else{
-                throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达"+fe_code+"不存在");
+				if(baseDao.checkIf("DEVSMTLOCATION","dsl_location='"+fe_code+"'")){
+					map.put("fe_code","-");
+					map.put("fe_location",fe_code);
+				}else {
+					throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达或站位"+fe_code+"不存在");
+				}
             }
             return map;
         }
+
+	@Override
+	public Map<String, Object> getBarcodeByFeeder(String fe_code) {
+		Map<String, Object> map = new HashMap<String, Object>();
+		SqlRowList rs=baseDao.queryForRowSet("select fe_location,fe_barcode from feeder where fe_code='"+fe_code+"'");
+		if(rs.next()){
+			String fe_barcode=rs.getString("fe_barcode");
+			//飞达未绑定其他站位的时候
+			if(fe_barcode == null || ("").equals(fe_barcode)){
+				throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达"+fe_code+"未绑定料盘");
+			}
+			else{
+				map.put("fe_barcode",rs.getString("fe_barcode"));
+			}
+		}else {
+			throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达"+fe_code+"不存在");
+		}
+		return map;
+	}
+
+
+	@Override
+	public Map<String, Object> unBindFeeder(String fe_code) {
+		Map<String, Object> map = new HashMap<String, Object>();
+		SqlRowList rs=baseDao.queryForRowSet("select fe_location,fe_barcode from feeder where fe_code='"+fe_code+"'");
+		if(rs.next()){
+			String fe_location=rs.getString("fe_location");
+			//飞达未绑定其他站位的时候
+			if(fe_location != null && !("").equals(fe_location)){
+				throw new APIErrorException(APIErrorCode.DATA_NOT_FOUND, "飞达"+fe_code+"已绑定站位"+fe_location+",请执行下料操作");
+			}else
+			{
+				baseDao.execute("update feeder set fe_barcode='' where fe_code='"+fe_code +"'");
+			}
+		}
+		return map;
+	}
 }