|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
package com.glxp.api.controller.basic;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.controller.BaseController;
|
|
|
|
|
import com.glxp.api.entity.auth.InvWarehouseEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.DlEntrustReceEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.EntrustReceEntity;
|
|
|
|
@ -14,6 +16,7 @@ import com.glxp.api.req.system.DeleteRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.res.basic.EntrustReceResponse;
|
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
|
import com.glxp.api.service.auth.InvWarehouseService;
|
|
|
|
|
import com.glxp.api.service.basic.EntrustReceService;
|
|
|
|
|
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
@ -67,16 +70,31 @@ public class EntrustReceController extends BaseController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
|
|
|
|
|
@PostMapping("/spms/entrust/rece/add")
|
|
|
|
|
public BaseResponse aadEntrustRece(@RequestBody EntrustReceEntity entrustReceEntity) {
|
|
|
|
|
entrustReceEntity.setUserId(getUserId());
|
|
|
|
|
entrustReceEntity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
|
|
EntrustReceEntity temp = entrustReceService.findByUnique(entrustReceEntity.getAction(), entrustReceEntity.getEntrustUser());
|
|
|
|
|
if (temp != null) {
|
|
|
|
|
return ResultVOUtils.error(500, "已存在相同的委托验收");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(entrustReceEntity.getCurInv())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前仓库不能为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(entrustReceEntity.getEntrustInv())) {
|
|
|
|
|
return ResultVOUtils.error(500, "委托验收仓库不能为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InvWarehouseEntity curEntity = invWarehouseService.findByInvSubByCode(entrustReceEntity.getCurInv());
|
|
|
|
|
InvWarehouseEntity entrustEntity = invWarehouseService.findByInvSubByCode(entrustReceEntity.getEntrustInv());
|
|
|
|
|
entrustReceEntity.setEntrustDept(entrustEntity.getParentId());
|
|
|
|
|
entrustReceEntity.setCurDept(curEntity.getParentId());
|
|
|
|
|
|
|
|
|
|
int b = entrustReceService.insertEntrustRec(entrustReceEntity);
|
|
|
|
|
if (b > 0) {
|
|
|
|
|
return ResultVOUtils.success("添加成功!");
|
|
|
|
@ -89,9 +107,19 @@ public class EntrustReceController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@PostMapping("/spms/entrust/rece/update")
|
|
|
|
|
public BaseResponse updateEntrustRece(@RequestBody EntrustReceEntity entrustReceEntity) {
|
|
|
|
|
entrustReceEntity.setUpdateTime(new Date());
|
|
|
|
|
if (StrUtil.isEmpty(entrustReceEntity.getCurInv())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前仓库不能为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(entrustReceEntity.getEntrustInv())) {
|
|
|
|
|
return ResultVOUtils.error(500, "委托验收仓库不能为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
entrustReceEntity.setUpdateTime(new Date());
|
|
|
|
|
InvWarehouseEntity curEntity = invWarehouseService.findByInvSubByCode(entrustReceEntity.getCurInv());
|
|
|
|
|
InvWarehouseEntity entrustEntity = invWarehouseService.findByInvSubByCode(entrustReceEntity.getEntrustInv());
|
|
|
|
|
entrustReceEntity.setEntrustDept(entrustEntity.getParentId());
|
|
|
|
|
entrustReceEntity.setCurDept(curEntity.getParentId());
|
|
|
|
|
int b = entrustReceService.updateEntrustRec(entrustReceEntity);
|
|
|
|
|
if (b > 0) {
|
|
|
|
|
return ResultVOUtils.success("添加成功!");
|
|
|
|
|