You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
6.4 KiB
Java
149 lines
6.4 KiB
Java
package com.glxp.api.controller.basic;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.glxp.api.annotation.Log;
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
import com.glxp.api.constant.BusinessType;
|
|
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;
|
|
import com.glxp.api.req.auth.BussinessTypeFilterRequest;
|
|
import com.glxp.api.req.basic.BasicEntrustRecRequest;
|
|
import com.glxp.api.req.basic.FilterBussinessTypeRequest;
|
|
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;
|
|
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 extends BaseController {
|
|
|
|
|
|
@Resource
|
|
EntrustReceService entrustReceService;
|
|
@Resource
|
|
private IBasicBussinessTypeService bussinessTypeService;
|
|
|
|
@GetMapping("/spms/entrust/rece/filter")
|
|
public BaseResponse getEntrustRece(BasicEntrustRecRequest basicExportStatusRequest) {
|
|
List<EntrustReceResponse> entrustReceEntities = entrustReceService.filterJoinEntrustRec(basicExportStatusRequest);
|
|
PageInfo<EntrustReceResponse> pageInfo;
|
|
pageInfo = new PageInfo<>(entrustReceEntities);
|
|
PageSimpleResponse<EntrustReceResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
pageSimpleResponse.setList(entrustReceEntities);
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
}
|
|
|
|
//手持终端下载委托验收
|
|
@GetMapping("/spms/entrust/rece/downloads")
|
|
public BaseResponse downloadEntrust(BasicEntrustRecRequest basicExportStatusRequest) {
|
|
basicExportStatusRequest.setEntrustUser(getUserId());
|
|
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(FilterBussinessTypeRequest bussinessTypeFilterRequest) {
|
|
bussinessTypeFilterRequest.setUserId(getUserId());
|
|
List<BasicBussinessTypeEntity> bussinessTypeEntities = bussinessTypeService.filterByUser(bussinessTypeFilterRequest);
|
|
return ResultVOUtils.success(bussinessTypeEntities);
|
|
|
|
}
|
|
|
|
@Resource
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
@PostMapping("/spms/entrust/rece/add")
|
|
@Log(title = "单据管理", businessType = BusinessType.INSERT)
|
|
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("添加成功!");
|
|
} else {
|
|
return ResultVOUtils.error(500, "添加失败!");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
@PostMapping("/spms/entrust/rece/update")
|
|
@Log(title = "单据管理", businessType = BusinessType.UPDATE)
|
|
public BaseResponse updateEntrustRece(@RequestBody EntrustReceEntity entrustReceEntity) {
|
|
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("添加成功!");
|
|
} else {
|
|
return ResultVOUtils.error(500, "添加失败!");
|
|
}
|
|
|
|
}
|
|
|
|
@PostMapping("/spms/entrust/rece/delete")
|
|
@Log(title = "单据管理", businessType = BusinessType.DELETE)
|
|
public BaseResponse deleteByStatus(@RequestBody DeleteRequest deleteRequest) {
|
|
|
|
boolean b = entrustReceService.deleteById(deleteRequest.getId());
|
|
if (b)
|
|
return ResultVOUtils.success("删除成功!");
|
|
else
|
|
return ResultVOUtils.error(500, "删除失败!");
|
|
}
|
|
|
|
|
|
}
|