盘点内容以及单据号规则
This commit is contained in:
@@ -1,17 +1,22 @@
|
|||||||
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.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.inventory.domain.vo.RkInventoryExportVO;
|
||||||
import com.zg.project.wisdom.domain.RkInfo;
|
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 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.BeanUtils;
|
||||||
@@ -36,7 +41,8 @@ public class InventoryMatchScanController extends BaseController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRkInfoService rkInfoService;
|
private IRkInfoService rkInfoService;
|
||||||
|
@Autowired
|
||||||
|
private RkInfoMapper rkInfoMapper;
|
||||||
/**
|
/**
|
||||||
* 分页查询盘点结果
|
* 分页查询盘点结果
|
||||||
* @param matchScan
|
* @param matchScan
|
||||||
@@ -142,4 +148,27 @@ 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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -172,4 +172,8 @@ public interface RkInfoMapper
|
|||||||
|
|
||||||
|
|
||||||
List<RkInfo> listRkInfoByPcodes(ArrayList<String> strings);
|
List<RkInfo> listRkInfoByPcodes(ArrayList<String> strings);
|
||||||
|
/**
|
||||||
|
* 查询今日最大单号
|
||||||
|
* */
|
||||||
|
String selectTodayMaxBillNo(String prefix, String date);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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());
|
||||||
|
|
||||||
@@ -541,7 +541,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());
|
||||||
|
|
||||||
|
|||||||
@@ -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位随机数
|
||||||
|
|||||||
@@ -605,10 +605,34 @@
|
|||||||
|
|
||||||
<select id="getByWarehouseAndScene" resultMap="RkInfoResult">
|
<select id="getByWarehouseAndScene" resultMap="RkInfoResult">
|
||||||
SELECT
|
SELECT
|
||||||
ri.*
|
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
|
FROM rk_info ri
|
||||||
JOIN pcde_detail pd
|
LEFT JOIN stock_in_type sit ON ri.operation_type = sit.type_code
|
||||||
ON pd.pcode = ri.pcode
|
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
|
WHERE ri.exec_status = 1
|
||||||
AND ri.is_delete = '0'
|
AND ri.is_delete = '0'
|
||||||
AND ri.is_chuku = '0'
|
AND ri.is_chuku = '0'
|
||||||
@@ -630,5 +654,9 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTodayMaxBillNo" resultType="java.lang.String">
|
||||||
|
SELECT MAX(bill_no)
|
||||||
|
FROM rk_info
|
||||||
|
WHERE bill_no LIKE CONCAT(#{prefix}, #{date}, '%')
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user