Compare commits
18 Commits
219e23c194
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ef0c52b6df | |||
| 424aac6748 | |||
| cd0f7b371d | |||
| 8ceaeb03ef | |||
| 8323ae3cd9 | |||
| 15a4053cab | |||
| a892cdd03d | |||
| ac45b0c79b | |||
| 0c23b61cbb | |||
| dbc2bada83 | |||
| 8f802a8738 | |||
| d29b336252 | |||
| 2183528894 | |||
| 367dd00008 | |||
| 54c9486a88 | |||
| 56e4514ee8 | |||
| b84fd1e046 | |||
| 7b4965ff7a |
@@ -1244,6 +1244,25 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (value instanceof String)
|
||||||
|
{
|
||||||
|
String str = (String) value;
|
||||||
|
|
||||||
|
if ("sapNo".equals(field.getName() )
|
||||||
|
&& str.matches("^\\d{1,15}$"))
|
||||||
|
{
|
||||||
|
cell.setCellValue(Double.parseDouble(str));
|
||||||
|
|
||||||
|
// 设置为数字格式
|
||||||
|
CellStyle numStyle = wb.createCellStyle();
|
||||||
|
numStyle.cloneStyleFrom(cell.getCellStyle());
|
||||||
|
numStyle.setDataFormat(wb.createDataFormat().getFormat("0"));
|
||||||
|
cell.setCellStyle(numStyle);
|
||||||
|
|
||||||
|
addStatisticsData(column, str, attr);
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
}
|
||||||
// 设置列类型
|
// 设置列类型
|
||||||
setCellVo(value, attr, cell);
|
setCellVo(value, attr, cell);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,24 @@ public class AutoInventoryController extends BaseController {
|
|||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 极简盘点匹配(只按仓库+场景)
|
||||||
|
*/
|
||||||
|
@PostMapping("/matchPure")
|
||||||
|
@ApiOperation("极简盘点匹配")
|
||||||
|
public AjaxResult matchPure(@RequestBody QueryDTO dto) {
|
||||||
|
|
||||||
|
if (dto.getScanType() != null && dto.getScanType() == 1) {
|
||||||
|
rfidService.stopScan(dto.getDeviceId());
|
||||||
|
}
|
||||||
|
|
||||||
|
dto.setScanType(1);
|
||||||
|
|
||||||
|
rkInfoService.matchPure(dto);
|
||||||
|
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 匹配后图表统计
|
* 匹配后图表统计
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,20 +1,34 @@
|
|||||||
package com.zg.project.inventory.AutoInventory.controller;
|
package com.zg.project.inventory.AutoInventory.controller;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.zg.common.utils.StringUtils;
|
||||||
import com.zg.common.utils.poi.ExcelUtil;
|
import com.zg.common.utils.poi.ExcelUtil;
|
||||||
import com.zg.framework.web.controller.BaseController;
|
import com.zg.framework.web.controller.BaseController;
|
||||||
import com.zg.framework.web.domain.AjaxResult;
|
import com.zg.framework.web.domain.AjaxResult;
|
||||||
import com.zg.framework.web.page.TableDataInfo;
|
import com.zg.framework.web.page.TableDataInfo;
|
||||||
import com.zg.project.inventory.AutoInventory.service.InventoryMatchScanService;
|
import com.zg.project.inventory.AutoInventory.service.InventoryMatchScanService;
|
||||||
|
import com.zg.project.inventory.domain.dto.InventoryDTO;
|
||||||
import com.zg.project.inventory.domain.dto.MatchScanPageDTO;
|
import com.zg.project.inventory.domain.dto.MatchScanPageDTO;
|
||||||
import com.zg.project.inventory.domain.entity.InventoryMatchScan;
|
import com.zg.project.inventory.domain.entity.InventoryMatchScan;
|
||||||
import com.zg.project.inventory.domain.vo.InventoryMatchScanVO;
|
import com.zg.project.inventory.domain.vo.InventoryMatchScanVO;
|
||||||
import com.zg.project.inventory.domain.vo.RkInfoMatchVO;
|
import com.zg.project.inventory.domain.vo.RkInfoMatchVO;
|
||||||
|
import com.zg.project.inventory.domain.vo.RkInventoryExportVO;
|
||||||
|
import com.zg.project.wisdom.domain.RkInfo;
|
||||||
|
import com.zg.project.wisdom.domain.RkRecord;
|
||||||
|
import com.zg.project.wisdom.domain.vo.StockStatisticVO;
|
||||||
|
import com.zg.project.wisdom.mapper.RkInfoMapper;
|
||||||
|
import com.zg.project.wisdom.service.IRkInfoService;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.zg.common.utils.PageUtils.startPage;
|
import static com.zg.common.utils.PageUtils.startPage;
|
||||||
|
|
||||||
@@ -25,7 +39,10 @@ public class InventoryMatchScanController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private InventoryMatchScanService inventoryMatchScanService;
|
private InventoryMatchScanService inventoryMatchScanService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IRkInfoService rkInfoService;
|
||||||
|
@Autowired
|
||||||
|
private RkInfoMapper rkInfoMapper;
|
||||||
/**
|
/**
|
||||||
* 分页查询盘点结果
|
* 分页查询盘点结果
|
||||||
* @param matchScan
|
* @param matchScan
|
||||||
@@ -40,9 +57,63 @@ public class InventoryMatchScanController extends BaseController {
|
|||||||
|
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, InventoryMatchScan criteria) {
|
public void export(HttpServletResponse response, InventoryMatchScan criteria) {
|
||||||
List<InventoryMatchScan> list = inventoryMatchScanService.selectInventoryMatchScanList(criteria);
|
|
||||||
ExcelUtil<InventoryMatchScan> util = new ExcelUtil<>(InventoryMatchScan.class);
|
// 1️⃣ 查盘点结果
|
||||||
util.exportExcel(response, list, "盘点匹配结果");
|
List<InventoryMatchScan> list =
|
||||||
|
inventoryMatchScanService.selectInventoryMatchScanList(criteria);
|
||||||
|
|
||||||
|
if (list == null || list.isEmpty()) {
|
||||||
|
new ExcelUtil<>(RkInventoryExportVO.class)
|
||||||
|
.exportExcel(response, new ArrayList<>(), "盘点匹配结果");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2️⃣ 收集所有 pcode(去重)
|
||||||
|
Set<String> pcodes = list.stream()
|
||||||
|
.map(InventoryMatchScan::getPcode)
|
||||||
|
.filter(StringUtils::isNotBlank)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// 3️⃣ 一次性查所有货物
|
||||||
|
List<RkInfo> allInfos =
|
||||||
|
rkInfoService.listRkInfoByPcodes(new ArrayList<>(pcodes));
|
||||||
|
|
||||||
|
// 4️⃣ 按 pcode 分组
|
||||||
|
Map<String, List<RkInfo>> infoMap = allInfos.stream()
|
||||||
|
.collect(Collectors.groupingBy(RkInfo::getPcode));
|
||||||
|
|
||||||
|
// 5️⃣ 组装
|
||||||
|
List<RkInventoryExportVO> exportList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (InventoryMatchScan scan : list) {
|
||||||
|
|
||||||
|
List<RkInfo> rkInfos = infoMap.get(scan.getPcode());
|
||||||
|
|
||||||
|
if (rkInfos == null || rkInfos.isEmpty()) {
|
||||||
|
|
||||||
|
RkInventoryExportVO vo = new RkInventoryExportVO();
|
||||||
|
BeanUtils.copyProperties(scan, vo);
|
||||||
|
exportList.add(vo);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for (RkInfo info : rkInfos) {
|
||||||
|
|
||||||
|
RkInventoryExportVO vo = new RkInventoryExportVO();
|
||||||
|
|
||||||
|
BeanUtils.copyProperties(info, vo);
|
||||||
|
BeanUtils.copyProperties(scan, vo);
|
||||||
|
|
||||||
|
exportList.add(vo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6️⃣ 导出
|
||||||
|
ExcelUtil<RkInventoryExportVO> util =
|
||||||
|
new ExcelUtil<>(RkInventoryExportVO.class);
|
||||||
|
|
||||||
|
util.exportExcel(response, exportList, "盘点匹配结果");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,4 +148,51 @@ public class InventoryMatchScanController extends BaseController {
|
|||||||
return AjaxResult.success(getDataTable(list));
|
return AjaxResult.success(getDataTable(list));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@PostMapping("/inventoryList")
|
||||||
|
public TableDataInfo inventoryList(@RequestBody InventoryDTO query) {
|
||||||
|
PageHelper.startPage(query.getPageNum(), query.getPageSize());
|
||||||
|
String warehouseCode = query.getWarehouseCode();
|
||||||
|
String sceneId = query.getSceneId();
|
||||||
|
List<RkInfo> normalAll =
|
||||||
|
rkInfoMapper.getByWarehouseAndScene(warehouseCode, sceneId);
|
||||||
|
return getDataTable(normalAll);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入库统计,返回总数
|
||||||
|
*/
|
||||||
|
@PostMapping("/statistics")
|
||||||
|
public AjaxResult statistics(@RequestBody InventoryDTO query) {
|
||||||
|
RkInfo rkInfo = new RkInfo();
|
||||||
|
rkInfo.setScene(query.getSceneId());
|
||||||
|
rkInfo.setCangku(query.getWarehouseCode());
|
||||||
|
StockStatisticVO stockStatistic = rkInfoMapper.selectStockStatisticByCondition(rkInfo);
|
||||||
|
return AjaxResult.success(stockStatistic);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 条目数
|
||||||
|
*/
|
||||||
|
@PostMapping("/countByWarehouseAndScene")
|
||||||
|
public AjaxResult countByWarehouseAndScene(@RequestBody InventoryDTO query)
|
||||||
|
{
|
||||||
|
String warehouseCode = query.getWarehouseCode();
|
||||||
|
String sceneId = query.getSceneId();
|
||||||
|
int count = rkInfoService.countByWarehouseAndScene(warehouseCode, sceneId);
|
||||||
|
return AjaxResult.success(count);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/exportInventory")
|
||||||
|
public void exportInventory(HttpServletResponse response, InventoryDTO query)
|
||||||
|
{
|
||||||
|
String warehouseCode = query.getWarehouseCode();
|
||||||
|
String sceneId = query.getSceneId();
|
||||||
|
|
||||||
|
// 查询数据(不分页)
|
||||||
|
List<RkInfo> list =
|
||||||
|
rkInfoMapper.getByWarehouseAndScene(warehouseCode, sceneId);
|
||||||
|
|
||||||
|
ExcelUtil<RkInfo> util = new ExcelUtil<>(RkInfo.class);
|
||||||
|
util.exportExcel(response, list, "盘点数据");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,4 +33,11 @@ public interface InventoryMatchScanMapper {
|
|||||||
List<RkInfoMatchVO> selectOnlyFromMatchScan(InventoryMatchScan param);
|
List<RkInfoMatchVO> selectOnlyFromMatchScan(InventoryMatchScan param);
|
||||||
|
|
||||||
List<RkInfoMatchVO> selectJoinRkInfo(InventoryMatchScan param);
|
List<RkInfoMatchVO> selectJoinRkInfo(InventoryMatchScan param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指定仓库下未被扫描的库位
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RkInfoMatchVO> selectUnscanFromMatchScan(InventoryMatchScan param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,20 +58,24 @@ public class InventoryMatchScanServiceImpl implements InventoryMatchScanService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RkInfoMatchVO> selectMatchScanCountList(InventoryMatchScan param) {
|
public List<RkInfoMatchVO> selectMatchScanCountList(InventoryMatchScan param) {
|
||||||
// 状态=2:只查扫描表中的数据
|
|
||||||
|
// ========== 1. 已扫描异常 ==========
|
||||||
if ("2".equals(param.getStatus())) {
|
if ("2".equals(param.getStatus())) {
|
||||||
return mapper.selectOnlyFromMatchScan(param);
|
return mapper.selectOnlyFromMatchScan(param);
|
||||||
}
|
}
|
||||||
// 状态=1:查询指定仓库下未被扫描的库位
|
|
||||||
|
// ========== 2. ❗未扫到(你要的逻辑)==========
|
||||||
else if ("1".equals(param.getStatus())) {
|
else if ("1".equals(param.getStatus())) {
|
||||||
// ✅ 根据任务ID取 sceneId,再按 scene 查询“未被扫描”的库位
|
|
||||||
String sceneId = taskMapper.getSceneByTaskId(param.getTaskId());
|
// 👉 只查扫描表!没有就是空!
|
||||||
return rkInfoMapper.getUnscannedPcodeByScene(sceneId, param.getTaskId());
|
return mapper.selectUnscanFromMatchScan(param);
|
||||||
}
|
}
|
||||||
// 其它情况:返回扫描表和库存表的关联数据
|
|
||||||
|
// ========== 3. 正常匹配 ==========
|
||||||
else {
|
else {
|
||||||
return mapper.selectJoinRkInfo(param);
|
return mapper.selectJoinRkInfo(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,18 +16,18 @@ public class HdInventoryController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IRkInfoService rkInfoService;
|
private IRkInfoService rkInfoService;
|
||||||
|
|
||||||
// @ApiModelProperty("开始匹配")
|
@ApiModelProperty("开始匹配")
|
||||||
// @PostMapping("/match")
|
@PostMapping("/match")
|
||||||
// public AjaxResult match(@RequestBody QueryDTO dto) {
|
public AjaxResult match(@RequestBody QueryDTO dto) {
|
||||||
//
|
|
||||||
// dto.setScanType(0);
|
|
||||||
//
|
|
||||||
//// dto.setDeviceId("0");
|
|
||||||
//
|
|
||||||
// rkInfoService.matchWithStatus(dto);
|
|
||||||
//
|
|
||||||
// return AjaxResult.success();
|
|
||||||
|
|
||||||
// }
|
dto.setScanType(0);
|
||||||
|
|
||||||
|
// dto.setDeviceId("0");
|
||||||
|
|
||||||
|
rkInfoService.matchPure(dto);
|
||||||
|
|
||||||
|
return AjaxResult.success();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,4 +94,5 @@ public interface InventoryTaskMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String selectSceneIdById(String taskId);
|
String selectSceneIdById(String taskId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.zg.project.inventory.domain.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class InventoryDTO {
|
||||||
|
private String warehouseCode;
|
||||||
|
private String sceneId;
|
||||||
|
/** 当前页 */
|
||||||
|
private Integer pageNum;
|
||||||
|
|
||||||
|
/** 每页条数 */
|
||||||
|
private Integer pageSize;
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ public class InventoryMatchScan extends BaseEntity {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 主键ID */
|
/** 主键ID */
|
||||||
@Excel(name = "主键ID")
|
// @Excel(name = "主键ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 设备ID */
|
/** 设备ID */
|
||||||
@@ -28,7 +28,7 @@ public class InventoryMatchScan extends BaseEntity {
|
|||||||
private String taskId;
|
private String taskId;
|
||||||
|
|
||||||
/** 扫描标签ID(货品码ID) */
|
/** 扫描标签ID(货品码ID) */
|
||||||
@Excel(name = "扫描标签ID")
|
@Excel(name = "库位号")
|
||||||
private String pcode;
|
private String pcode;
|
||||||
|
|
||||||
/** 系统入库时间 */
|
/** 系统入库时间 */
|
||||||
@@ -44,7 +44,7 @@ public class InventoryMatchScan extends BaseEntity {
|
|||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 匹配到的真实货品码 */
|
/** 匹配到的真实货品码 */
|
||||||
@Excel(name = "库位号")
|
// @Excel(name = "库位号")
|
||||||
private String rkPcode;
|
private String rkPcode;
|
||||||
|
|
||||||
@Excel(name = "盘点任务名称")
|
@Excel(name = "盘点任务名称")
|
||||||
@@ -115,6 +115,13 @@ public class InventoryMatchScan extends BaseEntity {
|
|||||||
public void setRkPcode(String rkPcode) {
|
public void setRkPcode(String rkPcode) {
|
||||||
this.rkPcode = rkPcode;
|
this.rkPcode = rkPcode;
|
||||||
}
|
}
|
||||||
|
public String getTaskName() {
|
||||||
|
return taskName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskName(String taskName) {
|
||||||
|
this.taskName = taskName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -128,6 +135,7 @@ public class InventoryMatchScan extends BaseEntity {
|
|||||||
.append("scanType", getScanType())
|
.append("scanType", getScanType())
|
||||||
.append("status", getStatus())
|
.append("status", getStatus())
|
||||||
.append("rkPcode", getRkPcode())
|
.append("rkPcode", getRkPcode())
|
||||||
|
.append("taskName", getTaskName())
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
.append("updateBy", getUpdateBy())
|
.append("updateBy", getUpdateBy())
|
||||||
|
|||||||
@@ -0,0 +1,129 @@
|
|||||||
|
package com.zg.project.inventory.domain.vo;
|
||||||
|
|
||||||
|
import com.zg.framework.aspectj.lang.annotation.Excel;
|
||||||
|
import com.zg.project.wisdom.domain.RkInfo;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RkInventoryExportVO extends RkInfo {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键ID */
|
||||||
|
@Excel(name = "主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 设备ID */
|
||||||
|
@Excel(name = "设备ID")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/** 盘点任务ID */
|
||||||
|
@Excel(name = "盘点任务ID")
|
||||||
|
private String taskId;
|
||||||
|
|
||||||
|
/** 扫描标签ID(货品码ID) */
|
||||||
|
@Excel(name = "库位号")
|
||||||
|
private String pcode;
|
||||||
|
|
||||||
|
/** 系统入库时间 */
|
||||||
|
@Excel(name = "系统入库时间")
|
||||||
|
private String tme;
|
||||||
|
|
||||||
|
/** 盘点类型(0=手动盘点,1=自动盘点) */
|
||||||
|
@Excel(name = "盘点类型", readConverterExp = "0=手动盘点,1=自动盘点")
|
||||||
|
private Integer scanType;
|
||||||
|
|
||||||
|
/** 匹配状态(0=正常, 1=未扫到, 2=误扫) */
|
||||||
|
@Excel(name = "匹配状态", readConverterExp = "0=正常,1=未扫到,2=误扫")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** 匹配到的真实货品码 */
|
||||||
|
@Excel(name = "库位号")
|
||||||
|
private String rkPcode;
|
||||||
|
|
||||||
|
@Excel(name = "盘点任务名称")
|
||||||
|
private String taskName;
|
||||||
|
|
||||||
|
// ---------- Getter/Setter ----------
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(String deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskId() {
|
||||||
|
return taskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskId(String taskId) {
|
||||||
|
this.taskId = taskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPcode() {
|
||||||
|
return pcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPcode(String pcode) {
|
||||||
|
this.pcode = pcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTme() {
|
||||||
|
return tme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTme(String tme) {
|
||||||
|
this.tme = tme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getScanType() {
|
||||||
|
return scanType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScanType(Integer scanType) {
|
||||||
|
this.scanType = scanType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRkPcode() {
|
||||||
|
return rkPcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRkPcode(String rkPcode) {
|
||||||
|
this.rkPcode = rkPcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("deviceId", getDeviceId())
|
||||||
|
.append("taskId", getTaskId())
|
||||||
|
.append("pcode", getPcode())
|
||||||
|
.append("tme", getTme())
|
||||||
|
.append("scanType", getScanType())
|
||||||
|
.append("status", getStatus())
|
||||||
|
.append("rkPcode", getRkPcode())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -179,7 +179,6 @@ public class RkRecordController extends BaseController
|
|||||||
* 更新配送状态
|
* 更新配送状态
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updateDeliveryStatus")
|
@PostMapping("/updateDeliveryStatus")
|
||||||
@Log(title = "更新配送状态", businessType = BusinessType.UPDATE)
|
|
||||||
public AjaxResult updateDeliveryStatus(@RequestBody RkDeliveryUpdateDTO dto) {
|
public AjaxResult updateDeliveryStatus(@RequestBody RkDeliveryUpdateDTO dto) {
|
||||||
|
|
||||||
if (dto.getIds() == null || dto.getIds().isEmpty()) {
|
if (dto.getIds() == null || dto.getIds().isEmpty()) {
|
||||||
@@ -190,6 +189,7 @@ public class RkRecordController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
int rows = rkRecordService.updateDeliveryStatus(dto.getIds(), dto.getIsDelivery());
|
int rows = rkRecordService.updateDeliveryStatus(dto.getIds(), dto.getIsDelivery());
|
||||||
|
|
||||||
return AjaxResult.success(rows);
|
return AjaxResult.success(rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public class RkStatisticsController {
|
|||||||
List<TodoStatVO> list = rkStatisticsService.selectTodoStat();
|
List<TodoStatVO> list = rkStatisticsService.selectTodoStat();
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小仓库位使用情况统计(总库位/已使用/未使用)
|
* 小仓库位使用情况统计(总库位/已使用/未使用)
|
||||||
*/
|
*/
|
||||||
@@ -78,6 +79,7 @@ public class RkStatisticsController {
|
|||||||
List<WarehouseSlotStatVO> list = rkStatisticsService.selectWarehouseSlotStat();
|
List<WarehouseSlotStatVO> list = rkStatisticsService.selectWarehouseSlotStat();
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库龄>=30天明细导出(分组:>30天 / >60天)
|
* 库龄>=30天明细导出(分组:>30天 / >60天)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class RkInfo extends BaseEntity
|
|||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 业务操作类型(0入库,1出库,2借料出库,3还料入库) */
|
/** 业务操作类型(0入库,1出库,2借料出库,3还料入库) */
|
||||||
@Excel(name = "业务类型", readConverterExp = "0=入库,1=出库,2=借料出库,3=还料入库")
|
// @Excel(name = "业务类型", readConverterExp = "0=入库,1=出库,2=借料出库,3=还料入库")
|
||||||
private String bizType;
|
private String bizType;
|
||||||
|
|
||||||
/** 出入库类型 */
|
/** 出入库类型 */
|
||||||
@@ -37,7 +37,7 @@ public class RkInfo extends BaseEntity
|
|||||||
private String operationTypeName;
|
private String operationTypeName;
|
||||||
|
|
||||||
/** 执行状态(0预入/预出,1已完成) */
|
/** 执行状态(0预入/预出,1已完成) */
|
||||||
@Excel(name = "执行状态", readConverterExp = "0=预入/预出,1=已完成")
|
// @Excel(name = "执行状态", readConverterExp = "0=预入/预出,1=已完成")
|
||||||
private String execStatus;
|
private String execStatus;
|
||||||
|
|
||||||
/** 物资类型 */
|
/** 物资类型 */
|
||||||
@@ -80,11 +80,11 @@ public class RkInfo extends BaseEntity
|
|||||||
private String operatorName;
|
private String operatorName;
|
||||||
|
|
||||||
/** 是否已出库(0已入库,1已出库) */
|
/** 是否已出库(0已入库,1已出库) */
|
||||||
@Excel(name = "是否已出库", readConverterExp = "0=已入库,1=已出库")
|
// @Excel(name = "是否已出库", readConverterExp = "0=已入库,1=已出库")
|
||||||
private String isChuku;
|
private String isChuku;
|
||||||
|
|
||||||
/** 审核状态(0入库待审核,1已通过,2已驳回,3出库待审核) */
|
/** 审核状态(0入库待审核,1已通过,2已驳回,3出库待审核) */
|
||||||
@Excel(name = "审核状态", readConverterExp = "0=入库待审核,1=已通过,2=已驳回,3=出库待审核")
|
// @Excel(name = "审核状态", readConverterExp = "0=入库待审核,1=已通过,2=已驳回,3=出库待审核")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 单据号 */
|
/** 单据号 */
|
||||||
@@ -92,7 +92,7 @@ public class RkInfo extends BaseEntity
|
|||||||
private String billNo;
|
private String billNo;
|
||||||
|
|
||||||
/** 县局 */
|
/** 县局 */
|
||||||
@Excel(name = "县局")
|
// @Excel(name = "县局")
|
||||||
private String xj;
|
private String xj;
|
||||||
|
|
||||||
/** 项目号 */
|
/** 项目号 */
|
||||||
@@ -104,11 +104,11 @@ public class RkInfo extends BaseEntity
|
|||||||
private String xmMs;
|
private String xmMs;
|
||||||
|
|
||||||
/** 出库项目号(借用方项目) */
|
/** 出库项目号(借用方项目) */
|
||||||
@Excel(name = "借用方项目号")
|
// @Excel(name = "借用方项目号")
|
||||||
private String xmNoCk;
|
private String xmNoCk;
|
||||||
|
|
||||||
/** 出库项目描述(借用方项目描述) */
|
/** 出库项目描述(借用方项目描述) */
|
||||||
@Excel(name = "借用方项目描述")
|
// @Excel(name = "借用方项目描述")
|
||||||
private String xmMsCk;
|
private String xmMsCk;
|
||||||
|
|
||||||
/** 物料号 */
|
/** 物料号 */
|
||||||
@@ -120,7 +120,7 @@ public class RkInfo extends BaseEntity
|
|||||||
private String wlMs;
|
private String wlMs;
|
||||||
|
|
||||||
/** 供应商编码 */
|
/** 供应商编码 */
|
||||||
@Excel(name = "供应商编码")
|
// @Excel(name = "供应商编码")
|
||||||
private String gysNo;
|
private String gysNo;
|
||||||
|
|
||||||
/** 供应商名称 */
|
/** 供应商名称 */
|
||||||
@@ -132,12 +132,12 @@ public class RkInfo extends BaseEntity
|
|||||||
private String sapNo;
|
private String sapNo;
|
||||||
|
|
||||||
/** 行号 */
|
/** 行号 */
|
||||||
@Excel(name = "行号")
|
// @Excel(name = "行号")
|
||||||
private String xh;
|
private String xh;
|
||||||
|
|
||||||
|
|
||||||
/** 计划交货金额 */
|
/** 计划交货金额 */
|
||||||
@Excel(name = "计划交货金额")
|
// @Excel(name = "计划交货金额")
|
||||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||||
private BigDecimal jhAmt;
|
private BigDecimal jhAmt;
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ public class RkInfo extends BaseEntity
|
|||||||
private BigDecimal htDj;
|
private BigDecimal htDj;
|
||||||
|
|
||||||
/** 计划交货数量 */
|
/** 计划交货数量 */
|
||||||
@Excel(name = "计划交货数量")
|
// @Excel(name = "计划交货数量")
|
||||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||||
private BigDecimal jhQty;
|
private BigDecimal jhQty;
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ public class RkInfo extends BaseEntity
|
|||||||
private String entityId;
|
private String entityId;
|
||||||
|
|
||||||
/** 施工队 */
|
/** 施工队 */
|
||||||
@Excel(name = "施工队")
|
// @Excel(name = "施工队")
|
||||||
private String teamCode;
|
private String teamCode;
|
||||||
|
|
||||||
/** 借用时间 */
|
/** 借用时间 */
|
||||||
@@ -205,7 +205,7 @@ public class RkInfo extends BaseEntity
|
|||||||
private String hasMoved;
|
private String hasMoved;
|
||||||
|
|
||||||
/** 是否借料(0否,1是,2已归还) */
|
/** 是否借料(0否,1是,2已归还) */
|
||||||
@Excel(name = "是否借料", readConverterExp = "0=否,1=是,2=已归还")
|
// @Excel(name = "是否借料", readConverterExp = "0=否,1=是,2=已归还")
|
||||||
private String isBorrowed;
|
private String isBorrowed;
|
||||||
|
|
||||||
/** 是否删除(0正常,1已删除) */
|
/** 是否删除(0正常,1已删除) */
|
||||||
@@ -213,7 +213,7 @@ public class RkInfo extends BaseEntity
|
|||||||
private String isDelete;
|
private String isDelete;
|
||||||
|
|
||||||
/** 供应计划ID */
|
/** 供应计划ID */
|
||||||
@Excel(name = "供应计划ID")
|
// @Excel(name = "供应计划ID")
|
||||||
private Long gysJhId;
|
private Long gysJhId;
|
||||||
|
|
||||||
/** rdid */
|
/** rdid */
|
||||||
@@ -226,7 +226,7 @@ public class RkInfo extends BaseEntity
|
|||||||
private Long sid;
|
private Long sid;
|
||||||
|
|
||||||
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||||
@Excel(name = "是否需要配送", readConverterExp = "0否,1是,2配送中,3配送完成")
|
// @Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=待配送,3=配送中,4=配送完成")
|
||||||
private String isDelivery;
|
private String isDelivery;
|
||||||
|
|
||||||
/** 封样编号1 */
|
/** 封样编号1 */
|
||||||
@@ -251,6 +251,12 @@ public class RkInfo extends BaseEntity
|
|||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date endDate;
|
private Date endDate;
|
||||||
|
/** 场景 */
|
||||||
|
@Excel(name = "场景",readConverterExp = "HJ=货架,DC=堆场")
|
||||||
|
private String scene;
|
||||||
|
|
||||||
|
private String sceneName;
|
||||||
|
|
||||||
public void setId(Long id)
|
public void setId(Long id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@@ -796,6 +802,24 @@ public class RkInfo extends BaseEntity
|
|||||||
this.endDate = endDate;
|
this.endDate = endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setScene(String scene)
|
||||||
|
{
|
||||||
|
this.scene = scene;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScene()
|
||||||
|
{
|
||||||
|
return scene;
|
||||||
|
}
|
||||||
|
public void setSceneName(String sceneName)
|
||||||
|
{
|
||||||
|
this.sceneName = sceneName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSceneName()
|
||||||
|
{
|
||||||
|
return sceneName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@@ -861,6 +885,7 @@ public class RkInfo extends BaseEntity
|
|||||||
.append("startDate", startDate)
|
.append("startDate", startDate)
|
||||||
.append("endDate", endDate)
|
.append("endDate", endDate)
|
||||||
.append("totalAmount", totalAmount)
|
.append("totalAmount", totalAmount)
|
||||||
|
.append("scene", getScene())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class RkRecord extends BaseEntity
|
|||||||
private String teamName;
|
private String teamName;
|
||||||
|
|
||||||
/** 执行状态(0预入/预出,1已完成) */
|
/** 执行状态(0预入/预出,1已完成) */
|
||||||
@Excel(name = "执行状态", readConverterExp = "0=预操作,1=已完成")
|
// @Excel(name = "执行状态", readConverterExp = "0=预操作,1=已完成")
|
||||||
private String execStatus;
|
private String execStatus;
|
||||||
|
|
||||||
/** 物资类型 */
|
/** 物资类型 */
|
||||||
@@ -119,11 +119,11 @@ public class RkRecord extends BaseEntity
|
|||||||
private String xmMs;
|
private String xmMs;
|
||||||
|
|
||||||
/** 出库项目号(借用方项目) */
|
/** 出库项目号(借用方项目) */
|
||||||
@Excel(name = "出库项目号", readConverterExp = "借=用方项目")
|
// @Excel(name = "出库项目号", readConverterExp = "借=用方项目")
|
||||||
private String xmNoCk;
|
private String xmNoCk;
|
||||||
|
|
||||||
/** 出库项目描述(借用方项目描述) */
|
/** 出库项目描述(借用方项目描述) */
|
||||||
@Excel(name = "出库项目描述", readConverterExp = "借=用方项目描述")
|
// @Excel(name = "出库项目描述", readConverterExp = "借=用方项目描述")
|
||||||
private String xmMsCk;
|
private String xmMsCk;
|
||||||
|
|
||||||
/** 物料号 */
|
/** 物料号 */
|
||||||
@@ -151,7 +151,7 @@ public class RkRecord extends BaseEntity
|
|||||||
private String xh;
|
private String xh;
|
||||||
|
|
||||||
/** 计划交货金额 */
|
/** 计划交货金额 */
|
||||||
@Excel(name = "计划交货金额")
|
// @Excel(name = "计划交货金额")
|
||||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||||
private BigDecimal jhAmt;
|
private BigDecimal jhAmt;
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ public class RkRecord extends BaseEntity
|
|||||||
private BigDecimal htDj;
|
private BigDecimal htDj;
|
||||||
|
|
||||||
/** 计划交货数量 */
|
/** 计划交货数量 */
|
||||||
@Excel(name = "计划交货数量")
|
// @Excel(name = "计划交货数量")
|
||||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||||
private BigDecimal jhQty;
|
private BigDecimal jhQty;
|
||||||
|
|
||||||
@@ -239,14 +239,14 @@ public class RkRecord extends BaseEntity
|
|||||||
private Long sid;
|
private Long sid;
|
||||||
|
|
||||||
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||||
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=已接单,3=配送中,4=配送完成")
|
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=待配送,3=配送中,4=配送完成")
|
||||||
private String isDelivery;
|
private String isDelivery;
|
||||||
/** 封样编号1 */
|
/** 封样编号1 */
|
||||||
// @Excel(name = "封样编号1")
|
// @Excel(name = "封样编号1")
|
||||||
private String fycde1;
|
private String fycde1;
|
||||||
|
|
||||||
/** 封样编号2 */
|
/** 封样编号2 */
|
||||||
// @Excel(name = "封样编号2")
|
// @Excel(name = "封样编号2")2
|
||||||
private String fycde2;
|
private String fycde2;
|
||||||
|
|
||||||
/** 1已更新 */
|
/** 1已更新 */
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zg.project.wisdom.mapper;
|
package com.zg.project.wisdom.mapper;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -160,4 +161,33 @@ public interface RkInfoMapper
|
|||||||
* 查询库存单据明细列表(按单据号排序)
|
* 查询库存单据明细列表(按单据号排序)
|
||||||
*/
|
*/
|
||||||
List<RkInfo> selectRkInfoListOrderByBillNo(RkInfo rkInfo);
|
List<RkInfo> selectRkInfoListOrderByBillNo(RkInfo rkInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据仓库和场景查询库存单据明细
|
||||||
|
*/
|
||||||
|
List<RkInfo> getByWarehouseAndScene(
|
||||||
|
@Param("warehouseCode") String warehouseCode,
|
||||||
|
@Param("sceneId") String sceneId
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
List<RkInfo> listRkInfoByPcodes(ArrayList<String> strings);
|
||||||
|
/**
|
||||||
|
* 查询今日最大单号
|
||||||
|
* */
|
||||||
|
String selectTodayMaxBillNo(String prefix, String date);
|
||||||
|
/**
|
||||||
|
* 更新单位
|
||||||
|
* */
|
||||||
|
int updateDw(@Param("sapNo") String sapNo,
|
||||||
|
@Param("wlNo") String wlNo,
|
||||||
|
@Param("xmNo") String xmNo,
|
||||||
|
@Param("dw") String dw);
|
||||||
|
/**
|
||||||
|
* 条目数
|
||||||
|
* */
|
||||||
|
int countByWarehouseAndScene(
|
||||||
|
@Param("warehouseCode") String warehouseCode,
|
||||||
|
@Param("sceneId") String sceneId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,5 +166,21 @@ public interface RkRecordMapper
|
|||||||
*/
|
*/
|
||||||
int countDifferentDeliveryStatus(@Param("billNo") String billNo,
|
int countDifferentDeliveryStatus(@Param("billNo") String billNo,
|
||||||
@Param("isDelivery") Integer isDelivery);
|
@Param("isDelivery") Integer isDelivery);
|
||||||
|
/**
|
||||||
|
* 根据 billNo 批量更新 record 明细
|
||||||
|
*/
|
||||||
|
int updateRecordByBillNo(RkRecord record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询bill最小配送状态
|
||||||
|
*/
|
||||||
|
Integer selectMinDeliveryStatusByBillNo(
|
||||||
|
@Param("billNo") String billNo);
|
||||||
|
/**
|
||||||
|
* 更新单位
|
||||||
|
*/
|
||||||
|
int updateDw(@Param("sapNo") String sapNo,
|
||||||
|
@Param("wlNo") String wlNo,
|
||||||
|
@Param("xmNo") String xmNo,
|
||||||
|
@Param("dw") String dw);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zg.project.wisdom.service;
|
package com.zg.project.wisdom.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.zg.project.inventory.domain.dto.QueryDTO;
|
import com.zg.project.inventory.domain.dto.QueryDTO;
|
||||||
@@ -76,6 +77,13 @@ public interface IRkInfoService
|
|||||||
*/
|
*/
|
||||||
void matchWithStatus(QueryDTO dto);
|
void matchWithStatus(QueryDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 盘点开始匹配(纯数据)
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void matchPure(QueryDTO dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图表统计:每个库位有多少个货物
|
* 图表统计:每个库位有多少个货物
|
||||||
* @param dto
|
* @param dto
|
||||||
@@ -101,4 +109,15 @@ public interface IRkInfoService
|
|||||||
* 查询库存单据明细列表(按单据号排序)
|
* 查询库存单据明细列表(按单据号排序)
|
||||||
*/
|
*/
|
||||||
List<RkInfo> selectRkInfoListOrderByBillNo(RkInfo rkInfo);
|
List<RkInfo> selectRkInfoListOrderByBillNo(RkInfo rkInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按多个pcode查询
|
||||||
|
* @param strings
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RkInfo> listRkInfoByPcodes(ArrayList<String> strings);
|
||||||
|
/**
|
||||||
|
*条目数
|
||||||
|
* */
|
||||||
|
int countByWarehouseAndScene(String warehouseCode, String sceneId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.zg.project.wisdom.mapper.AgvWcsMapper;
|
|||||||
import com.zg.project.wisdom.mapper.DdTaskMapper;
|
import com.zg.project.wisdom.mapper.DdTaskMapper;
|
||||||
import com.zg.project.wisdom.mapper.WcsTaskResultMapper;
|
import com.zg.project.wisdom.mapper.WcsTaskResultMapper;
|
||||||
import com.zg.project.wisdom.service.IDdTaskService;
|
import com.zg.project.wisdom.service.IDdTaskService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -27,13 +28,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.zg.framework.datasource.DynamicDataSourceContextHolder.log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调度任务 Service 实现类
|
* 调度任务 Service 实现类
|
||||||
*
|
*
|
||||||
* @author zg
|
* @author zg
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class DdTaskServiceImpl implements IDdTaskService {
|
public class DdTaskServiceImpl implements IDdTaskService {
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import com.zg.common.utils.SecurityUtils;
|
|||||||
import com.zg.common.utils.StringUtils;
|
import com.zg.common.utils.StringUtils;
|
||||||
import com.zg.framework.web.domain.AjaxResult;
|
import com.zg.framework.web.domain.AjaxResult;
|
||||||
import com.zg.project.wisdom.domain.dto.ExcelFieldMapping;
|
import com.zg.project.wisdom.domain.dto.ExcelFieldMapping;
|
||||||
|
import com.zg.project.wisdom.mapper.RkInfoMapper;
|
||||||
|
import com.zg.project.wisdom.mapper.RkRecordMapper;
|
||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -30,7 +32,11 @@ public class GysJhServiceImpl implements IGysJhService
|
|||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private GysJhMapper gysJhMapper;
|
private GysJhMapper gysJhMapper;
|
||||||
|
@Autowired
|
||||||
|
private RkInfoMapper rkInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RkRecordMapper rkRecordMapper;
|
||||||
/**
|
/**
|
||||||
* 查询供应计划
|
* 查询供应计划
|
||||||
*
|
*
|
||||||
@@ -78,7 +84,24 @@ public class GysJhServiceImpl implements IGysJhService
|
|||||||
public int updateGysJh(GysJh gysJh)
|
public int updateGysJh(GysJh gysJh)
|
||||||
{
|
{
|
||||||
gysJh.setUpdateTime(DateUtils.getNowDate());
|
gysJh.setUpdateTime(DateUtils.getNowDate());
|
||||||
return gysJhMapper.updateGysJh(gysJh);
|
int rows = gysJhMapper.updateGysJh(gysJh);
|
||||||
|
|
||||||
|
// 2️⃣ 同步更新 rk_info
|
||||||
|
rkInfoMapper.updateDw(
|
||||||
|
gysJh.getSapNo(),
|
||||||
|
gysJh.getWlNo(),
|
||||||
|
gysJh.getXmNo(),
|
||||||
|
gysJh.getDw()
|
||||||
|
);
|
||||||
|
|
||||||
|
// 3️⃣ 同步更新 rk_record
|
||||||
|
rkRecordMapper.updateDw(
|
||||||
|
gysJh.getSapNo(),
|
||||||
|
gysJh.getWlNo(),
|
||||||
|
gysJh.getXmNo(),
|
||||||
|
gysJh.getDw()
|
||||||
|
);
|
||||||
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
throw new RuntimeException("入库明细不能为空");
|
throw new RuntimeException("入库明细不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
String billNo = BillNoUtil.generateTodayBillNo("RK", null);
|
String billNo = BillNoUtil.generateTodayBillNo("RK", rkInfoMapper);
|
||||||
Date now = DateUtils.getNowDate();
|
Date now = DateUtils.getNowDate();
|
||||||
String userId = String.valueOf(SecurityUtils.getUserId());
|
String userId = String.valueOf(SecurityUtils.getUserId());
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
for (RkInfo info : rkInfoList) {
|
for (RkInfo info : rkInfoList) {
|
||||||
|
|
||||||
info.setExecStatus(bill.getExecStatus());
|
info.setExecStatus(bill.getExecStatus());
|
||||||
|
String scene = "";
|
||||||
// 库位校验
|
// 库位校验
|
||||||
if (StringUtils.isNotBlank(info.getPcode())) {
|
if (StringUtils.isNotBlank(info.getPcode())) {
|
||||||
PcdeDetail pcde = pcdeDetailMapper.selectByPcodeAndWarehouse(
|
PcdeDetail pcde = pcdeDetailMapper.selectByPcodeAndWarehouse(
|
||||||
@@ -144,6 +144,9 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
throw new RuntimeException("库位不存在:" + info.getPcode());
|
throw new RuntimeException("库位不存在:" + info.getPcode());
|
||||||
}
|
}
|
||||||
info.setPcodeId(pcde.getEncodedId());
|
info.setPcodeId(pcde.getEncodedId());
|
||||||
|
if(StringUtils.isNotBlank(pcde.getScene())){
|
||||||
|
scene = pcde.getScene();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// rk_info
|
// rk_info
|
||||||
@@ -159,7 +162,7 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
info.setHasMoved("0");
|
info.setHasMoved("0");
|
||||||
info.setIsBorrowed("0");
|
info.setIsBorrowed("0");
|
||||||
info.setIsDelete("0");
|
info.setIsDelete("0");
|
||||||
|
info.setScene(scene);
|
||||||
info.setCreateTime(now);
|
info.setCreateTime(now);
|
||||||
info.setCreateBy(userId);
|
info.setCreateBy(userId);
|
||||||
|
|
||||||
@@ -372,6 +375,7 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
}
|
}
|
||||||
|
|
||||||
info.setPcodeId(pcde.getEncodedId());
|
info.setPcodeId(pcde.getEncodedId());
|
||||||
|
info.setScene(pcde.getScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 5.2 继承主单字段 */
|
/* 5.2 继承主单字段 */
|
||||||
@@ -438,11 +442,35 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateRkBill(RkBill rkBill)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
{
|
public int updateRkBill(RkBill rkBill) {
|
||||||
return rkBillMapper.updateRkBill(rkBill);
|
|
||||||
|
if (rkBill == null || StringUtils.isBlank(rkBill.getBillNo())) {
|
||||||
|
throw new ServiceException("单据号不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ====================== 1. 更新主单 rk_bill ======================
|
||||||
|
int rows = rkBillMapper.updateRkBill(rkBill);
|
||||||
|
|
||||||
|
// ====================== 2. 同步更新对应 record 明细 ======================
|
||||||
|
RkRecord updateRecord = new RkRecord();
|
||||||
|
|
||||||
|
// 以 billNo 为条件
|
||||||
|
updateRecord.setBillNo(rkBill.getBillNo());
|
||||||
|
|
||||||
|
// ---- 需要同步的关键字段 ----
|
||||||
|
updateRecord.setOperationType(rkBill.getOperationType());
|
||||||
|
updateRecord.setTeamCode(rkBill.getTeamCode());
|
||||||
|
updateRecord.setOperator(rkBill.getOperator());
|
||||||
|
updateRecord.setIsDelivery(rkBill.getIsDelivery());
|
||||||
|
|
||||||
|
// 执行批量更新
|
||||||
|
rkRecordMapper.updateRecordByBillNo(updateRecord);
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除库存单据
|
* 批量删除库存单据
|
||||||
*
|
*
|
||||||
@@ -514,7 +542,7 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
throw new RuntimeException("出库明细不能为空");
|
throw new RuntimeException("出库明细不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
String billNo = BillNoUtil.generateTodayBillNo("CK", null);
|
String billNo = BillNoUtil.generateTodayBillNo("CK", rkInfoMapper);
|
||||||
Date now = DateUtils.getNowDate();
|
Date now = DateUtils.getNowDate();
|
||||||
String userId = String.valueOf(SecurityUtils.getUserId());
|
String userId = String.valueOf(SecurityUtils.getUserId());
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.zg.project.inventory.AutoInventory.mapper.InventoryMatchScanMapper;
|
|||||||
import com.zg.project.inventory.Task.mapper.InventoryTaskMapper;
|
import com.zg.project.inventory.Task.mapper.InventoryTaskMapper;
|
||||||
import com.zg.project.inventory.domain.dto.QueryDTO;
|
import com.zg.project.inventory.domain.dto.QueryDTO;
|
||||||
import com.zg.project.inventory.domain.entity.InventoryMatchScan;
|
import com.zg.project.inventory.domain.entity.InventoryMatchScan;
|
||||||
|
import com.zg.project.inventory.domain.entity.InventoryTask;
|
||||||
import com.zg.project.inventory.domain.vo.ChartDataVO;
|
import com.zg.project.inventory.domain.vo.ChartDataVO;
|
||||||
import com.zg.project.inventory.domain.vo.PcdeCntVO;
|
import com.zg.project.inventory.domain.vo.PcdeCntVO;
|
||||||
import com.zg.project.wisdom.domain.vo.StockStatisticVO;
|
import com.zg.project.wisdom.domain.vo.StockStatisticVO;
|
||||||
@@ -234,6 +235,79 @@ public class RkInfoServiceImpl implements IRkInfoService
|
|||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void matchPure(QueryDTO dto) {
|
||||||
|
|
||||||
|
/* ================== 1. 取任务信息 ================== */
|
||||||
|
|
||||||
|
String taskId = dto.getTaskId();
|
||||||
|
InventoryTask task = taskMapper.selectInventoryTaskById(Long.valueOf(taskId));
|
||||||
|
|
||||||
|
if (task == null) {
|
||||||
|
throw new ServiceException("任务不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
String sceneId = task.getSceneId();
|
||||||
|
String warehouseCode = task.getWarehouseCode();
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(sceneId)) {
|
||||||
|
throw new ServiceException("缺少场景ID");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(warehouseCode)) {
|
||||||
|
throw new ServiceException("缺少仓库信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
int scanType = dto.getScanType() != null ? dto.getScanType() : 0;
|
||||||
|
String deviceId = dto.getDeviceId();
|
||||||
|
|
||||||
|
if (scanType == 1 && StringUtils.isBlank(deviceId)) {
|
||||||
|
throw new ServiceException("自动盘点必须传递设备ID");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =====================================================
|
||||||
|
* 2. 🚀 核心逻辑(你要求的口径)
|
||||||
|
* → 只查 rk_info
|
||||||
|
* → 不再做任何 pcodeId 匹配
|
||||||
|
* ===================================================== */
|
||||||
|
|
||||||
|
List<RkInfo> normalAll =
|
||||||
|
rkInfoMapper.getByWarehouseAndScene(warehouseCode, sceneId);
|
||||||
|
|
||||||
|
/* 全部视为正常 */
|
||||||
|
String tmeStr =
|
||||||
|
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||||
|
|
||||||
|
List<InventoryMatchScan> toSave = new ArrayList<>();
|
||||||
|
|
||||||
|
for (RkInfo r : normalAll) {
|
||||||
|
|
||||||
|
InventoryMatchScan scan = new InventoryMatchScan();
|
||||||
|
|
||||||
|
scan.setTaskId(taskId);
|
||||||
|
scan.setPcode(r.getPcode());
|
||||||
|
|
||||||
|
// 全部都是正常
|
||||||
|
scan.setStatus("0");
|
||||||
|
|
||||||
|
scan.setDeviceId(deviceId);
|
||||||
|
scan.setTme(tmeStr);
|
||||||
|
scan.setScanType(scanType);
|
||||||
|
|
||||||
|
toSave.add(scan);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 批量写入 */
|
||||||
|
if (!toSave.isEmpty()) {
|
||||||
|
matchScanMapper.insertBatch(toSave);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================== 5. 完成任务 ================== */
|
||||||
|
|
||||||
|
taskMapper.updateStatus(taskId, "1");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图表统计:每个库位有多少个货物
|
* 图表统计:每个库位有多少个货物
|
||||||
* @param dto
|
* @param dto
|
||||||
@@ -276,4 +350,15 @@ public class RkInfoServiceImpl implements IRkInfoService
|
|||||||
{
|
{
|
||||||
return rkInfoMapper.selectRkInfoListOrderByBillNo(rkInfo);
|
return rkInfoMapper.selectRkInfoListOrderByBillNo(rkInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RkInfo> listRkInfoByPcodes(ArrayList<String> strings) {
|
||||||
|
return rkInfoMapper.listRkInfoByPcodes(strings);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int countByWarehouseAndScene(String warehouseCode, String sceneId)
|
||||||
|
{
|
||||||
|
return rkInfoMapper.countByWarehouseAndScene(warehouseCode, sceneId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import java.util.stream.Collectors;
|
|||||||
import com.zg.common.exception.ServiceException;
|
import com.zg.common.exception.ServiceException;
|
||||||
import com.zg.common.utils.DateUtils;
|
import com.zg.common.utils.DateUtils;
|
||||||
import com.zg.common.utils.StringUtils;
|
import com.zg.common.utils.StringUtils;
|
||||||
|
import com.zg.project.information.domain.PcdeDetail;
|
||||||
|
import com.zg.project.information.mapper.PcdeDetailMapper;
|
||||||
import com.zg.project.wisdom.domain.GysJh;
|
import com.zg.project.wisdom.domain.GysJh;
|
||||||
import com.zg.project.wisdom.domain.RkInfo;
|
import com.zg.project.wisdom.domain.RkInfo;
|
||||||
import com.zg.project.wisdom.domain.vo.RecordStatisticVO;
|
import com.zg.project.wisdom.domain.vo.RecordStatisticVO;
|
||||||
@@ -43,6 +45,8 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private GysJhMapper gysJhMapper;
|
private GysJhMapper gysJhMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PcdeDetailMapper pcdeDetailMapper;
|
||||||
/**
|
/**
|
||||||
* 查询出入库记录
|
* 查询出入库记录
|
||||||
*
|
*
|
||||||
@@ -199,6 +203,22 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- 同步库存(明确字段,禁止 BeanUtils) ---------- */
|
/* ---------- 同步库存(明确字段,禁止 BeanUtils) ---------- */
|
||||||
|
String scene = "";
|
||||||
|
// 库位校验
|
||||||
|
if (StringUtils.isNotBlank(info.getPcode())) {
|
||||||
|
PcdeDetail pcde = pcdeDetailMapper.selectByPcodeAndWarehouse(
|
||||||
|
rkRecord.getPcode(),
|
||||||
|
rkRecord.getCangku()
|
||||||
|
);
|
||||||
|
if (pcde == null) {
|
||||||
|
throw new RuntimeException("库位不存在:" + info.getPcode());
|
||||||
|
}
|
||||||
|
info.setPcodeId(pcde.getEncodedId());
|
||||||
|
if(StringUtils.isNotBlank(pcde.getScene())){
|
||||||
|
scene = pcde.getScene();
|
||||||
|
info.setScene(scene);
|
||||||
|
}
|
||||||
|
}
|
||||||
info.setRealQty(newInQty);
|
info.setRealQty(newInQty);
|
||||||
info.setWlNo(rkRecord.getWlNo());
|
info.setWlNo(rkRecord.getWlNo());
|
||||||
info.setWlMs(rkRecord.getWlMs());
|
info.setWlMs(rkRecord.getWlMs());
|
||||||
@@ -210,6 +230,7 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
info.setHtDj(rkRecord.getHtDj());
|
info.setHtDj(rkRecord.getHtDj());
|
||||||
info.setCangku(rkRecord.getCangku());
|
info.setCangku(rkRecord.getCangku());
|
||||||
info.setPcode(rkRecord.getPcode());
|
info.setPcode(rkRecord.getPcode());
|
||||||
|
info.setRemark(rkRecord.getRemark());
|
||||||
info.setIsChuku("0");
|
info.setIsChuku("0");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,6 +267,7 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
info.setHtDj(rkRecord.getHtDj());
|
info.setHtDj(rkRecord.getHtDj());
|
||||||
info.setCangku(rkRecord.getCangku());
|
info.setCangku(rkRecord.getCangku());
|
||||||
info.setPcode(rkRecord.getPcode());
|
info.setPcode(rkRecord.getPcode());
|
||||||
|
info.setRemark(rkRecord.getRemark());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ====================== 4. 更新库存表 ====================== */
|
/* ====================== 4. 更新库存表 ====================== */
|
||||||
@@ -804,35 +826,57 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int updateDeliveryStatus(List<Long> ids, Integer isDelivery) {
|
public int updateDeliveryStatus(List<Long> ids, Integer isDelivery)
|
||||||
|
{
|
||||||
if (ids == null || ids.isEmpty()) {
|
if (ids == null || ids.isEmpty()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. 先更新 record
|
// ===============================
|
||||||
int rows = rkRecordMapper.updateDeliveryStatus(ids, isDelivery);
|
// 1. 更新 record 状态
|
||||||
|
// ===============================
|
||||||
|
int rows =
|
||||||
|
rkRecordMapper.updateDeliveryStatus(ids, isDelivery);
|
||||||
|
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// 2. 查询受影响 billNo
|
||||||
|
// ===============================
|
||||||
|
List<String> billNos =
|
||||||
|
rkRecordMapper.selectBillNosByRecordIds(ids);
|
||||||
|
|
||||||
// 2. 找到受影响的 billNo
|
|
||||||
List<String> billNos = rkRecordMapper.selectBillNosByRecordIds(ids);
|
|
||||||
if (billNos == null || billNos.isEmpty()) {
|
if (billNos == null || billNos.isEmpty()) {
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 对每个 bill 判断是否可以更新
|
|
||||||
for (String billNo : billNos) {
|
|
||||||
|
|
||||||
// 3.1 查询该 bill 下是否还存在“不同状态”的 record
|
// ===============================
|
||||||
int diffCount = rkRecordMapper.countDifferentDeliveryStatus(billNo, isDelivery);
|
// 3. 更新 bill 状态
|
||||||
|
// 规则:
|
||||||
|
//
|
||||||
|
// bill状态 = MIN(record.is_delivery)
|
||||||
|
//
|
||||||
|
// 示例:
|
||||||
|
//
|
||||||
|
// 2,4,4 → 2
|
||||||
|
// 3,4 → 3
|
||||||
|
// 4,4 → 4
|
||||||
|
//
|
||||||
|
// ===============================
|
||||||
|
for (String billNo : billNos)
|
||||||
|
{
|
||||||
|
Integer billStatus =
|
||||||
|
rkRecordMapper.selectMinDeliveryStatusByBillNo(billNo);
|
||||||
|
|
||||||
// 只有“全部一致”时才改 bill
|
if (billStatus != null)
|
||||||
if (diffCount == 0) {
|
{
|
||||||
rkBillMapper.updateDeliveryStatusByBillNo(billNo, isDelivery);
|
rkBillMapper.updateDeliveryStatusByBillNo(
|
||||||
|
billNo,
|
||||||
|
billStatus
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// 否则:保持原状态(不动)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zg.project.wisdom.utils;
|
package com.zg.project.wisdom.utils;
|
||||||
|
|
||||||
import com.zg.project.wisdom.mapper.RkInfoMapper;
|
import com.zg.project.wisdom.mapper.RkInfoMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -22,6 +23,8 @@ public class BillNoUtil {
|
|||||||
|
|
||||||
private static final String DEFAULT_PREFIX = "RK";
|
private static final String DEFAULT_PREFIX = "RK";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成单据号(短号,不查数据库)
|
* 生成单据号(短号,不查数据库)
|
||||||
* 格式:PREFIX + yyMMdd + HHmmss + 2位随机数
|
* 格式:PREFIX + yyMMdd + HHmmss + 2位随机数
|
||||||
@@ -32,20 +35,25 @@ public class BillNoUtil {
|
|||||||
*/
|
*/
|
||||||
public static synchronized String generateTodayBillNo(String prefix, RkInfoMapper rkInfoMapper) {
|
public static synchronized String generateTodayBillNo(String prefix, RkInfoMapper rkInfoMapper) {
|
||||||
|
|
||||||
// 前缀处理
|
// 日期 yyMMdd
|
||||||
final String p = (prefix == null || prefix.trim().isEmpty())
|
String date = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||||
? DEFAULT_PREFIX
|
|
||||||
: prefix.trim().toUpperCase();
|
|
||||||
|
|
||||||
// 时间到秒:yyMMddHHmmss(12位)
|
// 查询今日最大单号
|
||||||
String time = new SimpleDateFormat("yyMMddHHmmss").format(new Date());
|
String maxBillNo = rkInfoMapper.selectTodayMaxBillNo(prefix, date);
|
||||||
|
|
||||||
// 2位随机数:10~99(避免同一秒内多次点击撞号)
|
int seq = 1;
|
||||||
int rnd = ThreadLocalRandom.current().nextInt(10, 100);
|
|
||||||
|
|
||||||
return p + time + rnd;
|
if (maxBillNo != null && maxBillNo.length() > 8) {
|
||||||
|
// 取最后8位流水号
|
||||||
|
String seqStr = maxBillNo.substring(prefix.length() + date.length());
|
||||||
|
seq = Integer.parseInt(seqStr) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 8位补零
|
||||||
|
String seqFormat = String.format("%08d", seq);
|
||||||
|
|
||||||
|
return prefix + date + seqFormat;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 需要更短的版本(可选)
|
* 需要更短的版本(可选)
|
||||||
* 格式:PREFIX + yyMMdd + 4位随机数
|
* 格式:PREFIX + yyMMdd + 4位随机数
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ spring:
|
|||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 0
|
database: 0
|
||||||
# 密码
|
# 密码
|
||||||
|
# password: shzg
|
||||||
password:
|
password:
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
|
|||||||
@@ -273,4 +273,17 @@
|
|||||||
ORDER BY MAX(r.create_time) DESC
|
ORDER BY MAX(r.create_time) DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUnscanFromMatchScan"
|
||||||
|
resultType="com.zg.project.inventory.domain.vo.RkInfoMatchVO">
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
pcode AS rkPcode,
|
||||||
|
0 AS realQty,
|
||||||
|
status
|
||||||
|
FROM inventory_match_scan
|
||||||
|
WHERE task_id = #{taskId}
|
||||||
|
AND status = '1'
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -66,13 +66,19 @@
|
|||||||
<result property="fycde1" column="fycde_1"/>
|
<result property="fycde1" column="fycde_1"/>
|
||||||
<result property="fycde2" column="fycde_2"/>
|
<result property="fycde2" column="fycde_2"/>
|
||||||
<result property="isUpdate" column="is_update"/>
|
<result property="isUpdate" column="is_update"/>
|
||||||
|
<result property="scene" column="scene"/>
|
||||||
|
<result property="sceneName" column="sceneName"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- ========================= 公共查询 SQL(联表完整版) ========================= -->
|
<!-- ========================= 公共查询 SQL(联表完整版) ========================= -->
|
||||||
<sql id="selectRkInfoVo">
|
<sql id="selectRkInfoVo">
|
||||||
SELECT
|
SELECT
|
||||||
ri.*,
|
ri.*,
|
||||||
|
CASE
|
||||||
|
WHEN ri.scene = 'HJ' THEN '货架'
|
||||||
|
WHEN ri.scene = 'DC' THEN '堆场'
|
||||||
|
ELSE ri.scene
|
||||||
|
END AS sceneName,
|
||||||
/* ===== 新增:计算总金额 ===== */
|
/* ===== 新增:计算总金额 ===== */
|
||||||
ri.real_qty * ri.ht_dj AS total_amount,
|
ri.real_qty * ri.ht_dj AS total_amount,
|
||||||
|
|
||||||
@@ -101,53 +107,75 @@
|
|||||||
ri.exec_status = 1
|
ri.exec_status = 1
|
||||||
AND ri.is_chuku = 0
|
AND ri.is_chuku = 0
|
||||||
AND ri.is_delete = 0
|
AND ri.is_delete = 0
|
||||||
|
|
||||||
<if test="operationType != null and operationType != ''">
|
<if test="operationType != null and operationType != ''">
|
||||||
AND ri.operation_type LIKE CONCAT('%', #{operationType}, '%')
|
AND ri.operation_type LIKE CONCAT('%', #{operationType}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="sapNo != null and sapNo != ''">
|
<if test="sapNo != null and sapNo != ''">
|
||||||
AND ri.sap_no LIKE CONCAT('%', #{sapNo}, '%')
|
AND ri.sap_no LIKE CONCAT('%', #{sapNo}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="xmNo != null and xmNo != ''">
|
<if test="xmNo != null and xmNo != ''">
|
||||||
AND ri.xm_no LIKE CONCAT('%', #{xmNo}, '%')
|
AND ri.xm_no LIKE CONCAT('%', #{xmNo}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="xmMs != null and xmMs != ''">
|
<if test="xmMs != null and xmMs != ''">
|
||||||
AND ri.xm_ms LIKE CONCAT('%', #{xmMs}, '%')
|
AND ri.xm_ms LIKE CONCAT('%', #{xmMs}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="wlNo != null and wlNo != ''">
|
<if test="wlNo != null and wlNo != ''">
|
||||||
AND ri.wl_no LIKE CONCAT('%', #{wlNo}, '%')
|
AND ri.wl_no LIKE CONCAT('%', #{wlNo}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="wlMs != null and wlMs != ''">
|
<if test="wlMs != null and wlMs != ''">
|
||||||
AND ri.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
|
AND ri.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="gysMc != null and gysMc != ''">
|
<if test="gysMc != null and gysMc != ''">
|
||||||
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
|
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="pcode != null and pcode != ''">
|
<if test="pcode != null and pcode != ''">
|
||||||
AND ri.pcode LIKE CONCAT('%', #{pcode}, '%')
|
AND ri.pcode LIKE CONCAT('%', #{pcode}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="bizType != null and bizType != ''">
|
<if test="bizType != null and bizType != ''">
|
||||||
AND ri.biz_type LIKE CONCAT('%', #{bizType}, '%')
|
AND ri.biz_type LIKE CONCAT('%', #{bizType}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="wlType != null and wlType != ''">
|
<if test="wlType != null and wlType != ''">
|
||||||
AND ri.wl_type LIKE CONCAT('%', #{wlType}, '%')
|
AND ri.wl_type LIKE CONCAT('%', #{wlType}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="cangku != null and cangku != ''">
|
<if test="cangku != null and cangku != ''">
|
||||||
AND ri.cangku LIKE CONCAT('%', #{cangku}, '%')
|
AND ri.cangku LIKE CONCAT('%', #{cangku}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="billNo != null and billNo != ''">
|
<if test="billNo != null and billNo != ''">
|
||||||
AND ri.bill_no LIKE CONCAT('%', #{billNo}, '%')
|
AND ri.bill_no LIKE CONCAT('%', #{billNo}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
<!-- ★★★ 新增:按备注模糊搜索 ★★★ -->
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
AND ri.remark LIKE CONCAT('%', #{remark}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="scene != null and scene != ''">
|
||||||
|
AND ri.scene LIKE CONCAT('%', #{scene}, '%')
|
||||||
|
</if>
|
||||||
<if test="isDelete != null and isDelete != ''">
|
<if test="isDelete != null and isDelete != ''">
|
||||||
AND ri.is_delete = #{isDelete}
|
AND ri.is_delete = #{isDelete}
|
||||||
</if>
|
</if>
|
||||||
<!-- 出入库时间范围 -->
|
|
||||||
<if test="startDate != null">
|
<if test="startDate != null">
|
||||||
AND ri.operation_time >= #{startDate}
|
AND ri.operation_time >= #{startDate}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="endDate != null">
|
<if test="endDate != null">
|
||||||
AND ri.operation_time <= #{endDate}
|
AND ri.operation_time <= #{endDate}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|
||||||
ORDER BY ri.operation_time DESC
|
ORDER BY ri.operation_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -220,6 +248,9 @@
|
|||||||
<if test="wlMs != null and wlMs != ''">
|
<if test="wlMs != null and wlMs != ''">
|
||||||
AND ri.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
|
AND ri.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="scene != null and scene != ''">
|
||||||
|
AND ri.scene LIKE CONCAT('%', #{scene}, '%')
|
||||||
|
</if>
|
||||||
<if test="gysMc != null and gysMc != ''">
|
<if test="gysMc != null and gysMc != ''">
|
||||||
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
|
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
|
||||||
</if>
|
</if>
|
||||||
@@ -278,7 +309,7 @@
|
|||||||
is_delivery,
|
is_delivery,
|
||||||
fycde_1, fycde_2,
|
fycde_1, fycde_2,
|
||||||
is_update,
|
is_update,
|
||||||
create_by, create_time, is_delete
|
create_by, create_time, is_delete,scene
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
#{operationType}, #{bizType}, #{wlType}, #{cangku}, #{operationTime}, #{operator},
|
#{operationType}, #{bizType}, #{wlType}, #{cangku}, #{operationTime}, #{operator},
|
||||||
@@ -296,7 +327,7 @@
|
|||||||
#{isDelivery},
|
#{isDelivery},
|
||||||
#{fycde1}, #{fycde2},
|
#{fycde1}, #{fycde2},
|
||||||
#{isUpdate},
|
#{isUpdate},
|
||||||
#{createBy}, #{createTime}, #{isDelete}
|
#{createBy}, #{createTime}, #{isDelete},#{scene}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -352,6 +383,7 @@
|
|||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||||
|
<if test="scene != null">scene = #{scene}</if>
|
||||||
</trim>
|
</trim>
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@@ -571,4 +603,78 @@
|
|||||||
ri.sap_no ASC
|
ri.sap_no ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getByWarehouseAndScene" resultMap="RkInfoResult">
|
||||||
|
SELECT
|
||||||
|
ri.*,
|
||||||
|
CASE
|
||||||
|
WHEN pd.scene = 'HJ' THEN '货架'
|
||||||
|
WHEN pd.scene = 'DC' THEN '堆场'
|
||||||
|
ELSE pd.scene
|
||||||
|
END AS sceneName,
|
||||||
|
sit.type_name AS operationTypeName,
|
||||||
|
/* ===== 新增:计算总金额 ===== */
|
||||||
|
ri.real_qty * ri.ht_dj AS total_amount,
|
||||||
|
|
||||||
|
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
|
||||||
|
mt.type_name AS wl_type_name,
|
||||||
|
|
||||||
|
wh.warehouse_name,
|
||||||
|
wh.parent_warehouse_code,
|
||||||
|
wh.parent_warehouse_name,
|
||||||
|
|
||||||
|
su.nick_name AS operator_name,
|
||||||
|
|
||||||
|
DATEDIFF(CURRENT_DATE, ri.operation_time) AS stock_age
|
||||||
|
|
||||||
|
FROM rk_info ri
|
||||||
|
LEFT JOIN stock_in_type sit ON ri.operation_type = sit.type_code
|
||||||
|
LEFT JOIN stock_out_type sot ON ri.operation_type = sot.type_code
|
||||||
|
LEFT JOIN material_type mt ON ri.wl_type = mt.type_code
|
||||||
|
LEFT JOIN warehouse_info wh ON ri.cangku = wh.warehouse_code
|
||||||
|
LEFT JOIN sys_user su ON ri.operator = su.user_id
|
||||||
|
LEFT JOIN pcde_detail pd ON pd.pcode = ri.pcode
|
||||||
|
WHERE ri.exec_status = 1
|
||||||
|
AND ri.is_delete = '0'
|
||||||
|
AND ri.is_chuku = '0'
|
||||||
|
AND ri.cangku = #{warehouseCode}
|
||||||
|
AND ri.scene = #{sceneId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listRkInfoByPcodes"
|
||||||
|
resultMap="RkInfoResult"
|
||||||
|
parameterType="java.util.ArrayList">
|
||||||
|
SELECT *
|
||||||
|
FROM rk_info
|
||||||
|
WHERE is_delete = 0
|
||||||
|
AND is_chuku = 0
|
||||||
|
AND pcode IN
|
||||||
|
<foreach collection="list" item="p" open="(" separator="," close=")">
|
||||||
|
#{p}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTodayMaxBillNo" resultType="java.lang.String">
|
||||||
|
SELECT MAX(bill_no)
|
||||||
|
FROM rk_record
|
||||||
|
WHERE bill_no LIKE CONCAT(#{prefix}, #{date}, '%')
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateDw">
|
||||||
|
UPDATE rk_info
|
||||||
|
SET dw = #{dw}
|
||||||
|
WHERE sap_no = #{sapNo}
|
||||||
|
AND wl_no = #{wlNo}
|
||||||
|
AND xm_no = #{xmNo}
|
||||||
|
</update>
|
||||||
|
<select id="countByWarehouseAndScene" resultType="int">
|
||||||
|
SELECT COUNT(1)
|
||||||
|
FROM rk_info ri
|
||||||
|
WHERE ri.exec_status = 1
|
||||||
|
AND ri.is_delete = '0'
|
||||||
|
AND ri.is_chuku = '0'
|
||||||
|
AND ri.cangku = #{warehouseCode}
|
||||||
|
AND ri.scene = #{sceneId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -92,31 +92,35 @@
|
|||||||
<sql id="selectRkRecordVo">
|
<sql id="selectRkRecordVo">
|
||||||
SELECT
|
SELECT
|
||||||
rr.*,
|
rr.*,
|
||||||
|
COALESCE(rr.real_qty, 0) * COALESCE(rr.ht_dj, 0) AS total_amount,
|
||||||
/* ===== 新增:统一计算总金额 ===== */
|
|
||||||
rr.real_qty * rr.ht_dj AS total_amount,
|
|
||||||
|
|
||||||
su.nick_name AS operator_name,
|
su.nick_name AS operator_name,
|
||||||
mt.type_name AS wl_type_name,
|
mt.type_name AS wl_type_name,
|
||||||
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
|
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
|
||||||
|
|
||||||
-- 小仓
|
|
||||||
wh.warehouse_name AS warehouse_name,
|
wh.warehouse_name AS warehouse_name,
|
||||||
|
|
||||||
-- 大仓
|
|
||||||
wh.parent_warehouse_code AS parent_warehouse_code,
|
wh.parent_warehouse_code AS parent_warehouse_code,
|
||||||
wh.parent_warehouse_name AS parent_warehouse_name,
|
wh.parent_warehouse_name AS parent_warehouse_name,
|
||||||
|
ct.team_name AS team_name,
|
||||||
|
|
||||||
ct.team_name AS team_name
|
(
|
||||||
|
SELECT MIN(gj.id)
|
||||||
|
FROM gys_jh gj
|
||||||
|
WHERE gj.sap_no = rr.sap_no
|
||||||
|
AND gj.wl_no = rr.wl_no
|
||||||
|
AND gj.xm_no = rr.xm_no
|
||||||
|
AND gj.is_delete = '0'
|
||||||
|
) AS gys_jh_id
|
||||||
|
|
||||||
FROM rk_record rr
|
FROM rk_record rr
|
||||||
LEFT JOIN sys_user su ON rr.operator = su.user_id
|
LEFT JOIN sys_user su
|
||||||
LEFT JOIN material_type mt ON rr.wl_type = mt.type_code
|
ON rr.operator = su.user_id
|
||||||
LEFT JOIN stock_in_type sit ON rr.operation_type = sit.type_code
|
LEFT JOIN material_type mt
|
||||||
LEFT JOIN stock_out_type sot ON rr.operation_type = sot.type_code
|
ON rr.wl_type = mt.type_code
|
||||||
|
LEFT JOIN stock_in_type sit
|
||||||
LEFT JOIN warehouse_info wh ON rr.cangku = wh.warehouse_code
|
ON rr.operation_type = sit.type_code
|
||||||
|
LEFT JOIN stock_out_type sot
|
||||||
|
ON rr.operation_type = sot.type_code
|
||||||
|
LEFT JOIN warehouse_info wh
|
||||||
|
ON rr.cangku = wh.warehouse_code
|
||||||
LEFT JOIN construction_team ct
|
LEFT JOIN construction_team ct
|
||||||
ON rr.team_code = ct.team_code
|
ON rr.team_code = ct.team_code
|
||||||
AND ct.is_delete = '0'
|
AND ct.is_delete = '0'
|
||||||
@@ -282,7 +286,11 @@
|
|||||||
<include refid="selectRkRecordVo"/>
|
<include refid="selectRkRecordVo"/>
|
||||||
WHERE rr.bill_no = #{billNo}
|
WHERE rr.bill_no = #{billNo}
|
||||||
AND (rr.is_delete = '0' OR rr.is_delete = 0 OR rr.is_delete IS NULL)
|
AND (rr.is_delete = '0' OR rr.is_delete = 0 OR rr.is_delete IS NULL)
|
||||||
ORDER BY rr.exec_status = '0' DESC, rr.operation_time DESC
|
|
||||||
|
ORDER BY
|
||||||
|
rr.exec_status = '0' DESC,
|
||||||
|
rr.create_time ASC,
|
||||||
|
gys_jh_id ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectRkRecordByIds" resultMap="RkRecordResult">
|
<select id="selectRkRecordByIds" resultMap="RkRecordResult">
|
||||||
@@ -598,37 +606,141 @@
|
|||||||
IFNULL(SUM(rr.real_qty), 0) AS totalQuantity
|
IFNULL(SUM(rr.real_qty), 0) AS totalQuantity
|
||||||
FROM rk_record rr
|
FROM rk_record rr
|
||||||
<where>
|
<where>
|
||||||
rr.is_delete = 0
|
|
||||||
AND rr.exec_status = 1
|
|
||||||
|
|
||||||
<!-- 已修复:String 不可用 size() -->
|
AND rr.exec_status = '1'
|
||||||
|
|
||||||
<if test="operationType != null and operationType != ''">
|
<if test="operationType != null and operationType != ''">
|
||||||
AND rr.operation_type = #{operationType}
|
AND rr.operation_type = #{operationType}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="xmNo != null and xmNo != ''">
|
<!-- 多 bizType -->
|
||||||
AND rr.xm_no LIKE CONCAT('%', #{xmNo}, '%')
|
<if test="bizTypeList != null and bizTypeList.size > 0">
|
||||||
|
AND rr.biz_type IN
|
||||||
|
<foreach collection="bizTypeList"
|
||||||
|
item="bt"
|
||||||
|
open="("
|
||||||
|
separator=","
|
||||||
|
close=")">
|
||||||
|
#{bt}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="wlNo != null and wlNo != ''">
|
<if test="bizType != null and bizType != ''">
|
||||||
AND rr.wl_no LIKE CONCAT('%', #{wlNo}, '%')
|
AND rr.biz_type = #{bizType}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="pcode != null and pcode != ''">
|
<if test="pcode != null and pcode != ''">
|
||||||
AND rr.pcode LIKE CONCAT('%', #{pcode}, '%')
|
AND rr.pcode = #{pcode}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="wlType != null and wlType != ''">
|
||||||
|
AND rr.wl_type = #{wlType}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="cangku != null and cangku != ''">
|
<if test="cangku != null and cangku != ''">
|
||||||
AND rr.cangku LIKE CONCAT('%', #{cangku}, '%')
|
AND rr.cangku = #{cangku}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
<if test="operator != null and operator != ''">
|
||||||
|
AND rr.operator = #{operator}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="isChuku != null and isChuku != ''">
|
||||||
|
AND rr.is_chuku = #{isChuku}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
AND rr.status = #{status}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="execStatus != null and execStatus != ''">
|
||||||
|
AND rr.exec_status = #{execStatus}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="billNo != null and billNo != ''">
|
||||||
|
AND rr.bill_no = #{billNo}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="isDelivery != null and isDelivery != ''">
|
||||||
|
AND rr.is_delivery = #{isDelivery}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 项目 -->
|
||||||
|
<if test="xmNo != null and xmNo != ''">
|
||||||
|
AND rr.xm_no LIKE concat('%', #{xmNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="xmMs != null and xmMs != ''">
|
||||||
|
AND rr.xm_ms LIKE concat('%', #{xmMs}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 订单 -->
|
||||||
|
<if test="sapNo != null and sapNo != ''">
|
||||||
|
AND rr.sap_no LIKE concat('%', #{sapNo}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 供应商 -->
|
||||||
|
<if test="gysMc != null and gysMc != ''">
|
||||||
|
AND rr.gys_mc LIKE concat('%', #{gysMc}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="wlNo != null and wlNo != ''">
|
||||||
|
AND rr.wl_no LIKE concat('%', #{wlNo}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="wlMs != null and wlMs != ''">
|
||||||
|
AND rr.wl_ms LIKE concat('%', #{wlMs}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 是否借料 -->
|
||||||
|
<if test="isBorrowed != null and isBorrowed != ''">
|
||||||
|
AND rr.is_borrowed = #{isBorrowed}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 删除标识 -->
|
||||||
|
<if test="isDelete == null">
|
||||||
|
AND (rr.is_delete = '0' OR rr.is_delete = 0 OR rr.is_delete IS NULL)
|
||||||
|
</if>
|
||||||
|
<if test="isDelete != null and isDelete != ''">
|
||||||
|
AND rr.is_delete = #{isDelete}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- ================= 时间条件(最终正确版) ================= -->
|
||||||
|
<if test="startDate != null or endDate != null">
|
||||||
|
AND (
|
||||||
|
<!-- 普通入库 / 出库:精确到时分秒 -->
|
||||||
|
(
|
||||||
|
rr.biz_type IN ('0','1')
|
||||||
<if test="startDate != null">
|
<if test="startDate != null">
|
||||||
AND rr.operation_time >= #{startDate}
|
AND rr.operation_time >= #{startDate}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="endDate != null">
|
<if test="endDate != null">
|
||||||
AND rr.operation_time <= #{endDate}
|
AND rr.operation_time <= #{endDate}
|
||||||
</if>
|
</if>
|
||||||
|
)
|
||||||
|
OR
|
||||||
|
<!-- 借料出库:按 borrow_time(按天) -->
|
||||||
|
(
|
||||||
|
rr.biz_type = '2'
|
||||||
|
<if test="startDate != null">
|
||||||
|
AND rr.borrow_time >= DATE(#{startDate})
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null">
|
||||||
|
AND rr.borrow_time < DATE_ADD(DATE(#{endDate}), INTERVAL 1 DAY)
|
||||||
|
</if>
|
||||||
|
)
|
||||||
|
OR
|
||||||
|
<!-- 还料入库:按 return_time(按天) -->
|
||||||
|
(
|
||||||
|
rr.biz_type = '3'
|
||||||
|
<if test="startDate != null">
|
||||||
|
AND rr.return_time >= DATE(#{startDate})
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null">
|
||||||
|
AND rr.return_time < DATE_ADD(DATE(#{endDate}), INTERVAL 1 DAY)
|
||||||
|
</if>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -788,4 +900,51 @@
|
|||||||
AND is_delivery != #{isDelivery}
|
AND is_delivery != #{isDelivery}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询bill最小配送状态 -->
|
||||||
|
<select id="selectMinDeliveryStatusByBillNo"
|
||||||
|
resultType="int">
|
||||||
|
|
||||||
|
SELECT MIN(is_delivery)
|
||||||
|
FROM rk_record
|
||||||
|
WHERE bill_no = #{billNo}
|
||||||
|
AND is_delete = '0'
|
||||||
|
AND is_delivery >= 2
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateRecordByBillNo" parameterType="com.zg.project.wisdom.domain.RkRecord">
|
||||||
|
UPDATE rk_record
|
||||||
|
<set>
|
||||||
|
<if test="operationType != null">
|
||||||
|
operation_type = #{operationType},
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="teamCode != null">
|
||||||
|
team_code = #{teamCode},
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="operator != null">
|
||||||
|
operator = #{operator},
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="isDelivery != null">
|
||||||
|
is_delivery = #{isDelivery},
|
||||||
|
</if>
|
||||||
|
|
||||||
|
update_time = NOW()
|
||||||
|
</set>
|
||||||
|
|
||||||
|
WHERE bill_no = #{billNo}
|
||||||
|
AND is_delete = '0'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateDw">
|
||||||
|
UPDATE rk_record
|
||||||
|
SET dw = #{dw}
|
||||||
|
WHERE sap_no = #{sapNo}
|
||||||
|
AND wl_no = #{wlNo}
|
||||||
|
AND xm_no = #{xmNo}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -254,32 +254,45 @@
|
|||||||
<select id="selectWarehouseSlotStat"
|
<select id="selectWarehouseSlotStat"
|
||||||
resultType="com.zg.project.wisdom.domain.vo.WarehouseSlotStatVO">
|
resultType="com.zg.project.wisdom.domain.vo.WarehouseSlotStatVO">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
p.warehouse_code AS cangkuCode,
|
p.warehouse_code AS cangkuCode,
|
||||||
p.warehouse_name AS cangkuName,
|
p.warehouse_name AS cangkuName,
|
||||||
|
|
||||||
COUNT(DISTINCT p.pcode) AS totalSlot,
|
COUNT(p.pcode) AS totalSlot,
|
||||||
|
|
||||||
COUNT(DISTINCT CASE WHEN r.id IS NOT NULL THEN p.pcode END) AS usedSlot,
|
COUNT(u.pcode) AS usedSlot,
|
||||||
|
|
||||||
COUNT(DISTINCT p.pcode)
|
COUNT(p.pcode) - COUNT(u.pcode) AS unusedSlot
|
||||||
- COUNT(DISTINCT CASE WHEN r.id IS NOT NULL THEN p.pcode END) AS unusedSlot
|
|
||||||
|
|
||||||
FROM pcde_detail p
|
FROM pcde_detail p
|
||||||
LEFT JOIN rk_info r
|
|
||||||
ON r.pcode = p.pcode
|
LEFT JOIN (
|
||||||
AND r.cangku = p.warehouse_code
|
SELECT DISTINCT
|
||||||
AND r.is_delete = '0'
|
pcode,
|
||||||
AND r.is_chuku = '0'
|
cangku
|
||||||
|
FROM rk_info
|
||||||
|
WHERE is_delete = '0'
|
||||||
|
AND is_chuku = '0'
|
||||||
|
AND exec_status = '1'
|
||||||
|
) u
|
||||||
|
ON u.pcode = p.pcode
|
||||||
|
AND u.cangku = p.warehouse_code
|
||||||
|
|
||||||
WHERE p.is_delete = '0'
|
WHERE p.is_delete = '0'
|
||||||
AND p.warehouse_name IS NOT NULL
|
AND p.warehouse_name IS NOT NULL
|
||||||
AND TRIM(p.warehouse_name) <> ''
|
AND TRIM(p.warehouse_name) <> ''
|
||||||
|
|
||||||
GROUP BY p.warehouse_code, p.warehouse_name
|
GROUP BY
|
||||||
ORDER BY p.warehouse_code
|
p.warehouse_code,
|
||||||
|
p.warehouse_name
|
||||||
|
|
||||||
|
ORDER BY
|
||||||
|
p.warehouse_code
|
||||||
|
|
||||||
]]>
|
]]>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectStockAgeExport30"
|
<select id="selectStockAgeExport30"
|
||||||
resultType="com.zg.project.wisdom.domain.vo.StockAgeExportVO">
|
resultType="com.zg.project.wisdom.domain.vo.StockAgeExportVO">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|||||||
Reference in New Issue
Block a user