|
|
|
@ -7,18 +7,22 @@ import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.api.constant.ConstantType;
|
|
|
|
|
import com.glxp.api.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.api.entity.auth.InvWarehouseEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiProductEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderMutiEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderMutiSetEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderMutiUseEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.*;
|
|
|
|
|
import com.glxp.api.req.inout.IoOrderMutiRequest;
|
|
|
|
|
import com.glxp.api.res.inout.IoOrderMutiResponse;
|
|
|
|
|
import com.glxp.api.res.inout.IoOrderMutiSetResponse;
|
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
|
import com.glxp.api.service.auth.InvWarehouseService;
|
|
|
|
|
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
|
|
|
|
import com.glxp.api.service.basic.UdiProductService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderMutiService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderMutiUseService;
|
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
|
|
import com.glxp.api.util.OrderNoTypeBean;
|
|
|
|
|
import com.glxp.api.util.RedisUtil;
|
|
|
|
@ -31,10 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
public class IoOrderMutiController {
|
|
|
|
@ -46,11 +47,21 @@ public class IoOrderMutiController {
|
|
|
|
|
@Resource
|
|
|
|
|
private IoOrderMutiUseService ioOrderMutiUseService;
|
|
|
|
|
@Resource
|
|
|
|
|
private IoOrderMutiSetService ioOrderMutiSetService;
|
|
|
|
|
@Resource
|
|
|
|
|
RedisUtil redisUtil;
|
|
|
|
|
@Resource
|
|
|
|
|
CustomerService customerService;
|
|
|
|
|
@Resource
|
|
|
|
|
GennerOrderUtils gennerOrderUtils;
|
|
|
|
|
@Resource
|
|
|
|
|
private IoOrderService orderService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCodeTempService codeTempService;
|
|
|
|
|
@Resource
|
|
|
|
|
IBasicBussinessTypeService basicBussinessTypeService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inout/order/muti/checkUdi")
|
|
|
|
@ -72,13 +83,15 @@ public class IoOrderMutiController {
|
|
|
|
|
return ResultVOUtils.success(ioOrderMutiEntityOne.getId());
|
|
|
|
|
} else {
|
|
|
|
|
//查询物资信息
|
|
|
|
|
UdiProductEntity udiProductEntity = udiProductService.findByNameCode(udiEntity.getUdi());
|
|
|
|
|
UdiProductEntity udiProductEntity = udiProductService.selectUdiByName(udiEntity.getUdi());
|
|
|
|
|
ioOrderMutiEntityOne = new IoOrderMutiEntity();
|
|
|
|
|
ioOrderMutiEntityOne.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
ioOrderMutiEntityOne.setRelIdFk(udiProductEntity.getRelId());
|
|
|
|
|
ioOrderMutiEntityOne.setMark(ioOrderMutiEntity.getMark());
|
|
|
|
|
ioOrderMutiEntityOne.setUdiCode(ioOrderMutiEntity.getUdiCode());
|
|
|
|
|
ioOrderMutiEntityOne.setBatchNo(udiProductEntity.getBatchNo());
|
|
|
|
|
ioOrderMutiEntityOne.setExpireDate(udiProductEntity.getExpireDate());
|
|
|
|
|
ioOrderMutiEntityOne.setProduceDate(udiProductEntity.getProduceDate());
|
|
|
|
|
ioOrderMutiEntityOne.setBatchNo(udiEntity.getBatchNo());
|
|
|
|
|
ioOrderMutiEntityOne.setExpireDate(udiEntity.getExpireDate());
|
|
|
|
|
ioOrderMutiEntityOne.setProduceDate(udiEntity.getProduceDate());
|
|
|
|
|
ioOrderMutiEntityOne.setTotalCount(20);
|
|
|
|
|
ioOrderMutiEntityOne.setStatus(0);
|
|
|
|
|
ioOrderMutiEntityOne.setCreateUser(customerService.getUserId() + "");
|
|
|
|
@ -87,7 +100,7 @@ public class IoOrderMutiController {
|
|
|
|
|
ioOrderMutiEntityOne.setCreateTime(new Date());
|
|
|
|
|
ioOrderMutiEntityOne.setUpdateTime(new Date());
|
|
|
|
|
ioOrderMutiEntityOne.setNameCode(udiProductEntity.getNameCode());
|
|
|
|
|
ioOrderMutiEntityOne.setSerialNo(udiProductEntity.getSerialNo());
|
|
|
|
|
ioOrderMutiEntityOne.setSerialNo(udiEntity.getSerialNo());
|
|
|
|
|
ioOrderMutiEntityOne.setSupId(udiProductEntity.getSupId());
|
|
|
|
|
ioOrderMutiService.save(ioOrderMutiEntityOne);
|
|
|
|
|
return ResultVOUtils.success(ioOrderMutiEntityOne.getId());
|
|
|
|
@ -129,14 +142,16 @@ public class IoOrderMutiController {
|
|
|
|
|
if (StrUtil.isNotBlank(ioOrderMutiEntity.getUdiCode())) {
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(ioOrderMutiEntity.getUdiCode());
|
|
|
|
|
//查询物资信息
|
|
|
|
|
UdiProductEntity udiProductEntity = udiProductService.findByNameCode(udiEntity.getUdi());
|
|
|
|
|
UdiProductEntity udiProductEntity = udiProductService.selectUdiByName(udiEntity.getUdi());
|
|
|
|
|
|
|
|
|
|
IoOrderMutiEntity ioOrderMutiEntity1 = new IoOrderMutiEntity();
|
|
|
|
|
ioOrderMutiEntity1.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
ioOrderMutiEntity1.setRelIdFk(udiProductEntity.getRelId());
|
|
|
|
|
ioOrderMutiEntity1.setMark(ioOrderMutiEntity.getMark());
|
|
|
|
|
ioOrderMutiEntity1.setUdiCode(ioOrderMutiEntity.getUdiCode());
|
|
|
|
|
ioOrderMutiEntity1.setBatchNo(udiProductEntity.getBatchNo());
|
|
|
|
|
ioOrderMutiEntity1.setExpireDate(udiProductEntity.getExpireDate());
|
|
|
|
|
ioOrderMutiEntity1.setProduceDate(udiProductEntity.getProduceDate());
|
|
|
|
|
ioOrderMutiEntity1.setBatchNo(udiEntity.getBatchNo());
|
|
|
|
|
ioOrderMutiEntity1.setExpireDate(udiEntity.getExpireDate());
|
|
|
|
|
ioOrderMutiEntity1.setProduceDate(udiEntity.getProduceDate());
|
|
|
|
|
ioOrderMutiEntity1.setTotalCount(20);
|
|
|
|
|
ioOrderMutiEntity1.setStatus(0);
|
|
|
|
|
ioOrderMutiEntity1.setUseCount(0);
|
|
|
|
@ -145,7 +160,7 @@ public class IoOrderMutiController {
|
|
|
|
|
ioOrderMutiEntity1.setCreateTime(new Date());
|
|
|
|
|
ioOrderMutiEntity1.setUpdateTime(new Date());
|
|
|
|
|
ioOrderMutiEntity1.setNameCode(udiProductEntity.getNameCode());
|
|
|
|
|
ioOrderMutiEntity1.setSerialNo(udiProductEntity.getSerialNo());
|
|
|
|
|
ioOrderMutiEntity1.setSerialNo(udiEntity.getSerialNo());
|
|
|
|
|
ioOrderMutiEntity1.setSupId(udiProductEntity.getSupId());
|
|
|
|
|
ioOrderMutiService.save(ioOrderMutiEntity1);
|
|
|
|
|
return ResultVOUtils.success(ioOrderMutiEntity1.getId());
|
|
|
|
@ -156,7 +171,75 @@ public class IoOrderMutiController {
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inout/order/muti/updateOrderMuti")
|
|
|
|
|
public BaseResponse updateOrderMuti(@RequestBody IoOrderMutiEntity ioOrderMutiEntity) {
|
|
|
|
|
|
|
|
|
|
String orderNo =ioOrderMutiEntity.getOrderIdFk();
|
|
|
|
|
//如果是第一次的话就插入
|
|
|
|
|
String mark=ioOrderMutiEntity.getMark();
|
|
|
|
|
int totalCount=ioOrderMutiEntity.getTotalCount();
|
|
|
|
|
int useCount=ioOrderMutiEntity.getUseCount();
|
|
|
|
|
int status=ioOrderMutiEntity.getStatus();
|
|
|
|
|
ioOrderMutiEntity= ioOrderMutiService.getById(ioOrderMutiEntity.getId());
|
|
|
|
|
ioOrderMutiEntity.setMark(mark);
|
|
|
|
|
ioOrderMutiEntity.setTotalCount(totalCount);
|
|
|
|
|
ioOrderMutiEntity.setUseCount(useCount);
|
|
|
|
|
ioOrderMutiEntity.setStatus(status);
|
|
|
|
|
if (StrUtil.isBlank(ioOrderMutiEntity.getOrderIdFk())) {
|
|
|
|
|
IoOrderEntity orderEntity = new IoOrderEntity();
|
|
|
|
|
//查询补单条件
|
|
|
|
|
AuthAdmin authAdmin = customerService.getUserBean();
|
|
|
|
|
QueryWrapper<IoOrderMutiSetEntity> setEw = new QueryWrapper<>();
|
|
|
|
|
setEw.eq("curInv", authAdmin.getLocInvCode());
|
|
|
|
|
IoOrderMutiSetEntity ioOrderMutiSetEntity = ioOrderMutiSetService.getOne(setEw);
|
|
|
|
|
if (ioOrderMutiSetEntity == null) {
|
|
|
|
|
return ResultVOUtils.error(999, "请设置补单条件!");
|
|
|
|
|
}
|
|
|
|
|
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(ioOrderMutiSetEntity.getTargetAction());
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(ioOrderMutiSetEntity.getCurInv());
|
|
|
|
|
orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
orderEntity.setBillNo(orderNo);
|
|
|
|
|
orderEntity.setMainAction(ConstantType.TYPE_OUT);
|
|
|
|
|
orderEntity.setCreateUser(authAdmin.getId() + "");
|
|
|
|
|
orderEntity.setCreateTime(new Date());
|
|
|
|
|
orderEntity.setUpdateUser(authAdmin.getId() + "");
|
|
|
|
|
orderEntity.setUpdateTime(new Date());
|
|
|
|
|
orderEntity.setCustomerId(authAdmin.getCustomerId() + "");
|
|
|
|
|
orderEntity.setFromCorp(ioOrderMutiSetEntity.getFromCorp());
|
|
|
|
|
orderEntity.setAction(bussinessTypeEntity.getAction());
|
|
|
|
|
orderEntity.setMainAction(bussinessTypeEntity.getMainAction());
|
|
|
|
|
orderEntity.setDeptCode(invWarehouseEntity.getParentId());
|
|
|
|
|
orderEntity.setInvCode(invWarehouseEntity.getCode());
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
|
|
|
|
|
orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
|
|
|
|
|
orderEntity.setFromType(ConstantStatus.FROM_Muti);
|
|
|
|
|
orderEntity.setOrderType(ConstantStatus.ORDER_TYPE_NORMAL);
|
|
|
|
|
orderEntity.setBusType(bussinessTypeEntity.getBusType());
|
|
|
|
|
//插入单据
|
|
|
|
|
orderService.insertOrder(orderEntity);
|
|
|
|
|
|
|
|
|
|
IoCodeTempEntity ioCodeTempEntity = new IoCodeTempEntity();
|
|
|
|
|
ioCodeTempEntity.setCode(ioOrderMutiEntity.getUdiCode());
|
|
|
|
|
ioCodeTempEntity.setMainAction(ConstantType.TYPE_OUT);
|
|
|
|
|
ioCodeTempEntity.setAction(bussinessTypeEntity.getAction());
|
|
|
|
|
ioCodeTempEntity.setOrderId(orderNo);
|
|
|
|
|
ioCodeTempEntity.setNameCode(ioOrderMutiEntity.getNameCode());
|
|
|
|
|
ioCodeTempEntity.setBatchNo(ioOrderMutiEntity.getBatchNo());
|
|
|
|
|
ioCodeTempEntity.setProduceDate(ioOrderMutiEntity.getProduceDate());
|
|
|
|
|
ioCodeTempEntity.setExpireDate(ioOrderMutiEntity.getExpireDate());
|
|
|
|
|
ioCodeTempEntity.setSerialNo(ioOrderMutiEntity.getSerialNo());
|
|
|
|
|
ioCodeTempEntity.setSupId(ioOrderMutiEntity.getSupId());
|
|
|
|
|
ioCodeTempEntity.setRelId(Long.valueOf(ioOrderMutiEntity.getRelIdFk()));
|
|
|
|
|
ioCodeTempEntity.setCount(ioOrderMutiEntity.getTotalCount());
|
|
|
|
|
ioCodeTempEntity.setReCount(ioOrderMutiEntity.getTotalCount() - ioOrderMutiEntity.getUseCount());
|
|
|
|
|
ioCodeTempEntity.setCreateTime(new Date());
|
|
|
|
|
ioCodeTempEntity.setUpdateTime(new Date());
|
|
|
|
|
ioCodeTempEntity.setDeptCode(invWarehouseEntity.getParentId());
|
|
|
|
|
ioCodeTempEntity.setInvCode(invWarehouseEntity.getCode());
|
|
|
|
|
codeTempService.insert(ioCodeTempEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ioOrderMutiEntity.setReCount(ioOrderMutiEntity.getTotalCount() - ioOrderMutiEntity.getUseCount());
|
|
|
|
|
ioOrderMutiEntity.setOrderIdFk(orderNo);
|
|
|
|
|
ioOrderMutiEntity.setCreateTime(new Date());
|
|
|
|
|
ioOrderMutiEntity.setCreateUser(customerService.getUserId() + "");
|
|
|
|
|
ioOrderMutiEntity.setUpdateTime(new Date());
|
|
|
|
@ -183,6 +266,18 @@ public class IoOrderMutiController {
|
|
|
|
|
@PostMapping("/udiwms/inout/order/muti/filterMutiDetailList")
|
|
|
|
|
public BaseResponse filterMutiDetailList(@RequestBody IoOrderMutiRequest ioOrderMutiRequest) {
|
|
|
|
|
|
|
|
|
|
//判断是不是个人使用
|
|
|
|
|
AuthAdmin authAdmin = customerService.getUserBean();
|
|
|
|
|
QueryWrapper<IoOrderMutiSetEntity> setEw=new QueryWrapper<>();
|
|
|
|
|
setEw.eq("curInv",authAdmin.getLocInvCode());
|
|
|
|
|
IoOrderMutiSetEntity ioOrderMutiSetEntity=ioOrderMutiSetService.getOne(setEw);
|
|
|
|
|
if(ioOrderMutiSetEntity!=null){
|
|
|
|
|
if(ioOrderMutiSetEntity.getCheckUse()==1){
|
|
|
|
|
ioOrderMutiRequest.setCreateUser(authAdmin.getId()+"");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
return ResultVOUtils.error(999,"请先设置多次出库单据类型!");
|
|
|
|
|
}
|
|
|
|
|
ioOrderMutiRequest.setStatus(0);
|
|
|
|
|
List<IoOrderMutiResponse> ioOrderMutiEntityList = ioOrderMutiService.filterList(ioOrderMutiRequest);
|
|
|
|
|
return ResultVOUtils.success(ioOrderMutiEntityList);
|
|
|
|
@ -209,6 +304,25 @@ public class IoOrderMutiController {
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inout/order/muti/addMutiDetail")
|
|
|
|
|
public BaseResponse addMutiDetail(@RequestBody IoOrderMutiUseEntity ioOrderMutiUseEntity) {
|
|
|
|
|
|
|
|
|
|
//判断是不是个人使用
|
|
|
|
|
AuthAdmin authAdmin = customerService.getUserBean();
|
|
|
|
|
QueryWrapper<IoOrderMutiSetEntity> setEw=new QueryWrapper<>();
|
|
|
|
|
setEw.eq("curInv",authAdmin.getLocInvCode());
|
|
|
|
|
IoOrderMutiSetEntity ioOrderMutiSetEntity=ioOrderMutiSetService.getOne(setEw);
|
|
|
|
|
if(ioOrderMutiSetEntity!=null){
|
|
|
|
|
if(ioOrderMutiSetEntity.getCheckUse()==1){
|
|
|
|
|
IoOrderMutiEntity ioOrderMutiEntity=ioOrderMutiService.getById(ioOrderMutiUseEntity.getMutiIdFk());
|
|
|
|
|
if(!ioOrderMutiEntity.getCreateUser().equals(authAdmin.getId()+"")){
|
|
|
|
|
return ResultVOUtils.error(999,"该单设置了个人使用,添加失败!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
return ResultVOUtils.error(999,"请先设置多次出库单据类型!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sum = 0;
|
|
|
|
|
QueryWrapper<IoOrderMutiUseEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("mutiIdFk", ioOrderMutiUseEntity.getMutiIdFk());
|
|
|
|
@ -245,11 +359,21 @@ public class IoOrderMutiController {
|
|
|
|
|
@PostMapping("/udiwms/inout/order/muti/delectMuti")
|
|
|
|
|
public BaseResponse delectMuti(@RequestBody IoOrderMutiEntity ioOrderMutiEntity) {
|
|
|
|
|
|
|
|
|
|
Boolean falg=ioOrderMutiService.removeById(ioOrderMutiEntity);
|
|
|
|
|
if(falg){
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}else{
|
|
|
|
|
return ResultVOUtils.error(999,"删除失败");
|
|
|
|
|
Boolean falg = ioOrderMutiService.removeById(ioOrderMutiEntity);
|
|
|
|
|
if (falg) {
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(999, "删除失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inout/order/muti/auditMuti")
|
|
|
|
|
public BaseResponse auditMuti(@RequestBody IoOrderMutiEntity ioOrderMutiEntity) {
|
|
|
|
|
ioOrderMutiEntity.setUpdateTime(new Date());
|
|
|
|
|
ioOrderMutiEntity.setUpdateUser(customerService.getUserId()+"");
|
|
|
|
|
ioOrderMutiEntity.setAuditTime(new Date());
|
|
|
|
|
ioOrderMutiEntity.setAuditUser(customerService.getUserId()+"");
|
|
|
|
|
ioOrderMutiService.updateById(ioOrderMutiEntity);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|