|
|
@@ -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 + "'");
|