| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531 |
- <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">
- <div class="name">批量报工时间:</div>
- </div>
- <el-date-picker
- v-model="executorTime"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- placeholder="选择日期"
- @change="handleCreate"
- >
- </el-date-picker>
- </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" v-if="!taskObj.isOrderListData">
- <div class="name">工单信息 </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"
- v-if="!taskObj.isOrderListData"
- ></workOrderBom>
- <!-- 报工时间 -->
- <div>
- <div class="title_box rx-bc">
- <div class="name">报工时间</div>
- </div>
- 报工时间:
- <el-date-picker
- v-model="item.workReportInfo.executorTime"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- placeholder="选择日期"
- style="margin-right: 25px; width: 190px"
- >
- </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
- >
- <el-option
- v-for="item in teamUserList"
- :label="item.name"
- :value="item.id"
- :key="item.id"
- >
- </el-option>
- </el-select>
- </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
- "
- :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>
- <!-- <checkbox :tableData="item.semiProductList" ></checkbox> -->
- <!-- :itemData="item" @tableDataFn="tableDataFn" -->
- <!-- 碳谷批量报工 -->
- <semiProductJobBomPL
- :singleReport="item.singleReport"
- v-if="
- item.semiProductList &&
- item.semiProductList.length != 0 &&
- taskObj.type != 4 &&
- 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"
- ></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="job"
- ref="pickingListRef"
- @allSelection="allSelection"
- ></pickingList>
- </div>
- </template>
- <script>
- import { listByIdsReport } 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: ''
- };
- },
- 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() {
- 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));
- console.log(list);
- list.map((item) => {
- item.workReportInfo.executorTime = e;
- });
- this.$set(this, 'List', list);
- }
- },
- async getTeamList(id) {
- const ids = id.split(',');
- this.teamList = [];
- this.teamUserList = [];
- await ids.forEach((item) => {
- getTeam(item).then((res) => {
- this.teamList.push({
- name: res.name,
- id: res.id
- });
- this.teamAllList.push(res.userVOList);
- });
- });
- },
- async getChooseEngrave() {
- 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;
- });
- },
- 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.pickOutInList = [];
- console.log('赋值了');
- } else if (
- this.clientEnvironmentId == 3 &&
- obj.singleReport == 0
- ) {
- if (obj.pickOutInList && obj.pickOutInList.length != 0) {
- obj.semiProductList = obj.pickOutInList;
- 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;
- console.log(item, 'item');
- return item;
- });
- obj.product = obj.product.map((item) => {
- if (this.taskObj.type != 6) {
- if (item['extInfo']?.reportWeight) {
- item['extInfo'].reportWeight = '';
- }
- }
- item.confirm = 0;
- console.log(item, 'item');
- return item;
- });
- obj.workReportInfo = {
- executorTime: null,
- formingNum: null,
- formingWeight: null,
- formedNum: null,
- formedWeight: null,
- taskId: this.taskObj.id,
- notFormedNum: null,
- notFormedWeigh: null
- };
- 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);
- },
- 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];
- },
- async save(type) {
- const required = await parameterGetByCode({
- code: 'mes_report_engrave_required'
- }).then((res) => {
- return res;
- });
- console.log(required, 'required');
- if (this.executorIdList.length == 0) {
- return this.$message.error('执行人不能为空!');
- }
- const executorList = [];
- this.executorIdList.forEach((item) => {
- this.teamUserList.forEach((it) => {
- if (item == it.id) {
- executorList.push({
- userId: it.id,
- jobNumber: it.jobNumber,
- name: it.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;
- // // }
- // // }
- // }
- }
- }
- }
- console.log('11111', this.List);
- this.loading = this.$loading({
- lock: true,
- text: '加载中',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- 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 != 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) {
- return false;
- }
- }
- }
- }
- // let succ = this.List.some((L) => {
- // return L.productRecycleList.length > 0;
- // });
- // if (succ) {
- // const isRecycle = await this.checkRecycle();
- // if (!isRecycle) {
- // return false;
- // }
- // }
- }
- console.log(this.item, '9999999999');
- if (this.taskObj.type == 4) {
- this.checkPack();
- // if (!isPack) {
- // return false
- // }
- }
- console.log('4444444444', this.List);
- 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 = [];
- }
- });
- console.log('ashsaoghaoghoasg');
- }
- 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;
- }
- console.log(this.List, 'this.List');
- // this.List[0].product = this.List[0].semiProductList;
- this.loadingBtn = true;
- jobSave(this.List)
- .then((res) => {
- this.loadingBtn = false;
- this.loading.close();
- this.$message.success('报工成功');
- 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);
- // });
- },
- 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;
- }
- ::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>
|