oyq28 1 vuosi sitten
vanhempi
commit
e033730ca3

+ 4 - 3
src/main/java/com/imcs/admin/business/service/impl/BusinessServiceImpl.java

@@ -637,7 +637,7 @@ public class BusinessServiceImpl implements BusinessService{
 
         jdbcService.update("update a_defective_products set if_defective=1,updated_at=now(),updated_by=? where id=?",getUserId(),id);
 
-        String insertSql="INSERT INTO a_defective_products_detail (`defective_products_id`, `amount`, `ifDefective`, `created_at`, `created_by`, `seq`) VALUES (?, ?, ?, ?, ?, ?);\n";
+        String insertSql="INSERT INTO a_defective_products_detail (`defective_products_id`, `amount`, `ifDefective`, `created_at`, `created_by`, `seq`,remark) VALUES (?, ?, ?, ?, ?, ?,?);\n";
         StringBuffer insert=new StringBuffer("INSERT INTO a_work_report_record ( production_work_order_id, report_amount, created_at, created_by) " +
                 "VALUES ( ?, ?, ?, ?);");
         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 ( ?, ?, ?, ?, ?, ?, ?, ?, ?)";
@@ -645,14 +645,15 @@ public class BusinessServiceImpl implements BusinessService{
             Map m = list.get(i);
             Integer detailAmount = Integer.valueOf(m.get("amount").toString());
             Integer ifdefective = Integer.valueOf(m.get("ifdefective").toString());
-            jdbcService.insert("insert",insertSql,id,detailAmount,ifdefective,new Date(),getUserId(),i);
+            String remark = m.get("remark").toString();
+            jdbcService.insert("insert",insertSql,id,detailAmount,ifdefective,new Date(),getUserId(),i,remark);
 
             if (ifdefective==1){
                 jdbcService.update("update a_production_work_order set report_amount=report_amount+"+detailAmount+" where id=?",productionWorkOrderId);
                 jdbcService.insert("执行insert",insert.toString(),productionWorkOrderId,detailAmount,new Date(),getUserId());
             } else if (ifdefective==2) {
                 jdbcService.update("update a_production_work_order set scrap_amount=scrap_amount+"+detailAmount+" where id=?",productionWorkOrderId);
-                jdbcService.insert("执行sql",scrap,generateSerial.generateSerialNumber("aWorkScrap"),workCode,detailAmount,getUserId(),null,0,new Date(),productionWorkOrderId,null);
+                jdbcService.insert("执行sql",scrap,generateSerial.generateSerialNumber("aWorkScrap"),workCode,detailAmount,getUserId(),remark,0,new Date(),productionWorkOrderId,null);
             }
 
         }

+ 4 - 0
src/main/java/com/imcs/admin/page/controller/PageController.java

@@ -8,6 +8,7 @@ import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.poi.excel.ExcelUtil;
 import cn.hutool.poi.excel.ExcelWriter;
+import com.imcs.admin.business.service.BusinessService;
 import com.imcs.admin.common.*;
 import com.imcs.admin.db.service.JdbcService;
 import com.imcs.admin.page.constants.PageKey;
@@ -58,6 +59,7 @@ public class PageController {
     @Resource
     private PageButtonService pageButtonService;
 
+
     @Resource
     private ApiService apiService;
 
@@ -139,6 +141,8 @@ public class PageController {
                 pageParam.put(key.substring(Constants.QUERY_KEY_START.length()),value);
             }
         });
+
+
         return pageService.query(pageCode,pageParam);
     }
     @RequestMapping("/options/{pageCode}")

+ 24 - 0
src/main/java/com/imcs/admin/page/service/impl/PageServiceImpl.java

@@ -3,6 +3,8 @@ package com.imcs.admin.page.service.impl;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.spring.SpringUtil;
+import com.imcs.admin.business.service.BusinessService;
+import com.imcs.admin.business.service.impl.BusinessServiceImpl;
 import com.imcs.admin.common.*;
 import com.imcs.admin.db.data.ColumnMeta;
 import com.imcs.admin.db.service.JdbcService;
@@ -22,6 +24,7 @@ import com.imcs.admin.util.StringUtil;
 import com.imcs.admin.util.TemplateUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
@@ -44,6 +47,9 @@ public class PageServiceImpl extends AbstractCacheService<Page> implements PageS
     @Lazy
     TemplateService templateService;
 
+    @Autowired
+    BusinessServiceImpl businessService;
+
     @Override
     public Page load(String pageCode) {
         Page page = jdbcService.findOne(Page.class, "code", pageCode);
@@ -206,6 +212,7 @@ public class PageServiceImpl extends AbstractCacheService<Page> implements PageS
         }
         if(!dateFields.isEmpty()){
             for(Map<String,Object> item:result.getData().getItems()){
+                item.put("loginId",getUserId());
                 for(Map.Entry<String,PageResultField> en:dateFields.entrySet()){
                     Object value = item.get(en.getKey());
                     if(value != null){
@@ -494,6 +501,18 @@ public class PageServiceImpl extends AbstractCacheService<Page> implements PageS
         if(Whether.NO.equals(page.getOpenPage())){
             crudData.setCount(null);
         }
+
+        if("aProductionWorkOrder01_printer_copy".equals(pageCode) && StringUtils.isNotEmpty(pageParam.get("workCode").toString())){
+            String q__workCode = pageParam.get("workCode").toString();
+            Map<String, Object> one = jdbcService.findOne("select * from a_production_work_order where work_code = ? ", q__workCode);
+            if(one == null ){
+                throw new RuntimeException("任务不存在");
+            }
+            if(Integer.parseInt(one.get("status").toString()) == 0){
+                businessService.receive(Long.valueOf(one.get("id").toString()));
+            }
+        }
+
         return Result.success(crudData);
     }
 
@@ -594,4 +613,9 @@ public class PageServiceImpl extends AbstractCacheService<Page> implements PageS
         }
         return this.query(pageCode,pageParam);
     }
+
+    public Long getUserId(){
+        Long userId = SessionContext.getSession().getUserId();
+        return userId;
+    }
 }

+ 11 - 8
src/main/java/com/imcs/admin/rbac/controller/UserController.java

@@ -99,14 +99,17 @@ public class UserController {
         if(StringUtils.isBlank(username) || StringUtils.isBlank(password)){
             return Result.error("用户名/密码不能为空");
         }
-        //读卡机器手动输入验证码不方便,注释掉
-        /*if(StringUtils.isBlank(captcha)){
-            return Result.error("验证码不能为空");
-        }*/
- /*       if(StringUtils.isBlank(captchaCode) || captchaTimeout == null || captchaTimeout < System.currentTimeMillis() || !captchaCode.equalsIgnoreCase(captcha)){
-            return Result.error("验证码错误");
-        }*/
-
+        Map<String, Object> one = jdbcService.findOne("select value from dic_item where parent_id = (select id from dic where dic_code='verifyLogin') and label = '登录'");
+        Boolean value = Boolean.valueOf(one.get("value").toString());
+        if(value){
+            //读卡机器手动输入验证码不方便,注释掉
+            if(StringUtils.isBlank(captcha)){
+                return Result.error("验证码不能为空");
+            }
+            if(StringUtils.isBlank(captchaCode) || captchaTimeout == null || captchaTimeout < System.currentTimeMillis() || !captchaCode.equalsIgnoreCase(captcha)){
+                return Result.error("验证码错误");
+            }
+        }
         User user = jdbcService.findOne(User.class,new String[]{
                 "userCode"
         },new Object[]{

+ 8 - 5
src/main/java/com/imcs/admin/util/GenerateSerial.java

@@ -22,22 +22,25 @@ public class GenerateSerial {
     @Autowired
     private RedisTemplate redisTemplate;
 
+
+
     @Resource
-    private PageController pageController;
+    JdbcService jdbcService;
 
     private static final String redisPrefix="generateSerialNumber:";
 
     public String generateSerialNumber(String formCode){
-        PageParam pageParam=new PageParam();
+       /* PageParam pageParam=new PageParam();
         pageParam.put("q__code",formCode);
         pageParam.put("page",1);
         pageParam.put("perPage",1);
         Result<CrudData<Map<String, Object>>> serialNumber = pageController.crudQuery(pageParam, "serialNumber");
-        List<Map<String, Object>> rows = serialNumber.getData().getRows();
-        if(rows.isEmpty()){
+        List<Map<String, Object>> rows = serialNumber.getData().getRows();*/
+        Map<String, Object> stringObjectMap = jdbcService.findOne("select * from serial_number where code=?", formCode);
+
+        if(stringObjectMap.isEmpty()){
             throw new RuntimeException("无自动生成规则");
         }
-        Map<String, Object> stringObjectMap = rows.get(0);
         Integer serialLenth = Integer.valueOf(stringObjectMap.get("serialLenth").toString());
         String dateFormate = stringObjectMap.get("dateFormat").toString();
         String prefix = stringObjectMap.get("prefix").toString();