Commit d10aa322 by 赵剑炜

完成盘点前四个接口

parent 759913b3
...@@ -10,6 +10,9 @@ public class BussinessInventoryReq { ...@@ -10,6 +10,9 @@ public class BussinessInventoryReq {
@NotNull(message = "预览时,盘点仓库不能为空", groups = { ValidationApi.detail.class}) @NotNull(message = "预览时,盘点仓库不能为空", groups = { ValidationApi.detail.class})
private String warehouseId; private String warehouseId;
private String orderId; private String orderId;
private String inventoryType;
private String inventoryState;
private String examineState;
private String type; private String type;
private String typeList; private String typeList;
private String orgId; private String orgId;
......
package com.junmp.jyzb.api.bean.req; package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest; import com.junmp.v2.common.bean.request.BaseRequest;
import com.junmp.v2.common.bean.request.ValidationApi;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
...@@ -8,11 +9,11 @@ import javax.validation.constraints.NotNull; ...@@ -8,11 +9,11 @@ import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
@Data @Data
public class UpdateInventoryReq extends BaseRequest { public class UpdateInventoryReq {
/** /**
* id * id
*/ */
@NotBlank(message = "id不能为空",groups = {edit.class}) @NotBlank(message = "id不能为空", groups = {ValidationApi.edit.class})
private String id; private String id;
private String applyTime; private String applyTime;
...@@ -24,13 +25,14 @@ public class UpdateInventoryReq extends BaseRequest { ...@@ -24,13 +25,14 @@ public class UpdateInventoryReq extends BaseRequest {
/** /**
* *
*/ */
@NotNull(message = "组织机构id不能为空",groups = {add.class,edit.class}) @NotBlank(message = "组织机构id不能为空", groups = {ValidationApi.edit.class})
private Long orgId; private Long orgId;
/** /**
* *
*/ */
@NotNull(message = "仓库id不能为空",groups = {add.class,edit.class}) @NotBlank(message = "仓库id不能为空", groups = {ValidationApi.edit.class})
private String warehouseId; private String warehouseId;
/** /**
* 单据单号 * 单据单号
......
...@@ -42,16 +42,10 @@ public class BussinessInventory implements Serializable { ...@@ -42,16 +42,10 @@ public class BussinessInventory implements Serializable {
private String currentAssign; private String currentAssign;
/** /**
* 单据业务类型
*/
@TableField(value = "bussiness_type")
private String bussinessType;
/**
* 单据编号 * 单据编号
*/ */
@TableField(value = "order") @TableField(value = "order_num")
private String order; private String orderNum;
/** /**
* 年度 * 年度
...@@ -154,7 +148,7 @@ public class BussinessInventory implements Serializable { ...@@ -154,7 +148,7 @@ public class BussinessInventory implements Serializable {
*/ */
@TableField(value = "update_time",fill = FieldFill.UPDATE) @TableField(value = "update_time",fill = FieldFill.UPDATE)
private Date updateTime; private Date updateTime;
@TableField(value = "detail_list", exist = false)
private List<BussinessDetail> detailList; private List<BussinessDetail> detailList;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -2,8 +2,10 @@ package com.junmp.jyzb.service.impl; ...@@ -2,8 +2,10 @@ package com.junmp.jyzb.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleCreateTableStatement;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.junmpProcess.dto.StartProcessInstanceDTO; import com.junmp.junmpProcess.dto.StartProcessInstanceDTO;
...@@ -34,6 +36,7 @@ import com.junmp.v2.dict.entity.SysDict; ...@@ -34,6 +36,7 @@ import com.junmp.v2.dict.entity.SysDict;
import com.junmp.v2.dict.entity.SysDictItem; import com.junmp.v2.dict.entity.SysDictItem;
import com.junmp.v2.dict.service.SysDictItemService; import com.junmp.v2.dict.service.SysDictItemService;
import com.junmp.v2.dict.service.SysDictService; import com.junmp.v2.dict.service.SysDictService;
import com.junmp.v2.sys.api.OrganizationServiceApi;
import com.sun.org.apache.xpath.internal.operations.Bool; import com.sun.org.apache.xpath.internal.operations.Bool;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -41,9 +44,11 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -41,9 +44,11 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.beans.Transient; import java.beans.Transient;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -62,6 +67,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -62,6 +67,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
@Resource @Resource
private WarehouseService warehouseService; private WarehouseService warehouseService;
@Resource @Resource
private PubOrgService orgService;
@Resource
private InventorySummaryService inventorySummaryService; private InventorySummaryService inventorySummaryService;
@Resource @Resource
private OrderNumService orderNumService; private OrderNumService orderNumService;
...@@ -71,18 +78,32 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -71,18 +78,32 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String AddInvOrder(UpdateInventoryReq req) { public String AddInvOrder(UpdateInventoryReq req) {
BussinessInventory BI = new BussinessInventory(); BussinessInventory BI = new BussinessInventory();
Warehouse warehouse= warehouseService.getById(req.getWarehouseId());
PubOrg pubOrg=orgService.getById(req.getOrgId());
BeanPlusUtil.copyProperties(req,BI); BeanPlusUtil.copyProperties(req,BI);
BI.setWarehouseName(warehouse.getName());
//设置单号 //设置单号
if (ObjectUtil.isNull(pubOrg.getDName()) )
{
BI.setOrgName(pubOrg.getOrgName());
}
else
{
BI.setOrgName(pubOrg.getDName());
}
BI.setYear(LocalDate.now().getYear());
BI.setMonth(Integer.valueOf(LocalDate.now().getMonthValue()));
OrderNum orderNum = setOrderCode("Inventory",req.getOrgId()); OrderNum orderNum = setOrderCode("bussinessInventory",req.getOrgId());
String codeValue=String.format("%04d",orderNum.getNum()); String codeValue=String.format("%04d",orderNum.getNum());
BI.setOrder(orderNum.getBussinessType()+orderNum.getYear()+ BI.setOrderNum(orderNum.getBussinessType()+orderNum.getYear()+
String.format("%02d", LocalDateTime.now().getMonth().getValue())+ String.format("%02d", LocalDateTime.now().getMonth().getValue())+
String.format("%02d",LocalDateTime.now().getDayOfMonth())+codeValue); String.format("%02d",LocalDateTime.now().getDayOfMonth())+codeValue);
BI.setCreateTime(DateTimeUtil.getCurrentDateTime()); BI.setCreateTime(DateTimeUtil.getCurrentDateTime());
BI.setApplyTime(DateTimeUtil.getCurrentDateTime()); BI.setUpdateTime(DateTimeUtil.getCurrentDateTime());
BI.setInventoryState("waitting");
BI.setExamineState("none");
//执行工作流 //执行工作流
if (req.getExamineState().equals("working")) if (req.getExamineState().equals("working"))
{ {
...@@ -105,20 +126,55 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -105,20 +126,55 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
@Override @Override
public BussinessInventoryDto Check(BussinessInventoryReq req) { public BussinessInventoryDto Check(BussinessInventoryReq req) {
String Id=req.getOrderId();
if (StringUtils.isNotBlank(Id))//如果传了订单号,则全部通过订单号查询
{
BussinessInventory inventory= this.getById(Id);
String type=inventory.getInventoryType().toString();
String warehouseId=inventory.getWarehouseId();
InventorySumReq sumreq=new InventorySumReq();
sumreq.setLocationType("0");
sumreq.setLocationId(warehouseId);
BussinessInventoryDto BIDto=new BussinessInventoryDto();
if (type.equals("1"))//按装备类型盘点
{
List<String> typeIds = Arrays.asList(req.getTypeList().split(","));
sumreq.setTypeIds(typeIds);
} else if (type.equals("2"))//按装备号型盘点
{
List<String> sizeIds = Arrays.asList(req.getTypeList().split(","));
sumreq.setSizeIds(sizeIds);
}
List<EquipmentListDto> eqList=new ArrayList<>();
Integer totalNumber=0;
List<InventorySummary> SumResult = inventorySummaryService.getEquipmentInfoList(sumreq);
for (InventorySummary summary : SumResult) {
EquipmentListDto eq=new EquipmentListDto();
BeanPlusUtil.copyProperties(summary,eq);
eq.setPlanNum(String.valueOf(summary.getStockNumber()));
totalNumber+=summary.getStockNumber();
eqList.add(eq);
}
BIDto.setTotalNum(String.valueOf(totalNumber));
BIDto.setEquipmentList(eqList);
return BIDto;
}
String type=req.getType(); String type=req.getType();
String warehouseId=req.getWarehouseId(); String warehouseId=req.getWarehouseId();
InventorySumReq sumreq=new InventorySumReq(); InventorySumReq sumreq=new InventorySumReq();
sumreq.setLocationType("aa270713-3a31-47ff-9ee1-176091fcdf3c"); sumreq.setLocationType("0");
sumreq.setLocationId(warehouseId); sumreq.setLocationId(warehouseId);
BussinessInventoryDto BIDto=new BussinessInventoryDto(); BussinessInventoryDto BIDto=new BussinessInventoryDto();
if (ObjectUtil.isEmpty(type) || ObjectUtil.isNull(type)) { if (ObjectUtil.isEmpty(type) || ObjectUtil.isNull(type)) {
} }
else { else {
if (type.equals("type"))//按装备类型盘点 if (type.equals("1"))//按装备类型盘点
{ {
List<String> typeIds = Arrays.asList(req.getTypeList().split(",")); List<String> typeIds = Arrays.asList(req.getTypeList().split(","));
sumreq.setTypeIds(typeIds); sumreq.setTypeIds(typeIds);
} else if (type.equals("size"))//按装备号型盘点 } else if (type.equals("2"))//按装备号型盘点
{ {
List<String> sizeIds = Arrays.asList(req.getTypeList().split(",")); List<String> sizeIds = Arrays.asList(req.getTypeList().split(","));
sumreq.setSizeIds(sizeIds); sumreq.setSizeIds(sizeIds);
...@@ -229,8 +285,10 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -229,8 +285,10 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
return wrapper; return wrapper;
} }
wrapper.eq(BussinessInventory::getOrgId, req.getOrgId()); wrapper.eq(BussinessInventory::getOrgId, req.getOrgId());
wrapper.eq(ObjectUtil.isNotNull(req.getWarehouseId()), BussinessInventory::getWarehouseId, req.getWarehouseId()); wrapper.eq(StringUtils.isNotBlank(req.getWarehouseId()), BussinessInventory::getWarehouseId, req.getWarehouseId());
wrapper.eq(ObjectUtil.isNotNull(req.getType()), BussinessInventory::getBussinessType, req.getType()); wrapper.eq(StringUtils.isNotBlank(req.getInventoryState()), BussinessInventory::getInventoryState, req.getInventoryState());
wrapper.eq(StringUtils.isNotBlank(req.getExamineState()), BussinessInventory::getExamineState, req.getExamineState());
wrapper.eq(StringUtils.isNotBlank(req.getInventoryType()), BussinessInventory::getInventoryType, req.getInventoryType());
return wrapper; return wrapper;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论