|
@@ -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;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 更新出库单状态,更新库存信息,当仓库员点击确定后,领用时申请触发的出库单则自动出库
|
|
|
* 在之前还没有出库
|