12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019 |
- <template>
- <div class="app-container" style="width: 100%;">
- <!--表格-->
- <el-table
- :data="tableData"
- ref="tableRef">
- <el-table-column prop="machineId" fixed :label="$t('planTable.machineNo')" header-align="center" align="center" width="111px" ></el-table-column>
- <el-table-column prop="productionDigit" fixed :label="$t('planTable.productionDigit')" header-align="center" align="center" width="111.2px"></el-table-column>
- <el-table-column :label="$t('planTable.inMachineProduct')" header-align="center" >
- <el-table-column prop="productTypeName" fixed :label="$t('planTable.productType')" header-align="center" align="center" width="111.2px"></el-table-column>
- <el-table-column prop="currentColorCode" :label="$t('planTable.colorNo')" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="currentSpecification" :label="$t('planTable.specification')" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="currentLotNumber" :label="$t('planTable.batchNo')" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="number" :label="$t('planTable.quantity')" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="startTime" :label="$t('planTable.startTime')" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="plannedEndTime" :label="$t('planTable.endTime')" header-align="center" width="90px" align="center"></el-table-column>
- </el-table-column>
- <el-table-column prop="plannedProduction" :label="$t('planTable.pendingProductList')" header-align="center" align="center" >
- <template v-slot:default="scope">
- <div v-if="scope.row.plannedProduction && scope.row.plannedProduction.length > 0">
- <div v-for="(chunk, chunkIndex) in splitList(scope.row.plannedProduction, 5)" :key="`chunk-${chunkIndex}`">
- <span v-for="(item, index) in chunk" :key="`item-${chunkIndex}-${index}`">
- {{ item }}, <!-- 替换为实际显示每个产品的代码 -->
- </span>
- </div>
- </div>
- <div v-else>
- </div>
- </template>
- </el-table-column>
- <el-table-column fixed="right" :label="$t('planTable.operation')" header-align="center" align="center" width="150px" >
- <template v-slot:default="scope">
- <el-dropdown>
- <el-button type="primary">
- {{ $t('planTable.operation') }}
- <i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">{{ $t('planTable.addPlan') }}</el-dropdown-item>
- <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">{{ $t('planTable.editPlan') }}</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- </el-table-column>
- </el-table>
- <!--新增计划弹窗-->
- <el-dialog :title="$t('planTable.addPlanTitle')" :visible.sync="nanInsertDialogTableVisible" width="1500px">
- <el-table :data="tableData2" @row-click.self="handleRowClick">
- <el-table-column prop="productId" :label="$t('planTable.product')" header-align="center" align="center" width="150px">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.productId" :placeholder="$t('planTable.selectProduct')" @change="selectedChangeDate(scope.row,scope.row.productId)">
- <el-option v-for="product in productsInfo" :key="product.id" :label="product.productName" :value="product.id" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column prop="currentColorCode" :label="$t('planTable.colorNo')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.currentColorCode" filterable :placeholder="$t('planTable.selectColorCode')" @change="selectedML(scope.row)">
- <el-option
- v-for="(item,index) in options"
- :key="index"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column prop="productionDigit" :label="$t('planTable.productionDigit')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.productionDigit" :placeholder="$t('planTable.inputSpindleCount')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.productionDigit }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="currentSpecification" :label="$t('planTable.specification')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentSpecification" :placeholder="$t('planTable.inputSpecification')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentSpecification }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="currentLotNumber" :label="$t('planTable.batchNo')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" :disabled="isDisabled" v-model="scope.row.currentLotNumber" :placeholder="$t('planTable.inputBatchNo')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentLotNumber }}</span>
- </template>
- </el-table-column>
- <!-- 新增筒重、箱重、管色字段 -->
- <el-table-column
- prop="tubeweight"
- label="筒重"
- header-align="center"
- align="center"
- >
- <template v-slot:default="scope">
- <el-select
- v-model="scope.row.tubeweight"
- clearable
- filterable
- allow-create
- default-first-option
- >
- <el-option
- v-for="item in dropDownData.drum_weight"
- :key="item.id"
- :label="item.codeName"
- :value="item.codeName"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- prop="boxweight"
- label="箱重"
- header-align="center"
- align="center"
- >
- <template v-slot:default="scope">
- <el-select
- v-model="scope.row.boxweight"
- clearable
- filterable
- allow-create
- default-first-option
- >
- <el-option
- v-for="item in dropDownData.box_weight"
- :key="item.id"
- :label="item.codeName"
- :value="item.codeName"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- prop="tubecolor"
- label="管色"
- header-align="center"
- align="center"
- >
- <template v-slot:default="scope">
- <el-select
- v-model="scope.row.tubecolor"
- clearable
- filterable
- allow-create
- default-first-option
- >
- <el-option
- v-for="item in dropDownData.tube_color"
- :key="item.id"
- :label="item.codeName"
- :value="item.codeName"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <!-- 新增筒重、箱重、管色字段 -->
- <el-table-column prop="number" :label="$t('planTable.quantity')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.number" :placeholder="$t('planTable.inputQuantity')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.number }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="startTime" :label="$t('planTable.startTime')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" :placeholder="$t('planTable.inputStartTime')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.startTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="plannedEndTime" :label="$t('planTable.endTime')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" :placeholder="$t('planTable.inputEndTime')" @blur="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.plannedEndTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="planStatus" :label="$t('planTable.planStatus')" header-align="center" align="center" width="100px">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.planStatus" :placeholder="$t('planTable.planStatus')" >
- <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column :label="$t('planTable.operation')" align="center">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="danger"
- @click.stop.prevent="handleDelete(scope.$index, scope.row)">{{ $t('planTable.delete') }}</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-button type="primary" style="width: 100%;margin-top: 30px" @click="addEditableRow">{{ $t('planTable.addPlanProduct') }}</el-button>
- <span slot="footer" class="dialog-footer">
- <el-button @click="nanInsertDialogTableVisible = false">{{ $t('planTable.cancel') }}</el-button>
- <el-button type="primary" @click="addPlanInfo">{{ $t('planTable.confirm') }}</el-button>
- </span>
- </el-dialog>
- <!--修改计划弹窗-->
- <el-dialog :title="$t('planTable.editPlanTitle')" :visible.sync="nanUpdateDialogTableVisible" width="1500px">
- <!--查询条件-->
- <el-form ref="form" :model="formData" label-width="80px" :inline="true">
- <el-form-item :label="$t('planTable.planStatusLabel')">
- <el-select v-model="formData.planStatus" :placeholder="$t('planTable.planStatus')">
- <el-option v-for="stateListItem in stateList2" :key="stateListItem.id" :label="stateListItem.name" :value="stateListItem.id" ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="onSubmit">{{ $t('planTable.search') }}</el-button>
- <el-button @click="reset">{{ $t('planTable.reset') }}</el-button>
- </el-form-item>
- </el-form>
- <!--表格-->
- <el-table :data="tableData2" @row-click.self="handleRowClick">
- <el-table-column prop="productId" :label="$t('planTable.product')" header-align="center" align="center" width="150px">
- <template slot-scope="scope">
- {{ getProductChineseName(scope.row.productId) }}
- </template>
- </el-table-column>
- <el-table-column prop="productionDigit" :label="$t('planTable.productionDigit')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.productionDigit" :placeholder="$t('planTable.inputSpindleCount')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.productionDigit }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="currentColorCode" :label="$t('planTable.colorNo')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentColorCode" :placeholder="$t('planTable.inputColorCode')" @blur.stop.prevent="handleInputBlur(scope.row)"></el-input>
- <span v-else>{{ scope.row.currentColorCode }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="currentSpecification" :label="$t('planTable.specification')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentSpecification" :placeholder="$t('planTable.inputSpecification')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentSpecification }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="currentLotNumber" :label="$t('planTable.batchNo')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.currentLotNumber" :placeholder="$t('planTable.inputBatchNo')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentLotNumber }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="number" :label="$t('planTable.quantity')" header-align="center" align="center"/>
- <!-- 新增筒重、箱重、管色字段 -->
- <el-table-column
- prop="tubeweight"
- label="筒重"
- header-align="center"
- align="center"
- >
- <template v-slot:default="scope">
- <el-select
- v-model="scope.row.tubeweight"
- clearable
- filterable
- allow-create
- default-first-option
- >
- <el-option
- v-for="item in dropDownData.drum_weight"
- :key="item.id"
- :label="item.codeName"
- :value="item.codeName"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- prop="boxweight"
- label="箱重"
- header-align="center"
- align="center"
- >
- <template v-slot:default="scope">
- <el-select
- v-model="scope.row.boxweight"
- clearable
- filterable
- allow-create
- default-first-option
- >
- <el-option
- v-for="item in dropDownData.box_weight"
- :key="item.id"
- :label="item.codeName"
- :value="item.codeName"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- prop="tubecolor"
- label="管色"
- header-align="center"
- align="center"
- >
- <template v-slot:default="scope">
- <el-select
- v-model="scope.row.tubecolor"
- clearable
- filterable
- allow-create
- default-first-option
- >
- <el-option
- v-for="item in dropDownData.tube_color"
- :key="item.id"
- :label="item.codeName"
- :value="item.codeName"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <!-- 新增筒重、箱重、管色字段 -->
- <el-table-column prop="number" label="数量" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.number" :placeholder="$t('planTable.inputQuantity')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.number }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="startTime" :label="$t('planTable.startTime')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" :placeholder="$t('planTable.inputStartTime')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.startTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="plannedEndTime" :label="$t('planTable.endTime')" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" :placeholder="$t('planTable.inputEndTime')" @blur="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.plannedEndTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="planStatus" :label="$t('planTable.planStatus')" header-align="center" align="center" width="100px">
- <template v-slot:default="scope">
- <el-select v-if="scope.row.planStatus==1" v-model="scope.row.planStatus" :placeholder="$t('planTable.planStatus')">
- <el-option v-for="stateItem in stateList1" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id"></el-option>
- </el-select>
- <el-select v-if="scope.row.planStatus==0" v-model="scope.row.planStatus" :placeholder="$t('planTable.planStatus')">
- <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id"></el-option>
- </el-select>
- <el-select v-if="scope.row.planStatus==2" v-model="scope.row.planStatus" :placeholder="$t('planTable.planStatus')">
- <el-option v-for="stateItem in stateList2" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id"></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column :label="$t('planTable.operation')" align="center" width="200px">
- <template v-slot:default="scope">
- <el-button
- size="mini"
- type="danger"
- @click.stop.prevent="updateStatus(scope.$index, scope.row,scope.row.planStatus)">{{ $t('planTable.confirmModify') }}</el-button>
- <el-button
- size="mini"
- type="danger"
- @click.stop.prevent="deletePlan(scope.$index, scope.row)">{{ $t('planTable.delete') }}</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!--按钮信息-->
- <span slot="footer" class="dialog-footer">
- <el-button @click="nanUpdateDialogTableVisible = false">{{ $t('planTable.cancel') }}</el-button>
- <el-button type="primary" @click="nanUpdateDialogTableVisible = false">{{ $t('planTable.confirm') }}</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- getProductsInfo,
- getProductsAll,
- getMaterielInfo,
- spinningFrameWinding,
- getSpinningPlanList,
- addSpinningPlanList,
- getPlanSpinningInfo,
- updateSpinningInfoPlanOne,
- getCurrentProductionLineSuperior,
- getIsTheOrderProductProduced,
- getOptionLsit
- } from "@/api/plan/paln.js";
- export default {
- data() {
- return {
- options: [],
- //
- isDisabled:true,
- //选中的是那个车间
- tableData:[],
- form: {
- product:"",
- },
- formzdsj:{machineToolNo: "", //机台编号
- // 表单参数
- packaging: "", //包装
- machineTool: "", //机台
- workShifts: "", //班次
- productionDate: "", //生产日期
- levels: "", //等级
- foreignTradeNumber: "", //外贸号
- canisterWeight: "", //筒重
- boxWeight: "", //箱重-车重
- canisterNum: "", //筒数
- tubeColor: "", //管色
- comPort: "", //端口
- printFormat: "", //格式
- grossWeight: 0, //毛重
- remark: "", //备注
- },
- dropDownData: {},
- previousMachineId: undefined,
- currentRowspan: 1,
- prevRow: {},
- tableData2: [],
- tableDataStatus: [],
- nanInsertDialogTableVisible:false,
- nanUpdateDialogTableVisible:false,
- beiInsertDialogTableVisible:false,
- beiUpdateDialogTableVisible:false,
- editingRowIndex: -1,
- lastEditLine:0,
- isEditLine:false,
- productsInfo:[],
- salesmanInfo:[],
- product:{},
- materiel:{},
- //机台号
- machineId:"",
- macId:"",
- // 待机/上机/停产
- stateList0:[
- {"id":0,"name":this.$t('planTable.standby')},
- {"id":1,"name":this.$t('planTable.inProduction')},
- ],
- stateList1:[
- {"id":0,"name":this.$t('planTable.standby')},
- {"id":2,"name":this.$t('planTable.stopped')},
- {"id":1,"name":this.$t('planTable.inProduction')},
- ],
- stateList2:[
- {"id":0,"name":this.$t('planTable.standby')},
- {"id":2,"name":this.$t('planTable.stopped')},
- {"id":1,"name":this.$t('planTable.inProduction')},
- ],
- formData:{
- updateSelectedProductCategory:"",
- updateSelectedProductState:""
- },
- }
- },
- mounted() {
- // 得到排产计划信息
- this.getSpinningPlanList();
- this.getSelectOptions();
- },
- methods: {
- selectedML(row){
- console.log(row.currentColorCode)
- if(row.currentColorCode){
- let tarName=this.options.find(item=>item.value==row.currentColorCode).colourNumber
- console.log("aaaaa=============",tarName)
- row.colourNumber=tarName;
- console.log("aaaaa=============",row)
- }
- },
- getProductChineseName(productId) {
- return this.productsInfo.find(product => product.id == productId).productName;
- },
- //修改计划里的删除计划
- deletePlan($index,row){
- console.log(row)
- getIsTheOrderProductProduced({"id":row.id}).then(resp=>{
- //if(resp.data.length>0){
- // this.$message({message: '当前计划订单产品在生产中已经不能删除', type: 'warning'});
- // return;//证明有在上级的产品--zhi能有一个上级产品
- // }else {
- //没有开始生产可以删除
- spinningFrameWinding(row.id).then(res=>{
- if(res.code==200){
- this.$message({
- message: this.$t('planTable.deleteSuccess'),
- type: 'success'
- });
- }
- this.onSubmit();
- this.getSpinningPlanList();
- })
- // }
- });
- },
- // 待机产品合并(五个显示为一排)
- splitList(list, chunkSize) {
- const chunks = [];
- for (let i = 0; i < list.length; i += chunkSize) {
- chunks.push(list.slice(i, i + chunkSize));
- }
- return chunks;
- },
- // 查询排产信息
- getSpinningPlanList() {
- getSpinningPlanList({"productionLineDepartment": this.$t('planTable.spinningDepartment')}).then((response) => {
- this.tableData = response.rows
- });
- },
- // 新增计划是得到产品信息
- getProductsInfo() {
- getProductsInfo("FK-").then((response) => {
- this.productsInfo = response.data;
- this.productsInfo.forEach(item => {
- // item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
- item.productName = item.productName+"—"+item.colours;
- });
- })
- },
- // 获取下拉数据
- async getSelectOptions() {
- try {
- let res = await getOptionLsit();
- if (res.code == 200) {
- this.dropDownData = res.data || {};
- // 初始化默认值
- if (
- this.dropDownData.work_shifts?.length > 0 &&
- this.excuteType == 1
- ) {
- this.formzdsj.workShifts = this.dropDownData.work_shifts[0].codeName;
- }
- if (this.dropDownData.level?.length > 0 && this.excuteType == 1) {
- this.formzdsj.levels = this.dropDownData.level[0].codeName;
- }
- if (
- this.dropDownData.drum_weight?.length > 0 &&
- this.excuteType == 1
- ) {
- this.formzdsj.canisterWeight =
- this.dropDownData.drum_weight[0].codeName;
- }
- if (
- this.dropDownData.box_weight?.length > 0 &&
- this.excuteType == 1
- ) {
- this.formzdsj.boxWeight = this.dropDownData.box_weight[0].codeName;
- }
- if (
- this.dropDownData.tube_color?.length > 0 &&
- this.excuteType == 1
- ) {
- this.formzdsj.tubeColor = this.dropDownData.tube_color[0].codeName;
- }
- } else {
- this.$message.error("网络异常!");
- }
- } catch (error) {}
- },
- // 下拉框数据改变查询色号批号信息
- selectedChangeDate(row,selectedProduct) {
- //选择的那个销售产品
- this.product = this.productsInfo.find(product => product.id === selectedProduct);
- //得到选择的商品
- this.form.product=selectedProduct;
- //通过母粒编码查询到对应的母粒信息
- // let queryParams = {
- // "materielCode": this.product.colourNumber
- // }
- // //得到对应的母粒信息
- // getMaterielInfo(queryParams).then((response) => {
- // if (response.data!=null) {
- // this.materiel = response.data;
- // console.log(response.data,"规格")
- // //色号 母粒编码+色号
- // row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
- // }
- // });
- //7月10号新需求修改
- //通过母粒编码查询到对应的母粒信息
- let queryParams = {
- // "materielCode": this.product.colourNumber,
- "materielSpecies":"1"
- }
- //得到对应的母粒信息
- getMaterielInfo(queryParams).then((response) => {
- if (response.data!=null) {
- let mls = response.data
- mls.forEach(dataKey => {
- this.options.push({
- "label":dataKey.materieEncoding+"("+dataKey.materieColorNumber+")",
- "value":dataKey.materieEncoding+"("+dataKey.materieColorNumber+")",
- "colourNumber":dataKey.materielCode
- })
- });
- //色号 母粒编码+色号
- // row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
- }
- });
- //isDisabled(有批号就用,没批号就自己输入)
- if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
- row.currentLotNumber=this.product.lotNumber;
- this.isDisabled=true;
- }else {
- this.isDisabled=false;
- row.currentLotNumber="";
- }
- //产品规格
- row.currentSpecification= this.product.productSpecifications;
- //合同号--销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
- row.salesmanId=this.product.saleOrderNo;
- //数量
- row.number=this.product.productNumber;
- },
- // 新增计划产品信息
- handleAddPlan(row) {
- this.getProductsInfo();
- this.nanInsertDialogTableVisible = true
- this.tableData2=[]
- //先清空
- this.machineId=""
- //当前操作机台号
- this.machineId=row.machineId;
- //机台id
- this.macId=row.macId;
- },
- // 新增删除行
- handleDelete(index, row) {
- // console.log(index,row)
- // this.tableData2[a];
- this.tableData2.splice(index, 1);
- // 把上一编辑行置回-1
- this.editingRowIndex = -1;
- },
- // 点击编辑行
- handleRowClick(row) {
- this.isEditLine = true;
- //找到当前行的编辑索引
- var rowIndex = this.tableData2.indexOf(row);
- console.log(rowIndex)
- if (this.lastEditLine != 0 &&
- this.editingRowIndex !== rowIndex &&
- this.editingRowIndex !== -1 &&
- !this.isRowFilled(this.tableData2[this.lastEditLine])) {
- this.$message({
- message: this.$t('planTable.completePreviousData'),
- type: 'warning'
- });
- return;
- }
- //编辑索引不等于当前编辑行索引
- if (this.editingRowIndex !== rowIndex) {
- // alert(this.editingRowIndex);
- if (this.editingRowIndex !== -1) {
- //把当前行变成不可编辑的
- this.tableData2[this.editingRowIndex].isEditing = false;
- }
- //把当前行变成可编辑的
- row.isEditing = true;
- this.editingRowIndex = rowIndex;
- }else {
- //把当前行变成可编辑的
- row.isEditing = true;
- this.editingRowIndex = rowIndex;
- }
- },
- // 光标失去焦点变成不可编辑
- handleInputBlur(row) {
- // let rowIndex = this.tableData2.indexOf(row);
- // //编辑索引不等于当前编辑行索引
- // if(row.isEditing="true"){
- // row.isEditing = false;
- // //对于整个表格来说
- // this.isEditLine = false;
- // //当前编辑行置为-1
- // this.editingRowIndex = -1;
- // }
- //编辑索引不等于当前编辑行索引
- // if (this.editingRowIndex !== rowIndex) {
- // if (this.isRowFilled(row)) {
- // row.isEditing = false;
- // //对于整个表格来说
- // this.isEditLine = false;
- // //当前编辑行置为-1
- // this.editingRowIndex = -1;
- // }
- // }
- },
- // 检查行是否填写完毕的示例方法
- isRowFilled(row) {
- return row.productionDigit &&
- row.currentColorCode &&
- row.currentSpecification &&
- row.currentLotNumber&&
- row.number&&
- row.tubecolor &&
- row.boxweight &&
- row.tubeweight;
- },
- // 新增一行标记为可编辑
- addEditableRow() {
- this.getProductsInfo();
- // 检查当前编辑行是否已填写完毕
- if(this.tableData2.length!=0){
- if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
- this.$message({
- message: this.$t('planTable.completePreviousData'),
- type: 'warning'
- });
- return;
- }
- //新增行之前先让以前的行不能编辑
- this.tableData2.forEach(item => {
- item.isEditing = false;
- })
- }
- this.tableData2.push({
- currentColorCode: '',
- currentSpecification: '',
- currentLotNumber: '',
- productionDigit: '',
- number:'',
- startTime: '',
- plannedEndTime:'',
- planStatus:0,
- productId:'',
- salesmanId:'',
- isEditing: true,
- planType: this.$t('planTable.spinningPlan'),
- colourNumber:""
- });
- this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
- this.lastEditLine = this.tableData2.length - 1
- },
- // 添加计划
- addPlanInfo(){
- if(this.tableData2.length<=0){
- this.$message({message: this.$t('planTable.addTableData'), type: 'warning'});
- }
- var flag=true;
- this.tableData2.forEach(item=>{
- if(!this.isRowFilled(item)){
- flag=false
- }
- })
- if(flag==false){
- this.$message({message: this.$t('planTable.completeTableData'), type: 'warning'});
- return ;
- }
- const datatime=Date.now()+this.machineId;
- let i=0
- //处理表格数据
- this.tableData2.forEach(item=>{
- item.timestampRandomCode=datatime;
- item.macId=this.macId;
- item.machineId=this.machineId;
- if(item.planStatus==1){
- i++
- }
- })
- if(i>=2){
- this.$message({
- message: this.$t('planTable.cannotAddTwoPlans'),
- type: 'warning'
- });
- return;
- }
- //先查询计划表中有没有正在上机的
- getPlanSpinningInfo({"machineId":this.machineId,"macId":this.macId,"planStatus":1}).then(response => {
- if(i>=1&&response.data.length>0){
- this.$message({
- message: this.$t('planTable.onlyOneInProduction'),
- type: 'warning'
- });
- return;
- }else {
- //添加计划信息
- addSpinningPlanList(this.tableData2).then(response => {
- if (response.code == 200) {
- this.$message({
- message: this.$t('planTable.addSuccess'),
- type: 'success'
- });
- this.getSpinningPlanList();
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- } else {
- this.$message({
- message: this.$t('planTable.addFailed'),
- type: 'error'
- });
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- }
- });
- }
- });
- },
- // 修改计划
- handleEditPlan(row) {
- //已经在待机列表了,isNull过滤掉了
- getProductsAll(row.macId).then((response) => {
- this.productsInfo = response.data;
- this.productsInfo.forEach(item => {
- item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
- });
- //当前操作机台号
- this.machineId=row.machineId;
- //机台id
- this.macId=row.macId;
- this.tableData2=[];
- //弹窗
- this.nanUpdateDialogTableVisible = true
- getPlanSpinningInfo({"macId":row.macId}).then((response) => {
- //得到生产中,停产的,待产的
- response.data.forEach(item => {
- item.isEditing=false;
- item.planStatus=parseInt(item.planStatus);
- item.productId=parseInt(item.productId)
- })
- this.tableData2=response.data;
- })
- })
- },
- // 弹窗里边的点击查询
- onSubmit(){
- this.formData.macId=this.macId;
- getPlanSpinningInfo(this.formData).then(response => {
- //得到生产中,停产的,待产的
- response.data.forEach(item => {
- item.isEditing=false;
- item.planStatus=parseInt(item.planStatus);
- })
- this.tableData2=response.data;
- });
- },
- // 重置
- reset(){
- this.formData.planStatus='';
- getPlanSpinningInfo({"macId":this.macId}).then(response => {
- //得到生产中,停产的,待产的
- response.data.forEach(item => {
- item.isEditing=false;
- item.planStatus=parseInt(item.planStatus);
- })
- this.tableData2=response.data;
- });
- },
- // 更新状态
- updateStatus(ind, row,planStatus){
- row.planType=this.$t('planTable.spinningPlan')
- if(!this.isRowFilled(row)){
- this.$message({message: this.$t('planTable.completeCurrentRow'), type: 'warning'});
- return;
- }
- if(row.planStatus=="2"){
- //如果说我要去停机一个产品我只需要去鉴别你这个产线上有没有停机或者上其他上机的产品
- getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":row.planStatus}).then(response => {
- if(response.data.length>0) {
- this.$message({message: this.$t('planTable.alreadyHasStopped'), type: 'warning'});
- return;//证明有在上级的产品--只能有一个上级或者停机的产品
- }else {
- getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":"1"}).then(response => {
- if(response.data.length>0){
- this.$message({message: this.$t('planTable.otherProductInProduction'), type: 'warning'});
- return;//证明有在上级的产品--zhi能有一个上级产品
- }else {
- updateSpinningInfoPlanOne(row).then(response=>{
- if (response.code == 200) {
- this.$message({
- message: this.$t('planTable.modifySuccess'),
- type: 'success'
- });
- this.getSpinningPlanList();
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- } else {
- this.$message({
- message: this.$t('planTable.modifyFailed'),
- type: 'error'
- });
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- }
- })
- }
- })
- }
- });
- return;
- }
- //判断当前计划是否已经投产
- getIsTheOrderProductProduced({"id":row.id}).then(resp=>{
- //if(resp.data.length>0){
- // this.$message({message: '当前计划订单产品在生产中已经不能修改', type: 'warning'});
- // return;//证明有在上级的产品--zhi能有一个上级产品
- // }
- //不等于0待机才去校验是否重复
- if(row.planStatus!=0){
- //先查询计划表中有没有正在上机的或者停机的
- getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":row.planStatus}).then(response => {
- if(response.data.length>0){
- if(row.planStatus==1){
- this.$message({message: this.$t('planTable.onlyOneInProduction'), type: 'warning'});
- return;//证明有在上级的产品--zhi能有一个上级产品
- }else {
- this.$message({message: this.$t('planTable.alreadyStopped'), type: 'warning'});
- return;//证明有在上级的产品--zhi能有一个上级产品
- }
- }else {
- if(row.planStatus==1){
- getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":"2"}).then(response => {
- if(response.data.length>0){
- this.$message({message: this.$t('planTable.needHandleStopped'), type: 'warning'});
- return;//证明有在上级的产品--zhi能有一个上级产品
- }else {
- updateSpinningInfoPlanOne(row).then(response=>{
- if (response.code == 200) {
- this.$message({
- message: this.$t('planTable.modifySuccess'),
- type: 'success'
- });
- this.getSpinningPlanList();
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- } else {
- this.$message({
- message: this.$t('planTable.modifyFailed'),
- type: 'error'
- });
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- }
- })
- }
- })
- }
- if(row.planStatus==2){
- getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":"1"}).then(response => {
- if(response.data.length>0){
- this.$message({message: this.$t('planTable.otherProductInProduction'), type: 'warning'});
- return;//证明有在上级的产品--zhi能有一个上级产品
- }else {
- updateSpinningInfoPlanOne(row).then(response=>{
- if (response.code == 200) {
- this.$message({
- message: this.$t('planTable.modifySuccess'),
- type: 'success'
- });
- this.getSpinningPlanList();
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- } else {
- this.$message({
- message: this.$t('planTable.modifyFailed'),
- type: 'error'
- });
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- }
- })
- }
- })
- }
- }
- });
- }else {
- //修改待机的话直接修改
- updateSpinningInfoPlanOne(row).then(response=>{
- if (response.code == 200) {
- this.$message({
- message: this.$t('planTable.modifySuccess'),
- type: 'success'
- });
- this.getSpinningPlanList();
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- } else {
- this.$message({
- message: this.$t('planTable.modifyFailed'),
- type: 'error'
- });
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- }
- })
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- .el-tabs--border-card >>> .el-tabs__content {
- padding: 0 !important;
- }
- .el-table__body-wrapper {
- cursor: grab;
- }
- .el-table__body-wrapper.grabbing {
- cursor: grabbing;
- }
- .container >>> .el-table .cell {
- white-space: pre-line;
- }
- </style>
|