Pārlūkot izejas kodu

温度湿度 大屏展示

oyq28 1 gadu atpakaļ
vecāks
revīzija
c77e414776

+ 2 - 0
src/main/java/com/imcs/admin/business/service/BusinessService.java

@@ -31,4 +31,6 @@ public interface BusinessService {
     void scrapAmount(Long id, Map<String, Object> map);
 
     void updateSales(Long id);
+
+    void updateProcessProcedure(Long id);
 }

+ 16 - 5
src/main/java/com/imcs/admin/business/service/impl/BusinessServiceImpl.java

@@ -10,7 +10,6 @@ import com.imcs.admin.common.config.SessionContext;
 import com.imcs.admin.db.service.JdbcDao;
 import com.imcs.admin.db.service.JdbcService;
 import com.imcs.admin.util.GenerateSerial;
-import com.imcs.admin.util.StringUtil;
 import org.apache.commons.collections.map.HashedMap;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +18,8 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 @Transactional(rollbackFor = Exception.class)
 @Service
@@ -395,14 +396,24 @@ public class BusinessServiceImpl implements BusinessService{
         Integer planAmount = Integer.valueOf(one.get("planAmount").toString());
         Integer scrapAmount = Integer.valueOf(one.get("scrapAmount").toString());
         String scrapReason = map.get("scrapReason").toString();
+        String contractFile = map.get("contractFile").toString();
         if(reportAmount + amount + scrapAmount > planAmount){
             throw new RuntimeException("报工数量+报废数量超出生产数量,请核对报废数量!!!");
         }
+        //更新文件类型
+        if(map.containsKey("contractFile") && !Objects.isNull(map.get("contractFile"))){
+            String businessType = "3";
+            Pattern pattern = Pattern.compile("/([^/]+)/[^/]+\\.(\\w+)");
+            Matcher matcher = pattern.matcher(contractFile);
+            if (matcher.find()) {
+                String extractedString = matcher.group(1);
+                jdbcService.update("更新","update sys_file set business_type = ? where id = ? ",businessType,extractedString);
+            }
+        }
 
-
-        String scrap="INSERT INTO a_work_scrap ( scrap_code, work_code, scrap_amount, scrap_person, scrap_reason, apply_status, create_time, production_work_order_id) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?)";
-        jdbcService.insert("执行sql",scrap,generateSerial.generateSerialNumber("aWorkScrap"),workCode,amount,getUserId(),scrapReason,0,new Date(),id);
-        jdbcService.update("update a_production_work_order set scrap_amount=scrap_amount + ? where id = ?",amount,id);
+        String scrap="INSERT INTO a_work_scrap ( scrap_code, work_code, scrap_amount, scrap_person, scrap_reason, apply_status, create_time, production_work_order_id,scrap_file) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+        jdbcService.insert("执行sql",scrap,generateSerial.generateSerialNumber("aWorkScrap"),workCode,amount,getUserId(),scrapReason,0,new Date(),id,contractFile);
+        jdbcService.update("update a_production_work_order set scrap_amount=scrap_amount + ?,scrap_file = ? where id = ?",amount,contractFile,id);
     }
 
     public Long getUserId(){

+ 2 - 0
src/main/java/com/imcs/admin/common/data/SysFile.java

@@ -22,4 +22,6 @@ public class SysFile extends BaseData {
     private Date uploadTime;
     //文件类型
     private String contentType;
+
+    private Integer applyStatus;
 }

+ 1 - 0
src/main/java/com/imcs/admin/common/service/impl/SysFileServiceImpl.java

@@ -144,6 +144,7 @@ public class SysFileServiceImpl implements SysFileService {
         sysFile.setFileName(file.getOriginalFilename());
         sysFile.setUploadTime(new Date());
         sysFile.setContentType(file.getContentType());
+        sysFile.setApplyStatus(0);
         String suffix = "";
         if(sysFile.getFileName().contains(".")){
             suffix = sysFile.getFileName().substring(sysFile.getFileName().lastIndexOf(".")+1).toLowerCase();

+ 8 - 0
src/main/java/com/imcs/admin/page/controller/CommonController.java

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
+import com.imcs.admin.business.service.BusinessService;
 import com.imcs.admin.db.service.JdbcService;
 import com.imcs.admin.page.constants.Whether;
 import com.imcs.admin.page.data.Form;
@@ -54,6 +55,9 @@ public class CommonController {
     @Resource
     private GenerateSerial generateSerial;
 
+    @Resource
+    private BusinessService businessService;
+
 
 
     @PostMapping("/{formCode}/saveJson")
@@ -241,6 +245,10 @@ public class CommonController {
         try{
             jdbcService.transactionOption(()->{
                 jdbcService.saveOrUpdate(dbObj,tableName);
+                if("aProcessVersion".equals(formCode)){
+                    Long processVersionId = Long.valueOf(dbObj.get("id").toString());
+                    businessService.updateProcessProcedure(processVersionId);
+                }
                 for(InputTableData inputTableData:inputTableDataList){
                     List<Long> ids = new ArrayList<>();
                     ids.add(-1L);

+ 12 - 1
src/main/resources/static/admin/bigScreen/index.html

@@ -41,6 +41,14 @@
 <!--header-->
 <div class="header">
     <div class="bg_header">
+        <div class="temp">
+            <span id="temp"></span>
+            <img style="top: -8%;position: absolute;" src="../images/icons8-温度-64.png">
+        </div>
+        <div class="hum">
+            <span id="hum"></span>
+            <img style="top: -8%;position: absolute;    margin-left: 16%;" src="../images/icons8-湿度-60.png">
+        </div>
         <div onclick="fullScreen()">
             <img class="fullScreen" src="../images/icons8-全屏-50.png">
         </div>
@@ -116,7 +124,10 @@
 
                 // 获取接口返回的设备信息数组
                 const devices = resp.data.rows;
-
+                var temp=devices[0].temp;
+                var hum=devices[0].hum;
+                $('#temp').text(temp);
+                $('#hum').text(hum);
                 // 循环遍历设备信息数组
                 devices.forEach(device => {
                     // 创建一个新的 div 元素用于展示设备信息

+ 24 - 0
src/main/resources/static/admin/css/index.css

@@ -457,6 +457,20 @@
     mix-blend-mode: lighten;
     cursor: pointer;
 }
+.temp {
+    position: absolute;
+    top: 3%;
+    left: 3%;
+    mix-blend-mode: lighten;
+    cursor: pointer;
+}
+.hum {
+    position: absolute;
+    top: 3%;
+    left: 15%;
+    mix-blend-mode: lighten;
+    cursor: pointer;
+}
 
 /* 阻止第一个td换行 */
 .data_content .data_bottom div .main_table tbody tr td:first-child {
@@ -466,4 +480,14 @@
 /* 允许第二个td换行 */
 .data_content .data_bottom div .main_table tbody tr td:nth-child(2) {
     word-break: break-all;
+}
+
+#temp{
+    font-size:45px;
+    color: red;
+}
+
+#hum{
+    font-size:45px;
+    color: red;
 }

BIN
src/main/resources/static/admin/images/icons8-温度-64.png


BIN
src/main/resources/static/admin/images/icons8-湿度-60.png