| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625 |
- <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="Object.keys(objData.workReportInfo).length != 0"
- pType="job"
- :taskType="taskType"
- @handleScan="handleScan"
- :isReportWork="true"
- >
- </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 &&
- clientEnvironmentId != 3
- "
- :item="objData"
- ref="jobRef"
- :notFormed="objData.notFormedList"
- :currentTask="objData.currentTaskDiagram"
- @penalize="penalize"
- @modeNum="modeNum"
- ></batchJobBom>
- <!-- <batchJobBom
- v-if="
- objData.currentTaskDiagram &&
- objData.currentTaskDiagram.type &&
- objData.singleReport == 0
- "
- :item="objData"
- ref="jobRef"
- :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 && 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 &&
- clientEnvironmentId == 3
- "
- :item="objData"
- :list="objData.semiProductList"
- ref="jobReftg"
- :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 != 3">
- <packingBom
- :taskId="taskId"
- :workOrderId="id"
- :objData="objData"
- ref="packRef"
- v-if="taskType == 4 && clientEnvironmentId != 3 && objData"
- :categoryId="categoryId"
- >
- </packingBom>
- </view>
- <div
- v-if="
- objData &&
- taskType == 4 &&
- clientEnvironmentId == 3 &&
- objData.singleReport == 0
- "
- >
- <packingBom
- :taskId="taskId"
- :workOrderId="id"
- :objData="objData"
- ref="packRef"
- v-if="taskType == 4 && objData"
- :categoryId="categoryId"
- >
- </packingBom>
- </div>
- <!-- 碳谷 包装扫码 -->
- <!-- <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>
- <uni-popup ref="alertDialog" type="dialog">
- <uni-popup-dialog
- type="warning"
- cancelText="取消"
- confirmText="确定"
- title="提示"
- :content="titleText"
- @confirm="dialogConfirm"
- @close="dialogClose"
- ></uni-popup-dialog>
- </uni-popup>
- </view>
- </view>
- </template>
- <script>
- import {
- getByIdReport,
- outSourceGetByIdReport,
- getByCodeReport,
- jobSave,
- checkReportNumber,
- } 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";
- import { parameterGetByCode } from "@/api/mainData/index.js";
- 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: {},
- executorTime: "",
- 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,
- titleText: "",
- };
- },
- onLoad(options) {
- console.log(options, "optionsoptions");
- 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);
- },
- async getList() {
- this.isLoad = false;
- let URL = this.isOutsource == 0 ? getByIdReport : outSourceGetByIdReport;
- console.log(URL, "URLURLURL");
- await 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.taskType == 4 && 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
- ) {
- 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
- ) {
- 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: "",
- lossNum: null,
- lossWeight: null,
- executorStartTime: null,
- reportTime: "",
- workTime: "",
- };
- this.objData.notFormedList = [
- {
- notFormedNum: null,
- notFormedWeight: null,
- weightUnit: res.weightUnit,
- unit: res.unit,
- warehouseId: null, // 处置 仓库id
- },
- ];
- this.objData.semiProductList = this.objData.semiProductList.map(
- (item) => {
- if (this.taskType != 6) {
- if (item["extInfo"]?.reportWeight) {
- item["extInfo"].reportWeight = "";
- }
- }
- item.confirm = 0;
- console.log(item, "item");
- return item;
- },
- );
- this.objData.product = this.objData.product.map((item) => {
- if (this.taskType != 6) {
- if (item["extInfo"]?.reportWeight) {
- item["extInfo"].reportWeight = "";
- }
- }
- item.confirm = 0;
- console.log(item, "item");
- return item;
- });
- 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) {
- 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.objDatathis.objDatathis.objData");
- // 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);
- // 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",
- });
- }
- }
- }
- await parameterGetByCode({
- code: "work_hour",
- }).then((res) => {
- if (res.value == "1") {
- if (!this.objData.workReportInfo["executorStartTime"]) {
- uni.showToast({
- title: `请先选择报工时间`,
- icon: "none",
- });
- return false;
- }
- }
- });
- 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) {
- 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;
- }
- });
- }
- });
- }
- // console.log(this.objData, "savesavesaveobjDataobjDataobjData");
- let newList = [];
- newList.push({
- currentTaskDiagram: this.objData.currentTaskDiagram,
- workOrderId: this.objData.workOrderId,
- });
- await checkReportNumber(newList).then((res) => {
- if (res.length != 0) {
- this.checkJobBook(res);
- }
- });
- },
- checkJobBook(list) {
- for (let item of list) {
- if (item.reportFormed != "0") {
- this.titleText = `工单号${item.workOrderCode}已有报工,是否继续重复报工?`;
- this.$refs.alertDialog.open();
- } else {
- this.jobBookReport();
- }
- }
- },
- dialogClose() {},
- dialogConfirm() {
- this.jobBookReport();
- },
- jobBookReport() {
- 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;
- let formedNumLast = 0;
- if (this.objData.singleReport == 1) {
- formedNumLast = this.objData.semiProductList.reduce((acc, pro) => {
- return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
- }, 0);
- } else if (this.objData.singleReport == 0) {
- formedNumLast = this.objData.product.reduce((acc, pro) => {
- return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
- }, 0);
- }
- if (
- formedNumLast !=
- Number(this.objData.workReportInfo["formedNum"]) +
- Number(this.objData.workReportInfo.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.workReportInfo.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) {
- //合格总数
- 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
- // );
- // console.log("777777777777777", this.objData);
- this.objData = this.deepCopy(this.objData);
- this.$forceUpdate();
- },
- 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);
- },
- },
- 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>
|