Browse Source

报修审核

guarantee-lsq 1 năm trước cách đây
mục cha
commit
974cb56a17

+ 2 - 0
platform-dao/src/main/java/com/platform/dao/dto/store/OutStoreFormDTO.java

@@ -175,4 +175,6 @@ public class OutStoreFormDTO extends BaseDTO implements Serializable {
     private List<Integer> statusList;
 
     private List<String> ids;
+
+    private String outStoreFormId; // 出库单ID
 }

+ 5 - 0
platform-dao/src/main/java/com/platform/dao/entity/store/OutStoreForm.java

@@ -127,4 +127,9 @@ public class OutStoreForm implements Serializable{
      * 是否已打印 0 否 1 是
      */
     private Integer printFlag;
+
+    /**
+     * 出库单ID  outFlag=0 此字段才有值
+     */
+    private String outStoreFormId;
 }

+ 2 - 0
platform-dao/src/main/java/com/platform/dao/mapper/project/ProjectMapper.java

@@ -51,6 +51,8 @@ public interface ProjectMapper extends MyMapper<Project> {
      */
     ProjectVO selectById(Object id);
 
+    ProjectVO selectByName(String name);
+
     /**
      * 查询名称
      *

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/store/OutStoreFormVO.java

@@ -153,4 +153,5 @@ public class OutStoreFormVO extends BaseVO implements Serializable {
 
     private BigDecimal realNum;
 
+    private String outStoreFormId; // 出库单ID
 }

+ 9 - 0
platform-dao/src/main/resources/mapper/project/ProjectMapper.xml

@@ -67,6 +67,15 @@
         where t1.id=#{value}
     </select>
 
+    <select id="selectByName" parameterType="java.lang.String"
+            resultType="com.platform.dao.vo.query.project.ProjectVO">
+        select
+        <include refid="Base_Column_List"/>
+        from t_project t1
+        left join t_project pt on t1.parent_id = pt.id
+        where t1.name = #{value}
+    </select>
+
     <!--查询姓名-->
     <select id="selectNameById" parameterType="java.lang.Object" resultType="java.lang.String">
         select name

+ 1 - 1
platform-dao/src/main/resources/mapper/store/OutStoreFormMapper.xml

@@ -122,7 +122,7 @@ outstoreform.process_instance_id,
             and outstoreform.update_time = #{updateTime}
         </if>
         <if test="keyword != null and keyword != ''">
-            and outstoreform.out_no like concat('%',#{keyword},'%')
+            and (outstoreform.out_no like concat('%',#{keyword},'%') or repairForm.no like concat('%',#{keyword},'%') )
         </if>
         <if test="searchStartTime != null">
             and outstoreform.created_time <![CDATA[ >= ]]> #{searchStartTime}

+ 12 - 0
platform-rest/src/main/java/com/platform/rest/controller/store/OutStoreFormController.java

@@ -75,6 +75,18 @@ public class OutStoreFormController {
         return new R<>(outStoreFormService.saveModelByDTOYY(outStoreFormDTO));
     }
 
+    /**
+     * 新增记录
+     * @param outStoreFormDTO 出库登记单DTO
+     * @return R
+     */
+    @SysLog("新增退库登记单")
+    @PostMapping("/yongyou/back")
+    @PreAuthorize("@pms.hasPermission('store-out-store-forms-add')")
+    public R saveYongyouBack(@Validated({AddGroup.class}) @RequestBody OutStoreFormDTO outStoreFormDTO) {
+        return new R<>(outStoreFormService.saveModelByDTOYY(outStoreFormDTO));
+    }
+
     /**
      * 修改记录
      *

+ 2 - 0
platform-service/src/main/java/com/platform/service/store/OutStoreFormService.java

@@ -82,6 +82,8 @@ public interface OutStoreFormService extends IBaseService<OutStoreForm, OutStore
 
     OutStoreForm saveModelByDTOYY(OutStoreFormDTO outStoreFormDTO);
 
+    OutStoreForm saveModelByDTOYYBack(OutStoreFormDTO outStoreFormDTO);
+
     /**
      * 推送失败
      *

+ 55 - 0
platform-service/src/main/java/com/platform/service/store/impl/OutStoreFormServiceImpl.java

@@ -10,9 +10,11 @@ import com.platform.common.exception.DeniedException;
 import com.platform.common.model.UserInfo;
 import com.platform.common.util.*;
 import com.platform.dao.bean.MyPage;
+import com.platform.dao.dto.project.ProjectDTO;
 import com.platform.dao.dto.store.OutStoreDetailDTO;
 import com.platform.dao.dto.store.OutStoreFormDTO;
 import com.platform.dao.dto.store.SparePickFormDTO;
+import com.platform.dao.entity.project.Project;
 import com.platform.dao.entity.repair.RepairApplicationForm;
 import com.platform.dao.entity.sb.SbOil;
 import com.platform.dao.entity.store.*;
@@ -342,6 +344,59 @@ public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper,
         return outStoreForm;
     }
 
+    @Override
+    public OutStoreForm saveModelByDTOYYBack(OutStoreFormDTO outStoreFormDTO) {
+        if(StringUtils.isBlank(outStoreFormDTO.getOutStoreFormId())){
+            throw new DeniedException("关联的出库单不能为空");
+        }
+        OutStoreForm queryForm = mapper.selectByPrimaryKey(outStoreFormDTO.getOutStoreFormId());
+        // 复制信息为新的入库单
+        OutStoreForm insertForm = BeanConverterUtil.copyObjectProperties(queryForm,OutStoreForm.class);
+        // 修改id,no等值
+        insertForm.setOutStoreFormId(outStoreFormDTO.getOutStoreFormId());
+        insertForm.setId(IdGeneratorUtils.getObjectId());
+        insertForm.setCreatedTime(LocalDateTime.now());
+        UserInfo userInfo = SecurityUtils.getUserInfo();
+        insertForm.setCreatedUserId(userInfo.getUserId());
+        insertForm.setCreatedUserName(userInfo.getUsername());
+        insertForm.setUpdateUserId(null);
+        insertForm.setUpdateTime(null);
+        insertForm.setUpdateUserName(null);
+        insertForm.setOutFlag(YesNoEnum.NO.getValue()); // 入库
+        BigDecimal countNum = mapper.getOutStoreFormCount1(new OutStoreFormDTO());
+        Integer count = 0;
+        if(countNum != null){
+            count = countNum.intValue();
+        }
+        insertForm.setOutNo(IdGeneratorUtils.getOutStoreNo(++count));
+        OutStoreForm outStoreForm = saveModelNoId(insertForm);
+        // 根据项目名称查询项目信息
+        ProjectVO project = projectMapper.selectByName(outStoreForm.getProjectName());
+        // 出库单详情
+        List<OutStoreDetailDTO> detailList = outStoreFormDTO.getDetailList();
+        if (project != null) {
+            for (OutStoreDetailDTO detailDTO : detailList) {
+                detailDTO.setProjectNo(project.getParentNo());
+                detailDTO.setProjectName(project.getParentName());
+                detailDTO.setProjectSecondNo(project.getNo());
+                detailDTO.setProjectSecondName(project.getName());
+            }
+        }
+        // 插入明细记录
+        for (OutStoreDetailDTO detail : detailList) {
+            detail.setUserInfo(userInfo);
+            detail.setOutId(outStoreForm.getId());
+            detail.setRealNum(detail.getNum());
+            detail.setOutNo(outStoreForm.getOutNo());
+            detail.setOutFlag(outStoreForm.getOutFlag());
+            OutStoreDetail storeDetail = new OutStoreDetail();
+            BeanConverterUtil.copyObjectProperties(detail, storeDetail);
+            storeDetail.setId(IdGeneratorUtils.getObjectId());
+            detailMapper.insertSelective(storeDetail);
+        }
+        return outStoreForm;
+    }
+
     /**
      * 更新出库单状态,更新库存信息,当仓库员点击确定后,领用时申请触发的出库单则自动出库
      * 在之前还没有出库