This commit is contained in:
parent
06c02c5e24
commit
bd823356bc
|
|
@ -37,6 +37,11 @@ public class PartApplyDetailAppVo {
|
|||
* 配件 型号
|
||||
*/
|
||||
private String partModel;
|
||||
|
||||
/**
|
||||
* 配件 型号
|
||||
*/
|
||||
private String partUnit;
|
||||
/**
|
||||
* 金钱
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -84,5 +84,14 @@ public class PartApplyController {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* 出库-接口
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("partOutInfo")
|
||||
@DecryptAndVerify(decryptedClass = PartApplyAppVo.class)
|
||||
public ServerResponse partOutInfo(EncryptedReq<PartApplyAppVo> dto) {
|
||||
return service.partOutInfo(dto.getData());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
package com.bonus.gzgqj.business.bases.controller;
|
||||
|
||||
|
||||
import com.bonus.gzgqj.business.app.entity.PartApplyAppVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.PartBackVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.UserPatypeInfo;
|
||||
import com.bonus.gzgqj.business.bases.service.PartBackService;
|
||||
import com.bonus.gzgqj.manager.annotation.DecryptAndVerify;
|
||||
import com.bonus.gzgqj.manager.core.entity.EncryptedReq;
|
||||
import com.bonus.gzgqj.manager.webResult.ServerResponse;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 配件 退料申请
|
||||
* @author 黑子
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/backstage/partBack")
|
||||
@Slf4j
|
||||
public class PartBackController {
|
||||
|
||||
@Autowired
|
||||
private PartBackService service;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 领料出库 查询
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("findByPage")
|
||||
@DecryptAndVerify(decryptedClass = PartBackVo.class)
|
||||
public PageInfo<PartBackVo> findByPage(EncryptedReq<PartBackVo> dto) {
|
||||
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
|
||||
List<PartBackVo> list = service.findByPage(dto.getData());;
|
||||
PageInfo<PartBackVo> pageInfo = new PageInfo<>(list);
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 退料人下拉选
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getUserList")
|
||||
@DecryptAndVerify(decryptedClass = UserPatypeInfo.class)
|
||||
public ServerResponse getUserList(EncryptedReq<UserPatypeInfo> dto) {
|
||||
return service.getUserList(dto.getData());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退料人下拉选
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getInfoDetails")
|
||||
@DecryptAndVerify(decryptedClass = PartBackVo.class)
|
||||
public ServerResponse getInfoDetails(EncryptedReq<PartBackVo> dto) {
|
||||
return service.getInfoDetails(dto.getData());
|
||||
}
|
||||
/**
|
||||
* 分页查询配件类型
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getPaTypeList")
|
||||
@DecryptAndVerify(decryptedClass = UserPatypeInfo.class)
|
||||
public PageInfo<UserPatypeInfo> getPaTypeList(EncryptedReq<UserPatypeInfo> dto) {
|
||||
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
|
||||
List<UserPatypeInfo> list = service.getPaTypeList(dto.getData());;
|
||||
PageInfo<UserPatypeInfo> pageInfo = new PageInfo<>(list);
|
||||
return pageInfo;
|
||||
}
|
||||
/**
|
||||
* 配件 退料
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("backInfo")
|
||||
public ServerResponse backInfo(HttpServletRequest request, @RequestParam(value = "file[]",required = false) MultipartFile[] files) {
|
||||
return service.backInfo(request,files);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ public class PaTypeVo {
|
|||
/**
|
||||
* 数量
|
||||
*/
|
||||
private String num;
|
||||
private int num;
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
|
|
@ -61,7 +61,18 @@ public class PaTypeVo {
|
|||
|
||||
private String parentName;
|
||||
|
||||
/**
|
||||
* 申请数量
|
||||
*/
|
||||
private String sqNum;
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
private int ckNum;
|
||||
/**
|
||||
* 总入库量
|
||||
*/
|
||||
private int allNum;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
package com.bonus.gzgqj.business.bases.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 退料详情记录
|
||||
* @author 黑子
|
||||
*/
|
||||
@Data
|
||||
public class PartBackDetailsVo {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
|
||||
private String backId;
|
||||
/**
|
||||
* 回退
|
||||
*/
|
||||
private int backNum;
|
||||
|
||||
|
||||
/**
|
||||
* 配件id
|
||||
*/
|
||||
private String partId;
|
||||
/**
|
||||
* 配件类型
|
||||
*/
|
||||
private String partType;
|
||||
/**
|
||||
* 配件名称
|
||||
*/
|
||||
private String partName;
|
||||
|
||||
/**
|
||||
* 配件类型
|
||||
*/
|
||||
private String partModel;
|
||||
|
||||
/**
|
||||
* 配件类型
|
||||
*/
|
||||
private String partUnit;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.bonus.gzgqj.business.bases.entity;
|
||||
|
||||
import com.bonus.gzgqj.business.plan.entity.FileUploadVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 配件退回
|
||||
*
|
||||
* @author 黑子
|
||||
*/
|
||||
@Data
|
||||
public class PartBackVo {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 回退人
|
||||
*/
|
||||
private String creator;
|
||||
/**
|
||||
* 回退人名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 回退日期
|
||||
*/
|
||||
private String backDay;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createId;
|
||||
|
||||
private String updateTime;
|
||||
|
||||
private String updater;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private String type;
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyWord;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private String startDay;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private String endDay;
|
||||
|
||||
private int backNum;
|
||||
/**
|
||||
* 详情集合
|
||||
*/
|
||||
private List<PartBackDetailsVo> detailsVoList;
|
||||
|
||||
|
||||
/**
|
||||
* 文件上传 集合
|
||||
*/
|
||||
private List<FileUploadVo> fileList;
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.gzgqj.business.bases.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 人员领用详情服务
|
||||
* @author 黑子
|
||||
*/
|
||||
@Data
|
||||
public class UserPatypeInfo {
|
||||
|
||||
|
||||
private String userId;
|
||||
/**
|
||||
* 领用人名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 配件id
|
||||
*/
|
||||
private String partId;
|
||||
/**
|
||||
* 配件类型
|
||||
*/
|
||||
private String partType;
|
||||
/**
|
||||
* 配件名称
|
||||
*/
|
||||
private String partName;
|
||||
/**
|
||||
* 配件类型
|
||||
*/
|
||||
private String partModel;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String partUnit;
|
||||
/**
|
||||
* 领用数量
|
||||
*/
|
||||
private int lyNum;
|
||||
/**
|
||||
* 归还数量
|
||||
*/
|
||||
private int ghNum;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.bonus.gzgqj.business.bases.mapper;
|
|||
import com.bonus.gzgqj.business.app.entity.PartApplyAppVo;
|
||||
import com.bonus.gzgqj.business.app.entity.PartApplyDetailAppVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.AuditRecord;
|
||||
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
|
@ -54,4 +55,17 @@ public interface PartApplyMapper {
|
|||
* @param data
|
||||
*/
|
||||
void updatePartInfo(PartApplyAppVo data);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
* @param partId
|
||||
* @return
|
||||
*/
|
||||
PaTypeVo getPaTypeVoById(String partId);
|
||||
|
||||
/**
|
||||
* 更新出库数量
|
||||
* @param paTypeVo
|
||||
*/
|
||||
void updatePaTypeVoById(PaTypeVo paTypeVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
package com.bonus.gzgqj.business.bases.mapper;
|
||||
|
||||
import com.bonus.gzgqj.business.bases.entity.PartBackDetailsVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.PartBackVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.UserPatypeInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
* 退料申请接口成
|
||||
*/
|
||||
@Repository
|
||||
public interface PartBackMapper {
|
||||
/**
|
||||
* 人员下拉选查询
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<UserPatypeInfo> getUserList(UserPatypeInfo data);
|
||||
|
||||
/**
|
||||
* 查询配置
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<UserPatypeInfo> getPaTypeList(UserPatypeInfo data);
|
||||
|
||||
/**
|
||||
* 查询当日回退数量
|
||||
* @return
|
||||
*/
|
||||
int getBackNum();
|
||||
|
||||
/**
|
||||
* 插入回退数据
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
int insertBack(PartBackVo vo);
|
||||
|
||||
int insertBackDetails(PartBackVo vo, List<PartBackDetailsVo> list);
|
||||
|
||||
/**
|
||||
* 分页查询 退料数据
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<PartBackVo> findByPage(PartBackVo data);
|
||||
|
||||
/**
|
||||
* 查询入库信息
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
PartBackVo getInfoDetails(PartBackVo data);
|
||||
|
||||
/**
|
||||
* 查询 回退详情
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<PartBackDetailsVo> getInfoDetailList(PartBackVo data);
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.gzgqj.business.bases.mapper;
|
||||
|
||||
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.PartInputDetails;
|
||||
import com.bonus.gzgqj.business.bases.entity.PartInputVo;
|
||||
|
||||
|
|
@ -40,14 +41,14 @@ public interface PartInputMapper {
|
|||
* @param detail
|
||||
* @return
|
||||
*/
|
||||
int getPaTypeById(PartInputDetails detail);
|
||||
PaTypeVo getPaTypeById(PartInputDetails detail);
|
||||
|
||||
/**
|
||||
* 修改入库后库存数量
|
||||
* @param partId
|
||||
* @param nowNum
|
||||
*/
|
||||
void updateTypeNum(@Param("id") String partId,@Param("num") int nowNum,@Param("price")String price);
|
||||
void updateTypeNum(PaTypeVo paTypeVo);
|
||||
|
||||
void updateTypeNum2(@Param("id") String partId,@Param("price")String price);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package com.bonus.gzgqj.business.bases.mapper;
|
||||
|
||||
import com.bonus.gzgqj.business.bases.entity.UserPatypeInfo;
|
||||
import lombok.Data;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 人员领用详情记录表
|
||||
* @author 黑子
|
||||
*/
|
||||
@Repository
|
||||
public interface UserPartInfoMapper {
|
||||
|
||||
/**
|
||||
* 查询 历史数据
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
UserPatypeInfo getInfo(UserPatypeInfo user);
|
||||
|
||||
/**
|
||||
* 插入数据
|
||||
* @param user
|
||||
*/
|
||||
void insertData(UserPatypeInfo user);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
*/
|
||||
void updateData(UserPatypeInfo user);
|
||||
|
||||
/**
|
||||
* 更新归还数量
|
||||
* @param user
|
||||
*/
|
||||
void updateBackData(UserPatypeInfo user);
|
||||
}
|
||||
|
|
@ -40,4 +40,11 @@ public interface PartApplyService {
|
|||
* @return
|
||||
*/
|
||||
ServerResponse uploadImage(HttpServletRequest request, MultipartFile[] files);
|
||||
|
||||
/**
|
||||
* 出库
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
ServerResponse partOutInfo(PartApplyAppVo data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.gzgqj.business.bases.service;
|
|||
import com.bonus.gzgqj.business.app.entity.PartApplyAppVo;
|
||||
import com.bonus.gzgqj.business.app.entity.PartApplyDetailAppVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.AuditRecord;
|
||||
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
|
||||
import com.bonus.gzgqj.business.bases.mapper.PartApplyMapper;
|
||||
import com.bonus.gzgqj.business.plan.entity.FileUploadVo;
|
||||
import com.bonus.gzgqj.business.utils.FileUploadService;
|
||||
|
|
@ -38,6 +39,9 @@ public class PartApplyServiceImpl implements PartApplyService{
|
|||
@Autowired
|
||||
private FileUploadService uploadService;
|
||||
|
||||
@Autowired
|
||||
UserPartInfoServiceImpl userPartInfoService;
|
||||
|
||||
/**
|
||||
* 申请记录列表查询
|
||||
* @param data
|
||||
|
|
@ -47,10 +51,6 @@ public class PartApplyServiceImpl implements PartApplyService{
|
|||
public List<PartApplyAppVo> findByPage(PartApplyAppVo data) {
|
||||
List<PartApplyAppVo> list=new ArrayList<>();
|
||||
try{
|
||||
if(StringHelper.isNotEmpty(data.getTimes())){
|
||||
data.setStartDay(data.getTimes().split(" ~ ")[0]);
|
||||
data.setEndDay(data.getTimes().split(" ~ ")[1]);
|
||||
}
|
||||
list=mapper.findByPage(data);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
|
|
@ -106,9 +106,9 @@ public class PartApplyServiceImpl implements PartApplyService{
|
|||
voo.setAuditRemark(data.getRemark());
|
||||
voo.setApplyId(data.getId());
|
||||
voo.setAuditStatus(status);
|
||||
voo.setAuditType("2");
|
||||
//通过
|
||||
if("2".equals(status)){
|
||||
vo.setAuditType("3");
|
||||
data.setStatusType("3");
|
||||
}
|
||||
int num=mapper.insertAuditRecord(voo);
|
||||
|
|
@ -151,6 +151,56 @@ public class PartApplyServiceImpl implements PartApplyService{
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库-接口
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse partOutInfo(PartApplyAppVo data) {
|
||||
List<PartApplyAppVo> list=new ArrayList<>();
|
||||
try{
|
||||
String id=data.getId();
|
||||
PartApplyAppVo vo=mapper.getAuditStatus(data);
|
||||
if(!"2".equals(vo.getStatus())){
|
||||
return ServerResponse.createSuccess("该数据状态已变更,请刷新数据重试");
|
||||
}
|
||||
Long userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId();
|
||||
AuditRecord voo=new AuditRecord();
|
||||
voo.setAuditor(userId.toString());
|
||||
voo.setApplyId(data.getId());
|
||||
voo.setAuditStatus("4");
|
||||
voo.setAuditType("3");
|
||||
int num=mapper.insertAuditRecord(voo);
|
||||
if(num>0){
|
||||
//出库
|
||||
data.setCkUser(userId.toString());
|
||||
data.setStatus("4");
|
||||
data.setStatusType("1");
|
||||
mapper.updatePartInfo(data);
|
||||
//计算出库数量
|
||||
List<PartApplyDetailAppVo> details=mapper.getDetailsList(data);
|
||||
String userName=UserUtil.getLoginUser().getUsername();
|
||||
//出库数据 维护
|
||||
userPartInfoService.insert(details,vo.getCreater(),vo.getUserName());
|
||||
details.forEach(detail->{
|
||||
String partId=detail.getPartId();
|
||||
int applyNum=detail.getApplyNum();
|
||||
PaTypeVo paTypeVo=mapper.getPaTypeVoById(partId);
|
||||
paTypeVo.setNum(paTypeVo.getNum()-applyNum);
|
||||
paTypeVo.setCkNum(paTypeVo.getCkNum()+applyNum);
|
||||
//更新当前库存
|
||||
mapper.updatePaTypeVoById(paTypeVo);
|
||||
});
|
||||
return ServerResponse.createSuccess("出库成功","出库成功");
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("出库失败");
|
||||
}
|
||||
|
||||
|
||||
public String transBast64(String url){
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.gzgqj.business.bases.service;
|
||||
|
||||
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.PartBackVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.UserPatypeInfo;
|
||||
import com.bonus.gzgqj.manager.webResult.ServerResponse;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 退料入库
|
||||
*/
|
||||
public interface PartBackService {
|
||||
/**
|
||||
* 查询已领用人员详情
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
ServerResponse getUserList(UserPatypeInfo data);
|
||||
|
||||
/**
|
||||
* 分页查询 配件
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<UserPatypeInfo> getPaTypeList(UserPatypeInfo data);
|
||||
|
||||
/**
|
||||
* 配件退料接口
|
||||
* @param request
|
||||
* @param files
|
||||
* @return
|
||||
*/
|
||||
ServerResponse backInfo(HttpServletRequest request, MultipartFile[] files);
|
||||
|
||||
/**
|
||||
* 分页查询 退料数据
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<PartBackVo> findByPage(PartBackVo data);
|
||||
|
||||
ServerResponse getInfoDetails(PartBackVo data);
|
||||
}
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
package com.bonus.gzgqj.business.bases.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.bonus.gzgqj.business.bases.entity.*;
|
||||
import com.bonus.gzgqj.business.bases.mapper.PartApplyMapper;
|
||||
import com.bonus.gzgqj.business.bases.mapper.PartBackMapper;
|
||||
import com.bonus.gzgqj.business.plan.entity.FileUploadVo;
|
||||
import com.bonus.gzgqj.business.utils.FileUploadService;
|
||||
import com.bonus.gzgqj.manager.common.util.DateTimeHelper;
|
||||
import com.bonus.gzgqj.manager.common.util.StringHelper;
|
||||
import com.bonus.gzgqj.manager.common.util.StringUtils;
|
||||
import com.bonus.gzgqj.manager.common.util.UserUtil;
|
||||
import com.bonus.gzgqj.manager.webResult.ServerResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 退料申请业务层
|
||||
*
|
||||
* @author 黑子
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PartBackServiceImpl implements PartBackService {
|
||||
|
||||
@Autowired
|
||||
private PartBackMapper mapper;
|
||||
@Autowired
|
||||
private PartApplyMapper partApplyMapper;
|
||||
|
||||
@Autowired
|
||||
private FileUploadService uploadService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserPartInfoServiceImpl userPartInfoService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<PartBackVo> findByPage(PartBackVo data) {
|
||||
List<PartBackVo> list=new ArrayList<>();
|
||||
try{
|
||||
list= mapper.findByPage(data);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情数据
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse getInfoDetails(PartBackVo data) {
|
||||
try{
|
||||
PartBackVo vo=mapper.getInfoDetails(data);
|
||||
List<PartBackDetailsVo> detailList=mapper.getInfoDetailList(data);
|
||||
List<FileUploadVo> flieList=uploadService.getFileList(data.getId(),"t_part_back",null);
|
||||
vo.setFileList(flieList);
|
||||
vo.setDetailsVoList(detailList);
|
||||
return ServerResponse.createSuccess(vo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createSuccess(new PartBackVo());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ServerResponse getUserList(UserPatypeInfo data) {
|
||||
List<UserPatypeInfo> list=new ArrayList<>();
|
||||
try{
|
||||
list= mapper.getUserList(data);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createSuccess(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserPatypeInfo> getPaTypeList(UserPatypeInfo data) {
|
||||
List<UserPatypeInfo> list=new ArrayList<>();
|
||||
try{
|
||||
list= mapper.getPaTypeList(data);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配件退料申请接口
|
||||
* @param request
|
||||
* @param files
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse backInfo(HttpServletRequest request, MultipartFile[] files) {
|
||||
try{
|
||||
Long userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId();
|
||||
String params=request.getParameter("params");
|
||||
PartBackVo vo= JSON.parseObject(params,PartBackVo.class);
|
||||
if(StringHelper.isEmpty(vo.getCreator())){
|
||||
return ServerResponse.createErroe("请选择退料人");
|
||||
}
|
||||
if(StringHelper.isEmpty(vo.getBackDay())){
|
||||
return ServerResponse.createErroe("请选择退料日期");
|
||||
}
|
||||
if(files==null || files.length<=0){
|
||||
return ServerResponse.createErroe("未上传附件");
|
||||
}
|
||||
List<PartBackDetailsVo> list=vo.getDetailsVoList();
|
||||
if(list==null || list.isEmpty()){
|
||||
return ServerResponse.createErroe("请填写回退明细");
|
||||
}
|
||||
String code=getCode();
|
||||
vo.setCode(code);
|
||||
vo.setCreateId(userId.toString());
|
||||
vo.setUpdater(userId.toString());
|
||||
// 使用Stream API对quantity属性求和
|
||||
int backNum = list.stream()
|
||||
.mapToInt(PartBackDetailsVo::getBackNum)
|
||||
.sum();
|
||||
vo.setBackNum(backNum);
|
||||
int num=mapper.insertBack(vo);
|
||||
if(num>0){
|
||||
List<FileUploadVo> fileList=uploadService.uploadImage(files,vo.getId(),"t_part_back","退料附件");
|
||||
if(StringUtils.isEmpty(fileList) || fileList.size()!=files.length){
|
||||
return ServerResponse.createErroe("退料失败");
|
||||
}
|
||||
int nums= mapper.insertBackDetails(vo,list);
|
||||
if(nums==list.size()){
|
||||
//退料
|
||||
userPartInfoService.backInfo(list,vo.getCreator());
|
||||
//更新库存数量
|
||||
list.forEach(detail->{
|
||||
String partId=detail.getPartId();
|
||||
int backNum=detail.getBackNum();
|
||||
PaTypeVo paTypeVo=partApplyMapper.getPaTypeVoById(partId);
|
||||
paTypeVo.setNum(paTypeVo.getNum()+backNum);
|
||||
paTypeVo.setCkNum(paTypeVo.getCkNum()-backNum);
|
||||
//更新当前库存
|
||||
partApplyMapper.updatePaTypeVoById(paTypeVo);
|
||||
});
|
||||
return ServerResponse.createSuccess("退料成功","退料成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("退料失败");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getCode( ) {
|
||||
int num =mapper.getBackNum();
|
||||
num++;
|
||||
String year= DateTimeHelper.getNowYMD();
|
||||
if(num<10) {
|
||||
return year+"00"+num;
|
||||
}else if(num<100) {
|
||||
return year+"0"+num;
|
||||
}
|
||||
return year+num;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ import com.bonus.gzgqj.manager.common.util.UserUtil;
|
|||
import com.bonus.gzgqj.manager.webResult.ServerResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.omg.CORBA.INTERNAL;
|
||||
import org.omg.PortableInterceptor.INACTIVE;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -118,11 +119,15 @@ public class PartInputServiceImpl implements PartInputService{
|
|||
if(num2==list.size()){
|
||||
list.forEach(detail->{
|
||||
//更新 库存数量-及平准单价
|
||||
int typeNum=mapper.getPaTypeById(detail);
|
||||
int nowNum= detail.getInputNum()+typeNum;
|
||||
PaTypeVo paTypeVo=mapper.getPaTypeById(detail);
|
||||
int nowNum= detail.getInputNum()+paTypeVo.getNum();
|
||||
int allNum=detail.getInputNum()+paTypeVo.getAllNum();
|
||||
paTypeVo.setNum(nowNum);
|
||||
paTypeVo.setAllNum(allNum);
|
||||
paTypeVo.setPrice(detail.getPartPrice());
|
||||
// String pzPrice=mapper.getPzPrice(detail);
|
||||
//最后入库就是最终价格
|
||||
mapper.updateTypeNum(detail.getPartId(),nowNum,detail.getPartPrice());
|
||||
mapper.updateTypeNum(paTypeVo);
|
||||
});
|
||||
return ServerResponse.createSuccess("入库成功");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
package com.bonus.gzgqj.business.bases.service;
|
||||
|
||||
import com.bonus.gzgqj.business.app.entity.PartApplyDetailAppVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.PartBackDetailsVo;
|
||||
import com.bonus.gzgqj.business.bases.entity.PartInputDetails;
|
||||
import com.bonus.gzgqj.business.bases.entity.UserPatypeInfo;
|
||||
import com.bonus.gzgqj.business.bases.mapper.UserPartInfoMapper;
|
||||
import com.bonus.gzgqj.manager.common.util.StringHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserPartInfoServiceImpl {
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserPartInfoMapper mapper;
|
||||
|
||||
/**
|
||||
* 新增 领料数据
|
||||
* @param list
|
||||
*/
|
||||
public void insert(List<PartApplyDetailAppVo> list, String userId, String userName){
|
||||
try{
|
||||
if(list!=null && !list.isEmpty()){
|
||||
UserPatypeInfo user=new UserPatypeInfo();
|
||||
for (PartApplyDetailAppVo vo:list){
|
||||
user.setPartId(vo.getPartId());
|
||||
user.setUserId(userId);
|
||||
UserPatypeInfo info=mapper.getInfo(user);
|
||||
//无数据
|
||||
if(info==null || StringHelper.isEmpty(info.getUserId())){
|
||||
user.setPartName(vo.getPartName());
|
||||
user.setPartType(vo.getPartType());
|
||||
user.setPartModel(vo.getPartModel());
|
||||
user.setUserName(userName);
|
||||
user.setLyNum(vo.getApplyNum());
|
||||
user.setGhNum(0);
|
||||
mapper.insertData(user);
|
||||
}else{
|
||||
info.setLyNum(info.getLyNum()+vo.getApplyNum());
|
||||
mapper.updateData(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退料 数据
|
||||
* @param list
|
||||
*/
|
||||
public void backInfo(List<PartBackDetailsVo> list, String userId ){
|
||||
if(list!=null && !list.isEmpty()){
|
||||
UserPatypeInfo user=new UserPatypeInfo();
|
||||
for (PartBackDetailsVo vo:list){
|
||||
user.setPartId(vo.getPartId());
|
||||
user.setUserId(userId);
|
||||
UserPatypeInfo info=mapper.getInfo(user);
|
||||
info.setGhNum(info.getGhNum()+vo.getBackNum());
|
||||
mapper.updateBackData(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -12,12 +12,12 @@
|
|||
</insert>
|
||||
<!--差人申请详情-->
|
||||
<insert id="insertDetails">
|
||||
insert into t_part_put_details(
|
||||
insert into t_part_apply_details(
|
||||
apply_id, part_id, apply_num,
|
||||
part_type, part_name, part_model ) values
|
||||
part_type, part_name, part_model,part_unit ) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{param.id},#{item.partId},#{item.applyNum},
|
||||
#{item.partType},#{item.partName},#{item.partModel})
|
||||
#{item.partType},#{item.partName},#{item.partModel},#{item.partUnit})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<mapper namespace="com.bonus.gzgqj.business.bases.mapper.PaTypeMapper" >
|
||||
<!--新增类型-->
|
||||
<insert id="addTypeData" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pa_type(parent_id, name,remarks,unit,is_active,level,price)VALUES(#{parentId},#{name},#{remarks},#{unit},1,#{level},0)
|
||||
insert into pa_type(parent_id, name,remarks,unit,is_active,level,price,ck_num,bf_num,all_num)VALUES(#{parentId},#{name},#{remarks},#{unit},1,#{level},0,0,0,0)
|
||||
</insert>
|
||||
<update id="updateTypeData">
|
||||
update pa_type set name=#{name},remarks=#{remarks},unit=#{unit} where id=#{id}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,20 @@
|
|||
<insert id="insertAuditRecord">
|
||||
insert into t_part_apply_record(
|
||||
apply_id, auditor, audit_time,
|
||||
audit_status, audit_remark
|
||||
)values (#{applyId},#{auditor},now(),#{auditStatus},#{auditRemark})
|
||||
audit_status, audit_remark,audit_type
|
||||
)values (#{applyId},#{auditor},now(),#{auditStatus},#{auditRemark},#{auditType})
|
||||
</insert>
|
||||
<update id="updatePartInfo">
|
||||
update t_part_apply set fz_user=#{fzUser},fz_time=now() ,status=#{status},status_type=#{statusType}
|
||||
update t_part_apply set status=#{status},status_type=#{statusType}
|
||||
<if test="fzUser!=null and fzUser!=''">
|
||||
,fz_user=#{fzUser} ,fz_time=now()
|
||||
</if>
|
||||
<if test="ckUser!=null and ckUser!=''">
|
||||
,ck_user=#{ckUser} ,ck_time=now()
|
||||
</if>
|
||||
where id=#{id}
|
||||
</update>
|
||||
|
||||
<!-- 领料 申请-->
|
||||
<select id="findByPage" resultType="com.bonus.gzgqj.business.app.entity.PartApplyAppVo">
|
||||
select tpa.id,tpa.code,tpa.creator,tpa.user_name userName,
|
||||
|
|
@ -31,7 +38,7 @@
|
|||
tpa.pro_name like('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="times!=null and times!='' and startDay!=null and endDay!=null ">
|
||||
<if test="startDay!=null and startDay!='' and endDay!=null and endDay!='' ">
|
||||
and STR_TO_DATE(tpa.create_time, '%Y-%m-%d') between STR_TO_DATE(#{startDay} ,'%Y-%m-%d') AND STR_TO_DATE(#{endDay},'%Y-%m-%d')
|
||||
</if>
|
||||
|
||||
|
|
@ -55,8 +62,8 @@
|
|||
</select>
|
||||
<select id="getDetailsList" resultType="com.bonus.gzgqj.business.app.entity.PartApplyDetailAppVo">
|
||||
select ppd.id,ppd.apply_id applyId, ppd.part_id partId, ppd.apply_num applyNum,
|
||||
ppd.part_type partType, ppd.part_name partName, ppd.part_model partModel
|
||||
from t_part_put_details ppd
|
||||
ppd.part_type partType, ppd.part_name partName, ppd.part_model partModel,ppd.part_unit partUnit
|
||||
from t_part_apply_details ppd
|
||||
where ppd.apply_id=#{id}
|
||||
</select>
|
||||
<!--审核状态-->
|
||||
|
|
@ -71,4 +78,13 @@
|
|||
FROM t_part_apply tpa
|
||||
where tpa.id=#{id}
|
||||
</select>
|
||||
<select id="getPaTypeVoById" resultType="com.bonus.gzgqj.business.bases.entity.PaTypeVo">
|
||||
select id ,num,ck_num ckNum
|
||||
from pa_type
|
||||
where id=#{id}
|
||||
</select>
|
||||
|
||||
<update id="updatePaTypeVoById">
|
||||
update pa_type set num=#{num},ck_num=#{ckNum} where id=#{id}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.bonus.gzgqj.business.bases.mapper.PartBackMapper" >
|
||||
|
||||
<select id="findByPage" resultType="com.bonus.gzgqj.business.bases.entity.PartBackVo">
|
||||
select tpb.id, tpb.code, tpb.creator,pu.TELPHONE phone ,tpb.back_num backNum,tpb.user_name userName
|
||||
tpb.back_day backDay, tpb.create_time createTime, tpb.type, tpb.remark,
|
||||
tpb.status, tpb.updater, tpb.update_time updateTime, tpb.create_id createId
|
||||
from t_part_back tpb
|
||||
left join pm_user pu on pu.id=tpb.creator
|
||||
<where>
|
||||
<if test="keyWord!=null and keyWord!=''">
|
||||
and (
|
||||
tpb.code like('%',#{keyWord},'%') or
|
||||
tpb.user_name like('%',#{keyWord},'%') or
|
||||
tpb.remark like('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="times!=null and times!='' and startDay!=null and endDay!=null ">
|
||||
and STR_TO_DATE(tpb.create_time, '%Y-%m-%d') between STR_TO_DATE(#{startDay} ,'%Y-%m-%d') AND STR_TO_DATE(#{endDay},'%Y-%m-%d')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!--插入数据-->
|
||||
<insert id="insertBack" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into t_part_back(
|
||||
code,creator,back_day,
|
||||
create_time, type, remark,
|
||||
status,updater, update_time, create_id,back_num,user_name
|
||||
)values (#{code},#{creator},#{backDay},now(),#{type},#{remark},#{status},#{updater},now(),#{createId},#{backNum},#{userName})
|
||||
</insert>
|
||||
<insert id="insertBackDetails">
|
||||
insert into t_part_back_details(
|
||||
back_id, back_num, part_id,
|
||||
part_type, part_name, part_model,
|
||||
part_unit, remark ) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{param.id},#{item.backNum},#{item.partId},#{item.partType},#{item.partName},
|
||||
#{item.partModel},#{item.partUnit},#{item.remark})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getUserList" resultType="com.bonus.gzgqj.business.bases.entity.UserPatypeInfo">
|
||||
select distinct user_id userId, user_name userName
|
||||
from tb_user_pa_type_info
|
||||
</select>
|
||||
<!--查询配置类型数据-->
|
||||
<select id="getPaTypeList" resultType="com.bonus.gzgqj.business.bases.entity.UserPatypeInfo">
|
||||
select
|
||||
user_id userId, part_id partId,part_type partType,
|
||||
part_name partName, part_model partModel,
|
||||
ly_num lyNum, gh_num ghNum, user_name userName,part_unit partUnit
|
||||
from tb_user_pa_type_info ppd where user_id=#{userId}
|
||||
<if test="partType!=null and partType!=''">
|
||||
and ppd.part_type like concat('%',#{partType},'%')
|
||||
</if>
|
||||
<if test="partName!=null and partName!=''">
|
||||
and ppd.part_name like concat('%',#{partName},'%')
|
||||
</if>
|
||||
<if test="partModel!=null and partModel!=''">
|
||||
and ppd.part_model like concat('%',#{partModel},'%')
|
||||
</if>
|
||||
</select>
|
||||
<select id="getBackNum" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from t_part_back
|
||||
where DATE_FORMAT(create_time,'%Y-%m-%d')=CURRENT_DATE
|
||||
</select>
|
||||
|
||||
<select id="getInfoDetailList" resultType="com.bonus.gzgqj.business.bases.entity.PartBackDetailsVo">
|
||||
SELECT id, back_id backId, back_num backNum,
|
||||
part_id partId, part_type partType,
|
||||
part_name partName, part_model partModel, part_unit partUnit, remark
|
||||
FROM t_part_back_details
|
||||
WHERE back_id=#{id}
|
||||
</select>
|
||||
<select id="getInfoDetails" resultType="com.bonus.gzgqj.business.bases.entity.PartBackVo">
|
||||
select tpb.id, tpb.code, tpb.creator,pu.TELPHONE phone ,tpb.back_num backNum,tpb.user_name userName
|
||||
tpb.back_day backDay, tpb.create_time createTime, tpb.type, tpb.remark,
|
||||
tpb.status, tpb.updater, tpb.update_time updateTime, tpb.create_id createId
|
||||
from t_part_back tpb
|
||||
left join pm_user pu on pu.id=tpb.creator
|
||||
WHERE tpb.id=#{id}
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -21,7 +21,8 @@
|
|||
</insert>
|
||||
|
||||
<update id="updateTypeNum">
|
||||
update pa_type set num=#{num},price=#{price} where id=#{id}
|
||||
update pa_type set num=#{num},price=#{price},all_num=#{allNum}
|
||||
where id=#{id}
|
||||
</update>
|
||||
|
||||
<update id="updateTypeNum2">
|
||||
|
|
@ -64,9 +65,9 @@
|
|||
from t_part_input
|
||||
where DATE_FORMAT(create_time,'%Y-%m-%d')=CURRENT_DATE
|
||||
</select>
|
||||
<select id="getPaTypeById" resultType="java.lang.Integer">
|
||||
select IFNULL(num,0) num
|
||||
from pa_type where id=#{partId}
|
||||
<select id="getPaTypeById" resultType="com.bonus.gzgqj.business.bases.entity.PaTypeVo">
|
||||
select id ,num,ck_num ckNum,all_num allNum
|
||||
from pa_type where id=#{partId}
|
||||
</select>
|
||||
<!--查询 入库详情-->
|
||||
<select id="getInputDetails" resultType="com.bonus.gzgqj.business.bases.entity.PartInputVo">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.bonus.gzgqj.business.bases.mapper.UserPartInfoMapper" >
|
||||
<insert id="insertData">
|
||||
insert into tb_user_pa_type_info(user_id,part_id,part_type,part_name,part_model,ly_num,gh_num,user_name,part_unit
|
||||
)values (#{userId},#{partId},#{partName},#{partName},#{partModel},#{lyNum},#{ghNum},#{userName},#{partUnit})
|
||||
</insert>
|
||||
<update id="updateData">
|
||||
update tb_user_pa_type_info set ly_num=#{lyNum}
|
||||
where user_id=#{userId} and part_id=#{partId}
|
||||
</update>
|
||||
<update id="updateBackData">
|
||||
update tb_user_pa_type_info set gh_num=#{gh_num}
|
||||
where user_id=#{userId} and part_id=#{partId}
|
||||
|
||||
</update>
|
||||
<!--查询详情-->
|
||||
<select id="getInfo" resultType="com.bonus.gzgqj.business.bases.entity.UserPatypeInfo">
|
||||
select
|
||||
user_id userId, part_id partId,part_type partType,
|
||||
part_name partName, part_model partModel,
|
||||
ly_num lyNum, gh_num ghNum, user_name userName,part_unit partUnit
|
||||
from tb_user_pa_type_info
|
||||
where user_id=#{userId} and part_id=#{partId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue