diff --git a/sgzb-ui/src/api/store/putInStore.js b/sgzb-ui/src/api/store/putInStore.js
index ebe7e699..5e185b4b 100644
--- a/sgzb-ui/src/api/store/putInStore.js
+++ b/sgzb-ui/src/api/store/putInStore.js
@@ -55,6 +55,14 @@ export function getDeviceTypeTree(params = {}){
})
}
+// 提交编码入库
+export function inputByCode(data) {
+ return request({
+ url: '/material/inventoryAndWarehousing/addList',
+ method: 'post',
+ data: data
+ })
+}
diff --git a/sgzb-ui/src/views/store/warehousing/putInStore.vue b/sgzb-ui/src/views/store/warehousing/putInStore.vue
index 0755cf96..3169ccca 100644
--- a/sgzb-ui/src/views/store/warehousing/putInStore.vue
+++ b/sgzb-ui/src/views/store/warehousing/putInStore.vue
@@ -56,7 +56,7 @@
查询
重置
数量盘点
- 编号盘点
+ 编码盘点
@@ -157,142 +157,178 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 点击填充
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 点击填充
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
通过
- 重置
+
@@ -386,14 +475,15 @@ import { listType, getType, delType, addType, updateType, refreshCache } from "@
import {
getReturnOfMaterialsInfoAll,
getTypeList,
- getDeviceTypeTree
+ getDeviceTypeTree,
+ inputByCode
} from "@/api/store/putInStore";
import { getInfo } from '@/api/login'
import { supplierInfoList } from "@/api/store/tools";
export default {
name: "DevicesWarehousing",
- dicts: ['sys_normal_disable'],
+ // dicts: ['sys_normal_disable'],
data() {
return {
// 用户信息
@@ -414,8 +504,15 @@ export default {
modelList: [],
// 表格数据
returnList: [],
+ // 编码盘点表格数据
+ codeTableList: [],
// 弹出层标题
title: "",
+ // 入库来源选项
+ codeInStoreOptions: [
+ { label: "库存盘点入库", value: "库存盘点入库" },
+ { label: "退料入库", value: "退料入库" },
+ ],
// 是否显示弹出层
numberOpen: false,
codeOpen: false,
@@ -459,17 +556,17 @@ export default {
// 表单参数:编号表单 / 数量表单
numberForm: {},
codeForm: {
- codeInStoreSource: undefined,
- codeNote: undefined,
- codeDeviceType: undefined,
- codeWaitInSum: undefined,
+ putInType: undefined,
+ remarks: undefined,
+ typeId: undefined,
+ num: undefined,
codePrefix: undefined,
codeSuffixStart: undefined,
codeSuffixEnd: undefined,
- codeSinglePrice: undefined,
+ buyPrice: undefined,
codeFactory: undefined,
- codeCheckFixTime: undefined,
- codeNextCheckFixTime: undefined,
+ thisCheckFixTime: undefined,
+ nextCheckFixTime: undefined,
pageNum: 1,
pageSize: 10,
},
@@ -483,13 +580,13 @@ export default {
]
},
codeFormRules: {
- codeInStoreSource: [
+ putInType: [
{ required: true, message: "入库来源不能为空", trigger: "blur" }
],
- codeDeviceType: [
+ typeId: [
{ required: true, message: "设备/物资类型不能为空", trigger: "blur" }
],
- codeWaitInSum: [
+ num: [
{ required: true, message: "待入库总数不能为空", trigger: "blur" }
],
}
@@ -538,6 +635,8 @@ export default {
this.resetCodeForm();
this.deviceType = {}
this.reset();
+ this.codeTableList = []
+ this.$refs['codeForm'].clearValidate()
},
// 表单重置
reset() {
@@ -553,17 +652,17 @@ export default {
// 编码表单重置
resetCodeForm() {
this.codeForm = {
- codeInStoreSource: undefined,
- codeNote: undefined,
- codeDeviceType: undefined,
- codeWaitInSum: undefined,
+ putInType: undefined,
+ remarks: undefined,
+ typeId: undefined,
+ num: undefined,
codePrefix: undefined,
codeSuffixStart: undefined,
codeSuffixEnd: undefined,
- codeSinglePrice: undefined,
+ buyPrice: undefined,
codeFactory: undefined,
- codeCheckFixTime: undefined,
- codeNextCheckFixTime: undefined,
+ thisCheckFixTime: undefined,
+ nextCheckFixTime: undefined,
pageNum: 1,
pageSize: 10,
}
@@ -575,7 +674,59 @@ export default {
},
/** 填充编码盘点表单 */
fillCodeForm() {
- console.log(this.codeForm)
+ // 校验表单
+ this.$refs['codeForm'].validate(valid => {
+ if (!valid) return
+ console.log('🚀 ~ fillCodeForm ~ this.codeForm:', this.codeForm);
+ // 清空this.codeTableList
+ this.codeTableList = []
+ // 根据this.codeForm.num的数量, 往this.codeTableList中添加this.codeForm的数据
+ for (let i = 0; i < this.codeForm.num; i++) {
+ // 设备编码: 前缀 拼接 后缀
+ let suffix = (parseInt(this.codeForm.codeSuffixStart) + i).toString().padStart(this.codeForm.codeSuffixStart?.length, '0')
+ console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
+ suffix = isNaN(suffix) ? '' : suffix
+ const maCode = `${this.codeForm.codePrefix || ''}${suffix}`
+ // 出厂编码
+ const outFacCode = ''
+ // 生产厂家
+ const maVender = this.supplierList.find(item => item.supplierId == this.codeForm.codeFactory)?.supplier || ''
+ // 检修日期: codeForm.thisCheckFixTime, 时间格式为 yyyy-MM-dd
+ let thisCheckFixTime = new Date(this.codeForm.thisCheckFixTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
+ if (thisCheckFixTime == 'Invalid Date') thisCheckFixTime = ''
+ // 下次检修日期: codeForm.nextCheckFixTime
+ let nextCheckFixTime = new Date(this.codeForm.nextCheckFixTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
+ if (nextCheckFixTime == 'Invalid Date') nextCheckFixTime = ''
+ // 单价: codeForm.buyPrice
+ const buyPrice = this.codeForm.buyPrice || 0
+ this.codeTableList.push({
+ maCode,
+ outFacCode,
+ maVender,
+ thisCheckFixTime,
+ nextCheckFixTime,
+ buyPrice
+ })
+ }
+ })
+ },
+ /** 输入框改变 */
+ changeInput(num) {
+ if (isNaN(num)) {
+ this.$message.error('请输入数字类型')
+ this.codeForm.codeSuffixStart = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
+ }
+ },
+
+ handleResetRow(row) {
+ // 重置当前行所有数据为空
+ row.maCode = ''
+ row.outFacCode = ''
+ row.maVender = ''
+ row.thisCheckFixTime = ''
+ row.nextCheckFixTime = ''
+ row.buyPrice = 0
+
},
/** 重置按钮操作 */
resetQuery() {
@@ -615,7 +766,34 @@ export default {
submitForm: function() {
this.$refs['codeForm'].validate(valid => {
if (valid) {
- console.log(this.codeForm)
+ console.log('🚀 ~ this.codeForm:', this.codeForm);
+ console.log('🚀 ~ this.codeTableList:', this.codeTableList);
+ // 提交数据
+ const SavePutInfoDto = {
+ isCode: true, // 是否编码盘点
+ putInType: this.codeForm.putInType,
+ typeId: this.codeForm.typeId,
+ num: this.codeForm.num,
+ remarks: this.codeForm.remarks || '',
+ machIneDtoList: this.codeTableList
+ }
+ console.log('🚀 ~ submitForm: ~ SavePutInfoDto', SavePutInfoDto)
+
+ if (this.codeTableList.length == 0) {
+ this.$message.error('请点击填充按钮, 填充数据')
+ return
+ }
+
+ // 发送请求
+ inputByCode(SavePutInfoDto).then(response => {
+ this.$message.success('入库成功')
+ this.codeOpen = false
+ this.getList()
+ this.resetCodeForm()
+ this.reset()
+ this.codeTableList = []
+ this.deviceType = {}
+ })
}
})
/* this.$refs["form"].validate(valid => {
@@ -670,14 +848,14 @@ export default {
},
/////// 设备类型树 切换
deviceTypeChange(val){
- console.log(val)
- this.cascaderDisabled = true
+ console.log('🚀 ~ deviceTypeChange ~ val:', val);
+ // this.cascaderDisabled = true
let nodes = null;
nodes = this.$refs.deviceTypeCascader.getCheckedNodes().length > 0 ? this.$refs.deviceTypeCascader.getCheckedNodes() : [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)]
if(nodes[0].level != 4){
return
}
- console.log(nodes[0])
+ console.log('🚀 ~ deviceTypeChange ~ nodes[0]:', nodes[0]);
for(let i = 0; i < this.leaseApplyDetails.length; i++) {
if (this.leaseApplyDetails[i].typeId == nodes[0].data.id) {
this.leaseApplyDetails.splice(i,1)
@@ -687,15 +865,15 @@ export default {
this.leaseApplyDetails.push(
this.handelTableItemData(nodes[0])
)
- console.log(this.leaseApplyDetails)
+ console.log('🚀 ~ deviceTypeChange ~ this.leaseApplyDetails:', this.leaseApplyDetails);
// this.deviceType = {}
},
//// 将数据处理成 表格中需要的数据
handelTableItemData(node){
const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem))
// template.createBy = this.user.name
- console.log(node.data, node.data.id)
- this.codeForm.codeDeviceType = node.data.id
+ console.log('🚀 ~ handelTableItemData ~ node.data, node.data.id:', node.data, node.data.id);
+ this.codeForm.typeId = node.data.id
template.num = node.data.num
template.companyId = node.data.companyId
template.typeId = node.data.id
@@ -707,8 +885,7 @@ export default {
const index = this.leaseApplyInfoList.find(key => key.companyId == node.data.companyId)
template.parentId = index ? index.id : ''
}
-
- console.log(template)
+ console.log('🚀 ~ handelTableItemData ~ template:', template);
return template
},