Compare commits
20 Commits
c362acece6
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ceaeb03ef | |||
| 8323ae3cd9 | |||
| 15a4053cab | |||
| a892cdd03d | |||
| ac45b0c79b | |||
| 0c23b61cbb | |||
| dbc2bada83 | |||
| 8f802a8738 | |||
| d29b336252 | |||
| 2183528894 | |||
| 367dd00008 | |||
| 54c9486a88 | |||
| 56e4514ee8 | |||
| b84fd1e046 | |||
| 7b4965ff7a | |||
| 219e23c194 | |||
| 8fa2c1c52d | |||
| 27a105b4f6 | |||
| 6ffafc81f4 | |||
| d141676788 |
@@ -1244,6 +1244,25 @@ public class ExcelUtil<T>
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ public class PcdeDetailController extends BaseController
|
||||
public TableDataInfo list(PcdeDetail pcdeDetail)
|
||||
{
|
||||
startPage();
|
||||
System.out.printf("111111");
|
||||
List<PcdeDetail> list = pcdeDetailService.selectPcdeDetailList(pcdeDetail);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@@ -68,6 +68,14 @@ public interface PcdeDetailMapper
|
||||
*/
|
||||
PcdeDetail selectByPcode(String pcode);
|
||||
|
||||
/**
|
||||
* 根据仓库编码和库位编码查询库位信息
|
||||
* @param pcode
|
||||
* @return
|
||||
*/
|
||||
PcdeDetail selectByPcodeAndWarehouse(@Param("pcode") String pcode,
|
||||
@Param("warehouseCode") String warehouseCode);
|
||||
|
||||
/**
|
||||
* 根据仓库编码查询库位编码
|
||||
* @param pcode
|
||||
|
||||
@@ -81,6 +81,24 @@ public class AutoInventoryController extends BaseController {
|
||||
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;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.zg.common.utils.StringUtils;
|
||||
import com.zg.common.utils.poi.ExcelUtil;
|
||||
import com.zg.framework.web.controller.BaseController;
|
||||
import com.zg.framework.web.domain.AjaxResult;
|
||||
import com.zg.framework.web.page.TableDataInfo;
|
||||
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.entity.InventoryMatchScan;
|
||||
import com.zg.project.inventory.domain.vo.InventoryMatchScanVO;
|
||||
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 org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
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;
|
||||
|
||||
@@ -25,7 +39,10 @@ public class InventoryMatchScanController extends BaseController {
|
||||
@Autowired
|
||||
private InventoryMatchScanService inventoryMatchScanService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IRkInfoService rkInfoService;
|
||||
@Autowired
|
||||
private RkInfoMapper rkInfoMapper;
|
||||
/**
|
||||
* 分页查询盘点结果
|
||||
* @param matchScan
|
||||
@@ -40,9 +57,63 @@ public class InventoryMatchScanController extends BaseController {
|
||||
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, InventoryMatchScan criteria) {
|
||||
List<InventoryMatchScan> list = inventoryMatchScanService.selectInventoryMatchScanList(criteria);
|
||||
ExcelUtil<InventoryMatchScan> util = new ExcelUtil<>(InventoryMatchScan.class);
|
||||
util.exportExcel(response, list, "盘点匹配结果");
|
||||
|
||||
// 1️⃣ 查盘点结果
|
||||
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,27 @@ public class InventoryMatchScanController extends BaseController {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,4 +33,11 @@ public interface InventoryMatchScanMapper {
|
||||
List<RkInfoMatchVO> selectOnlyFromMatchScan(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
|
||||
public List<RkInfoMatchVO> selectMatchScanCountList(InventoryMatchScan param) {
|
||||
// 状态=2:只查扫描表中的数据
|
||||
|
||||
// ========== 1. 已扫描异常 ==========
|
||||
if ("2".equals(param.getStatus())) {
|
||||
return mapper.selectOnlyFromMatchScan(param);
|
||||
}
|
||||
// 状态=1:查询指定仓库下未被扫描的库位
|
||||
|
||||
// ========== 2. ❗未扫到(你要的逻辑)==========
|
||||
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 {
|
||||
return mapper.selectJoinRkInfo(param);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,18 +16,18 @@ public class HdInventoryController {
|
||||
@Autowired
|
||||
private IRkInfoService rkInfoService;
|
||||
|
||||
// @ApiModelProperty("开始匹配")
|
||||
// @PostMapping("/match")
|
||||
// public AjaxResult match(@RequestBody QueryDTO dto) {
|
||||
//
|
||||
// dto.setScanType(0);
|
||||
//
|
||||
//// dto.setDeviceId("0");
|
||||
//
|
||||
// rkInfoService.matchWithStatus(dto);
|
||||
//
|
||||
// return AjaxResult.success();
|
||||
@ApiModelProperty("开始匹配")
|
||||
@PostMapping("/match")
|
||||
public AjaxResult match(@RequestBody QueryDTO dto) {
|
||||
|
||||
// }
|
||||
dto.setScanType(0);
|
||||
|
||||
// dto.setDeviceId("0");
|
||||
|
||||
rkInfoService.matchPure(dto);
|
||||
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -94,4 +94,5 @@ public interface InventoryTaskMapper
|
||||
* @return
|
||||
*/
|
||||
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;
|
||||
|
||||
/** 主键ID */
|
||||
@Excel(name = "主键ID")
|
||||
// @Excel(name = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/** 设备ID */
|
||||
@@ -28,7 +28,7 @@ public class InventoryMatchScan extends BaseEntity {
|
||||
private String taskId;
|
||||
|
||||
/** 扫描标签ID(货品码ID) */
|
||||
@Excel(name = "扫描标签ID")
|
||||
@Excel(name = "库位号")
|
||||
private String pcode;
|
||||
|
||||
/** 系统入库时间 */
|
||||
@@ -44,7 +44,7 @@ public class InventoryMatchScan extends BaseEntity {
|
||||
private String status;
|
||||
|
||||
/** 匹配到的真实货品码 */
|
||||
@Excel(name = "库位号")
|
||||
// @Excel(name = "库位号")
|
||||
private String rkPcode;
|
||||
|
||||
@Excel(name = "盘点任务名称")
|
||||
@@ -115,6 +115,13 @@ public class InventoryMatchScan extends BaseEntity {
|
||||
public void setRkPcode(String rkPcode) {
|
||||
this.rkPcode = rkPcode;
|
||||
}
|
||||
public String getTaskName() {
|
||||
return taskName;
|
||||
}
|
||||
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@@ -128,6 +135,7 @@ public class InventoryMatchScan extends BaseEntity {
|
||||
.append("scanType", getScanType())
|
||||
.append("status", getStatus())
|
||||
.append("rkPcode", getRkPcode())
|
||||
.append("taskName", getTaskName())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.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();
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,7 @@ public class RkBillController extends BaseController
|
||||
List<RkBill> list = rkBillService.selectRkBillList(rkBill);
|
||||
|
||||
return getDataTable(list);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,6 +48,18 @@ public class RkInfoController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存单据明细列表(按订单编号排序)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
|
||||
@GetMapping("/listByBillNo")
|
||||
public TableDataInfo listByBillNo(RkInfo rkInfo)
|
||||
{
|
||||
startPage();
|
||||
List<RkInfo> list = rkInfoService.selectRkInfoListOrderByBillNo(rkInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存单据明细列表
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zg.project.wisdom.domain.RkInfo;
|
||||
import com.zg.project.wisdom.domain.dto.RkDeliveryUpdateDTO;
|
||||
import com.zg.project.wisdom.domain.vo.StockStatisticVO;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -173,4 +174,22 @@ public class RkRecordController extends BaseController
|
||||
StockStatisticVO stockStatistic = rkRecordService.selectRecordStatisticByCondition(query);
|
||||
return AjaxResult.success(stockStatistic);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新配送状态
|
||||
*/
|
||||
@PostMapping("/updateDeliveryStatus")
|
||||
public AjaxResult updateDeliveryStatus(@RequestBody RkDeliveryUpdateDTO dto) {
|
||||
|
||||
if (dto.getIds() == null || dto.getIds().isEmpty()) {
|
||||
return AjaxResult.error("rk_record 主键ID集合不能为空");
|
||||
}
|
||||
if (dto.getIsDelivery() == null) {
|
||||
return AjaxResult.error("配送状态不能为空");
|
||||
}
|
||||
|
||||
int rows = rkRecordService.updateDeliveryStatus(dto.getIds(), dto.getIsDelivery());
|
||||
|
||||
return AjaxResult.success(rows);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,26 @@ public class RkStatisticsController {
|
||||
public AjaxResult home(@RequestBody(required = false) HomeStatQueryDTO query) {
|
||||
return AjaxResult.success(rkStatisticsService.getHomeStatistics(query));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 按时间查询【入库类型】统计
|
||||
*/
|
||||
@ApiOperation("按时间查询入库类型统计")
|
||||
@PostMapping("/inTypeByTime")
|
||||
public AjaxResult inTypeByTime(@RequestBody HomeStatQueryDTO query) {
|
||||
return AjaxResult.success(rkStatisticsService.getInTypeByTime(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 按时间查询【出库类型】统计
|
||||
*/
|
||||
@ApiOperation("按时间查询出库类型统计")
|
||||
@PostMapping("/outTypeByTime")
|
||||
public AjaxResult outTypeByTime(@RequestBody HomeStatQueryDTO query) {
|
||||
return AjaxResult.success(rkStatisticsService.getOutTypeByTime(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页统计,库龄统计
|
||||
* */
|
||||
@@ -50,6 +70,7 @@ public class RkStatisticsController {
|
||||
List<TodoStatVO> list = rkStatisticsService.selectTodoStat();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小仓库位使用情况统计(总库位/已使用/未使用)
|
||||
*/
|
||||
@@ -58,6 +79,7 @@ public class RkStatisticsController {
|
||||
List<WarehouseSlotStatVO> list = rkStatisticsService.selectWarehouseSlotStat();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 库龄>=30天明细导出(分组:>30天 / >60天)
|
||||
*/
|
||||
|
||||
@@ -97,8 +97,8 @@ public class RkBill extends BaseEntity {
|
||||
@Excel(name = "施工队名称")
|
||||
private String teamName;
|
||||
|
||||
/** 是否需要配送(0否,1是,2配送中,3配送完成) */
|
||||
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=配送中,3=配送完成")
|
||||
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=已接单,3=配送中,4=配送完成")
|
||||
private String isDelivery;
|
||||
|
||||
/** 借用时间 */
|
||||
|
||||
@@ -225,8 +225,8 @@ public class RkInfo extends BaseEntity
|
||||
/** sid */
|
||||
private Long sid;
|
||||
|
||||
/** 是否需要配送(0否,1是,2配送中,3配送完成) */
|
||||
@Excel(name = "是否需要配送", readConverterExp = "0否,1是,2配送中,3配送完成")
|
||||
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=待配送,3=配送中,4=配送完成")
|
||||
private String isDelivery;
|
||||
|
||||
/** 封样编号1 */
|
||||
@@ -251,6 +251,12 @@ public class RkInfo extends BaseEntity
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date endDate;
|
||||
/** 场景 */
|
||||
@Excel(name = "场景",readConverterExp = "HJ=货架,DC=堆场")
|
||||
private String scene;
|
||||
|
||||
private String sceneName;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@@ -796,6 +802,24 @@ public class RkInfo extends BaseEntity
|
||||
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
|
||||
public String toString() {
|
||||
@@ -861,6 +885,7 @@ public class RkInfo extends BaseEntity
|
||||
.append("startDate", startDate)
|
||||
.append("endDate", endDate)
|
||||
.append("totalAmount", totalAmount)
|
||||
.append("scene", getScene())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,15 +238,15 @@ public class RkRecord extends BaseEntity
|
||||
// @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long sid;
|
||||
|
||||
/** 是否需要配送(0否,1是,2配送中,3配送完成) */
|
||||
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=配送中,3=配送完成")
|
||||
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=待配送,3=配送中,4=配送完成")
|
||||
private String isDelivery;
|
||||
/** 封样编号1 */
|
||||
// @Excel(name = "封样编号1")
|
||||
private String fycde1;
|
||||
|
||||
/** 封样编号2 */
|
||||
// @Excel(name = "封样编号2")
|
||||
// @Excel(name = "封样编号2")2
|
||||
private String fycde2;
|
||||
|
||||
/** 1已更新 */
|
||||
|
||||
@@ -10,6 +10,6 @@ public class RkDeliveryUpdateDTO {
|
||||
/** rk_info 主键ID集合 */
|
||||
private List<Long> ids;
|
||||
|
||||
/** 配送状态:0否 1是 2配送中 3已完成 */
|
||||
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||
private Integer isDelivery;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public class DeliveryBillVO implements Serializable {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date operationTime;
|
||||
|
||||
/** 是否需要配送(0否,1是,2配送中,3配送完成) */
|
||||
/** 配送状态:0否 1是 2待接单 3配送中 4配送完成 */
|
||||
private String isDelivery;
|
||||
/** 出入库类型名称(联表) */
|
||||
private String operationTypeName;
|
||||
|
||||
@@ -15,6 +15,9 @@ public class StockStatisticGroupVO {
|
||||
/** 分组值(类型编码,如 operation_type / wl_type) */
|
||||
private String groupValue;
|
||||
|
||||
/** 分组名称(类型编码,如 operation_type / wl_type) */
|
||||
private String groupName;
|
||||
|
||||
/** 总金额 */
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
@@ -86,4 +86,13 @@ public interface RkBillMapper
|
||||
*/
|
||||
int updateExecStatus(@Param("billNo") String billNo,
|
||||
@Param("execStatus") String execStatus);
|
||||
|
||||
/**
|
||||
* 修改配送状态
|
||||
* @param billNo
|
||||
* @param isDelivery
|
||||
* @return
|
||||
*/
|
||||
int updateDeliveryStatusByBillNo(@Param("billNo") String billNo,
|
||||
@Param("isDelivery") Integer isDelivery);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zg.project.wisdom.mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -155,4 +156,31 @@ public interface RkInfoMapper
|
||||
int countGetByWh(@org.apache.ibatis.annotations.Param("warehouse") String warehouse);
|
||||
|
||||
List<RkInfo> listRkInfoByPcode(String pcode);
|
||||
|
||||
/**
|
||||
* 查询库存单据明细列表(按单据号排序)
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -149,4 +149,38 @@ public interface RkRecordMapper
|
||||
* 根据单据号查询出入库记录
|
||||
* */
|
||||
List<RkRecord> selectByBillNo(String billNo);
|
||||
|
||||
/**
|
||||
* 修改发货状态
|
||||
* */
|
||||
int updateDeliveryStatus(@Param("ids") List<Long> ids,
|
||||
@Param("isDelivery") Integer isDelivery);
|
||||
|
||||
/**
|
||||
* 根据ID列表查询单据号列表
|
||||
* */
|
||||
List<String> selectBillNosByRecordIds(@Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询该 bill 下 与目标状态不同的记录数
|
||||
*/
|
||||
int countDifferentDeliveryStatus(@Param("billNo") String billNo,
|
||||
@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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zg.project.inventory.domain.dto.QueryDTO;
|
||||
@@ -76,6 +77,13 @@ public interface IRkInfoService
|
||||
*/
|
||||
void matchWithStatus(QueryDTO dto);
|
||||
|
||||
/**
|
||||
* 盘点开始匹配(纯数据)
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
void matchPure(QueryDTO dto);
|
||||
|
||||
/**
|
||||
* 图表统计:每个库位有多少个货物
|
||||
* @param dto
|
||||
@@ -96,4 +104,16 @@ public interface IRkInfoService
|
||||
* @return
|
||||
*/
|
||||
List<RkInfo> listRkInfoByPcode(String pcode);
|
||||
|
||||
/**
|
||||
* 查询库存单据明细列表(按单据号排序)
|
||||
*/
|
||||
List<RkInfo> selectRkInfoListOrderByBillNo(RkInfo rkInfo);
|
||||
|
||||
/**
|
||||
* 按多个pcode查询
|
||||
* @param strings
|
||||
* @return
|
||||
*/
|
||||
List<RkInfo> listRkInfoByPcodes(ArrayList<String> strings);
|
||||
}
|
||||
|
||||
@@ -97,4 +97,9 @@ public interface IRkRecordService
|
||||
* 出入库总数统计
|
||||
*/
|
||||
StockStatisticVO selectRecordStatisticByCondition(RkRecord query);
|
||||
|
||||
/**
|
||||
* 修改指定入库记录的配送状态
|
||||
*/
|
||||
int updateDeliveryStatus(List<Long> ids, Integer isDelivery);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,16 @@ public interface RkStatisticsService {
|
||||
*/
|
||||
HomeStatVO getHomeStatistics(HomeStatQueryDTO query);
|
||||
|
||||
/**
|
||||
* 按时间查询入库类型统计
|
||||
*/
|
||||
List<StockStatisticGroupVO> getInTypeByTime(HomeStatQueryDTO query);
|
||||
|
||||
/**
|
||||
* 按时间查询出库类型统计
|
||||
*/
|
||||
List<StockStatisticGroupVO> getOutTypeByTime(HomeStatQueryDTO query);
|
||||
|
||||
/**
|
||||
* 首页库龄统计接口
|
||||
* */
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.zg.project.wisdom.mapper.AgvWcsMapper;
|
||||
import com.zg.project.wisdom.mapper.DdTaskMapper;
|
||||
import com.zg.project.wisdom.mapper.WcsTaskResultMapper;
|
||||
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.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -27,13 +28,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.zg.framework.datasource.DynamicDataSourceContextHolder.log;
|
||||
|
||||
/**
|
||||
* 调度任务 Service 实现类
|
||||
*
|
||||
* @author zg
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DdTaskServiceImpl implements IDdTaskService {
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.zg.common.utils.SecurityUtils;
|
||||
import com.zg.common.utils.StringUtils;
|
||||
import com.zg.framework.web.domain.AjaxResult;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -30,7 +32,11 @@ public class GysJhServiceImpl implements IGysJhService
|
||||
{
|
||||
@Autowired
|
||||
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)
|
||||
{
|
||||
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("入库明细不能为空");
|
||||
}
|
||||
|
||||
String billNo = BillNoUtil.generateTodayBillNo("RK", null);
|
||||
String billNo = BillNoUtil.generateTodayBillNo("RK", rkInfoMapper);
|
||||
Date now = DateUtils.getNowDate();
|
||||
String userId = String.valueOf(SecurityUtils.getUserId());
|
||||
|
||||
@@ -133,14 +133,20 @@ public class RkBillServiceImpl implements IRkBillService
|
||||
for (RkInfo info : rkInfoList) {
|
||||
|
||||
info.setExecStatus(bill.getExecStatus());
|
||||
|
||||
String scene = "";
|
||||
// 库位校验
|
||||
if (StringUtils.isNotBlank(info.getPcode())) {
|
||||
PcdeDetail pcde = pcdeDetailMapper.selectByPcode(info.getPcode());
|
||||
PcdeDetail pcde = pcdeDetailMapper.selectByPcodeAndWarehouse(
|
||||
info.getPcode(),
|
||||
bill.getCangku()
|
||||
);
|
||||
if (pcde == null) {
|
||||
throw new RuntimeException("库位不存在:" + info.getPcode());
|
||||
}
|
||||
info.setPcodeId(pcde.getEncodedId());
|
||||
if(StringUtils.isNotBlank(pcde.getScene())){
|
||||
scene = pcde.getScene();
|
||||
}
|
||||
}
|
||||
|
||||
// rk_info
|
||||
@@ -156,7 +162,7 @@ public class RkBillServiceImpl implements IRkBillService
|
||||
info.setHasMoved("0");
|
||||
info.setIsBorrowed("0");
|
||||
info.setIsDelete("0");
|
||||
|
||||
info.setScene(scene);
|
||||
info.setCreateTime(now);
|
||||
info.setCreateBy(userId);
|
||||
|
||||
@@ -331,38 +337,54 @@ public class RkBillServiceImpl implements IRkBillService
|
||||
throw new ServiceException("单据不存在:" + billNo);
|
||||
}
|
||||
|
||||
/* ================== 2️⃣ 执行状态规则 ================== */
|
||||
/* ================== 2️⃣ 取前端选择仓库 ================== */
|
||||
String frontCangku = dto.getRkBill().getCangku();
|
||||
if (StringUtils.isBlank(frontCangku)) {
|
||||
frontCangku = bill.getCangku();
|
||||
}
|
||||
|
||||
/* ================== 3️⃣ 执行状态 ================== */
|
||||
String execStatus = dto.getRkBill().getExecStatus();
|
||||
if (StringUtils.isBlank(execStatus)) {
|
||||
execStatus = bill.getExecStatus();
|
||||
}
|
||||
|
||||
// 标记:本次是否包含预入库
|
||||
boolean hasPreIn = false;
|
||||
|
||||
List<RkInfo> rkInfoList = dto.getRkInfoList();
|
||||
|
||||
/* ================== 3️⃣ 追加前:供应计划【批量】校验 ================== */
|
||||
/* ================== 4️⃣ 供应计划校验 ================== */
|
||||
checkGysJhQtyBeforeInStockBatch(rkInfoList);
|
||||
|
||||
/* ================== 4️⃣ 插入明细 & 事件 ================== */
|
||||
/* ================== 5️⃣ 追加明细 ================== */
|
||||
for (RkInfo info : rkInfoList) {
|
||||
|
||||
/* 4.1 库位校验 */
|
||||
/* 5.1 库位校验 → 用【前端仓库】 */
|
||||
if (StringUtils.isNotBlank(info.getPcode())) {
|
||||
PcdeDetail pcde = pcdeDetailMapper.selectByPcode(info.getPcode());
|
||||
|
||||
PcdeDetail pcde = pcdeDetailMapper.selectByPcodeAndWarehouse(
|
||||
info.getPcode(),
|
||||
frontCangku
|
||||
);
|
||||
|
||||
if (pcde == null) {
|
||||
throw new ServiceException("库位不存在:" + info.getPcode());
|
||||
throw new ServiceException(
|
||||
"库位不存在或不属于当前仓库:"
|
||||
+ info.getPcode()
|
||||
+ ",仓库:" + frontCangku
|
||||
);
|
||||
}
|
||||
|
||||
info.setPcodeId(pcde.getEncodedId());
|
||||
info.setScene(pcde.getScene());
|
||||
}
|
||||
|
||||
/* 4.2 继承主单字段 */
|
||||
/* 5.2 继承主单字段 */
|
||||
info.setBillNo(bill.getBillNo());
|
||||
info.setOperationType(bill.getOperationType());
|
||||
info.setBizType(bill.getBizType());
|
||||
info.setWlType(bill.getWlType());
|
||||
info.setCangku(bill.getCangku());
|
||||
|
||||
info.setCangku(frontCangku);
|
||||
|
||||
info.setOperationTime(now);
|
||||
info.setOperator(bill.getOperator());
|
||||
@@ -376,36 +398,36 @@ public class RkBillServiceImpl implements IRkBillService
|
||||
info.setHasMoved("0");
|
||||
info.setIsBorrowed("0");
|
||||
|
||||
/* 4.3 备注兜底 */
|
||||
String finalRemark = StringUtils.isNotBlank(info.getRemark())
|
||||
? info.getRemark()
|
||||
: bill.getRemark();
|
||||
info.setRemark(finalRemark);
|
||||
|
||||
/* 4.4 审计字段 */
|
||||
info.setCreateTime(now);
|
||||
info.setCreateBy(bill.getCreateBy());
|
||||
info.setIsDelete("0");
|
||||
|
||||
/* 4.5 插入 rk_info */
|
||||
/* 5.3 插入 rk_info */
|
||||
rkInfoMapper.insertRkInfo(info);
|
||||
|
||||
/* 4.6 插入 rk_record */
|
||||
/* 5.4 插入 rk_record */
|
||||
RkRecord record = buildInRkRecord(bill, info, now);
|
||||
record.setExecStatus(execStatus);
|
||||
record.setRkInfoId(info.getId());
|
||||
record.setPcodeId(info.getPcodeId());
|
||||
record.setRemark(finalRemark);
|
||||
|
||||
record.setCangku(frontCangku);
|
||||
|
||||
rkRecordMapper.insertRkRecord(record);
|
||||
}
|
||||
|
||||
/* ================== 5️⃣ 追加后:供应计划【仅完成入库】 ================== */
|
||||
/* ================== 6️⃣ 供应计划回写 ================== */
|
||||
if ("1".equals(execStatus)) {
|
||||
handleGysJhAfterInStockBatch(rkInfoList);
|
||||
}
|
||||
|
||||
/* ================== 6️⃣ 同步回退主单状态 ================== */
|
||||
/* ================== 7️⃣ 主单状态回退 ================== */
|
||||
if (hasPreIn && !"0".equals(bill.getExecStatus())) {
|
||||
rkBillMapper.updateExecStatusByBillNo(billNo, "0");
|
||||
}
|
||||
@@ -420,11 +442,35 @@ public class RkBillServiceImpl implements IRkBillService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRkBill(RkBill rkBill)
|
||||
{
|
||||
return rkBillMapper.updateRkBill(rkBill);
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateRkBill(RkBill 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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除库存单据
|
||||
*
|
||||
@@ -496,7 +542,7 @@ public class RkBillServiceImpl implements IRkBillService
|
||||
throw new RuntimeException("出库明细不能为空");
|
||||
}
|
||||
|
||||
String billNo = BillNoUtil.generateTodayBillNo("CK", null);
|
||||
String billNo = BillNoUtil.generateTodayBillNo("CK", rkInfoMapper);
|
||||
Date now = DateUtils.getNowDate();
|
||||
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.domain.dto.QueryDTO;
|
||||
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.PcdeCntVO;
|
||||
import com.zg.project.wisdom.domain.vo.StockStatisticVO;
|
||||
@@ -234,6 +235,79 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
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
|
||||
@@ -270,4 +344,17 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
public List<RkInfo> listRkInfoByPcode(String pcode) {
|
||||
return rkInfoMapper.listRkInfoByPcode(pcode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RkInfo> selectRkInfoListOrderByBillNo(RkInfo rkInfo)
|
||||
{
|
||||
return rkInfoMapper.selectRkInfoListOrderByBillNo(rkInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RkInfo> listRkInfoByPcodes(ArrayList<String> strings) {
|
||||
return rkInfoMapper.listRkInfoByPcodes(strings);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import java.util.stream.Collectors;
|
||||
import com.zg.common.exception.ServiceException;
|
||||
import com.zg.common.utils.DateUtils;
|
||||
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.RkInfo;
|
||||
import com.zg.project.wisdom.domain.vo.RecordStatisticVO;
|
||||
@@ -43,6 +45,8 @@ public class RkRecordServiceImpl implements IRkRecordService
|
||||
@Autowired
|
||||
private GysJhMapper gysJhMapper;
|
||||
|
||||
@Autowired
|
||||
private PcdeDetailMapper pcdeDetailMapper;
|
||||
/**
|
||||
* 查询出入库记录
|
||||
*
|
||||
@@ -199,6 +203,22 @@ public class RkRecordServiceImpl implements IRkRecordService
|
||||
}
|
||||
|
||||
/* ---------- 同步库存(明确字段,禁止 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.setWlNo(rkRecord.getWlNo());
|
||||
info.setWlMs(rkRecord.getWlMs());
|
||||
@@ -210,6 +230,7 @@ public class RkRecordServiceImpl implements IRkRecordService
|
||||
info.setHtDj(rkRecord.getHtDj());
|
||||
info.setCangku(rkRecord.getCangku());
|
||||
info.setPcode(rkRecord.getPcode());
|
||||
info.setRemark(rkRecord.getRemark());
|
||||
info.setIsChuku("0");
|
||||
}
|
||||
|
||||
@@ -246,6 +267,7 @@ public class RkRecordServiceImpl implements IRkRecordService
|
||||
info.setHtDj(rkRecord.getHtDj());
|
||||
info.setCangku(rkRecord.getCangku());
|
||||
info.setPcode(rkRecord.getPcode());
|
||||
info.setRemark(rkRecord.getRemark());
|
||||
}
|
||||
|
||||
/* ====================== 4. 更新库存表 ====================== */
|
||||
@@ -801,4 +823,60 @@ public class RkRecordServiceImpl implements IRkRecordService
|
||||
public StockStatisticVO selectRecordStatisticByCondition(RkRecord query) {
|
||||
return rkRecordMapper.selectRecordStatisticByCondition(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateDeliveryStatus(List<Long> ids, Integer isDelivery)
|
||||
{
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// 1. 更新 record 状态
|
||||
// ===============================
|
||||
int rows =
|
||||
rkRecordMapper.updateDeliveryStatus(ids, isDelivery);
|
||||
|
||||
|
||||
// ===============================
|
||||
// 2. 查询受影响 billNo
|
||||
// ===============================
|
||||
List<String> billNos =
|
||||
rkRecordMapper.selectBillNosByRecordIds(ids);
|
||||
|
||||
if (billNos == null || billNos.isEmpty()) {
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
||||
// ===============================
|
||||
// 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);
|
||||
|
||||
if (billStatus != null)
|
||||
{
|
||||
rkBillMapper.updateDeliveryStatusByBillNo(
|
||||
billNo,
|
||||
billStatus
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,14 +28,26 @@ public class RkStatisticsServiceImpl implements RkStatisticsService {
|
||||
vo.setCurrentInType(rkStatisticsMapper.statCurrentInByOperationType());
|
||||
vo.setMaterialType(rkStatisticsMapper.statCurrentByMaterialType());
|
||||
|
||||
// ========== 3. 时间维度统计 ==========
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<StockStatisticGroupVO> getInTypeByTime(HomeStatQueryDTO query) {
|
||||
|
||||
Date start = query == null ? null : query.getStartDate();
|
||||
Date end = query == null ? null : query.getEndDate();
|
||||
|
||||
vo.setInTypeByTime(rkStatisticsMapper.statInByOperationType(start, end));
|
||||
vo.setOutTypeByTime(rkStatisticsMapper.statOutByOperationType(start, end));
|
||||
return rkStatisticsMapper.statInByOperationType(start, end);
|
||||
}
|
||||
|
||||
return vo;
|
||||
@Override
|
||||
public List<StockStatisticGroupVO> getOutTypeByTime(HomeStatQueryDTO query) {
|
||||
|
||||
Date start = query == null ? null : query.getStartDate();
|
||||
Date end = query == null ? null : query.getEndDate();
|
||||
|
||||
return rkStatisticsMapper.statOutByOperationType(start, end);
|
||||
}
|
||||
/**
|
||||
* 首页库龄统计接口
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zg.project.wisdom.utils;
|
||||
|
||||
import com.zg.project.wisdom.mapper.RkInfoMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@@ -22,6 +23,8 @@ public class BillNoUtil {
|
||||
|
||||
private static final String DEFAULT_PREFIX = "RK";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 生成单据号(短号,不查数据库)
|
||||
* 格式:PREFIX + yyMMdd + HHmmss + 2位随机数
|
||||
@@ -32,20 +35,25 @@ public class BillNoUtil {
|
||||
*/
|
||||
public static synchronized String generateTodayBillNo(String prefix, RkInfoMapper rkInfoMapper) {
|
||||
|
||||
// 前缀处理
|
||||
final String p = (prefix == null || prefix.trim().isEmpty())
|
||||
? DEFAULT_PREFIX
|
||||
: prefix.trim().toUpperCase();
|
||||
// 日期 yyMMdd
|
||||
String date = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
|
||||
// 时间到秒:yyMMddHHmmss(12位)
|
||||
String time = new SimpleDateFormat("yyMMddHHmmss").format(new Date());
|
||||
// 查询今日最大单号
|
||||
String maxBillNo = rkInfoMapper.selectTodayMaxBillNo(prefix, date);
|
||||
|
||||
// 2位随机数:10~99(避免同一秒内多次点击撞号)
|
||||
int rnd = ThreadLocalRandom.current().nextInt(10, 100);
|
||||
int seq = 1;
|
||||
|
||||
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位随机数
|
||||
|
||||
@@ -77,6 +77,7 @@ spring:
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
# password: shzg
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
|
||||
@@ -273,4 +273,17 @@
|
||||
ORDER BY MAX(r.create_time) DESC
|
||||
</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>
|
||||
|
||||
@@ -140,6 +140,33 @@
|
||||
AND is_delete = '0'
|
||||
</select>
|
||||
|
||||
<!-- 根据 pcode + 小仓编码 精准定位 -->
|
||||
<select id="selectByPcodeAndWarehouse"
|
||||
resultType="com.zg.project.information.domain.PcdeDetail">
|
||||
|
||||
SELECT
|
||||
id,
|
||||
pcode,
|
||||
scene,
|
||||
parent_warehouse_code AS parentWarehouseCode,
|
||||
parent_warehouse_name AS parentWarehouseName,
|
||||
warehouse_code AS warehouseCode,
|
||||
warehouse_name AS warehouseName,
|
||||
encoded_id AS encodedId,
|
||||
tag,
|
||||
is_delete AS isDelete,
|
||||
created_by AS createdBy,
|
||||
created_at AS createdAt,
|
||||
updated_by AS updatedBy,
|
||||
updated_at AS updatedAt,
|
||||
remark
|
||||
FROM pcde_detail
|
||||
WHERE pcode = #{pcode}
|
||||
AND warehouse_code = #{warehouseCode}
|
||||
AND is_delete = '0'
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 根据库位编码查编码后ID -->
|
||||
<select id="selectEncodedIdByPcode"
|
||||
resultType="java.lang.String"
|
||||
|
||||
@@ -104,7 +104,6 @@
|
||||
<select id="selectRkBillList" parameterType="RkBill" resultMap="RkBillResult">
|
||||
<include refid="selectRkBillVo"/>
|
||||
<where>
|
||||
AND rb.is_delivery ='1'
|
||||
<if test="wlType != null and wlType != ''">
|
||||
AND rb.wl_type = #{wlType}
|
||||
</if>
|
||||
@@ -121,7 +120,7 @@
|
||||
AND rb.operation_type = #{operationType}
|
||||
</if>
|
||||
|
||||
<if test="bizTypeList != null and bizTypeList.size > 0">
|
||||
<if test="bizTypeList != null and bizTypeList.size() > 0">
|
||||
AND rb.biz_type IN
|
||||
<foreach collection="bizTypeList" item="bt" open="(" separator="," close=")">
|
||||
#{bt}
|
||||
@@ -303,4 +302,11 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateDeliveryStatusByBillNo">
|
||||
UPDATE rk_bill
|
||||
SET is_delivery = #{isDelivery},
|
||||
update_time = NOW()
|
||||
WHERE bill_no = #{billNo}
|
||||
AND is_delete = '0'
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@@ -66,13 +66,19 @@
|
||||
<result property="fycde1" column="fycde_1"/>
|
||||
<result property="fycde2" column="fycde_2"/>
|
||||
<result property="isUpdate" column="is_update"/>
|
||||
<result property="scene" column="scene"/>
|
||||
<result property="sceneName" column="sceneName"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- ========================= 公共查询 SQL(联表完整版) ========================= -->
|
||||
<sql id="selectRkInfoVo">
|
||||
SELECT
|
||||
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,
|
||||
|
||||
@@ -101,53 +107,75 @@
|
||||
ri.exec_status = 1
|
||||
AND ri.is_chuku = 0
|
||||
AND ri.is_delete = 0
|
||||
|
||||
<if test="operationType != null and operationType != ''">
|
||||
AND ri.operation_type LIKE CONCAT('%', #{operationType}, '%')
|
||||
</if>
|
||||
|
||||
<if test="sapNo != null and sapNo != ''">
|
||||
AND ri.sap_no LIKE CONCAT('%', #{sapNo}, '%')
|
||||
</if>
|
||||
|
||||
<if test="xmNo != null and xmNo != ''">
|
||||
AND ri.xm_no LIKE CONCAT('%', #{xmNo}, '%')
|
||||
</if>
|
||||
|
||||
<if test="xmMs != null and xmMs != ''">
|
||||
AND ri.xm_ms LIKE CONCAT('%', #{xmMs}, '%')
|
||||
</if>
|
||||
|
||||
<if test="wlNo != null and wlNo != ''">
|
||||
AND ri.wl_no LIKE CONCAT('%', #{wlNo}, '%')
|
||||
</if>
|
||||
|
||||
<if test="wlMs != null and wlMs != ''">
|
||||
AND ri.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
|
||||
</if>
|
||||
|
||||
<if test="gysMc != null and gysMc != ''">
|
||||
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
|
||||
</if>
|
||||
|
||||
<if test="pcode != null and pcode != ''">
|
||||
AND ri.pcode LIKE CONCAT('%', #{pcode}, '%')
|
||||
</if>
|
||||
|
||||
<if test="bizType != null and bizType != ''">
|
||||
AND ri.biz_type LIKE CONCAT('%', #{bizType}, '%')
|
||||
</if>
|
||||
|
||||
<if test="wlType != null and wlType != ''">
|
||||
AND ri.wl_type LIKE CONCAT('%', #{wlType}, '%')
|
||||
</if>
|
||||
|
||||
<if test="cangku != null and cangku != ''">
|
||||
AND ri.cangku LIKE CONCAT('%', #{cangku}, '%')
|
||||
</if>
|
||||
|
||||
<if test="billNo != null and billNo != ''">
|
||||
AND ri.bill_no LIKE CONCAT('%', #{billNo}, '%')
|
||||
</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 != ''">
|
||||
AND ri.is_delete = #{isDelete}
|
||||
</if>
|
||||
<!-- 出入库时间范围 -->
|
||||
|
||||
<if test="startDate != null">
|
||||
AND ri.operation_time >= #{startDate}
|
||||
</if>
|
||||
|
||||
<if test="endDate != null">
|
||||
AND ri.operation_time <= #{endDate}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
ORDER BY ri.operation_time DESC
|
||||
</select>
|
||||
|
||||
@@ -220,6 +248,9 @@
|
||||
<if test="wlMs != null and wlMs != ''">
|
||||
AND ri.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
|
||||
</if>
|
||||
<if test="scene != null and scene != ''">
|
||||
AND ri.scene LIKE CONCAT('%', #{scene}, '%')
|
||||
</if>
|
||||
<if test="gysMc != null and gysMc != ''">
|
||||
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
|
||||
</if>
|
||||
@@ -278,7 +309,7 @@
|
||||
is_delivery,
|
||||
fycde_1, fycde_2,
|
||||
is_update,
|
||||
create_by, create_time, is_delete
|
||||
create_by, create_time, is_delete,scene
|
||||
)
|
||||
VALUES (
|
||||
#{operationType}, #{bizType}, #{wlType}, #{cangku}, #{operationTime}, #{operator},
|
||||
@@ -296,7 +327,7 @@
|
||||
#{isDelivery},
|
||||
#{fycde1}, #{fycde2},
|
||||
#{isUpdate},
|
||||
#{createBy}, #{createTime}, #{isDelete}
|
||||
#{createBy}, #{createTime}, #{isDelete},#{scene}
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -352,6 +383,7 @@
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="scene != null">scene = #{scene}</if>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
@@ -500,4 +532,139 @@
|
||||
ORDER BY t.operation_time DESC, t.id DESC
|
||||
</select>
|
||||
|
||||
<!-- ========================= 按单据号排序查询列表 ========================= -->
|
||||
<select id="selectRkInfoListOrderByBillNo" parameterType="RkInfo" resultMap="RkInfoResult">
|
||||
<include refid="selectRkInfoVo"/>
|
||||
<where>
|
||||
ri.exec_status = 1
|
||||
AND ri.is_chuku = 0
|
||||
AND ri.is_delete = 0
|
||||
|
||||
<if test="operationType != null and operationType != ''">
|
||||
AND ri.operation_type LIKE CONCAT('%', #{operationType}, '%')
|
||||
</if>
|
||||
<if test="sapNo != null and sapNo != ''">
|
||||
AND ri.sap_no LIKE CONCAT('%', #{sapNo}, '%')
|
||||
</if>
|
||||
<if test="xmNo != null and xmNo != ''">
|
||||
AND ri.xm_no LIKE CONCAT('%', #{xmNo}, '%')
|
||||
</if>
|
||||
<if test="xmMs != null and xmMs != ''">
|
||||
AND ri.xm_ms LIKE CONCAT('%', #{xmMs}, '%')
|
||||
</if>
|
||||
<if test="wlNo != null and wlNo != ''">
|
||||
AND ri.wl_no LIKE CONCAT('%', #{wlNo}, '%')
|
||||
</if>
|
||||
<if test="wlMs != null and wlMs != ''">
|
||||
AND ri.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
|
||||
</if>
|
||||
<if test="gysMc != null and gysMc != ''">
|
||||
AND ri.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
|
||||
</if>
|
||||
<if test="pcode != null and pcode != ''">
|
||||
AND ri.pcode LIKE CONCAT('%', #{pcode}, '%')
|
||||
</if>
|
||||
<if test="bizType != null and bizType != ''">
|
||||
AND ri.biz_type LIKE CONCAT('%', #{bizType}, '%')
|
||||
</if>
|
||||
<if test="wlType != null and wlType != ''">
|
||||
AND ri.wl_type LIKE CONCAT('%', #{wlType}, '%')
|
||||
</if>
|
||||
<if test="cangku != null and cangku != ''">
|
||||
AND ri.cangku LIKE CONCAT('%', #{cangku}, '%')
|
||||
</if>
|
||||
<if test="billNo != null and billNo != ''">
|
||||
AND ri.bill_no LIKE CONCAT('%', #{billNo}, '%')
|
||||
</if>
|
||||
<if test="isDelete != null and isDelete != ''">
|
||||
AND ri.is_delete = #{isDelete}
|
||||
</if>
|
||||
<!-- 出入库时间范围 -->
|
||||
<if test="startDate != null">
|
||||
AND ri.operation_time >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND ri.operation_time <= #{endDate}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
ORDER BY
|
||||
/* 1. 纯数字优先 */
|
||||
(ri.sap_no REGEXP '^[0-9]+$') DESC,
|
||||
|
||||
/* 2. 纯数字按【从小到大】 */
|
||||
CASE
|
||||
WHEN ri.sap_no REGEXP '^[0-9]+$'
|
||||
THEN CAST(ri.sap_no AS UNSIGNED)
|
||||
ELSE 999999999999
|
||||
END ASC,
|
||||
|
||||
/* 3. 字母混合按字符串 */
|
||||
ri.sap_no ASC
|
||||
</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 pd.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>
|
||||
</mapper>
|
||||
|
||||
@@ -92,31 +92,35 @@
|
||||
<sql id="selectRkRecordVo">
|
||||
SELECT
|
||||
rr.*,
|
||||
|
||||
/* ===== 新增:统一计算总金额 ===== */
|
||||
rr.real_qty * rr.ht_dj AS total_amount,
|
||||
|
||||
COALESCE(rr.real_qty, 0) * COALESCE(rr.ht_dj, 0) AS total_amount,
|
||||
su.nick_name AS operator_name,
|
||||
mt.type_name AS wl_type_name,
|
||||
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
|
||||
|
||||
-- 小仓
|
||||
wh.warehouse_name AS warehouse_name,
|
||||
|
||||
-- 大仓
|
||||
wh.parent_warehouse_code AS parent_warehouse_code,
|
||||
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
|
||||
LEFT JOIN sys_user su ON rr.operator = su.user_id
|
||||
LEFT JOIN material_type mt ON rr.wl_type = mt.type_code
|
||||
LEFT JOIN stock_in_type sit 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 sys_user su
|
||||
ON rr.operator = su.user_id
|
||||
LEFT JOIN material_type mt
|
||||
ON rr.wl_type = mt.type_code
|
||||
LEFT JOIN stock_in_type sit
|
||||
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
|
||||
ON rr.team_code = ct.team_code
|
||||
AND ct.is_delete = '0'
|
||||
@@ -282,7 +286,11 @@
|
||||
<include refid="selectRkRecordVo"/>
|
||||
WHERE rr.bill_no = #{billNo}
|
||||
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,
|
||||
gj.gys_jh_id ASC
|
||||
</select>
|
||||
|
||||
<select id="selectRkRecordByIds" resultMap="RkRecordResult">
|
||||
@@ -598,36 +606,140 @@
|
||||
IFNULL(SUM(rr.real_qty), 0) AS totalQuantity
|
||||
FROM rk_record rr
|
||||
<where>
|
||||
rr.is_delete = 0
|
||||
AND rr.exec_status = 1
|
||||
|
||||
<!-- 已修复:String 不可用 size() -->
|
||||
AND rr.exec_status = '1'
|
||||
|
||||
<if test="operationType != null and operationType != ''">
|
||||
AND rr.operation_type = #{operationType}
|
||||
</if>
|
||||
|
||||
<if test="xmNo != null and xmNo != ''">
|
||||
AND rr.xm_no LIKE CONCAT('%', #{xmNo}, '%')
|
||||
<!-- 多 bizType -->
|
||||
<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 test="wlNo != null and wlNo != ''">
|
||||
AND rr.wl_no LIKE CONCAT('%', #{wlNo}, '%')
|
||||
<if test="bizType != null and bizType != ''">
|
||||
AND rr.biz_type = #{bizType}
|
||||
</if>
|
||||
|
||||
<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 test="cangku != null and cangku != ''">
|
||||
AND rr.cangku LIKE CONCAT('%', #{cangku}, '%')
|
||||
AND rr.cangku = #{cangku}
|
||||
</if>
|
||||
|
||||
<if test="startDate != null">
|
||||
AND rr.operation_time >= #{startDate}
|
||||
<if test="operator != null and operator != ''">
|
||||
AND rr.operator = #{operator}
|
||||
</if>
|
||||
|
||||
<if test="endDate != null">
|
||||
AND rr.operation_time <= #{endDate}
|
||||
<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">
|
||||
AND rr.operation_time >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND rr.operation_time <= #{endDate}
|
||||
</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>
|
||||
</select>
|
||||
@@ -662,6 +774,7 @@
|
||||
WHERE id = #{id}
|
||||
AND is_delete = '0'
|
||||
</update>
|
||||
|
||||
<select id="selectInOutStatisticByCondition"
|
||||
parameterType="com.zg.project.wisdom.domain.RkRecord"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticVO">
|
||||
@@ -751,6 +864,87 @@
|
||||
ON rr.cangku = wh.warehouse_code
|
||||
WHERE rr.bill_no = #{billNo}
|
||||
AND rr.is_delete = '0'
|
||||
AND rr.is_delivery = '1'
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 修改 record 状态 -->
|
||||
<update id="updateDeliveryStatus">
|
||||
UPDATE rk_record
|
||||
SET is_delivery = #{isDelivery},
|
||||
update_time = NOW()
|
||||
WHERE is_delete = '0'
|
||||
AND id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 找到受影响的 bill -->
|
||||
<select id="selectBillNosByRecordIds" resultType="string">
|
||||
SELECT DISTINCT bill_no
|
||||
FROM rk_record
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND is_delete = '0'
|
||||
</select>
|
||||
|
||||
<!-- 统计不同状态数量 -->
|
||||
<select id="countDifferentDeliveryStatus" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM rk_record
|
||||
WHERE bill_no = #{billNo}
|
||||
AND is_delete = '0'
|
||||
AND is_delivery != #{isDelivery}
|
||||
</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>
|
||||
|
||||
@@ -5,112 +5,165 @@
|
||||
<!-- 当前入库类型统计 -->
|
||||
<select id="statCurrentInByOperationType"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||
|
||||
SELECT
|
||||
ri.operation_type AS groupValue,
|
||||
sit.type_name AS groupName,
|
||||
|
||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
||||
|
||||
FROM rk_info ri
|
||||
LEFT JOIN stock_in_type sit
|
||||
ON sit.type_code = ri.operation_type
|
||||
AND sit.status = 1
|
||||
|
||||
WHERE ri.exec_status = 1
|
||||
AND ri.is_chuku = 0
|
||||
AND ri.is_delete = 0
|
||||
GROUP BY ri.operation_type
|
||||
|
||||
GROUP BY ri.operation_type, sit.type_name
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 当前物资类型统计 -->
|
||||
<select id="statCurrentByMaterialType"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||
|
||||
SELECT
|
||||
ri.wl_type AS groupValue,
|
||||
mt.type_name AS groupName,
|
||||
|
||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
||||
|
||||
FROM rk_info ri
|
||||
LEFT JOIN material_type mt
|
||||
ON mt.type_code = ri.wl_type
|
||||
AND mt.status = 1
|
||||
|
||||
WHERE ri.exec_status = 1
|
||||
AND ri.is_chuku = 0
|
||||
AND ri.is_delete = 0
|
||||
GROUP BY ri.wl_type
|
||||
|
||||
GROUP BY ri.wl_type, mt.type_name
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 入库类型统计(时间) -->
|
||||
<select id="statInByOperationType"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||
|
||||
SELECT
|
||||
ri.operation_type AS groupValue,
|
||||
sit.type_name AS groupName,
|
||||
|
||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
||||
|
||||
FROM rk_info ri
|
||||
LEFT JOIN stock_in_type sit
|
||||
ON sit.type_code = ri.operation_type
|
||||
AND sit.status = 1
|
||||
|
||||
WHERE ri.exec_status = 1
|
||||
AND ri.is_chuku = 0
|
||||
AND ri.is_delete = 0
|
||||
|
||||
<if test="startDate != null">
|
||||
AND ri.operation_time <![CDATA[>=]]> #{startDate}
|
||||
</if>
|
||||
|
||||
<if test="endDate != null">
|
||||
AND ri.operation_time <![CDATA[<=]]> #{endDate}
|
||||
</if>
|
||||
GROUP BY ri.operation_type
|
||||
|
||||
GROUP BY ri.operation_type, sit.type_name
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 出库类型统计(时间) -->
|
||||
<select id="statOutByOperationType"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||
|
||||
SELECT
|
||||
ri.operation_type AS groupValue,
|
||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
||||
FROM rk_info ri
|
||||
WHERE ri.exec_status = 1
|
||||
AND ri.is_chuku = 1
|
||||
AND ri.is_delete = 0
|
||||
rr.operation_type AS groupValue,
|
||||
|
||||
sot.type_name AS groupName,
|
||||
|
||||
IFNULL(SUM(rr.real_qty * rr.ht_dj), 0) AS totalAmount,
|
||||
|
||||
COUNT(DISTINCT rr.pcode) AS locationCount,
|
||||
|
||||
IFNULL(SUM(rr.real_qty), 0) AS totalQuantity,
|
||||
|
||||
COUNT(DISTINCT rr.xm_no) AS projectCount
|
||||
|
||||
FROM rk_record rr
|
||||
|
||||
LEFT JOIN stock_out_type sot
|
||||
ON sot.type_code = rr.operation_type
|
||||
AND sot.is_delete = '0'
|
||||
|
||||
WHERE rr.exec_status = '1'
|
||||
AND rr.biz_type = '1' <!-- 出库 -->
|
||||
AND rr.is_delete = '0'
|
||||
|
||||
<if test="startDate != null">
|
||||
AND ri.operation_time <![CDATA[>=]]> #{startDate}
|
||||
AND rr.operation_time <![CDATA[>=]]> #{startDate}
|
||||
</if>
|
||||
|
||||
<if test="endDate != null">
|
||||
AND ri.operation_time <![CDATA[<=]]> #{endDate}
|
||||
AND rr.operation_time <![CDATA[<=]]> #{endDate}
|
||||
</if>
|
||||
GROUP BY ri.operation_type
|
||||
|
||||
GROUP BY rr.operation_type, sot.type_name
|
||||
|
||||
</select>
|
||||
|
||||
<select id="statHomeKpi"
|
||||
resultType="com.zg.project.wisdom.domain.vo.HomeKpiVO">
|
||||
|
||||
SELECT
|
||||
/* 月入库 */
|
||||
COUNT(CASE WHEN ri.is_chuku = 0
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
/* ===== 月入库 ===== */
|
||||
COUNT(CASE WHEN rr.biz_type = '0'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN 1 END) AS monthInCount,
|
||||
|
||||
COUNT(DISTINCT CASE WHEN ri.is_chuku = 0
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN ri.xm_no END) AS monthInProjectCount,
|
||||
COUNT(DISTINCT CASE WHEN rr.biz_type = '0'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN rr.xm_no END) AS monthInProjectCount,
|
||||
|
||||
IFNULL(SUM(CASE WHEN ri.is_chuku = 0
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN ri.real_qty * ri.ht_dj END),0) AS monthInAmount,
|
||||
IFNULL(SUM(CASE WHEN rr.biz_type = '0'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN rr.real_qty * rr.ht_dj END),0) AS monthInAmount,
|
||||
|
||||
/* 月出库 */
|
||||
COUNT(CASE WHEN ri.is_chuku = 1
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
/* ===== 月出库 ===== */
|
||||
COUNT(CASE WHEN rr.biz_type = '1'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN 1 END) AS monthOutCount,
|
||||
|
||||
COUNT(DISTINCT CASE WHEN ri.is_chuku = 1
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN ri.xm_no END) AS monthOutProjectCount,
|
||||
COUNT(DISTINCT CASE WHEN rr.biz_type = '1'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN rr.xm_no END) AS monthOutProjectCount,
|
||||
|
||||
IFNULL(SUM(CASE WHEN rr.biz_type = '1'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN rr.real_qty * rr.ht_dj END),0) AS monthOutAmount
|
||||
|
||||
FROM rk_record rr
|
||||
WHERE rr.exec_status = '1'
|
||||
AND rr.is_delete = '0'
|
||||
|
||||
IFNULL(SUM(CASE WHEN ri.is_chuku = 1
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN ri.real_qty * ri.ht_dj END),0) AS monthOutAmount
|
||||
FROM rk_info ri
|
||||
WHERE ri.exec_status = 1
|
||||
AND ri.is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="selectStockAgeStat" resultType="com.zg.project.wisdom.domain.vo.StockAgeStatVO">
|
||||
<![CDATA[
|
||||
SELECT '10-20天' AS name, COUNT(*) AS value
|
||||
@@ -180,81 +233,66 @@
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
'应到未到[全部未到]' AS type,
|
||||
COUNT(DISTINCT g.xm_no) AS projectCnt,
|
||||
ROUND(
|
||||
COALESCE(
|
||||
SUM(g.jh_qty),
|
||||
0
|
||||
),
|
||||
3
|
||||
) AS totalQty,
|
||||
ROUND(
|
||||
COALESCE(
|
||||
SUM(g.jh_qty * g.ht_dj),
|
||||
0
|
||||
),
|
||||
3
|
||||
) AS totalAmt
|
||||
FROM gys_jh g
|
||||
WHERE g.is_delete = '0'
|
||||
AND g.status = '0'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
'应出未出[全部未出]' AS type,
|
||||
COUNT(DISTINCT g.xm_no) AS projectCnt,
|
||||
COUNT(DISTINCT ri.xm_no) AS projectCnt,
|
||||
ROUND(
|
||||
COALESCE(
|
||||
SUM(g.real_qty),
|
||||
0
|
||||
),
|
||||
COALESCE(SUM(ri.real_qty), 0),
|
||||
3
|
||||
) AS totalQty,
|
||||
ROUND(
|
||||
COALESCE(
|
||||
SUM(g.real_qty * g.ht_dj),
|
||||
0
|
||||
),
|
||||
COALESCE(SUM(ri.real_qty * ri.ht_dj), 0),
|
||||
3
|
||||
) AS totalAmt
|
||||
FROM gys_jh g
|
||||
WHERE g.is_delete = '0'
|
||||
AND g.status = '1';
|
||||
FROM rk_info ri
|
||||
WHERE ri.is_delete = '0'
|
||||
AND ri.is_chuku = '0'
|
||||
AND TIMESTAMPDIFF(DAY, ri.operation_time, NOW()) > 30;
|
||||
|
||||
]]>
|
||||
</select>
|
||||
<select id="selectWarehouseSlotStat"
|
||||
resultType="com.zg.project.wisdom.domain.vo.WarehouseSlotStatVO">
|
||||
<![CDATA[
|
||||
<![CDATA[
|
||||
|
||||
SELECT
|
||||
p.warehouse_code AS cangkuCode,
|
||||
p.warehouse_name AS cangkuName,
|
||||
p.warehouse_code AS cangkuCode,
|
||||
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(DISTINCT CASE WHEN r.id IS NOT NULL THEN p.pcode END) AS unusedSlot
|
||||
COUNT(p.pcode) - COUNT(u.pcode) AS unusedSlot
|
||||
|
||||
FROM pcde_detail p
|
||||
LEFT JOIN rk_info r
|
||||
ON r.pcode = p.pcode
|
||||
AND r.cangku = p.warehouse_code
|
||||
AND r.is_delete = '0'
|
||||
AND r.is_chuku = '0'
|
||||
|
||||
LEFT JOIN (
|
||||
SELECT DISTINCT
|
||||
pcode,
|
||||
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'
|
||||
AND p.warehouse_name IS NOT NULL
|
||||
AND TRIM(p.warehouse_name) <> ''
|
||||
|
||||
GROUP BY p.warehouse_code, p.warehouse_name
|
||||
ORDER BY p.warehouse_code
|
||||
GROUP BY
|
||||
p.warehouse_code,
|
||||
p.warehouse_name
|
||||
|
||||
ORDER BY
|
||||
p.warehouse_code
|
||||
|
||||
]]>
|
||||
</select>
|
||||
</select>
|
||||
|
||||
<select id="selectStockAgeExport30"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockAgeExportVO">
|
||||
<![CDATA[
|
||||
|
||||
Reference in New Issue
Block a user