| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498 |
- <template>
- <!-- 报工页面 -->
- <view class="content-box">
- <uni-nav-bar
- fixed="true"
- statusBar="true"
- left-icon="back"
- :title="title"
- background-color="#F7F9FA"
- color="#000"
- @clickLeft="back"
- right-icon="scan"
- @clickRight="HandlScanCode"
- >
- </uni-nav-bar>
- <view class="list_box">
- <u-list @scrolltolower="scrolltolower">
- <view class="card_box">
- <!-- 工单信息 objData 报告信息-->
- <workOrderBom
- :item="objData"
- v-if="objData"
- pType="job"
- :taskType="taskType"
- @handleScan="handleScan"
- >
- </workOrderBom>
- <paramBom
- v-if="paramDetailList.length != 0"
- :list="paramDetailList"
- ></paramBom>
- <!-- 设备信息 -->
- <deviceBom
- v-if="objData.equipmentList.length != 0"
- :list="objData.equipmentList"
- :ishuoWei="false"
- :wordItem="objData"
- :isDetails="true"
- >
- </deviceBom>
- <modelBom
- v-if="objData.modelList.length != 0"
- :list="objData.modelList"
- pattern="job"
- ref="modelRef"
- >
- </modelBom>
- <!-- 1报工信息 -->
- <!-- <view v-if="clientEnvironmentId == 3">
- <view v-if="objData.singleReport !== 1">
- <jobBom
- v-if="isLoad"
- :item="objData"
- ref="jobReftg"
- :notFormed="objData.notFormedList"
- @penalize="penalize"
- @modeNum="modeNum"
- ></jobBom>
- </view>
- </view> -->
- <!-- <view>3333</view> -->
- <!-- <view v-if=""></view> -->
- <!-- 单独报工报工信息 -->
- <!-- single -->
- <singleJobBom
- v-if="objData.singleReport == 1"
- :item="objData"
- ref="jobRef"
- :notFormed="objData.notFormedList"
- @penalize="penalize"
- @modeNum="modeNum"
- ></singleJobBom>
- <!-- 批量报工 -->
- <batchJobBom
- v-else-if="
- objData.currentTaskDiagram &&
- objData.currentTaskDiagram.type &&
- objData.singleReport == 0
- "
- :item="objData"
- ref="jobReftg"
- :notFormed="objData.notFormedList"
- :currentTask="objData.currentTaskDiagram"
- @penalize="penalize"
- @modeNum="modeNum"
- ></batchJobBom>
- <palletBom
- v-if="objData.palletList.length != 0"
- :palletList="objData.palletList"
- ></palletBom>
- <revolvingDiskBom
- v-if="isLoad && objData.revolvingDiskList.length > 0"
- pattern="job"
- :revolvingDiskList="objData.revolvingDiskList"
- ></revolvingDiskBom>
- <!-- <oneJobBom
- v-if='objData.instanceList && objData.instanceList.length != 0 && taskType != 4 && taskType != 6'
- :item='objData' :list='objData.instanceList'>
- </oneJobBom> -->
- <!-- -->
- <!-- 报工信息 列表 -->
- <view
- v-if="clientEnvironmentId == 3 || this.objData.singleReport !== 1"
- >
- <semiProductJobBom
- v-if="
- objData.semiProductList &&
- objData.semiProductList.length != 0 &&
- taskType != 4 &&
- taskType != 6 &&
- objData.singleReport == 1
- "
- :item="objData"
- :list="objData.semiProductList"
- :equipmentList="objData.equipmentList"
- @weightEmit="weightEmit"
- >
- </semiProductJobBom>
- </view>
- <!-- <view v-if="this.objData.singleReport">
-
- </view> -->
- <semiProductJobBomPL
- v-if="
- objData.semiProductList &&
- objData.semiProductList.length != 0 &&
- taskType != 4 &&
- taskType != 6 &&
- objData.singleReport == 0
- "
- :item="objData"
- :list="objData.semiProductList"
- :equipmentList="objData.equipmentList"
- @countNumPl="countNumPl"
- >
- </semiProductJobBomPL>
- <oneJobQualityBom
- v-if="
- objData.semiProductList &&
- objData.semiProductList.length != 0 &&
- taskType == 6 &&
- clientEnvironmentId == 3 &&
- objData.singleReport == 1
- "
- :item="objData"
- :list="objData.semiProductList"
- @weightEmit="weightEmit"
- ></oneJobQualityBom>
- <oneJobQualityBomPL
- v-if="
- objData.semiProductList &&
- objData.semiProductList.length != 0 &&
- taskType == 6 &&
- clientEnvironmentId == 3 &&
- objData.singleReport == 0
- "
- :item="objData"
- :list="objData.semiProductList"
- ></oneJobQualityBomPL>
- <!-- 副产品 -->
- <byProductBom
- v-if="objData.productRecycleList.length != 0"
- :list="objData.productRecycleList"
- @penalize="penalize"
- >
- </byProductBom>
- <!-- 周转车 -->
- <turnoverBom
- v-if="objData.turnover.length != 0"
- :list="objData.turnover"
- :itemValue="objData"
- :wordItem="objData"
- pattern="job"
- @handleScan="handleScan"
- @formedNumFn="formedNumFn"
- >
- </turnoverBom>
- <!-- // 区域扫码 -->
- <aridRegion
- v-if="objData.aridRegionList.length != 0"
- :list="objData.aridRegionList"
- :remainingTime="remainingTime"
- @handleScan="handleScan"
- :isType="true"
- ></aridRegion>
- <!-- //包装扫码 -->
- <!-- <view v-if="clientEnvironmentId != 2 && objData.singleReport !== 1">
- <packingBom
- :taskId="taskId"
- :workOrderId="id"
- :objData="objData"
- ref="packRef"
- v-if="taskType == 4 && clientEnvironmentId != 3 && objData"
- :categoryId="categoryId"
- >
- </packingBom>
- </view> -->
- <!-- 通用包装 -->
- <view v-if="clientEnvironmentId != 2 && clientEnvironmentId != 3">
- <packingBom
- :taskId="taskId"
- :workOrderId="id"
- :objData="objData"
- ref="packRef"
- v-if="taskType == 4 && clientEnvironmentId != 3 && objData"
- :categoryId="categoryId"
- >
- </packingBom>
- </view>
- <!-- 碳谷 包装扫码 -->
- <packingTgBom
- v-if="
- objData.pickOutInList &&
- objData.pickOutInList.length != 0 &&
- taskType == 4 &&
- clientEnvironmentId == 3
- "
- :list="objData.pickOutInList"
- :objData="objData"
- :item="objData"
- ></packingTgBom>
- <view class="operate_box rx-sc">
- <u-button
- size="small"
- class="u-reset-button"
- type="success"
- @click="handAdd"
- >手动添加</u-button
- >
- </view>
- <view style="height: 100rpx"></view>
- </view>
- </u-list>
- </view>
- <view :class="[operateBtn ? 'flex_btn' : 'flex_btn2']">
- <image
- v-if="operateBtn"
- class="jiantou"
- src="../../../../static/rightJt.png"
- @click="operateBtn = false"
- >
- </image>
- <view class="close_box" @click="operateBtn = true">
- <image
- v-if="!operateBtn"
- class="close"
- src="../../../../static/close.png"
- ></image>
- </view>
- <view v-if="!operateBtn" @click="removeCacheFn()">清空缓存</view>
- <view v-if="!operateBtn" @click="switchOrder = true">切换工单</view>
- </view>
- <view class="bottom-wrapper">
- <view class="btn_box" @click="save(1)">缓存</view>
- <view class="btn_box" @click="save(2)">一键报工</view>
- </view>
- <SearchPopup mode="bottom" v-if="searchShow">
- <template v-slot:list>
- <view class="search_list">
- <u-form
- labelPosition="left"
- :model="formData"
- labelWidth="180"
- labelAlign="left"
- class="baseForm"
- >
- <u-form-item
- label="仓库:"
- class="required-form"
- borderBottom
- prop="warehouseId"
- >
- <zxz-uni-data-select
- :localdata="warehouseList"
- v-model="formData.warehouseId"
- dataValue="id"
- dataKey="name"
- filterable
- format="{name}"
- ></zxz-uni-data-select>
- </u-form-item>
- </u-form>
- </view>
- </template>
- <template v-slot:operate>
- <view class="operate_box rx-bc">
- <u-button size="small" class="u-reset-button" @click="searchCancel">
- 取消
- </u-button>
- <u-button
- type="success"
- size="small"
- class="u-reset-button"
- @click="popupOk"
- >
- 确定
- </u-button>
- </view>
- </template>
- </SearchPopup>
- <SearchPopup mode="center" v-if="switchOrder">
- <template v-slot:list>
- <view class="search_list2">
- <u-form
- labelPosition="left"
- :model="formData"
- labelWidth="180"
- labelAlign="left"
- class="baseForm"
- >
- <u-form-item
- label="工单:"
- class="required-form"
- borderBottom
- prop="warehouseId"
- >
- <zxz-uni-data-select
- :localdata="warehouseList"
- v-model="formData.warehouseId"
- dataValue="id"
- dataKey="name"
- filterable
- format="{name}"
- ></zxz-uni-data-select>
- </u-form-item>
- </u-form>
- </view>
- </template>
- <template v-slot:operate>
- <view class="operate_box rx-bc">
- <u-button
- size="small"
- class="u-reset-button"
- @click="switchOrder = false"
- >
- 取消
- </u-button>
- <u-button type="success" size="small" class="u-reset-button">
- 确定
- </u-button>
- </view>
- </template>
- </SearchPopup>
- </view>
- </template>
- <script>
- import {
- getByIdReport,
- outSourceGetByIdReport,
- getByCodeReport,
- jobSave,
- } from "@/api/pda/jobBooking.js";
- import {
- scanLedger,
- getWarehouseList,
- saveCache,
- getCache,
- removeCache,
- } from "@/api/pda/workOrder.js";
- import workOrderBom from "../../feeding/components/workOrderBom.vue";
- import deviceBom from "../../feeding/components/deviceBom.vue";
- import modelBom from "../../feeding/components/modelBom.vue";
- import jobBom from "../components/jobBom.vue";
- import singleJobBom from "../components/singleJobBom.vue";
- import palletBom from "../components/palletBom.vue";
- import oneJobBom from "../components/oneJobBom.vue";
- import semiProductJobBom from "../components/semiProductJobBom.vue";
- import semiProductJobBomPL from "../components/semiProductJobBomPL.vue";
- import byProductBom from "../components/byProductBom";
- import turnoverBom from "../components/turnoverBom.vue";
- import aridRegion from "../../feeding/components/aridRegion.vue";
- import paramBom from "../../feeding/components/paramBom.vue";
- import packingBom from "../components/packingBom.vue";
- import packingTgBom from "../components/packingTgBom";
- import revolvingDiskBom from "../../feeding/components/revolvingDiskBom.vue";
- import SearchPopup from "../../components/searchPopup.vue";
- import oneJobQualityBom from "../components/oneJobQualityBom.vue";
- import oneJobQualityBomPL from "../components/oneJobQualityBomPL.vue";
- import batchJobBom from "../components/batchJobBom.vue";
- import workInProgressList from "../components/workInProgressList.vue";
- export default {
- components: {
- workOrderBom,
- deviceBom,
- modelBom,
- jobBom,
- singleJobBom,
- palletBom,
- oneJobBom,
- semiProductJobBom,
- semiProductJobBomPL,
- byProductBom,
- turnoverBom,
- aridRegion,
- paramBom,
- packingBom,
- packingTgBom,
- revolvingDiskBom,
- SearchPopup,
- oneJobQualityBom,
- oneJobQualityBomPL,
- batchJobBom,
- workInProgressList,
- },
- data() {
- return {
- title: "",
- taskType: 1,
- isLoad: true,
- categoryId: "",
- objData: {
- formedNumLast: 0,
- product: [],
- equipmentList: [],
- modelList: [],
- turnover: [],
- productRecycleList: [],
- aridRegionList: [],
- palletList: [],
- workReportInfo: {},
- notFormedList: [], // 报工-不合格
- },
- searchShow: false,
- switchOrder: false,
- warehouseList: [],
- formData: {
- warehouseId: "",
- },
- penalizeIndex: null,
- paramDetailList: [],
- remainingTime: 0,
- id: null,
- taskId: null,
- clientEnvironmentId:
- uni.getStorageSync("userInfo") &&
- uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
- operateBtn: true,
- isOutsource: 0,
- };
- },
- onLoad(options) {
- this.info = options.info;
- this.title = options.taskName ? options.taskName + "-报工" : "报工";
- this.taskType = options.taskType;
- this.id = options.id;
- this.taskId = options.taskId;
- this.isOutsource = options.isOutsource;
- this.categoryId = options.categoryId;
- this.singleReport = options.singleReport; // 单个报工 1是单 2多
- this.getList();
- },
- onShow() {
- uni.$off("setSelectList");
- uni.$on("setSelectList", (selectList, id) => {
- let turnover = [];
- let equipmentList = []; // 生产设备
- let isEquipment = this.objData.equipmentList.length > 0 ? true : false; // 判断是否有设置
- selectList.forEach((f) => {
- if (f.rootCategoryLevelId == 4) {
- // 生产设备
- if (isEquipment) {
- equipmentList = this.objData.equipmentList;
- } else {
- equipmentList = equipmentList.concat(f);
- }
- }
- if (f.rootCategoryLevelId == 7) {
- // 周转车
- turnover = turnover.concat(f);
- }
- });
- this.$set(this.objData, "equipmentList", equipmentList);
- this.$set(this.objData, "turnover", turnover);
- this.$forceUpdate();
- });
- },
- methods: {
- weightEmit(formedWeight, notFormedWeight) {
- this.$refs.jobReftg.fWeightInput(formedWeight, notFormedWeight);
- this.$nextTick(() => {
- this.$set(this.objData.workReportInfo, "formedWeight", formedWeight);
- this.$set(
- this.objData.workReportInfo,
- "notFormedWeight",
- notFormedWeight
- );
- });
- this.$forceUpdate();
- },
- // 相机扫码
- HandlScanCode() {
- uni.scanCode({
- success: (res) => {
- this.scanItAllData(res.result);
- },
- });
- },
- scanItAllData(result) {
- scanLedger(result).then((res) => {
- if (res[0].rootCategoryLevelId == 4) {
- // 设备
- let isFals = this.objData.equipmentList.some((m) => m.code == result);
- if (isFals) {
- uni.showToast({
- title: "设备已存在",
- icon: "none",
- });
- return false;
- }
- this.objData.equipmentList.push(res[0]);
- this.$forceUpdate();
- }
- if (res.length >= 1 && res[0].rootCategoryLevelId == 5) {
- // 磨具
- if (this.objData.modelList.length == 0) {
- this.objData.modelList = res;
- this.$forceUpdate();
- } else {
- if (this.objData.modelList[0].instanceId != res[0].instanceId) {
- uni.showToast({
- title: "模具不匹配",
- icon: "none",
- });
- } else {
- uni.showToast({
- title: "设备匹配成功",
- icon: "none",
- });
- }
- }
- } else if (res.length == 1 && res[0].rootCategoryLevelId == 7) {
- // 周转车
- let isFals = this.objData.turnover.some((m) => m.code == result);
- if (isFals) {
- uni.showToast({
- title: "周转车已存在",
- icon: "none",
- });
- return false;
- }
- this.objData.turnover.push(res[0]);
- this.$forceUpdate();
- }
- });
- },
- handleScan(id, type) {
- uni.scanCode({
- success: (res) => {
- this.scanData(res.result, type, id);
- },
- });
- },
- scanData(result, type, id) {
- if (type == "wordOrder") {
- getByCodeReport(result, this.taskId).then((res) => {
- this.objData = res;
- if (!this.objData.hasOwnProperty("turnover")) {
- this.objData["turnover"] = [];
- }
- if (!this.objData.hasOwnProperty("aridRegionList")) {
- this.objData["aridRegionList"] = [];
- }
- });
- } else if (type == "turnover") {
- let isFals = this.objData.turnover.some((m) => m.code == result);
- if (isFals) {
- uni.showToast({
- title: "周转车已存在",
- icon: "none",
- });
- return false;
- }
- getByCodeReport(result, this.taskId).then((res) => {
- this.objData.turnover[id] = res;
- });
- }
- },
- formedNumFn(num) {
- console.log(999, num);
- this.$refs.jobRef.setFormedNum(num);
- },
- getList() {
- this.isLoad = false;
- let URL = this.isOutsource == 0 ? getByIdReport : outSourceGetByIdReport;
- console.log(URL, "URLURLURL");
- URL(this.id, this.taskId)
- .then((res) => {
- // currentTaskDiagram 有是否可以报工
- this.objData = res;
- console.log(22, res);
- if (!this.objData.hasOwnProperty("turnover")) {
- this.objData["turnover"] = [];
- }
- if (!this.objData.hasOwnProperty("aridRegionList")) {
- this.objData["aridRegionList"] = [];
- }
- if (!this.objData.hasOwnProperty("instanceList")) {
- this.objData["instanceList"] = [];
- }
- if (!this.objData.hasOwnProperty("palletList")) {
- this.objData["palletList"] = [];
- }
- if (!this.objData.hasOwnProperty("revolvingDiskList")) {
- this.objData["revolvingDiskList"] = [];
- }
- // this.taskType = res.currentTaskDiagram.type
- if (this.objData.palletList.length > 0) {
- this.objData.palletList = this.objData.palletList.map((m) => {
- return {
- hideKc: true, // 不显示库存
- quantity: m.feedQuantity,
- ...m,
- };
- });
- } else {
- // this.objData.palletList = [{
- // categoryLevelId: '',
- // categoryLevelName: '',
- // categoryId: '',
- // rootCategoryLevelId: '',
- // code: '',
- // name: '',
- // specification: '',
- // brandNum: '',
- // modelType: '',
- // quantity: '',
- // unit: '',
- // }]
- }
- if (
- (this.taskType == 6 || this.isOutsource == 1) &&
- this.clientEnvironmentId == 3
- ) {
- this.objData.semiProductList = this.objData.pickOutInList;
- }
- // if (this.taskId == 6 || this.isOutsource == 1) {
- // this.objData.product = this.objData.pickOutInList;
- // }
- if (
- (this.taskType == 6 || this.taskType == 4) &&
- this.objData.singleReport == 1 &&
- this.clientEnvironmentId != 3 &&
- this.clientEnvironmentId != 2
- ) {
- if (
- this.objData.pickOutInList &&
- this.objData.pickOutInList.length != 0
- ) {
- this.objData.semiProductList = this.objData.pickOutInList;
- this.objData.pickOutInList = [];
- }
- }
- if (
- (this.taskType == 6 || this.taskType == 4) &&
- this.objData.singleReport == 0 &&
- this.clientEnvironmentId != 3 &&
- this.clientEnvironmentId != 2
- ) {
- if (
- this.objData.pickOutInList &&
- this.objData.pickOutInList.length != 0
- ) {
- this.objData.product = this.objData.pickOutInList;
- this.objData.pickOutInList = [];
- }
- }
- if (
- this.objData.singleReport == 1 &&
- this.objData.currentTaskDiagram.type != 2 &&
- this.objData.currentTaskDiagram.type != 3 &&
- this.objData.currentTaskDiagram.type != 6
- ) {
- this.objData.semiProductList.map((item) => {
- item.extInfo.taskId = "";
- item.extInfo.taskName = "";
- });
- }
- if (
- this.objData.singleReport == 0 &&
- this.objData.currentTaskDiagram.type != 2 &&
- this.objData.currentTaskDiagram.type != 3 &&
- this.objData.currentTaskDiagram.type != 6
- ) {
- this.objData.product.map((item) => {
- item.extInfo.taskId = "";
- item.extInfo.taskName = "";
- });
- }
- if (
- this.clientEnvironmentId == 3 &&
- this.objData.singleReport == 0 &&
- this.taskType != 6
- ) {
- this.objData.semiProductList.map((a) => {
- a.extInfo.batchReportInfo = [
- {
- allFeedQuantity: "",
- allReportWeight: "",
- taskId: "",
- taskName: "",
- },
- ];
- a.extInfo.notBatchReportInfo = [
- {
- allFeedQuantity: "",
- allReportWeight: "",
- notType: "",
- taskId: "",
- taskName: "",
- notReason: "",
- },
- ];
- return {
- a,
- };
- });
- this.objData.semiProductList = this.objData.semiProductList;
- }
- this.objData.workReportInfo = {
- formingNum: null,
- formingWeight: null,
- formedNum: null,
- formedWeight: null,
- taskId: this.taskId,
- executorTime: "",
- };
- this.objData.notFormedList = [
- {
- notFormedNum: null,
- notFormedWeight: null,
- weightUnit: res.weightUnit,
- unit: res.unit,
- warehouseId: null, // 处置 仓库id
- },
- ];
- if (this.objData.semiProductList.length > 0) {
- // 预制体报工
- this.objData.workReportInfo.formedNum =
- this.objData.semiProductList.length;
- let numCot = 0;
- if (this.objData.semiProductList.length > 0) {
- this.objData.semiProductList.map((fitem) => {
- numCot = numCot + fitem.feedQuantity || 1;
- });
- this.objData.workReportInfo.formedNum = numCot;
- }
- } else if (this.objData.product.length > 0) {
- console.log(this.objData.product, "this.objData.product");
- const number = this.objData.product.reduce((acc, pro) => {
- return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
- }, 0);
- this.objData.workReportInfo.formedNum = number;
- }
- this.objData.workReportInfo.formingNum = res.formingNum;
- this.objData.workReportInfo.formingWeight = res.formingWeight;
- this.objData.workReportInfo.unit = res.unit;
- this.objData.workReportInfo.weightUnit = res.weightUnit;
- this.objData.workReportInfo.workOrderId = res.workOrderId;
- this.paramDetailList = res.paramDetailList;
- console.log(this.objData, "this.paramDetailList");
- // this.paramDetailList = res.paramDetailList.map((m) => {
- // if (m.extInfo.textType == 5) {
- // this.remainingTime = m.extInfo.remainingTime;
- // }
- // return {
- // ...m.extInfo,
- // };
- // });
- })
- .finally(() => {
- this.isLoad = true;
- if (this.taskType == 1) {
- this.getCacheFn();
- }
- });
- },
- scrolltolower() {},
- handAdd() {
- const storageKey = Date.now() + "";
- uni.setStorageSync(storageKey, this.objData || {});
- uni.navigateTo({
- url: `/pages/pda/workOrder/search/index?storageKey=${storageKey}&isType=job&taskId=${this.taskId}`,
- });
- },
- penalize(index) {
- if (index || index == 0) {
- console.log(index, "----");
- this.penalizeIndex = index;
- this.formData.warehouseId =
- this.objData.productRecycleList[this.penalizeIndex].warehouseId || "";
- } else {
- this.penalizeIndex = null;
- this.formData.warehouseId =
- this.objData.notFormedList[0].warehouseId || "";
- console.log(this.formData.warehouseId, "+++++");
- }
- this.$forceUpdate();
- if (this.warehouseList.length == 0) {
- getWarehouseList().then((res) => {
- this.warehouseList = res;
- this.searchShow = true;
- });
- } else {
- this.searchShow = true;
- }
- },
- inputChange(e) {
- console.log(e);
- },
- searchCancel() {
- this.searchShow = false;
- },
- popupOk() {
- if (this.penalizeIndex == null) {
- this.$set(
- this.objData.notFormedList[0],
- "warehouseId",
- this.formData.warehouseId || null
- );
- } else {
- this.objData.productRecycleList[this.penalizeIndex].warehouseId =
- this.formData.warehouseId;
- }
- this.$forceUpdate();
- this.searchShow = false;
- },
- modeNum(num) {
- console.log(num, "------------", this.objData.modelList.length);
- if (this.objData.modelList.length == 0) {
- return false;
- }
- console.log(num);
- this.$refs.modelRef.setNum(num);
- },
- async save(type) {
- // 验证判断条件
- this.$isJobExls(1, this.objData);
- // console.log(this.objData, "this.objData");
- // return;
- // for (let i = 0; i < this.List.length; i++) {
- // if (
- // !this.List[i].executorTime &&
- // this.List[i].executorTime == undefined
- // ) {
- // uni.showToast({
- // title: `请先选择报工时间`,
- // icon: "none",
- // });
- // return;
- // }
- // }
- if (!(this.clientEnvironmentId == 3 || this.objData.singleReport !== 1)) {
- if (this.objData.semiProductList.length) {
- let arr = this.objData.semiProductList.filter(
- (v) => v.selected == true
- );
- this.objData.semiProductList = arr;
- if (!arr.length) {
- return uni.showToast({
- title: "请选择报工数量",
- icon: "none",
- });
- }
- // else{
- // let engraveList = arr.filter(v=> v.extInfo.engrave ==null);
- // if(engraveList.length){
- // return uni.showToast({
- // title: '请输入刻码',
- // icon: 'none'
- // })
- // }
- // }
- }
- }
- uni.showLoading({
- title: "加载中",
- });
- if (
- !this.objData.workReportInfo["formedNum"] &&
- this.objData.workReportInfo["formedNum"] != 0
- ) {
- uni.showToast({
- title: "请输入合格品数量",
- icon: "none",
- });
- return false;
- }
- // 预制体
- if (this.clientEnvironmentId == 3 || this.objData.singleReport !== 1) {
- if (
- this.objData.semiProductList.length > 0 &&
- this.taskType != 4 &&
- this.objData.singleReport == 1 &&
- type == 2
- ) {
- let bol;
- let _i;
- bol = this.objData.semiProductList.every((e, i) => {
- _i = i + 1;
- if (this.taskType == 6) {
- return e.extInfo.hasOwnProperty("taskId") && e.extInfo.taskId;
- } else {
- // if (e.extInfo.isQualified == 1 || e.extInfo.notType == 5) {
- // return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId && e.extInfo
- // .reportWeight
- // } else {
- // return e.extInfo.hasOwnProperty('notType') && e.extInfo.notType
- // }
- return (
- e.extInfo.hasOwnProperty("taskId") &&
- e.extInfo.taskId &&
- e.extInfo.reportWeight
- );
- }
- });
- if (!bol) {
- uni.showToast({
- title: `请完善第${_i}处置方式`,
- icon: "none",
- });
- return false;
- }
- }
- }
- if (
- this.objData.productRecycleList.length > 0 &&
- this.clientEnvironmentId != 2
- ) {
- const isRecycle = await this.checkRecycle();
- if (!isRecycle) {
- return false;
- }
- }
- if (
- this.taskType == 4 &&
- this.clientEnvironmentId != 3 &&
- this.clientEnvironmentId != 2
- ) {
- const isPack = await this.checkPack();
- if (!isPack) {
- return false;
- }
- }
- //
- // console.log(this.objData.currentTaskDiagram.isFirstTask,'22222');
- // if (this.objData.currentTaskDiagram.isFirstTask == 0) { // isFirstTask 1是 判断是否首工序
- // const isFirstTask = await this.checkFirstTask()
- // if (!isFirstTask) {
- // return false
- // }
- // }
- if (this.taskType == 1) {
- const isCache = await this.checkCache(type);
- if (!isCache) {
- return false;
- }
- }
- if (
- this.clientEnvironmentId == 3 &&
- type == 2 &&
- this.taskType == 6 &&
- this.objData.singleReport == 0
- ) {
- this.objData.semiProductList = [];
- }
- if (this.clientEnvironmentId == 3 && this.taskType == 1) {
- if (
- this.objData &&
- this.objData.executorTime &&
- this.objData.executorTime != undefined
- ) {
- // 正则表达式1:匹配 yyyy-MM-dd 格式
- const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
- if (dateRegex.test(this.objData.executorTime.trimRight())) {
- this.objData.workReportInfo["executorTime"] =
- this.objData.executorTime + " 00:00:00";
- } else {
- this.objData.workReportInfo["executorTime"] =
- this.objData.executorTime;
- }
- } else {
- uni.showToast({
- title: `请先选择实际报工时间`,
- icon: "none",
- });
- return false;
- }
- }
- if (this.objData.semiProductList.length > 0) {
- this.objData.semiProductList.map((ditem) => {
- let wdid = ditem.deviceId ? ditem.deviceId.split("/") : "";
- ditem.deviceId = wdid ? wdid[0] : "";
- 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] : "";
- });
- }
- });
- }
- console.log(this.objData, "this.objData");
- console.log(this.objData.equipmentList);
- if (
- this.objData.product.length != 0 &&
- this.objData.equipmentList.length != 0
- ) {
- this.objData.product.forEach((item) => {
- if (item.deviceId) {
- this.objData.equipmentList.forEach((el) => {
- if (item.deviceId == el.instanceId) {
- item.deviceName = el.name;
- }
- });
- }
- });
- }
- jobSave(this.objData)
- .then((res) => {
- uni.hideLoading();
- if (this.taskType == 4) {
- uni.showModal({
- title: "提示",
- content: "打包完成是否去入库!",
- confirmText: "确认", //这块是确定按钮的文字
- success: (rr) => {
- if (rr.confirm) {
- uni.redirectTo({
- url: `/pages/pda/warehousing/index?workOrderId=${this.id}&taskId=-1&workReportId=${res}&delta=-2`,
- });
- } else {
- uni.navigateBack();
- }
- },
- });
- } else {
- uni.navigateBack();
- }
- })
- .finally(() => {
- setTimeout(function () {
- uni.hideLoading();
- }, 3000);
- });
- },
- checkRecycle() {
- uni.hideLoading();
- return new Promise((resolve) => {
- uni.showModal({
- title: "提示",
- content: "是否跳过副产品回收处置!",
- confirmText: "确认", //这块是确定按钮的文字
- success: function (res) {
- if (res.confirm) {
- resolve(true);
- } else {
- resolve(false);
- }
- },
- });
- });
- },
- checkPack() {
- uni.hideLoading();
- return new Promise((resolve) => {
- let packInfo = this.$refs.packRef.getData();
- this.objData.packInfo = packInfo;
- this.objData.taskType = this.taskType;
- const formedNumLast = this.objData.product.reduce((acc, pro) => {
- return pro.extInfo.sourceQuantity
- ? acc + Number(pro.extInfo.sourceQuantity)
- : acc;
- }, 0);
- if (
- formedNumLast !=
- Number(this.objData.workReportInfo["formedNum"]) +
- Number(this.objData.notFormedList[0].notFormedNum)
- ) {
- uni.hideLoading();
- uni.showModal({
- title: "提示",
- content: "合格品数量加不合格品数量不等于包装总数!",
- confirmText: "确认", //这块是确定按钮的文字
- success: function (res) {
- if (res.confirm) {
- resolve(true);
- } else {
- resolve(false);
- }
- },
- });
- } else {
- resolve(true);
- }
- });
- },
- checkFirstTask() {
- uni.hideLoading();
- return new Promise((resolve) => {
- if (
- this.objData.formedNumLast !=
- Number(this.objData.workReportInfo["formedNum"]) +
- Number(this.objData.notFormedList[0].notFormedNum)
- ) {
- uni.showModal({
- title: "提示",
- content: "合格品数量加不合格品数量不等于上道工序数量!",
- confirmText: "确认", //这块是确定按钮的文字
- success: function (res) {
- if (res.confirm) {
- resolve(true);
- } else {
- resolve(false);
- }
- },
- });
- } else {
- resolve(true);
- }
- });
- },
- checkCache(type) {
- uni.hideLoading();
- return new Promise((resolve) => {
- if (type == 1) {
- saveCache(this.objData).then((rr) => {
- uni.showToast({
- title: `已经缓存`,
- icon: "none",
- });
- });
- resolve(false);
- } else if (type == 2) {
- resolve(true);
- }
- });
- },
- removeCacheFn() {
- uni.showModal({
- title: "缓存",
- content: "是否清空缓存!",
- confirmText: "确认", //这块是确定按钮的文字
- success: (rr) => {
- if (rr.confirm) {
- let parma = {
- workOrderIds: [this.id],
- taskId: this.taskId,
- type: 1,
- };
- removeCache(parma).then((res) => {
- this.getList();
- });
- }
- },
- });
- },
- getCacheFn() {
- let parma = {
- workOrderId: this.id,
- taskId: this.taskId,
- type: 1,
- };
- getCache(parma).then((res) => {
- if (
- !res ||
- res.length < 0 ||
- Object.getOwnPropertyNames(res).length === 0
- ) {
- return false;
- }
- this.objData["product"] = res.extInfo.product;
- this.objData["workReportInfo"] = res.extInfo.workReportInfo;
- this.objData["notFormedList"] = res.extInfo.notFormedList;
- this.objData["turnover"] = res.extInfo.turnover;
- this.objData["productRecycleList"] = res.extInfo.productRecycleList;
- this.objData["semiProductList"] = res.extInfo.semiProductList;
- this.objData["modelList"] = res.extInfo.modelList;
- });
- },
- //批量报工合格不合格重量统计
- 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.objData.workReportInfo, "formedNum", formedNumCount); //合格总数
- this.$set(this.objData.workReportInfo, "formedWeight", formedWeightCount); //合格总重量
- this.$set(this.objData.workReportInfo, "notFormedNum", notFormedNumCount); //不合格总数
- this.$set(
- this.objData.workReportInfo,
- "notFormedWeight",
- notFormedWeightCount
- ); //不合格总重量
- this.$refs.jobReftg.formedTotal(
- formedNumCount,
- formedWeightCount,
- notFormedNumCount,
- notFormedWeightCount
- );
- this.$forceUpdate();
- },
- },
- beforeDestroy() {
- uni.hideLoading();
- },
- };
- </script>
- <style lang="scss" scoped>
- .content-box {
- height: 100vh;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- }
- .list_box {
- flex: 1;
- overflow: hidden;
- padding: 4rpx 0;
- .u-list {
- height: 100% !important;
- }
- .card_box {
- padding: 16rpx 20rpx;
- }
- }
- .bottom-wrapper {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-around;
- .btn_box {
- width: 50%;
- height: 88rpx;
- line-height: 88rpx;
- background: $theme-color;
- text-align: center;
- font-size: 36rpx;
- font-style: normal;
- font-weight: 400;
- color: #fff;
- &:first-child {
- border-right: 2rpx solid #fff;
- }
- }
- }
- .operate_box {
- padding: 10rpx 160rpx;
- /deep/ .u-button {
- width: 160rpx;
- }
- }
- .search_list {
- min-height: 500rpx;
- padding: 0 32rpx;
- }
- .search_list2 {
- min-height: 120rpx;
- padding: 0 32rpx;
- }
- .flex_btn {
- position: fixed;
- right: 0;
- bottom: 160rpx;
- width: 40rpx;
- height: 50rpx;
- line-height: 66rpx;
- border-radius: 22rpx 0 0 22rpx;
- background: $theme-color;
- text-align: center;
- font-size: 22rpx;
- font-style: normal;
- font-weight: 400;
- color: #fff;
- opacity: 0.6;
- .jiantou {
- width: 30rpx;
- height: 30rpx;
- }
- }
- .flex_btn2 {
- position: fixed;
- right: 0;
- bottom: 160rpx;
- width: 126rpx;
- min-height: 140rpx;
- line-height: 62rpx;
- border-radius: 22rpx 0 0 22rpx;
- background: $theme-color;
- text-align: center;
- font-size: 22rpx;
- font-style: normal;
- font-weight: 400;
- color: #fff;
- opacity: 0.7;
- .close_box {
- height: 50rpx;
- line-height: 50rpx;
- width: 126rpx;
- text-align: left;
- .close {
- width: 40rpx;
- height: 40rpx;
- padding: 6rpx 10rpx;
- }
- }
- }
- </style>
|