扫二维码签名;入库单号规则;
This commit is contained in:
+7
@@ -89,4 +89,11 @@ public interface ElectronicSignatureMapper extends BaseMapper<ElectronicSignatur
|
|||||||
+ " AND DEL_FLAG = 1"
|
+ " AND DEL_FLAG = 1"
|
||||||
+ "</script>")
|
+ "</script>")
|
||||||
List<ElectronicSignature> selectBySignatureIds(@Param("signatureIds") List<Long> signatureIds);
|
List<ElectronicSignature> selectBySignatureIds(@Param("signatureIds") List<Long> signatureIds);
|
||||||
|
|
||||||
|
|
||||||
|
@Update("UPDATE NGWL_TEST_WMS.STOCK_IN_ORDER SET SIGNATURE_STATUS = 2,SIGNATURE_TIME =now() WHERE IN_ORDER_ID = #{id}")
|
||||||
|
int updateIn( @Param("id") Long id);
|
||||||
|
|
||||||
|
@Update("UPDATE NGWL_TEST_WMS.STOCK_OUT_ORDER SET SIGNATURE_STATUS = 2,SIGNATURE_TIME =now() WHERE OUT_ORDER_ID = #{id}")
|
||||||
|
int updateOut(@Param("id") Long id);
|
||||||
}
|
}
|
||||||
+23
-1
@@ -95,8 +95,30 @@ public class ElectronicSignatureDomainService {
|
|||||||
* 4. 若不存在,新增主表+明细
|
* 4. 若不存在,新增主表+明细
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean updateSignature(ElectronicSignatureDO electronicSignatureDO) {
|
public Boolean inQqcode(ElectronicSignatureDO electronicSignatureDO) {
|
||||||
Long orderId = electronicSignatureDO.getOrderId();
|
Long orderId = electronicSignatureDO.getOrderId();
|
||||||
|
ElectronicSignature existing = electronicSignatureService.getById(orderId);
|
||||||
|
if (existing != null) {
|
||||||
|
existing.setSignatureTime(new Date()); // 设置签名时间
|
||||||
|
existing.setSignatureStatus(2); // 设置签名状态为已签名
|
||||||
|
existing.setSignatureMode(1); // 设置签名方式为1-二维码
|
||||||
|
electronicSignatureService.updateById(existing);
|
||||||
|
electronicSignatureMapper.updateIn(existing.getOrderId());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean outQqcode(ElectronicSignatureDO electronicSignatureDO) {
|
||||||
|
Long orderId = electronicSignatureDO.getOrderId();
|
||||||
|
ElectronicSignature existing = electronicSignatureService.getById(orderId);
|
||||||
|
if (existing != null) {
|
||||||
|
existing.setSignatureTime(new Date()); // 设置签名时间
|
||||||
|
existing.setSignatureStatus(2); // 设置签名状态为已签名
|
||||||
|
existing.setSignatureMode(1); // 设置签名方式为1-二维码
|
||||||
|
electronicSignatureService.updateById(existing);
|
||||||
|
electronicSignatureMapper.updateOut(existing.getOrderId());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
@@ -77,4 +77,12 @@ public interface ReserveStockInOrderMapper extends BaseMapper<ReserveStockInOrde
|
|||||||
* 根据入库单号精确统计(导入防重用)
|
* 根据入库单号精确统计(导入防重用)
|
||||||
*/
|
*/
|
||||||
int countByInOrderNumber(@Param("inOrderNumber") String inOrderNumber);
|
int countByInOrderNumber(@Param("inOrderNumber") String inOrderNumber);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跨4张入库单表查询指定前缀+组织+仓库的所有入库单号(用于取最大序号+1,防止删单后单号重复)
|
||||||
|
* 包含: reserve_stock_in_order, reservation_stock_in_order, execution_stock_in_order, WMS stock_in_order
|
||||||
|
*/
|
||||||
|
List<String> getMaxStockInOrderByPrefixAndOrgAndWarehouse(@Param("prefix") String prefix,
|
||||||
|
@Param("organizationId") Long organizationId,
|
||||||
|
@Param("warehouseId") Long warehouseId);
|
||||||
}
|
}
|
||||||
+59
-1
@@ -104,7 +104,35 @@ public class ReserveStockInOrderDomainService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean insert(ReserveStockInOrderDO stockInOrderDO) {
|
public Boolean insert(ReserveStockInOrderDO stockInOrderDO) {
|
||||||
if (stockInOrderDO.getInOrderNumber() == null) {
|
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||||
stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
Long warehouseId = stockInOrderDO.getWarehouseId();
|
||||||
|
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||||
|
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||||
|
throw new ServiceException("获取仓库信息失败");
|
||||||
|
}
|
||||||
|
//仓库信息
|
||||||
|
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||||
|
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||||
|
String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||||
|
if (prefix == null || prefix.isEmpty()) {
|
||||||
|
prefix = "RK";
|
||||||
|
}
|
||||||
|
Long organizationId = stockInOrderDO.getOrganizationId();
|
||||||
|
Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
||||||
|
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||||
|
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||||
|
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||||
|
String datePrefix = prefix + dateStr;
|
||||||
|
List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||||
|
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||||
|
String seq = String.format("%03d", maxSeq + 1);
|
||||||
|
stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
||||||
|
} else {
|
||||||
|
//历史累加: 前缀 + 历史最大序号+1
|
||||||
|
List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||||
|
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||||
|
String seq = String.format("%03d", maxSeq + 1);
|
||||||
|
stockInOrderDO.setInOrderNumber(prefix + seq);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// //设置默认值
|
// //设置默认值
|
||||||
// setDefaultValues(stockInOrderDO);
|
// setDefaultValues(stockInOrderDO);
|
||||||
@@ -993,4 +1021,34 @@ public class ReserveStockInOrderDomainService {
|
|||||||
return prefix + seq;
|
return prefix + seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从单号列表中提取最大序号
|
||||||
|
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||||
|
* 即使中间有删单,也能保证序号递增不重复
|
||||||
|
*
|
||||||
|
* @param orderNumbers 匹配的单号列表
|
||||||
|
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||||
|
* @return 最大序号值,列表为空时返回0
|
||||||
|
*/
|
||||||
|
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||||
|
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int maxSeq = 0;
|
||||||
|
for (String orderNumber : orderNumbers) {
|
||||||
|
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||||
|
try {
|
||||||
|
String seqStr = orderNumber.substring(prefixLength);
|
||||||
|
int seq = Integer.parseInt(seqStr);
|
||||||
|
if (seq > maxSeq) {
|
||||||
|
maxSeq = seq;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// 序号部分非数字,跳过
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maxSeq;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+17
-4
@@ -59,12 +59,25 @@ public class ElectronicSignatureApi extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 保存电子签名记录(WMS端Feign调用)
|
* 保存电子签名记录(WMS端Feign调用)
|
||||||
*/
|
*/
|
||||||
@ApiOperation("保存电子签名记录")
|
@ApiOperation("二维码签名")
|
||||||
@PostMapping("/updateSignature")
|
@PostMapping("/inQqcode")
|
||||||
public AjaxResult updateSignature(@RequestBody ElectronicSignatureSaveDTO saveDTO) {
|
public AjaxResult inQqcode(@RequestBody ElectronicSignatureSaveDTO saveDTO) {
|
||||||
try {
|
try {
|
||||||
ElectronicSignatureDO signatureDO = toDO(saveDTO);
|
ElectronicSignatureDO signatureDO = toDO(saveDTO);
|
||||||
electronicSignatureDomainService.updateSignature(signatureDO);
|
electronicSignatureDomainService.inQqcode(signatureDO);
|
||||||
|
return AjaxResult.success("电子签名记录保存成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("保存电子签名记录失败", e);
|
||||||
|
return AjaxResult.error("保存电子签名记录失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("二维码签名")
|
||||||
|
@PostMapping("/outQqcode")
|
||||||
|
public AjaxResult outQqcode(@RequestBody ElectronicSignatureSaveDTO saveDTO) {
|
||||||
|
try {
|
||||||
|
ElectronicSignatureDO signatureDO = toDO(saveDTO);
|
||||||
|
electronicSignatureDomainService.outQqcode(signatureDO);
|
||||||
return AjaxResult.success("电子签名记录保存成功");
|
return AjaxResult.success("电子签名记录保存成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("保存电子签名记录失败", e);
|
log.error("保存电子签名记录失败", e);
|
||||||
|
|||||||
@@ -831,4 +831,53 @@
|
|||||||
WHERE in_order_number = #{inOrderNumber}
|
WHERE in_order_number = #{inOrderNumber}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 跨4张入库单表查询指定前缀+组织+仓库的所有入库单号(取最大序号+1,防止删单后单号重复) -->
|
||||||
|
<select id="getMaxStockInOrderByPrefixAndOrgAndWarehouse" resultType="java.lang.String">
|
||||||
|
SELECT in_order_number FROM reserve_stock_in_order
|
||||||
|
WHERE in_order_number LIKE concat(#{prefix}, '%')
|
||||||
|
AND del_flag = 1
|
||||||
|
<if test="organizationId != null">
|
||||||
|
AND organization_id = #{organizationId}
|
||||||
|
</if>
|
||||||
|
<if test="warehouseId != null">
|
||||||
|
AND warehouse_id = #{warehouseId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT in_order_number FROM reservation_stock_in_order
|
||||||
|
WHERE in_order_number LIKE concat(#{prefix}, '%')
|
||||||
|
AND del_flag = 1
|
||||||
|
<if test="organizationId != null">
|
||||||
|
AND organization_id = #{organizationId}
|
||||||
|
</if>
|
||||||
|
<if test="warehouseId != null">
|
||||||
|
AND warehouse_id = #{warehouseId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT in_order_number FROM execution_stock_in_order
|
||||||
|
WHERE in_order_number LIKE concat(#{prefix}, '%')
|
||||||
|
AND del_flag = 1
|
||||||
|
<if test="organizationId != null">
|
||||||
|
AND organization_id = #{organizationId}
|
||||||
|
</if>
|
||||||
|
<if test="warehouseId != null">
|
||||||
|
AND warehouse_id = #{warehouseId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT in_order_number FROM NGWL_TEST_WMS.stock_in_order
|
||||||
|
WHERE in_order_number LIKE concat(#{prefix}, '%')
|
||||||
|
AND del_flag = 1
|
||||||
|
<if test="organizationId != null">
|
||||||
|
AND organization_id = #{organizationId}
|
||||||
|
</if>
|
||||||
|
<if test="warehouseId != null">
|
||||||
|
AND warehouse_id = #{warehouseId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user