添加 出库单据出口选择 盘点单据粗口选择功能
This commit is contained in:
@@ -11,6 +11,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.bas.BasProduct.domain.BasProduct;
|
||||
import com.ruoyi.bas.BasProduct.service.IBasProductService;
|
||||
import com.ruoyi.bas.basJobId.service.IBasJobIdService;
|
||||
@@ -102,24 +103,30 @@ public class CheckStockinServiceImpl implements ICheckStockinService
|
||||
public AjaxResult updateCheckStockin(CheckStockin checkStockin)
|
||||
{
|
||||
CheckStockin old = selectCheckStockinByStockGuid(checkStockin.getStockGuid());
|
||||
checkStockinMapper.updateCheckStockin(checkStockin);
|
||||
if ("5".equals(checkStockin.getStatus())){
|
||||
//作废
|
||||
if (!"1".equals(old.getStatus())){
|
||||
throw new RuntimeException("单据状态非未执行状态!");
|
||||
return AjaxResult.error("单据状态非未执行状态!");
|
||||
}
|
||||
checkStockinMapper.updateCheckStockin(checkStockin);
|
||||
//插入历史单据
|
||||
insertCheckStockinHistory(checkStockin);
|
||||
}else if ("2".equals(checkStockin.getStatus())){
|
||||
if (StrUtil.isEmpty(checkStockin.getSpare1())){
|
||||
return AjaxResult.error("请选择出口!");
|
||||
}
|
||||
//审核
|
||||
if (!"1".equals(old.getStatus())){
|
||||
throw new RuntimeException("单据状态非未执行状态!");
|
||||
return AjaxResult.error("单据状态非未执行状态!");
|
||||
}
|
||||
checkStockinMapper.updateCheckStockin(checkStockin);
|
||||
|
||||
}else if ("4".equals(checkStockin.getStatus())){
|
||||
//确认
|
||||
if (!"3".equals(old.getStatus())){
|
||||
throw new RuntimeException("单据状态非正执行状态!");
|
||||
return AjaxResult.error("单据状态非正执行状态!");
|
||||
}
|
||||
checkStockinMapper.updateCheckStockin(checkStockin);
|
||||
insertCheckStockinHistory(checkStockin);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
|
||||
@@ -124,11 +124,16 @@ public class OutStockoutController extends BaseController {
|
||||
@Log(title = "出库主单状态改变", businessType = BusinessType.OTHER)
|
||||
@RequestMapping("/changeStatus")
|
||||
@ResponseBody
|
||||
public String changeStatus(@RequestParam("stockoutIds") String[] stockoutIds, @RequestParam("status") String status,@RequestParam("newStatus")String newStatus) {
|
||||
String s = outStockoutService.updateOutStockoutStatus(stockoutIds, status, newStatus);
|
||||
public String changeStatus(@RequestParam("stockoutIds") String[] stockoutIds, @RequestParam("status") String status,@RequestParam("newStatus")String newStatus,@RequestParam(value = "exitId",required = false)String exitId) {
|
||||
String s = outStockoutService.updateOutStockoutStatus(stockoutIds, status, newStatus,exitId);
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动出库
|
||||
* @param stockoutId
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('out:outStockout:autoAllot')")
|
||||
@Log(title = "出库单自动分配", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/autoAllot")
|
||||
|
||||
@@ -8,15 +8,15 @@ import com.ruoyi.out.outStockout.domain.OutStockoutVo;
|
||||
|
||||
/**
|
||||
* 出库主单Service接口
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-20
|
||||
*/
|
||||
public interface IOutStockoutService
|
||||
public interface IOutStockoutService
|
||||
{
|
||||
/**
|
||||
* 查询出库主单
|
||||
*
|
||||
*
|
||||
* @param stockoutGuid 出库主单主键
|
||||
* @return 出库主单
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ public interface IOutStockoutService
|
||||
|
||||
/**
|
||||
* 查询出库主单列表
|
||||
*
|
||||
*
|
||||
* @param outStockout 出库主单
|
||||
* @return 出库主单集合
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ public interface IOutStockoutService
|
||||
|
||||
/**
|
||||
* 新增出库主单
|
||||
*
|
||||
*
|
||||
* @param outStockout 出库主单
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ public interface IOutStockoutService
|
||||
|
||||
/**
|
||||
* 修改出库主单
|
||||
*
|
||||
*
|
||||
* @param outStockout 出库主单
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -48,7 +48,7 @@ public interface IOutStockoutService
|
||||
|
||||
/**
|
||||
* 批量删除出库主单
|
||||
*
|
||||
*
|
||||
* @param stockoutGuids 需要删除的出库主单主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ public interface IOutStockoutService
|
||||
|
||||
/**
|
||||
* 删除出库主单信息
|
||||
*
|
||||
*
|
||||
* @param stockoutGuid 出库主单主键
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -66,7 +66,7 @@ public interface IOutStockoutService
|
||||
*/
|
||||
public String saveBill(OutStockoutVo outStockoutVo);
|
||||
|
||||
public String updateOutStockoutStatus(String[] stockoutIds, String status,String newStatus);
|
||||
public String updateOutStockoutStatus(String[] stockoutIds, String status,String newStatus,String exitId);
|
||||
|
||||
AjaxResult autoAllot(String stockoutId);
|
||||
}
|
||||
|
||||
@@ -142,13 +142,14 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateOutStockoutStatus(String[] stockoutIds, String status, String newStatus) {
|
||||
public String updateOutStockoutStatus(String[] stockoutIds, String status, String newStatus,String exitId) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for(String stockoutId:stockoutIds){
|
||||
map.put("outStockId",stockoutId);
|
||||
map.put("status",status);
|
||||
map.put("newStatus",newStatus);
|
||||
map.put("exitId",exitId);
|
||||
outStockoutMapper.updateOutStockoutStatus(map);
|
||||
stringBuilder.append(",").append(map.get("v_resultString"));
|
||||
}
|
||||
|
||||
@@ -152,6 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{outStockId,mode=IN,jdbcType=VARCHAR},
|
||||
#{status,mode=IN,jdbcType=VARCHAR},
|
||||
#{newStatus,mode=IN,jdbcType=VARCHAR},
|
||||
#{exitId,mode=IN,jdbcType=VARCHAR},
|
||||
#{v_result,mode=OUT,jdbcType=VARCHAR},
|
||||
#{v_resultString,mode=OUT,jdbcType=VARCHAR}
|
||||
)
|
||||
|
||||
@@ -50,6 +50,9 @@ export function getOutStockoutDetail(query) {
|
||||
if (params.newStatus) {
|
||||
searchParams.append('newStatus', params.newStatus);
|
||||
}
|
||||
if (params.exitId) {
|
||||
searchParams.append('exitId', params.exitId);
|
||||
}
|
||||
return request({
|
||||
url: '/out/outStockout/changeStatus?' + searchParams.toString(),
|
||||
method: 'get'
|
||||
|
||||
@@ -267,6 +267,11 @@ export default {
|
||||
inputProductName:'Please input product name',
|
||||
selectStartDate: 'Please input start date',
|
||||
selectFinishDate: 'Please input finish date',
|
||||
auditTitle:'auditTitle',
|
||||
selectExit:'selectExit',
|
||||
pleaseSelectExit:'pleaseSelectExit',
|
||||
confirmExit:'confirm',
|
||||
cancelExit:'cancel',
|
||||
|
||||
},
|
||||
// ***************新建出库单据**************
|
||||
|
||||
@@ -264,6 +264,12 @@ export default {
|
||||
inputProductName:'请输入物资名称',
|
||||
selectStartDate: '请选择创建开始时间',
|
||||
selectFinishDate: '请选择创建结束时间',
|
||||
auditTitle:'单据审核',
|
||||
selectExit:'出口',
|
||||
pleaseSelectExit:'请选择出口',
|
||||
confirmExit:'提交',
|
||||
cancelExit:'取消',
|
||||
|
||||
},
|
||||
productAndStock: {
|
||||
serialNumber: '序号',
|
||||
|
||||
@@ -250,6 +250,26 @@
|
||||
:limit.sync="queryDetailParams.pageSize"
|
||||
@pagination="getDetailList"
|
||||
/>
|
||||
|
||||
<!-- 审核弹窗 -->
|
||||
<el-dialog title="$t('outStockoutManage.auditTitle')" :visible.sync="auditDialogVisible" width="500px" append-to-body>
|
||||
<el-form ref="auditForm" :model="auditForm" :rules="auditRules" label-width="100px">
|
||||
<el-form-item label="$t('outStockoutManage.selectExit')" prop="exitId">
|
||||
<el-select v-model="auditForm.exitId" placeholder="$t('outStockoutManage.pleaseSelectExit')" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in exitOptions"
|
||||
:key="item.exitId"
|
||||
:label="item.exitName"
|
||||
:value="item.exitId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelAudit">{{$t('outStockoutManage.confirmExit')}}</el-button>
|
||||
<el-button type="primary" @click="submitAudit">{{$t('outStockoutManage.cancelExit')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -293,6 +313,40 @@ export default {
|
||||
stockCheckDetailList: [],
|
||||
// 选中数据
|
||||
selectedRows: [],
|
||||
// 审核弹窗显示状态
|
||||
auditDialogVisible: false,
|
||||
// 审核表单数据
|
||||
auditForm: {
|
||||
exitId: null
|
||||
},
|
||||
// 审核表单验证规则
|
||||
auditRules: {
|
||||
exitId: [
|
||||
{ required: true, message: '请选择出口', trigger: 'change' }
|
||||
]
|
||||
},
|
||||
// 出口选项(动态设置)
|
||||
exitOptions: [],
|
||||
// 所有出口数据(按仓库ID分组)
|
||||
allExitOptions: {
|
||||
'02': [
|
||||
{ exitId: "G1004", exitName: 'G1004' },
|
||||
{ exitId: 'G1010', exitName: 'G1010' },
|
||||
{ exitId: 'fluent1', exitName: 'fluent1' },
|
||||
{ exitId: 'fluent2', exitName: 'fluent2' },
|
||||
],
|
||||
'13': [
|
||||
{ exitId: 'G2001', exitName: 'G2001' },
|
||||
{ exitId: 'G3001', exitName: 'G3001' },
|
||||
{ exitId: 'G3010', exitName: 'G3010' },
|
||||
{ exitId: 'G4001', exitName: 'G4001' },
|
||||
{ exitId: 'G4010', exitName: 'G4010' },
|
||||
{ exitId: 'G5001', exitName: 'G5001' },
|
||||
{ exitId: 'G5010', exitName: 'G5010' },
|
||||
]
|
||||
},
|
||||
// 当前审核的单据
|
||||
currentAuditStock: null,
|
||||
// 明细查询参数
|
||||
queryDetailParams: {
|
||||
pageNum: 1,
|
||||
@@ -305,7 +359,7 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
stockCheckId: null,
|
||||
checkType: '1',
|
||||
checkType: null,
|
||||
createDate: null,
|
||||
createManId: null,
|
||||
status: '1',
|
||||
@@ -486,14 +540,13 @@ export default {
|
||||
return
|
||||
}
|
||||
if (stockCheck.status === "1") {
|
||||
let data = {
|
||||
"stockGuid": stockCheck.stockGuid,
|
||||
"status": "2"
|
||||
}
|
||||
updateStockCheck(data).then(response => {
|
||||
this.$modal.msgSuccess(this.$t('checkStockCheck.reviewSuccess'))
|
||||
this.getList()
|
||||
})
|
||||
// 保存当前审核的单据
|
||||
this.currentAuditStock = stockCheck
|
||||
// 根据单据的仓库ID设置出口选项
|
||||
this.setExitOptionsByWarehouse(stockCheck.warehouseId)
|
||||
// 显示审核弹窗
|
||||
this.auditDialogVisible = true
|
||||
this.auditForm.exitId = null
|
||||
} else {
|
||||
this.$modal.msgError(this.$t('checkStockCheck.onlyUnreviewedCanReview'))
|
||||
}
|
||||
@@ -527,6 +580,68 @@ export default {
|
||||
this.$modal.msgSuccess(this.$t('checkStockCheck.autoAllocationSuccess'))
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
|
||||
/** 根据仓库ID设置出口选项 */
|
||||
setExitOptionsByWarehouse(warehouseId) {
|
||||
try {
|
||||
console.log('设置出口选项,仓库ID:', warehouseId)
|
||||
|
||||
// 如果没有有效的仓库ID,清空出口选项
|
||||
if (!warehouseId) {
|
||||
this.exitOptions = []
|
||||
console.warn('没有找到有效的仓库ID,已清空出口选项')
|
||||
return
|
||||
}
|
||||
|
||||
// 根据仓库ID获取对应的出口选项
|
||||
this.exitOptions = this.allExitOptions[warehouseId] || []
|
||||
|
||||
// 如果没有对应key的默认为空数组,并给出提示
|
||||
if (!this.allExitOptions[warehouseId]) {
|
||||
console.warn(`仓库ID ${warehouseId} 没有配置出口选项,已设置为空数组`)
|
||||
}
|
||||
|
||||
console.log('可用出口:', this.exitOptions)
|
||||
|
||||
// 如果最终没有可用的出口选项,给出提示
|
||||
if (this.exitOptions.length === 0) {
|
||||
//console.warn('当前仓库没有可用的出口选项')
|
||||
this.exitOptions=[{exitId: '0', exitName: '人工出口'}]
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('设置出口选项时发生错误:', error)
|
||||
// 发生错误时,设置为空数组,确保不会影响用户操作
|
||||
this.exitOptions = []
|
||||
}
|
||||
},
|
||||
|
||||
/** 提交审核 */
|
||||
submitAudit() {
|
||||
this.$refs["auditForm"].validate(valid => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
"stockGuid": this.currentAuditStock.stockGuid,
|
||||
"status": "2",
|
||||
"spare1": this.auditForm.exitId // 将选择的出口数据放入spare1字段
|
||||
}
|
||||
console.log('审核数据(含出口信息):', data)
|
||||
|
||||
updateStockCheck(data).then(response => {
|
||||
this.$modal.msgSuccess(this.$t('checkStockCheck.reviewSuccess'))
|
||||
this.auditDialogVisible = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** 取消审核 */
|
||||
cancelAudit() {
|
||||
this.auditDialogVisible = false
|
||||
this.auditForm.exitId = null
|
||||
this.currentAuditStock = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +195,26 @@
|
||||
:limit.sync="detailQueryParams.pageSize"
|
||||
@pagination="getDetailList"
|
||||
/>
|
||||
|
||||
<!-- 审核弹窗 -->
|
||||
<el-dialog :title="$t('outStockoutManage.auditTitle')" :visible.sync="auditDialogVisible" width="400px" append-to-body>
|
||||
<el-form ref="auditForm" :model="auditForm" :rules="auditRules" label-width="80px">
|
||||
<el-form-item :label="$t('outStockoutManage.selectExit')" prop="exitId">
|
||||
<el-select v-model="auditForm.exitId" :placeholder="$t('outStockoutManage.pleaseSelectExit')" clearable>
|
||||
<el-option
|
||||
v-for="item in exitOptions"
|
||||
:key="item.exitId"
|
||||
:label="item.exitName"
|
||||
:value="item.exitId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitAudit">{{$t('outStockoutManage.confirmExit')}}</el-button>
|
||||
<el-button @click="cancelAudit">{{$t('outStockoutManage.cancelExit')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -222,6 +242,40 @@ export default {
|
||||
outStockDetailList: [],
|
||||
// 选中数据
|
||||
selectedRows: [],
|
||||
// 审核弹窗显示状态
|
||||
auditDialogVisible: false,
|
||||
// 审核表单数据
|
||||
auditForm: {
|
||||
exitId: null
|
||||
},
|
||||
// 审核表单验证规则
|
||||
auditRules: {
|
||||
exitId: [
|
||||
{ required: true, message: '请选择出口', trigger: 'change' }
|
||||
]
|
||||
},
|
||||
// 出口选项
|
||||
exitOptions: [],
|
||||
// 所有出口数据(按仓库ID分组)
|
||||
allExitOptions: {
|
||||
'02': [
|
||||
{ exitId: "G1004", exitName: 'G1004' },
|
||||
{ exitId: 'G1010', exitName: 'G1010' },
|
||||
{ exitId: 'fluent1', exitName: 'fluent1' },
|
||||
{ exitId: 'fluent2', exitName: 'fluent2' },
|
||||
],
|
||||
'13': [
|
||||
{ exitId: 'G2001', exitName: 'G2001' },
|
||||
{ exitId: 'G3001', exitName: 'G3001' },
|
||||
{ exitId: 'G3010', exitName: 'G3010' },
|
||||
{ exitId: 'G4001', exitName: 'G4001' },
|
||||
{ exitId: 'G4010', exitName: 'G4010' },
|
||||
{ exitId: 'G5001', exitName: 'G5001' },
|
||||
{ exitId: 'G5010', exitName: 'G5010' },
|
||||
]
|
||||
},
|
||||
// 当前审核状态
|
||||
currentAuditStatus: null,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@@ -320,6 +374,17 @@ export default {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果是审核操作(status=2),显示弹窗选择出口
|
||||
if (status === 2) {
|
||||
this.currentAuditStatus = status
|
||||
// 根据选中单据的仓库ID设置出口选项
|
||||
this.setExitOptionsByWarehouse()
|
||||
this.auditDialogVisible = true
|
||||
this.auditForm.exitId = null
|
||||
return
|
||||
}
|
||||
|
||||
const params = {
|
||||
stockoutIds: this.selectedRows.map(row => row.stockoutId),
|
||||
status: this.selectedRows[0].status,
|
||||
@@ -367,6 +432,79 @@ export default {
|
||||
const stockoutIds = this.selectedRows.map(row => row.stockoutId)
|
||||
// TODO: 调用手动分配接口
|
||||
console.log("手动分配:", stockoutIds)
|
||||
},
|
||||
|
||||
/** 提交审核 */
|
||||
submitAudit() {
|
||||
this.$refs["auditForm"].validate(valid => {
|
||||
if (valid) {
|
||||
const params = {
|
||||
stockoutIds: this.selectedRows.map(row => row.stockoutId),
|
||||
status: this.selectedRows[0].status,
|
||||
newStatus: this.currentAuditStatus,
|
||||
exitId: this.auditForm.exitId
|
||||
}
|
||||
console.log("单据状态修改(含出口信息):", params)
|
||||
|
||||
//调用单据状态改变接口
|
||||
updateOutStockStatus(params).then(response => {
|
||||
this.$modal.msgSuccess(response)
|
||||
this.auditDialogVisible = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** 取消审核 */
|
||||
cancelAudit() {
|
||||
this.auditDialogVisible = false
|
||||
this.auditForm.exitId = null
|
||||
this.currentAuditStatus = null
|
||||
},
|
||||
|
||||
/** 根据仓库ID设置出口选项 */
|
||||
setExitOptionsByWarehouse() {
|
||||
try {
|
||||
// 获取选中单据的仓库ID集合,过滤掉空值和无效值
|
||||
const warehouseIds = [...new Set(
|
||||
this.selectedRows
|
||||
.map(row => row.warehouseId)
|
||||
.filter(id => id !== null && id !== undefined && id !== '')
|
||||
)]
|
||||
|
||||
console.log("仓库ID集合:", warehouseIds)
|
||||
|
||||
// 如果没有有效的仓库ID,清空出口选项
|
||||
if (warehouseIds.length === 0) {
|
||||
this.exitOptions = []
|
||||
console.warn('没有找到有效的仓库ID,已清空出口选项')
|
||||
return
|
||||
}
|
||||
|
||||
if (warehouseIds.length === 1) {
|
||||
// 如果所有选中单据都是同一个仓库,显示该仓库的出口
|
||||
const warehouseId = warehouseIds[0]
|
||||
this.exitOptions = this.allExitOptions[warehouseId] || []
|
||||
|
||||
// 如果没有对应key的默认为空数组,并给出提示
|
||||
if (!this.allExitOptions[warehouseId]) {
|
||||
console.warn(`仓库ID ${warehouseId} 没有配置出口选项,已设置为空数组`)
|
||||
}
|
||||
}
|
||||
|
||||
console.log('选中仓库ID:', warehouseIds, '可用出口:', this.exitOptions)
|
||||
|
||||
// 如果最终没有可用的出口选项,给出提示
|
||||
if (this.exitOptions.length === 0) {
|
||||
this.exitOptions=[{exitId: '0', exitName: '人工出口'}]
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('设置出口选项时发生错误:', error)
|
||||
// 发生错误时,设置为空数组,确保不会影响用户操作
|
||||
this.exitOptions = []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user