123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- package com.uas.eis.controller;
- import com.uas.eis.sdk.entity.ApiResult;
- import com.uas.eis.sdk.resp.ApiResponse;
- import com.uas.eis.service.MESHelperService;
- import org.dom4j.Document;
- import org.dom4j.DocumentHelper;
- import org.dom4j.Element;
- import org.dom4j.io.OutputFormat;
- import org.dom4j.io.XMLWriter;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import javax.servlet.http.HttpServletRequest;
- import java.io.IOException;
- import java.io.StringWriter;
- import java.util.HashMap;
- import java.util.Map;
- @RestController
- @RequestMapping("/MES/helper")
- public class MESHelperController {
- @Autowired
- private MESHelperService mesHelperService;
- @RequestMapping(value="/dllMain")
- public ApiResult<Map<Object,Object>> DLLMain(HttpServletRequest request, @RequestBody String data){
- Map<String, Object> modelMap = new HashMap<String, Object>();
- String accessKey = request.getHeader("AccessKey");
- String requestId = request.getHeader("RequestId");
- Map<Object,Object> map = mesHelperService.DLLMain(accessKey,requestId,data);
- return ApiResponse.successRsp(requestId,map);
- }
-
- @RequestMapping(value="/StateEventDetail")
- public Map<Object,Object> StateEventDetail(HttpServletRequest request, @RequestBody String json){
- Map<String, Object> modelMap = new HashMap<String, Object>();
- Map<Object,Object> map = mesHelperService.StateEventDetail(json);
- return map;
- }
-
- @RequestMapping(value="/SendPlaceData")
- public Map<Object,Object> SendPlaceData(HttpServletRequest request, @RequestBody String json){
- Map<String, Object> modelMap = new HashMap<String, Object>();
- Map<Object,Object> map = mesHelperService.SendPlaceData(json);
- return map;
- }
-
- @RequestMapping(value="/SetupResultDataInterface")
- public Map<Object,Object> SetupResultDataInterface(HttpServletRequest request, @RequestBody String json){
- Map<String, Object> modelMap = new HashMap<String, Object>();
- Map<Object,Object> map = mesHelperService.SetupResultDataInterface(json);
- return map;
- }
-
- @RequestMapping(value="/TraceabilityDataInterface")
- public Map<Object,Object> TraceabilityDataInterface(HttpServletRequest request, @RequestBody String json){
- Map<String, Object> modelMap = new HashMap<String, Object>();
- Map<Object,Object> map = mesHelperService.TraceabilityDataInterface(json);
- return map;
- }
-
- @RequestMapping(value="/XrayTestDataSave")
- public Map<Object,Object> XrayTestDataSave(HttpServletRequest request, @RequestBody String json){
- Map<String, Object> modelMap = new HashMap<String, Object>();
- Map<Object,Object> map = mesHelperService.XrayTestDataSave(json);
- return map;
- }
-
-
- @RequestMapping(value="/Weigh")
- public Map<Object,Object> Weigh(HttpServletRequest request, @RequestBody String json){
- Map<String, Object> modelMap = new HashMap<String, Object>();
- Map<Object,Object> map = mesHelperService.Weigh(json);
- return map;
- }
-
- @RequestMapping(value="/Radium")
- public Map<Object,Object> Radium(HttpServletRequest request, @RequestBody String json){
- Map<String, Object> modelMap = new HashMap<String, Object>();
- Map<Object,Object> map = mesHelperService.Radium(json);
- return map;
- }
-
- @RequestMapping(value="/SPI")
- public Map<Object,Object> SPI(HttpServletRequest request, @RequestBody String json){
- Map<String, Object> modelMap = new HashMap<String, Object>();
- Map<Object,Object> map = mesHelperService.SPI(json);
- return map;
- }
-
- @RequestMapping(value="/AOI")
- public String AOI(HttpServletRequest request,@RequestBody String Data,String Username,String Shiftname, String MachineNO, String LineNO, String procedure,String Moname,
- String Lotsn,String Side,String Result,String Defect,String elementQTY,String TestQTY,String Type,String Time) {
- Data=Data+"1";
- Element root = DocumentHelper.createElement("Data");
- Document document = DocumentHelper.createDocument(root);
- String Err=mesHelperService.AOI( Username, Shiftname, MachineNO, LineNO, procedure, Moname,
- Lotsn, Side, Result, Defect, elementQTY, TestQTY, Type, Time);
- Element element1 = root.addElement("Result");
- Element element2 = root.addElement("ErrMsg");
- if(Err.equals("")||Err==null){
- element1.setText("OK");
- element2.setText("");
- }else{
- element1.setText("NG");
- element2.setText(Err);
- }
- StringWriter stringWriter = new StringWriter();
- OutputFormat format = OutputFormat.createPrettyPrint();
- XMLWriter xmlWriter = new XMLWriter(stringWriter, format);
- try {
- xmlWriter.write(document);
- } catch (IOException e) {
- e.printStackTrace();
- }
- String xmlString = stringWriter.toString();
- return xmlString;
- }
-
- @RequestMapping(value="/UploadSteel",method = RequestMethod.POST)
- public String UploadSteel(HttpServletRequest request,String SteelMeshCode,String scraperCode, String SteelMeshCount, String scraperCount, String datatime) {
- Element root = DocumentHelper.createElement("Data");
- Document document = DocumentHelper.createDocument(root);
- String Err=mesHelperService.UploadSteel( SteelMeshCode, scraperCode, SteelMeshCount, scraperCount, datatime);
- Element element1 = root.addElement("Result");
- Element element2 = root.addElement("ErrMsg");
- if(Err.equals("")||Err==null){
- element1.setText("OK");
- element2.setText("");
- }else{
- element1.setText("NG");
- element2.setText(Err);
- }
- StringWriter stringWriter = new StringWriter();
- OutputFormat format = OutputFormat.createPrettyPrint();
- XMLWriter xmlWriter = new XMLWriter(stringWriter, format);
- try {
- xmlWriter.write(document);
- } catch (IOException e) {
- e.printStackTrace();
- }
- String xmlString = stringWriter.toString();
- return xmlString;
- }
-
- @RequestMapping(value="/CheckSteel")
- public String CheckSteel(HttpServletRequest request, String SteelMeshCode) {
- Element root = DocumentHelper.createElement("Data");
- Document document = DocumentHelper.createDocument(root);
- String Err=mesHelperService.CheckSteel(SteelMeshCode);
- Element element1 = root.addElement("Result");
- Element element2 = root.addElement("ErrMsg");
- if(Err.equals("")||Err==null){
- element1.setText("OK");
- element2.setText("");
- }else{
- element1.setText("NG");
- element2.setText(Err);
- }
- StringWriter stringWriter = new StringWriter();
- OutputFormat format = OutputFormat.createPrettyPrint();
- XMLWriter xmlWriter = new XMLWriter(stringWriter, format);
- try {
- xmlWriter.write(document);
- } catch (IOException e) {
- e.printStackTrace();
- }
- String xmlString = stringWriter.toString();
- return xmlString;
- }
-
- @RequestMapping(value="/getMESSnCode")
- public Map<Object,Object> GetMESSnCode(HttpServletRequest request, @RequestBody String json){
- return mesHelperService.getMESSnCode(json);
- }
-
- @RequestMapping(value="/getMakeSnCode")
- public Map<Object,Object> getMakeSnCode(HttpServletRequest request, @RequestBody String json){
- return mesHelperService.getMakeSnCode(json);
- }
-
- @RequestMapping(value="/getMainAllSnCode")
- public Map<Object,Object> getMainAllSnCode(HttpServletRequest request, @RequestBody String json){
- return mesHelperService.getMainAllSnCode(json);
- }
-
- @RequestMapping(value="/countQTY")
- public Map<Object,Object> countQTY(HttpServletRequest request, @RequestBody String json){
- return mesHelperService.countQTY(json);
- }
- }
|