| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124 |
- <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: '',
- 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) {
- 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);
- });
- },
- async getChooseEngrave() {
- await parameterGetByCode({
- code: 'work_hour'
- }).then((res) => {
- this.isReportTime = res.value == '1' ? true : false;
- });
- 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;
- 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.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));
- console.log(totalReportNum, totalNum, '1111');
- 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;
- return item;
- });
- console.log(this.List, '------------');
- let confirmList = [];
- // const confirmList = this.List[0].semiProductList.filter(
- // (item) => item.confirm == 1
- // );
- 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 (this.chooseListData.length > 0) {
- // this.checkChooseData(this.chooseListData, type, 'choose');
- // return;
- // } else {
- // this.checkChooseData(this.List, type, 'all');
- // return;
- // }
- console.log(this.List, 'this.List');
- if (confirmList.length > 0) {
- for (let i = 0; i < confirmList.length; i++) {
- // if (
- // !confirmList[i].extInfo.engrave &&
- // confirmList[i].confirm == 1
- // ) {
- // this.$message.warning('请输入刻码!');
- // return;
- // }
- 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].extInfo.engrave) {
- // this.$message.warning('请输入刻码!');
- // return;
- // }
- if (this.List[0].semiProductList[i].confirm == 1) {
- if (!this.List[0].semiProductList[i].extInfo.engrave) {
- this.$message.warning('请输入刻码!');
- return;
- }
- }
- }
- // this.List.forEach((item) => {
- // for (let i = 0; i < item.semiProductList.length; i++) {
- // if (!item.semiProductList[i].extInfo.engrave) {
- // this.$message.warning('请输入刻码!');
- // return;
- // }
- // }
- // });
- // for (let i = 0; i < this.List.length; i++) {
- // for(let j = 0; i < this.List[i].semiProductList.length; j++) {
- // }
- // // for (let j = 0; this.List[i].semiProductList.length; j++) {
- // // console.log(
- // // this.List[i].semiProductList[j],
- // // 'this.List[i].semiProductList[j]'
- // // );
- // // if (!this.List[i].semiProductList[j].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('请选择执行时间');
- }
- }
- // for (let i = 0; i < this.List.length; i++) {
- // if (
- // this.List[i].packInfo &&
- // Object.keys(this.List[i].packInfo).length === 0
- // ) {
- // this.loading.close();
- // return this.$message.warning('请到主数据配置包装规格');
- // }
- // }
- // if(this.taskObj.type !=6){
- // if(this.reportNeedFeed==1&&!(this.List[0].semiProductList.length>0||this.List[0].pickOutInList.length>0)){
- // 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'] != ''
- );
- });
- // if (!bol2) {
- // this.$message.warning('请输入合格品数量');
- // this.loading.close();
- // return false;
- // }
- // 预制体
- 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 (!bol) {
- // this.$message.warning(`请完善工单${wId}第${_i}处置方式`);
- // this.loading.close();
- // return false;
- // }
- 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;
- }
- }
- }
- }
- // let succ = this.List.some((L) => {
- // return L.productRecycleList.length > 0;
- // });
- // if (succ) {
- // const isRecycle = await this.checkRecycle();
- // if (!isRecycle) {
- // 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 (!isPack) {
- // return false
- // }
- }
- 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({
- // 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.jobBookReport();
- // })
- // .catch(() => {
- // this.loading.close();
- // });
- // } else {
- // this.jobBookReport();
- // }
- // });
- }
- await checkReportNumber(newList).then((res) => {
- if (res.length != 0) {
- this.checkJobBook(res);
- }
- });
- // 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.getList(this.idsList);
- // this.$emit('jobSuccess', 'Success');
- // })
- // .catch(() => {
- // this.loadingBtn = false;
- // this.loading.close();
- // });
- // .finally(() => {
- // setTimeout(function () {
- // this.loading.close();
- // }, 3000);
- // });
- },
- 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(
- `工单号${list.join(',')}已有报工,是否继续重复报工?`,
- '提示',
- {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: 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.getList(this.idsList);
- this.$emit('jobSuccess', 'Success');
- })
- .catch(() => {
- this.loadingBtn = false;
- this.loading.close();
- });
- },
- checkRecycle() {
- // this.loading.close();
- 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.$set(this.List[index].workReportInfo,'executorTime',timestampToDateTime(o.extInfo.workReportInfo.executorTime))
- 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>
|