| | |
| | | <u-form-item label="零件描述" :border-bottom="false" prop="partName"> |
| | | <u-input v-model="form.partName" placeholder="" disabled /> |
| | | </u-form-item> |
| | | <u-form-item label="批量大小" :border-bottom="false" prop="qtyrequired"> |
| | | <u-input v-model="form.qtyrequired" placeholder="" disabled /> |
| | | <u-form-item label="批量大小" :border-bottom="false" prop="qtyRequired"> |
| | | <u-input v-model="form.qtyRequired" placeholder="" disabled /> |
| | | </u-form-item> |
| | | <u-form-item |
| | | label="剩余数量" |
| | |
| | | <u-input v-model="form.proposedLocation" placeholder="" disabled /> |
| | | </u-form-item> |
| | | <u-form-item label="报工类型" prop="productType"> |
| | | <u-radio-group v-model="form.productType"> |
| | | <u-radio-group v-model="form.productType" :disabled="subdisabled"> |
| | | <u-radio name="dep">下机报工</u-radio> |
| | | <u-radio name="ndep">未下机报工</u-radio> |
| | | </u-radio-group> |
| | | </u-form-item> |
| | | <u-form-item label="接收零件" prop="receive"> |
| | | <u-radio-group v-model="form.receive"> |
| | | <u-radio-group v-model="form.receive" :disabled="subdisabled"> |
| | | <u-radio name="mo">车间订单</u-radio> |
| | | <u-radio name="part">替代零件</u-radio> |
| | | </u-radio-group> |
| | | </u-form-item> |
| | | <u-form-item label="物料" prop="materialcost"> |
| | | <u-radio-group v-model="form.materialcost" :disabled="true"> |
| | | <u-form-item label="物料" prop="materialCost"> |
| | | <u-radio-group v-model="form.materialCost" :disabled="true"> |
| | | <u-radio name="倒冲">倒冲</u-radio> |
| | | <u-radio name="投料">投料</u-radio> |
| | | </u-radio-group> |
| | | </u-form-item> |
| | | <u-form-item label="工序" prop="value11"> |
| | | <u-checkbox-group> |
| | | <u-checkbox |
| | | :name="item.name" |
| | | v-for="(item, index) in checkboxList" |
| | | :key="index" |
| | | v-model="item.value11" |
| | | @change="changeCheckbox" |
| | | :disabled="subdisabled || item.disabled" |
| | | > |
| | | {{ item.name }} |
| | | </u-checkbox> |
| | | </u-checkbox-group> |
| | | <u-form-item label="简化物料检查" prop="simplifyMaterials"> |
| | | <u-radio-group v-model="form.simplifyMaterials" :disabled="subdisabled || simplifyDisabled" @change="radioChange"> |
| | | <u-radio name="true">是</u-radio> |
| | | <u-radio name="false">否</u-radio> |
| | | </u-radio-group> |
| | | </u-form-item> |
| | | <u-form-item label="报工方式" prop="status"> |
| | | <u-radio-group v-model="form.status" :disabled="subdisabled" @change="handleReportTypeChange"> |
| | | <u-radio name="false">按班组报工</u-radio> |
| | | <u-radio name="true">按人员报工</u-radio> |
| | | </u-radio-group> |
| | | </u-form-item> |
| | | <u-form-item label="人员名称" :border-bottom="false" prop="Persons"> |
| | | <u-input v-model="form.Persons" type="select" placeholder="请选择" |
| | | @click="openselectedPersons" :disabled="!canSelectPerson || subdisabled"/> |
| | | </u-form-item> |
| | | <u-form-item label="产出列表" :border-bottom="false"></u-form-item> |
| | | </u-form> |
| | | <view class="wrap"> |
| | |
| | | v-for="(item, index) in InventoryReceiptList" |
| | | :key="index" |
| | | :index="index" |
| | | @click="cancelReport(item)" |
| | | > |
| | | <view class="content-header"> |
| | | <view class="content-header-title">{{ index + 1 }}</view> |
| | |
| | | <view class="_label-name">批号:</view> |
| | | </view> |
| | | <view class="_content"> |
| | | {{ item.productNo }} |
| | | {{ item.outBatchNo }} |
| | | </view> |
| | | </view> |
| | | <view class="row-list"> |
| | |
| | | <view class="_label-name">数量:</view> |
| | | </view> |
| | | <view class="_content"> |
| | | {{ item.value1 }} |
| | | {{ item.netWeight }} |
| | | </view> |
| | | </view> |
| | | <view class="row-list"> |
| | |
| | | </modalBg> |
| | | <saveForm |
| | | ref="saveForm" |
| | | :operationTaskId="this.form" |
| | | :operationTaskList="this.form" |
| | | @update="handleUpdate" |
| | | /> |
| | | <u-modal |
| | | width="720rpx" |
| | | v-model="showModal" |
| | | title="" |
| | | :show-cancel-button="true" |
| | | :show-confirm-button="true" |
| | | @confirm="confirmModle" |
| | | @cancel="cancelModle" |
| | | > |
| | | <view class="popup-content"> |
| | | <view class="packing-registration-param"> |
| | | <view class="packing-registration-param-view"> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">批号</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <text class="item-one">{{ detailedList.outBatchNo }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">零件号</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <text class="item-one">{{ detailedList.partNo }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">零件描述</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <span class="item-one">{{ detailedList.partName }}</span> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">取消接收数量</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <span class="item-one">{{ detailedList.netWeight }}</span> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </u-modal> |
| | | <u-modal v-model="personShowModal" title="" :show-cancel-button="true" :show-confirm-button="true" |
| | | @confirm="confirmSelection" @cancel="cancelSelection"> |
| | | <view class="popup-content"> |
| | | <view class="popup-header"> |
| | | <checkbox-group @change="checkboxChange"> |
| | | <label class="checkbox-item" v-for="(item, index) in selectedPersons" :key="index"> |
| | | <checkbox :value="item.staffId" :checked="item.checked" /> |
| | | <text class="label">{{ item.staffName }}</text> |
| | | </label> |
| | | </checkbox-group> |
| | | </view> |
| | | </view> |
| | | </u-modal> |
| | | <scan></scan> |
| | | </div> |
| | | </template> |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | checkboxList: [ |
| | | { |
| | | name: "工序的自动报告", |
| | | value: false, |
| | | disabled: false, |
| | | }, |
| | | { |
| | | name: "简化物料检查", |
| | | value: false, |
| | | disabled: false, |
| | | }, |
| | | ], |
| | | simplifyDisabled:false, |
| | | // checkboxList: [ |
| | | // { |
| | | // name: "工序的自动报告", |
| | | // value: false, |
| | | // disabled: false, |
| | | // }, |
| | | // { |
| | | // name: "简化物料检查", |
| | | // value: false, |
| | | // disabled: false, |
| | | // }, |
| | | // ], |
| | | InventoryReceiptList: [], |
| | | selectedPersons: [], |
| | | form: { |
| | | workstationId: "", |
| | | work: "", |
| | | taskNo: "", |
| | | name: "", |
| | | moOn: "", |
| | | partNo: "", |
| | | partName: "", |
| | | qtyrequired: "", |
| | | qtyRequired: "", |
| | | Jianqtyfinished: "", |
| | | proposedLocation: "", |
| | | productType: "dep", |
| | | receive: "mo", // 复选框组的值 |
| | | materialcost: "", |
| | | autoReport: false, |
| | | simplifyMaterials: false, |
| | | receive: "mo", |
| | | materialCost: "", |
| | | // autoReport: false, |
| | | simplifyMaterials: 'false', |
| | | status: 'false', |
| | | Persons: '', |
| | | productStaffIds: [], |
| | | productStaffs:[] |
| | | }, |
| | | personList: [], |
| | | canSelectPerson: false, |
| | | rules: { |
| | | work: [ |
| | | { |
| | |
| | | trigger: ["change"], |
| | | }, |
| | | ], |
| | | status: [ |
| | | { |
| | | required: true, |
| | | message: "请选择报工方式", |
| | | trigger: ["change"], |
| | | }, |
| | | ], |
| | | Persons: [ |
| | | { |
| | | required: true, |
| | | message: "请选择人员", |
| | | trigger: ["change"], |
| | | }, |
| | | ], |
| | | }, |
| | | showSave: false, |
| | | operationTaskId: "", |
| | | subdisabled: false, |
| | | codeInfoId: "", |
| | | detailedList: {}, |
| | | showModal: false, |
| | | personShowModal: false, |
| | | checkboxList: [], |
| | | }; |
| | | }, |
| | | // 点击提交按钮的事件处理函数 |
| | | onNavigationBarButtonTap() { |
| | | this.$refs.uForm.validate((valid) => { |
| | | if (valid) { |
| | | console.log("验证通过"); |
| | | uni.showLoading({ |
| | | mask: true, |
| | | title: "加载中", |
| | | }); |
| | | // 处理提交逻辑 |
| | | this.$u.api.workReporting |
| | | .operationTask({ |
| | | id: this.form.id, |
| | | }) |
| | | .then((res) => { |
| | | console.log("res", res); |
| | | res.data.name = this.form.name; |
| | | this.$refs.saveForm.open(res); |
| | | uni.hideLoading(); |
| | | }); |
| | | } else { |
| | | console.log("验证失败"); |
| | | // 可以获取具体的错误信息 |
| | | const errors = this.$refs.uForm.getError(); |
| | | console.log("错误信息:", errors); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | }, |
| | | onShow() { |
| | | let that = this; |
| | | console.log("1111111111111"); |
| | | uni.$off("scan"); // 每次进来先 移除全局自定义事件监听器 |
| | | uni.$on("scan", function (data) { |
| | | console.log("onscan"); |
| | | //扫码成功后的回调,你可以写自己的逻辑代码在这里 |
| | | console.log("页面扫码结果:", data.code); |
| | | if (data.code) { |
| | | let codeInfo = JSON.parse(data.code); |
| | | if (codeInfo.moOn) { |
| | | that.codeInfoId = codeInfo.id; |
| | | // 扫描报工单二维码 |
| | | that.saveForm(codeInfo); |
| | | that.$u.api.workReporting |
| | | .getProductMainV1({ |
| | | current: 1, |
| | | size: -1, |
| | | operationTaskId: codeInfo.id, |
| | | }) |
| | | .then((res) => { |
| | | console.log("res", res); |
| | | let InventoryReceiptList = JSON.parse(res.data.records); |
| | | that.saveInventory(InventoryReceiptList); |
| | | }); |
| | | console.log("this.InventoryReceiptList", that.InventoryReceiptList); |
| | | that.getHandelList(); |
| | | } |
| | | if (codeInfo.BN) { |
| | | // 扫描报工单二维码 |
| | | that.CopperReportingWork(codeInfo); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | watch: { |
| | | "form.taskNo": function (newVal, oldVal) { |
| | | console.log("taskNo changed:", newVal, oldVal); |
| | | this.subdisabled = false; |
| | | }, |
| | | 'form.status'(newVal) { |
| | | this.selectedPersons = this.selectedPersons.map(item => ({ |
| | | ...item, |
| | | checked: newVal === 'false' |
| | | })); |
| | | } |
| | | }, |
| | | methods: { |
| | | saveInventory(val) { |
| | | this.InventoryReceiptList = val; |
| | | // 处理报工方式变更 |
| | | handleReportTypeChange() { |
| | | // 切换报工方式时清空人员名称 |
| | | this.form.Persons = ''; |
| | | this.form.productStaffs = []; |
| | | this.form.productStaffIds = []; |
| | | }, |
| | | // 人员名称 |
| | | openselectedPersons() { |
| | | this.personShowModal = true; |
| | | }, |
| | | // 复选框变化事件 |
| | | checkboxChange(e) { |
| | | console.log('e',e) |
| | | const values = e.target.value || []; |
| | | if (this.form.status === 'true') { |
| | | // 单选模式,只允许选择一个人 |
| | | const previouslySelected = this.selectedPersons.find(item => item.checked); |
| | | const newlySelected = values.length > 0 ? values[values.length - 1] : null; |
| | | if (previouslySelected && newlySelected && previouslySelected.staffId !== newlySelected) { |
| | | // 已有选中项且选择了新的项,提示只能选择一个人 |
| | | this.$u.toast('按人员报工时只能选择一位人员'); |
| | | // 保持原选择 |
| | | this.selectedPersons = this.selectedPersons.map(item => ({ |
| | | ...item, |
| | | checked: item.staffId === previouslySelected.staffId |
| | | })); |
| | | |
| | | } else { |
| | | // 首次选择或取消选择 |
| | | this.selectedPersons = this.selectedPersons.map(item => ({ |
| | | ...item, |
| | | checked: newlySelected ? item.staffId === newlySelected : false |
| | | })); |
| | | |
| | | } |
| | | } else { |
| | | // 多选模式 |
| | | this.selectedPersons = this.selectedPersons.map(item => ({ |
| | | ...item, |
| | | checked: values.includes(item.staffId) |
| | | })); |
| | | } |
| | | }, |
| | | // 确认选择 |
| | | confirmSelection() { |
| | | const selected = this.selectedPersons.filter(item => item.checked); |
| | | // 根据报工方式设置人员名称 |
| | | if (this.form.status === 'true' && selected.length > 0) { |
| | | this.form.Persons = selected[0].staffName; |
| | | } else { |
| | | this.form.Persons = selected.map(item => item.staffName).join(','); |
| | | } |
| | | this.form.productStaffs = selected.map(item => item.staffNo); |
| | | this.form.productStaffIds = selected.map(item => item.staffId); |
| | | }, |
| | | cancelSelection(){}, |
| | | // 铜杆报工 |
| | | CopperReportingWork(val) { |
| | | const copperList = {}; |
| | | copperList.outBatchNo = val.BN |
| | | copperList.partNo = val.PN |
| | | copperList.weighingClerk = val.WC |
| | | copperList.executiveStandard = val.ES |
| | | copperList.netWeight = val.NW |
| | | copperList.specificationType = val.ST |
| | | copperList.grossWeight = val.TR |
| | | copperList.operationTaskId = this.form.id |
| | | copperList.status = this.form.status; |
| | | copperList.Persons = this.form.Persons; |
| | | copperList.productStaffIds = this.form.productStaffIds; |
| | | copperList.productStaffs = this.form.productStaffs; |
| | | this.form.productOutputList = []; |
| | | this.form.operationTaskId = this.form.id; |
| | | this.form.productOutputList.push(copperList); |
| | | console.log('this.form',this.form) |
| | | this.$u.api.workReporting.submitPDA(this.form).then((res) => { |
| | | this.subdisabled = true; |
| | | this.getHandelList(); |
| | | this.$u.toast("报工成功"); |
| | | }); |
| | | }, |
| | | // 点击确认后获取取消报工记录 |
| | | radioChange() { |
| | | // 处理单选框变化事件 |
| | | }, |
| | | // 获取人员列表 |
| | | getPersonList(dutyId) { |
| | | console.log('111111') |
| | | try { |
| | | this.$u.api.workReporting.getPersonByDutyRecordId({ id: dutyId }).then((res) => { |
| | | this.selectedPersons = res.data.map(item => ({ |
| | | ...item, |
| | | checked: this.form.status === 'false' |
| | | })); |
| | | }) |
| | | .catch(err => { |
| | | console.log(err) |
| | | }) |
| | | } catch (err) { |
| | | console.log(err) |
| | | |
| | | } |
| | | |
| | | }, |
| | | |
| | | confirmModle() { |
| | | console.log("点击确认后获取取消报工记录"); |
| | | // 处理确认逻辑 |
| | | this.$u.api.cancelReporting |
| | | .cancelDTAOfWorkApplication({ |
| | | outBatchNo: this.detailedList.outBatchNo, |
| | | }) |
| | | .then((res) => { |
| | | console.log("res", res); |
| | | this.showModal = false; |
| | | this.getHandelList(); |
| | | this.$u.toast("取消报工成功"); |
| | | }); |
| | | }, |
| | | cancelModle() { |
| | | this.showModal = false; // 关闭弹窗 |
| | | }, |
| | | // 取消报工 |
| | | cancelReport(item) { |
| | | let that = this; |
| | | uni.showModal({ |
| | | title: "提示", |
| | | content: "是否确认取消批次" + item.outBatchNo + "的报工", |
| | | success: function (res) { |
| | | if (res.confirm) { |
| | | that.detailedList = item; |
| | | that.showModal = true; |
| | | } else if (res.cancel) { |
| | | return; |
| | | } |
| | | }, |
| | | }); |
| | | }, |
| | | getHandelList() { |
| | | this.$u.api.workReporting |
| | | .getProductMainV1({ |
| | | current: 1, |
| | | size: -1, |
| | | id: this.codeInfoId, |
| | | }) |
| | | .then((res) => { |
| | | this.InventoryReceiptList = res.data.productOutputList; |
| | | }); |
| | | }, |
| | | // 多选处理 |
| | | changeCheckbox(val) { |
| | | if (val.name === "工序的自动报告") { |
| | | this.form.autoReport = val.value; |
| | | } |
| | | if (val.name === "简化物料检查") { |
| | | this.form.simplifyMaterials = val.value; |
| | | } |
| | | }, |
| | | // changeCheckbox(val) { |
| | | // if (val.name === "工序的自动报告") { |
| | | // this.form.autoReport = val.value; |
| | | // } |
| | | // if (val.name === "简化物料检查") { |
| | | // this.form.simplifyMaterials = val.value; |
| | | // } |
| | | // }, |
| | | handleUpdate() { |
| | | this.subdisabled = true; |
| | | this.getHandelList(); |
| | | }, |
| | | // 打开弹框--后面还需要监听扫码枪扫码结果,赋值给报工单号字段,然后打开弹框选择订单号等操作 |
| | | open() { |
| | | this.$refs.modalBg.open(); |
| | | }, |
| | | // 弹框保存 |
| | | confirm() { |
| | | console.log("保存", this.form.taskNo); |
| | | }, |
| | | confirm() {}, |
| | | // 选择订单号 |
| | | openList() { |
| | | if (this.form.taskNo === "") { |
| | |
| | | }, |
| | | // 回显扫码的信息-报工单 |
| | | saveForm(val) { |
| | | console.log("回显的数据", val); |
| | | this.form = { |
| | | id: val.id, |
| | | workstationId: val.workstationId, |
| | | work: val.work, |
| | | taskNo: val.taskNo, |
| | | name: val.name, |
| | | moOn: val.moOn, |
| | | partNo: val.partNo, |
| | | partName: val.partName, |
| | | qtyrequired: val.qtyrequired, |
| | | Jianqtyfinished: val.qtyrequired - val.qtyfinished, |
| | | qtyRequired: val.qtyRequired, |
| | | Jianqtyfinished: val.qtyRequired - val.qtyFinished, |
| | | proposedLocation: val.proposedLocation, |
| | | productType: "dep", |
| | | receive: "mo", // 复选框组的值 |
| | | materialcost: val.materialcost, |
| | | autoReport: false, |
| | | simplifyMaterials: false, |
| | | receive: "mo", |
| | | materialCost: val.materialCost, |
| | | // autoReport: false, |
| | | simplifyMaterials: 'false', |
| | | status: 'false', |
| | | Persons:'', |
| | | }; |
| | | if (this.form.materialcost == "倒冲") { |
| | | this.checkboxList[1].disabled = true; |
| | | if (this.form.materialCost == "倒冲") { |
| | | this.simplifyDisabled = true; |
| | | } |
| | | // 如果有dutyNo,获取人员列表 |
| | | if (val.dutyId) { |
| | | this.getPersonList(val.dutyId); |
| | | } |
| | | }, |
| | | }, |