diff --git a/api-admin/src/main/java/com/glxp/api/admin/controller/basic/EntrustReceController.java b/api-admin/src/main/java/com/glxp/api/admin/controller/basic/EntrustReceController.java new file mode 100644 index 00000000..3423ce6a --- /dev/null +++ b/api-admin/src/main/java/com/glxp/api/admin/controller/basic/EntrustReceController.java @@ -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 entrustReceEntities = entrustReceService.filterJoinEntrustRec(basicExportStatusRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(entrustReceEntities); + PageSimpleResponse 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 entrustReceEntities = entrustReceService.downloadEntrustRec(basicExportStatusRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(entrustReceEntities); + PageSimpleResponse 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 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, "删除失败!"); + } + + +} diff --git a/api-admin/src/main/java/com/glxp/api/admin/controller/inout/WareHouseController.java b/api-admin/src/main/java/com/glxp/api/admin/controller/inout/WareHouseController.java index 6f98863d..cd681a4b 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/controller/inout/WareHouseController.java +++ b/api-admin/src/main/java/com/glxp/api/admin/controller/inout/WareHouseController.java @@ -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("") diff --git a/api-admin/src/main/java/com/glxp/api/admin/dao/basic/EntrustReceDao.java b/api-admin/src/main/java/com/glxp/api/admin/dao/basic/EntrustReceDao.java new file mode 100644 index 00000000..08a95284 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/api/admin/dao/basic/EntrustReceDao.java @@ -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 filterEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest); + + List downloadEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest); + + + List filterJoinEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest); + + boolean insertEntrustRec(EntrustReceEntity ioOrderStatusEntity); + + boolean deleteById(String id); + + boolean updateEntrustRec(EntrustReceEntity warehouseEntity); + +} diff --git a/api-admin/src/main/java/com/glxp/api/admin/entity/basic/DlEntrustReceEntity.java b/api-admin/src/main/java/com/glxp/api/admin/entity/basic/DlEntrustReceEntity.java new file mode 100644 index 00000000..f3822b0e --- /dev/null +++ b/api-admin/src/main/java/com/glxp/api/admin/entity/basic/DlEntrustReceEntity.java @@ -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; + +} diff --git a/api-admin/src/main/java/com/glxp/api/admin/entity/basic/EntrustReceEntity.java b/api-admin/src/main/java/com/glxp/api/admin/entity/basic/EntrustReceEntity.java new file mode 100644 index 00000000..b61156bc --- /dev/null +++ b/api-admin/src/main/java/com/glxp/api/admin/entity/basic/EntrustReceEntity.java @@ -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; + +} diff --git a/api-admin/src/main/java/com/glxp/api/admin/req/basic/BasicEntrustRecRequest.java b/api-admin/src/main/java/com/glxp/api/admin/req/basic/BasicEntrustRecRequest.java new file mode 100644 index 00000000..34a75295 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/api/admin/req/basic/BasicEntrustRecRequest.java @@ -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; + + +} diff --git a/api-admin/src/main/java/com/glxp/api/admin/res/basic/EntrustReceRespose.java b/api-admin/src/main/java/com/glxp/api/admin/res/basic/EntrustReceRespose.java new file mode 100644 index 00000000..04841822 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/api/admin/res/basic/EntrustReceRespose.java @@ -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; + +} diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/basic/EntrustReceService.java b/api-admin/src/main/java/com/glxp/api/admin/service/basic/EntrustReceService.java new file mode 100644 index 00000000..4afb86f9 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/api/admin/service/basic/EntrustReceService.java @@ -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 filterEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest); + + List downloadEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest); + + List filterJoinEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest); + + boolean insertEntrustRec(EntrustReceEntity ioOrderStatusEntity); + + boolean deleteById(String id); + + boolean updateEntrustRec(EntrustReceEntity warehouseEntity); + +} diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/basic/impl/EntrustReceServiceImpl.java b/api-admin/src/main/java/com/glxp/api/admin/service/basic/impl/EntrustReceServiceImpl.java new file mode 100644 index 00000000..005a1cee --- /dev/null +++ b/api-admin/src/main/java/com/glxp/api/admin/service/basic/impl/EntrustReceServiceImpl.java @@ -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 entrustReceEntities = entrustReceDao.filterEntrustRec(basicEntrustRecRequest); + if (CollUtil.isNotEmpty(entrustReceEntities)) { + return entrustReceEntities.get(0); + } + return null; + } + + @Override + public List 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 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 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); + } +} diff --git a/api-admin/src/main/java/com/glxp/api/admin/util/FilterUdiUtils.java b/api-admin/src/main/java/com/glxp/api/admin/util/FilterUdiUtils.java index 6bfea07b..9e39ed7c 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/util/FilterUdiUtils.java +++ b/api-admin/src/main/java/com/glxp/api/admin/util/FilterUdiUtils.java @@ -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()); diff --git a/api-admin/src/main/resources/mybatis/mapper/basic/EntrustReceDao.xml b/api-admin/src/main/resources/mybatis/mapper/basic/EntrustReceDao.xml new file mode 100644 index 00000000..0e4f9a42 --- /dev/null +++ b/api-admin/src/main/resources/mybatis/mapper/basic/EntrustReceDao.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + 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} + ) + + + + UPDATE basic_entrust_accept + + action=#{action}, + entrustInv=#{entrustInv}, + entrustUser=#{entrustUser}, + userId=#{userId}, + updateTime=#{updateTime}, + curInv=#{curInv}, + remark=#{remark}, + finishRece=#{finishRece}, + entrustAction=#{entrustAction}, + + WHERE id = #{id} + + + DELETE + FROM basic_entrust_accept + WHERE id = #{id} + + + \ No newline at end of file