优化页面
This commit is contained in:
@@ -7,6 +7,7 @@ import com.ruoyi.bas.BasProduct.domain.BasProduct;
|
||||
import com.ruoyi.bas.BasSupplier.domain.BasSupplier;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api2erp")
|
||||
@Component("erpTask")
|
||||
public class ToErpApiController {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -35,4 +35,21 @@ public interface JobStatisticsMapper {
|
||||
*/
|
||||
public List<Map<String, Object>> selectMonthlyStatistics(@Param("year") int year, @Param("month") int month);
|
||||
|
||||
/**
|
||||
* 查询指定日期范围内的每日入库出库统计
|
||||
*
|
||||
* @param startDate 开始日期 (yyyy-MM-dd)
|
||||
* @param endDate 结束日期 (yyyy-MM-dd)
|
||||
* @return 统计列表
|
||||
*/
|
||||
public List<Map<String, Object>> selectDateRangeStatistics(@Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
/**
|
||||
* 查询当成年每月入库出库统计
|
||||
*
|
||||
* @param year 年份
|
||||
* @return 每月统计列表
|
||||
*/
|
||||
public List<Map<String, Object>> selectYearlyStatistics(@Param("year") int year);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import com.ruoyi.api.service.IStockScreenService;
|
||||
import com.ruoyi.bas.cargoSpace.mapper.BasCargoSpaceMapper;
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
import com.ruoyi.stock.stock.service.IBasStockService;
|
||||
import com.ruoyi.api.mapper.JobStatisticsMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -13,6 +13,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class StockScreenServiceImpl implements IStockScreenService {
|
||||
@@ -22,7 +23,7 @@ public class StockScreenServiceImpl implements IStockScreenService {
|
||||
@Autowired
|
||||
private BasCargoSpaceMapper basCargoSpaceMapper;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
private JobStatisticsMapper jobStatisticsMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAllStocksWithTotal() {
|
||||
@@ -79,28 +80,54 @@ public class StockScreenServiceImpl implements IStockScreenService {
|
||||
public Map<String, Object> getInOutSummary() {
|
||||
java.time.LocalDate now = java.time.LocalDate.now();
|
||||
java.time.format.DateTimeFormatter dFmt = java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
java.time.format.DateTimeFormatter mFmt = java.time.format.DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
String todayPrefix = now.format(dFmt);
|
||||
int dIn = countLike("in_stockin_finish", todayPrefix);
|
||||
int dOut = countLike("out_stockout_finish", todayPrefix);
|
||||
|
||||
int dIn = jobStatisticsMapper.selectDailyInCount(todayPrefix);
|
||||
int dOut = jobStatisticsMapper.selectDailyOutCount(todayPrefix);
|
||||
|
||||
java.time.LocalDate monday = now.with(java.time.DayOfWeek.MONDAY);
|
||||
java.time.LocalDate sunday = monday.plusDays(6);
|
||||
String startWeek = monday.format(dFmt);
|
||||
String endWeek = sunday.format(dFmt);
|
||||
|
||||
List<Map<String, Object>> rangeStats = jobStatisticsMapper.selectDateRangeStatistics(startWeek, endWeek);
|
||||
Map<String, Map<String, Object>> statsMap = rangeStats.stream()
|
||||
.collect(Collectors.toMap(m -> String.valueOf(m.get("date")), m -> m, (k1, k2) -> k1));
|
||||
|
||||
List<Integer> wkIn = new ArrayList<>();
|
||||
List<Integer> wkOut = new ArrayList<>();
|
||||
for (int i = 0; i < 7; i++) {
|
||||
java.time.LocalDate day = monday.plusDays(i);
|
||||
String p = day.format(dFmt);
|
||||
wkIn.add(countLike("in_stockin_finish", p));
|
||||
wkOut.add(countLike("out_stockout_finish", p));
|
||||
Map<String, Object> stat = statsMap.get(p);
|
||||
if (stat != null) {
|
||||
wkIn.add(parseInt(stat.get("inCount")));
|
||||
wkOut.add(parseInt(stat.get("outCount")));
|
||||
} else {
|
||||
wkIn.add(0);
|
||||
wkOut.add(0);
|
||||
}
|
||||
}
|
||||
|
||||
int year = now.getYear();
|
||||
List<Map<String, Object>> yearStats = jobStatisticsMapper.selectYearlyStatistics(year);
|
||||
Map<Integer, Map<String, Object>> yearStatsMap = new HashMap<>();
|
||||
for (Map<String, Object> m : yearStats) {
|
||||
Object monthObj = m.get("month");
|
||||
if (monthObj != null) {
|
||||
yearStatsMap.put(Integer.parseInt(String.valueOf(monthObj)), m);
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String, Object>> monthStat = new ArrayList<>();
|
||||
for (int m = 1; m <= 12; m++) {
|
||||
java.time.LocalDate mm = java.time.LocalDate.of(year, m, 1);
|
||||
String mp = mm.format(mFmt);
|
||||
int mi = countLikeMonth("in_stockin_finish", mp);
|
||||
int mo = countLikeMonth("out_stockout_finish", mp);
|
||||
Map<String, Object> stat = yearStatsMap.get(m);
|
||||
int mi = 0;
|
||||
int mo = 0;
|
||||
if (stat != null) {
|
||||
mi = parseInt(stat.get("inCount"));
|
||||
mo = parseInt(stat.get("outCount"));
|
||||
}
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("mouth", String.valueOf(m));
|
||||
item.put("入库", mi);
|
||||
@@ -117,20 +144,12 @@ public class StockScreenServiceImpl implements IStockScreenService {
|
||||
return res;
|
||||
}
|
||||
|
||||
private int countLike(String table, String dayPrefix) {
|
||||
private int parseInt(Object obj) {
|
||||
if (obj == null) return 0;
|
||||
if (obj instanceof Number) return ((Number) obj).intValue();
|
||||
try {
|
||||
Integer c = jdbcTemplate.queryForObject("SELECT COUNT(1) FROM " + table + " WHERE create_date LIKE ?", Integer.class, dayPrefix + "%");
|
||||
return c == null ? 0 : c;
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private int countLikeMonth(String table, String monthPrefix) {
|
||||
try {
|
||||
Integer c = jdbcTemplate.queryForObject("SELECT COUNT(1) FROM " + table + " WHERE create_date LIKE ?", Integer.class, monthPrefix + "%");
|
||||
return c == null ? 0 : c;
|
||||
} catch (Exception e) {
|
||||
return Integer.parseInt(obj.toString());
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,20 +279,26 @@ public class ToErpServiceImpl implements IToErpService {
|
||||
@Override
|
||||
public AjaxResult receiveOutStockList() {
|
||||
ErpOutStockListParam erpOutStockListParam = new ErpOutStockListParam();
|
||||
OutStockMiddle outStockMiddle = new OutStockMiddle();
|
||||
OutStockMiddle outStockMiddle1 = outStockMiddleService.selectOutStockMiddleByStockoutId("1");
|
||||
erpOutStockListParam.setDate3_end(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
// 判断是否有上次访问时间
|
||||
if (ObjUtil.isNotNull(outStockMiddle1)){
|
||||
erpOutStockListParam.setDate3_start(outStockMiddle1.getCreateDate());
|
||||
outStockMiddle1.setCreateDate(erpOutStockListParam.getDate3_end());
|
||||
outStockMiddleService.updateOutStockMiddle(outStockMiddle1);
|
||||
}else {
|
||||
erpOutStockListParam.setDate3_start("");
|
||||
outStockMiddle.setStockoutId("1");
|
||||
outStockMiddle.setCreateDate(erpOutStockListParam.getDate3_end());
|
||||
outStockMiddleService.insertOutStockMiddle(outStockMiddle);
|
||||
}
|
||||
// OutStockMiddle outStockMiddle = new OutStockMiddle();
|
||||
// OutStockMiddle outStockMiddle1 = outStockMiddleService.selectOutStockMiddleByStockoutId("1");
|
||||
// erpOutStockListParam.setDate3_end(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
//// 判断是否有上次访问时间
|
||||
// if (ObjUtil.isNotNull(outStockMiddle1)){
|
||||
// erpOutStockListParam.setDate3_start(outStockMiddle1.getCreateDate());
|
||||
// outStockMiddle1.setCreateDate(erpOutStockListParam.getDate3_end());
|
||||
// outStockMiddleService.updateOutStockMiddle(outStockMiddle1);
|
||||
// }else {
|
||||
// erpOutStockListParam.setDate3_start("");
|
||||
// outStockMiddle.setStockoutId("1");
|
||||
// outStockMiddle.setCreateDate(erpOutStockListParam.getDate3_end());
|
||||
// outStockMiddleService.insertOutStockMiddle(outStockMiddle);
|
||||
// }
|
||||
String today = DateUtil.today();
|
||||
erpOutStockListParam.setDate3_start(today + " 00:00:00");
|
||||
erpOutStockListParam.setDate3_end(today + " 23:59:59");
|
||||
erpOutStockListParam.setDate5_start(today + " 00:00:00");
|
||||
erpOutStockListParam.setDate5_end(today + " 23:59:59");
|
||||
erpOutStockListParam.setTitle("打冷");
|
||||
erpOutStockListParam.setPage_index(0);
|
||||
erpOutStockListParam.setPage_size(0);
|
||||
erpOutStockListParam.setNeedList(1);
|
||||
@@ -416,8 +422,6 @@ public class ToErpServiceImpl implements IToErpService {
|
||||
outStockoutDetailService.insertOutStockoutDetail(outStockoutDetail);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@@ -686,7 +690,6 @@ public class ToErpServiceImpl implements IToErpService {
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
//获取入库单据
|
||||
|
||||
public AjaxResult getInStock(){
|
||||
//创建请求体
|
||||
InStockinNQueryRequest inStockinNQueryRequest = new InStockinNQueryRequest();
|
||||
@@ -694,12 +697,10 @@ public class ToErpServiceImpl implements IToErpService {
|
||||
inStockinNQueryRequest.setSort1(0);
|
||||
// 设置日期范围为当天
|
||||
String today = DateUtil.today();
|
||||
// inStockinNQueryRequest.setDate3Start(today + " 00:00:00");
|
||||
// inStockinNQueryRequest.setDate3End(today + " 23:59:59");
|
||||
inStockinNQueryRequest.setDate3Start("2025-11-03" + " 00:00:00");
|
||||
inStockinNQueryRequest.setDate3End("2025-11-03" + " 23:59:59");
|
||||
inStockinNQueryRequest.setDate5Start("2025-11-03" + " 00:00:00");
|
||||
inStockinNQueryRequest.setDate5End("2025-11-03" + " 23:59:59");
|
||||
inStockinNQueryRequest.setDate3Start(today + " 00:00:00");
|
||||
inStockinNQueryRequest.setDate3End(today + " 23:59:59");
|
||||
inStockinNQueryRequest.setDate5Start(today + " 00:00:00");
|
||||
inStockinNQueryRequest.setDate5End(today + " 23:59:59");
|
||||
inStockinNQueryRequest.setTitle("打冷");
|
||||
inStockinNQueryRequest.setNeedList(1);
|
||||
inStockinNQueryRequest.setPageIndex(1);
|
||||
@@ -920,7 +921,6 @@ public class ToErpServiceImpl implements IToErpService {
|
||||
requestLog.setRequestBody(jsonStr);
|
||||
requestLog.setResponseBody(body);
|
||||
requestLog.setEndpoint(endpoint);
|
||||
|
||||
boolean isSuccess = false;
|
||||
try {
|
||||
if (JSONUtil.isTypeJSON(body)) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ToWcsServiceImpl implements IToWcsService {
|
||||
|
||||
|
||||
@Override
|
||||
// @Scheduled(fixedDelay=1500)
|
||||
@Scheduled(fixedDelay=1500)
|
||||
public void pushOutMydoJob() {
|
||||
//查询所有未推送的料箱出库作业
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
|
||||
@@ -189,55 +189,38 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
//>>>>>>>>>>>>>>获取物料库存信息 -> 有库存 -> 货位(cargospace) -> 存储区组(groupCodingNo) -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
||||
//>>>>>>>>>>>>>>获取物料库存信息 -> 无库存 -> 遍历存储区组(groupCodingNo) -> 查找全部货位空的区组 -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
||||
try {
|
||||
//获取物料的货位集合 - 首先查找已经存放该物料的存储区
|
||||
List<BasStock> stocks = basStockService.selectBasStockListByProductId(productId);
|
||||
// 1. 查找已存放该物料的存储区组(一次性获取去重后的组列表)
|
||||
List<String> existingGroups = basStockService.selectGroupCodingNosByProductId(productId);
|
||||
|
||||
//如果集合空 - 寻找未被占用的存储区组放货
|
||||
if (!stocks.isEmpty()) {
|
||||
//如果物料已经存放在多个货位(区域) - 去重
|
||||
List<BasStock> stocksNew = stocks.stream().distinct().collect(Collectors.toList());
|
||||
if (!existingGroups.isEmpty()) {
|
||||
// 2. 在这些组中查找任意一个空闲货位(status='1')
|
||||
BasCargoSpace availableSpace = basCargoSpaceService.selectEmptyCargoSpaceInGroups(existingGroups);
|
||||
if (availableSpace != null) {
|
||||
// 分配成功,更新状态为3
|
||||
availableSpace.setStatus("3");
|
||||
basCargoSpaceService.updateBasCargoSpace(availableSpace);
|
||||
return availableSpace.getCargoSpaceId();
|
||||
}
|
||||
}
|
||||
|
||||
//查询对应货位的区域在【BasCargoSpace】是否有空位 - 在groupCodingNo的分组中是否仍然有状态【1】的货位
|
||||
for (BasStock stock : stocksNew) {
|
||||
//获取每种物料的存放货位信息
|
||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stock.getCargoSpaceId());
|
||||
|
||||
//获取每种物料的存放货位信息 - 存储区
|
||||
String group = cargoSpace.getGroupCodingNo();
|
||||
|
||||
//获取该存储区组的所有货位
|
||||
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceListByGroupCodingNo(group);
|
||||
|
||||
//在集合中获取状态为【1】的货位
|
||||
for (BasCargoSpace cs : cargoSpaces) {
|
||||
//货位状态:1(未占用) -> 返回该货位结果
|
||||
if ("1".equals(cs.getStatus())) {
|
||||
return cs.getCargoSpaceId();
|
||||
}
|
||||
// 3. 如果没有现有组或现有组无空位,查找一个完全空闲的组(001-045)
|
||||
String emptyGroupNo = basCargoSpaceService.selectFirstEmptyGroupCodingNo();
|
||||
|
||||
if (emptyGroupNo != null) {
|
||||
// 4. 在该空闲组中,获取最内侧(groupCoding最大)的货位
|
||||
// 复用现有方法 selectBasCargoSpaceListByGroupCodingNo,它已按 group_coding desc 排序
|
||||
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceListByGroupCodingNo(emptyGroupNo);
|
||||
|
||||
if (!cargoSpaces.isEmpty()) {
|
||||
BasCargoSpace bestSpace = cargoSpaces.get(0);
|
||||
// 再次确认状态(虽然 selectFirstEmptyGroupCodingNo 保证了组空,但为了安全)
|
||||
if ("1".equals(bestSpace.getStatus())) {
|
||||
bestSpace.setStatus("3");
|
||||
basCargoSpaceService.updateBasCargoSpace(bestSpace);
|
||||
return bestSpace.getCargoSpaceId();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
for (int i = 1; i <= 45; i++) {
|
||||
BasCargoSpace cargospace = new BasCargoSpace();
|
||||
|
||||
//存储区
|
||||
String groupCodingNo = String.format("%03d", i);
|
||||
cargospace.setGroupCodingNo(groupCodingNo);
|
||||
|
||||
//获取【groupCodingNo】所有货位
|
||||
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceList(cargospace);
|
||||
|
||||
//判断是否全部未占用,即某存储区全部为空位 - 避免物料混放
|
||||
boolean isAllEmpty = cargoSpaces.stream().allMatch(c -> "1".equals(c.getStatus()));
|
||||
|
||||
//区域未占用 - 则分配最内侧货位
|
||||
if (isAllEmpty && cargoSpaces.size() > 0) {
|
||||
cargoSpaces.sort(Comparator.comparing(BasCargoSpace::getGroupCoding).reversed());
|
||||
return cargoSpaces.get(0).getCargoSpaceId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("入库子单获取目标货位失败,异常信息:" + e.getMessage());
|
||||
|
||||
@@ -100,5 +100,18 @@ public interface BasCargoSpaceMapper extends BaseMapper<BasCargoSpace>
|
||||
*/
|
||||
public List<BasCargoSpace> selectCargoSpaceWithStock();
|
||||
|
||||
/**
|
||||
* 在指定存储区组中查找首个空闲货位
|
||||
* @param groups 存储区组列表
|
||||
* @return 空闲货位
|
||||
*/
|
||||
public BasCargoSpace selectEmptyCargoSpaceInGroups(@Param("groups") List<String> groups);
|
||||
|
||||
/**
|
||||
* 查找第一个完全空闲(无占用)的存储区组编号(范围001-045)
|
||||
* @return 存储区组编号
|
||||
*/
|
||||
public String selectFirstEmptyGroupCodingNo();
|
||||
|
||||
void lockedCargoSpace(BasCargoSpace basCargoSpace);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,19 @@ public interface IBasCargoSpaceService extends IService<BasCargoSpace>
|
||||
*/
|
||||
public List<BasCargoSpace> selectBasCargoSpaceListByGroupCodingNo(String groupCodingNo);
|
||||
|
||||
/**
|
||||
* 在指定存储区组中查找首个空闲货位
|
||||
* @param groups 存储区组列表
|
||||
* @return 空闲货位
|
||||
*/
|
||||
public BasCargoSpace selectEmptyCargoSpaceInGroups(List<String> groups);
|
||||
|
||||
/**
|
||||
* 查找第一个完全空闲(无占用)的存储区组编号
|
||||
* @return 存储区组编号
|
||||
*/
|
||||
public String selectFirstEmptyGroupCodingNo();
|
||||
|
||||
/**
|
||||
* 新增库存信息
|
||||
*
|
||||
|
||||
@@ -58,6 +58,16 @@ public class BasCargoSpaceServiceImpl extends ServiceImpl<BasCargoSpaceMapper,Ba
|
||||
return basCargoSpaceMapper.selectBasCargoSpaceListByGroupCodingNo(groupCodingNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasCargoSpace selectEmptyCargoSpaceInGroups(List<String> groups) {
|
||||
return basCargoSpaceMapper.selectEmptyCargoSpaceInGroups(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectFirstEmptyGroupCodingNo() {
|
||||
return basCargoSpaceMapper.selectFirstEmptyGroupCodingNo();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增库存信息
|
||||
|
||||
@@ -29,6 +29,13 @@ public interface BasStockMapper
|
||||
*/
|
||||
public List<BasStock> selectBasStockListByProductId(String productId);
|
||||
|
||||
/**
|
||||
* 查询指定物料所在的存储区组列表(去重)
|
||||
* @param productId 物料ID
|
||||
* @return 存储区组列表
|
||||
*/
|
||||
public List<String> selectGroupCodingNosByProductId(String productId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询库存信息列表
|
||||
|
||||
@@ -29,6 +29,13 @@ public interface IBasStockService
|
||||
*/
|
||||
public List<BasStock> selectBasStockListByProductId(String productId);
|
||||
|
||||
/**
|
||||
* 查询指定物料所在的存储区组列表(去重)
|
||||
* @param productId 物料ID
|
||||
* @return 存储区组列表
|
||||
*/
|
||||
public List<String> selectGroupCodingNosByProductId(String productId);
|
||||
|
||||
/**
|
||||
* 查询库存信息列表
|
||||
*
|
||||
|
||||
@@ -62,6 +62,11 @@ public class BasStockServiceImpl implements IBasStockService
|
||||
return basStockMapper.selectBasStockListByProductId(productId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> selectGroupCodingNosByProductId(String productId) {
|
||||
return basStockMapper.selectGroupCodingNosByProductId(productId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存信息列表
|
||||
*
|
||||
|
||||
22
ruoyi-admin/src/main/java/com/ruoyi/task/ErpTask.java
Normal file
22
ruoyi-admin/src/main/java/com/ruoyi/task/ErpTask.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.task;
|
||||
|
||||
import com.ruoyi.api.service.impl.ToErpServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("ErpTask")
|
||||
public class ErpTask {
|
||||
@Autowired
|
||||
private ToErpServiceImpl toErpServiceImpl;
|
||||
public void getInStock(){
|
||||
toErpServiceImpl.getInStock();
|
||||
}
|
||||
|
||||
public void getOutStock(){
|
||||
toErpServiceImpl.receiveOutStockList();
|
||||
}
|
||||
|
||||
public void getProductList(){
|
||||
toErpServiceImpl.receiveProduct();
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,11 @@
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:sqlserver://172.16.2.170:1433;databaseName=FT542-wms;encrypt=true;trustServerCertificate=true;
|
||||
url: jdbc:sqlserver://192.168.10.200:1433;databaseName=FT542-wms;encrypt=true;trustServerCertificate=true
|
||||
username: sa
|
||||
password: Flrd0914.
|
||||
# 从库数据源
|
||||
@@ -35,7 +35,7 @@ spring:
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM sys_oper_log
|
||||
validationQuery: SELECT 1
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
|
||||
@@ -71,7 +71,7 @@ spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 172.16.2.170
|
||||
host: 192.168.10.200
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
|
||||
@@ -17,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
SELECT COUNT(1)
|
||||
FROM mydo_job_finish
|
||||
WHERE CONVERT(varchar(10), create_time, 120) = #{createTime}
|
||||
AND in_or_out >= 20
|
||||
AND in_or_out > 20
|
||||
</select>
|
||||
|
||||
<!-- 查询当月每日入库出库统计 -->
|
||||
@@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
SELECT
|
||||
DAY(create_time) as date,
|
||||
SUM(CASE WHEN in_or_out < 20 THEN 1 ELSE 0 END) as '入库',
|
||||
SUM(CASE WHEN in_or_out >= 20 THEN 1 ELSE 0 END) as '出库'
|
||||
SUM(CASE WHEN in_or_out > 20 THEN 1 ELSE 0 END) as '出库'
|
||||
FROM mydo_job_finish
|
||||
WHERE YEAR(create_time) = #{year}
|
||||
AND MONTH(create_time) = #{month}
|
||||
@@ -33,4 +33,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ORDER BY date
|
||||
</select>
|
||||
|
||||
<!-- 查询指定日期范围内的每日入库出库统计 -->
|
||||
<select id="selectDateRangeStatistics" resultType="java.util.Map">
|
||||
SELECT
|
||||
CONVERT(varchar(10), create_time, 120) as date,
|
||||
SUM(CASE WHEN in_or_out < 20 THEN 1 ELSE 0 END) as inCount,
|
||||
SUM(CASE WHEN in_or_out > 20 THEN 1 ELSE 0 END) as outCount
|
||||
FROM mydo_job_finish
|
||||
WHERE CONVERT(varchar(10), create_time, 120) >= #{startDate}
|
||||
AND CONVERT(varchar(10), create_time, 120) <= #{endDate}
|
||||
GROUP BY CONVERT(varchar(10), create_time, 120)
|
||||
</select>
|
||||
|
||||
<!-- 查询当年每月入库出库统计 -->
|
||||
<select id="selectYearlyStatistics" resultType="java.util.Map">
|
||||
SELECT
|
||||
MONTH(create_time) as month,
|
||||
SUM(CASE WHEN in_or_out < 20 THEN 1 ELSE 0 END) as inCount,
|
||||
SUM(CASE WHEN in_or_out > 20 THEN 1 ELSE 0 END) as outCount
|
||||
FROM mydo_job_finish
|
||||
WHERE YEAR(create_time) = #{year}
|
||||
GROUP BY MONTH(create_time)
|
||||
ORDER BY month
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -263,4 +263,26 @@
|
||||
<if test="spare7 != null and spare7 != ''">and bs.spare7 = #{spare7}</if>
|
||||
<if test="stockStatus != null and stockStatus != ''">and bs.stock_status = #{stockStatus}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectEmptyCargoSpaceInGroups" resultMap="BasCargoSpaceResult">
|
||||
SELECT TOP 1 bcs.cargo_space_id, bcs.group_coding_no, bcs.status
|
||||
FROM bas_cargo_space bcs
|
||||
WHERE bcs.status = '1'
|
||||
AND bcs.locked = 'N'
|
||||
AND bcs.group_coding_no IN
|
||||
<foreach item="group" collection="groups" open="(" separator="," close=")">
|
||||
#{group}
|
||||
</foreach>
|
||||
ORDER BY bcs.group_coding DESC
|
||||
</select>
|
||||
|
||||
<select id="selectFirstEmptyGroupCodingNo" resultType="String">
|
||||
SELECT TOP 1 group_coding_no
|
||||
FROM bas_cargo_space
|
||||
WHERE group_coding_no BETWEEN '001' AND '045'
|
||||
GROUP BY group_coding_no
|
||||
HAVING SUM(CASE WHEN status != '1' THEN 1 ELSE 0 END) = 0
|
||||
AND SUM(CASE WHEN locked != 'N' THEN 1 ELSE 0 END) = 0
|
||||
ORDER BY group_coding_no ASC
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -225,6 +225,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where bs.product_id = #{productId}
|
||||
</select>
|
||||
|
||||
<select id="selectGroupCodingNosByProductId" parameterType="string" resultType="java.lang.String">
|
||||
SELECT DISTINCT bcs.group_coding_no
|
||||
FROM bas_stock bs
|
||||
JOIN bas_cargo_space bcs ON bs.cargo_space_id = bcs.cargo_space_id
|
||||
WHERE bs.product_id = #{productId}
|
||||
AND bcs.group_coding_no IS NOT NULL
|
||||
</select>
|
||||
|
||||
<insert id="insertBasStock" parameterType="BasStock">
|
||||
insert into bas_stock
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
Reference in New Issue
Block a user