|
@@ -6,6 +6,7 @@ import com.steerinfo.dil.model.WmspInventoryClose;
|
|
import com.steerinfo.dil.service.IWmspInventoryCloseService;
|
|
import com.steerinfo.dil.service.IWmspInventoryCloseService;
|
|
import com.steerinfo.dil.util.DataChange;
|
|
import com.steerinfo.dil.util.DataChange;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -29,67 +30,71 @@ public class WmspInventoryCloseServiceImpl implements IWmspInventoryCloseService
|
|
@Override
|
|
@Override
|
|
public List<Map<String, Object>> getWmspInventoryClose(Map<String, Object> mapValue) {
|
|
public List<Map<String, Object>> getWmspInventoryClose(Map<String, Object> mapValue) {
|
|
List<Map<String, Object>> maps = wmspInventoryCloseMapper.selectWmspInventoryClose(mapValue);
|
|
List<Map<String, Object>> maps = wmspInventoryCloseMapper.selectWmspInventoryClose(mapValue);
|
|
-
|
|
|
|
return maps;
|
|
return maps;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Scheduled(cron = "3 45 23 25 * ? ")
|
|
public int addInventoryClose() {
|
|
public int addInventoryClose() {
|
|
int i = 0;
|
|
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();
|
|
|
|
|
|
+ int count = wmspInventoryCloseMapper.getClose();
|
|
|
|
+ if(count == 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 =
|
|
BigDecimal closeThismonthInventory =
|
|
new BigDecimal(closeThismonthInbound1.intValue() - closeThismonthOutbound1.intValue() + closeLastmonthInventory1.intValue());
|
|
new BigDecimal(closeThismonthInbound1.intValue() - closeThismonthOutbound1.intValue() + closeLastmonthInventory1.intValue());
|
|
|
|
|
|
wmspInventoryClose.setCloseThismonthInventory(closeThismonthInventory);
|
|
wmspInventoryClose.setCloseThismonthInventory(closeThismonthInventory);
|
|
|
|
|
|
- wmspInventoryClose.setInsertTime(new Date());
|
|
|
|
- wmspInventoryClose.setInsertUsername("admin");
|
|
|
|
- wmspInventoryClose.setDeleted(new BigDecimal(1));
|
|
|
|
- i+=wmspInventoryCloseMapper.insertSelective(wmspInventoryClose);
|
|
|
|
- }
|
|
|
|
|
|
+ wmspInventoryClose.setInsertTime(new Date());
|
|
|
|
+ wmspInventoryClose.setInsertUsername("admin");
|
|
|
|
+ wmspInventoryClose.setDeleted(new BigDecimal(1));
|
|
|
|
+ i+=wmspInventoryCloseMapper.insertSelective(wmspInventoryClose);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
return i;
|
|
return i;
|
|
}
|
|
}
|
|
|
|
|