| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027 |
- <template>
- <div>
- <div class="top_fixed">
- <div
- style="display: flex; align-items: center; margin-right: 10px"
- v-if="List.length > 1"
- >
- <div class="rx-bc" v-if="isReportTime">
- <div class="name">批量报工时间:</div>
- <el-date-picker
- v-model="reportTime"
- type="datetimerange"
- range-separator="至"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- format="yyyy-MM-dd HH:mm:ss"
- value-format="yyyy-MM-dd HH:mm:ss"
- align="right"
- @change="changeBatchReportTime"
- :picker-options="pickerOptionsTwo"
- @calendar-change="handleCalendarChange"
- >
- </el-date-picker>
- </div>
- <div class="rx-bc" v-if="!isReportTime">
- <div class="name">批量报工时间:</div>
- <el-date-picker
- v-model="executorTime"
- type="datetime"
- format="yyyy-MM-dd HH:mm:ss"
- value-format="yyyy-MM-dd HH:mm:ss"
- placeholder="选择日期"
- @change="handleCreate"
- :picker-options="pickerOptions"
- >
- </el-date-picker>
- </div>
- </div>
- <el-button
- type="primary"
- size="mini"
- :loading="loadingBtn"
- @click="save(2, 'all')"
- >一键报工</el-button
- >
- <el-button type="primary" size="mini" @click="removeCacheFn('all')"
- >清空缓存</el-button
- >
- <el-button
- v-if="taskObj.type == 1"
- type="primary"
- size="mini"
- @click="save(1, 'all')"
- >缓存</el-button
- >
- </div>
- <div class="job_box">
- <div
- v-for="(item, index) in List"
- :key="index"
- class="card_box"
- v-if="isLoad"
- >
- <div class="title_box rx-bc">
- <div class="name" v-if="!taskObj.isOrderListData">工单信息 </div>
- <div class="name" v-else> </div>
- <div class="rx-bc">
- <el-button
- type="text"
- size="mini"
- @click="openPicking(item.workOrderId, item)"
- >手动添加</el-button
- >
- <el-button
- type="text"
- size="mini"
- @click="removeCacheFn(item.workOrderId)"
- >清空缓存</el-button
- >
- <el-button
- v-if="taskObj.type == 1"
- type="text"
- size="mini"
- @click="save(1, index)"
- >缓存</el-button
- >
- </div>
- </div>
- <!-- // 工单信息 -->
- <workOrderBom
- :item="item"
- :isReportWork="true"
- :isOrder="!taskObj.isOrderListData"
- ></workOrderBom>
- <!-- 报工时间 -->
- <div>
- <div class="title_box rx-bc">
- <div class="name">报工时间</div>
- </div>
- <div v-if="isReportTime">
- 报工时间
- <el-date-picker
- v-model="item.workReportInfo.reportTime"
- type="datetimerange"
- range-separator="至"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- format="yyyy-MM-dd HH:mm:ss"
- value-format="yyyy-MM-dd HH:mm:ss"
- align="right"
- style="margin-right: 10px"
- @change="changeReportTime(index)"
- :picker-options="pickerOptionsTwo"
- @calendar-change="handleCalendarChange"
- >
- </el-date-picker>
- 工时
- <el-input
- v-model="item.workReportInfo.workTime"
- placeholder="请输入工时"
- style="width: 220px"
- >
- <template slot="append">小时</template>
- </el-input>
- <div style="margin-top: 10px">
- 执行人:
- <el-select
- v-model="teamId"
- placeholder="请选择班组"
- filterable
- style="width: 120px"
- @change="checkTeamList(teamId)"
- >
- <el-option
- v-for="item in teamList"
- :label="item.name"
- :value="item.id"
- :key="item.id"
- >
- </el-option>
- </el-select>
- <el-select
- v-model="executorIdList"
- placeholder="请选择执行人"
- filterable
- multiple
- @change="changeId(index)"
- style="width: 160px"
- >
- <div class="checkboxWrapper">
- <el-checkbox v-model="checked" @change="checkChange(index)">
- 全选
- </el-checkbox>
- </div>
- <el-option
- v-for="item in teamUserList"
- :label="item.name"
- :value="item.id"
- :key="item.id"
- >
- </el-option>
- </el-select>
- </div>
- </div>
- <div v-else>
- 报工时间:
- <el-date-picker
- v-model="item.workReportInfo.executorTime"
- type="datetime"
- format="yyyy-MM-dd HH:mm:ss"
- value-format="yyyy-MM-dd HH:mm:ss"
- placeholder="选择日期"
- style="margin-right: 25px; width: 190px"
- :picker-options="pickerOptions"
- >
- </el-date-picker>
- 执行人:
- <el-select
- v-model="teamId"
- placeholder="请选择班组"
- filterable
- style="width: 120px"
- @change="checkTeamList(teamId)"
- >
- <el-option
- v-for="item in teamList"
- :label="item.name"
- :value="item.id"
- :key="item.id"
- >
- </el-option>
- </el-select>
- <el-select
- v-model="executorIdList"
- placeholder="请选择执行人"
- filterable
- multiple
- @change="changeId(index)"
- >
- <div class="checkboxWrapper">
- <el-checkbox v-model="checked" @change="checkChange">
- 全选
- </el-checkbox>
- </div>
- <el-option
- v-for="item in teamUserList"
- :label="item.name"
- :value="item.id"
- :key="item.id"
- >
- </el-option>
- </el-select>
- </div>
- </div>
- <paramBom
- v-if="item.paramDetailList.length != 0"
- :list="item.paramDetailList"
- ></paramBom>
- <!-- //报工信息 -->
- <div v-if="item.singleReport == 0">
- <jobBom
- :item="item"
- ref="jobBomRef"
- :notFormed="item.notFormedList"
- :warehouseList="warehouseList"
- ></jobBom>
- </div>
- <div v-if="item.singleReport == 1">
- <jobDdBom
- :item="item"
- ref="jobRef"
- :notFormed="item.notFormedList"
- :warehouseList="warehouseList"
- ></jobDdBom>
- </div>
- <!-- :item="item" :notFormed="item.notFormedList" :warehouseList="warehouseList" @modeNum='modeNum'-->
- <deviceBom
- v-if="item.equipmentList.length != 0"
- :list="item.equipmentList"
- ></deviceBom>
- <modelBom
- v-if="item.modelList.length != 0"
- :list="item.modelList"
- pattern="job"
- ref="modelRef"
- :item="item"
- ></modelBom>
- <palletBom
- v-if="item.palletList.length != 0"
- :list="item.palletList"
- ></palletBom>
- <revolvingDiskBom
- v-if="item.revolvingDiskList.length > 0"
- pattern="job"
- :list="objData.revolvingDiskList"
- >
- </revolvingDiskBom>
- <!-- 单件 报告信息 -->
- <semiProductJobBom
- :singleReport="item.singleReport"
- v-if="
- item.semiProductList &&
- item.semiProductList.length != 0 &&
- item.singleReport == 1 &&
- clientEnvironmentId != 3
- "
- :item="item"
- :list="item.semiProductList"
- :equipmentList="item.equipmentList"
- :isChoose="isChoose"
- @chooseData="chooseData"
- :isEngrave="isEngrave"
- :isDisposal="isDisposal"
- ></semiProductJobBom>
- <semiProductJobBom
- :singleReport="item.singleReport"
- v-if="
- item.semiProductList &&
- item.semiProductList.length != 0 &&
- item.singleReport == 1 &&
- clientEnvironmentId == 3 &&
- taskObj.type != 4
- "
- :item="item"
- :list="item.semiProductList"
- :equipmentList="item.equipmentList"
- :isChoose="isChoose"
- @chooseData="chooseData"
- :isEngrave="isEngrave"
- :isDisposal="isDisposal"
- ></semiProductJobBom>
- <!-- 通用批量报工 -->
- <batchSemiProductJobBom
- :singleReport="item.singleReport"
- v-if="
- item.product &&
- item.product.length != 0 &&
- item.singleReport == 0 &&
- clientEnvironmentId != 3
- "
- :item="item"
- :list="item.product"
- :equipmentList="item.equipmentList"
- :isChoose="isChoose"
- :isEngrave="isEngrave"
- :isDisposal="isDisposal"
- @chooseData="chooseData"
- ></batchSemiProductJobBom>
- <!-- <batchSemiProductJobBom
- :singleReport="item.singleReport"
- v-if="
- item.semiProductList &&
- item.semiProductList.length != 0 &&
- item.singleReport == 0 &&
- clientEnvironmentId == 3 &&
- taskObj.type == 4
- "
- :item="item"
- :list="item.semiProductList"
- :equipmentList="item.equipmentList"
- :isChoose="isChoose"
- :isEngrave="isEngrave"
- :isDisposal="isDisposal"
- @chooseData="chooseData"
- ></batchSemiProductJobBom> -->
- <!-- <checkbox :tableData="item.semiProductList" ></checkbox> -->
- <!-- :itemData="item" @tableDataFn="tableDataFn" -->
- <!-- 碳谷批量报工 -->
- <semiProductJobBomPL
- :singleReport="item.singleReport"
- v-if="
- item.semiProductList &&
- item.semiProductList.length != 0 &&
- taskObj.type != 6 &&
- item.singleReport == 0 &&
- clientEnvironmentId == 3
- "
- :item="item"
- :list="item.semiProductList"
- :equipmentList="item.equipmentList"
- @countNumPl="countNumPl"
- :isChoose="isChoose"
- :isEngrave="isEngrave"
- :isDisposal="isDisposal"
- :index="index"
- ></semiProductJobBomPL>
- <!-- <semiProductJobBom v-if="
- item.pickOutInList &&
- item.pickOutInList.length != 0 &&
- taskObj.type == 6 &&
- item.singleReport == 1
- " :item="item" :list="item.pickOutInList">
- </semiProductJobBom> -->
- <!-- 物料清单 -->
- <!-- <semiProductBom
- v-if="
- item.semiProductList.length != 0 &&
- item.singleReport == 0 &&
- clientEnvironmentId != 3
- "
- :list="item.semiProductList"
- :equipmentList="item.equipmentList"
- :workInfo="item"
- ></semiProductBom> -->
- <!-- 产品信息 -->
- <oneJobQualityBomPL
- v-if="
- item.semiProductList &&
- item.semiProductList.length != 0 &&
- taskObj.type == 6 &&
- item.singleReport == 0 &&
- clientEnvironmentId == 3
- "
- :item="item"
- :list="item.semiProductList"
- >
- </oneJobQualityBomPL>
- <byProductBom
- v-if="item.productRecycleList.length != 0"
- :list="item.productRecycleList"
- >
- </byProductBom>
- <turnoverBom
- v-if="item.turnover.length != 0"
- :list="item.turnover"
- :wordItem="item"
- pattern="job"
- >
- </turnoverBom>
- <aridRegion
- v-if="item.aridRegionList.length != 0"
- :list="item.aridRegionList"
- :isType="true"
- ></aridRegion>
- <!-- 这里是包装分组 -->
- <!-- <div
- v-if="
- item.currentTaskDiagram.type == 4 &&
- item.semiProductList.length != 0
- "
- >
- <semiProductJobBom
- :singleReport="item.singleReport"
- :item="item"
- :list="
- item.currentTaskDiagram.type == 4
- ? item.pickOutInList
- : item.semiProductList
- "
- :equipmentList="item.equipmentList"
- ></semiProductJobBom>
- </div>
- <div
- v-if="
- item.currentTaskDiagram.type == 4 && item.pickOutInList.length != 0
- "
- >
- <semiProductJobBom
- :singleReport="item.singleReport"
- :item="item"
- :list="
- item.currentTaskDiagram.type == 4
- ? item.pickOutInList
- : item.semiProductList
- "
- :equipmentList="item.equipmentList"
- ></semiProductJobBom>
- </div> -->
- <packingTgBom
- v-if="
- item.semiProductList &&
- item.semiProductList.length != 0 &&
- taskObj.type == 4 &&
- clientEnvironmentId == 3 &&
- item.singleReport == 1
- "
- :list="item.semiProductList"
- :item="item"
- :isChoose="isChoose"
- :isEngrave="isEngrave"
- :isDisposal="isDisposal"
- ></packingTgBom>
- <div
- v-if="
- item &&
- item.currentTaskDiagram.type == 4 &&
- clientEnvironmentId == 3 &&
- item.singleReport == 0
- "
- >
- <batchPackagingGrouping
- ref="packagingGroupingRef"
- :objData="item"
- :workOrderId="item.workOrderId"
- :taskId="item.currentTaskDiagram.taskId"
- >
- </batchPackagingGrouping>
- </div>
- <div
- v-if="
- item &&
- item.currentTaskDiagram.type == 4 &&
- clientEnvironmentId != 3
- "
- >
- <!-- <packagingGrouping
- ref="packagingGroupingRef"
- :objData="item"
- :workOrderId="item.workOrderId"
- :taskId="item.currentTaskDiagram.taskId"
- >
- </packagingGrouping> -->
- <batchPackagingGrouping
- ref="packagingGroupingRef"
- :objData="item"
- :workOrderId="item.workOrderId"
- :taskId="item.currentTaskDiagram.taskId"
- >
- </batchPackagingGrouping>
- </div>
- <!-- <packingBom :taskId='taskObj.id' :workOrderId="item.workOrderId" :objData="item" ref="packRef"
- v-if='taskObj.type == 4 && clientEnvironmentId != 3 && item'></packingBom> -->
- <!-- <semiProductJobBom
- :singleReport="item.singleReport"
- v-if="
- item.semiProductList &&
- item.semiProductList.length != 0 &&
- item.singleReport == 1
- "
- :item="item"
- :list="item.semiProductList"
- :equipmentList="item.equipmentList"
- :isChoose="isChoose"
- @chooseData="chooseData"
- :isEngrave="isEngrave"
- :isDisposal="isDisposal"
- ></semiProductJobBom> -->
- <!-- <packingTgBom
- v-if="
- item.semiProductList &&
- item.semiProductList.length != 0 &&
- taskObj.type == 4 &&
- clientEnvironmentId == 3
- "
- :list="item.semiProductList"
- :item="item"
- ></packingTgBom> -->
- <semiProductJobBom
- v-if="
- item.pickOutInList &&
- item.pickOutInList.length != 0 &&
- taskObj.type == 4 &&
- clientEnvironmentId == 3
- "
- :singleReport="item.singleReport"
- :list="item.semiProductList"
- :equipmentList="item.equipmentList"
- :item="item"
- @chooseData="chooseData"
- :isEngrave="isEngrave"
- :isDisposal="isDisposal"
- ></semiProductJobBom>
- </div>
- </div>
- <pickingList
- isType="feed"
- ref="pickingListRef"
- @allSelection="allSelection"
- ></pickingList>
- </div>
- </template>
- <script>
- import { listByIdsReport, checkReportNumber } from '@/api/produce/job';
- import { getWarehouseList } from '@/api/produce/index';
- import {
- jobSave,
- saveCache,
- getCache,
- removeCache
- } from '@/api/produce/workOrder';
- import pickingList from '../picking/pickingList.vue';
- import packagingGrouping from './components/packagingGrouping.vue';
- import workOrderBom from '../feeding/components/workOrderBom.vue';
- import paramBom from '../feeding/components/paramBom.vue';
- import jobBom from './components/jobBom.vue';
- import deviceBom from '../feeding/components/deviceBom.vue';
- import modelBom from '../feeding/components/modelBom.vue';
- import palletBom from './components/palletBom.vue';
- import revolvingDiskBom from '../feeding/components/revolvingDiskBom.vue';
- import oneJobQualityBom from './components/oneJobQualityBom.vue';
- import oneJobQualityBomPL from './components/oneJobQualityBomPL.vue';
- import jobDdBom from './components/jobDdBom.vue';
- import semiProductJobBom from './components/semiProductJobBom.vue';
- // import semiProductJobBom from './components/newSemiProductJobBom.vue';
- import semiProductJobBomPL from './components/semiProductJobBomPL.vue';
- import semiProductJobBomQT from './components/semiProductJobBomQT.vue';
- import batchSemiProductJobBom from './components/batchSemiProductJobBom.vue';
- import batchPackagingGrouping from './components/batchPackagingGrouping.vue';
- import semiProductBom from '../feeding/components/semiProductBom';
- // import byProductBom from './components/byProductBom.vue';
- import byProductBom from './components/newByProductBom.vue';
- import turnoverBom from './components/turnoverBom.vue';
- import aridRegion from '../feeding/components/aridRegion.vue';
- import packingBom from './components/packingBom.vue';
- import packingTgBom from './components/packingTgBom.vue';
- import { timestampToDateTime } from '@/utils/index.js';
- import { parameterGetByCode } from '@/api/system/dictionary-data';
- import { getTeam } from '@/api/produce/job.js';
- export default {
- components: {
- pickingList,
- packagingGrouping,
- workOrderBom,
- paramBom,
- jobBom,
- deviceBom,
- modelBom,
- palletBom,
- revolvingDiskBom,
- oneJobQualityBom,
- oneJobQualityBomPL,
- semiProductJobBomQT,
- semiProductJobBom,
- semiProductJobBomPL,
- byProductBom,
- turnoverBom,
- aridRegion,
- packingBom,
- jobDdBom,
- packingTgBom,
- semiProductBom,
- batchSemiProductJobBom,
- batchPackagingGrouping
- },
- props: {
- workListIds: {
- type: Array,
- default() {
- return [];
- }
- },
- reportNeedFeed: {},
- workPlanType: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- List: [],
- idsList: [],
- isLoad: false,
- executorTime: '',
- warehouseList: [],
- loading: null,
- loadingBtn: false,
- chooseListData: [],
- isChoose: false,
- isEngrave: false,
- isDisposal: false,
- teamList: [],
- teamAllList: [],
- teamUserList: [],
- executorIdList: [],
- teamId: '',
- teamName: '',
- checked: false,
- isReportTime: false,
- reportTime: '',
- workHour: '',
- pickerOptions: {
- disabledDate(time) {
- // 禁止选择大于当前时间的日期
- return time.getTime() > Date.now();
- }
- // selectableRange: (() => {
- // const now = new Date();
- // const start = '00:00:00';
- // const end = now.toTimeString().split(' ')[0];
- // return `${start} - ${end}`;
- // })()
- },
- pickerOptionsTwo: {
- disabledDate: (time) => {
- // 禁止选择当前时间之后的所有日期时间
- return time.getTime() > Date.now();
- },
- selectableRange: '00:00:00 - 23:59:59' // 默认全天可选,后面会动态修改
- }
- };
- },
- computed: {
- taskObj() {
- return this.$store.state.user.taskObj;
- },
- clientEnvironmentId() {
- return this.$store.state.user.info.clientEnvironmentId;
- }
- },
- watch: {
- workListIds: {
- handler(val) {
- this.getList(val);
- },
- deep: true,
- immediate: true
- },
- workPlanType: {
- handler(val) {
- if (val == 1) {
- this.getList(this.idsList);
- }
- }
- }
- },
- created() {
- this.getWarehouseListFn();
- this.getChooseEngrave();
- },
- mounted() {
- if (localStorage.getItem('singleUserInfo') == '1') {
- const data = JSON.parse(localStorage.getItem('chooseUserInfo'));
- this.getTeamList(data.teamId);
- } else {
- this.getTeamList(this.$store.state.user.info.teamId);
- }
- },
- methods: {
- checkPack() {
- this.$refs.packagingGroupingRef[0].getData();
- },
- handleCreate(e) {
- if (e) {
- const list = JSON.parse(JSON.stringify(this.List));
- list.map((item) => {
- item.workReportInfo.executorTime = e;
- });
- this.$set(this, 'List', list);
- }
- },
- changeBatchReportTime(e) {
- if (e) {
- const list = JSON.parse(JSON.stringify(this.List));
- list.map((item) => {
- item.workReportInfo.reportTime = e;
- const startTime = new Date(item.workReportInfo.reportTime[0]);
- const endTime = new Date(item.workReportInfo.reportTime[1]);
- const diffMs = endTime - startTime;
- const diffHours = diffMs / (1000 * 60 * 60);
- if (this.executorIdList.length != 0) {
- item.workReportInfo.workTime =
- Number(diffHours) * Number(this.executorIdList.length);
- }
- });
- this.$set(this, 'List', list);
- }
- },
- async getTeamList(id) {
- if (!id) return;
- const ids = id.split(',');
- this.teamList = [];
- this.teamUserList = [];
- const list = ids.map((item) => getTeam(item));
- const dataList = await Promise.all(list);
- dataList.forEach((item) => {
- this.teamList.push({
- name: item.name,
- id: item.id
- });
- this.teamAllList.push(item.userVOList);
- });
- },
- getNowTime() {
- const now = new Date();
- const year = now.getFullYear();
- const month = String(now.getMonth() + 1).padStart(2, '0');
- const day = String(now.getDate()).padStart(2, '0');
- const hour = String(now.getHours()).padStart(2, '0');
- const minute = String(now.getMinutes()).padStart(2, '0');
- const second = String(now.getSeconds()).padStart(2, '0');
- return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
- },
- async getChooseEngrave() {
- await parameterGetByCode({
- code: 'work_hour'
- }).then((res) => {
- this.isReportTime = res.value == '1' ? true : false;
- });
- const res = await parameterGetByCode({
- code: 'mes_order_feed_by_default_date'
- });
- if (res.value == '1') {
- const dateTime = this.getNowTime();
- this.$nextTick(() => {
- this.List.forEach((item) => {
- if (!item.workReportInfo) {
- this.$set(item, 'workReportInfo', {});
- }
- this.$set(item.workReportInfo, 'executorTime', dateTime);
- });
- });
- }
- // await parameterGetByCode({
- // code: 'mes_order_feed_by_default_date'
- // }).then((res) => {
- // if (res.value == '1') {
- // const dateTime = this.getNowTime();
- // this.List.forEach((item) => {
- // item.workReportInfo.executorTime = dateTime;
- // });
- // }
- // });
- await parameterGetByCode({
- code: 'choose_engrave'
- }).then((res) => {
- this.isChoose = res.value == '1' ? true : false;
- });
- await parameterGetByCode({
- code: 'batch_update_engrave'
- }).then((res) => {
- this.isEngrave = res.value == '1' ? true : false;
- });
- await parameterGetByCode({
- code: 'batch_disposal'
- }).then((res) => {
- this.isDisposal = res.value == '1' ? true : false;
- });
- await parameterGetByCode({
- code: 'default_executor'
- }).then((res) => {
- this.isDefaultExecutor = res.value == '1' ? true : false;
- if (this.isDefaultExecutor) {
- this.setDefaultIdList();
- }
- });
- },
- setDefaultIdList() {
- if (this.teamList.length != 0) {
- this.teamId = this.teamList[0].id;
- this.teamName = this.teamList[0].name;
- const index = this.teamList.findIndex(
- (item) => item.id == this.teamId
- );
- this.teamUserList = this.teamAllList[index];
- if (this.teamUserList) {
- const res = this.teamUserList.find(
- (it) => it.id == this.$store.state.user.info.userId
- );
- this.executorIdList.push(res.id);
- }
- // const res = this.teamUserList.find(
- // (it) => it.id == this.$store.state.user.info.userId
- // );
- // this.executorIdList.push(res.id);
- }
- },
- changeId(index) {
- if (this.isReportTime) {
- this.calculateWorkingHours(index);
- }
- if (this.executorIdList.length == this.teamUserList.length) {
- this.checked = true;
- } else {
- this.checked = false;
- }
- },
- changeReportTime(index) {
- if (this.List[index].workReportInfo.reportTime) {
- this.calculateWorkingHours(index);
- } else {
- this.List[index].workReportInfo.workTime = '';
- }
- },
- calculateWorkingHours(index) {
- const startTime = new Date(
- this.List[index].workReportInfo.reportTime[0]
- );
- const endTime = new Date(this.List[index].workReportInfo.reportTime[1]);
- const diffMs = endTime - startTime;
- const diffHours = diffMs / (1000 * 60 * 60);
- if (this.executorIdList.length != 0) {
- this.List[index].workReportInfo.workTime =
- Number(diffHours) * Number(this.executorIdList.length);
- }
- },
- checkChange(index) {
- if (this.checked) {
- this.executorIdList = [];
- this.executorIdList = this.teamUserList.map((item) => item.id);
- } else {
- this.executorIdList = [];
- this.List[index].workReportInfo.workTime = '';
- }
- if (this.isReportTime) {
- this.calculateWorkingHours(index);
- }
- },
- getList(ids) {
- this.idsList = ids || [];
- if (this.taskObj.id != -2) {
- let param = {
- ids: ids,
- taskId: this.taskObj.id,
- type: 0
- };
- this.isLoad = false;
- listByIdsReport(param)
- .then((res) => {
- this.List = res.map((obj) => {
- if (!Object.prototype.hasOwnProperty.call(obj, 'turnover')) {
- obj['turnover'] = [];
- }
- if (
- !Object.prototype.hasOwnProperty.call(obj, 'aridRegionList')
- ) {
- obj['aridRegionList'] = [];
- }
- if (
- !Object.prototype.hasOwnProperty.call(obj, 'instanceList')
- ) {
- obj['instanceList'] = [];
- }
- if (!Object.prototype.hasOwnProperty.call(obj, 'palletList')) {
- obj['palletList'] = [];
- }
- if (
- !Object.prototype.hasOwnProperty.call(
- obj,
- 'revolvingDiskList'
- )
- ) {
- obj['revolvingDiskList'] = [];
- }
- if (obj.palletList.length > 0) {
- obj.palletList = obj.palletList.map((m) => {
- return {
- hideKc: true, // 不显示库存
- quantity: m.feedQuantity,
- ...m
- };
- });
- }
- // console.log(this.taskObj.type, 'this.taskObj.type');
- if (
- (this.taskObj.type == 6 && obj.singleReport == 1) ||
- (this.clientEnvironmentId == 3 &&
- obj.singleReport == 0 &&
- this.taskObj.type == 6)
- ) {
- obj.semiProductList = obj.pickOutInList;
- obj.semiProductList.forEach((item) => {
- if (item.extInfo.taskId == -1) {
- item.extInfo.taskId = item.extInfo.taskId + '';
- }
- });
- obj.pickOutInList = [];
- console.log('赋值了');
- } else if (
- this.clientEnvironmentId == 3 &&
- obj.singleReport == 0
- ) {
- if (obj.pickOutInList && obj.pickOutInList.length != 0) {
- obj.semiProductList = obj.pickOutInList;
- obj.semiProductList.forEach((item) => {
- if (item.extInfo.taskId == -1) {
- item.extInfo.taskId = item.extInfo.taskId + '';
- }
- });
- obj.pickOutInList = [];
- }
- } else if (this.taskObj.type == 6 && obj.singleReport == 0) {
- obj.product = obj.pickOutInList;
- obj.pickOutInList = [];
- } else if (
- this.taskObj.type == 4 &&
- obj.singleReport == 0 &&
- this.clientEnvironmentId != 3
- ) {
- if (obj.pickOutInList && obj.pickOutInList.length != 0) {
- obj.product = obj.pickOutInList;
- obj.pickOutInList = [];
- }
- } else if (
- this.taskObj.type == 4 &&
- obj.singleReport == 1 &&
- this.clientEnvironmentId != 2
- ) {
- if (obj.pickOutInList && obj.pickOutInList.length != 0) {
- obj.semiProductList = obj.pickOutInList;
- obj.pickOutInList = [];
- }
- }
- if (
- obj.singleReport == 1 &&
- obj.currentTaskDiagram.type != 2 &&
- obj.currentTaskDiagram.type != 3 &&
- obj.currentTaskDiagram.type != 6
- ) {
- obj.semiProductList.map((item) => {
- item.extInfo.taskId = '';
- item.extInfo.taskName = '';
- });
- }
- if (
- obj.singleReport == 0 &&
- obj.currentTaskDiagram.type != 2 &&
- obj.currentTaskDiagram.type != 3 &&
- obj.currentTaskDiagram.type != 6
- ) {
- obj.product.map((item) => {
- item.extInfo.taskId = '';
- item.extInfo.taskName = '';
- });
- }
- if (
- this.clientEnvironmentId == 3 &&
- obj.singleReport == 0 &&
- this.taskObj.type != 6
- ) {
- obj.semiProductList.map((a) => {
- let feedQuantity = 0;
- let reportWeight = 0;
- let unFeedQuantity = 0;
- let unReportWeight = 0;
- if (
- a.extInfo &&
- a.extInfo.batchReportInfo &&
- a.extInfo.batchReportInfo.length != 0
- ) {
- a.extInfo.batchReportInfo.forEach((it) => {
- console.log(it, '1111111111');
- feedQuantity += Number(it.allFeedQuantity);
- reportWeight += Number(it.allReportWeight);
- });
- }
- if (
- a.extInfo &&
- a.extInfo.notBatchReportInfo &&
- a.extInfo.notBatchReportInfo.length != 0
- ) {
- a.extInfo.notBatchReportInfo.forEach((it) => {
- unFeedQuantity += Number(it.allFeedQuantity);
- unReportWeight += Number(it.allReportWeight);
- });
- }
- a.extInfo.batchReportInfo = [
- {
- allFeedQuantity: feedQuantity,
- allReportWeight: reportWeight,
- taskId: '',
- taskName: ''
- }
- ];
- a.extInfo.notBatchReportInfo = [
- {
- allFeedQuantity: unFeedQuantity,
- allReportWeight: unReportWeight,
- notType: '',
- taskId: '',
- taskName: '',
- notReason: ''
- }
- ];
- return {
- a
- };
- });
- obj.semiProductList = JSON.parse(
- JSON.stringify(obj.semiProductList)
- );
- }
- obj.semiProductList = obj.semiProductList.map((item) => {
- if (this.taskObj.type != 6) {
- if (item['extInfo']?.reportWeight) {
- item['extInfo'].reportWeight = '';
- }
- }
- item.confirm = 0;
- return item;
- });
- obj.product = obj.product.map((item) => {
- if (this.taskObj.type != 6) {
- if (item['extInfo']?.reportWeight) {
- item['extInfo'].reportWeight = '';
- }
- }
- item.confirm = 0;
- return item;
- });
- obj.workReportInfo = {
- executorTime: null,
- formingNum: null,
- formingWeight: null,
- formedNum: null,
- formedWeight: null,
- taskId: this.taskObj.id,
- notFormedNum: null,
- notFormedWeight: null,
- lossQuantity: null,
- lossWeight: null,
- executorStartTime: null,
- reportTime: '',
- workTime: ''
- };
- obj.notFormedList = [
- {
- notFormedNum: null,
- notFormedWeight: null,
- weightUnit: obj.weightUnit,
- unit: obj.unit,
- warehouseId: null // 处置 仓库id
- }
- ];
- if (obj.semiProductList.length != 0) {
- // 预制体报工
- obj.workReportInfo.formedNum = obj.semiProductList.length;
- let numCot = 0;
- let notFormedNum = 0;
- if (obj.semiProductList.length > 0) {
- obj.semiProductList.map((fitem) => {
- if (
- !fitem.extInfo.isQualified ||
- fitem.extInfo.isQualified == 1
- ) {
- numCot = numCot + fitem.feedQuantity || 1;
- } else {
- notFormedNum = notFormedNum + fitem.feedQuantity;
- }
- });
- obj.workReportInfo.formedNum = numCot;
- obj.workReportInfo.notFormedNum = notFormedNum;
- }
- } else if (obj.product.length != 0) {
- const formedNum = obj.product.reduce((acc, pro) => {
- return pro.feedQuantity &&
- (!pro.extInfo.isQualified || pro.extInfo.isQualified == 1)
- ? acc + Number(pro.feedQuantity)
- : acc;
- }, 0);
- const notFormedNum = obj.product.reduce((acc, pro) => {
- return pro.feedQuantity && pro.extInfo.isQualified == 2
- ? acc + Number(pro.feedQuantity)
- : acc;
- }, 0);
- obj.workReportInfo.formedNum = formedNum;
- obj.workReportInfo.notFormedNum = notFormedNum;
- }
- obj.workReportInfo.formingNum = obj.formingNum;
- obj.workReportInfo.formingWeight = obj.formingWeight;
- obj.workReportInfo.unit = obj.unit;
- obj.workReportInfo.weightUnit = obj.weightUnit;
- obj.workReportInfo.workOrderId = obj.workOrderId;
- obj.workReportInfo.executorTime = obj.executorTime;
- obj.paramDetailList.map((m) => {
- if (m.extInfo.textType == 5) {
- m.remainingTime = m.extInfo.remainingTime;
- }
- return {
- ...m.extInfo
- };
- });
- console.log(obj, 4445555);
- if (this.taskObj.type == 4) {
- let numVal = 0;
- obj.pickOutInList.map((item) => {
- numVal = numVal + item.feedQuantity;
- });
- obj.workReportInfo.formedNum = numVal;
- }
- return {
- ...obj
- };
- });
- if (this.clientEnvironmentId == 3) {
- this.List.forEach((item, index) => {
- if (
- item.semiProductList.length != 0 &&
- item.singleReport == 0
- ) {
- this.countNumPl(item.semiProductList, index);
- }
- });
- }
- })
- .finally(() => {
- this.isLoad = true;
- if (this.taskObj.type == 1) {
- this.getCacheFn();
- }
- });
- }
- },
- openPicking(id, item) {
- this.$refs.pickingListRef.open(
- id,
- item,
- '选择设备列表',
- this.taskObj.id
- );
- },
- allSelection(id, selectList) {
- console.log(id, selectList, 'allSelection');
- this.List.forEach((m) => {
- if (m.workOrderId == id) {
- let turnover = [];
- let equipmentList = []; // 生产设备
- selectList.forEach((f) => {
- if (f.rootCategoryLevelId == 4) {
- equipmentList = equipmentList.concat(f);
- }
- if (f.rootCategoryLevelId == 7) {
- turnover = turnover.concat(f);
- }
- });
- this.$set(m, 'equipmentList', equipmentList);
- this.$set(m, 'turnover', turnover);
- this.$forceUpdate();
- }
- });
- },
- chooseData(dataList) {
- this.chooseListData = this.deepCopy(dataList);
- // if (this.chooseListData.length > 0) {
- // this.chooseListData.forEach((item) => {
- // item.confirm = 1;
- // });
- // } else {
- // this.List.forEach((item) => {
- // item.semiProductList.forEach((fitem) => {
- // fitem.confirm = 0;
- // });
- // });
- // }
- },
- deepCopy(obj, hash = new WeakMap()) {
- if (obj === null) return null;
- if (obj instanceof Date) return new Date(obj);
- if (obj instanceof RegExp) return new RegExp(obj);
- if (typeof obj !== 'object' && typeof obj !== 'function') return obj;
- if (hash.has(obj)) return hash.get(obj); // 处理循环引用
- const result = Array.isArray(obj) ? [] : {};
- hash.set(obj, result); // 存储原始对象和其副本的映射关系
- return Object.keys(obj).reduce((acc, key) => {
- acc[key] = this.deepCopy(obj[key], hash);
- return acc;
- }, result);
- },
- checkTeamList(id) {
- this.executorIdList = [];
- const index = this.teamList.findIndex((item) => item.id == id);
- this.teamName = this.teamList[index].name;
- this.teamUserList = this.teamAllList[index];
- },
- toInteger(num) {
- const len = this.getDecimalLength(num);
- return {
- int: Math.round(num * Math.pow(10, len)),
- factor: Math.pow(10, len)
- };
- },
- add(a, b) {
- const { int: aInt, factor: aFactor } = this.toInteger(a);
- const { int: bInt, factor: bFactor } = this.toInteger(b);
- const maxFactor = Math.max(aFactor, bFactor);
- return (
- (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
- maxFactor
- );
- },
- getDecimalLength(num) {
- return (num.toString().split('.')[1] || '').length;
- },
- async checkReportNum() {
- for (let item of this.List) {
- if (item.currentTaskDiagram.isFirstTask == '1') {
- await checkReportNumber({
- currentTaskDiagram: item.currentTaskDiagram,
- workOrderId: item.workOrderId
- }).then((res) => {
- const totalNum = Number(item.formingNum);
- const reportNum = this.add(
- item.workReportInfo.notFormedNum,
- item.workReportInfo.formedNum
- );
- const totalReportNum = this.add(reportNum, Number(res));
- if (totalReportNum > totalNum) {
- this.$confirm('报工数量大于生产数量, 是否继续报工?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.$message({
- type: 'success',
- message: '删除成功!'
- });
- return true;
- })
- .catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- return false;
- });
- }
- });
- }
- }
- },
- handleCalendarChange(val) {
- if (!val || val.length === 0) return;
- const selected = val[val.length - 1]; // 当前选中的日期
- const now = new Date();
- const todayStr = now.toDateString();
- const selectedStr = new Date(selected).toDateString();
- if (todayStr === selectedStr) {
- // 如果选中的是今天,只能选择到当前时分秒
- const end = now.toTimeString().split(' ')[0];
- this.pickerOptions.selectableRange = `00:00:00 - ${end}`;
- } else {
- // 其他日期不限
- this.pickerOptions.selectableRange = '00:00:00 - 23:59:59';
- }
- },
- async save(type) {
- const required = await parameterGetByCode({
- code: 'mes_report_engrave_required'
- }).then((res) => {
- return res;
- });
- if (this.executorIdList.length == 0) {
- return this.$message.warning('执行人不能为空!');
- }
- const executorList = [];
- this.executorIdList.forEach((item) => {
- const data = this.teamUserList.find((it) => it.id == item);
- if (data) {
- executorList.push({
- userId: data.id,
- jobNumber: data.jobNumber,
- name: data.name
- });
- }
- });
- this.List = this.List.map((item) => {
- item.workReportInfo.executorList = executorList;
- item.workReportInfo.teamId = this.teamId;
- item.workReportInfo.teamName = this.teamName;
- return item;
- });
- let confirmList = [];
- this.List.forEach((item) => {
- item.semiProductList.forEach((it) => {
- if (it.confirm == 1) {
- confirmList.push(it);
- }
- });
- });
- if (required.value == '1' && this.List[0].singleReport == 1) {
- if (confirmList.length > 0) {
- for (let i = 0; i < confirmList.length; i++) {
- if (confirmList[i].confirm == 1) {
- if (!confirmList[i].extInfo.engrave) {
- this.$message.warning('请输入刻码!');
- return;
- }
- }
- }
- } else {
- if (this.List.length > 0) {
- console.log(this.List);
- for (let i = 0; i < this.List[0].semiProductList.length; i++) {
- if (this.List[0].semiProductList[i].confirm == 1) {
- if (!this.List[0].semiProductList[i].extInfo.engrave) {
- this.$message.warning('请输入刻码!');
- return;
- }
- }
- }
- }
- }
- }
- this.loading = this.$loading({
- lock: true,
- text: '加载中',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- if (this.isReportTime) {
- let arr = this.List.filter((L) => L.workReportInfo.reportTime);
- if (!arr.length) {
- this.loading.close();
- return this.$message.warning('请选择执行时间');
- }
- this.List.forEach((item) => {
- item.workReportInfo.executorStartTime =
- item.workReportInfo.reportTime[0];
- item.workReportInfo.executorTime =
- item.workReportInfo.reportTime[1];
- });
- } else {
- let arr = this.List.filter((L) => L.workReportInfo.executorTime);
- if (!arr.length) {
- this.loading.close();
- return this.$message.warning('请选择执行时间');
- }
- }
- let bol2;
- bol2 = this.List.every((e) => {
- return (
- // e.workReportInfo['formedNum'] && e.workReportInfo['formedNum'] != 0
- e.workReportInfo['formedNum'] != ''
- );
- });
- let wId;
- let bol = true;
- let _i;
- this.List.forEach((L) => {
- if (
- L.semiProductList.length > 0 &&
- this.taskObj.type != 4 &&
- L.singleReport == 1
- ) {
- bol = L.semiProductList.every((e, i) => {
- _i = i + 1;
- wId = L.code;
- if (this.taskObj.type == 6) {
- return (
- Object.prototype.hasOwnProperty.call(e.extInfo, 'taskId') &&
- e.extInfo.taskId
- );
- } else {
- if (e.extInfo.isQualified == 1 || e.extInfo.notType == 5) {
- return (
- Object.prototype.hasOwnProperty.call(e.extInfo, 'taskId') &&
- e.extInfo.taskId &&
- e.extInfo.reportWeight
- );
- } else {
- return (
- Object.prototype.hasOwnProperty.call(
- e.extInfo,
- 'notType'
- ) && e.extInfo.notType
- );
- }
- }
- });
- }
- if (L.workReportInfo.batchNo) {
- L.workReportInfo.batchNo = L.batchNo + L.workReportInfo.batchNo;
- }
- });
- if (this.clientEnvironmentId == 3) {
- for (const item of this.List) {
- if (item.singleReport == 0) {
- if (item.currentTaskDiagram.type == 6) {
- for (const it of item.sampleQuality) {
- const data = it.extInfo;
- if (data.batchReportInfo.length == 0) {
- if (!data.reportWeight) {
- this.loading.close();
- return this.$message.warning('报工重量不能为空');
- }
- } else if (data.batchReportInfo.length != 0) {
- for (const i of data.batchReportInfo) {
- if (i.allFeedQuantity) {
- if (!i.allReportWeight) {
- this.loading.close();
- return this.$message.warning('报工重量不能为空');
- }
- }
- }
- }
- }
- } else {
- for (const it of item.semiProductList) {
- const data = it.extInfo;
- for (const i of data.batchReportInfo) {
- if (i.allFeedQuantity) {
- if (!i.allReportWeight) {
- this.loading.close();
- return this.$message.warning('报工重量不能为空');
- }
- }
- }
- for (const i of data.notBatchReportInfo) {
- if (i.allFeedQuantity) {
- if (!i.allReportWeight) {
- this.loading.close();
- return this.$message.warning('不合格品重量不能为空');
- }
- }
- }
- }
- }
- } else {
- if (item.currentTaskDiagram.type != 4) {
- for (const it of item.semiProductList) {
- const data = it.extInfo;
- if (!data.reportWeight) {
- this.loading.close();
- return this.$message.warning('报工重量不能为空');
- }
- }
- }
- }
- }
- }
- if (this.clientEnvironmentId != 2) {
- for (let i = 0; i < this.List.length; i++) {
- for (let j = 0; j < this.List[i].productRecycleList.length; j++) {
- if (!this.List[i].productRecycleList[j].warehouseId) {
- const isRecycle = await this.checkRecycle();
- if (!isRecycle) {
- this.loading.close();
- return false;
- }
- }
- }
- }
- }
- if (this.taskObj.type == 4) {
- if (this.clientEnvironmentId == 3) {
- this.List.forEach((it) => {
- if (it.singleReport == 0) {
- this.checkPack();
- }
- });
- } else {
- this.checkPack();
- }
- }
- if (this.taskObj.type == 1) {
- const isCache = await this.checkCache(type);
- if (!isCache) {
- return false;
- }
- }
- if (
- this.clientEnvironmentId == 3 &&
- type == 2 &&
- this.taskObj.type == 6
- ) {
- this.List.forEach((L) => {
- if (L.singleReport == 0) {
- L.semiProductList = [];
- }
- });
- }
- let isSemiProduct = false;
- this.List.map((semi) => {
- if (
- semi.semiProductList.length == 0 &&
- semi.singleReport == 1 &&
- semi.currentTaskDiagram.isFirstTask == 1 &&
- this.clientEnvironmentId != 3
- ) {
- isSemiProduct = true;
- this.loading.close();
- setTimeout(() => {
- this.$message.warning({
- message: '请工单编号:' + semi.code + '先创建在制品',
- key: semi.code // 使用当前时间作为key,确保唯一性
- });
- }, 500);
- }
- if (semi.semiProductList.length == 0 && semi.singleReport == 0) {
- semi.semiProductList.map((ditem) => {
- if (ditem.extInfo.batchReportInfo) {
- ditem.extInfo.batchReportInfo.map((baItem) => {
- let idvalue = baItem.deviceId
- ? baItem.deviceId.split('/')
- : '';
- baItem.deviceId = idvalue ? idvalue[0] : '';
- });
- }
- if (ditem.extInfo.notBatchReportInfo) {
- ditem.extInfo.notBatchReportInfo.map((noItem) => {
- let idvalue = noItem.deviceId
- ? noItem.deviceId.split('/')
- : '';
- noItem.deviceId = idvalue ? idvalue[0] : '';
- });
- }
- });
- }
- });
- if (isSemiProduct) {
- this.loading.close();
- return;
- }
- let newList = [];
- for (let item of this.List) {
- newList.push({
- currentTaskDiagram: item.currentTaskDiagram,
- workOrderId: item.workOrderId
- });
- }
- await checkReportNumber(newList).then((res) => {
- if (res.length != 0) {
- this.checkJobBook(res);
- }
- });
- },
- checkJobBook(list) {
- let wordCodeList = [];
- let reportCodeList = [];
- for (let item of list) {
- if (item.reportFormed != '0') {
- wordCodeList.push(item.workOrderCode);
- }
- }
- if (!this.isReportTime) {
- for (let item of list) {
- for (let it of this.List) {
- if (item.workOrderCode == it.code) {
- if (item.feedDate) {
- const t1 = new Date(item.feedDate);
- const t2 = new Date(it.workReportInfo.executorTime);
- if (t1 > t2) {
- reportCodeList.push(item.workOrderCode);
- }
- }
- if (item.reportDate) {
- const t1 = new Date(item.reportDate);
- const t2 = new Date(it.workReportInfo.executorTime);
- if (t1 > t2) {
- reportCodeList.push(item.workOrderCode);
- }
- }
- }
- }
- }
- }
- if (reportCodeList.length != 0) {
- this.$confirm(
- `工单号${reportCodeList.join(
- ','
- )}报工时间大于上道工序的执行时间,是否继续报工?`,
- '提示',
- {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }
- )
- .then(() => {
- return this.checkWorkCode(wordCodeList);
- })
- .catch(() => {
- this.loading.close();
- });
- } else {
- this.checkWorkCode(wordCodeList);
- }
- },
- checkWorkCode(list) {
- if (list.length != 0) {
- this.$confirm(
- `工单号:<br>${list.join('<br>')}<br>已有报工,是否继续重复报工?`,
- '提示',
- {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true,
- dangerouslyUseHTMLString: true
- }
- )
- .then(() => {
- this.jobBookReport();
- })
- .catch(() => {
- this.loading.close();
- });
- } else {
- this.jobBookReport();
- }
- },
- jobBookReport() {
- this.loadingBtn = true;
- jobSave(this.List)
- .then((res) => {
- this.loadingBtn = false;
- this.loading.close();
- this.$message.success('报工成功');
- this.checked = false;
- this.executorIdList = [];
- this.teamId = '';
- this.teamName = '';
- this.getList(this.idsList);
- this.$emit('jobSuccess', 'Success');
- })
- .catch(() => {
- this.loadingBtn = false;
- this.loading.close();
- });
- },
- checkRecycle() {
- return new Promise((resolve) => {
- this.$confirm('是否跳过副产品回收处置!', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- resolve(true);
- })
- .catch(() => {
- resolve(false);
- });
- });
- },
- checkCache(type) {
- return new Promise((resolve) => {
- if (type == 1) {
- saveCache(this.List).then((rr) => {
- this.$message.success('缓存成功');
- this.loading.close();
- });
- resolve(false);
- } else if (type == 2) {
- resolve(true);
- }
- });
- },
- getCacheFn() {
- let parma = {
- workOrderIds: this.idsList,
- taskId: this.taskObj.id,
- type: 1
- };
- getCache(parma).then((res) => {
- this.List.forEach((f, index) => {
- res.forEach((o) => {
- if (f.workOrderId == o.workOrderId) {
- f['product'] = o.extInfo.product;
- f['workReportInfo'] = o.extInfo.workReportInfo;
- f['notFormedList'] = o.extInfo.notFormedList;
- f['turnover'] = o.extInfo.turnover;
- f['productRecycleList'] = o.extInfo.productRecycleList;
- f['semiProductList'] = o.extInfo.semiProductList;
- f['modelList'] = o.extInfo.modelList;
- this.$forceUpdate();
- }
- });
- });
- });
- },
- removeCacheFn(type) {
- this.$confirm('是否清空缓存', '缓存')
- .then(() => {
- let parma = {
- workOrderIds: type == 'all' ? this.idsList : [type],
- taskId: this.taskObj.id,
- type: 1
- };
- removeCache(parma).then((res) => {
- this.$message.success('已经清空缓存');
- this.getList(this.idsList);
- });
- })
- .catch(() => {});
- },
- getWarehouseListFn() {
- getWarehouseList().then((res) => {
- this.warehouseList = res.data;
- });
- },
- //批量报工合格不合格重量统计
- countNumPl(list, index) {
- console.log('11111122222333', list);
- //合格总数
- let formedNumCount = 0;
- //合格总重量
- let formedWeightCount = 0;
- //不合格总数
- let notFormedNumCount = 0;
- //不合格总重量
- let notFormedWeightCount = 0;
- list.map((item) => {
- //合格总数
- item.extInfo.batchReportInfo.forEach((m) => {
- formedNumCount = formedNumCount + Number(m.allFeedQuantity || 0);
- });
- //合格总重量
- item.extInfo.batchReportInfo.forEach((w) => {
- formedWeightCount =
- formedWeightCount + Number(w.allReportWeight || 0);
- });
- //不合格总数
- item.extInfo.notBatchReportInfo.forEach((nf) => {
- notFormedNumCount =
- notFormedNumCount + Number(nf.allFeedQuantity || 0);
- });
- //不合格总重量
- item.extInfo.notBatchReportInfo.forEach((nw) => {
- notFormedWeightCount =
- notFormedWeightCount + Number(nw.allReportWeight || 0);
- });
- });
- this.$set(this.List[index].workReportInfo, 'formedNum', formedNumCount); //合格总数
- this.$set(
- this.List[index].workReportInfo,
- 'formedWeight',
- formedWeightCount
- ); //合格总重量
- this.$set(
- this.List[index].workReportInfo,
- 'notFormedNum',
- notFormedNumCount
- ); //不合格总数
- this.$set(
- this.List[index].workReportInfo,
- 'notFormedWeight',
- notFormedWeightCount
- ); //不合格总重量
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .top_fixed {
- width: 100%;
- height: 40px;
- background: #fff;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- }
- .title_box {
- padding: 10px 0;
- .name {
- font-size: 14px;
- font-style: normal;
- font-weight: 400;
- color: #157a2c;
- padding-left: 5px;
- position: relative;
- &:before {
- position: absolute;
- content: '';
- left: 0px;
- top: 0px;
- bottom: 0px;
- width: 2px;
- height: 14px;
- background: #157a2c;
- margin: auto;
- }
- }
- }
- .job_box {
- // margin-top: 6px;
- width: 100%;
- height: calc(100vh - 70px - 50px - 80px - 60px);
- overflow-y: scroll;
- overflow-x: hidden;
- }
- .card_box {
- background: #fff;
- padding: 8px;
- border-radius: 2px;
- }
- .checkboxWrapper {
- padding: 8px 20px;
- border-bottom: 1px solid #ccc;
- }
- ::v-deep .el-select__tags {
- flex-wrap: nowrap;
- overflow: auto;
- }
- /* 输入框最大宽度*/
- ::v-deep .el-select__tags-text {
- max-width: 90px;
- }
- /* 底部滚动条的高度*/
- ::v-deep .el-select__tags::-webkit-scrollbar {
- height: 2px !important;
- }
- </style>
|