瀏覽代碼

【微浦MES】校验功能调整,按照已上料料卷号校验

caosy 4 年之前
父節點
當前提交
0209b387c8

+ 15 - 7
src/com/uas/mes/api/pda/PdaSMTController.java

@@ -1,18 +1,17 @@
 package com.uas.mes.api.pda;
 package com.uas.mes.api.pda;
 
 
-import java.util.List;
-import java.util.Map;
-
+import com.uas.mes.api.core.BaseApiController;
+import com.uas.mes.core.exception.APIErrorException;
+import com.uas.mes.core.exception.APIErrorException.APIErrorCode;
+import com.uas.mes.pda.service.PdaSMTService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.ui.ModelMap;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
-import com.uas.mes.api.core.BaseApiController;
-import com.uas.mes.core.exception.APIErrorException;
-import com.uas.mes.core.exception.APIErrorException.APIErrorCode;
-import com.uas.mes.pda.service.PdaSMTService;
+import java.util.List;
+import java.util.Map;
 
 
 @RestController("api.pdaSMTController")
 @RestController("api.pdaSMTController")
 @RequestMapping("/api/pda/smt")
 @RequestMapping("/api/pda/smt")
@@ -175,6 +174,15 @@ public class PdaSMTController extends BaseApiController{
 		pdaSMTService.joinForecastDataCheck(dsl,deviceLineMake);
 		pdaSMTService.joinForecastDataCheck(dsl,deviceLineMake);
 		return success();
 		return success();
 	}
 	}
+
+	/**
+	 * 校验功能条码校验
+	 */
+	@RequestMapping(value="/ForecastDataCheck.action",method = RequestMethod.POST)
+	public ModelMap ForecastDataCheck (String dsl,String deviceLineMake){
+		pdaSMTService.ForecastDataCheck(dsl,deviceLineMake);
+		return success();
+	}
 	
 	
 	/**
 	/**
 	 * 一进入上料界面,自动发送请求获取未上料站位
 	 * 一进入上料界面,自动发送请求获取未上料站位

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

@@ -39,6 +39,7 @@ public interface PdaSMTService {
 	List<Map<String, Object>> fuzzySearchProduct(String pr_code);
 	List<Map<String, Object>> fuzzySearchProduct(String pr_code);
 	
 	
 	void joinForecastDataCheck(String dsl,String deviceLineMake);
 	void joinForecastDataCheck(String dsl,String deviceLineMake);
+	void ForecastDataCheck(String dsl,String deviceLineMake);
 	
 	
 	Map<String, Object> getUnLoadingLocation (String linecode);
 	Map<String, Object> getUnLoadingLocation (String linecode);
 	
 	

+ 43 - 3
src/com/uas/mes/pda/service/impl/PdaSMTServiceImpl.java

@@ -1355,7 +1355,6 @@ public class PdaSMTServiceImpl implements PdaSMTService {
         Integer ps_id = 0;
         Integer ps_id = 0;
         Integer dl_id = 0;
         Integer dl_id = 0;
         boolean success = Boolean.valueOf(String.valueOf(map1.get("success")));
         boolean success = Boolean.valueOf(String.valueOf(map1.get("success")));
-		success = true;
         SqlRowList rs;
         SqlRowList rs;
         int cn=0;
         int cn=0;
         cn=baseDao.getCount("select count(1) from devsmtlocation where dsl_linecode='"+linecode+"' and dsl_table ='"+map.get("DL_TABLE")+"' and dsl_location = '"+map1.get("dsl_location")+"' and dsl_status = 0");
         cn=baseDao.getCount("select count(1) from devsmtlocation where dsl_linecode='"+linecode+"' and dsl_table ='"+map.get("DL_TABLE")+"' and dsl_location = '"+map1.get("dsl_location")+"' and dsl_status = 0");
@@ -1387,7 +1386,7 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			 i =-1;
 			 i =-1;
 			 meg = "校验失败";
 			 meg = "校验失败";
 		 }
 		 }
-		 baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"校验",meg+",料号:"+prodcode,linecode,location,i,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"):"");
+		 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
 		 //ps_id,table,linecode,ma_code,table
 		 Map<String,Object> mapR = new HashMap <String, Object>();
 		 Map<String,Object> mapR = new HashMap <String, Object>();
 		 rs=baseDao.queryForRowSet("select * from (select psl_location from(select min(psl_detno)psl_detno,psl_location from productsmtlocation "
 		 rs=baseDao.queryForRowSet("select * from (select psl_location from(select min(psl_detno)psl_detno,psl_location from productsmtlocation "
@@ -1494,7 +1493,48 @@ public class PdaSMTServiceImpl implements PdaSMTService {
 			}
 			}
 		}
 		}
 
 
-		//获取未上料站位
+	@Override
+	public void ForecastDataCheck(String dsl, String deviceLineMake) {
+		SqlRowList rs = null;
+		Map<Object, Object> map = FlexJsonUtil.fromJson(deviceLineMake);
+		Map<Object, Object> map1 = FlexJsonUtil.fromJson(dsl);
+		Object linecode = map.get("DL_LINECODE");
+		Object prodcode = map1.get("dsl_prodcode");
+		Object location = map1.get("dsl_location");
+		Object dl_prodcode = map.get("DL_PRODCODE");
+		boolean ifRecord = false;
+		ifRecord = baseDao.isDBSetting("smtcheckerrlog");
+		rs=baseDao.queryForRowSet("select dsl_barcode,dsl_prodcode from devsmtlocation where dsl_linecode=? and dsl_table =? and dsl_location = ? and dsl_status = 0  and dsl_barcode = ? order by dsl_indate desc",linecode,map.get("DL_TABLE"),map1.get("dsl_location"),prodcode);
+		if(rs.next()){
+			String dsl_barcode = rs.getString("dsl_barcode");
+			String dsl_prodcode = rs.getString("dsl_prodcode");
+			if(dsl_barcode != null && !("").equals(dsl_barcode)){
+				if(prodcode.equals(dsl_barcode)){
+					baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"接料原物料号校验","校验成功"+",料卷:"+prodcode,linecode,location,0,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"):"");
+				}else{
+					if(ifRecord){
+						baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"接料原物料号校验","原料卷校验失败"+",料号:"+prodcode,linecode,location,-1,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"):"");
+					}
+					throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"校验错误,料卷校验错误!");
+				}
+			}else{
+				if(!prodcode.equals(dsl_prodcode)){
+					if(ifRecord){
+						baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"接料原物料号校验","原物料校验失败"+",料号:"+prodcode,linecode,location,-1,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"):"");
+					}
+					throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"校验错误,物料校验错误!");
+				}
+				baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"接料原物料号校验","校验成功"+",料号:"+prodcode,linecode,location,0,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"):"");
+			}
+		}else{
+			if(ifRecord){
+				baseDao.execute(INSERT_SMTLOG,SystemSession.getUser().getEm_name(),"接料原物料号校验","校验失败,无上料记录"+",料号:"+prodcode,linecode,location,-1,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"):"");
+			}
+			throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"校验失败,无上料记录!");
+		}
+	}
+
+	//获取未上料站位
 		@Override
 		@Override
 		public Map<String, Object> getUnLoadingLocation(String linecode) {
 		public Map<String, Object> getUnLoadingLocation(String linecode) {
 			SqlRowList rs = null;
 			SqlRowList rs = null;