loulijun2021
2022-08-23 b8ee668eaace5d422ebb27a200c3b178b82e2a6d
src/views/scgl/sckbg.vue
@@ -85,7 +85,7 @@
              />
              <el-table-column
                prop="partname"
                min-width="110"
                min-width="160"
                label="产品名称"
                sortable="custom"
              />
@@ -95,12 +95,17 @@
                min-width="80"
                sortable="custom"
              />
              <el-table-column
                prop="descr"
                label="工序描述"
                min-width="150"
                sortable="custom"
              />
              <!--              <el-table-column-->
              <!--                prop="descr"-->
              <!--                label="工序描述"-->
              <!--                min-width="150"-->
              <!--                sortable="custom"-->
              <!--              >-->
              <!--                <template slot-scope="{row}">-->
              <!--                  <div v-if="row.descr">{{ row.descr }}</div>-->
              <!--                  <div v-else>/</div>-->
              <!--                </template>-->
              <!--              </el-table-column>-->
              <el-table-column
                prop="plan_qty"
                label="任务数量"
@@ -108,8 +113,17 @@
                sortable="custom"
              />
              <el-table-column
                label="未报工数量"
                width="120"
              >
                <!--                sortable="custom"-->
                <template slot-scope="{row}">
                  <div>{{ row.plan_qty - row.good_qty - row.ng_qty }}</div>
                </template>
              </el-table-column>
              <el-table-column
                prop="good_qty"
                label="已报工数量(良品)"
                label="已报工数量"
                sortable="custom"
                width="160"
              />
@@ -117,7 +131,12 @@
                prop="ng_qty"
                label="不良数量"
                width="150"
                sortable="custom"
              />
              <el-table-column
                prop="bad_qty"
                label="已报废数量"
                width="120"
                sortable="custom"
              />
              <el-table-column
@@ -125,8 +144,19 @@
                label="计划开工日期"
                width="185"
                sortable="custom"
                fixed="right"
              />
              <el-table-column
                prop="plan_enddate"
                label="计划完工日期"
                width="185"
                sortable="custom"
                fixed="right"
              >
                <template slot-scope="{row}">
                  <div v-if="row.plan_startdate">{{ row.plan_startdate }}</div>
                  <div v-else>/</div>
                </template>
              </el-table-column>
              <!--              <el-table-column-->
              <!--                label="操作"-->
              <!--                width="150"-->
@@ -248,7 +278,7 @@
              <el-table-column
                prop="partname"
                label="产品名称"
                min-width="110"
                min-width="160"
                sortable="custom"
              />
              <el-table-column
@@ -257,12 +287,17 @@
                min-width="80"
                sortable="custom"
              />
              <el-table-column
                prop="descr"
                label="工序描述"
                min-width="150"
                sortable="custom"
              />
              <!--              <el-table-column-->
              <!--                prop="descr"-->
              <!--                label="工序描述"-->
              <!--                min-width="150"-->
              <!--                sortable="custom"-->
              <!--              >-->
              <!--                <template slot-scope="{row}">-->
              <!--                  <div v-if="row.descr">{{ row.descr }}</div>-->
              <!--                  <div v-else>/</div>-->
              <!--                </template>-->
              <!--              </el-table-column>-->
              <el-table-column
                prop="plan_qty"
                label="任务数量"
@@ -270,8 +305,17 @@
                sortable="custom"
              />
              <el-table-column
                label="未报工数量"
                width="120"
              >
                <!--                sortable="custom"-->
                <template slot-scope="{row}">
                  <div>{{ row.plan_qty - row.good_qty - row.ng_qty }}</div>
                </template>
              </el-table-column>
              <el-table-column
                prop="good_qty"
                label="已收料数量(良品)"
                label="已收料数量"
                sortable="custom"
                width="160"
              />
@@ -282,12 +326,29 @@
                sortable="custom"
              />
              <el-table-column
                prop="bad_qty"
                label="已报废数量"
                min-width="120"
                sortable="custom"
              />
              <el-table-column
                prop="plan_startdate"
                label="计划开工日期"
                width="185"
                sortable="custom"
                fixed="right"
              />
              <el-table-column
                prop="plan_enddate"
                label="计划完工日期"
                width="185"
                sortable="custom"
                fixed="right"
              >
                <template slot-scope="{row}">
                  <div v-if="row.plan_startdate">{{ row.plan_startdate }}</div>
                  <div v-else>/</div>
                </template>
              </el-table-column>
              <!--              <el-table-column-->
              <!--                label="操作"-->
              <!--                width="150"-->
@@ -311,6 +372,113 @@
            layout="total,prev, pager, next,sizes"
            popper-class="select_bottom"
            @pagination="getMesOrderStepSearch"
          />
        </el-tab-pane>
        <el-tab-pane label="不良待处理列表">
          <div style="margin-left: 10px;margin-top:10px;display: flex;justify-content: space-between">
            <div style="display: flex;align-items: center">
              <div style="width: 90px">扫描条码:</div>
              <!--              oninput="value=value.replace(/[^0-9a-zA-Z;_]/g,'')"-->
              <el-input
                v-model="badForm.orderstepqrcode"
                name="badProduceCode"
                style="width: 300px"
                @keyup.enter.native="val=>enterNative(val,'badProduceCode')"
              />
            </div>
          </div>
          <el-divider />
          <div class="elTableDiv">
            <el-table
              :data="badTableData"
              :height="isIpad? (tableHeight+50):tableHeight"
              border
              :row-class-name="tableRowClassName"
              :style="{width: 100+'%',height:tableHeight+'px',}"
              highlight-current-row
              :header-cell-style="this.$headerCellStyle"
              :cell-style="this.$cellStyle"
              @sort-change="badSortChange"
            >
              <el-table-column
                prop="RowNum"
                width="50"
                label="序号"
                fixed
              />
              <el-table-column
                prop="wo_code"
                label="工单号"
                min-width="160"
                sortable="custom"
              />
              <el-table-column
                prop="partcode"
                label="产品编码"
                min-width="110"
                sortable="custom"
              />
              <el-table-column
                prop="partname"
                min-width="160"
                label="产品名称"
                sortable="custom"
              />
              <el-table-column
                prop="stepname"
                label="工序"
                min-width="80"
                sortable="custom"
              />
              <el-table-column
                prop="plan_qty"
                label="任务数量"
                min-width="110"
                sortable="custom"
              />
              <el-table-column
                prop="good_qty"
                label="已报工数量"
                sortable="custom"
                min-width="160"
              />
              <el-table-column
                prop="ng_qty"
                label="不良数量"
                min-width="150"
                sortable="custom"
              />
              <el-table-column
                prop="bad_qty"
                label="已报废数量"
                min-width="120"
                sortable="custom"
              />
              <el-table-column
                label="操作"
                width="120"
                fixed="right"
              >
                <template slot-scope="{row}">
                  <div class="operationClass">
                    <el-button type="text" @click="repairHandle(row)">维修处理</el-button>
                  </div>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <!--分页-->
          <pagination
            :total="badTotal"
            :page.sync="badForm.page"
            :limit.sync="badForm.rows"
            align="right"
            layout="total,prev, pager, next,sizes"
            popper-class="select_bottom"
            @pagination="getBadList"
          />
        </el-tab-pane>
      </el-tabs>
@@ -349,7 +517,7 @@
        <el-form-item label="当前工序:">
          <div style="width: 200px">{{ dialogForm.stepname }}</div>
        </el-form-item>
        <el-form-item label="工序描述:">
        <el-form-item v-if="false" label="工序描述:">
          <!--          <el-tooltip   class="item" effect="dark" content="原材料切按材料切按材料切按时打卡数据的卡" placement="top-start">-->
          <div style="width: 200px;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;">
            {{ dialogForm.stepdesc }}
@@ -662,6 +830,7 @@
      title="预览"
      :visible.sync="dialogVisible2"
      width="1140"
      top="10vh"
      :close-on-click-modal="false"
      @close="dialogVisible2Close"
    >
@@ -719,6 +888,155 @@
      </span>
    </el-dialog>
    <!--    不良处理列表对话框-->
    <el-dialog
      title="维修处理"
      :visible.sync="badDialogVisible"
      width="990px"
      class="badDialogVisible"
      top="10vh"
      :close-on-click-modal="false"
      @close="handleCloseBad"
      @closed="handleCloseBad"
    >
      <el-form
        inline
        :model="badDialogForm"
        label-width="110px"
      >
        <el-form-item label="工单编号:">
          <div style="width: 200px">{{ badDialogForm.wo_code }}</div>
        </el-form-item>
        <el-form-item label="产品编码:">
          <div style="width: 200px">{{ badDialogForm.partcode }}</div>
        </el-form-item>
        <el-form-item label="产品名称:">
          <div style="width: 200px">{{ badDialogForm.partname }}</div>
        </el-form-item>
        <el-form-item label="产品规格:">
          <div style="width: 200px">{{ badDialogForm.partspec }}</div>
        </el-form-item>
        <el-form-item label="当前工序:">
          <div style="width: 200px">{{ badDialogForm.stepname }}</div>
        </el-form-item>
        <el-form-item label="下道工序:">
          <div style="width: 200px">{{ badDialogForm.nextstepname }}</div>
        </el-form-item>
        <el-form-item label="任务数量:">
          <div style="width: 200px">{{ badDialogForm.plan_qty }}</div>
        </el-form-item>
        <el-form-item label="报工数量:">
          <div style="width: 200px">{{ badDialogForm.good_qty }}</div>
        </el-form-item>
        <el-form-item label="不良数量:">
          <div style="width: 200px">{{ badDialogForm.ng_qty }}</div>
        </el-form-item>
      </el-form>
      <div style="margin-bottom:20px">
        <i class="el-icon-s-operation" style="color:#42b983;" /> 不良信息明细:
      </div>
      <div class="elTableDiv">
        <el-table
          :data="badTableDataDialog"
          :height="isIpad? (tableHeight-350):(tableHeight-400)"
          border
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:(tableHeight-400)+'px',}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
        >
          <el-table-column
            type="index"
            width="50"
            label="序号"
            fixed
          />
          <el-table-column
            prop="step_code"
            label="工序编码"
            min-width="80"
          />
          <el-table-column
            prop="stepname"
            label="工序名称"
            min-width="80"
          />
          <el-table-column
            prop="plan_qty"
            label="任务数量"
            width="80"
          />
          <el-table-column
            label="报工数量"
            width="80"
            prop="report_qty"
          />
          <el-table-column
            prop="ng_qty"
            label="不良数量"
            width="80"
          />
          <el-table-column
            prop="badqty"
            label="已报废数量"
            width="100"
          />
          <el-table-column
            prop="defect_name"
            label="不良原因"
            show-tooltip-when-overflow
            width="80"
          />
          <el-table-column
            prop="repair_qty"
            label="维修数量"
            width="90"
          >
            <template slot-scope="{row}">
              <!--              {{ row.repair_qty }}-->
              <div v-if="row.isVisible===0">{{ row.repair_qty }}</div>
              <el-input v-if="row.isVisible===1" v-model="row.repair_qty" oninput="value=value.replace(/[^0-9]/g,'')" />
            </template>
          </el-table-column>
          <el-table-column
            prop="bad_qty"
            label="报废数量"
            width="90"
          >
            <!--            oninput="value=value.replace(/[0-9]/g,'')"-->
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">{{ row.bad_qty }}</div>
              <el-input v-if="row.isVisible===1" v-model="row.bad_qty" oninput="value=value.replace(/[^0-9]/g,'')" />
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            width="100"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-button v-if="row.isVisible===0" type="text" @click="badEdit(row)">编辑</el-button>
                <el-button v-if="row.isVisible===0" type="text" @click="badDel(row)">删除</el-button>
                <el-button v-if="row.isVisible===1" type="text" @click="badSave(row)">确认</el-button>
                <el-button v-if="row.isVisible===1" type="text" @click="badCancel(row)">取消</el-button>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="badDialogVisibleCancel">取 消</el-button>
          <el-button type="primary" @click="badDialogVisibleConfirm ">保 存/打 印</el-button>
        </div>
      </span>
    </el-dialog>
  </div>
</template>
@@ -738,7 +1056,7 @@
  MesOrderStepSelectCause,
  SavaMesOrderStepIn,
  SavaMesOrderStepStart,
  SavaMesOrderStepReport
  SavaMesOrderStepReport, MesOrderNgStepSearch, MesOrderNgSubStepSearch, EditOrderNgStepSeave
} from '@/api/scgl'
import { urlAddRandomNo, webapp_ws_ajax_run, webapp_ws_autoupdate } from '@/utils/grwebapp'
import QRCode from 'qrcodejs2'
@@ -902,14 +1220,28 @@
          console.log('执行了打印')
        }
      },
      qrForm: {
      qrForm: { // 打印内容
        qrvalue: '',
        startqty: '',
        wo_code: '',
        partcode: '',
        partname: '',
        nextstepname: ''
      }
        nextstepname: '',
        operator: '', // 操作人
        operatorTime: ''// 操作时间
      },
      badForm: {
        orderstepqrcode: '', // 扫描的二维码
        prop: 'wo_code',
        order: 'asc',
        page: 1,
        rows: 20
      },
      badTableData: [], // 不良处理列表table数据
      badTotal: 0,
      badDialogVisible: false,
      badDialogForm: {},
      badTableDataDialog: []// 不良对话框table表格
    }
  },
  // computed: {
@@ -984,6 +1316,18 @@
      this.WXform.prop = prop
      this.getMesOrderWxStepSearch()
    },
    badSortChange({ column, prop, order }) {
      if (order === 'descending') {
        order = 'desc'
      } else if (order === 'ascending') {
        order = 'asc'
      } else {
        order = 'desc'
      }
      this.badForm.order = order
      this.badForm.prop = prop
      this.getBadList()
    },
    // 自制页签原点点击
    getCurrentRow(val) {
@@ -1007,6 +1351,13 @@
          this.getMesOrderWxStepSearch()
          $("input[name='WXproduceCode']")[0].focus()
          this.form.orderstepqrcode = ''
        })
      }
      if (this.$refs.elTabs.currentName === '2') {
        this.$nextTick(() => {
          this.getBadList()
          $("input[name='badProduceCode']")[0].focus()
          this.badForm.orderstepqrcode = ''
        })
      }
    },
@@ -1047,6 +1398,13 @@
        if (res.code === '200' && res.count === 3) {
          await this.WXback(res.data)
        }
      }
      if (belong === 'badProduceCode') {
        // this.badForm.orderstepqrcode=
        await this.getBadList()
        await this.repairHandle(this.badForm.orderstepqrcode)
        this.badDialogVisible = true
      }
    },
    // 查询
@@ -1322,6 +1680,10 @@
      this.dialogForm.startqtySum = '' // 不能超过的数值
      this.dialogForm.nextstepcode = '' // 下道工序编码
      this.userTableData = [] // 人员列表
      this.$refs.dialogForm.clearValidate()
    },
    // 对话框取消
@@ -1383,9 +1745,12 @@
            }
            SavaMesOrderStepIn(data).then(res => {
              if (res.code === '200') {
                this.WXprint2()
                this.$message.success('收料成功!')
                this.dialogVisible = false
                if (this.dialogForm.nextstepcode !== '') {
                  this.WXprint2()
                }
                this.dialogVisible2 = true
                this.tabClick()
              } else {
@@ -1428,7 +1793,13 @@
                return this.$message.info('请选择不良原因!')
              }
            }
            // this.userTableData = [...new Set(this.userTableData)]// 数组去重
            this.userTableData = this.userTableData.filter(item => item.usercode !== '')
            // 数组中对象相同的去重
            this.userTableData = this.userTableData.filter((currentValue, currentIndex, selfArr) => {
              return selfArr.findIndex(item => item.usercode === currentValue.usercode) === currentIndex
            })
            // console.log(this.userTableData, 1)
            const reportuser = this.userTableData.map(item => item.usercode).join(';')
            const data = {
              mesordercode: this.dialogForm.wo_code, // 工单编号
@@ -1449,9 +1820,13 @@
            SavaMesOrderStepReport(data).then(res => {
              if (res.code === '200') {
                this.ZZprint2()
                this.$message.success('报工成功!')
                this.dialogVisible = false
                console.log(this.dialogForm.nextstepcode, 1)
                if (this.dialogForm.nextstepcode !== '') {
                  this.ZZprint2()
                }
                this.dialogVisible2 = true
                this.tabClick()
              } else {
@@ -1519,6 +1894,181 @@
          this.tableHeight = this.tableHeight - 50
        }
      })
    },
    // 获取不良处理列表
    async getBadList() {
      const res = await MesOrderNgStepSearch(this.badForm)
      this.badTableData = res.data
      this.badTotal = res.count
    },
    badDialogVisibleCancel() {
      this.badDialogVisible = false
    },
    badDialogVisibleConfirm() {
      const data = {
        Data: this.badTableDataDialog
      }
      // console.log(JSON.stringify(data), 1)
      // this.badPrint()
      // this.dialogVisible2 = true
      EditOrderNgStepSeave(data).then(res => {
        if (res.code === '200' || res.code === '301') {
          this.getBadList()
          this.badDialogVisible = false
          return this.$message.success('保存成功!')
        }
      })
    },
    badPrint() {
      this.qrForm.qrvalue = this.badDialogForm.wo_code + ';' + this.badDialogForm.nextstepcode
      this.qrForm.startqty = this.badDialogForm.plan_qty
      this.qrForm.wo_code = this.badDialogForm.wo_code
      this.qrForm.partcode = this.badDialogForm.partcode
      this.qrForm.partname = this.badDialogForm.partname
      this.qrForm.nextstepname = this.badDialogForm.nextstepname
      this.$nextTick(() => {
        this.bindQRCode(this.qrForm.qrvalue)
      })
    },
    handleCloseBad() {
      this.badDialogForm = {}
      this.badTableDataDialog = []
    },
    // 点击维修处理按钮
    async repairHandle(row) {
      console.log(row)
      let data
      if (row.wo_code) {
        data = {
          orderstepqrcode: row.wo_code + ';' + row.stepcode
        }
      } else {
        data = {
          orderstepqrcode: row
        }
      }
      const { data: res } = await MesOrderNgSubStepSearch(data)
      this.$nextTick(() => {
        this.badDialogForm.wo_code = res.data1.wo_code
        this.badDialogForm.partcode = res.data1.partnumber
        this.badDialogForm.partname = res.data1.partname
        this.badDialogForm.partspec = res.data1.partspec
        this.badDialogForm.stepname = res.data1.stepname
        this.badDialogForm.nextstepcode = res.data1.nextstepcode
        this.badDialogForm.nextstepname = res.data1.nextstepname
        this.badDialogForm.plan_qty = res.data1.planqty
        this.badDialogForm.good_qty = res.data1.noreportqty // 报工数量
        this.badDialogForm.ng_qty = res.data1.noputqty // 不良数量
        this.badTableDataDialog = res.data2
        this.badTableDataDialog.forEach(item => {
          item.repair_qty = 0
          item.bad_qty = 0
          item.isVisible = 0
        })
        console.log(this.badTableDataDialog, 321)
        this.badDialogVisible = true
      })
    },
    badEdit(row) {
      console.log(row)
      this.badTableDataDialog.forEach((item, index) => {
        if (item.id === row.id && item.m_id === row.m_id) {
          this.badTableDataDialog.splice(index, 1, {
            bad_qty: row.bad_qty,
            repair_qty: row.repair_qty,
            isVisible: 1,
            defect_code: row.defect_code,
            defect_name: row.defect_name,
            badqty: row.badqty,
            id: row.id,
            m_id: row.m_id,
            materiel_code: row.materiel_code,
            ng_qty: row.ng_qty,
            plan_qty: row.plan_qty,
            report_qty: row.report_qty,
            seq: row.seq,
            step_code: row.step_code,
            stepname: row.stepname,
            style: row.style,
            wo_code: row.wo_code
          })
        }
      })
    },
    badSave(row) {
      console.log(row, 1)
      // console.log(parseFloat(row.bad_qty) + parseFloat(row.repair_qty), 2)
      // console.log(parseFloat(row.ng_qty), 2)
      // console.log(parseFloat(row.bad_qty) + parseFloat(row.repair_qty) > parseFloat(row.ng_qty), 2)
      if (parseFloat(row.bad_qty) + parseFloat(row.repair_qty) > parseFloat(row.ng_qty)) {
        this.badCancel(row)
        return this.$message.info('维修数量与报废数量之和不能大于不良数量!')
      }
      this.badTableDataDialog.forEach((item, index) => {
        if (item.id === row.id && item.m_id === row.m_id) {
          this.badTableDataDialog.splice(index, 1, {
            bad_qty: row.bad_qty,
            repair_qty: row.repair_qty,
            isVisible: 0,
            defect_code: row.defect_code,
            defect_name: row.defect_name,
            id: row.id,
            m_id: row.m_id,
            badqty: row.badqty,
            materiel_code: row.materiel_code,
            ng_qty: row.ng_qty,
            plan_qty: row.plan_qty,
            report_qty: row.report_qty,
            seq: row.seq,
            step_code: row.step_code,
            stepname: row.stepname,
            style: row.style,
            wo_code: row.wo_code
          })
        }
      })
    },
    badCancel(row) {
      this.badTableDataDialog.forEach((item, index) => {
        if (item.id === row.id && item.m_id === row.m_id) {
          this.badTableDataDialog.splice(index, 1, {
            // bad_qty: row.bad_qty,
            // repair_qty: row.repair_qty,
            bad_qty: 0,
            repair_qty: 0,
            isVisible: 0,
            defect_code: row.defect_code,
            defect_name: row.defect_name,
            id: row.id,
            m_id: row.m_id,
            badqty: row.badqty,
            materiel_code: row.materiel_code,
            ng_qty: row.ng_qty,
            plan_qty: row.plan_qty,
            report_qty: row.report_qty,
            seq: row.seq,
            step_code: row.step_code,
            stepname: row.stepname,
            style: row.style,
            wo_code: row.wo_code
          })
        }
      })
    },
    badDel(row) {
      this.badTableDataDialog.forEach((item, index) => {
        if (item.id === row.id && item.m_id === row.m_id) {
          this.badTableDataDialog.splice(index, 1)
        }
      })
    }
  }
}
@@ -1526,10 +2076,11 @@
<style lang="scss" scoped>
$main_color: #42b983;
.el-button--text{
.el-button--text {
  font-size: 14px;
  cursor: pointer;
}
.operationClass {
  height: 23px;
  display: flex;
@@ -1575,13 +2126,20 @@
<!--公共页面样式-->
<style lang="scss" scoped>
$main_color: #42b983;
.el-icon-share ,.el-icon-delete,.el-icon-edit-outline{
::v-deep .el-button--text {
  font-size: 14px;
  cursor: pointer;
}
.el-icon-share, .el-icon-delete, .el-icon-edit-outline {
  color: $main_color;
  cursor: pointer;
}
.el-icon-edit-outline{
.el-icon-edit-outline {
  margin-right: 15px;
}
::v-deep .el-button--primary, .el-button--default, .el-button--info {
  height: 34px;
  display: flex;
@@ -1616,6 +2174,10 @@
  padding: 20px 20px !important;
}
::v-deep .badDialogVisible .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .el-dialog__footer {
  display: flex;
  justify-content: flex-end;
@@ -1639,8 +2201,8 @@
  background-color: #f8f8fa;
}
::v-deep .el-table__body .el-table__row.hover-row td{
  background-color: #eaecef ;
::v-deep .el-table__body .el-table__row.hover-row td {
  background-color: #eaecef;
}
::v-deep .el-form--inline .el-form-item__label {