辅材盘盈盘亏
This commit is contained in:
parent
84d109761d
commit
633557de35
@ -47,18 +47,6 @@ export function getBarCode(ChangeParams: any) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 无单据入库确定
|
||||
* @param ChangeParams
|
||||
*/
|
||||
export function QTRCommit(ChangeParams: any) {
|
||||
return request({
|
||||
url: '/api/NoInvoice/QTRCommit',
|
||||
method: 'post',
|
||||
data: ChangeParams
|
||||
})
|
||||
}
|
||||
|
||||
export function CreateBox(ChangeParams: any) {
|
||||
return request({
|
||||
url: '/api/MaterialReceiveAct/TrackOutBox',
|
||||
@ -187,3 +175,29 @@ export function confirm(data: any) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘盈入库
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
export function QTRCommit(data: any) {
|
||||
return request({
|
||||
url: '/api/MaterialReceiveAct/QTRCommit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘亏出库
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
export function QTCCommit(data: any) {
|
||||
return request({
|
||||
url: '/api/MaterialReceiveAct/QTCCommit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -47,12 +47,13 @@ export function createCheckPlan(data: any) {
|
||||
|
||||
/**
|
||||
* 获取成本中心
|
||||
* @param data
|
||||
* @param params
|
||||
* @returns
|
||||
*/
|
||||
export function getCostCenter() {
|
||||
export function getCostCenter(params) {
|
||||
return request({
|
||||
url: '/api/CostCenter/getCostCenter',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
@ -217,7 +217,7 @@ function audit() {
|
||||
|
||||
}
|
||||
function getCost(){
|
||||
getCostCenter().then((res: any) => {
|
||||
getCostCenter({erpFactory: JSON.parse(localStorage.get('orgNo'))}).then((res: any) => {
|
||||
state.costCenterList = res.data;
|
||||
})
|
||||
}
|
||||
|
@ -49,12 +49,19 @@
|
||||
</el-col>
|
||||
<el-col :span="6" class="col_height">
|
||||
<el-form-item label="差异数量" prop="nums">
|
||||
<el-Input-number min="0" v-model="queryParams.params.nums" placeholder="输入差异数量" clearable/>
|
||||
<el-Input-number min="1" v-model="queryParams.params.nums" placeholder="输入差异数量" clearable/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="6" class="col_height">
|
||||
<el-form-item label="批次号" prop="CHARGE">
|
||||
<el-Input v-model="queryParams.params.CHARGE" placeholder="输入批次号" clearable/>
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="page-search-btns">
|
||||
<!-- <el-button type="primary" @click="handleSearch">搜索</el-button> -->
|
||||
<!-- <el-button type="primary" @click="resetQuery">重置</el-button> -->
|
||||
<el-button type="primary" @click="handleConfirm" v-loading="state.loadingC">确认</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
@ -67,7 +74,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-table :height="tableHeight" border v-loading="loading" :default-sort="{ prop: 'MATERIALSPECNAME', order: 'descending' }"
|
||||
<el-table :height="tableHeight" border v-loading="loading"
|
||||
:data="state.dataList" highlight-current-row row-key="id" style="width: 100%">
|
||||
<template v-for="(col, index) in tableConfig.column" :key="index">
|
||||
<el-table-column v-if="!col.hide" :label="col.header" :prop="col.field" show-overflow-tooltip
|
||||
@ -79,8 +86,9 @@
|
||||
<el-row :gutter="22">
|
||||
<el-col :span="5">
|
||||
<el-form-item label="成本中心" prop="costName">
|
||||
<el-select v-model="state.updateParams.costName" placeholder="选择成本中心" clearable>
|
||||
<el-option value="1010103000" label="财务部中心"></el-option>
|
||||
<el-select filterable v-model="state.updateParams.costName" placeholder="下拉选择成本" size="small">
|
||||
<el-option v-for="item in state.costCenterList" :key="item.costCode"
|
||||
:label="item.costName" :value="item.costCode" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -104,10 +112,11 @@ import { ElForm, ElMessageBox, ElTable } from 'element-plus'
|
||||
import { getQueryPageList,getQueryList } from '@/api/common'
|
||||
import { areAllNotEmpty, msToDate } from '@/utils/CommonUtil';
|
||||
import { localStorage } from '@/utils/storage'
|
||||
import { confirm } from '@/api/StockIn'
|
||||
import { confirm,QTRCommit,QTCCommit } from '@/api/StockIn'
|
||||
import { bTableHeight } from '@/composables/calcTableHeight'
|
||||
import { getORG } from '@/api/auth'
|
||||
import { search } from '@/api/wareHouse'
|
||||
import { getCostCenter } from '@/api/check'
|
||||
// 公共变量
|
||||
const { tableContainer, tableHeight, updateTableHeight, handleResize } = bTableHeight(310)
|
||||
const { proxy }: any = getCurrentInstance()
|
||||
@ -121,6 +130,7 @@ const formDataRef = ref()
|
||||
// 变量
|
||||
const state = reactive({
|
||||
dataList: [] as any, // 表格数据
|
||||
costCenterList: [],
|
||||
loadings: false, // 更新按钮
|
||||
loadingC: false,
|
||||
loading: false, // 表格
|
||||
@ -130,10 +140,11 @@ const state = reactive({
|
||||
ERPLocationList: [] as any,
|
||||
// 货位
|
||||
LocationList: [] as any,
|
||||
commitDate: '',
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
queryId: 'NotPosted',
|
||||
version: 'G5001',
|
||||
queryId: 'AuxiliaryOutIn',
|
||||
version: '00001',
|
||||
params: {
|
||||
siteName: localStorage.get('siteName') || 'SDK',
|
||||
user: localStorage.get('userName'),
|
||||
@ -175,7 +186,6 @@ const state = reactive({
|
||||
checkType: [{required: true, message: '请选择盘点类型', trigger: 'blur'}],
|
||||
erpFactory: [{required: true, message: '请选择组织', trigger: 'blur'}],
|
||||
erpLocation: [{required: true, message: '请选择仓库', trigger: 'blur'}],
|
||||
location: [{required: true, message: '请选择货位', trigger: 'blur'}],
|
||||
materialSpecName: [{required: true, message: '请输入料号', trigger: 'blur'}],
|
||||
nums: [{required: true, message: '请输入数量', trigger: 'blur'}],
|
||||
},
|
||||
@ -184,8 +194,16 @@ const { queryParams, loading, ERPFactoryList, rules, rulesParam } = toRefs(state
|
||||
|
||||
// 加载
|
||||
onMounted(() => {
|
||||
var newDate = new Date()
|
||||
var year = newDate.getFullYear()
|
||||
var moth = newDate.getMonth() + 1
|
||||
if (moth < 10) moth = '0' + moth
|
||||
var day = newDate.getDate()
|
||||
if (day < 10) day = '0' + day
|
||||
state.commitDate = year + '-' + moth + '-' + day;
|
||||
|
||||
tableConfig.value.column = [
|
||||
{ header: '二维码', field: 'SITENAME', hide: true },
|
||||
{ header: '二维码', field: 'MATERIALPACKINGNAME', hide: false },
|
||||
{ header: '组织', field: 'ERPFACTORY', hide: false },
|
||||
// { header: '组织(CN)', field: 'ERPFACTORYDESC', hide: false, width: 100 },
|
||||
{ header: '仓库编码', field: 'ERPLOCATION', hide: false, width: 100 },
|
||||
@ -194,16 +212,29 @@ onMounted(() => {
|
||||
// { header: '货位名称', field: 'LOCATIONNAMEDESC', hide: false, width: 100 },
|
||||
{ header: '物料编号', field: 'MATERIALSPECNAME', hide: false, width: 140 },
|
||||
{ header: '差异数量', field: 'MATERIALQUANTITY', hide: false, width: 140 },
|
||||
{ header: '规格', field: 'TRUEGG', hide: false, width: 100 },
|
||||
{ header: '批次号', field: 'CHARGE', hide: false, width: 180 },
|
||||
]
|
||||
getErpFactory()
|
||||
updateTableHeight()
|
||||
getCost()
|
||||
window.addEventListener('resize', handleResize)
|
||||
})
|
||||
|
||||
// 更新
|
||||
function submit() {
|
||||
function getCost(){
|
||||
getCostCenter({erpFactory: JSON.parse(localStorage.get('orgNo'))}).then((res: any) => {
|
||||
state.costCenterList = res.data;
|
||||
})
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
// queryFormRef.value.resetFields();
|
||||
state.queryParams.params.erpFactory = ''
|
||||
state.queryParams.params.erpLocation = ''
|
||||
state.queryParams.params.location = ''
|
||||
state.queryParams.params.materialSpecName = ''
|
||||
}
|
||||
|
||||
// 加载组织
|
||||
function getErpFactory() {
|
||||
getORG({ orgNo: null }).then((res: any) => {
|
||||
@ -219,6 +250,7 @@ function ERPLocationQuery() {
|
||||
state.queryParamsERPLocation.params.ERPFACTORYNAME = state.queryParams.params.erpFactory
|
||||
getQueryList(state.queryParamsERPLocation).then((res: any) => {
|
||||
state.ERPLocationList = res.data;
|
||||
state.ERPLocationList.push({DESCRIPTION:'6101',ENUMVALUE: '6101'}) ;
|
||||
});
|
||||
}
|
||||
function GetLocationListForSomeERPLocation(value: any) {
|
||||
@ -249,25 +281,103 @@ function handleInput(val: any) {
|
||||
})
|
||||
}
|
||||
}
|
||||
function handleSearch(){
|
||||
if(!state.queryParams.params.CHARGE){
|
||||
proxy.$ElMessage.warning("请输入批次号");
|
||||
return
|
||||
}
|
||||
getQueryPageList(state.queryParams).then(res => {
|
||||
if(res.code == '200'){
|
||||
state.dataList = res.data.list;
|
||||
} else {
|
||||
proxy.$ElMessage.error(res.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
function handleConfirm(){
|
||||
queryFormRef.value.validate((valid: any) => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
})
|
||||
let param = {
|
||||
...state.queryParams.params,
|
||||
}
|
||||
state.loadingC = true
|
||||
confirm(state.queryParams.params).then(res => {
|
||||
if(res.success){
|
||||
state.dataList = res.resultObj;
|
||||
} else {
|
||||
proxy.$ElMessage.error(res.message);
|
||||
}
|
||||
state.loadingC = false
|
||||
state.loadingC = true
|
||||
confirm(state.queryParams.params).then(res => {
|
||||
if(res.success){
|
||||
state.dataList = res.resultObj;
|
||||
resetQuery();
|
||||
} else {
|
||||
proxy.$ElMessage.error(res.message);
|
||||
}
|
||||
state.loadingC = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 提交
|
||||
function submit() {
|
||||
formDataRef.value.validate((valid: any) => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
if (state.dataList.length == 0){
|
||||
proxy.$ElMessage.warning("列表没有数据")
|
||||
return
|
||||
}
|
||||
if(!state.queryParams.params.checkType){
|
||||
proxy.$ElMessage.warning("请选择盘点类型");
|
||||
return
|
||||
}
|
||||
let param = {
|
||||
boxList: state.dataList,
|
||||
user: localStorage.get("userId"),
|
||||
commitDate: state.commitDate,
|
||||
opcode: '',
|
||||
qtc: 'Z06',
|
||||
costName: state.updateParams.costName,
|
||||
siteName: 'SDK'
|
||||
}
|
||||
// todo, STOCKSTATE
|
||||
state.loadings = true
|
||||
if (state.queryParams.params.checkType == "盘盈") {
|
||||
let hasEven = state.dataList.some(item =>
|
||||
item.STOCKSTATE != 'Created'
|
||||
)
|
||||
if(hasEven){
|
||||
proxy.$ElMessage.warning("列表中含有状态不是Created的数据,不能进行盘盈");
|
||||
state.loadings = false
|
||||
return
|
||||
}
|
||||
QTRCommit(param).then(res => {
|
||||
if(res.success){
|
||||
proxy.$ElMessage.success(res.message);
|
||||
state.dataList = [];
|
||||
} else {
|
||||
proxy.$ElMessage.error(res.message);
|
||||
}
|
||||
state.loadings = false
|
||||
})
|
||||
} else {
|
||||
let hasEven = state.dataList.some(item =>
|
||||
item.STOCKSTATE != 'Stocked'
|
||||
)
|
||||
if(hasEven){
|
||||
proxy.$ElMessage.warning("列表中含有状态不是Stocked的数据,不能进行盘亏");
|
||||
state.loadings = false
|
||||
return
|
||||
}
|
||||
param.qtc = 'Z05'
|
||||
QTCCommit(param).then(res => {
|
||||
if(res.success){
|
||||
proxy.$ElMessage.success(res.message);
|
||||
state.dataList = [];
|
||||
} else {
|
||||
proxy.$ElMessage.error(res.message);
|
||||
}
|
||||
state.loadings = false
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.col_height {
|
||||
|
Loading…
x
Reference in New Issue
Block a user