|
@@ -34,6 +34,7 @@ import java.util.*;
|
|
|
|
|
|
import org.dom4j.DocumentHelper;
|
|
|
|
|
|
+import javax.print.DocFlavor;
|
|
|
import javax.xml.parsers.DocumentBuilder;
|
|
|
import javax.xml.parsers.DocumentBuilderFactory;
|
|
|
import javax.xml.parsers.ParserConfigurationException;
|
|
@@ -757,6 +758,118 @@ public class MESHelperServiceImpl implements MESHelperService {
|
|
|
return rmap;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<Object, Object> PrintCheck(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 FrontSqueegeeSN="";
|
|
|
+ String RearSqueegeeSN="";
|
|
|
+ String StencilSN="";
|
|
|
+ String PasteSN="";
|
|
|
+ if(obj2!=null){
|
|
|
+ FrontSqueegeeSN=obj2.get("FrontSqueegeeSN").toString();
|
|
|
+ RearSqueegeeSN=obj2.get("RearSqueegeeSN").toString();
|
|
|
+ StencilSN=obj2.get("StencilSN").toString();
|
|
|
+ PasteSN=obj2.get("PasteSN").toString();
|
|
|
+ }
|
|
|
+ int code = 200;
|
|
|
+ String returnmessage = "";
|
|
|
+ if(!baseDao.checkIf("Stencil","nvl(st_usestatus,'') = '在线' and st_code = '"+FrontSqueegeeSN+"'"))
|
|
|
+ {
|
|
|
+ code = 222;
|
|
|
+ returnmessage = returnmessage + "刮刀:"+FrontSqueegeeSN+"未在线,校验失败.\n";
|
|
|
+ }
|
|
|
+ if(!baseDao.checkIf("Stencil","nvl(st_usestatus,'') = '在线' and st_code = '"+RearSqueegeeSN+"'"))
|
|
|
+ {
|
|
|
+ code = 222;
|
|
|
+ returnmessage = returnmessage + "刮刀:"+RearSqueegeeSN+"未在线,校验失败.\n";
|
|
|
+ }
|
|
|
+ if(!baseDao.checkIf("Stencil","nvl(st_usestatus,'') = '在线' and st_code = '"+StencilSN+"'"))
|
|
|
+ {
|
|
|
+ code = 222;
|
|
|
+ returnmessage = returnmessage + "钢网:"+StencilSN+"未在线,校验失败.\n";
|
|
|
+ }
|
|
|
+ if(!baseDao.checkIf("SPMBARCODE","nvl(SPB_STATUS,'') = '已开封' and SPB_BARCODE = '"+PasteSN+"'"))
|
|
|
+ {
|
|
|
+ code = 222;
|
|
|
+ returnmessage = returnmessage + "锡膏:"+FrontSqueegeeSN+"未开封,校验失败.\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ 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",code);
|
|
|
+ rmap2.put("Message",returnmessage);
|
|
|
+ rmap.put("Header",rmap1);
|
|
|
+ rmap.put("Body",rmap2);
|
|
|
+ }
|
|
|
+ return rmap;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<Object, Object> PrintOnOffline(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 Action="";
|
|
|
+ String MaterialType="";
|
|
|
+ String MaterialSN="";
|
|
|
+ if(obj2!=null){
|
|
|
+ Action=obj2.get("Action").toString();
|
|
|
+ MaterialType=obj2.get("MaterialType").toString();
|
|
|
+ MaterialSN=obj2.get("MaterialSN").toString();
|
|
|
+ }
|
|
|
+ if(Action.equals("Online")&&!baseDao.checkIf("GKGINTO","GI_MATERIALTYPE = '"+MaterialType+"' and GI_MATERIALSN = '"+MaterialSN+"' and GI_LINE = '"+Line+"' and GI_OFFDATE is null")) {
|
|
|
+ int GKGINTOID = baseDao.getSeqId("GKGINTO_seq");
|
|
|
+ baseDao.execute("insert into GKGINTO(GI_ID,GI_COMMAND,GI_SESSIONID,GI_ONDATE,GI_DIRECTION,GI_VENDOR," +
|
|
|
+ "GI_LINE,GI_MACHINESN,GI_MACHINETYPE,GI_MATERIALTYPE,GI_MATERIALSN)" +
|
|
|
+ "values('" + GKGINTOID + "','" + Command + "','" + SessionID + "',to_date(substr('" + TimeStamp + "',0,19),'yyyy-mm-dd hh24:mi:ss')" +
|
|
|
+ ",'" + Direction + "','" + Vendor + "','" + Line + "','" + MachineSN + "','" + MachineType + "','" + MaterialType + "','" + MaterialSN + "'" +
|
|
|
+ ")");
|
|
|
+ } else if (Action.equals("OffLine")&&baseDao.checkIf("GKGINTO","GI_MATERIALTYPE = '"+MaterialType+"' and GI_MATERIALSN = '"+MaterialSN+"' and GI_LINE = '"+Line+"' and GI_OFFDATE is null"))
|
|
|
+ {
|
|
|
+ int outqty = baseDao.getCountByCondition("PRODUCTIONINFO"," LINE = '"+Line+"' AND TIMESTAMP BETWEEN " +
|
|
|
+ " (SELECT MAX(GI_ONDATE) FROM GKGINTO WHERE GI_MATERIALTYPE = '"+MaterialType+"' and GI_MATERIALSN = '"+MaterialSN+"' and GI_LINE = '"+Line+"' and GI_OFFDATE is null ) and to_date(substr('" + TimeStamp + "',0,19),'yyyy-mm-dd hh24:mi:ss') ");
|
|
|
+ baseDao.updateByCondition("GKGINTO","GI_OFFDATE = to_date(substr('" + TimeStamp + "',0,19),'yyyy-mm-dd hh24:mi:ss'),GI_OUTPUT = '"+outqty+"'","GI_MATERIALTYPE = '"+MaterialType+"' and GI_MATERIALSN = '"+MaterialSN+"' and GI_LINE = '"+Line+"' and GI_OFFDATE is null");
|
|
|
+ }
|
|
|
+ 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);
|
|
|
}
|