Selaa lähdekoodia

【功能完善】【镭雕、DCR接口增加工单号处理】

koul 1 vuosi sitten
vanhempi
commit
be4f2401d0
1 muutettua tiedostoa jossa 22 lisäystä ja 10 poistoa
  1. 22 10
      src/main/java/com/uas/eis/serviceImpl/MESDataServiceImpl.java

+ 22 - 10
src/main/java/com/uas/eis/serviceImpl/MESDataServiceImpl.java

@@ -246,6 +246,10 @@ public class MESDataServiceImpl implements MESDataService {
 	@Override
 	public ApiResult<Map<String,Object>> getQRCode(String data) {
 		Map<Object, Object> map = BaseUtil.parseFormStoreToMap(data);
+		String maCode = StringUtil.nvl(map.get("maCode"), "");
+		if ("".equals(maCode)){
+			return ApiResponse.failRsp("10018","请指定工单!");
+		}
 		String veCode = StringUtil.nvl(map.get("veCode"), "");
 		if ("".equals(veCode)){
 			return ApiResponse.failRsp("10011","供应商代码不能为空!");
@@ -266,22 +270,26 @@ public class MESDataServiceImpl implements MESDataService {
 		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")) {
-			SqlRowList rs = baseDao.queryForRowSet("select * 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 order by qr_id");
+		if (baseDao.checkIf("ProdQRCode","qr_macode='"+maCode+"' 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")) {
+			SqlRowList rs = baseDao.queryForRowSet("select * from ProdQRCode where qr_macode='"+maCode+"' 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 order by qr_id");
 			if (rs.next()) {
 				int qrId = rs.getGeneralInt("qr_id");
 				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_id=" + qrId);
 				baseDao.execute("update ProdQRCode set qr_isobtained=-1 where qr_id=" + qrId);
 				return ApiResponse.successRsp("0", "Success", "", maps.get(0));
 			}else
-				return ApiResponse.failRsp("10015","获取失败,请检查参数!");
+				return ApiResponse.failRsp("10016","获取失败,请检查参数!");
 		}else
-			return ApiResponse.failRsp("10015","获取失败,请检查参数!");
+			return ApiResponse.failRsp("10017","获取失败,请检查参数!");
 	}
 
 	@Override
 	public ApiResult<String> checkQRCode(String data) {
 		Map<Object, Object> map = BaseUtil.parseFormStoreToMap(data);
+		String maCode = StringUtil.nvl(map.get("maCode"), "");
+		if ("".equals(maCode)){
+			return ApiResponse.failRsp("10018","请指定工单!");
+		}
 		String veCode = StringUtil.nvl(map.get("veCode"), "");
 		if ("".equals(veCode)){
 			return ApiResponse.failRsp("10011","供应商代码不能为空!");
@@ -310,11 +318,11 @@ public class MESDataServiceImpl implements MESDataService {
 		if ("".equals(result)){
 			return ApiResponse.failRsp("10017","请确认校验结果!");
 		}
-		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")&&"OK".equals(result)){
-			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");
+		if (baseDao.checkIf("ProdQRCode","qr_macode='"+maCode+"' and 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")&&"OK".equals(result)){
+			baseDao.execute("update ProdQRCode set qr_ldischeck=-1,qr_ldcheckres='OK',qr_ldcheckdate=sysdate where qr_macode='"+maCode+"' and 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","","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");
+			baseDao.execute("update ProdQRCode set qr_ldischeck=-1,qr_ldcheckres='NG',qr_ldcheckdate=sysdate where qr_macode='"+maCode+"' and 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", "", "NG");
 		}
 
@@ -325,6 +333,10 @@ public class MESDataServiceImpl implements MESDataService {
 		String AE_MASTER = checkAccessKey(accessKey, requestId);
 		SpObserver.putSp(AE_MASTER);
 		Map<Object, Object> map = BaseUtil.parseFormStoreToMap(data);
+		String maCode = StringUtil.nvl(map.get("maCode"), "");
+		if ("".equals(maCode)){
+			return ApiResponse.failRsp("10018","请指定工单!");
+		}
 		String veCode = StringUtil.nvl(map.get("veCode"), "");
 		if ("".equals(veCode)){
 			return ApiResponse.failRsp("10011","供应商代码不能为空!");
@@ -349,11 +361,11 @@ public class MESDataServiceImpl implements MESDataService {
 		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");
+		if (baseDao.checkIf("ProdQRCode","qr_macode='"+maCode+"' and 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_macode='"+maCode+"' and 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");
+			baseDao.execute("update ProdQRCode set qr_dcrischeck=-1,qr_dcrcheckres='OK',qr_dcrcheckdate=sysdate where qr_macode='"+maCode+"' and 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");
 		}
 	}