瀏覽代碼

fix: sop 设备发货管理

caozixuan 1 年之前
父節點
當前提交
6471d1208b

+ 3 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/TBDeviceDeliveryResult.java

@@ -2,6 +2,8 @@ package com.qmth.sop.business.bean.result;
 
 import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.sop.common.enums.DeviceDeliveryStatusEnum;
 import com.qmth.sop.common.enums.DeviceUsageTypeEnum;
 import com.qmth.sop.common.enums.InOutTypeEnum;
@@ -18,6 +20,7 @@ public class TBDeviceDeliveryResult implements Serializable {
 
     @ApiModelProperty("id")
     @ExcelIgnore
+    @JsonSerialize(using = ToStringSerializer.class)
     private Long id;
 
     @ApiModelProperty("服务单元")

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

@@ -313,7 +313,7 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
             String serialNo = deviceInOutForm.getSerialNo();
             List<TBDeviceDelivery> outList = this.list(new QueryWrapper<TBDeviceDelivery>()
                     .lambda()
-                    .eq(TBDeviceDelivery::getStatus, DeviceDeliveryStatusEnum.RECEIVE)
+                    .eq(TBDeviceDelivery::getStatus, DeviceDeliveryStatusEnum.DELIVER)
                     .eq(TBDeviceDelivery::getEffect, true)
                     .eq(TBDeviceDelivery::getSerialNo, serialNo)
                     .eq(TBDeviceDelivery::getDeliveryType, InOutTypeEnum.OUT));

+ 12 - 6
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDeviceInOutServiceImpl.java

@@ -79,13 +79,15 @@ public class TBDeviceInOutServiceImpl extends ServiceImpl<TBDeviceInOutMapper, T
 
     @Override
     public List<DeviceInOutResult> findDeviceCanOutInfo(Long supplierId, String sopNo) {
-        SopCrmInfo sopCrmInfo = tbCrmService.findSopCrmInfoBySop(sopNo);
-        String crmNo = sopCrmInfo.getCrmNo();
+        String crmNo = null;
+        if (sopNo != null && sopNo.length() > 0) {
+            SopCrmInfo sopCrmInfo = tbCrmService.findSopCrmInfoBySop(sopNo);
+            crmNo = sopCrmInfo.getCrmNo();
+        }
+
         List<TBDeviceDelivery> tbDeviceDeliveryList = tbDeviceDeliveryService.list(new QueryWrapper<TBDeviceDelivery>()
                 .lambda()
-                .eq(TBDeviceDelivery::getEffect, true)
-                .eq(TBDeviceDelivery::getDeliveryType, InOutTypeEnum.OUT)
-                .eq(TBDeviceDelivery::getStatus, DeviceDeliveryStatusEnum.RECEIVE));
+                .eq(TBDeviceDelivery::getEffect, true));
 
         List<DeviceInOutResult> result = new ArrayList<>();
         List<DeviceInOutResult> deviceInOutResultList = this.baseMapper.findDeviceCanOutInfo(supplierId, DeviceStatusEnum.NORMAL, InOutTypeEnum.IN);
@@ -105,6 +107,10 @@ public class TBDeviceInOutServiceImpl extends ServiceImpl<TBDeviceInOutMapper, T
                 }
                 TBDeviceDelivery tbDeviceDelivery = cellDeliveryList.get(0);
                 String deliveryCrmNo = tbDeviceDelivery.getCrmNo();
+                if (!InOutTypeEnum.OUT.equals(tbDeviceDelivery.getDeliveryType()) || !DeviceDeliveryStatusEnum.DELIVER.equals(tbDeviceDelivery.getStatus())){
+                    // 出库 且 已发货的可以出库
+                    continue;
+                }
                 if (crmNo != null && crmNo.length() > 0) {
                     // 用于sop
                     if (crmNo.equals(deliveryCrmNo)) {
@@ -211,7 +217,7 @@ public class TBDeviceInOutServiceImpl extends ServiceImpl<TBDeviceInOutMapper, T
                     .set(SysDevice::getScanCount, e.getScanCount())
                     .set(SysDevice::getStatus, e.getDeviceStatus())
                     .set(SysDevice::getBound, inOutType)
-                    .eq(SysDevice::getDeviceCode, e.getSerialNo());
+                    .eq(SysDevice::getSerialNo, e.getSerialNo());
             sysDeviceService.update(updateWrapper);
 
             return Stream.of(tbDeviceInOut);

+ 2 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -352,6 +352,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
             if (!CollectionUtils.isEmpty(tbDeviceDeliveryList)) {
                 for (TBDeviceDelivery t : tbDeviceDeliveryList) {
                     t.setStatus(DeviceDeliveryStatusEnum.RECEIVE);
+                    t.setReceiveTime(System.currentTimeMillis());
+                    t.setReceiveUserId(sysUser.getId());
                     t.updateInfo(sysUser.getId());
                 }
                 tbDeviceDeliveryService.updateBatchById(tbDeviceDeliveryList);

+ 2 - 2
sop-business/src/main/resources/mapper/TBDeviceInOutMapper.xml

@@ -245,10 +245,10 @@
             </if>
             <choose>
                 <when test="sopNo != null and sopNo != ''">
-                    AND EXISTS(SELECT 1 FROM t_b_device_in_out tbdio WHERE tbdio.device_serial_no = sd.device_code AND tbdio.sop_no = #{sopNo})
+                    AND EXISTS(SELECT 1 FROM t_b_device_in_out tbdio WHERE tbdio.device_serial_no = sd.serial_no AND tbdio.sop_no = #{sopNo})
                 </when>
                 <otherwise>
-                    AND EXISTS(SELECT 1 FROM t_b_device_in_out tbdio WHERE tbdio.device_serial_no = sd.device_code AND tbdio.service_id IS NULL)
+                    AND EXISTS(SELECT 1 FROM t_b_device_in_out tbdio WHERE tbdio.device_serial_no = sd.serial_no AND tbdio.service_id IS NULL)
                 </otherwise>
             </choose>
         </where>