|
@@ -1,10 +1,15 @@
|
|
|
package com.steerinfo.dil.service.impl;
|
|
|
|
|
|
+import com.steerinfo.dil.mapper.RmsWarehouseMapper;
|
|
|
import com.steerinfo.dil.mapper.WmspInventoryCloseMapper;
|
|
|
+import com.steerinfo.dil.model.WmspInventoryClose;
|
|
|
import com.steerinfo.dil.service.IWmspInventoryCloseService;
|
|
|
+import com.steerinfo.dil.util.DataChange;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -18,6 +23,9 @@ public class WmspInventoryCloseServiceImpl implements IWmspInventoryCloseService
|
|
|
@Autowired
|
|
|
WmspInventoryCloseMapper wmspInventoryCloseMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ RmsWarehouseMapper rmsWarehouseMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public List<Map<String, Object>> getWmspInventoryClose(Map<String, Object> mapValue) {
|
|
|
List<Map<String, Object>> maps = wmspInventoryCloseMapper.selectWmspInventoryClose(mapValue);
|
|
@@ -26,7 +34,68 @@ public class WmspInventoryCloseServiceImpl implements IWmspInventoryCloseService
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int count() {
|
|
|
- return 0;
|
|
|
+ public int addInventoryClose() {
|
|
|
+ int i = 0;
|
|
|
+ //高线库,一棒库,二棒库,配送库
|
|
|
+ List<Map<String, Object>> mapList = rmsWarehouseMapper.getWarehouseName();
|
|
|
+ //遍历四个仓库
|
|
|
+ for(Map<String,Object> map:mapList) {
|
|
|
+ BigDecimal warehouseId = DataChange.dataToBigDecimal(map.get("id"));
|
|
|
+ //先获取收发存中的物资
|
|
|
+ List<Map<String,Object>> materialList = wmspInventoryCloseMapper.selectSendReceive(warehouseId);
|
|
|
+ for(Map<String,Object> map1:materialList){
|
|
|
+ WmspInventoryClose wmspInventoryClose = new WmspInventoryClose();
|
|
|
+ //主键自增
|
|
|
+ BigDecimal inventoryCloseId = wmspInventoryCloseMapper.addInventoryCloseId();
|
|
|
+ wmspInventoryClose.setCloseId(inventoryCloseId);
|
|
|
+ //增加仓库id
|
|
|
+ wmspInventoryClose.setWarehouseId(warehouseId);
|
|
|
+ //增加物资id
|
|
|
+ BigDecimal materialId = DataChange.dataToBigDecimal(map1.get("materialId"));
|
|
|
+ wmspInventoryClose.setMaterialId(materialId);
|
|
|
+ //获取一个仓库中的一种物资一个月之内的入库数据
|
|
|
+ BigDecimal closeThismonthInbound = wmspInventoryCloseMapper.selectCloseThismonthInbound(warehouseId,materialId);
|
|
|
+ if(closeThismonthInbound == null){
|
|
|
+ wmspInventoryClose.setCloseThismonthInbound(new BigDecimal(0));
|
|
|
+ }else {
|
|
|
+ wmspInventoryClose.setCloseThismonthInbound(closeThismonthInbound);
|
|
|
+ }
|
|
|
+ BigDecimal closeThismonthInbound1 = wmspInventoryClose.getCloseThismonthInbound();
|
|
|
+ //获取一个仓库的一种物资一个月之内的出库数据
|
|
|
+ BigDecimal closeThismonthOutbound = wmspInventoryCloseMapper.selectCloseThismonthOutbound(warehouseId,materialId);
|
|
|
+ if(closeThismonthOutbound == null){
|
|
|
+ wmspInventoryClose.setCloseThismonthOutbound(new BigDecimal(0));
|
|
|
+ }else {
|
|
|
+ wmspInventoryClose.setCloseThismonthOutbound(closeThismonthOutbound);
|
|
|
+ }
|
|
|
+ BigDecimal closeThismonthOutbound1 = wmspInventoryClose.getCloseThismonthOutbound();
|
|
|
+ //获取上一个月的一种物资的库存数据
|
|
|
+ BigDecimal closeLastmonthInventory = wmspInventoryCloseMapper.selectCloseLastmonthInventory(warehouseId,materialId);
|
|
|
+ if(closeLastmonthInventory==null){
|
|
|
+ wmspInventoryClose.setCloseLastmonthInventory(new BigDecimal(0));
|
|
|
+ }else {
|
|
|
+ wmspInventoryClose.setCloseLastmonthInventory(closeLastmonthInventory);
|
|
|
+ }
|
|
|
+ //获取一个仓库的一种物资一个月之内的总库存数据
|
|
|
+ BigDecimal closeLastmonthInventory1 = wmspInventoryClose.getCloseLastmonthInventory();
|
|
|
+ BigDecimal closeThismonthInventory =
|
|
|
+ new BigDecimal(closeThismonthInbound1.intValue() - closeThismonthOutbound1.intValue() + closeLastmonthInventory1.intValue());
|
|
|
+
|
|
|
+ wmspInventoryClose.setCloseThismonthInventory(closeThismonthInventory);
|
|
|
+
|
|
|
+ wmspInventoryClose.setInsertTime(new Date());
|
|
|
+ wmspInventoryClose.setInsertUsername("admin");
|
|
|
+ wmspInventoryClose.setDeleted(new BigDecimal(1));
|
|
|
+ i+=wmspInventoryCloseMapper.insertSelective(wmspInventoryClose);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return i;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int getClose() {
|
|
|
+ return wmspInventoryCloseMapper.getClose();
|
|
|
+ }
|
|
|
+
|
|
|
}
|