|
@@ -13,17 +13,30 @@ import com.uas.eis.utils.*;
|
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
|
import net.sf.json.JsonConfig;
|
|
import net.sf.json.JsonConfig;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
+import org.dom4j.DocumentException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
+import org.w3c.dom.Document;
|
|
|
|
|
+import org.w3c.dom.Element;
|
|
|
|
|
+import org.w3c.dom.Node;
|
|
|
|
|
+import org.w3c.dom.NodeList;
|
|
|
|
|
+import org.xml.sax.SAXException;
|
|
|
import sun.awt.TimedWindowEvent;
|
|
import sun.awt.TimedWindowEvent;
|
|
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.sql.Timestamp;
|
|
import java.sql.Timestamp;
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+
|
|
|
|
|
+import org.dom4j.DocumentHelper;
|
|
|
|
|
+
|
|
|
|
|
+import javax.xml.parsers.DocumentBuilder;
|
|
|
|
|
+import javax.xml.parsers.DocumentBuilderFactory;
|
|
|
|
|
+import javax.xml.parsers.ParserConfigurationException;
|
|
|
|
|
+
|
|
|
|
|
+import org.xml.sax.InputSource;
|
|
|
|
|
+import java.io.StringReader;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
public class MESHelperServiceImpl implements MESHelperService {
|
|
public class MESHelperServiceImpl implements MESHelperService {
|
|
@@ -34,6 +47,126 @@ public class MESHelperServiceImpl implements MESHelperService {
|
|
|
@Value("${spring.datasource.username}")
|
|
@Value("${spring.datasource.username}")
|
|
|
private String username;
|
|
private String username;
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Map<Object,Object> Radium(String data) {
|
|
|
|
|
+ Map<String, Object> map=null;
|
|
|
|
|
+ Map<Object, Object> rmap = new HashMap<Object, Object>();
|
|
|
|
|
+ String oErrMessage="";
|
|
|
|
|
+ String UserName="";
|
|
|
|
|
+ try{
|
|
|
|
|
+ map =BaseUtil.convertJsonToMap(data);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ System.out.printf(e.getMessage()) ;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(map.get("SN")==null){
|
|
|
|
|
+ rmap.put("code",-1);
|
|
|
|
|
+ rmap.put("message","SN号不能为空");
|
|
|
|
|
+ return rmap;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(map.get("MO")==null){
|
|
|
|
|
+ rmap.put("code",-1);
|
|
|
|
|
+ rmap.put("message","工单号不能为空");
|
|
|
|
|
+ return rmap;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(map.get("SpecificationName")==null){
|
|
|
|
|
+ rmap.put("code",-1);
|
|
|
|
|
+ rmap.put("message","工序不能为空");
|
|
|
|
|
+ return rmap;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(map.get("UserName")==null){
|
|
|
|
|
+ rmap.put("code",-1);
|
|
|
|
|
+ rmap.put("message","用户不能为空");
|
|
|
|
|
+ return rmap;
|
|
|
|
|
+ }
|
|
|
|
|
+ String specificationName=map.get("SpecificationName").toString();
|
|
|
|
|
+ String MO=map.get("MO").toString();
|
|
|
|
|
+
|
|
|
|
|
+ Map<Object,Object> map1=BaseUtil.parseFormStoreToMap(map.get("SN").toString());
|
|
|
|
|
+ for (Map.Entry<Object, Object> entry : map1.entrySet()) {
|
|
|
|
|
+ Object key = entry.getKey();
|
|
|
|
|
+ Object value = entry.getValue();
|
|
|
|
|
+ oErrMessage+=GoMo(value.toString().toUpperCase(),MO, specificationName);
|
|
|
|
|
+ if(oErrMessage.equals("null")){
|
|
|
|
|
+ oErrMessage="";
|
|
|
|
|
+ }else{
|
|
|
|
|
+ rmap.put("code",-1);
|
|
|
|
|
+ rmap.put("message",oErrMessage);
|
|
|
|
|
+ return rmap;
|
|
|
|
|
+ }
|
|
|
|
|
+ oErrMessage+=CheckRoutePassed(value.toString().toUpperCase(),specificationName);
|
|
|
|
|
+ if(oErrMessage.equals("null")){
|
|
|
|
|
+ oErrMessage="";
|
|
|
|
|
+ }else{
|
|
|
|
|
+ rmap.put("code",-1);
|
|
|
|
|
+ rmap.put("message",oErrMessage);
|
|
|
|
|
+ return rmap;
|
|
|
|
|
+ }
|
|
|
|
|
+ oErrMessage+=SetPcbaData(value.toString().toUpperCase(),specificationName,UserName,"OK");
|
|
|
|
|
+ if(oErrMessage.equals("null")){
|
|
|
|
|
+ oErrMessage="";
|
|
|
|
|
+ }else{
|
|
|
|
|
+ rmap.put("code",-1);
|
|
|
|
|
+ rmap.put("message",oErrMessage);
|
|
|
|
|
+ return rmap;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(oErrMessage.equals("")||oErrMessage==null){
|
|
|
|
|
+ rmap.put("code",0);
|
|
|
|
|
+ rmap.put("message","镭射识别绑定成功");
|
|
|
|
|
+ return rmap;
|
|
|
|
|
+ }
|
|
|
|
|
+ return rmap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Map<Object,Object> SPI(String data) {
|
|
|
|
|
+ Map<Object, Object> rmap = new HashMap<Object, Object>();
|
|
|
|
|
+ try{
|
|
|
|
|
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
|
|
|
|
+ DocumentBuilder builder = factory.newDocumentBuilder();
|
|
|
|
|
+ try {
|
|
|
|
|
+ try{
|
|
|
|
|
+ Element root;
|
|
|
|
|
+ NodeList books;
|
|
|
|
|
+ Document document = builder.parse(new InputSource(new StringReader(data)));
|
|
|
|
|
+ root = document.getDocumentElement();
|
|
|
|
|
+ books = root.getChildNodes();
|
|
|
|
|
+ for (Node node = books.item(1).getFirstChild(); node != null; node = node.getNextSibling()) {
|
|
|
|
|
+ {
|
|
|
|
|
+ if (node.getNodeName().equals("UpdAOISPIRecord")) {
|
|
|
|
|
+ NodeList books1 = node.getChildNodes();
|
|
|
|
|
+ for (int i = 0; i < books1.getLength(); i++) {
|
|
|
|
|
+ Node node1 = books1.item(i);
|
|
|
|
|
+ if(!node1.getNodeName().equals("#text")){
|
|
|
|
|
+ System.out.printf("名称:"+node1.getNodeName());
|
|
|
|
|
+ System.out.printf("值:"+node1.getTextContent());
|
|
|
|
|
+ System.out.printf("类型:"+node1.getNodeType());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }catch (IOException e){
|
|
|
|
|
+ System.out.printf(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (SAXException e){
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }catch (ParserConfigurationException e){
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return rmap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Map<Object,Object> AOI(String data) {
|
|
|
|
|
+ Map<Object, Object> rmap = new HashMap<Object, Object>();
|
|
|
|
|
+ return rmap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public Map<Object,Object> Weigh(String data) {
|
|
public Map<Object,Object> Weigh(String data) {
|
|
|
Map<Object, Object> rmap = new HashMap<Object, Object>();
|
|
Map<Object, Object> rmap = new HashMap<Object, Object>();
|
|
@@ -248,6 +381,38 @@ public class MESHelperServiceImpl implements MESHelperService {
|
|
|
return rmap;
|
|
return rmap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private String GoMo(String iSN,String iMo,String iResCode){
|
|
|
|
|
+ Map<Object, Object> rmap = new HashMap<Object, Object>();
|
|
|
|
|
+ String oErrMessage=null;
|
|
|
|
|
+ List<String> list = new ArrayList<String>();
|
|
|
|
|
+ list = baseDao.callProcedureWithOut("CS_CHECKSTEPSNANDMACODE", new Object[]{
|
|
|
|
|
+ String.valueOf(iMo),
|
|
|
|
|
+ String.valueOf(iResCode),
|
|
|
|
|
+ String.valueOf(iSN),
|
|
|
|
|
+ String.valueOf("")
|
|
|
|
|
+ }, new Integer[]{1, 2, 3, 4}, new Integer[]{5, 6, 7});
|
|
|
|
|
+ oErrMessage=list.get(2);
|
|
|
|
|
+
|
|
|
|
|
+ SqlRowList rs = baseDao.queryForRowSet("select ms_status,ms_stepcode,ms_nextstepcode from makeserial where ms_id=( select max(ms_id) from makeserial where ms_sncode in ( select '" + iSN + "' from dual union select sn from makesnrelation where beforesn='" + iSN + "' and sn<>' ' union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' '))");
|
|
|
|
|
+ String ms_status = "";
|
|
|
|
|
+ String ms_stepcode = "";
|
|
|
|
|
+ String ms_nextstepcode = "";
|
|
|
|
|
+ if(rs.next()){
|
|
|
|
|
+ ms_status= rs.getString("ms_status");
|
|
|
|
|
+ ms_stepcode=rs.getString("ms_stepcode");
|
|
|
|
|
+ ms_nextstepcode=rs.getString("ms_nextstepcode");
|
|
|
|
|
+ }
|
|
|
|
|
+ String stepcode = GetStepCodeBySource(iResCode);
|
|
|
|
|
+ if ( oErrMessage == null || (ms_status == "3" && ms_stepcode == stepcode))
|
|
|
|
|
+ {
|
|
|
|
|
+ if (ms_status == "3")
|
|
|
|
|
+ {
|
|
|
|
|
+ oErrMessage = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return oErrMessage;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private Map<Object,Object> GetInfoByMaterial(JSONObject map){
|
|
private Map<Object,Object> GetInfoByMaterial(JSONObject map){
|
|
|
Map<Object, Object> rmap = new HashMap<Object, Object>();
|
|
Map<Object, Object> rmap = new HashMap<Object, Object>();
|
|
|
String iPCBA=null;
|
|
String iPCBA=null;
|
|
@@ -348,7 +513,7 @@ public class MESHelperServiceImpl implements MESHelperService {
|
|
|
String stepcode = GetStepCodeBySource(iResCode);
|
|
String stepcode = GetStepCodeBySource(iResCode);
|
|
|
if (ms_nextstepcode != "" && !ms_nextstepcode.equals(stepcode))
|
|
if (ms_nextstepcode != "" && !ms_nextstepcode.equals(stepcode))
|
|
|
{
|
|
{
|
|
|
- oErrMessage = "当前序列号下一工序" + ms_nextstepcode;
|
|
|
|
|
|
|
+ oErrMessage = "当前序列号"+iSN+"下一工序" + ms_nextstepcode;
|
|
|
}
|
|
}
|
|
|
return oErrMessage;
|
|
return oErrMessage;
|
|
|
}
|
|
}
|