Commit 53532981 by 赵剑炜

调整盘点单据

parent af39161a
...@@ -15,6 +15,7 @@ public class EquipmentListDto { ...@@ -15,6 +15,7 @@ public class EquipmentListDto {
private String planNum; private String planNum;
private String stockNumber; private String stockNumber;
private String fixNumber; private String fixNumber;
private BigDecimal fixPrice;
private String num; private String num;
private String state; private String state;
private String price; private String price;
......
...@@ -293,7 +293,7 @@ import static com.junmp.junmpProcess.common.CommonConstants.*; ...@@ -293,7 +293,7 @@ import static com.junmp.junmpProcess.common.CommonConstants.*;
if (Type.equals("stocktakeOrder"))//整理需要下发的消息 if (Type.equals("stocktakeOrder"))//整理需要下发的消息
{ {
sendReq.setMsgTitle("盘点提醒"); sendReq.setMsgTitle("盘点提醒");
sendReq.setMsgContent("【盘库单】已下发"); sendReq.setMsgContent("盘库单:【"+mainProcess.getName()+"】已下发");
} }
else else
{ {
......
...@@ -31,7 +31,10 @@ public interface InventoryMapper extends BaseMapper<Inventory> { ...@@ -31,7 +31,10 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
List<InventoryMapDto> GetViewInventoryMap(@Param("warehouseId") String warehouseId); List<InventoryMapDto> GetViewInventoryMap(@Param("warehouseId") String warehouseId);
Boolean deleteByEpcs(@Param("list") List<String> epcs); Boolean deleteByEpcs(@Param("list") List<String> epcs);
List<InvSummaryDto> selectWarehouseByEpcs(@Param("list") List<String> epcs,@Param("orgId") String orgId);
Boolean DeleteEpcsWithoutWarehouse(@Param("list") List<String> epcs,@Param("orgId") String orgId,@Param("warehouseId") String warehouseId);
List<InvSummaryDto> selectWarehouseByEpcs(@Param("list") List<String> epcs,@Param("orgId") String orgId,@Param("warehouseId") String warehouseId);
//根据单警柜统计装备信息 //根据单警柜统计装备信息
boolean SetCabinetInventory(@Param("brokenNumberDays") Integer brokenNumberDays); boolean SetCabinetInventory(@Param("brokenNumberDays") Integer brokenNumberDays);
......
...@@ -78,6 +78,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -78,6 +78,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
@Resource @Resource
private WarehouseInventoryService warehouseInventoryService; private WarehouseInventoryService warehouseInventoryService;
@Resource @Resource
private LogSummaryService logSummaryService;
@Resource
private InventoryService inventoryService; private InventoryService inventoryService;
@Resource @Resource
...@@ -519,6 +521,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -519,6 +521,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
BeanPlusUtil.copyProperties(detail, eqDto); BeanPlusUtil.copyProperties(detail, eqDto);
eqDto.setNum(Integer.valueOf(priceEq.getNum())); eqDto.setNum(Integer.valueOf(priceEq.getNum()));
eqDto.setPrice(priceEq.getPrice()); eqDto.setPrice(priceEq.getPrice());
eqDto.setFixPrice(detail.getFixPrice());
eqDto.setStockPrice(priceEq.getStockPrice()); eqDto.setStockPrice(priceEq.getStockPrice());
eqDto.setAccountNum(String.valueOf(priceEq.getAccountNumber())); eqDto.setAccountNum(String.valueOf(priceEq.getAccountNumber()));
eqDto.setInventoryId(Long.valueOf(req.getOrderId())); eqDto.setInventoryId(Long.valueOf(req.getOrderId()));
...@@ -590,7 +593,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -590,7 +593,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
InventorySumReq sumreq=new InventorySumReq(); InventorySumReq sumreq=new InventorySumReq();
sumreq.setLocationType("0"); sumreq.setLocationType("0");
sumreq.setLocationId(BI.getWarehouseId()); sumreq.setLocationId(BI.getWarehouseId());
// logSummaryService.processInventoryRecords()
if (BI.getInventoryType().equals(1))//按装备类型盘点 if (BI.getInventoryType().equals(1))//按装备类型盘点
{ {
List<String> typeIds = Arrays.asList(BI.getRules().split(",")); List<String> typeIds = Arrays.asList(BI.getRules().split(","));
...@@ -615,20 +618,21 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -615,20 +618,21 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
summary.setStockNumber(bussiness.getFixNumber()); summary.setStockNumber(bussiness.getFixNumber());
summary.setOutboundNumber(0); summary.setOutboundNumber(0);
summary.setNumber(bussiness.getFixNumber()); summary.setNumber(bussiness.getFixNumber());
if (bussiness.getState().equals(1))//盈余状态需要增加金额和数量 if (bussiness.getState().equals("1"))//盈余状态需要增加金额和数量
{ {
summary.setPrice( summary.getPrice().add(bussiness.getFixPrice())); summary.setPrice( bussiness.getFixPrice());
bussiness.setStockPrice(summary.getStockNumberPrice()); // bussiness.setStockPrice(summary.getStockNumberPrice());
} }
else if (bussiness.getState().equals(2))//亏损状态需要减少金额和数量 else if (bussiness.getState().equals("2"))//亏损状态需要减少金额和数量
{ {
BigDecimal fixPriceNew=summary.getPrice().subtract(bussiness.getFixPrice()); summary.setPrice( bussiness.getFixPrice());
int i = fixPriceNew.compareTo(BigDecimal.ZERO); // BigDecimal fixPriceNew=summary.getPrice().subtract(bussiness.getFixPrice());
if (i == -1) { // int i = fixPriceNew.compareTo(BigDecimal.ZERO);
summary.setPrice(BigDecimal.ZERO); // if (i == -1) {
} else if (i == 1||i == 0) { // summary.setPrice(BigDecimal.ZERO);
summary.setPrice( fixPriceNew); // } else if (i == 1||i == 0) {
} // summary.setPrice( fixPriceNew);
// }
} }
...@@ -777,7 +781,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -777,7 +781,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
UpdateInventorys = new ArrayList<>(Collections.singletonList(epcUpdate)); UpdateInventorys = new ArrayList<>(Collections.singletonList(epcUpdate));
} }
//需要对Summary表得数据进行更新 //需要对Summary表得数据进行更新
List<InvSummaryDto> Summary=inventoryMapper.selectWarehouseByEpcs(UpdateInventorys, String.valueOf(BI.getOrgId()));//删除同组织机构下EPC所在 List<InvSummaryDto> Summary=inventoryMapper.selectWarehouseByEpcs(UpdateInventorys, String.valueOf(BI.getOrgId()),String.valueOf(BI.getWarehouseId()));//删除同组织机构下EPC所在
List<InventorySummary> UpdateSummary=new ArrayList<>(); List<InventorySummary> UpdateSummary=new ArrayList<>();
List<InventorySummary> DeleteSummary=new ArrayList<>(); List<InventorySummary> DeleteSummary=new ArrayList<>();
for (InvSummaryDto Isum:Summary) { for (InvSummaryDto Isum:Summary) {
...@@ -794,10 +799,10 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -794,10 +799,10 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
BigDecimal price = Isum.getPrice(); BigDecimal price = Isum.getPrice();
BigDecimal result = count.multiply(price); BigDecimal result = count.multiply(price);
BigDecimal currentPrice=InvSum.getPrice().subtract(result);//当前价格 BigDecimal currentPrice=InvSum.getPrice().subtract(result);//当前价格
InvSum.setPrice(currentPrice); InvSum.setPrice(currentPrice.max(BigDecimal.ZERO));
InvSum.setNumber(currentNumber); InvSum.setNumber(Math.max(currentNumber, 0));
InvSum.setStockNumber(currentNumber); InvSum.setStockNumber(Math.max(currentNumber, 0));
InvSum.setStockNumberPrice(currentPrice); InvSum.setStockNumberPrice(currentPrice.max(BigDecimal.ZERO));
InvSum.setUpdateTime(DateTimeUtil.getCurrentDateTime()); InvSum.setUpdateTime(DateTimeUtil.getCurrentDateTime());
if (InvSum.getStockNumber()==0&&InvSum.getNumber()==0&&InvSum.getFixNumber()==0&&InvSum.getBrokenNumber()==0&&InvSum.getDestructionNumber()==0&&InvSum.getOutboundNumber()==0) if (InvSum.getStockNumber()==0&&InvSum.getNumber()==0&&InvSum.getFixNumber()==0&&InvSum.getBrokenNumber()==0&&InvSum.getDestructionNumber()==0&&InvSum.getOutboundNumber()==0)
{ {
...@@ -807,6 +812,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -807,6 +812,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
{ {
UpdateSummary.add(InvSum); UpdateSummary.add(InvSum);
} }
//这里还要记上出入库的日志,用来记录原有物资减少的变化
} }
...@@ -841,8 +848,9 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -841,8 +848,9 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
} }
BI.setInventoryState("close"); BI.setInventoryState("close");
BI.setUpdateTime(DateTimeUtil.getCurrentDateTime()); BI.setUpdateTime(DateTimeUtil.getCurrentDateTime());
//删除同组织机构下该EPC其他仓库的位置信息
if (DeleteList.size()>0) inventoryMapper.DeleteEpcsWithoutWarehouse(UpdateInventorys, String.valueOf(BI.getOrgId()),String.valueOf(BI.getWarehouseId()));
if (DeleteList.size()>0)//删除库内全部的EPC信息
{ {
warehouseInventoryService.removeBatchByIds(DeleteList); warehouseInventoryService.removeBatchByIds(DeleteList);
} }
...@@ -851,20 +859,21 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -851,20 +859,21 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
{ {
inventorySummaryService.removeBatchByIds(DeleteSummary); inventorySummaryService.removeBatchByIds(DeleteSummary);
} }
if (UpdateSummary.size()>0) if (UpdateSummary.size()>0)//同组织机构的其他不同仓库的物资
{ {
inventorySummaryService.updateBatchById(UpdateSummary); inventorySummaryService.updateBatchById(UpdateSummary);
} }
if (SaveEpcList.size()>0) if (SumResult.size()>0)//当前组织机构盘点后的物资汇总信息
{ {
warehouseInventoryService.saveBatch(SaveEpcList); inventorySummaryService.updateBatchById(SumResult);
} }
this.updateById(BI); if (SaveEpcList.size()>0)//将新的库内EPC存入新仓库
if (SumResult.size()>0)
{ {
inventorySummaryService.updateBatchById(SumResult); warehouseInventoryService.saveBatch(SaveEpcList);
} }
if (InsertSumResult.size()>0)
if (InsertSumResult.size()>0)//当前仓库下没有该物资,需要新增该物资的信息
{ {
inventorySummaryService.saveBatch(InsertSumResult); inventorySummaryService.saveBatch(InsertSumResult);
} }
...@@ -879,6 +888,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -879,6 +888,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
Warehouse warehouse= warehouseService.getById(BI.getWarehouseId()); Warehouse warehouse= warehouseService.getById(BI.getWarehouseId());
warehouse.setIsLocked(0); warehouse.setIsLocked(0);
warehouseService.updateById(warehouse); warehouseService.updateById(warehouse);
this.updateById(BI);
} }
else//废除单据 req.getState().equals(1) else//废除单据 req.getState().equals(1)
{ {
......
...@@ -108,6 +108,18 @@ ...@@ -108,6 +108,18 @@
</foreach> </foreach>
</delete> </delete>
<delete id="DeleteEpcsWithoutWarehouse" parameterType="java.util.List">
DELETE bwi
FROM `base_warehouse_inventory` bwi
WHERE bwi.epc IN
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
AND bwi.org_id = #{orgId}
AND bwi.location_id != #{warehouseId}
</delete>
<select id="selectWarehouseByEpcs" resultType="com.junmp.jyzb.api.bean.dto.InvSummaryDto"> <select id="selectWarehouseByEpcs" resultType="com.junmp.jyzb.api.bean.dto.InvSummaryDto">
SELECT SELECT
bi.type_id as typeId, bi.type_id as typeId,
...@@ -124,7 +136,7 @@ ...@@ -124,7 +136,7 @@
open="(" separator="," close=")"> open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
and bwi.org_id=#{orgId} and bwi.org_id=#{orgId} and bwi.location_id!=#{warehouseId}
GROUP BY GROUP BY
bi.size_id, bi.type_id, bi.price,bwi.location_id bi.size_id, bi.type_id, bi.price,bwi.location_id
</select> </select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论