Browse Source

印刷机接口添加

callm 1 month ago
parent
commit
369fef7879

+ 9 - 0
src/main/java/com/uas/eis/controller/MESHelperController.java

@@ -89,6 +89,15 @@ public class MESHelperController {
     }
 
 
+    //追溯信息接口
+    @RequestMapping(value="/PrintInfo")
+    public Map<Object,Object> PrintInfo(HttpServletRequest request,  @RequestBody String json){
+        Map<String, Object> modelMap = new HashMap<String, Object>();
+        Map<Object,Object> map = mesHelperService.PrintInfo(json);
+        return map;
+    }
+
+
     //
     //天马电子秤对接接口
     @RequestMapping(value="/Weigh")

+ 2 - 0
src/main/java/com/uas/eis/service/MESHelperService.java

@@ -20,6 +20,8 @@ public interface MESHelperService {
 
 	Map<Object, Object> SPITestInfo(String data);
 
+	Map<Object, Object> PrintInfo(String data);
+
 	Map<Object, Object> SendPlaceData(String data);
 
 	Map<Object, Object> StateEventDetail(String data);

+ 44 - 0
src/main/java/com/uas/eis/serviceImpl/MESHelperServiceImpl.java

@@ -713,6 +713,50 @@ public class MESHelperServiceImpl implements MESHelperService {
 		return rmap;
 	}
 
+	public Map<Object,Object> PrintInfo(String data){
+		Map<Object, Object> rmap = new HashMap<Object, Object>();
+		JSONObject object = JSONObject.fromObject(data);
+		JSONObject obj1=object.getJSONObject("Header");
+		JSONObject obj2=object.getJSONObject("Body");
+		if(obj1!=null){
+			String Command=obj1.get("Command").toString();
+			String SessionID=obj1.get("SessionID").toString();
+			String TimeStamp=obj1.get("TimeStamp").toString();
+			String Direction=obj1.get("Direction").toString();
+			String Vendor=obj1.get("Vendor").toString();
+			String Line=obj1.get("Line").toString();
+			String MachineSN=obj1.get("MachineSN").toString();
+			String MachineType=obj1.get("MachineType").toString();
+			String WorkOrder="";
+			String RecipeName="";
+			if(obj2!=null){
+				WorkOrder=obj2.get("WorkOrder").toString();
+				RecipeName=obj2.get("RecipeName").toString();
+			}
+			JSONArray BarcodeList = obj2.getJSONArray("BarcodeList");
+			for (int i=0;i<BarcodeList.size();i++){
+				String barcode=BarcodeList.get(i).toString();
+				int HEADERID=baseDao.getSeqId("ProductionInfo_seq");
+				baseDao.execute("insert into ProductionInfo(HEADERID, COMMAND, SESSIONID, TIMESTAMP, DIRECTION, VENDOR, LINE, " +
+						"MACHINESN, MACHINETYPE, WORKORDER, RECIPENAME, BARCODELIST)" +
+						"values('"+HEADERID+"','"+Command+"','"+SessionID+"',to_date(substr('"+TimeStamp+"',0,19),'yyyy-mm-dd hh24:mi:ss')" +
+						",'"+Direction+"','"+Vendor+"','"+Line+"','"+MachineSN+"','"+MachineType+"','"+WorkOrder+"','"+RecipeName+"'" +
+						",'"+barcode+"')");
+			}
+			Map<Object, Object> rmap1 = new HashMap<Object, Object>();
+			rmap1.put("Command","ProductionInfo");
+			rmap1.put("SessionID",SessionID);
+			rmap1.put("TimeStamp",TimeStamp);
+			rmap1.put("Direction","Response");
+			Map<Object, Object> rmap2 = new HashMap<Object, Object>();
+			rmap2.put("Code",200);
+			rmap2.put("Message","成功");
+			rmap.put("Header",rmap1);
+			rmap.put("Body",rmap2);
+		}
+		return rmap;
+	}
+
 	public String Time(String time){
 		return time.replaceAll("T"," ").substring(0,19);
 	}