|
@@ -67,40 +67,82 @@ public class DataCollectController {
|
|
// @Autowired
|
|
// @Autowired
|
|
// private ErpOrderInfoMapper erpOrderInfoMapper;
|
|
// private ErpOrderInfoMapper erpOrderInfoMapper;
|
|
|
|
|
|
- @RequestMapping("/insertCisData")
|
|
|
|
- public String insertCisData(@RequestBody List<TisTimeVO> tisList) {
|
|
|
|
-// List<TisTimeVO> tisTimeVOS = JSONArray.parseArray(jsonarray, TisTimeVO.class);
|
|
|
|
|
|
+ @RequestMapping("/checkCisData")
|
|
|
|
+ public List<TisTimeVO> checkCisData(@RequestBody List<TisTimeVO> tisList) {
|
|
if(!CollectionUtils.isEmpty(tisList)){
|
|
if(!CollectionUtils.isEmpty(tisList)){
|
|
- int count = 0;
|
|
|
|
for (TisTimeVO tisTimeVO : tisList) {
|
|
for (TisTimeVO tisTimeVO : tisList) {
|
|
String sqlQuery = "select top 1 iRealCOID from ca_batchmap where cMOCode = ? and iMOSubSN = ? ";
|
|
String sqlQuery = "select top 1 iRealCOID from ca_batchmap where cMOCode = ? and iMOSubSN = ? ";
|
|
try (Connection connection = sqlServerDataSource.getConnection()) {
|
|
try (Connection connection = sqlServerDataSource.getConnection()) {
|
|
PreparedStatement queryStmt = connection.prepareStatement(sqlQuery);
|
|
PreparedStatement queryStmt = connection.prepareStatement(sqlQuery);
|
|
- queryStmt.setString(1,tisTimeVO.getOrderId());
|
|
|
|
- queryStmt.setInt(2,tisTimeVO.getLine());
|
|
|
|
|
|
+ queryStmt.setString(1, tisTimeVO.getOrderId());
|
|
|
|
+ queryStmt.setInt(2, tisTimeVO.getLine());
|
|
ResultSet queryRs = queryStmt.executeQuery();
|
|
ResultSet queryRs = queryStmt.executeQuery();
|
|
if (queryRs.next()) {
|
|
if (queryRs.next()) {
|
|
tisTimeVO.setCoId(queryRs.getString("iRealCOID"));
|
|
tisTimeVO.setCoId(queryRs.getString("iRealCOID"));
|
|
- String sqlInsert = "insert into CA_DayTiS(cPPID,iRealWkt,dDate) values(?,?,?)";
|
|
|
|
- PreparedStatement insertStmt = connection.prepareStatement(sqlInsert);
|
|
|
|
- insertStmt.setString(1,tisTimeVO.getCoId());
|
|
|
|
- insertStmt.setBigDecimal(2,tisTimeVO.getWorkTime());
|
|
|
|
- insertStmt.setString(3,tisTimeVO.getDateStr());
|
|
|
|
- int i = insertStmt.executeUpdate();
|
|
|
|
- if(i>0){
|
|
|
|
- count++;
|
|
|
|
|
|
+ }
|
|
|
|
+ } catch (SQLException e) {
|
|
|
|
+ System.err.println("数据库操作错误: " + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return tisList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/insertCisData")
|
|
|
|
+ public String insertCisData(@RequestBody List<TisTimeVO> tisList) {
|
|
|
|
+ if(!CollectionUtils.isEmpty(tisList)){
|
|
|
|
+ int count = 0;
|
|
|
|
+ for (TisTimeVO tisTimeVO : tisList) {
|
|
|
|
+ String sqlInsert = "insert into CA_DayTiS(cPPID,iRealWkt,dDate) values(?,?,?)";
|
|
|
|
+ try (Connection connection = sqlServerDataSource.getConnection()) {
|
|
|
|
+ PreparedStatement insertStmt = connection.prepareStatement(sqlInsert);
|
|
|
|
+ insertStmt.setString(1,tisTimeVO.getCoId());
|
|
|
|
+ insertStmt.setBigDecimal(2,tisTimeVO.getWorkTime());
|
|
|
|
+ insertStmt.setString(3,tisTimeVO.getDateStr());
|
|
|
|
+ int i = insertStmt.executeUpdate();
|
|
|
|
+ if(i>0){
|
|
|
|
+ count++;
|
|
// System.out.println("执行成功");
|
|
// System.out.println("执行成功");
|
|
- }else{
|
|
|
|
- System.out.println(tisTimeVO.getCoId()+"执行失败");
|
|
|
|
- }
|
|
|
|
|
|
+ }else{
|
|
|
|
+ System.out.println(tisTimeVO.getCoId()+"执行失败");
|
|
}
|
|
}
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
System.err.println("数据库操作错误: " + e.getMessage());
|
|
System.err.println("数据库操作错误: " + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
System.out.println("本批次总数量:"+tisList.size()+",成功插入条数:"+count);
|
|
System.out.println("本批次总数量:"+tisList.size()+",成功插入条数:"+count);
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+// List<TisTimeVO> tisTimeVOS = JSONArray.parseArray(jsonarray, TisTimeVO.class);
|
|
|
|
+// if(!CollectionUtils.isEmpty(tisList)){
|
|
|
|
+// int count = 0;
|
|
|
|
+// for (TisTimeVO tisTimeVO : tisList) {
|
|
|
|
+// String sqlQuery = "select top 1 iRealCOID from ca_batchmap where cMOCode = ? and iMOSubSN = ? ";
|
|
|
|
+// try (Connection connection = sqlServerDataSource.getConnection()) {
|
|
|
|
+// PreparedStatement queryStmt = connection.prepareStatement(sqlQuery);
|
|
|
|
+// queryStmt.setString(1,tisTimeVO.getOrderId());
|
|
|
|
+// queryStmt.setInt(2,tisTimeVO.getLine());
|
|
|
|
+// ResultSet queryRs = queryStmt.executeQuery();
|
|
|
|
+// if (queryRs.next()) {
|
|
|
|
+// tisTimeVO.setCoId(queryRs.getString("iRealCOID"));
|
|
|
|
+// String sqlInsert = "insert into CA_DayTiS(cPPID,iRealWkt,dDate) values(?,?,?)";
|
|
|
|
+// PreparedStatement insertStmt = connection.prepareStatement(sqlInsert);
|
|
|
|
+// insertStmt.setString(1,tisTimeVO.getCoId());
|
|
|
|
+// insertStmt.setBigDecimal(2,tisTimeVO.getWorkTime());
|
|
|
|
+// insertStmt.setString(3,tisTimeVO.getDateStr());
|
|
|
|
+// int i = insertStmt.executeUpdate();
|
|
|
|
+// if(i>0){
|
|
|
|
+// count++;
|
|
|
|
+//// System.out.println("执行成功");
|
|
|
|
+// }else{
|
|
|
|
+// System.out.println(tisTimeVO.getCoId()+"执行失败");
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// } catch (SQLException e) {
|
|
|
|
+// System.err.println("数据库操作错误: " + e.getMessage());
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// System.out.println("本批次总数量:"+tisList.size()+",成功插入条数:"+count);
|
|
|
|
+// }
|
|
return "ok";
|
|
return "ok";
|
|
}
|
|
}
|
|
|
|
|