Răsfoiți Sursa

设备发货管理-批量导入

haogh 1 an în urmă
părinte
comite
de0c98b77e

BIN
sop-api/src/main/resources/static/delivery.xlsx


+ 3 - 1
sop-business/src/main/java/com/qmth/sop/business/bean/dto/DeviceDeliveryImportDto.java

@@ -19,7 +19,9 @@ import java.io.Serializable;
 @HeadStyle(fillForegroundColor = 11)
 @HeadFontStyle(color = 1)
 public class DeviceDeliveryImportDto extends BasicExcelRow implements Serializable {
-    @ExcelProperty(value = "项目单号/项目编号")
+    @ExcelProperty(value = "项目单号/项目编号*")
+    @NotNull(message = "项目单号/项目编号不能为空")
+    @NotBlank(message = "项目单号/项目编号不能为空")
     private String crmNo;
 
     @ExcelProperty(value = "供应商*")

+ 23 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/TBDeviceDelivery.java

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.sop.common.base.BaseEntity;
 import com.qmth.sop.common.enums.DeviceDeliveryStatusEnum;
+import com.qmth.sop.common.enums.DeviceStatusEnum;
 import com.qmth.sop.common.enums.DeviceUsageTypeEnum;
 import com.qmth.sop.common.enums.InOutTypeEnum;
 import io.swagger.annotations.ApiModel;
@@ -93,6 +94,12 @@ public class TBDeviceDelivery extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "有效的可操作的发货记录(当一个设备处于一个发货出入库生命周期时为有效), 0: 无效,1: 有效")
     private Boolean effect;
 
+    @ApiModelProperty(value = "设备的状态,NORMAL:正常 BREAK_DOWN: 故障")
+    private DeviceStatusEnum deviceStatus;
+
+    @ApiModelProperty(value = "设备来源ID,不为空,说明该设备由其他单号中转过来")
+    private Long sourceId;
+
     public String getExpressNo() {
         return expressNo;
     }
@@ -252,4 +259,20 @@ public class TBDeviceDelivery extends BaseEntity implements Serializable {
     public void setEffect(Boolean effect) {
         this.effect = effect;
     }
+
+    public DeviceStatusEnum getDeviceStatus() {
+        return deviceStatus;
+    }
+
+    public void setDeviceStatus(DeviceStatusEnum deviceStatus) {
+        this.deviceStatus = deviceStatus;
+    }
+
+    public Long getSourceId() {
+        return sourceId;
+    }
+
+    public void setSourceId(Long sourceId) {
+        this.sourceId = sourceId;
+    }
 }

+ 6 - 3
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDeviceDeliveryServiceImpl.java

@@ -189,16 +189,18 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
                 }
 
                 TBDeviceDelivery tbDeviceDelivery = new TBDeviceDelivery();
-                if (crmNo != null && crmNo.length() > 0) {
+                if (crmNo != null && !crmNo.isEmpty()) {
                     if (!crmNoList.contains(crmNo)) {
                         throw ExceptionResultEnum.ERROR.exception("派单号不存在");
                     }
 
                     tbDeviceDelivery.setCrmNo(crmNo);
                     tbDeviceDelivery.setUsageType(DeviceUsageTypeEnum.PROJECT);
-                } else {
-                    tbDeviceDelivery.setUsageType(DeviceUsageTypeEnum.OTHER);
                 }
+                // 项目单号/项目编号修改为必填项
+                /*else {
+                    tbDeviceDelivery.setUsageType(DeviceUsageTypeEnum.OTHER);
+                }*/
                 tbDeviceDelivery.setSerialNo(serialNo);
                 tbDeviceDelivery.setSupplierId(supplierId);
                 tbDeviceDelivery.setMailingAddress(mailingAddress);
@@ -210,6 +212,7 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
                 tbDeviceDelivery.setDeliveryType(InOutTypeEnum.OUT);
                 tbDeviceDelivery.setStatus(DeviceDeliveryStatusEnum.UN_DELIVER);
                 tbDeviceDelivery.setCreateId(requestUser.getId());
+                tbDeviceDelivery.setDeviceStatus(DeviceStatusEnum.NORMAL);
                 this.save(tbDeviceDelivery);
             }
         }

+ 4 - 3
sop-business/src/main/resources/db/log/haoguanghui_update_log.sql

@@ -1,5 +1,6 @@
-ALTER TABLE t_b_device_delivery
+-- 2024-05-15
+ALTER TABLE t_b_device_delivery
     ADD COLUMN `device_status` varchar(30) NULL COMMENT '设备状态,正常:NORMAL; 故障:FAULT' AFTER `effect`;
-
 ALTER TABLE t_b_device_delivery
-    ADD COLUMN `source_id` bigint NULL COMMENT '设备来源ID,不为空,说明该设备由其他单号中转过来' AFTER `device_status`;
+    ADD COLUMN `source_id` bigint NULL COMMENT '设备来源ID,不为空,说明该设备由其他单号中转过来' AFTER `device_status`;
+