Commit b07771f3 by 赵剑炜

修改盘库接口

parent 1fcf17b2
...@@ -3,6 +3,9 @@ package com.junmp.jyzb.api.bean.dto; ...@@ -3,6 +3,9 @@ package com.junmp.jyzb.api.bean.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@Data @Data
public class EquipmentListDto { public class EquipmentListDto {
private String typeId; private String typeId;
...@@ -15,5 +18,13 @@ public class EquipmentListDto { ...@@ -15,5 +18,13 @@ public class EquipmentListDto {
private String num; private String num;
private String state; private String state;
private String accountNumber; private String accountNumber;
private List<PriceInfo> priceInfo;
@Data
public static class PriceInfo
{
private BigDecimal price;
private String num;
private Integer accountNumber;
private BigDecimal stockPrice;
}
} }
...@@ -11,6 +11,7 @@ public class InventoryMapDto { ...@@ -11,6 +11,7 @@ public class InventoryMapDto {
private String id; private String id;
private String warehouseId; private String warehouseId;
private String warehouseName; private String warehouseName;
private String childrenId;
private Long orgId; private Long orgId;
private String orgName; private String orgName;
private String typeId; private String typeId;
......
...@@ -8,9 +8,11 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; ...@@ -8,9 +8,11 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.poi.hpsf.Decimal;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -25,7 +27,7 @@ public class BussinessInventoryChildrenDetail implements Serializable { ...@@ -25,7 +27,7 @@ public class BussinessInventoryChildrenDetail implements Serializable {
*/ */
@TableId(value = "id") @TableId(value = "id")
@Id @Id
private String id; private Long id;
/** /**
* 工作流id * 工作流id
...@@ -39,6 +41,16 @@ public class BussinessInventoryChildrenDetail implements Serializable { ...@@ -39,6 +41,16 @@ public class BussinessInventoryChildrenDetail implements Serializable {
@TableField(value = "is_use") @TableField(value = "is_use")
private Integer isUse; private Integer isUse;
/** /**
* 是否已使用
*/
@TableField(value = "price")
private BigDecimal price;
/**
*
*/
@TableField(value = "total_price")
private BigDecimal totalPrice;
/**
* 工作流id * 工作流id
*/ */
@TableField(value = "production_date") @TableField(value = "production_date")
...@@ -60,11 +72,6 @@ public class BussinessInventoryChildrenDetail implements Serializable { ...@@ -60,11 +72,6 @@ public class BussinessInventoryChildrenDetail implements Serializable {
@TableField(value = "num") @TableField(value = "num")
private Integer num; private Integer num;
/**
* 月
*/
@TableField(value = "price")
private Integer price;
/** /**
......
...@@ -24,7 +24,7 @@ public interface InventoryMapper extends BaseMapper<Inventory> { ...@@ -24,7 +24,7 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
//根据单警柜统计装备信息 //根据单警柜统计装备信息
List<WarehouseInvDto> GetViewWarehouseInv(@Param("warehouseId") Long orgId,@Param("typeIdsList") List<String> typeIdsList,@Param("sizeIds") List<String> sizeIds); List<WarehouseInvDto> GetViewWarehouseInv(@Param("orgId") Long orgId,@Param("typeIdsList") List<String> typeIdsList,@Param("sizeIds") List<String> sizeIds);
List<ViewEquipmentDto> GetViewEquipment(@Param("epcList") List<String> epcList); List<ViewEquipmentDto> GetViewEquipment(@Param("epcList") List<String> epcList);
List<EpcListDto> GetViewCountByepcs(@Param("epcList") List<String> epcList); List<EpcListDto> GetViewCountByepcs(@Param("epcList") List<String> epcList);
......
...@@ -441,37 +441,38 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -441,37 +441,38 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
public Boolean UploadStock(UploadInventoryReq req) { public Boolean UploadStock(UploadInventoryReq req) {
//更新之前先把库存表的epc备份 //更新之前先把库存表的epc备份
BussinessInventory BI= this.getById(req.getOrderId()); BussinessInventory BI= this.getById(req.getOrderId());
String type= BI.getInventoryType().toString(); if (BI.getInventoryState().equals("close"))
InventorySumReq sumreq=new InventorySumReq();
String epcList="";
List<WarehouseInventory> details=new ArrayList<>();
if (type.equals("0"))
{
details = warehouseInventoryService.list(
new LambdaQueryWrapper<WarehouseInventory>().eq(WarehouseInventory::getLocationId, BI.getWarehouseId())
);
} else if (type.equals("1"))//按装备类型盘点
{
List<String> typeIds = Arrays.asList(BI.getRules().split(","));
details = warehouseInventoryService.list(
new LambdaQueryWrapper<WarehouseInventory>().eq(WarehouseInventory::getLocationId, BI.getWarehouseId())
.and(qw -> typeIds.forEach(typeId -> qw.or().eq(WarehouseInventory::getTypeId, typeId)))
);
}
else if (type.equals("2"))//按号型盘点
{ {
List<String> sizeIds = Arrays.asList(BI.getRules().split(",")); throw new ServiceException(InventoryExceptionEnum.ORDER_CLOSED);
details = warehouseInventoryService.list(
new LambdaQueryWrapper<WarehouseInventory>().eq(WarehouseInventory::getLocationId, BI.getWarehouseId())
.and(qw -> sizeIds.forEach(size -> qw.or().eq(WarehouseInventory::getSizeId, size)))
);
} }
// String type= BI.getInventoryType().toString();
// InventorySumReq sumreq=new InventorySumReq();
// String epcList="";
// List<WarehouseInventory> details=new ArrayList<>();
// if (type.equals("0"))
// {
//
// details = warehouseInventoryService.list(
// new LambdaQueryWrapper<WarehouseInventory>().eq(WarehouseInventory::getLocationId, BI.getWarehouseId())
// );
//
//
// } else if (type.equals("1"))//按装备类型盘点
// {
// List<String> typeIds = Arrays.asList(BI.getRules().split(","));
// details = warehouseInventoryService.list(
// new LambdaQueryWrapper<WarehouseInventory>().eq(WarehouseInventory::getLocationId, BI.getWarehouseId())
// .and(qw -> typeIds.forEach(typeId -> qw.or().eq(WarehouseInventory::getTypeId, typeId)))
// );
// }
// else if (type.equals("2"))//按号型盘点
// {
// List<String> sizeIds = Arrays.asList(BI.getRules().split(","));
// details = warehouseInventoryService.list(
// new LambdaQueryWrapper<WarehouseInventory>().eq(WarehouseInventory::getLocationId, BI.getWarehouseId())
// .and(qw -> sizeIds.forEach(size -> qw.or().eq(WarehouseInventory::getSizeId, size)))
// );
// }
...@@ -489,35 +490,31 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -489,35 +490,31 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
bussinessInventoryChildrenDetailService.removeBatchByIds(ChildrenDetail); bussinessInventoryChildrenDetailService.removeBatchByIds(ChildrenDetail);
} }
} }
List<BussinessInventoryChildrenDetail> updateInvChilred=new ArrayList<>();
for (BussinessDetail detail : ChildrenList) {//子单据中的数据打上标记,以后不会再使用
List<BussinessInventoryChildrenDetail> ChildrenDetail = bussinessInventoryChildrenDetailService.list(
new LambdaQueryWrapper<BussinessInventoryChildrenDetail>().eq(BussinessInventoryChildrenDetail::getInvDetailId, detail.getId())
);
updateInvChilred.addAll(ChildrenDetail);
}
if (updateInvChilred.size()>0)
{
updateInvChilred.forEach(p->p.setIsUse(1));
updateInvChilred.forEach(p->p.setUpdateTime(DateTimeUtil.getCurrentDateTime()));
bussinessInventoryChildrenDetailService.updateBatchById(updateInvChilred);
}
if (ChildrenList.size()>0) if (ChildrenList.size()>0)
{ {
bussinessInventoryDetailService.removeBatchByIds(ChildrenList); bussinessInventoryDetailService.removeBatchByIds(ChildrenList);
} }
List<BussinessInventoryChildrenDetail> ChildrenInfo=new ArrayList<>();
//将上报的数据传入数据库存储 //将上报的数据传入数据库存储
BeanPlusUtil.copyProperties(req,BI); BeanPlusUtil.copyProperties(req,BI);
List<BussinessDetail> Bussinessdetails=new ArrayList<>(); List<BussinessDetail> Bussinessdetails=new ArrayList<>();
for (EquipmentListDto detail : req.getEquipmentList()) { for (EquipmentListDto detail : req.getEquipmentList()) {
for (EquipmentListDto.PriceInfo priceEq :detail.getPriceInfo())
{
BussinessDetail eqDto = new BussinessDetail(); BussinessDetail eqDto = new BussinessDetail();
BeanPlusUtil.copyProperties(detail, eqDto); BeanPlusUtil.copyProperties(detail, eqDto);
eqDto.setAccountNum(detail.getAccountNumber()); eqDto.setNum(Integer.valueOf(priceEq.getNum()));
eqDto.setPrice(priceEq.getPrice());
eqDto.setStockPrice(priceEq.getStockPrice());
eqDto.setAccountNum(String.valueOf(priceEq.getAccountNumber()));
eqDto.setInventoryId(Long.valueOf(req.getOrderId())); eqDto.setInventoryId(Long.valueOf(req.getOrderId()));
eqDto.setUpdateTime(DateTimeUtil.getCurrentDateTime());
eqDto.setCreateTime(DateTimeUtil.getCurrentDateTime());
Bussinessdetails.add(eqDto); Bussinessdetails.add(eqDto);
}
} }
BI.setEpcUpdate(req.getEpcList()); BI.setEpcUpdate(req.getEpcList());
BI.setResult(req.getState()); BI.setResult(req.getState());
...@@ -533,6 +530,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -533,6 +530,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
public Boolean UpdateDetail(UpdateDetailReq req) { public Boolean UpdateDetail(UpdateDetailReq req) {
BussinessDetail bd= bussinessInventoryDetailService.getById(req.getDetailId());
List<BussinessInventoryChildrenDetail> ChildrenDetail = bussinessInventoryChildrenDetailService.list( List<BussinessInventoryChildrenDetail> ChildrenDetail = bussinessInventoryChildrenDetailService.list(
new LambdaQueryWrapper<BussinessInventoryChildrenDetail>().eq(BussinessInventoryChildrenDetail::getInvDetailId, req.getDetailId()) new LambdaQueryWrapper<BussinessInventoryChildrenDetail>().eq(BussinessInventoryChildrenDetail::getInvDetailId, req.getDetailId())
); );
...@@ -546,6 +544,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -546,6 +544,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
BussinessInventoryChildrenDetail Bcd=new BussinessInventoryChildrenDetail(); BussinessInventoryChildrenDetail Bcd=new BussinessInventoryChildrenDetail();
BeanPlusUtil.copyProperties(eqInfo,Bcd); BeanPlusUtil.copyProperties(eqInfo,Bcd);
Bcd.setInvDetailId(req.getDetailId()); Bcd.setInvDetailId(req.getDetailId());
Bcd.setPrice(bd.getPrice());
Bcd.setTotalPrice(bd.getStockPrice());
Bcd.setUpdateTime(DateTimeUtil.getCurrentDateTime()); Bcd.setUpdateTime(DateTimeUtil.getCurrentDateTime());
Bcd.setCreateTime(DateTimeUtil.getCurrentDateTime()); Bcd.setCreateTime(DateTimeUtil.getCurrentDateTime());
AddChildrenDetail.add(Bcd); AddChildrenDetail.add(Bcd);
...@@ -635,7 +635,6 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -635,7 +635,6 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
InsertSum.setNumber(bdList.getNum()); InsertSum.setNumber(bdList.getNum());
InsertSum.setOrgId(BI.getOrgId()); InsertSum.setOrgId(BI.getOrgId());
InsertSum.setOrgName(BI.getOrgName()); InsertSum.setOrgName(BI.getOrgName());
InsertSum.setOrgCode(org.getOrgCode()); InsertSum.setOrgCode(org.getOrgCode());
InsertSum.setTypeId(bdList.getTypeId()); InsertSum.setTypeId(bdList.getTypeId());
InsertSum.setTypeName(bdList.getTypeName()); InsertSum.setTypeName(bdList.getTypeName());
...@@ -690,6 +689,21 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -690,6 +689,21 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
List<WarehouseInventory> addWareInvList=new ArrayList<>(); List<WarehouseInventory> addWareInvList=new ArrayList<>();
List<InventoryMapDto> InvFakeList= inventoryMapper.GetViewInventoryMap(BI.getWarehouseId()); List<InventoryMapDto> InvFakeList= inventoryMapper.GetViewInventoryMap(BI.getWarehouseId());
List<BussinessInventoryChildrenDetail> updateInvChilred=new ArrayList<>();
for (InventoryMapDto detail : InvFakeList) {
BussinessInventoryChildrenDetail ChildrenDetail = bussinessInventoryChildrenDetailService.getById(
new LambdaQueryWrapper<BussinessInventoryChildrenDetail>().eq(BussinessInventoryChildrenDetail::getId, detail.getChildrenId())
);
updateInvChilred.add(ChildrenDetail);
}
if (updateInvChilred.size()>0)
{
updateInvChilred.forEach(p->p.setIsUse(1));
updateInvChilred.forEach(p->p.setUpdateTime(DateTimeUtil.getCurrentDateTime()));
bussinessInventoryChildrenDetailService.updateBatchById(updateInvChilred);
}
for (InventoryMapDto invFake:InvFakeList) { for (InventoryMapDto invFake:InvFakeList) {
Random random = new Random(); Random random = new Random();
//先插入仓库实体表 //先插入仓库实体表
...@@ -697,7 +711,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -697,7 +711,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
String epc="000000"+DateTimeUtil.getCurrentDateTime().getTime()+(random.nextInt(999999 - 100000 + 1) + 100000); String epc="000000"+DateTimeUtil.getCurrentDateTime().getTime()+(random.nextInt(999999 - 100000 + 1) + 100000);
Inventory inventory = new Inventory(); Inventory inventory = new Inventory();
inventory.setEpc(epc); inventory.setEpc(epc);
inventory.setEpcType(1);
inventory.setPrice(invFake.getPrice());
inventory.setSizeId(invFake.getSizeId()); inventory.setSizeId(invFake.getSizeId());
inventory.setTypeId(invFake.getTypeId()); inventory.setTypeId(invFake.getTypeId());
inventory.setPrice(invFake.getPrice()); inventory.setPrice(invFake.getPrice());
...@@ -705,6 +720,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -705,6 +720,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
inventory.setState("normal"); inventory.setState("normal");
inventory.setBussinessState("normal"); inventory.setBussinessState("normal");
inventory.setCreateTime(DateTimeUtil.getCurrentDateTime()); inventory.setCreateTime(DateTimeUtil.getCurrentDateTime());
inventory.setUpdateTime(DateTimeUtil.getCurrentDateTime());
inventory.setProductionDate(invFake.getProductionDate()); inventory.setProductionDate(invFake.getProductionDate());
inventory.setWarrantyPeriod(invFake.getWarrantyPeriod()); inventory.setWarrantyPeriod(invFake.getWarrantyPeriod());
inventory.setMaintenancePeriod(invFake.getMaintenancePeriod()); inventory.setMaintenancePeriod(invFake.getMaintenancePeriod());
...@@ -720,6 +736,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -720,6 +736,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
warehouseInventory.setTypeId(invFake.getTypeId()); warehouseInventory.setTypeId(invFake.getTypeId());
warehouseInventory.setSizeId(invFake.getSizeId()); warehouseInventory.setSizeId(invFake.getSizeId());
warehouseInventory.setLocationType("0"); warehouseInventory.setLocationType("0");
warehouseInventory.setUpdateTime(DateTimeUtil.getCurrentDateTime());
warehouseInventory.setLocationState("in"); warehouseInventory.setLocationState("in");
warehouseInventory.setCreateTime(DateTimeUtil.getCurrentDateTime()); warehouseInventory.setCreateTime(DateTimeUtil.getCurrentDateTime());
warehouseInventory.setOrgName(invFake.getOrgName()); warehouseInventory.setOrgName(invFake.getOrgName());
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
</select> </select>
<delete id="deleteByEpcs" parameterType="java.util.List"> <delete id="deleteByEpcs" parameterType="java.util.List">
DELETE FROM inventory DELETE FROM base_inventory
WHERE epc IN WHERE epc IN
<foreach item="item" index="index" collection="list" <foreach item="item" index="index" collection="list"
open="(" separator="," close=")"> open="(" separator="," close=")">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论