Forráskód Böngészése

优化PDA补码接口

zhifei 1 éve
szülő
commit
1a3826bf7e

+ 2 - 1
warewms-system/src/main/java/com/warewms/hailiang/contoller/RetroactiveNowController.java

@@ -11,6 +11,7 @@ import com.warewms.hailiang.domain.RetroactiveNow;
 import com.warewms.hailiang.service.DeviceLogService;
 import com.warewms.hailiang.service.RetroactiveNowService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
@@ -55,7 +56,7 @@ public class RetroactiveNowController {
      * @return
      */
     @PostMapping("/pda/complement")
-    public R complement(@RequestBody RetroactiveNow retroactiveNow){
+    public R complement(@Validated @RequestBody RetroactiveNow retroactiveNow){
         return retroactiveNowService.complement(retroactiveNow);
     }
 }

+ 5 - 0
warewms-system/src/main/java/com/warewms/hailiang/domain/RetroactiveNow.java

@@ -10,6 +10,8 @@ import com.warewms.common.core.domain.base.BaseEntity;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import javax.validation.constraints.NotBlank;
+
 /**
  * 生产追溯表
  * @TableName retroactive_now
@@ -27,6 +29,7 @@ public class RetroactiveNow extends BaseEntity {
     /**
      * 产线
      */
+    @NotBlank(message = "产线不能为空!")
     private String productionLine;
 
     /**
@@ -47,11 +50,13 @@ public class RetroactiveNow extends BaseEntity {
     /**
      * 生产状态
      */
+    @NotBlank(message = "生产状态不能为空!")
     private String status;
 
     /**
      * 设备编号
      */
+    @NotBlank(message = "设备编号不能为空!")
     private String deviceId;
 
 

+ 7 - 1
warewms-system/src/main/java/com/warewms/hailiang/service/impl/RetroactiveNowServiceImpl.java

@@ -123,8 +123,14 @@ public class RetroactiveNowServiceImpl extends ServiceImpl<RetroactiveNowMapper,
         baseData.setDeviceId("PDA");
         baseData.setUpdateBy(loginUser.getUsername());
         baseData.setRemark("PDA手动补码");
-        retroactiveNowMapper.updateById(baseData);
+        if(Integer.parseInt(retroactiveNow.getStatus())>Integer.parseInt(baseData.getStatus())){
+            retroactiveNowMapper.updateById(baseData);
+        }
         baseData.setCreateBy(loginUser.getUsername());
+        if (ObjectUtil.isNull(retroactiveNow.getCreateTime())){
+            throw new ServiceException("工序完成时间为空!");
+        }
+        baseData.setCreateTime(retroactiveNow.getCreateTime());
         RetroactiveHistory retroactiveHistory = BeanUtil.copyProperties(baseData, RetroactiveHistory.class);
         retroactiveHistory.setCreateTime(baseData.getUpdateTime());
         retroactiveHistoryMapper.insert(retroactiveHistory);