优化页面
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.bas.BasSupplier.domain.BasSupplier;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api2erp")
|
@RequestMapping("/api2erp")
|
||||||
|
@Component("erpTask")
|
||||||
public class ToErpApiController {
|
public class ToErpApiController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -35,4 +35,21 @@ public interface JobStatisticsMapper {
|
|||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> selectMonthlyStatistics(@Param("year") int year, @Param("month") int month);
|
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.bas.cargoSpace.mapper.BasCargoSpaceMapper;
|
||||||
import com.ruoyi.stock.stock.domain.BasStock;
|
import com.ruoyi.stock.stock.domain.BasStock;
|
||||||
import com.ruoyi.stock.stock.service.IBasStockService;
|
import com.ruoyi.stock.stock.service.IBasStockService;
|
||||||
|
import com.ruoyi.api.mapper.JobStatisticsMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -13,6 +13,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class StockScreenServiceImpl implements IStockScreenService {
|
public class StockScreenServiceImpl implements IStockScreenService {
|
||||||
@@ -22,7 +23,7 @@ public class StockScreenServiceImpl implements IStockScreenService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private BasCargoSpaceMapper basCargoSpaceMapper;
|
private BasCargoSpaceMapper basCargoSpaceMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcTemplate jdbcTemplate;
|
private JobStatisticsMapper jobStatisticsMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getAllStocksWithTotal() {
|
public Map<String, Object> getAllStocksWithTotal() {
|
||||||
@@ -79,28 +80,54 @@ public class StockScreenServiceImpl implements IStockScreenService {
|
|||||||
public Map<String, Object> getInOutSummary() {
|
public Map<String, Object> getInOutSummary() {
|
||||||
java.time.LocalDate now = java.time.LocalDate.now();
|
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 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);
|
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 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> wkIn = new ArrayList<>();
|
||||||
List<Integer> wkOut = new ArrayList<>();
|
List<Integer> wkOut = new ArrayList<>();
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
java.time.LocalDate day = monday.plusDays(i);
|
java.time.LocalDate day = monday.plusDays(i);
|
||||||
String p = day.format(dFmt);
|
String p = day.format(dFmt);
|
||||||
wkIn.add(countLike("in_stockin_finish", p));
|
Map<String, Object> stat = statsMap.get(p);
|
||||||
wkOut.add(countLike("out_stockout_finish", 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();
|
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<>();
|
List<Map<String, Object>> monthStat = new ArrayList<>();
|
||||||
for (int m = 1; m <= 12; m++) {
|
for (int m = 1; m <= 12; m++) {
|
||||||
java.time.LocalDate mm = java.time.LocalDate.of(year, m, 1);
|
Map<String, Object> stat = yearStatsMap.get(m);
|
||||||
String mp = mm.format(mFmt);
|
int mi = 0;
|
||||||
int mi = countLikeMonth("in_stockin_finish", mp);
|
int mo = 0;
|
||||||
int mo = countLikeMonth("out_stockout_finish", mp);
|
if (stat != null) {
|
||||||
|
mi = parseInt(stat.get("inCount"));
|
||||||
|
mo = parseInt(stat.get("outCount"));
|
||||||
|
}
|
||||||
Map<String, Object> item = new HashMap<>();
|
Map<String, Object> item = new HashMap<>();
|
||||||
item.put("mouth", String.valueOf(m));
|
item.put("mouth", String.valueOf(m));
|
||||||
item.put("入库", mi);
|
item.put("入库", mi);
|
||||||
@@ -117,20 +144,12 @@ public class StockScreenServiceImpl implements IStockScreenService {
|
|||||||
return res;
|
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 {
|
try {
|
||||||
Integer c = jdbcTemplate.queryForObject("SELECT COUNT(1) FROM " + table + " WHERE create_date LIKE ?", Integer.class, dayPrefix + "%");
|
return Integer.parseInt(obj.toString());
|
||||||
return c == null ? 0 : c;
|
} catch (NumberFormatException e) {
|
||||||
} 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 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,20 +279,26 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
@Override
|
@Override
|
||||||
public AjaxResult receiveOutStockList() {
|
public AjaxResult receiveOutStockList() {
|
||||||
ErpOutStockListParam erpOutStockListParam = new ErpOutStockListParam();
|
ErpOutStockListParam erpOutStockListParam = new ErpOutStockListParam();
|
||||||
OutStockMiddle outStockMiddle = new OutStockMiddle();
|
// OutStockMiddle outStockMiddle = new OutStockMiddle();
|
||||||
OutStockMiddle outStockMiddle1 = outStockMiddleService.selectOutStockMiddleByStockoutId("1");
|
// OutStockMiddle outStockMiddle1 = outStockMiddleService.selectOutStockMiddleByStockoutId("1");
|
||||||
erpOutStockListParam.setDate3_end(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
// erpOutStockListParam.setDate3_end(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||||
// 判断是否有上次访问时间
|
//// 判断是否有上次访问时间
|
||||||
if (ObjUtil.isNotNull(outStockMiddle1)){
|
// if (ObjUtil.isNotNull(outStockMiddle1)){
|
||||||
erpOutStockListParam.setDate3_start(outStockMiddle1.getCreateDate());
|
// erpOutStockListParam.setDate3_start(outStockMiddle1.getCreateDate());
|
||||||
outStockMiddle1.setCreateDate(erpOutStockListParam.getDate3_end());
|
// outStockMiddle1.setCreateDate(erpOutStockListParam.getDate3_end());
|
||||||
outStockMiddleService.updateOutStockMiddle(outStockMiddle1);
|
// outStockMiddleService.updateOutStockMiddle(outStockMiddle1);
|
||||||
}else {
|
// }else {
|
||||||
erpOutStockListParam.setDate3_start("");
|
// erpOutStockListParam.setDate3_start("");
|
||||||
outStockMiddle.setStockoutId("1");
|
// outStockMiddle.setStockoutId("1");
|
||||||
outStockMiddle.setCreateDate(erpOutStockListParam.getDate3_end());
|
// outStockMiddle.setCreateDate(erpOutStockListParam.getDate3_end());
|
||||||
outStockMiddleService.insertOutStockMiddle(outStockMiddle);
|
// 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_index(0);
|
||||||
erpOutStockListParam.setPage_size(0);
|
erpOutStockListParam.setPage_size(0);
|
||||||
erpOutStockListParam.setNeedList(1);
|
erpOutStockListParam.setNeedList(1);
|
||||||
@@ -416,8 +422,6 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
outStockoutDetailService.insertOutStockoutDetail(outStockoutDetail);
|
outStockoutDetailService.insertOutStockoutDetail(outStockoutDetail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
@@ -686,7 +690,6 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
private ObjectMapper objectMapper;
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
//获取入库单据
|
//获取入库单据
|
||||||
|
|
||||||
public AjaxResult getInStock(){
|
public AjaxResult getInStock(){
|
||||||
//创建请求体
|
//创建请求体
|
||||||
InStockinNQueryRequest inStockinNQueryRequest = new InStockinNQueryRequest();
|
InStockinNQueryRequest inStockinNQueryRequest = new InStockinNQueryRequest();
|
||||||
@@ -694,12 +697,10 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
inStockinNQueryRequest.setSort1(0);
|
inStockinNQueryRequest.setSort1(0);
|
||||||
// 设置日期范围为当天
|
// 设置日期范围为当天
|
||||||
String today = DateUtil.today();
|
String today = DateUtil.today();
|
||||||
// inStockinNQueryRequest.setDate3Start(today + " 00:00:00");
|
inStockinNQueryRequest.setDate3Start(today + " 00:00:00");
|
||||||
// inStockinNQueryRequest.setDate3End(today + " 23:59:59");
|
inStockinNQueryRequest.setDate3End(today + " 23:59:59");
|
||||||
inStockinNQueryRequest.setDate3Start("2025-11-03" + " 00:00:00");
|
inStockinNQueryRequest.setDate5Start(today + " 00:00:00");
|
||||||
inStockinNQueryRequest.setDate3End("2025-11-03" + " 23:59:59");
|
inStockinNQueryRequest.setDate5End(today + " 23:59:59");
|
||||||
inStockinNQueryRequest.setDate5Start("2025-11-03" + " 00:00:00");
|
|
||||||
inStockinNQueryRequest.setDate5End("2025-11-03" + " 23:59:59");
|
|
||||||
inStockinNQueryRequest.setTitle("打冷");
|
inStockinNQueryRequest.setTitle("打冷");
|
||||||
inStockinNQueryRequest.setNeedList(1);
|
inStockinNQueryRequest.setNeedList(1);
|
||||||
inStockinNQueryRequest.setPageIndex(1);
|
inStockinNQueryRequest.setPageIndex(1);
|
||||||
@@ -920,7 +921,6 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
requestLog.setRequestBody(jsonStr);
|
requestLog.setRequestBody(jsonStr);
|
||||||
requestLog.setResponseBody(body);
|
requestLog.setResponseBody(body);
|
||||||
requestLog.setEndpoint(endpoint);
|
requestLog.setEndpoint(endpoint);
|
||||||
|
|
||||||
boolean isSuccess = false;
|
boolean isSuccess = false;
|
||||||
try {
|
try {
|
||||||
if (JSONUtil.isTypeJSON(body)) {
|
if (JSONUtil.isTypeJSON(body)) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class ToWcsServiceImpl implements IToWcsService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
// @Scheduled(fixedDelay=1500)
|
@Scheduled(fixedDelay=1500)
|
||||||
public void pushOutMydoJob() {
|
public void pushOutMydoJob() {
|
||||||
//查询所有未推送的料箱出库作业
|
//查询所有未推送的料箱出库作业
|
||||||
MydoJob mydoJobParam = new MydoJob();
|
MydoJob mydoJobParam = new MydoJob();
|
||||||
|
|||||||
@@ -189,55 +189,38 @@ public class ToWmsServiceImpl implements IToWmsService {
|
|||||||
//>>>>>>>>>>>>>>获取物料库存信息 -> 有库存 -> 货位(cargospace) -> 存储区组(groupCodingNo) -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
//>>>>>>>>>>>>>>获取物料库存信息 -> 有库存 -> 货位(cargospace) -> 存储区组(groupCodingNo) -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
||||||
//>>>>>>>>>>>>>>获取物料库存信息 -> 无库存 -> 遍历存储区组(groupCodingNo) -> 查找全部货位空的区组 -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
//>>>>>>>>>>>>>>获取物料库存信息 -> 无库存 -> 遍历存储区组(groupCodingNo) -> 查找全部货位空的区组 -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
||||||
try {
|
try {
|
||||||
//获取物料的货位集合 - 首先查找已经存放该物料的存储区
|
// 1. 查找已存放该物料的存储区组(一次性获取去重后的组列表)
|
||||||
List<BasStock> stocks = basStockService.selectBasStockListByProductId(productId);
|
List<String> existingGroups = basStockService.selectGroupCodingNosByProductId(productId);
|
||||||
|
|
||||||
//如果集合空 - 寻找未被占用的存储区组放货
|
if (!existingGroups.isEmpty()) {
|
||||||
if (!stocks.isEmpty()) {
|
// 2. 在这些组中查找任意一个空闲货位(status='1')
|
||||||
//如果物料已经存放在多个货位(区域) - 去重
|
BasCargoSpace availableSpace = basCargoSpaceService.selectEmptyCargoSpaceInGroups(existingGroups);
|
||||||
List<BasStock> stocksNew = stocks.stream().distinct().collect(Collectors.toList());
|
if (availableSpace != null) {
|
||||||
|
// 分配成功,更新状态为3
|
||||||
|
availableSpace.setStatus("3");
|
||||||
|
basCargoSpaceService.updateBasCargoSpace(availableSpace);
|
||||||
|
return availableSpace.getCargoSpaceId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//查询对应货位的区域在【BasCargoSpace】是否有空位 - 在groupCodingNo的分组中是否仍然有状态【1】的货位
|
// 3. 如果没有现有组或现有组无空位,查找一个完全空闲的组(001-045)
|
||||||
for (BasStock stock : stocksNew) {
|
String emptyGroupNo = basCargoSpaceService.selectFirstEmptyGroupCodingNo();
|
||||||
//获取每种物料的存放货位信息
|
|
||||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stock.getCargoSpaceId());
|
|
||||||
|
|
||||||
//获取每种物料的存放货位信息 - 存储区
|
if (emptyGroupNo != null) {
|
||||||
String group = cargoSpace.getGroupCodingNo();
|
// 4. 在该空闲组中,获取最内侧(groupCoding最大)的货位
|
||||||
|
// 复用现有方法 selectBasCargoSpaceListByGroupCodingNo,它已按 group_coding desc 排序
|
||||||
|
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceListByGroupCodingNo(emptyGroupNo);
|
||||||
|
|
||||||
//获取该存储区组的所有货位
|
if (!cargoSpaces.isEmpty()) {
|
||||||
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceListByGroupCodingNo(group);
|
BasCargoSpace bestSpace = cargoSpaces.get(0);
|
||||||
|
// 再次确认状态(虽然 selectFirstEmptyGroupCodingNo 保证了组空,但为了安全)
|
||||||
//在集合中获取状态为【1】的货位
|
if ("1".equals(bestSpace.getStatus())) {
|
||||||
for (BasCargoSpace cs : cargoSpaces) {
|
bestSpace.setStatus("3");
|
||||||
//货位状态:1(未占用) -> 返回该货位结果
|
basCargoSpaceService.updateBasCargoSpace(bestSpace);
|
||||||
if ("1".equals(cs.getStatus())) {
|
return bestSpace.getCargoSpaceId();
|
||||||
return cs.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) {
|
} catch (Exception e) {
|
||||||
log.error("入库子单获取目标货位失败,异常信息:" + e.getMessage());
|
log.error("入库子单获取目标货位失败,异常信息:" + e.getMessage());
|
||||||
|
|||||||
@@ -100,5 +100,18 @@ public interface BasCargoSpaceMapper extends BaseMapper<BasCargoSpace>
|
|||||||
*/
|
*/
|
||||||
public List<BasCargoSpace> selectCargoSpaceWithStock();
|
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);
|
void lockedCargoSpace(BasCargoSpace basCargoSpace);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,19 @@ public interface IBasCargoSpaceService extends IService<BasCargoSpace>
|
|||||||
*/
|
*/
|
||||||
public List<BasCargoSpace> selectBasCargoSpaceListByGroupCodingNo(String groupCodingNo);
|
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);
|
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);
|
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);
|
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);
|
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:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
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
|
username: sa
|
||||||
password: Flrd0914.
|
password: Flrd0914.
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
@@ -35,7 +35,7 @@ spring:
|
|||||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||||
maxEvictableIdleTimeMillis: 900000
|
maxEvictableIdleTimeMillis: 900000
|
||||||
# 配置检测连接是否有效
|
# 配置检测连接是否有效
|
||||||
validationQuery: SELECT 1 FROM sys_oper_log
|
validationQuery: SELECT 1
|
||||||
testWhileIdle: true
|
testWhileIdle: true
|
||||||
testOnBorrow: false
|
testOnBorrow: false
|
||||||
testOnReturn: false
|
testOnReturn: false
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ spring:
|
|||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 172.16.2.170
|
host: 192.168.10.200
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
SELECT COUNT(1)
|
SELECT COUNT(1)
|
||||||
FROM mydo_job_finish
|
FROM mydo_job_finish
|
||||||
WHERE CONVERT(varchar(10), create_time, 120) = #{createTime}
|
WHERE CONVERT(varchar(10), create_time, 120) = #{createTime}
|
||||||
AND in_or_out >= 20
|
AND in_or_out > 20
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 查询当月每日入库出库统计 -->
|
<!-- 查询当月每日入库出库统计 -->
|
||||||
@@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
SELECT
|
SELECT
|
||||||
DAY(create_time) as date,
|
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 '出库'
|
SUM(CASE WHEN in_or_out > 20 THEN 1 ELSE 0 END) as '出库'
|
||||||
FROM mydo_job_finish
|
FROM mydo_job_finish
|
||||||
WHERE YEAR(create_time) = #{year}
|
WHERE YEAR(create_time) = #{year}
|
||||||
AND MONTH(create_time) = #{month}
|
AND MONTH(create_time) = #{month}
|
||||||
@@ -33,4 +33,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ORDER BY date
|
ORDER BY date
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
@@ -263,4 +263,26 @@
|
|||||||
<if test="spare7 != null and spare7 != ''">and bs.spare7 = #{spare7}</if>
|
<if test="spare7 != null and spare7 != ''">and bs.spare7 = #{spare7}</if>
|
||||||
<if test="stockStatus != null and stockStatus != ''">and bs.stock_status = #{stockStatus}</if>
|
<if test="stockStatus != null and stockStatus != ''">and bs.stock_status = #{stockStatus}</if>
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|||||||
@@ -225,6 +225,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where bs.product_id = #{productId}
|
where bs.product_id = #{productId}
|
||||||
</select>
|
</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 id="insertBasStock" parameterType="BasStock">
|
||||||
insert into bas_stock
|
insert into bas_stock
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ public class Constants
|
|||||||
/**
|
/**
|
||||||
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||||
*/
|
*/
|
||||||
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi.quartz.task" };
|
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi.quartz.task" ,"com.ruoyi.task"};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务违规的字符
|
* 定时任务违规的字符
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -36,11 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
AND invoke_target like concat('%', #{invokeTarget}, '%')
|
AND invoke_target like concat('%', #{invokeTarget}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
and date_format(create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
|
and convert(varchar(8), create_time, 112) >= convert(varchar(8), cast(#{params.beginTime} as datetime), 112)
|
||||||
</if>
|
</if>
|
||||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
and date_format(create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
|
and convert(varchar(8), create_time, 112) <= convert(varchar(8), cast(#{params.endTime} as datetime), 112)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
@@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
|
<if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
|
||||||
<if test="status != null and status != ''">#{status},</if>
|
<if test="status != null and status != ''">#{status},</if>
|
||||||
<if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
|
<if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
|
||||||
sysdate()
|
GETDATE()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="status !=null">status = #{status},</if>
|
<if test="status !=null">status = #{status},</if>
|
||||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
update_time = sysdate()
|
update_time = GETDATE()
|
||||||
</set>
|
</set>
|
||||||
where job_id = #{jobId}
|
where job_id = #{jobId}
|
||||||
</update>
|
</update>
|
||||||
@@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="status != null and status != ''">#{status},</if>
|
<if test="status != null and status != ''">#{status},</if>
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
sysdate()
|
GETDATE()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,8 @@
|
|||||||
format="CODE39"
|
format="CODE39"
|
||||||
width="2"
|
width="2"
|
||||||
height="100"
|
height="100"
|
||||||
display-value
|
font-options="bold"
|
||||||
|
font-size="28"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</vue-easy-print>
|
</vue-easy-print>
|
||||||
|
|||||||
Reference in New Issue
Block a user