x新增委托验收功能

master
anthonyywj2 3 years ago
parent 731c62c1d2
commit 660f20101a

@ -0,0 +1,112 @@
package com.glxp.api.admin.controller.basic;
//委托验收
import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.entity.basic.BussinessTypeEntity;
import com.glxp.api.admin.entity.basic.DlEntrustReceEntity;
import com.glxp.api.admin.entity.basic.EntrustReceEntity;
import com.glxp.api.admin.req.basic.BasicEntrustRecRequest;
import com.glxp.api.admin.req.inout.DeleteRequest;
import com.glxp.api.admin.req.receipt.BussinessTypeFilterRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.EntrustReceRespose;
import com.glxp.api.admin.service.auth.CustomerService;
import com.glxp.api.admin.service.basic.BussinessTypeService;
import com.glxp.api.admin.service.basic.EntrustReceService;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@RestController
public class EntrustReceController {
@Resource
EntrustReceService entrustReceService;
@Resource
CustomerService customerService;
@Resource
private BussinessTypeService bussinessTypeService;
@GetMapping("/spms/entrust/rece/filter")
public BaseResponse getEntrustRece(BasicEntrustRecRequest basicExportStatusRequest) {
List<EntrustReceRespose> entrustReceEntities = entrustReceService.filterJoinEntrustRec(basicExportStatusRequest);
PageInfo<EntrustReceRespose> pageInfo;
pageInfo = new PageInfo<>(entrustReceEntities);
PageSimpleResponse<EntrustReceRespose> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(entrustReceEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
//手持终端下载委托验收
@GetMapping("/spms/entrust/rece/downloads")
public BaseResponse downloadEntrust(BasicEntrustRecRequest basicExportStatusRequest) {
Integer userId = customerService.getUserId();
basicExportStatusRequest.setEntrustUser(userId + "");
List<DlEntrustReceEntity> entrustReceEntities = entrustReceService.downloadEntrustRec(basicExportStatusRequest);
PageInfo<DlEntrustReceEntity> pageInfo;
pageInfo = new PageInfo<>(entrustReceEntities);
PageSimpleResponse<DlEntrustReceEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(entrustReceEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@GetMapping("/spms/entrust/rece/filterAllNoUse")
public BaseResponse filterAllNoUse(BasicEntrustRecRequest basicExportStatusRequest) {
Integer uerId = customerService.getUserId();
BussinessTypeFilterRequest bussinessTypeFilterRequest = new BussinessTypeFilterRequest();
bussinessTypeFilterRequest.setUserId(uerId);
List<BussinessTypeEntity> bussinessTypeEntities = bussinessTypeService.filterAllByUser(bussinessTypeFilterRequest);
return ResultVOUtils.success(bussinessTypeEntities);
}
@PostMapping("/spms/entrust/rece/add")
public BaseResponse aadEntrustRece(@RequestBody EntrustReceEntity entrustReceEntity) {
Integer userId = customerService.getUserId();
entrustReceEntity.setUserId(userId + "");
entrustReceEntity.setUpdateTime(new Date());
boolean b = entrustReceService.insertEntrustRec(entrustReceEntity);
if (b) {
return ResultVOUtils.success("添加成功!");
} else {
return ResultVOUtils.error(500, "添加失败!");
}
}
@PostMapping("/spms/entrust/rece/update")
public BaseResponse updateEntrustRece(@RequestBody EntrustReceEntity entrustReceEntity) {
boolean b = entrustReceService.updateEntrustRec(entrustReceEntity);
if (b) {
return ResultVOUtils.success("添加成功!");
} else {
return ResultVOUtils.error(500, "添加失败!");
}
}
@PostMapping("/spms/entrust/rece/delete")
public BaseResponse deleteByStatus(@RequestBody DeleteRequest deleteRequest) {
boolean b = entrustReceService.deleteById(deleteRequest.getId());
if (b)
return ResultVOUtils.success("删除成功!");
else
return ResultVOUtils.error(500, "删除失败!");
}
}

@ -351,7 +351,6 @@ public class WareHouseController {
}
@AuthRuleAnnotation("")
@PostMapping("warehouse/inout/enterCode")
public BaseResponse addEndterCode(@RequestBody AddEnterCodeRequest addEnterCodeRequest, BindingResult bindingResult) {
@ -375,33 +374,58 @@ public class WareHouseController {
if (StrUtil.isNotEmpty(newCode)) {
if (newCode.startsWith("10")) {
if (StrUtil.isNotEmpty(originUdiEntity.getBatchNo())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误");
BaseResponse baseResponse = ResultVOUtils.error(501, "批次号重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
} else if (newCode.startsWith("17")) {
if (StrUtil.isNotEmpty(originUdiEntity.getExpireDate())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误");
BaseResponse baseResponse = ResultVOUtils.error(501, "失效日期重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
} else if (newCode.startsWith("11")) {
if (StrUtil.isNotEmpty(originUdiEntity.getProduceDate())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误");
BaseResponse baseResponse = ResultVOUtils.error(501, "生产日期重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
} else if (newCode.startsWith("21")) {
if (StrUtil.isNotEmpty(originUdiEntity.getSerialNo())) {
BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误");
BaseResponse baseResponse = ResultVOUtils.error(501, "序列号重复添加");
baseResponse.setData(originCode);
return baseResponse;
} else {
String msg = checkNewCode(originUdiEntity, newCode);
if (msg != null) {
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
baseResponse.setData(originCode);
return baseResponse;
}
}
// else {
// return ResultVOUtils.success(code);
// }
} else {
BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误");
BaseResponse baseResponse = ResultVOUtils.error(501, "格式错误");
baseResponse.setData(originCode);
return baseResponse;
}
@ -412,7 +436,7 @@ public class WareHouseController {
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
if (udiEntity == null) {
BaseResponse baseResponse = ResultVOUtils.error(501, "DI格式错误");
BaseResponse baseResponse = ResultVOUtils.error(501, "UDI格式错误");
baseResponse.setData(originCode);
return baseResponse;
}
@ -423,30 +447,31 @@ public class WareHouseController {
}
}
UdiRelevanceResponse checkUdi = udiRelevanceService.selectByNameCode(udiEntity.getUdi());
if (checkUdi == null) {
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
}
boolean checkSuccess = true;
String lostMsg = "";
//校验条码完整性
if (("是".equals(checkUdi.getScbssfbhph()) && StrUtil.isEmpty(udiEntity.getBatchNo()))) {
if (!checkUdi.isAllowNoBatch())
checkSuccess = false;
if (!checkUdi.isAllowNoBatch() && StrUtil.isEmpty(udiEntity.getBatchNo())) {
checkSuccess = false;
lostMsg = lostMsg + ",批次号";
}
if (("是".equals(checkUdi.getScbssfbhscrq()) && StrUtil.isEmpty(udiEntity.getProduceDate()))
) {
if (!checkUdi.isAllowNoProduct())
checkSuccess = false;
if (!checkUdi.isAllowNoProduct() && StrUtil.isEmpty(udiEntity.getProduceDate())) {
checkSuccess = false;
lostMsg = lostMsg + ",生产日期";
}
if (("是".equals(checkUdi.getScbssfbhsxrq()) && StrUtil.isEmpty(udiEntity.getExpireDate()))
) {
if (!checkUdi.isAllowNoExpire())
checkSuccess = false;
if (!checkUdi.isAllowNoExpire() && StrUtil.isEmpty(udiEntity.getExpireDate())) {
checkSuccess = false;
lostMsg = lostMsg + ",失效日期";
}
if (("是".equals(checkUdi.getScbssfbhxlh()) && StrUtil.isEmpty(udiEntity.getSerialNo()))
) {
checkSuccess = false;
lostMsg = lostMsg + ",序列号";
}
if (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && udiEntity.getSerialNo().length() > 20) {
checkSuccess = false;
@ -465,8 +490,12 @@ public class WareHouseController {
}
return ResultVOUtils.success(code);
} else {
if (newCode.startsWith("21")) {
BaseResponse baseResponse = ResultVOUtils.error(503, "当前条码未完成,是否继续添加?");
if (newCode.startsWith("21") || (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && newCode.contains("21" + udiEntity.getSerialNo()))) {
if (StrUtil.isEmpty(lostMsg)) {
lostMsg = ",";
}
BaseResponse baseResponse = ResultVOUtils.error(503, "条码完整性错误,缺少" + lostMsg.substring(1) + "是否继续添加?");
baseResponse.setData(code);
return baseResponse;
}
@ -476,6 +505,26 @@ public class WareHouseController {
return baseResponse;
}
public String checkNewCode(UdiEntity originEnity, String newCode) {
UdiEntity newEntity = FilterUdiUtils.getUdi(originEnity.getUdi() + newCode);
if (newEntity == null || originEnity == null) {
return null;
}
if (StrUtil.isNotEmpty(originEnity.getBatchNo()) && StrUtil.isNotEmpty(newEntity.getBatchNo())) {
return "批次号重复添加!";
}
if (StrUtil.isNotEmpty(originEnity.getProduceDate()) && StrUtil.isNotEmpty(newEntity.getProduceDate())) {
return "生产日期重复添加!";
}
if (StrUtil.isNotEmpty(originEnity.getExpireDate()) && StrUtil.isNotEmpty(newEntity.getExpireDate())) {
return "失效日期重复添加!";
}
if (StrUtil.isNotEmpty(originEnity.getSerialNo()) && StrUtil.isNotEmpty(newEntity.getSerialNo())) {
return "序列号重复添加!";
}
return null;
}
//网页端数据上传调用接口
@AuthRuleAnnotation("")

@ -0,0 +1,28 @@
package com.glxp.api.admin.dao.basic;
import com.glxp.api.admin.entity.basic.DlEntrustReceEntity;
import com.glxp.api.admin.entity.basic.EntrustReceEntity;
import com.glxp.api.admin.req.basic.BasicEntrustRecRequest;
import com.glxp.api.admin.res.basic.EntrustReceRespose;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface EntrustReceDao {
List<EntrustReceEntity> filterEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
List<DlEntrustReceEntity> downloadEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
List<EntrustReceRespose> filterJoinEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
boolean insertEntrustRec(EntrustReceEntity ioOrderStatusEntity);
boolean deleteById(String id);
boolean updateEntrustRec(EntrustReceEntity warehouseEntity);
}

@ -0,0 +1,14 @@
package com.glxp.api.admin.entity.basic;
import lombok.Data;
@Data
public class DlEntrustReceEntity {
private Integer id;
private String action;
private String name;
private String mainAction;
}

@ -0,0 +1,21 @@
package com.glxp.api.admin.entity.basic;
import lombok.Data;
import java.util.Date;
@Data
public class EntrustReceEntity {
private Integer id;
private String action;
private String curInv;
private String entrustInv;
private String entrustUser;
private String userId;
private String entrustAction;
private Date updateTime;
private String remark;
private boolean finishRece;
}

@ -0,0 +1,20 @@
package com.glxp.api.admin.req.basic;
import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data;
import java.util.Date;
@Data
public class BasicEntrustRecRequest extends ListPageRequest {
private Integer id;
private String action;
private String entrustInv;
private String entrustUser;
private String userId;
private Date updateTime;
private String curInv;
}

@ -0,0 +1,25 @@
package com.glxp.api.admin.res.basic;
import lombok.Data;
import java.util.Date;
@Data
public class EntrustReceRespose {
private Integer id;
private String action;
private String entrustInv;
private String entrustUser;
private String userId;
private String entrustAction;
private Date updateTime;
private String remark;
private boolean finishRece;
private String curName;
private String entrustName;
private String employeeName;
private String entrustInvName;
private String curInv;
private String curInvName;
}

@ -0,0 +1,27 @@
package com.glxp.api.admin.service.basic;
import com.glxp.api.admin.entity.basic.DlEntrustReceEntity;
import com.glxp.api.admin.entity.basic.EntrustReceEntity;
import com.glxp.api.admin.req.basic.BasicEntrustRecRequest;
import com.glxp.api.admin.res.basic.EntrustReceRespose;
import java.util.List;
public interface EntrustReceService {
EntrustReceEntity findById(Integer id);
List<EntrustReceEntity> filterEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
List<DlEntrustReceEntity> downloadEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
List<EntrustReceRespose> filterJoinEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
boolean insertEntrustRec(EntrustReceEntity ioOrderStatusEntity);
boolean deleteById(String id);
boolean updateEntrustRec(EntrustReceEntity warehouseEntity);
}

@ -0,0 +1,86 @@
package com.glxp.api.admin.service.basic.impl;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.basic.EntrustReceDao;
import com.glxp.api.admin.entity.basic.DlEntrustReceEntity;
import com.glxp.api.admin.entity.basic.EntrustReceEntity;
import com.glxp.api.admin.req.basic.BasicEntrustRecRequest;
import com.glxp.api.admin.res.basic.EntrustReceRespose;
import com.glxp.api.admin.service.basic.EntrustReceService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class EntrustReceServiceImpl implements EntrustReceService {
@Resource
EntrustReceDao entrustReceDao;
@Override
public EntrustReceEntity findById(Integer id) {
BasicEntrustRecRequest basicEntrustRecRequest = new BasicEntrustRecRequest();
basicEntrustRecRequest.setId(id);
List<EntrustReceEntity> entrustReceEntities = entrustReceDao.filterEntrustRec(basicEntrustRecRequest);
if (CollUtil.isNotEmpty(entrustReceEntities)) {
return entrustReceEntities.get(0);
}
return null;
}
@Override
public List<EntrustReceEntity> filterEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest) {
if (basicEntrustRecRequest == null) {
return Collections.emptyList();
}
if (basicEntrustRecRequest.getPage() != null) {
int offset = (basicEntrustRecRequest.getPage() - 1) * basicEntrustRecRequest.getLimit();
PageHelper.offsetPage(offset, basicEntrustRecRequest.getLimit());
}
return entrustReceDao.filterEntrustRec(basicEntrustRecRequest);
}
@Override
public List<DlEntrustReceEntity> downloadEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest) {
if (basicEntrustRecRequest == null) {
return Collections.emptyList();
}
if (basicEntrustRecRequest.getPage() != null) {
int offset = (basicEntrustRecRequest.getPage() - 1) * basicEntrustRecRequest.getLimit();
PageHelper.offsetPage(offset, basicEntrustRecRequest.getLimit());
}
return entrustReceDao.downloadEntrustRec(basicEntrustRecRequest);
}
@Override
public List<EntrustReceRespose> filterJoinEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest) {
if (basicEntrustRecRequest == null) {
return Collections.emptyList();
}
if (basicEntrustRecRequest.getPage() != null) {
int offset = (basicEntrustRecRequest.getPage() - 1) * basicEntrustRecRequest.getLimit();
PageHelper.offsetPage(offset, basicEntrustRecRequest.getLimit());
}
return entrustReceDao.filterJoinEntrustRec(basicEntrustRecRequest);
}
@Override
public boolean insertEntrustRec(EntrustReceEntity entrustReceEntity) {
return entrustReceDao.insertEntrustRec(entrustReceEntity);
}
@Override
public boolean deleteById(String id) {
return entrustReceDao.deleteById(id);
}
@Override
public boolean updateEntrustRec(EntrustReceEntity entrustReceEntity) {
return entrustReceDao.updateEntrustRec(entrustReceEntity);
}
}

@ -50,6 +50,10 @@ public class FilterUdiUtils {
} else {
serialNo = null;
}
}else{
if (last.length() >= 10 && last.substring(8, 10).equals("21")){
serialNo = last.substring(10);
}
}
} else if ((last != null && last.length() >= 2) && last.substring(0, 2).equals("17")) {
expireDate = last.substring(2, 8);
@ -60,6 +64,10 @@ public class FilterUdiUtils {
} else {
serialNo = null;
}
}else {
if (last.length() >= 10 && last.substring(8, 10).equals("21")){
serialNo = last.substring(10);
}
}
} else if ((last != null && last.length() >= 2) && last.substring(0, 2).equals("21")) {
serialNo = last.substring(2, last.length());

@ -0,0 +1,135 @@
<?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.glxp.api.admin.dao.basic.EntrustReceDao">
<select id="filterEntrustRec" parameterType="com.glxp.api.admin.req.basic.BasicEntrustRecRequest"
resultType="com.glxp.api.admin.entity.basic.EntrustReceEntity">
select * from basic_entrust_accept
<where>
<if test="id != '' and id!=null">
and id = #{id}
</if>
<if test="action!=null">
and action = #{action}
</if>
<if test="entrustInv!=null">
and entrustInv = #{entrustInv}
</if>
<if test="entrustUser != '' and entrustUser!=null">
and entrustUser = #{entrustUser}
</if>
<if test="userId!=null">
and userId = #{userId}
</if>
<if test="curInv!=null">
and curInv = #{curInv}
</if>
</where>
order by updateTime desc
</select>
<select id="downloadEntrustRec" parameterType="com.glxp.api.admin.req.basic.BasicEntrustRecRequest"
resultType="com.glxp.api.admin.entity.basic.DlEntrustReceEntity">
select
basic_entrust_accept.id,b.name,b.action,b.mainAction
from basic_entrust_accept
INNER JOIN basic_bustype_local a on basic_entrust_accept.action = a.action
INNER JOIN basic_bussiness_type b on a.action = b.localAction
LEFT JOIN auth_user on basic_entrust_accept.entrustUser = auth_user.id
<where>
<if test="id != '' and id!=null">
and id = #{id}
</if>
<if test="action!=null">
and basic_entrust_accept.action = #{action}
</if>
<if test="entrustInv!=null">
and basic_entrust_accept.entrustInv = #{entrustInv}
</if>
<if test="entrustUser != '' and entrustUser!=null">
and basic_entrust_accept.entrustUser = #{entrustUser}
</if>
<if test="userId!=null">
and basic_entrust_accept.userId = #{userId}
</if>
</where>
</select>
<select id="filterJoinEntrustRec" parameterType="com.glxp.api.admin.req.basic.BasicEntrustRecRequest"
resultType="com.glxp.api.admin.res.basic.EntrustReceRespose">
select basic_entrust_accept.* ,
a.name curName, b.name entrustName,auth_user.employeeName
,c.name entrustInvName,d.name curInvName
from basic_entrust_accept
LEFT JOIN basic_bustype_local a on basic_entrust_accept.action = a.action
LEFT JOIN basic_bussiness_type b on basic_entrust_accept.entrustAction = b.action
LEFT JOIN auth_user on basic_entrust_accept.entrustUser = auth_user.id
LEFT JOIN inv_warehouse c on basic_entrust_accept.entrustInv = c.`code`
LEFT JOIN inv_warehouse d on basic_entrust_accept.curInv = d.`code`
<where>
<if test="id != '' and id!=null">
and id = #{id}
</if>
<if test="action!=null">
and action = #{action}
</if>
<if test="entrustInv!=null">
and entrustInv = #{entrustInv}
</if>
<if test="entrustUser != '' and entrustUser!=null">
and entrustUser = #{entrustUser}
</if>
<if test="userId!=null">
and userId = #{userId}
</if>
<if test="curInv!=null">
and curInv = #{curInv}
</if>
</where>
order by updateTime desc
</select>
<insert id="insertEntrustRec" keyProperty="id"
parameterType="com.glxp.api.admin.entity.basic.EntrustReceEntity">
replace
INTO basic_entrust_accept(id,`action`, entrustInv, `entrustUser`, userId, updateTime, remark,entrustAction,finishRece,curInv)
values (
#{id},
#{action},
#{entrustInv},
#{entrustUser},
#{userId},
#{updateTime},
#{remark},
#{entrustAction},
#{finishRece},
#{curInv}
)
</insert>
<update id="updateEntrustRec" parameterType="com.glxp.api.admin.entity.basic.EntrustReceEntity">
UPDATE basic_entrust_accept
<trim prefix="set" suffixOverrides=",">
<if test="action != null">action=#{action},</if>
<if test="entrustInv != null">entrustInv=#{entrustInv},</if>
<if test="entrustUser != null">entrustUser=#{entrustUser},</if>
<if test="userId != null">userId=#{userId},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="curInv != null">curInv=#{curInv},</if>
<if test="remark != null">remark=#{remark},</if>
<if test="finishRece != null">finishRece=#{finishRece},</if>
<if test="entrustAction != null">entrustAction=#{entrustAction},</if>
</trim>
WHERE id = #{id}
</update>
<delete id="deleteById" parameterType="Map">
DELETE
FROM basic_entrust_accept
WHERE id = #{id}
</delete>
</mapper>
Loading…
Cancel
Save