|
@@ -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);
|
|
|
}
|