二级系统联合寻找数据

This commit is contained in:
2026-02-03 16:11:02 +08:00
parent b04360b770
commit 17016c8177
9 changed files with 202 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
package com.klp.pocket.acid.controller;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.R;
import com.klp.pocket.acid.domain.vo.AcidTypingPrefillVo;
import com.klp.pocket.acid.service.IAcidTypingService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RequiredArgsConstructor
@RestController
@RequestMapping("/pocket/acidTyping")
public class AcidTypingController extends BaseController {
private final IAcidTypingService acidTypingService;
@GetMapping("/prefill")
public R<AcidTypingPrefillVo> getTypingPrefill(@RequestParam String currentCoilNo) {
AcidTypingPrefillVo vo = acidTypingService.getTypingPrefillByCurrentCoilNo(currentCoilNo);
return R.ok(vo);
}
}

View File

@@ -0,0 +1,27 @@
package com.klp.pocket.acid.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 酸连轧工序typing页面表单预填数据
*/
@Data
public class AcidTypingPrefillVo {
/** 当前钢卷号来自klptcm1_pdo_excoil.encoilid */
private String currentCoilNo;
/** 出口卷号klptcm1_pdo_excoil.excoilid */
private String excoilId;
/** 出口重量t */
private BigDecimal exitWeight;
/** 出口长度m */
private BigDecimal exitLength;
/** 班组格式shift-crew例如甲-A */
private String team;
}

View File

@@ -0,0 +1,12 @@
package com.klp.pocket.acid.mapper;
import com.klp.pocket.acid.domain.vo.AcidTypingPrefillVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface AcidTypingMapper {
AcidTypingPrefillVo selectTypingPrefillByEncoilId(@Param("encoilId") String encoilId);
}

View File

@@ -0,0 +1,9 @@
package com.klp.pocket.acid.service;
import com.klp.pocket.acid.domain.vo.AcidTypingPrefillVo;
public interface IAcidTypingService {
AcidTypingPrefillVo getTypingPrefillByCurrentCoilNo(String currentCoilNo);
}

View File

@@ -0,0 +1,22 @@
package com.klp.pocket.acid.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.klp.pocket.acid.domain.vo.AcidTypingPrefillVo;
import com.klp.pocket.acid.mapper.AcidTypingMapper;
import com.klp.pocket.acid.service.IAcidTypingService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@RequiredArgsConstructor
@DS("acid")
@Service
public class AcidTypingServiceImpl implements IAcidTypingService {
private final AcidTypingMapper acidTypingMapper;
@Override
public AcidTypingPrefillVo getTypingPrefillByCurrentCoilNo(String currentCoilNo) {
return acidTypingMapper.selectTypingPrefillByEncoilId(currentCoilNo);
}
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.klp.pocket.acid.mapper.AcidTypingMapper">
<select id="selectTypingPrefillByEncoilId" resultType="com.klp.pocket.acid.domain.vo.AcidTypingPrefillVo">
SELECT
e.ENCOILID AS currentCoilNo,
e.EXCOILID AS excoilId,
e.EXIT_WEIGHT AS exitWeight,
NULL AS exitLength,
CONCAT(e.SHIFT, '-', e.CREW) AS team
FROM klptcm1_pdo_excoil e
WHERE e.ENCOILID = #{encoilId}
ORDER BY e.INSDATE DESC
LIMIT 1
</select>
</mapper>

View File

@@ -0,0 +1,10 @@
import request from '@/utils/request'
export function getAcidTypingPrefill(currentCoilNo) {
return request({
url: '/pocket/acidTyping/prefill',
method: 'get',
params: { currentCoilNo }
})
}

View File

@@ -832,11 +832,14 @@ export default {
}
// 跳转并传递参数
const currentActionTypeLabel = this.$route?.query?.actionType
this.$router.push({
path: path,
query: {
coilId: row.coilId,
actionId: row.actionId
actionId: row.actionId,
...(currentActionTypeLabel ? { actionType: currentActionTypeLabel } : {})
}
})
}).catch(error => {

View File

@@ -12,6 +12,15 @@
</div>
</div>
<el-alert
v-if="acidPrefill.visible"
:title="acidPrefill.title"
:type="acidPrefill.type"
:closable="false"
show-icon
style="margin-bottom: 20px;"
/>
<!-- 主内容区 - 左右布局 -->
<div class="content-wrapper">
<!-- 左侧当前信息 -->
@@ -255,6 +264,7 @@ import { completeAction } from '@/api/wms/pendingAction';
import { listWarehouse } from '@/api/wms/warehouse';
import { listRawMaterialWithBom } from '@/api/wms/rawMaterial';
import { listProductWithBom } from '@/api/wms/product';
import { getAcidTypingPrefill } from '@/api/pocket/acidTyping';
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
import ProductSelect from "@/components/KLPService/ProductSelect";
@@ -358,6 +368,12 @@ export default {
warehouseList: [],
historySteps: [],
actionId: null,
acidPrefill: {
visible: false,
type: 'info',
title: ''
},
isAcidRolling: false,
// 原材料和产品列表(实时搜索,不再保存完整备份)
rawMaterialList: [],
productList: [],
@@ -411,10 +427,67 @@ export default {
// 从路由参数获取coilId和actionId
const coilId = this.$route.query.coilId;
const actionId = this.$route.query.actionId;
const actionType = this.$route.query.actionType;
const readonly = this.$route.query.readonly;
this.isAcidRolling = actionType === '酸连轧工序'
if (this.isAcidRolling) {
this.acidPrefill.visible = true
this.acidPrefill.type = 'info'
this.acidPrefill.title = '正在结合酸轧二级系统自动填写部分信息...'
}
if (coilId) {
await this.loadCoilInfo(coilId);
if (this.isAcidRolling) {
const currentCoilNo = this.currentInfo && this.currentInfo.currentCoilNo
console.log('[typing] acid rolling actionType detected, will call prefill API with currentCoilNo (encoilid)=', currentCoilNo)
if (!currentCoilNo) {
this.acidPrefill.type = 'warning'
this.acidPrefill.title = '当前钢卷号为空'
} else {
try {
const prefillRes = await getAcidTypingPrefill(currentCoilNo)
const prefill = prefillRes && prefillRes.data
if (!prefill) {
this.acidPrefill.type = 'info'
this.acidPrefill.title = '未在二级系统中查找到对应信息,请自行填写'
} else {
if (prefill.exitWeight != null && prefill.exitWeight !== '') {
const w = Number(prefill.exitWeight)
if (!Number.isNaN(w)) {
this.$set(this.updateForm, 'grossWeight', w)
this.$set(this.updateForm, 'netWeight', w)
}
}
if (prefill.exitLength != null && prefill.exitLength !== '') {
const len = Number(prefill.exitLength)
if (!Number.isNaN(len)) {
this.$set(this.updateForm, 'length', len)
}
}
if (prefill.team) {
this.$set(this.updateForm, 'team', prefill.team)
}
this.acidPrefill.type = 'success'
this.acidPrefill.title = '已结合酸轧二级系统完成部分信息填写'
console.log('[typing] acid rolling prefill applied:', prefill)
}
} catch (e) {
console.error('[typing] acid rolling prefill request failed:', e)
this.acidPrefill.type = 'error'
this.acidPrefill.title = '未在二级系统中查找到对应信息,故自动填写失败'
}
}
}
}
if (actionId) {