|
@@ -9,18 +9,69 @@
|
|
|
top="50px"
|
|
|
>
|
|
|
<el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
|
|
|
- <el-form-item label="产品编号:" prop="code">
|
|
|
- <el-input v-model="tenant.code" placeholder="请输入..."/>
|
|
|
+ <div class="fanganTitle">{{$t("lineSide.form.outWareConf")}}:</div>
|
|
|
+ <el-form-item :label='$t("lineSide.form.deviceUnit")+":"' prop="deviceUnit">
|
|
|
+ <el-select v-model="tenant.deviceUnit" placeholder="选择产线" :disabled="true">
|
|
|
+ <el-option v-for="deviceUnit in lineList " :label="deviceUnit.name" :value="deviceUnit.no" :key="deviceUnit.no" ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label='$t("lineSide.form.robots")+":"' prop="robotResourceId">
|
|
|
+ <el-select v-model="tenant.robotResourceId" placeholder="选择产线机器人" :disabled="true">
|
|
|
+ <el-option v-for="robot in robotList " :label="robot.name" :value="robot.id" :key="robot.id" ></el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="产品名称:" prop="name">
|
|
|
- <el-input v-model="tenant.name" placeholder="请输入..."/>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="库位:" prop="name2">
|
|
|
- <el-input v-model="tenant.name2" placeholder="请输入..."/>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="数量:" prop="num">
|
|
|
- <el-input-number v-model="tenant.num" :min="1" :max="99999999999" label=""></el-input-number>
|
|
|
+ <el-form-item :label='$t("lineSide.form.outWareType")+":"' prop="storgeId">
|
|
|
+ <el-select v-model="tenant.storgeId" :placeholder='$t("common.pleaseSelect")' size="medium" style="width: 50%;" :disabled="true">
|
|
|
+ <el-option
|
|
|
+ v-for="item in locationList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
+ <div class="fanganTitle">{{$t("lineSide.form.outWareFan")}}:</div>
|
|
|
+ <el-form-item :label='$t("lineSide.form.outWarePoint")+":"' prop="endpointId">
|
|
|
+ <el-input-number v-model="tenant.endpointId" :min="1" :max="500" @change="checkStock($event)" ></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ <div class="fanganTitle">{{$t("lineSide.form.outWareProd")}}:</div>
|
|
|
+ <el-row>
|
|
|
+ <!-- Table数据 -->
|
|
|
+ <el-table
|
|
|
+ ref="table"
|
|
|
+ v-loading="loading"
|
|
|
+ :data="tableData"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ style="width: 100%;"
|
|
|
+ highlight-current-row
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ >
|
|
|
+ <el-table-column prop="brandNo" :label='$t("lineSide.table.sideProd.brandNo")' align="center" width="200px"></el-table-column>
|
|
|
+ <el-table-column prop="categoryDesc" :label='$t("lineSide.table.sideBrach.name2")' align="center" width="120px"></el-table-column>
|
|
|
+ <el-table-column prop="brandName" :label='$t("lineSide.table.sideProd.brandName")' align="center"></el-table-column>
|
|
|
+ <el-table-column prop="specification" :label='$t("lineSide.table.sideProd.specification")' align="center" width="110px"></el-table-column>
|
|
|
+ <el-table-column prop="num" :label='$t("lineSide.table.sideProd.num")' align="center" width="150px"></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('table.operation')"
|
|
|
+ fixed="right"
|
|
|
+ align="center"
|
|
|
+ column-key="operation"
|
|
|
+ width="50px"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
|
|
|
+ <i
|
|
|
+ class="el-icon-delete table-operation"
|
|
|
+ style="color: #f50;"
|
|
|
+ @click="singleDelete(row)"
|
|
|
+ />
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button plain type="warning" @click="isVisible = false">{{ $t('common.cancel') }}</el-button>
|
|
@@ -31,6 +82,14 @@
|
|
|
<script>
|
|
|
// 【BOM管理】-API
|
|
|
import bomMgrApi from "@/api/prepareProductMgr/bomMgr"
|
|
|
+import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
|
|
|
+// 【仓库类型管理】-API
|
|
|
+import warehouseTypeMgrApi from "@/api/modelingCenter/warehouseTypeMgr"
|
|
|
+// 【边线库管理】-API
|
|
|
+import lineSideMgrApi from "@/api/lineSideLibrary/lineSideMgr"
|
|
|
+// 【库位管理】-API
|
|
|
+import locationMgrApi from "@/api/lineSideLibrary/locationMgr"
|
|
|
+import { initQueryParams } from '@/utils/commons'
|
|
|
|
|
|
export default {
|
|
|
name: 'TenantEdit',
|
|
@@ -47,17 +106,29 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
type: 'add',
|
|
|
+ loading: false,
|
|
|
+ currentRow: null, // 当前选中的行
|
|
|
+ shelvesId: '',
|
|
|
+ pNodeName: '',
|
|
|
+ zoneCode: '',
|
|
|
+ availableNum: 23, // 数量
|
|
|
+ tableData: [],
|
|
|
+ lineList: [],
|
|
|
+ robotList: [{id:"1496352097438793728",name:"舱体_机器人",abbreviate:"舱体",code:"CT"},{id:"1496360341817262080",name:"保障中心_伺服舵机",abbreviate:"保障中心",code:"BZ"},{id:"1496350084294508544",name:"框体_机器人",abbreviate:"框体",code:"KT"}],
|
|
|
+ locationList: [], // 【库位】下拉数据
|
|
|
+ wareTypeList: [], // 库位类型下拉数据
|
|
|
tenant: this.initTenant(),
|
|
|
screenWidth: 0,
|
|
|
width: this.initWidth(),
|
|
|
confirmDisabled: false,
|
|
|
+ queryParams: initQueryParams({}),
|
|
|
dicts:{
|
|
|
NATION: {}
|
|
|
},
|
|
|
roles: [],
|
|
|
rules: {
|
|
|
name: [
|
|
|
- { required: true, message: '名称必须填写', trigger: 'blur' }
|
|
|
+ { required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
|
]
|
|
|
}
|
|
|
}
|
|
@@ -86,11 +157,14 @@ export default {
|
|
|
methods: {
|
|
|
initTenant () {
|
|
|
return {
|
|
|
- id: '',
|
|
|
- code: '',
|
|
|
- name: '',
|
|
|
- name2: '',
|
|
|
- num: 1
|
|
|
+ manualId: '',
|
|
|
+ startpointId: '',
|
|
|
+ endpointId: '',
|
|
|
+ startResourceId: '',
|
|
|
+ endResourceId: '',
|
|
|
+ robotResourceId: '',
|
|
|
+ manualIdType:'general',
|
|
|
+ deviceUnit: ''
|
|
|
}
|
|
|
},
|
|
|
initWidth () {
|
|
@@ -103,16 +177,158 @@ export default {
|
|
|
return '800px'
|
|
|
}
|
|
|
},
|
|
|
- setTenant (val, currNode, dicts) {
|
|
|
+ selParams(val){
|
|
|
+ let option = this.lineList.find(function(i){
|
|
|
+ return i.no === val
|
|
|
+ })
|
|
|
+ this.tenant.deviceUnit = option.no
|
|
|
+ },
|
|
|
+ querySearchAsync(queryString, cb) {
|
|
|
+ var restaurants = this.restaurants;
|
|
|
+ var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
|
|
|
+
|
|
|
+ clearTimeout(this.timeout);
|
|
|
+ this.timeout = setTimeout(() => {
|
|
|
+ cb(results);
|
|
|
+ }, 1000 * Math.random());
|
|
|
+ },
|
|
|
+ createStateFilter(queryString) {
|
|
|
+ return (state) => {
|
|
|
+ return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) > -1);
|
|
|
+ };
|
|
|
+ },
|
|
|
+ selStorge(val){
|
|
|
+ let option = this.locationList.find(function(i){
|
|
|
+ return i.id === val
|
|
|
+ })
|
|
|
+ this.tenant.endpointId = option.no
|
|
|
+ this.tenant.endResourceId = option.resourceId
|
|
|
+ },
|
|
|
+ loadAll() {
|
|
|
+ lineSideMgrApi.getGoodsList({}).then(res => {
|
|
|
+ res = res.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ let list = []
|
|
|
+ res.data.forEach(item => {
|
|
|
+ item.value = item.name
|
|
|
+ list.push(item)
|
|
|
+ })
|
|
|
+ this.restaurants = list
|
|
|
+ // console.log("自动获取数据33:", this.restaurants)
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setTenant (val) {
|
|
|
if(val){
|
|
|
- this.tenant = { ...val }
|
|
|
+ this.shelvesId = val.storgeObj.shelvesId
|
|
|
+ this.pNodeName = val.storgeObj.pNodeName
|
|
|
+ this.tenant.storgeId = val.storgeObj.id
|
|
|
+ this.tenant.startResourceId = val.storgeObj.resourceId
|
|
|
+ this.tenant.startpointId = val.storgeObj.pointId
|
|
|
+ this.tableData = val.tableData.records
|
|
|
}
|
|
|
- // 字典表
|
|
|
- this.dicts = dicts
|
|
|
- },
|
|
|
+ // 调用数据
|
|
|
+ this.loadAll()
|
|
|
+ // 【库位类型】
|
|
|
+ // this.getWareType()
|
|
|
+ // 获取库位数量
|
|
|
+ this.getWareNums()
|
|
|
+ this.fetch()
|
|
|
+ },
|
|
|
close () {
|
|
|
this.$emit('close')
|
|
|
},
|
|
|
+ fetch(){
|
|
|
+ areaMgrApi.page(this.queryParams).then(res => {
|
|
|
+ res = res.data
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.lineList = res.data.records
|
|
|
+ let that = this
|
|
|
+ let obj = this.lineList.find(item=>{
|
|
|
+ return that.pNodeName.indexOf(item.abbreviate)>-1
|
|
|
+ })
|
|
|
+ let robot = this.robotList.find(item=>{
|
|
|
+ return that.pNodeName.indexOf(item.abbreviate)>-1
|
|
|
+ })
|
|
|
+ this.tenant.deviceUnit = obj.no
|
|
|
+ this.tenant.robotResourceId = robot.id
|
|
|
+ this.zoneCode = robot.code
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 获取库位
|
|
|
+ this.getLocationList()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val){
|
|
|
+ this.currentRow = val
|
|
|
+ },
|
|
|
+ handleSelect(obj) {
|
|
|
+ console.log(obj);
|
|
|
+ let list = []
|
|
|
+ this.tableData.map(item => {
|
|
|
+ if(item.key == this.currentRow.key){
|
|
|
+ // 合并对象
|
|
|
+ item = Object.assign(item, obj)
|
|
|
+ // 类型
|
|
|
+ item.goodsType = obj.category
|
|
|
+ // 物品id
|
|
|
+ item.goodsId = obj.id
|
|
|
+ }
|
|
|
+ // console.log("选中的值:", item)
|
|
|
+ // 赋值
|
|
|
+ list.push(item)
|
|
|
+ })
|
|
|
+
|
|
|
+ // 重新赋值
|
|
|
+ this.tableData = list
|
|
|
+ },
|
|
|
+ checkStock(point){
|
|
|
+ this.queryParams = initQueryParams({})
|
|
|
+ this.queryParams.model.code = this.zoneCode+"_"+point
|
|
|
+ this.queryParams.model.status = 1
|
|
|
+ let bool = true
|
|
|
+ locationMgrApi.checkStock(this.queryParams).then(res => {
|
|
|
+ res = res.data
|
|
|
+ if(res.isSuccess){
|
|
|
+ if(res.data.total==1){
|
|
|
+ this.tenant.endResourceId = res.data.records[0].id
|
|
|
+ this.tenant.endpointId = String(point)
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message: "请确认出库库位设备是否存在或是否可用",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ bool = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return bool
|
|
|
+ },
|
|
|
+ getWareNums(){
|
|
|
+ locationMgrApi.storgeCount({}).then(res => {
|
|
|
+ res = res.data
|
|
|
+ // console.log(" 获取【可用库位】:", res)
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.availableNum = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getLocationList(){
|
|
|
+ this.queryParams = initQueryParams({})
|
|
|
+ this.queryParams.model.shelvesId = this.shelvesId
|
|
|
+ this.queryParams.model.lockStatus = 1
|
|
|
+ this.queryParams.size = 100
|
|
|
+ locationMgrApi.page(this.queryParams).then(res => {
|
|
|
+ res = res.data
|
|
|
+ console.log("【库位】下拉数据: ", res.data)
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.locationList = res.data.records.filter(item=>{
|
|
|
+ return item.storgeNum > 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
reset () {
|
|
|
// 先清除校验,再清除表单,不然有奇怪的bug
|
|
|
this.$refs.form.clearValidate()
|
|
@@ -120,11 +336,16 @@ export default {
|
|
|
this.tenant = this.initTenant()
|
|
|
},
|
|
|
submitForm () {
|
|
|
+ if(!this.checkStock(this.tenant.endpointId)){
|
|
|
+ this.confirmDisabled = false
|
|
|
+ return false
|
|
|
+ }
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.confirmDisabled = true
|
|
|
if (this.type === 'add') {
|
|
|
- this.save()
|
|
|
+ //this.save()
|
|
|
+ this.manualTask()
|
|
|
} else {
|
|
|
this.update()
|
|
|
}
|
|
@@ -132,6 +353,15 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ manualTask() {
|
|
|
+ this.tenant.manualId = new Date().getTime().toString()
|
|
|
+ lineSideMgrApi.manualTask(this.tenant).then(response => {
|
|
|
+ const res = response.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.save()
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
save () {
|
|
|
bomMgrApi.save(this.tenant)
|