项目初始化
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import com.ruoyi.api.service.IJobStatisticsService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
import com.ruoyi.stock.stock.service.IBasStockService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 作业统计 Controller-展示大屏
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class JobStatisticsController {
|
||||
|
||||
@Autowired
|
||||
private IJobStatisticsService jobStatisticsService;
|
||||
@Autowired
|
||||
private IBasStockService basStockService;
|
||||
|
||||
/**
|
||||
* 获取统计数据,包含:
|
||||
* 1. 当日入库和出库数量统计
|
||||
* 2. 货位状态统计
|
||||
* 3. 当前任务列表
|
||||
* 4. 当月每日入库和出库数量统计
|
||||
*/
|
||||
@GetMapping("/daily")
|
||||
public AjaxResult getDailyStatistics() {
|
||||
Map<String, Object> result = jobStatisticsService.getDailyStatistics();
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
/**
|
||||
* 获取库存信息(前50条)
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult getStockList() {
|
||||
// 查询所有库存数据
|
||||
List<BasStock> list = basStockService.selectBasStockListApi(new BasStock());
|
||||
|
||||
// 截取前50条数据
|
||||
List<BasStock> topList = list.stream()
|
||||
.limit(50)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 构建返回结果
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("stockMsg", topList);
|
||||
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/device/info")
|
||||
public Object getDeviceInfo() {
|
||||
// 获取设备信息
|
||||
return jobStatisticsService.getDeviceInfo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.domain.ReMaterialParam;
|
||||
import com.ruoyi.api.domain.RequestEnter;
|
||||
import com.ruoyi.api.domain.WmsJobRequest;
|
||||
import com.ruoyi.api.service.IToErpService;
|
||||
import com.ruoyi.api.service.IToWmsService;
|
||||
import com.ruoyi.bas.BasCustomer.domain.BasCustomer;
|
||||
import com.ruoyi.bas.BasProduct.domain.BasProduct;
|
||||
import com.ruoyi.bas.BasSupplier.domain.BasSupplier;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.log.domain.RequestLog;
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 作业统计 Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api2erp")
|
||||
public class ToErpApiController {
|
||||
|
||||
@Autowired
|
||||
private IToErpService toErpService;
|
||||
|
||||
/**
|
||||
* 接收物料信息
|
||||
*/
|
||||
@GetMapping("/receiveMaterial")
|
||||
public AjaxResult receiveMaterial(@RequestBody BasProduct basProduct) {
|
||||
return toErpService.receiveMaterial(basProduct);
|
||||
}
|
||||
/**
|
||||
* 接收客户信息
|
||||
*/
|
||||
@GetMapping("/receiveCustomer")
|
||||
public AjaxResult receiveCustomer(@RequestBody BasCustomer basProduct) {
|
||||
return toErpService.receiveCustomer(basProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收供应商信息
|
||||
*/
|
||||
@GetMapping("/receiveSupplier")
|
||||
public AjaxResult receiveSupplier(@RequestBody BasSupplier basSupplier) {
|
||||
return toErpService.receiveSupplier(basSupplier);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import com.ruoyi.api.domain.AgvMoveParam;
|
||||
import com.ruoyi.api.service.IToWcsService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 作业统计 Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api2wcs")
|
||||
public class ToWcsApiController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IToWcsService toWcsService;
|
||||
|
||||
|
||||
/**
|
||||
* 推送agv搬运作业
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/pushAgvMoveJob")
|
||||
public AjaxResult pushAgvMoveJob(@RequestBody AgvMoveParam agvMoveParam) {
|
||||
return toWcsService.pushAgvMoveJob(agvMoveParam);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.domain.ReMaterialParam;
|
||||
import com.ruoyi.api.domain.RequestEnter;
|
||||
import com.ruoyi.api.domain.WmsJobRequest;
|
||||
import com.ruoyi.api.service.IToWmsService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.log.domain.RequestLog;
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 作业统计 Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api2wms")
|
||||
public class ToWmsApiController {
|
||||
|
||||
@Autowired
|
||||
private IToWmsService toWmsService;
|
||||
@Autowired
|
||||
private IRequestLogService requestLogService;
|
||||
|
||||
/**
|
||||
* 入库请求生成作业
|
||||
*/
|
||||
@PostMapping("/requestEnterByTrayCode")
|
||||
public AjaxResult requestEnterByTrayCode(@RequestBody RequestEnter requestEnter) {
|
||||
AjaxResult ajaxResult = toWmsService.requestEnterByTrayCode(requestEnter);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(requestEnter), "入库任务创建请求",ajaxResult);
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求补码作业
|
||||
*/
|
||||
@RequestMapping("/requestByNoTrayCode")
|
||||
public AjaxResult requestByNoTrayCode(@RequestBody RequestEnter requestEnter) {
|
||||
AjaxResult ajaxResult = toWmsService.selectMydoJobByEntranceId(requestEnter);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(requestEnter), "请求补码作业",ajaxResult);
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取入库作业
|
||||
*/
|
||||
@RequestMapping("/requestEnterByTrayCodeAndEntranceId")
|
||||
public AjaxResult requestEnterByTrayCodeAndEntranceId(@RequestBody RequestEnter requestEnter) {
|
||||
AjaxResult ajaxResult = toWmsService.requestEnterByTrayCodeAndEntranceId(requestEnter);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(requestEnter), "获取入库作业",ajaxResult);
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 入库、出库 任务完成回传
|
||||
* Map<String, String>
|
||||
* "wmsType": "任务类型" 1-入库 2-出库 3-agv搬运,
|
||||
* taskNo:出库 入库任务号
|
||||
* trayCode:托盘码
|
||||
* positionCode1:起点
|
||||
* positionCode2:终点
|
||||
* containerCode:容器编码
|
||||
*
|
||||
*/
|
||||
@PostMapping("/jobFinish")
|
||||
public AjaxResult jobFinish(@RequestBody WmsJobRequest wmsJobRequest) {
|
||||
AjaxResult ajaxResult = toWmsService.jobFinish(wmsJobRequest);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wmsJobRequest), "jobFinish",ajaxResult);
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 放货有货,重新分配货位
|
||||
*/
|
||||
@PostMapping("/reAssign")
|
||||
public AjaxResult reAssign(@RequestBody ReMaterialParam reMaterialParam) {
|
||||
AjaxResult ajaxResult = toWmsService.reAssign(reMaterialParam);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(reMaterialParam), "reAssign",ajaxResult);
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 取货无货,重新分配物料
|
||||
*/
|
||||
@PostMapping("/reMaterial")
|
||||
public AjaxResult reMaterial(@RequestBody ReMaterialParam reMaterialParam) {
|
||||
AjaxResult ajaxResult = toWmsService.reMaterial(reMaterialParam);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(reMaterialParam), "reMaterial",ajaxResult);
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 接收入库单据
|
||||
*/
|
||||
|
||||
/**
|
||||
* 接收出库单据
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import com.ruoyi.api.service.IProductPortService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 仓库和点位API接口--拣选大屏
|
||||
*
|
||||
* @author lsy
|
||||
* @date 2025-06-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/warehouse")
|
||||
public class WarehousePortController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
private IProductPortService productPortService;
|
||||
|
||||
/**
|
||||
* 获取仓库列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult getWarehouseList() {
|
||||
try {
|
||||
String sql = "SELECT warehouse_id, warehouse_no, warehouse_name, address, c_desc " +
|
||||
"FROM bas_warehouse " +
|
||||
"WHERE is_current = 'Y' " +
|
||||
"ORDER BY warehouse_no";
|
||||
|
||||
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
||||
return success(list);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询仓库列表失败:", e);
|
||||
return error("查询仓库列表失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据仓库ID获取点位列表
|
||||
*/
|
||||
@GetMapping("/port/{warehouseId}")
|
||||
public AjaxResult getPortList( @PathVariable("warehouseId") String warehouseId) {
|
||||
if (warehouseId == null || warehouseId.trim().isEmpty()) {
|
||||
return error("仓库ID不能为空");
|
||||
}
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("warehouseId", warehouseId);
|
||||
params.put("portType", 2);
|
||||
List<Map<String, Object>> portList = productPortService.selectPortListByParams(params);
|
||||
return success(portList);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询点位列表失败:", e);
|
||||
return error("查询点位列表失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工位号数组查询任务数据
|
||||
*/
|
||||
@PostMapping("/workstation/jobs")
|
||||
public AjaxResult getJobsByWorkstations(@RequestBody Map<String, Object> request) {
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> workstationNumbers = (List<String>) request.get("workstationNumbers");
|
||||
String warehouseId = (String) request.get("warehouseId");
|
||||
if (workstationNumbers == null || workstationNumbers.isEmpty()) {
|
||||
return error("工位号数组不能为空");
|
||||
}
|
||||
if (warehouseId == null || warehouseId.trim().isEmpty()) {
|
||||
return error("仓库ID不能为空");
|
||||
}
|
||||
|
||||
StringBuilder placeholders = new StringBuilder();
|
||||
for (int i = 0; i < workstationNumbers.size(); i++) {
|
||||
placeholders.append(i == 0 ? "?" : ", ?");
|
||||
}
|
||||
|
||||
String sql = "SELECT j.*, jd.out_quantity, jd.product_id, bp.product_name " +
|
||||
"FROM mydo_job j " +
|
||||
"LEFT JOIN mydo_job_detail jd ON j.job_id = jd.job_id " +
|
||||
"LEFT JOIN bas_product bp ON jd.product_id = bp.product_id " +
|
||||
"WHERE j.exit_id IN (" + placeholders.toString() + ") " +
|
||||
"AND j.warehouse_id = ? ";
|
||||
|
||||
Object[] params = new Object[workstationNumbers.size() + 1];
|
||||
for (int i = 0; i < workstationNumbers.size(); i++) {
|
||||
params[i] = workstationNumbers.get(i);
|
||||
}
|
||||
params[workstationNumbers.size()] = warehouseId;
|
||||
List<Map<String, Object>> queryResult = jdbcTemplate.queryForList(sql, params);
|
||||
|
||||
// 按工位号分组
|
||||
Map<String, List<Map<String, Object>>> groupedResult = new HashMap<>();
|
||||
for (Map<String, Object> job : queryResult) {
|
||||
String exitId = (String) job.get("exit_id");
|
||||
groupedResult.computeIfAbsent(exitId, k -> new ArrayList<>()).add(job);
|
||||
}
|
||||
|
||||
return success(groupedResult);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询工位任务数据失败:", e);
|
||||
return error("查询工位任务数据失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user