Эх сурвалжийг харах

调拨入库出库为采购次品仓时,出入库类型更换

fgd 1 жил өмнө
parent
commit
6a3e94536b

+ 16 - 2
sd-business/src/main/java/com/sd/business/service/in/impl/InOutStorageServiceImpl.java

@@ -15,6 +15,7 @@ import com.sd.business.entity.in.emums.OutDetailTypeEnum;
 import com.sd.business.entity.in.po.InOutStorage;
 import com.sd.business.entity.in.po.InOutStorageBom;
 import com.sd.business.entity.in.vo.InOutStorageVo;
+import com.sd.business.entity.warehouse.constant.WarehouseConstant;
 import com.sd.business.entity.warehouse.po.Warehouse;
 import com.sd.business.mapper.in.InOutStorageMapper;
 import com.sd.business.service.in.InOutStorageBomService;
@@ -27,6 +28,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
+import java.util.Objects;
 
 
 /**
@@ -108,9 +110,17 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
     public void addAllot(AddAllotDto dto) {
         long allotFlag = IdWorker.getId();
 
+        // 调出仓库为采购次品仓,调入仓库为半成品仓时,出入库明细类型为生产出库和归还入库
+        boolean flag = Objects.equals(dto.getOutWarehouseId(), WarehouseConstant.PURCHASE_DEFECTIVE)
+                && Objects.equals(dto.getInWarehouseId(), WarehouseConstant.SEMI_FINISHED_PRODUCT);
+
         InOutStorageDto outStorageDto = new InOutStorageDto();
         outStorageDto.setType(InOutTypeEnum.OUT.getKey());
-        outStorageDto.setDetailType(OutDetailTypeEnum.ALLOT.getKey());
+        if (flag) {
+            outStorageDto.setDetailType(OutDetailTypeEnum.PRODUCTION.getKey());
+        } else {
+            outStorageDto.setDetailType(OutDetailTypeEnum.ALLOT.getKey());
+        }
         outStorageDto.setWarehouseId(dto.getOutWarehouseId());
         outStorageDto.setDepartmentId(dto.getDepartmentId());
         outStorageDto.setApplicant(dto.getApplicant());
@@ -121,7 +131,11 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 
         InOutStorageDto inStorageDto = new InOutStorageDto();
         inStorageDto.setType(InOutTypeEnum.IN.getKey());
-        inStorageDto.setDetailType(InDetailTypeEnum.ALLOT.getKey());
+        if (flag) {
+            inStorageDto.setDetailType(InDetailTypeEnum.GIVE_BACK.getKey());
+        } else {
+            inStorageDto.setDetailType(InDetailTypeEnum.ALLOT.getKey());
+        }
         inStorageDto.setWarehouseId(dto.getInWarehouseId());
         inStorageDto.setDepartmentId(dto.getDepartmentId());
         inStorageDto.setApplicant(dto.getApplicant());