Commit b70e5944 by 赵剑炜

盘点接口调整

parent acfe256e
......@@ -17,6 +17,7 @@ public class EquipmentListDto {
private String fixNumber;
private String num;
private String state;
private String price;
private String accountNumber;
private List<PriceInfo> priceInfo;
@Data
......
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class InvSummaryDto {
private String typeId;
private String sizeId;
private String locationId;
private Integer count;
private BigDecimal price;
}
......@@ -24,13 +24,15 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
//根据单警柜统计装备信息
List<WarehouseInvDto> GetViewWarehouseInv(@Param("orgId") Long orgId,@Param("typeIdsList") List<String> typeIdsList,@Param("sizeIds") List<String> sizeIds);
List<WarehouseInvDto> GetViewWarehouseInv(@Param("warehouseId") String warehouseId,@Param("typeIdsList") List<String> typeIdsList,@Param("sizeIds") List<String> sizeIds);
List<ViewEquipmentDto> GetViewEquipment(@Param("epcList") List<String> epcList);
List<EpcListDto> GetViewCountByepcs(@Param("epcList") List<String> epcList);
List<InventoryMapDto> GetViewInventoryMap(@Param("warehouseId") String warehouseId);
Boolean deleteByEpcs(@Param("list") List<String> epcs);
List<InvSummaryDto> selectWarehouseByEpcs(@Param("list") List<String> epcs,@Param("orgId") String orgId);
//根据单警柜统计装备信息
boolean SetCabinetInventory(@Param("brokenNumberDays") Integer brokenNumberDays);
......
......@@ -684,17 +684,14 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
}
List<WarehouseInvDto> DeleteFakeEpc = inventoryMapper.GetViewWarehouseInv(BI.getOrgId(), typeIds, sizeIds);
List<WarehouseInvDto> DeleteFakeEpc = inventoryMapper.GetViewWarehouseInv(BI.getWarehouseId(), typeIds, sizeIds);
List<Inventory> addInvList=new ArrayList<>();
List<WarehouseInventory> addWareInvList=new ArrayList<>();
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())
);
BussinessInventoryChildrenDetail ChildrenDetail = bussinessInventoryChildrenDetailService.getById(detail.getChildrenId());
updateInvChilred.add(ChildrenDetail);
}
if (updateInvChilred.size()>0)
......@@ -764,8 +761,47 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
} else {
UpdateInventorys = new ArrayList<>(Collections.singletonList(epcUpdate));
}
//需要对Summary表得数据进行更新
List<InvSummaryDto> Summary=inventoryMapper.selectWarehouseByEpcs(UpdateInventorys, String.valueOf(BI.getOrgId()));//删除同组织机构下EPC所在
List<InventorySummary> UpdateSummary=new ArrayList<>();
List<InventorySummary> DeleteSummary=new ArrayList<>();
for (InvSummaryDto Isum:Summary) {
InventorySumReq summaryreq=new InventorySumReq();
summaryreq.setLocationId(Isum.getLocationId());
summaryreq.setUnitPrice(String.valueOf(Isum.getPrice()));
summaryreq.setTypeId(Isum.getTypeId());
summaryreq.setSizeId(Isum.getSizeId());
InventorySummary InvSum= inventorySummaryService.getOne(summaryreq);
if (InvSum!=null)//同组织原有仓库需要减少数量和价格
{
Integer currentNumber=InvSum.getNumber()-Isum.getCount();
BigDecimal count = new BigDecimal(Isum.getCount());
BigDecimal price = Isum.getPrice();
BigDecimal result = count.multiply(price);
BigDecimal currentPrice=InvSum.getPrice().subtract(result);//当前价格
InvSum.setPrice(currentPrice);
InvSum.setNumber(currentNumber);
InvSum.setStockNumber(currentNumber);
InvSum.setStockNumberPrice(currentPrice);
InvSum.setUpdateTime(DateTimeUtil.getCurrentDateTime());
if (InvSum.getStockNumber()==0&&InvSum.getNumber()==0&&InvSum.getFixNumber()==0&&InvSum.getBrokenNumber()==0&&InvSum.getDestructionNumber()==0&&InvSum.getOutboundNumber()==0)
{
DeleteSummary.add(InvSum);
}
else
{
UpdateSummary.add(InvSum);
}
}
//同组织机构当前仓库需要增加价格和数量
InventorySumReq summaryNowReq=new InventorySumReq();
summaryNowReq.setLocationId(BI.getWarehouseId());
summaryNowReq.setUnitPrice(String.valueOf(Isum.getPrice()));
summaryNowReq.setTypeId(Isum.getTypeId());
summaryNowReq.setSizeId(Isum.getSizeId());
}
List<ViewEquipmentDto> viewEd= inventoryMapper.GetViewEquipment(UpdateInventorys);
for (ViewEquipmentDto inv:viewEd
) {
......@@ -795,6 +831,15 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
{
warehouseInventoryService.removeBatchByIds(DeleteList);
}
if (DeleteSummary.size()>0)
{
inventorySummaryService.removeBatchByIds(DeleteSummary);
}
if (UpdateSummary.size()>0)
{
inventorySummaryService.updateBatchById(UpdateSummary);
}
if (SaveEpcList.size()>0)
{
warehouseInventoryService.saveBatch(SaveEpcList);
......
......@@ -76,7 +76,7 @@
FROM
view_warehouse_inv
WHERE
orgId = #{orgId}
locationId = #{warehouseId}
<if test="typeIdsList!=null and typeIdsList.size() > 0">
AND type_id IN
......@@ -108,6 +108,26 @@
</foreach>
</delete>
<select id="selectWarehouseByEpcs" resultType="com.junmp.jyzb.api.bean.dto.InvSummaryDto">
SELECT
bi.type_id as typeId,
bi.size_id as sizeId,
COUNT(bi.id) AS count,
bwi.location_id as locationId,
bi.price
FROM
`base_inventory` `bi`
JOIN
`base_warehouse_inventory` `bwi` ON `bi`.`epc` = `bwi`.`epc`
WHERE bi.epc IN
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
and bwi.org_id=#{orgId}
GROUP BY
bi.size_id, bi.type_id, bi.price,bwi.location_id
</select>
<insert id="SetCabinetInventory">
INSERT INTO base_inventory_summary_type2 (id,org_id_int,org_name, org_code,type_id,type_name,size_id,size_name,location_id,location_name,
number,unit_price,price,stock_number, outbound_number,destruction_number,expire_number,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论