1.完善主榜单完成正向逻辑。

This commit is contained in:
xiaosuonian 2025-07-08 17:46:48 +08:00
parent 5777f1dae5
commit cfc8a92acb
11 changed files with 136 additions and 28 deletions

View File

@ -109,10 +109,10 @@ public class PoundmstController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('measurement/bill:poundmst:add')") @PreAuthorize("@ss.hasPermi('measurement/bill:poundmst:add')")
@Log(title = "主榜单信息", businessType = BusinessType.INSERT) @Log(title = "主榜单信息", businessType = BusinessType.INSERT)
@GetMapping(value = "/complete/{id}") @PostMapping(value = "/complete")
public AjaxResult complete(@PathVariable("id") String id) public AjaxResult complete(@RequestBody Poundmst poundmst)
{ {
return toAjax(poundmstService.completePoundmst(id)); return toAjax(poundmstService.completePoundmst(poundmst));
} }
/** /**

View File

@ -70,4 +70,8 @@ public interface PoundmstMapper extends BaseMapper<Poundmst>
* @return 结果 * @return 结果
*/ */
public int updateFidById(@Param("id")String id,@Param("fid")String fid); public int updateFidById(@Param("id")String id,@Param("fid")String fid);
public int completeBillMst(@Param("id")String id);
public int unCompleteBillMst(@Param("id")String id);
} }

View File

@ -56,10 +56,10 @@ public interface IPoundmstService extends IService<Poundmst>
/** /**
* 完成主榜单信息 * 完成主榜单信息
* *
* @param id 主榜单信息 * @param poundmst 主榜单信息
* @return 结果 * @return 结果
*/ */
public int completePoundmst(String id); public int completePoundmst(Poundmst poundmst);
/** /**
* 批量删除主榜单信息 * 批量删除主榜单信息
@ -78,6 +78,20 @@ public interface IPoundmstService extends IService<Poundmst>
*/ */
public int updateFidById(String id, String fid); public int updateFidById(String id, String fid);
/**
* 根据id进行单据状态完成
* @param id
* @return
*/
public int completeBillMst(String id);
/**
* 根据Id进行单据反完成
* @param id
* @return
*/
public int unCompleteBillMst(String id);
/** /**
* 删除主榜单信息信息 * 删除主榜单信息信息
* *

View File

@ -3,6 +3,7 @@ package com.ruoyi.bill.service.impl;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import com.ruoyi.bill.domain.PoundBill;
import com.ruoyi.webApi.ApiPostBack; import com.ruoyi.webApi.ApiPostBack;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -28,6 +29,8 @@ public class PoundmstServiceImpl extends ServiceImpl<PoundmstMapper, Poundmst> i
@Autowired @Autowired
private ApiPostBack apiPostBack; private ApiPostBack apiPostBack;
@Autowired
private PoundBillServiceImpl poundBillServiceImpl;
/** /**
* 查询主榜单信息 * 查询主榜单信息
@ -64,6 +67,7 @@ public class PoundmstServiceImpl extends ServiceImpl<PoundmstMapper, Poundmst> i
public int insertPoundmst(Poundmst poundmst) public int insertPoundmst(Poundmst poundmst)
{ {
poundmst.initAddFields(poundmst); poundmst.initAddFields(poundmst);
poundmst.setBllstt("1");
boolean save = save(poundmst); boolean save = save(poundmst);
if (save){ if (save){
return 1; return 1;
@ -103,15 +107,26 @@ public class PoundmstServiceImpl extends ServiceImpl<PoundmstMapper, Poundmst> i
} }
@Override @Override
public int completePoundmst(String id) { @Transactional(rollbackFor = Exception.class)
public int completePoundmst(Poundmst poundmst) {
String id = poundmst.getId();
String usrcode = poundmst.getUsrcode();
try { try {
//根据当前id查询下游的榜单信息如果存在非完成状态的数据则提示报错
PoundBill queryPoundBill = new PoundBill();
queryPoundBill.setAppliid(id);
queryPoundBill.setBillstate("1");
List<PoundBill> poundBills = poundBillServiceImpl.selectPoundBillList(queryPoundBill);
if (!poundBills.isEmpty()){
//下游还存在未完成的榜单不允许完成
throw new Exception("下游存在“未完成”的榜单,不允许完成。");
}
//推送星空 //推送星空
apiPostBack.makePoundmstFormData(id); apiPostBack.makePoundmstFormData(id);
//推送完成后将单据状态设置为完成 //推送完成后将单据状态设置为完成
completeBillMst(id);
}catch (Exception e){ }catch (Exception e){
throw new RuntimeException("主榜单:" + id + "推送星空时,出现异常:"+e.getMessage()); throw new RuntimeException("主榜单:" + usrcode + " 推送星空时,出现异常:"+e.getMessage());
} }
return 1; return 1;
} }
@ -137,7 +152,25 @@ public class PoundmstServiceImpl extends ServiceImpl<PoundmstMapper, Poundmst> i
*/ */
public int updateFidById(String id, String fid){ public int updateFidById(String id, String fid){
return poundmstMapper.updateFidById(id,fid); return poundmstMapper.updateFidById(id,fid);
}; }
/**
* 完成单据
* @param id
* @return
*/
public int completeBillMst(String id){
return poundmstMapper.completeBillMst(id);
}
/**
* 反完成单据
* @param id
* @return
*/
public int unCompleteBillMst(String id){
return poundmstMapper.unCompleteBillMst(id);
}
/** /**
* 删除主榜单信息信息 * 删除主榜单信息信息

View File

@ -326,6 +326,7 @@ public class ApiTask {
// 3. 保存 // 3. 保存
Poundmst poundmst = new Poundmst(); Poundmst poundmst = new Poundmst();
poundmst.setId(UUID.randomUUID().toString()); poundmst.setId(UUID.randomUUID().toString());
poundmst.setBllstt("1");//是否完成
poundmst.setBsndt(date); poundmst.setBsndt(date);
poundmst.setSrcbllid(billno); poundmst.setSrcbllid(billno);
poundmst.setItmname(materialName); poundmst.setItmname(materialName);
@ -361,6 +362,7 @@ public class ApiTask {
// 3. 保存过磅申请 // 3. 保存过磅申请
Poundmst poundmst = new Poundmst(); Poundmst poundmst = new Poundmst();
poundmst.setId(UUID.randomUUID().toString()); poundmst.setId(UUID.randomUUID().toString());
poundmst.setBllstt("1");//是否完成
poundmst.setBsndt(date); poundmst.setBsndt(date);
poundmst.setSrcbllid(billno); poundmst.setSrcbllid(billno);
poundmst.setFid(fid); poundmst.setFid(fid);

View File

@ -311,4 +311,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
set fid = #{fid} set fid = #{fid}
where id = #{id} where id = #{id}
</update> </update>
<update id="completeBillMst" parameterType="String">
update t_data_poundmst
set bllstt = '2'
where id = #{id}
</update>
<update id="unCompleteBillMst" parameterType="String">
update t_data_poundmst
set bllstt = '1'
where id = #{id}
</update>
</mapper> </mapper>

View File

@ -44,11 +44,12 @@ export function updatePoundmst(data) {
} }
// 查询主榜单信息详细 // 完成主榜单。
export function complete(id) { export function complete(data) {
return request({ return request({
url: '/measurement/bill/poundmst/complete/' + id, url: '/measurement/bill/poundmst/complete',
method: 'get' method: 'post',
data:data
}) })
} }

View File

@ -17,7 +17,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分 // axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API, baseURL: process.env.VUE_APP_BASE_API,
// 超时 // 超时
timeout: 10000 timeout: 20000
}) })
// request拦截器 // request拦截器

View File

@ -81,8 +81,8 @@
<el-form-item prop="sendunitid"> <el-form-item prop="sendunitid">
<el-checkbox <el-checkbox
v-model="queryPageParams.mstBill.bllstt" v-model="queryPageParams.mstBill.bllstt"
:true-value="'2'" :true-label="'2'"
:false-value="'1'" :false-label="'1'"
>完成</el-checkbox> >完成</el-checkbox>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -735,6 +735,7 @@ export default {
// //
mstBillFormData:{ mstBillFormData:{
selectedIds:[], selectedIds:[],
selectedUsrcodes:[],
mstBillForm:{}, mstBillForm:{},
mstBillRules:{}, mstBillRules:{},
mstBillTitle:"主榜单信息", mstBillTitle:"主榜单信息",
@ -858,9 +859,11 @@ export default {
handleMstSelectionChange(selection) { handleMstSelectionChange(selection) {
if (selection.length > 0){ if (selection.length > 0){
this.mstBillFormData.selectedIds = selection.map(item => item.id) this.mstBillFormData.selectedIds = selection.map(item => item.id)
this.mstBillFormData.selectedUsrcodes = selection.map(item => item.usrcode)
this.queryPoundBillDetailFirst(); this.queryPoundBillDetailFirst();
}else { }else {
this.mstBillFormData.selectedIds = []; this.mstBillFormData.selectedIds = [];
this.mstBillFormData.selectedUsrcodes = [];
} }
}, },
// //
@ -1190,7 +1193,19 @@ export default {
return; return;
} }
// //
await complete(this.mstBillFormData.selectedIds[0]) //
const data = {
id:this.mstBillFormData.selectedIds[0],
usrcode:this.mstBillFormData.selectedUsrcodes[0],
}
const res = await complete(data);
if (res.code === 200) {
this.$message.success("完成主榜单成功!");
//
this.handleSearchMstBillFirst();
} else {
this.$message.error("完成主榜单失败!");
}
}, },
//searchSelect //searchSelect

View File

@ -81,8 +81,8 @@
<el-form-item prop="sendunitid"> <el-form-item prop="sendunitid">
<el-checkbox <el-checkbox
v-model="queryPageParams.mstBill.bllstt" v-model="queryPageParams.mstBill.bllstt"
:true-value="'2'" :true-label="'2'"
:false-value="'1'" :false-label="'1'"
>完成</el-checkbox> >完成</el-checkbox>
</el-form-item> </el-form-item>
</el-col> </el-col>

View File

@ -53,6 +53,17 @@
<el-button type="primary" size="mini" @click="handleSearchMstBillFirst">查询</el-button> <el-button type="primary" size="mini" @click="handleSearchMstBillFirst">查询</el-button>
<el-button type="primary" size="mini" @click="handleSearchMstBillFirst">打印</el-button> <el-button type="primary" size="mini" @click="handleSearchMstBillFirst">打印</el-button>
</el-form-item> </el-form-item>
<el-row>
<el-col>
<el-form-item prop="sendunitid">
<el-checkbox
v-model="queryPageParams.mstBill.bllstt"
:true-label="'2'"
:false-label="'1'"
>完成</el-checkbox>
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<!-- 主磅单信息 --> <!-- 主磅单信息 -->
<el-card> <el-card>
@ -495,6 +506,7 @@ export default {
trnunitid:"",// trnunitid:"",//
sendunitid:"",// sendunitid:"",//
poundid:"",//,java poundid:"",//,java
bllstt:"1"
}, },
poundBillDetail: { poundBillDetail: {
total: 0, total: 0,
@ -521,6 +533,7 @@ export default {
// //
mstBillFormData:{ mstBillFormData:{
selectedIds:[], selectedIds:[],
selectedUsrcodes:[],
mstBillForm:{}, mstBillForm:{},
mstBillRules:{}, mstBillRules:{},
mstBillTitle:"主榜单信息", mstBillTitle:"主榜单信息",
@ -703,10 +716,12 @@ export default {
handleMstSelectionChange(selection) { handleMstSelectionChange(selection) {
if (selection.length > 0){ if (selection.length > 0){
this.mstBillFormData.selectedIds = selection.map(item => item.id) this.mstBillFormData.selectedIds = selection.map(item => item.id)
this.mstBillFormData.selectedUsrcodes = selection.map(item => item.usrcode)
var mstId = this.mstBillFormData.selectedIds[0]; var mstId = this.mstBillFormData.selectedIds[0];
this.queryPoundBillDetail(mstId); this.queryPoundBillDetail(mstId);
}else { }else {
this.mstBillFormData.selectedIds = []; this.mstBillFormData.selectedIds = [];
this.mstBillFormData.selectedUsrcodes = [];
} }
}, },
@ -969,7 +984,19 @@ export default {
return; return;
} }
// //
await complete(this.mstBillFormData.selectedIds[0]) //
const data = {
id:this.mstBillFormData.selectedIds[0],
usrcode:this.mstBillFormData.selectedUsrcodes[0],
}
const res = await complete(data);
if (res.code === 200) {
this.$message.success("完成主榜单成功!");
//
this.handleSearchMstBillFirst();
} else {
this.$message.error("完成主榜单失败!");
}
}, },
//searchSelect //searchSelect
buildCacheKey({ params, where, groupby = '', orderby = '' }) { buildCacheKey({ params, where, groupby = '', orderby = '' }) {