|
|
|
|
@ -3,7 +3,6 @@ package org.springblade.lims.goods.controller; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.mysql.cj.util.StringUtils; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
@ -23,12 +22,9 @@ import org.springblade.lims.goods.service.IGoodsService; |
|
|
|
|
import org.springblade.lims.goods.vo.ApplyVO; |
|
|
|
|
import org.springblade.resource.enums.SysTypeEnum; |
|
|
|
|
import org.springblade.resource.feign.IMessageClient; |
|
|
|
|
import org.springblade.system.cache.DictBizCache; |
|
|
|
|
import org.springblade.system.enums.DictBizEnum; |
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
@ -168,6 +164,7 @@ public class ApplyController extends BladeController { |
|
|
|
|
// 消息通知
|
|
|
|
|
if (userList != null) { |
|
|
|
|
for (User user : userList) { |
|
|
|
|
// id硬编码
|
|
|
|
|
if ("1542095624162525185".equals(user.getRoleId())) { |
|
|
|
|
apply.setApproveUserId(user.getId()); |
|
|
|
|
apply.setApproveUser(user.getName()); |
|
|
|
|
@ -176,6 +173,7 @@ public class ApplyController extends BladeController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// id硬编码
|
|
|
|
|
messageClient.event(SysTypeEnum.INFORM.getValue(), "申领出库", |
|
|
|
|
"你有新的申领单待出库,请及时处理", 1, 5, "1533753689484058625", "/capital/shenlingList"); |
|
|
|
|
} else { |
|
|
|
|
@ -183,6 +181,7 @@ public class ApplyController extends BladeController { |
|
|
|
|
// 消息通知
|
|
|
|
|
if (userList != null) { |
|
|
|
|
for (User user : userList) { |
|
|
|
|
// id硬编码
|
|
|
|
|
if ("1542095624162525185".equals(user.getRoleId())) { |
|
|
|
|
messageClient.event(SysTypeEnum.INFORM.getValue(), "申领审核", |
|
|
|
|
"你有新的申领单待审核,请及时处理", 1, 5, user.getId().toString(), "/capital/shenlingList"); |
|
|
|
|
@ -248,6 +247,7 @@ public class ApplyController extends BladeController { |
|
|
|
|
// 通过
|
|
|
|
|
if (apply.getStatus() == 1) { |
|
|
|
|
// 消息通知
|
|
|
|
|
// id硬编码
|
|
|
|
|
messageClient.event(SysTypeEnum.INFORM.getValue(), "申领出库", |
|
|
|
|
"你有新的申领单待出库,请及时处理", 1, 5, "1533753689484058625", "/capital/shenlingList"); |
|
|
|
|
} |
|
|
|
|
@ -376,44 +376,7 @@ public class ApplyController extends BladeController { |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/return") |
|
|
|
|
public void reture(@RequestBody Apply apply) { |
|
|
|
|
boolean isComplete = true; |
|
|
|
|
List<ApplyDetail> applyDetails = apply.getApplyDetails(); |
|
|
|
|
if (applyDetails != null && applyDetails.size() > 0) { |
|
|
|
|
for (ApplyDetail detail : applyDetails) { |
|
|
|
|
// 库存入库
|
|
|
|
|
Goods goods = goodsService.getById(detail.getProductId()); |
|
|
|
|
goods.setNum(goods.getNum() + detail.getReturnNum()); |
|
|
|
|
goodsService.updateById(goods); |
|
|
|
|
|
|
|
|
|
//批次数量回填(批次数量入库)
|
|
|
|
|
LambdaQueryWrapper<ProductStoreDetial> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(ProductStoreDetial::getGoodsId, detail.getProductId()) |
|
|
|
|
.eq(ProductStoreDetial::getPNum, detail.getBatchNum()); |
|
|
|
|
ProductStoreDetial productStoreDetail = productStoreDetialService.getOne(wrapper); |
|
|
|
|
productStoreDetail.setNum(productStoreDetail.getNum() + detail.getReturnNum()); |
|
|
|
|
productStoreDetialService.updateById(productStoreDetail); |
|
|
|
|
|
|
|
|
|
if (detail.getIsReturn() != 1) { |
|
|
|
|
ApplyDetail byId = applyDetailService.getById(detail.getId()); |
|
|
|
|
if (byId != null) { |
|
|
|
|
Integer total = byId.getReturnNum() + detail.getReturnNum(); |
|
|
|
|
if (detail.getOutNum().equals(total)) { |
|
|
|
|
detail.setIsReturn(1); |
|
|
|
|
} |
|
|
|
|
detail.setReturnNum(total); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (ApplyDetail detail : applyDetails) { |
|
|
|
|
if (detail.getIsReturn() == 0) { |
|
|
|
|
isComplete = false; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
apply.setStatus(isComplete ? 4 : 3); |
|
|
|
|
applyService.updateById(apply); |
|
|
|
|
applyDetailService.updateBatchById(applyDetails); |
|
|
|
|
applyService.reture(apply); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -428,7 +391,6 @@ public class ApplyController extends BladeController { |
|
|
|
|
// 申领详情
|
|
|
|
|
LambdaQueryWrapper<ApplyDetail> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(ApplyDetail::getApplyId, apply.getId()); |
|
|
|
|
// wrapper.isNotNull(ApplyDetail::getReturnTime);
|
|
|
|
|
List<ApplyDetail> applyDetails = applyDetailService.list(wrapper); |
|
|
|
|
if (applyDetails != null && applyDetails.size() > 0) { |
|
|
|
|
for (ApplyDetail detail : applyDetails) { |
|
|
|
|
@ -442,7 +404,7 @@ public class ApplyController extends BladeController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 8.查看详情 |
|
|
|
|
* 9.查看详情 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/applyInfo") |
|
|
|
|
public R<Apply> applyInfo(Apply apply) { |
|
|
|
|
@ -464,42 +426,19 @@ public class ApplyController extends BladeController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 9.更改申领单或申领物品信息 |
|
|
|
|
* 10.更改申领单或申领物品信息 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/updateApplyOrDetails") |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public boolean updateApplyOrDetails(@RequestBody Apply apply) { |
|
|
|
|
// List<ApplyDetail> applyDetails = apply.getApplyDetails();
|
|
|
|
|
// if (applyDetails != null && applyDetails.size() > 0) {
|
|
|
|
|
// for (ApplyDetail applyDetail : applyDetails) {
|
|
|
|
|
// applyDetail.setOutNum(applyDetail.getNewOutNum());
|
|
|
|
|
// }
|
|
|
|
|
// applyDetailService.updateBatchById(applyDetails);
|
|
|
|
|
// }
|
|
|
|
|
// return applyService.updateById(apply);
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<ApplyDetail> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(ApplyDetail::getApplyId, apply.getId()); |
|
|
|
|
List<ApplyDetail> details = applyDetailService.list(wrapper); |
|
|
|
|
for (ApplyDetail detail : details) { |
|
|
|
|
if (detail.getReturnTime() != null) { |
|
|
|
|
apply.setStatus(3); |
|
|
|
|
break; |
|
|
|
|
} else { |
|
|
|
|
apply.setStatus(4); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return applyService.updateById(apply); |
|
|
|
|
return applyService.updateApplyOrDetails(apply); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 10.出库单打印 |
|
|
|
|
* 11.出库单打印 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/print") |
|
|
|
|
public void print(String id, HttpServletResponse response) { |
|
|
|
|
applyService.print(id, response); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|