Browse Source

镭雕机、DCR接口处理

koul 1 year ago
parent
commit
93cedfea29

+ 37 - 0
src/main/java/com/uas/eis/controller/MESDataController.java

@@ -100,5 +100,42 @@ public class MESDataController {
         return ApiResponse.successRsp("0","Success",requestId,list);
     }
 
+    /**
+     * 镭雕机获取条码
+     * @param data
+     * @return
+     */
+    @RequestMapping("/api/mes/getQRCode")
+    public ApiResult<List<Map<String,Object>>> getQRCode(HttpServletRequest request, String data){
+        String accessKey = request.getHeader("AccessKey");
+        String requestId = request.getHeader("RequestId");
+        return mesDataService.getQRCode(accessKey,requestId,data);
+
+    }
+
+    /**
+     * 镭雕机 条码校验
+     * @param data
+     * @return
+     */
+    @RequestMapping("/api/mes/checkQRCode")
+    public ApiResult<String> checkQRCode(HttpServletRequest request, String data){
+        String accessKey = request.getHeader("AccessKey");
+        String requestId = request.getHeader("RequestId");
+        return mesDataService.checkQRCode(accessKey, requestId, data);
+    }
+
+    /**
+     * DCR 条码校验
+     * @param data
+     * @return
+     */
+    @RequestMapping("/api/mes/checkDCRQRCode")
+    public ApiResult<String> checkDCRQRCode(HttpServletRequest request, String data){
+        String accessKey = request.getHeader("AccessKey");
+        String requestId = request.getHeader("RequestId");
+        return mesDataService.checkDCRQRCode(accessKey, requestId, data);
+    }
+
 
 }

+ 1 - 2
src/main/java/com/uas/eis/core/config/DynamicDataSourceRegister.java

@@ -84,8 +84,7 @@ public class DynamicDataSourceRegister  implements ImportBeanDefinitionRegistrar
     private void initCustomDataSources(Environment env) {
         // 读取配置文件获取更多数据源,也可以通过defaultDataSource读取数据库获取更多数据源
     	/*DynamicDataSourceManage.setDataSourceType("UAS_DEV");
-    	List<Map<String , Object>> master = jdbcTemplate.queryForList("select MA_USER,MA_PWD from master");
-    	System.out.println(master);*/
+    	List<Map<String , Object>> master = jdbcTemplate.queryForList("select MA_USER,MA_PWD from master");*/
     	JdbcTemplate jdbcTemplate = new JdbcTemplate(defaultDataSource);  
     	List<Map<String , Object>> master = jdbcTemplate.queryForList("select MA_USER,MS_PWD from master");
     	// 读取主数据源

+ 2 - 7
src/main/java/com/uas/eis/core/support/ApiSignLoginInterceptor.java

@@ -72,8 +72,7 @@ public class ApiSignLoginInterceptor extends HandlerInterceptorAdapter {
         }
 
        /* String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
-        String s = UUID.randomUUID().toString();
-        System.out.println("uuid"+s);*/
+        String s = UUID.randomUUID().toString();*/
 
         String regex = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
         if (!requestId.matches(regex)) {
@@ -102,8 +101,7 @@ public class ApiSignLoginInterceptor extends HandlerInterceptorAdapter {
         params.put(TIMESTAMP_KEY,request.getHeader(TIMESTAMP_KEY));
         String originSign = request.getHeader(SIGN_KEY);
         String sign = createSign(params, accessSecret);
-        System.out.println(sign);
-
+        System.err.println(sign);
         return sign.equals(originSign);
     }
 
@@ -128,9 +126,6 @@ public class ApiSignLoginInterceptor extends HandlerInterceptorAdapter {
             temp.append(valueString);
         }
         temp.append("&").append(ACCESS_SECRET).append("=").append(accessSecret);
-        System.out.println(temp);
-        System.out.println(MD5Util.encrypt32Up(temp.toString()));
-       // System.out.println(MD5Util.getEncryption(temp.toString()));
         return MD5Util.encrypt32Up(temp.toString()).toUpperCase();
     }
 }

+ 0 - 4
src/main/java/com/uas/eis/core/support/MesHelperApiLoginInterceptor.java

@@ -63,7 +63,6 @@ public class MesHelperApiLoginInterceptor extends HandlerInterceptorAdapter {
         params.put(TIMESTAMP_KEY,request.getHeader(TIMESTAMP_KEY));
         String originSign = request.getHeader(SIGN_KEY);
         String sign = createSign(params, accessSecret);
-        System.out.println(sign);
 
         return sign.equals(originSign);
     }
@@ -89,9 +88,6 @@ public class MesHelperApiLoginInterceptor extends HandlerInterceptorAdapter {
             temp.append(valueString);
         }
         temp.append("&").append(ACCESS_SECRET).append("=").append(accessSecret);
-        System.out.println(temp);
-        System.out.println(MD5Util.encrypt32Up(temp.toString()));
-       // System.out.println(MD5Util.getEncryption(temp.toString()));
         return MD5Util.encrypt32Up(temp.toString()).toUpperCase();
     }
 }

+ 0 - 3
src/main/java/com/uas/eis/listener/UasProdInOutListener.java

@@ -229,7 +229,6 @@ public class UasProdInOutListener {
                     "        ]" +
                     "    }";*/
 
-            System.out.println("start----"+KingdeeFormId.SUBPICKMTRL.name());
             List<ProdInoutPickingF> fList = new ArrayList<ProdInoutPickingF>();
             ProdInoutPickingF  prodInoutPickingF= null;
             for(int i = 1; i< 10 ; i++) {
@@ -243,9 +242,7 @@ public class UasProdInOutListener {
                     build();
             CommonSaveReq commonSaveReq = new CommonSaveReq<ProdInoutPickingSaveReqModel>();
             commonSaveReq.setModel(reqModel);
-            System.out.println(JSONObject.fromObject(commonSaveReq).toString());
             String Result = client.save(KingdeeFormId.SUBPICKMTRL.getFormId(), JSONObject.fromObject(commonSaveReq).toString());
-            System.out.println(" success:" + Result);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 0 - 2
src/main/java/com/uas/eis/sdk/dto/SubPickmtrlReq.java

@@ -184,8 +184,6 @@ public class SubPickmtrlReq implements Serializable {
         JSONObject o = new JSONObject();
         o.put("SUPPLIERNO", SUPPLIERNO);
         o.put("ENTRY", JSONArray.fromObject(ENTRY).toString());
-        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!");
-        System.out.println(o.toString());
         return o.toString();
     }
 }

+ 0 - 2
src/main/java/com/uas/eis/sdk/webservice/SoapUtil.java

@@ -81,8 +81,6 @@ public class SoapUtil {
             entry.setENTRY_FSRCENTRYSEQ(1);
             entryList.add(entry);
             req.setENTRY(entryList);
-            System.out.println(req.toJSONString());
-           System.out.println( call.invoke(new Object[]{type, req.toJSONString()}));
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 9 - 0
src/main/java/com/uas/eis/service/MESDataService.java

@@ -1,5 +1,7 @@
 package com.uas.eis.service;
 
+import com.uas.eis.sdk.entity.ApiResult;
+
 import java.util.List;
 import java.util.Map;
 
@@ -16,4 +18,11 @@ public interface MESDataService {
 	List<Map<Object,Object>> makeBadReason(String accessKey, String requestId, String data);
 
 	List<Map<Object,Object>> packageDetail(String accessKey, String requestId, String data);
+
+	ApiResult<List<Map<String,Object>>> getQRCode(String accessKey, String requestId, String data);
+
+	ApiResult<String> checkQRCode(String accessKey, String requestId, String data);
+
+	ApiResult<String> checkDCRQRCode(String accessKey, String requestId, String data);
+
 }

+ 112 - 4
src/main/java/com/uas/eis/serviceImpl/MESDataServiceImpl.java

@@ -6,11 +6,9 @@ import com.uas.eis.dto.DataCenter;
 import com.uas.eis.entity.ErrorMessage;
 import com.uas.eis.exception.ApiSystemException;
 import com.uas.eis.sdk.entity.ApiResult;
+import com.uas.eis.sdk.resp.ApiResponse;
 import com.uas.eis.service.MESDataService;
-import com.uas.eis.utils.BaseUtil;
-import com.uas.eis.utils.Constant;
-import com.uas.eis.utils.DateUtil;
-import com.uas.eis.utils.SqlUtil;
+import com.uas.eis.utils.*;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -243,6 +241,116 @@ public class MESDataServiceImpl implements MESDataService {
 		return relist;
 	}
 
+	@Override
+	public ApiResult<List<Map<String,Object>>> getQRCode(String accessKey, String requestId, String data) {
+		String AE_MASTER = checkAccessKey(accessKey, requestId);
+		SpObserver.putSp(AE_MASTER);
+		Map<Object, Object> map = BaseUtil.parseFormStoreToMap(data);
+		String veCode = StringUtil.nvl(map.get("veCode"), "");
+		if ("".equals(veCode)){
+			return ApiResponse.failRsp("10011","供应商代码不能为空!");
+		}
+		String prodCode = StringUtil.nvl(map.get("prodCode"), "");
+		if ("".equals(prodCode)){
+			return ApiResponse.failRsp("10012","物料代码不能为空!");
+		}
+		String machineCode = StringUtil.nvl(map.get("machineCode"), "");
+		if ("".equals(machineCode)){
+			return ApiResponse.failRsp("10013","机台号不能为空!");
+		}
+		String version = StringUtil.nvl(map.get("version"), "");
+		if ("".equals(version)){
+			return ApiResponse.failRsp("10014","版本号不能为空!");
+		}
+		String indate = StringUtil.nvl(map.get("indate"), "");
+		if ("".equals(indate)){
+			return ApiResponse.failRsp("10015","请确认获取条码的具体时间!");
+		}
+		if (baseDao.checkIf("ProdQRCode","qr_vecode='" + veCode + "' and qr_prodcode='" + prodCode + "' and qr_machinecode='" + machineCode + "' and qr_version='" + version + "' and to_char(qr_date,'yyyy-MM-dd')='"+indate+"' and nvl(qr_isobtained,0)=0")) {
+			List<Map<String, Object>> maps = baseDao.queryForList("select to_char(qr_date,'yyyy-MM-dd') qr_date, qr_prodcode, qr_vecode, qr_version, qr_machinecode, qr_qty, qr_serianum, qr_code from ProdQRCode where qr_vecode='" + veCode + "' and qr_prodcode='" + prodCode + "' and qr_machinecode='" + machineCode + "' and qr_version='" + version + "' and to_char(qr_date,'yyyy-MM-dd')='"+indate+"' and nvl(qr_isobtained,0)=0");
+			baseDao.execute("update ProdQRCode set qr_isobtained=-1 where qr_vecode='" + veCode + "' and qr_prodcode='" + prodCode + "' and qr_machinecode='" + machineCode + "' and qr_version='" + version + "' and to_char(qr_date,'yyyy-MM-dd')='"+indate+"' and nvl(qr_isobtained,0)=0");
+			return ApiResponse.successRsp("0", "Success", requestId, maps);
+		}else
+			return ApiResponse.failRsp("10015","获取失败,请检查参数!");
+	}
+
+	@Override
+	public ApiResult<String> checkQRCode(String accessKey, String requestId, String data) {
+		String AE_MASTER = checkAccessKey(accessKey, requestId);
+		SpObserver.putSp(AE_MASTER);
+		Map<Object, Object> map = BaseUtil.parseFormStoreToMap(data);
+		String veCode = StringUtil.nvl(map.get("veCode"), "");
+		if ("".equals(veCode)){
+			return ApiResponse.failRsp("10011","供应商代码不能为空!");
+		}
+		String prodCode = StringUtil.nvl(map.get("prodCode"), "");
+		if ("".equals(prodCode)){
+			return ApiResponse.failRsp("10012","物料代码不能为空!");
+		}
+		String machineCode = StringUtil.nvl(map.get("machineCode"), "");
+		if ("".equals(machineCode)){
+			return ApiResponse.failRsp("10013","机台号不能为空!");
+		}
+		String version = StringUtil.nvl(map.get("version"), "");
+		if ("".equals(version)){
+			return ApiResponse.failRsp("10014","版本号不能为空!");
+		}
+		String indate = StringUtil.nvl(map.get("indate"), "");
+		if ("".equals(indate)){
+			return ApiResponse.failRsp("10015","请确认获取条码的具体时间!");
+		}
+		String QRCode = StringUtil.nvl(map.get("QRCode"), "");
+		if ("".equals(QRCode)){
+			return ApiResponse.failRsp("10016","条码不能为空!");
+		}
+		if (baseDao.checkIf("ProdQRCode","qr_code='"+QRCode+"' and qr_vecode='" + veCode + "' and qr_prodcode='" + prodCode + "' and qr_machinecode='" + machineCode + "' and qr_version='" + version + "' and to_char(qr_date,'yyyy-MM-dd')='"+indate+"' and nvl(qr_isobtained,0)<>0")){
+			baseDao.execute("update ProdQRCode set qr_ldischeck=-1,qr_ldcheckres='OK',qr_ldcheckdate=sysdate where qr_code='"+QRCode+"' and qr_vecode='" + veCode + "' and qr_prodcode='" + prodCode + "' and qr_machinecode='" + machineCode + "' and qr_version='" + version + "' and to_char(qr_date,'yyyy-MM-dd')='"+indate+"' and nvl(qr_isobtained,0)<>0");
+			return ApiResponse.successRsp("0","Success",requestId,"OK");
+		}else {
+			baseDao.execute("update ProdQRCode set qr_ldischeck=-1,qr_ldcheckres='NG',qr_ldcheckdate=sysdate where qr_code='"+QRCode+"' and qr_vecode='" + veCode + "' and qr_prodcode='" + prodCode + "' and qr_machinecode='" + machineCode + "' and qr_version='" + version + "' and to_char(qr_date,'yyyy-MM-dd')='"+indate+"' and nvl(qr_isobtained,0)<>0");
+			return ApiResponse.successRsp("0", "Success", requestId, "NG");
+		}
+
+	}
+
+	@Override
+	public ApiResult<String> checkDCRQRCode(String accessKey, String requestId, String data) {
+		String AE_MASTER = checkAccessKey(accessKey, requestId);
+		SpObserver.putSp(AE_MASTER);
+		Map<Object, Object> map = BaseUtil.parseFormStoreToMap(data);
+		String veCode = StringUtil.nvl(map.get("veCode"), "");
+		if ("".equals(veCode)){
+			return ApiResponse.failRsp("10011","供应商代码不能为空!");
+		}
+		String prodCode = StringUtil.nvl(map.get("prodCode"), "");
+		if ("".equals(prodCode)){
+			return ApiResponse.failRsp("10012","物料代码不能为空!");
+		}
+		String machineCode = StringUtil.nvl(map.get("machineCode"), "");
+		if ("".equals(machineCode)){
+			return ApiResponse.failRsp("10013","机台号不能为空!");
+		}
+		String version = StringUtil.nvl(map.get("version"), "");
+		if ("".equals(version)){
+			return ApiResponse.failRsp("10014","版本号不能为空!");
+		}
+		String indate = StringUtil.nvl(map.get("indate"), "");
+		if ("".equals(indate)){
+			return ApiResponse.failRsp("10015","请确认获取条码的具体时间!");
+		}
+		String QRCode = StringUtil.nvl(map.get("QRCode"), "");
+		if ("".equals(QRCode)){
+			return ApiResponse.failRsp("10016","条码不能为空!");
+		}
+		if (baseDao.checkIf("ProdQRCode","qr_code='"+QRCode+"' and qr_vecode='" + veCode + "' and qr_prodcode='" + prodCode + "' and qr_machinecode='" + machineCode + "' and qr_version='" + version + "' and to_char(qr_date,'yyyy-MM-dd')='"+indate+"' and nvl(qr_isobtained,0)<>0")){
+			baseDao.execute("update ProdQRCode set qr_dcrischeck=-1,qr_dcrcheckres='OK',qr_dcrcheckdate=sysdate where qr_code='"+QRCode+"' and qr_vecode='" + veCode + "' and qr_prodcode='" + prodCode + "' and qr_machinecode='" + machineCode + "' and qr_version='" + version + "' and to_char(qr_date,'yyyy-MM-dd')='"+indate+"' and nvl(qr_isobtained,0)<>0");
+			return ApiResponse.successRsp("0","Success",requestId,"OK");
+		}else {
+			baseDao.execute("update ProdQRCode set qr_dcrischeck=-1,qr_dcrcheckres='OK',qr_dcrcheckdate=sysdate where qr_code='"+QRCode+"' and qr_vecode='" + veCode + "' and qr_prodcode='" + prodCode + "' and qr_machinecode='" + machineCode + "' and qr_version='" + version + "' and to_char(qr_date,'yyyy-MM-dd')='"+indate+"' and nvl(qr_isobtained,0)<>0");
+			return ApiResponse.successRsp("0", "Success", requestId, "NG");
+		}
+	}
+
 	private String checkAccessKey(String accessKey,String requestId){
 		Object accessSecret_O = baseDao.getFieldDataByCondition("APIEMPLOYEE", "AE_SECRET", "AE_KEY='" + accessKey + "'");
 		Object AE_MASTER = baseDao.getFieldDataByCondition("APIEMPLOYEE", "AE_MASTER", "AE_KEY='" + accessKey + "'");

+ 0 - 1
src/main/java/com/uas/eis/utils/DateUtil.java

@@ -302,7 +302,6 @@ public class DateUtil {
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
-		// System.out.println("日期:"+DateStr+" : "+weekDay);
 		return weekDay;
 	}
 

+ 0 - 2
src/main/java/com/uas/eis/utils/HttpUtil.java

@@ -579,9 +579,7 @@ public class HttpUtil {
 				}
 			}
 			request.setEntity(new UrlEncodedFormEntity(nvps));
-			System.out.println(request);
 			response = httpClient.execute(request);
-			System.out.println(response);
 			return Response.getResponse(response);
 		} finally {
 			request.releaseConnection();

+ 1 - 0
src/main/resources/application.yml

@@ -16,6 +16,7 @@ spring:
 #        host: 10.1.81.208
 #        port: 26379
 server:
+    port: 8081
     tomcat:
         uri_encoding: UTF-8
     context-path: