Browse Source

2024修改

luguang 8 months ago
parent
commit
8fa6659ebb

+ 3 - 3
src/main/java/com/sy/coinage/core/util/ExcelExportUtil.java

@@ -244,7 +244,7 @@ public class ExcelExportUtil<T> {
                     cell_0.setCellValue(i + 1);
                     XSSFCell cell_1 = row.createCell(1);
                     cell_1.setCellStyle(style);
-                    cell_1.setCellValue(DateUtils.toString(t.getCreateTime()));
+                    cell_1.setCellValue(DateUtils.toString(t.getCreateTime(), DateUtils.YY_MM_DD_HH_mm_ss));
                     XSSFCell cell_2 = row.createCell(2);
                     if (t.getRedFlashFlag() != null && t.getRedFlashFlag().intValue() == 1) {
                         cell_2.setCellStyle(style);
@@ -467,7 +467,7 @@ public class ExcelExportUtil<T> {
                 cell_0.setCellValue(i + 1);
                 XSSFCell cell_1 = row.createCell(1);
                 cell_1.setCellStyle(style);
-                cell_1.setCellValue(DateUtils.toString(t.getCreateTime()));
+                cell_1.setCellValue(DateUtils.toString(t.getCreateTime(), DateUtils.YY_MM_DD_HH_mm_ss));
                 // 摘要
                 XSSFCell cell_2 = row.createCell(2);
                 if (t.getRedFlashFlag() != null && t.getRedFlashFlag().intValue() == 1) {
@@ -584,7 +584,7 @@ public class ExcelExportUtil<T> {
                 cell_0.setCellValue(i + 1);
                 XSSFCell cell_1 = row.createCell(1);
                 cell_1.setCellStyle(style);
-                cell_1.setCellValue(DateUtils.toString(t.getCreateTime()));
+                cell_1.setCellValue(DateUtils.toString(t.getCreateTime(), DateUtils.YY_MM_DD_HH_mm_ss));
                 // 摘要
                 XSSFCell cell_2 = row.createCell(2);
                 if (t.getRedFlashFlag() != null && t.getRedFlashFlag().intValue() == 1) {

+ 50 - 2
src/main/java/com/sy/coinage/workshop/controller/BaseInfoController.java

@@ -2,6 +2,8 @@ package com.sy.coinage.workshop.controller;
 
 import com.sy.coinage.core.redis.RedisService;
 import com.sy.coinage.core.util.DateUtils;
+import com.sy.coinage.sys.model.Dept;
+import com.sy.coinage.sys.service.IDeptService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -49,7 +51,7 @@ public class BaseInfoController extends BaseController {
     private IBaseInfoService baseInfoService;
 
     @Autowired
-    private RedisService redisService;
+    private IDeptService deptService;
 
     //=========pc接口
     @ApiOperation(value = "rfid基础信息登记列表")
@@ -71,7 +73,7 @@ public class BaseInfoController extends BaseController {
         queryWrapper.eq(req.getDeptId() != null && req.getDeptId() > 0, BaseInfo::getDeptId,
                 req.getDeptId());
         if (req.getQualityStatus() != null && req.getQualityStatus() > 0) {
-            if (req.getQualityStatus().intValue() == 1) {
+            if (req.getQualityStatus().intValue() == 2) {
                 queryWrapper.and(qw -> {
                     qw.eq(BaseInfo::getQualityStatus, req.getQualityStatus())
                             .or().isNull(BaseInfo::getQualityStatus);
@@ -106,6 +108,52 @@ public class BaseInfoController extends BaseController {
         return data;
     }
 
+    @ApiOperation(value = "rfid基础信息登记表分页列表")
+    @PostMapping("/page1")
+    @ActiveFastJsonProfile(groups = "list", clazz = BaseInfo.class)
+    public IPage<BaseInfo> page1(@RequestBody BaseInfoListReq req, @CurrentUser CacheUserVO user) {
+
+        Dept dept = this.deptService.getById(user.getDeptId());
+        LambdaQueryWrapper<BaseInfo> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.gt(BaseInfo::getId, 0); // 没条件时 排序生效
+        queryWrapper.and(qw -> {
+            qw.eq(BaseInfo::getLocWareId, dept.getRemark())
+                    .or().isNull(BaseInfo::getLocWareId);
+        });
+        if (req.getQualityStatus() != null && req.getQualityStatus() > 0) {
+            if (req.getQualityStatus().intValue() == 2) {
+                queryWrapper.and(qw -> {
+                    qw.eq(BaseInfo::getQualityStatus, req.getQualityStatus())
+                            .or().isNull(BaseInfo::getQualityStatus);
+                });
+            } else {
+                queryWrapper.eq(BaseInfo::getQualityStatus, req.getQualityStatus());
+            }
+        }
+        queryWrapper.eq(req.getSecuritiesId() != null && req.getSecuritiesId() > 0, BaseInfo::getSecuritiesId, req.getSecuritiesId());
+        if (req.getStartDate() != null) {
+            queryWrapper.ge(BaseInfo::getWeightDate, DateUtils.getDayStartTime(req.getStartDate()));
+        }
+        if (req.getEndDate() != null) {
+            queryWrapper.le(BaseInfo::getWeightDate, DateUtils.getDayEndTime(req.getEndDate()));
+        }
+        if (req.getDeliveryStartDate() != null) {
+            queryWrapper.le(BaseInfo::getDeliveryTime, DateUtils.getDayStartTime(req.getDeliveryStartDate()));
+        }
+        if (req.getDeliveryEndDate() != null) {
+            queryWrapper.ge(BaseInfo::getDeliveryTime, DateUtils.getDayEndTime(req.getDeliveryEndDate()));
+        }
+        if (StringUtils.isNotBlank(req.getCrown())) {
+            queryWrapper.eq(BaseInfo::getSerialNumber, req.getCrown());
+
+        }
+        //按照创建时间倒序排列
+        queryWrapper.orderByDesc(BaseInfo::getCreateTime);
+        Page<BaseInfo> page = new Page<>(req.getPage(), req.getRows());
+        IPage<BaseInfo> data = this.baseInfoService.queryPageList(page, queryWrapper);
+        return data;
+    }
+
     @ApiOperation(value = "新拍记录分页列表")
     @PostMapping("/newPalletPage")
     @ActiveFastJsonProfile(groups = "list", clazz = BaseInfo.class)

+ 3 - 3
src/main/java/com/sy/coinage/workshop/controller/WorkshopAccountController.java

@@ -237,10 +237,10 @@ public class WorkshopAccountController extends BaseController {
 
     @ApiOperation(value = "生成当日台账")
     @Operation(value = "生成当日台账")
-    @GetMapping("/createAccount")
+    @PostMapping("/createAccount")
 //    @Permission("workshopAccount:add")
-    public Object createAccount(@CurrentUser CacheUserVO user) {
-        this.workshopAccountService.createAccount(user);
+    public Object createAccount(@RequestBody @Valid CreateAccountReq req, @CurrentUser CacheUserVO user) {
+        this.workshopAccountService.createAccount(req.getCreateDate(), user);
         return "";
     }
 

+ 1 - 1
src/main/java/com/sy/coinage/workshop/model/WorkshopAccount.java

@@ -130,7 +130,7 @@ public class WorkshopAccount implements Serializable {
      */
     @ApiModelProperty(value = "创建时间")
     @TableField(value = "create_time")
-    @JSONField(format = "yyyy-MM-dd")
+    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
     /**
      * -红冲标识 1:普通 2:红冲数据(抽检、返检) -10

+ 16 - 0
src/main/java/com/sy/coinage/workshop/req/CreateAccountReq.java

@@ -0,0 +1,16 @@
+package com.sy.coinage.workshop.req;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+@Data
+public class CreateAccountReq {
+
+    @JSONField(format = "yyyy-MM-dd")
+    @NotNull(message = "日期不能为空")
+    private Date createDate;
+
+}

+ 3 - 1
src/main/java/com/sy/coinage/workshop/service/IWorkshopAccountService.java

@@ -7,6 +7,8 @@ import com.sy.coinage.workshop.req.*;
 import com.sy.coinage.workshop.vo.*;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Date;
+
 /**
  * -IService
  */
@@ -55,7 +57,7 @@ public interface IWorkshopAccountService extends IService<WorkshopAccount> {
                 Integer statType, Integer type, String digest, Integer wareId, Integer securitiesId,
                 String securities);
 
-    void createAccount(CacheUserVO user);
+    void createAccount(Date d, CacheUserVO user);
 
     Integer getLastInventory(Integer securitiesId, Integer deptId);
 }

+ 5 - 2
src/main/java/com/sy/coinage/workshop/service/impl/WorkshopAccountServiceImpl.java

@@ -268,7 +268,7 @@ public class WorkshopAccountServiceImpl extends ServiceImpl<WorkshopAccountDao,
     }
 
     @Override
-    public void createAccount(CacheUserVO user) {
+    public void createAccount(Date d, CacheUserVO user) {
         Integer wareId = user.getSelfWareId();
         Stock lastStock = this.stockService.getLastStock(wareId);
         Stock stock = null;
@@ -281,9 +281,12 @@ public class WorkshopAccountServiceImpl extends ServiceImpl<WorkshopAccountDao,
         if (stock == null) {
             return;
         }
-        Date d = new Date();
+//        Date d = new Date();
         String key = "account_last_date:" + wareId;
         Date lastDate = this.getCacheDate(key);
+        if (lastDate != null && lastDate.after(d)) {
+            throw new RetException("不能生成" + DateUtils.toString(lastDate) + "之前的台账");
+        }
         // 查询是否存在
         this.valid(d, user, stock);
         // 计算当日内部收入