小小儁爺
8 天以前 4a2c6fb2773adf8b5e28351021b79aebaf2af5e4
src/views/workOrder/workOrderList.vue
@@ -5,21 +5,21 @@
      <div
        class="bodyTopStatus"
      >
        <div style="font-weight: bolder;">工单状态</div>
        <div class="statusItem" :class="{statusItemLight:form.mesorderstus===''}" @click="statusChange('')">全部</div>
        <div class="statusItem" :class="{statusItemLight:form.mesorderstus==='NEW'}" @click="statusChange('NEW')">新订单</div>
        <div class="statusItem" :class="{statusItemLight:form.mesorderstus==='ALLO'}" @click="statusChange('ALLO')">已派发</div>
        <div class="statusItem" :class="{statusItemLight:form.mesorderstus==='START'}" @click="statusChange('START')">开工</div>
        <div class="statusItem" :class="{statusItemLight:form.mesorderstus==='CLOSED'}" @click="statusChange('CLOSED')">完工</div>
        <div style="font-weight: bolder;">工单状态:</div>
        <div class="statusItem" :class="{statusItemLight:true}" @click="statusChange('')">全部</div>
        <div class="statusItem" :class="{statusItemLight1:true}" @click="statusChange('NEW')">新订单</div>
        <div class="statusItem" :class="{statusItemLight2:true}" @click="statusChange('ALLO')">已派发</div>
        <div class="statusItem" :class="{statusItemLight3:true}" @click="statusChange('START')">开工</div>
        <div class="statusItem" :class="{statusItemLight4:true}" @click="statusChange('CLOSED')">完工</div>
      </div>
      <div class="bodyTopButtonGroup" style="justify-content: space-between;margin-top: 5px;">
        <div style="display: flex">
          <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
          <el-button v-waves type="success" icon="el-icon-connection" @click="send">派发</el-button>
          <el-button v-waves type="success" icon="el-icon-connection" @click="send();tableDataDetail=[]">派发</el-button>
        </div>
        <el-button v-waves type="primary" @click="batchUpdate"><i
        <el-button v-waves type="primary" @click="batchUpdate();tableDataDetail=[]"><i
          class="el-icon-edit"
          style="margin-right: 0;"
        /> 批量绑定
@@ -39,6 +39,8 @@
              <el-select
                v-model="form.wkshopcode"
                filterable
                multiple
                collapse-tags
                :popper-append-to-body="false"
                style="width: 200px"
                placeholder="请选择"
@@ -119,8 +121,8 @@
            class="bodySearchReset"
            :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
          >
            <el-button v-waves type="primary" icon="el-icon-search" @click="search">查询</el-button>
            <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
            <el-button v-waves type="primary" icon="el-icon-search" @click="search();tableDataDetail=[]">查询</el-button>
            <el-button v-waves type="info" icon="el-icon-refresh" @click="reset();tableDataDetail=[]">重置</el-button>
          </div>
        </el-form>
@@ -152,7 +154,7 @@
          border
          :summary-method="getSummaries"
          show-summary
          :row-class-name="tableRowClassName"
          :row-class-name="tableRowClassName2"
          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px'}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
@@ -165,12 +167,14 @@
            type="selection"
            width="50"
            :selectable="selected"
            class-name="fixed-column"
          />
          <el-table-column
            prop="rowNum"
            width="50"
            width="80"
            label="序号"
            fixed
            class-name="fixed-column"
          />
          <el-table-column
            prop="status"
@@ -462,6 +466,7 @@
            label="操作"
            width="160"
            fixed="right"
            class-name="fixed-column"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
@@ -484,7 +489,7 @@
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click="del(row)" />
                  <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click.stop="del(row)" />
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="打印工单" placement="top">
@@ -523,11 +528,12 @@
        align="right"
        layout="total,prev, pager, next,sizes,jumper"
        popper-class="select_bottom"
        @pagination="getMesOrderSearch"
        @pagination="getMesOrderSearch();tableDataDetail=[]"
      />
      <div class="elTableDiv">
        <el-table
          ref="tableDataRef2"
          :data="tableDataDetail"
          border
          height="210px"
@@ -753,6 +759,7 @@
            v-model="dialogForm.mesqty"
            oninput="value=value.replace(/[^\d]/g,'')"
            style="width: 200px"
            @input="mesqtyInputChange"
          />
          <!--          oninput="value=value.replace(/[^0-9*.{1}0-9*]/g,'')"-->
        </el-form-item>
@@ -850,7 +857,13 @@
            />
          </el-select>
        </el-form-item>
        <el-form-item label="销售订单" prop="">
          <el-input
            v-model="dialogForm.saleordercode"
            style="width: 200px"
            :disabled="!(dialogForm.mesorderstus==='NEW'&&dialogForm.data_sources==='MES')"
          />
        </el-form-item>
        <el-form-item label="预计交付日期" prop="deliverydate">
          <el-date-picker
            v-model="dialogForm.deliverydate"
@@ -886,6 +899,7 @@
            class="stepSelectedValueClass"
            style="width: 930px;"
            multiple
            filterable
            placeholder="请选择相对应工序"
            @change="stepSelectedValueChange"
          >
@@ -1574,6 +1588,7 @@
            </div>
            <div
              id="qrCode0"
              :key="formApprove.mesordercode"
              style="width: 22%;height:90px;
                        margin-top: 20px;
                        overflow-y: scroll;display: flex;
@@ -1710,6 +1725,7 @@
            </div>
            <div
              id="qrCode1"
              :key="formApprove.mesordercode"
              style="width: 22%;height:90px;
                        margin-top: 20px;
                        overflow-y: scroll;display: flex;
@@ -1796,7 +1812,7 @@
          <el-button v-waves @click="dialogVisibleBackPreview">返 回</el-button>
          <!--            <el-button v-waves v-if="operation==='add'" type="primary" @click="dialogVisibleConfirm">确 定</el-button>-->
          <!--            <el-button v-waves type="primary" @click="dialogVisibleConfirm">确 定/打 印</el-button>-->
          <el-button v-waves v-print="printObj" type="primary">打 印</el-button>
          <el-button v-waves v-print="printObj" type="primary" @click="sendMesOrderDistribution">打 印</el-button>
        </div>
      </span>
    </el-dialog>
@@ -2482,9 +2498,8 @@
      </div>
      <div v-for="(i,index) in formData3" :key="index" class="customDiv">
        <!--        ref="dialogForm"-->
        <el-form
          ref="dialogForm"
          inline
          :model="i"
          label-width="110px"
@@ -2565,7 +2580,13 @@
              />
            </el-select>
          </el-form-item>
          <el-form-item label="销售订单" prop="">
            <el-input
              v-model="i.saleordercode"
              style="width: 200px"
              :disabled="!(i.mesorderstus==='NEW'&&i.data_sources==='MES')"
            />
          </el-form-item>
          <el-form-item label="预计交付日期" prop="deliverydate">
            <el-date-picker
              v-model="i.deliverydate"
@@ -2600,6 +2621,7 @@
              class="stepSelectedValueClass"
              style="width: 930px;"
              multiple
              filterable
              placeholder="请选择相对应工序"
              @change="val=>stepSelectedValueChangeBatchUpdate(val,index)"
            >
@@ -2735,7 +2757,7 @@
  AddUpdateMesOrder, AddUpdateMesOrderList, DeleteMesOrder,
  MesBadOrderSearch, MesOrderDistribution, MesOrderNewStepContent, MesOrderProcessSopSearch,
  MesOrderSearch, MesOrderSopSearch, UpdateMesOrderStepListSearch,
  UpdateMesOrderStepSearch
  UpdateMesOrderStepSearch, MesOrderNewStepListContent
} from '@/api/WorkOrder'
import { PartSelect } from '@/api/ProductModel'
import { PrentOrganization, PrentOrganizationNoCompany, StepData } from '@/api/GeneralBasicData'
@@ -2743,7 +2765,12 @@
import ElDragSelect from '@/components/DragSelect'
import { MesOrderPrintSearch } from '@/api/GridReport' // base on element-ui
import DateType from '@/components/DateType'
import { PartSelectRpute, PartSelectRputeList, RouteSelectStep, RouteSelectStepList } from '@/api/basicSettings'
import {
  PartSelectRpute,
  PartSelectRputeList,
  RouteSelectStep,
  RouteSelectStepList
} from '@/api/basicSettings'
import { DeviceSopSearch } from '@/api/DeviceManager'
export default {
@@ -2762,7 +2789,7 @@
      tableHeight: 0,
      username: '',
      form: {
        wkshopcode: '', // 车间编码
        wkshopcode: [], // 车间编码
        mesorderstus: '', // 工单状态码
        mesordercode: '', // 工单编号
        partcode: '', // 产品编码
@@ -2775,7 +2802,7 @@
        // createdate: '', // 创建时间
        datatype: 'ED', // 日期类型(计划开工(PS)、计划完工(PE)、预计交付(ED)、创建日期(CT))
        timeValue: [], // 查询日期
        prop: 'lm_date', // 排序字段
        prop: 'partspec', // 排序字段  lm_date
        order: 'desc', // 排序字段
        page: 1, // 第几页
        rows: 20 // 每页多少条
@@ -2800,6 +2827,8 @@
        ordertype: 'PO', // 工单类型
        sourceorderid: '', // 源单id
        sourceorder: '', // 源单单号
        saleordercode: '', // 销售订单号
        partcode: '', // 产品编码
        partname: '', // 产品名称
@@ -2898,7 +2927,7 @@
          console.log('执行了打印')
        }
      },
      sendMesOrderWoCode: '',
      formApprove: {
        m_po: '', // 源单单号
        mesordercode: '',
@@ -3023,7 +3052,7 @@
      routecodeArr: [], //
      sourceType: false, // 工序的数据来源
      sourceType: true, // 工序的数据来源
      mesSetting: JSON.parse(localStorage.getItem('mesSetting')),
@@ -3083,7 +3112,25 @@
    // })
  },
  methods: {
    // 打印的时候执行派发事件
    sendMesOrderDistribution() {
      MesOrderDistribution([this.sendMesOrderWoCode]).then(res => {
        if (res.code === '200') {
          this.$notify.success('派发成功!')
          this.getMesOrderSearch()
        }
      })
    },
    mesqtyInputChange(val) {
      if (this.stepTableData && this.stepTableData.length > 0) {
        this.stepTableData.forEach(i => {
          i.sumqty = Math.floor(parseFloat(val) * (1 + (parseFloat(i.ratio) / 100)))
        })
      }
    },
    statusChange(val) {
      this.tableDataDetail = []
      this.form.mesorderstus = val
      this.getMesOrderSearch()
    },
@@ -3134,6 +3181,7 @@
          ordertype: i.wotype, // 工单类型
          sourceorderid: i.sourceid, // 源单id
          sourceorder: i.m_po, // 源单单号
          saleordercode: i.saleOrderCode,
          partcode: i.partcode, // 产品编码
          partname: i.partname, // 产品名称
          partspec: i.partspec, // 产品规格
@@ -3149,6 +3197,8 @@
          stepTableData: []// 工序表值
        })
      })
      const tempArr = []
      const { data: res3 } = await UpdateMesOrderStepListSearch(data3)
      console.log(res3, 321)
      res3.forEach((i, index) => {
@@ -3159,40 +3209,61 @@
          })
          this.formData3[index].stepTableData = i.stepdata
          this.formData3[index].stepSelectedValue = i.stepdata.map(j => j.stepcode)
        } else {
          tempArr.push({
            'wkshopcode': this.formData3[index].wkshopcode,
            'routecode': this.formData3[index].routecode,
            'partcode': this.formData3[index].partcode
          })
        }
      })
      const { data: res } = await PartSelectRputeList(partcodeArr)
      if (this.mesSetting.route) {
        res.forEach((i, index) => {
          if (i.routedata.length > 0) {
            this.formData3[index].routecodeArr = i.routedata
          }
        })
      } else {
      console.log(this.sourceType, '执行1', this.formData3)
      const tempArr2 = tempArr.filter((item, index) => {
        return tempArr.findIndex(i => i.partcode === item.partcode) === index
      })
      if (this.sourceType) { // 为true时,调用MesOrderNewStepListContent
        const { data: res } = await MesOrderNewStepListContent(tempArr2)
        this.formData3.forEach((i, index) => {
          if (i.stepTableData.length === 0) {
            i.stepTableData = res[index].stepdata
            i.stepSelectedValue = res[index].stepdata.length > 0 ? res[index].stepdata.map(j => j.stepcode) : []
          }
        })
      }
      // i.stepdata.forEach(j => {
      //   j.ratio = parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) : 0
      //   j.sumqty = Math.round(parseFloat(i.canupdate_qty) * (1 + (parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) / 100 : 0)))
      // })
      if (this.mesSetting.route) {
        const { data: res2 } = await RouteSelectStepList(data2)
        this.formData3.forEach((i, index) => {
          if (i.stepTableData.length === 0) {
            res2[index].stepdata.forEach(j => {
            const ind = res.findIndex(j => j.partcode === this.formData3[index].partcode)
            res[ind].stepdata.forEach(j => {
              j.ratio = parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) : 0
              j.sumqty = Math.round(parseFloat(i.mesqty) * (1 + (parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) / 100 : 0)))
            })
            i.stepTableData = res2[index].stepdata
            i.stepSelectedValue = res2[index].stepdata.length > 0 ? res2[index].stepdata.map(j => j.stepcode) : []
            this.formData3[index].stepTableData = res[ind].stepdata
            this.formData3[index].stepSelectedValue = res[ind].stepdata.length > 0 ? res[ind].stepdata.map(j => j.stepcode) : []
          }
        })
      } else { // 调用PartSelectRputeList
        const { data: res } = await PartSelectRputeList(partcodeArr)
        if (this.mesSetting.route) {
          res.forEach((i, index) => {
            if (i.routedata.length > 0) {
              this.formData3[index].routecodeArr = i.routedata
            }
          })
        } else {
          this.formData3.forEach((i, index) => {
            if (i.stepTableData.length === 0) {
              i.stepTableData = res[index].stepdata
              i.stepSelectedValue = res[index].stepdata.length > 0 ? res[index].stepdata.map(j => j.stepcode) : []
            }
          })
        }
        if (this.mesSetting.route) {
          const { data: res2 } = await RouteSelectStepList(data2)
          this.formData3.forEach((i, index) => {
            if (i.stepTableData.length === 0) {
              res2[index].stepdata.forEach(j => {
                j.ratio = parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) : 0
                j.sumqty = Math.round(parseFloat(i.mesqty) * (1 + (parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) / 100 : 0)))
              })
              i.stepTableData = res2[index].stepdata
              i.stepSelectedValue = res2[index].stepdata.length > 0 ? res2[index].stepdata.map(j => j.stepcode) : []
            }
          })
        }
      }
      // this.formData3 = this.multipleSelection
@@ -3248,6 +3319,7 @@
          sourceid: i.sourceorderid, // 源单id
          sourcewo: i.sourceorder, // 源单单号
          partcode: i.partcode, // 产品编号
          saleordercode: i.saleordercode, // 销售单号
          wkshopcode: i.wkshopcode,
          woqty: i.mesqty, // 工单数量
          deliverydate: i.deliverydate, // 交付时间
@@ -3480,6 +3552,20 @@
    tableRowClassName({ row, rowIndex }) {
      return 'custom-row'
    },
    tableRowClassName2({ row, rowIndex }) {
      if (row.status === 'NEW') {
        return 'custom-row1'
      }
      if (row.status === 'ALLO') {
        return 'custom-row2'
      }
      if (row.status === 'START') {
        return 'custom-row3'
      }
      if (row.status === 'CLOSED') {
        return 'custom-row4'
      }
    },
    handleRequest() {
      this.getMesOrderSearch().then(res => {
        if (res.code === '200') {
@@ -3499,7 +3585,7 @@
      // }
      const data = {
        wkshopcode: this.form.wkshopcode,
        wkshopcode: this.form.wkshopcode.join(','),
        mesorderstus: this.form.mesorderstus, // 工单状态码
        mesordercode: this.form.mesordercode, // 工单编号
        partcode: this.form.partcode, // 产品编码
@@ -3573,7 +3659,7 @@
    // 重置
    reset(val) {
      this.form.wkshopcode = ''
      this.form.wkshopcode = []
      this.form.mesorderstus = ''
      this.form.mesordercode = ''
      this.form.partcode = ''
@@ -3584,6 +3670,8 @@
      this.form.sourceorder = ''
      this.form.ordertype = ''
      // this.form.createdate = ''
      this.form.saleordercode = ''
      this.form.timeValue = []
      this.cycleTime = null
@@ -3672,6 +3760,7 @@
            if (this.form.page > 1 && this.tableData.length === 1) {
              this.form.page--
            }
            this.tableDataDetail = []
            this.getMesOrderSearch()
          }
        })
@@ -3697,6 +3786,7 @@
      this.dialogForm.ordertype = row.wotype
      this.dialogForm.sourceorderid = row.sourceid
      this.dialogForm.sourceorder = row.m_po
      this.dialogForm.saleordercode = row.saleOrderCode
      this.dialogForm.partcode = row.partcode
      this.dialogForm.partname = row.partname
      this.dialogForm.partspec = row.partspec
@@ -3781,7 +3871,9 @@
          this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
        } else {
          await this.getBasicProcessData()
          // await this.getBasicProcessData()
          console.log('执行')
          this.sourceTypeChange(this.sourceType)
        }
      }
@@ -3911,7 +4003,7 @@
        ordertype: 'PO', // 工单类型
        sourceorderid: '', // 源单id
        sourceorder: '', // 源单单号
        saleordercode: '', // 销售订单号
        partcode: '', // 产品编码
        partname: '', // 产品名称
        partspec: '', // 产品规格
@@ -3928,11 +4020,13 @@
      this.dialogForm.routecode = ''
      this.sourceType = false
      this.sourceType = true
      this.stepSelectedValue = []
      this.stepTableData = []
      this.$refs.dialogForm.clearValidate()
      this.$refs.tableDataRef.doLayout()
      this.$refs.tableDataRef2.doLayout()
    },
    // 对话框取消
    dialogVisibleCancel() {
@@ -3983,13 +4077,14 @@
              return this.$message.error('有序报工情况下,超报比例后道工序不能大于前道工序!')
            }
          }
          console.log(isNaN(this.dialogForm.mesqty - this.dialogForm.mesqtyinit))
          // console.log(isNaN(this.dialogForm.mesqty - this.dialogForm.mesqtyinit))
          const data = {
            wostatus: this.dialogForm.mesorderstus, // 工单状态
            wocode: this.dialogForm.mesordercode, // 工单号
            wotype: this.dialogForm.ordertype, // 工单类型
            sourceid: this.dialogForm.sourceorderid, // 源单id
            sourcewo: this.dialogForm.sourceorder, // 源单单号
            saleordercode: this.dialogForm.saleordercode, // 销售订单号
            partcode: this.dialogForm.partcode, // 产品编号
            wkshopcode: this.dialogForm.wkshopcode,
            woqty: this.dialogForm.mesqty, // 工单数量
@@ -4010,6 +4105,7 @@
              // this.handlePrint()
              this.$message.success(this.operation === 'add' ? '添加成功!' : '保存成功!')
              this.getMesOrderSearch()
              this.tableDataDetail = []
              this.$store.state.app.buttonIsDisabled = false
            } else {
              this.$message.error(this.operation === 'add' ? '添加失败!' : '保存失败!')
@@ -4083,6 +4179,7 @@
      const data2 = {
        mesordercode: wo_code || this.dialogForm.mesordercode
      }
      this.sendMesOrderWoCode = wo_code || this.dialogForm.mesordercode
      MesOrderPrintSearch(data2).then(res2 => {
        if (res2.code === '200') {
          this.dialogVisibleApprove = true
@@ -4573,7 +4670,7 @@
    getSummaries(param) {
      const { columns, data } = param
      const sums = []
      const i = 9
      const i = 13
      columns.forEach((column, index) => {
        if (index === i) {
          sums[index] = '总数'
@@ -4940,7 +5037,25 @@
.statusItemLight{
  font-weight: bolder;
  color: #42b983;
  //color: #42b983;
  color: #000;
}
.statusItemLight1{
  font-weight: bolder;
  color: rgba(245, 108, 108, 1);
}
.statusItemLight2{
  font-weight: bolder;
  color: rgba(230, 162, 60, 1);
}
.statusItemLight3{
  font-weight: bolder;
  color: rgba(144, 147, 153, 1);
}
.statusItemLight4{
  font-weight: bolder;
  color: rgba(103, 194, 58, 1);
}
</style>
@@ -4949,6 +5064,27 @@
.el-table .custom-row {
  background: #f8f8fa;
}
.el-table .custom-row1 {
  background: rgba(245, 108, 108, 0.4);
}
.el-table .custom-row2 {
  background: rgba(230, 162, 60, 0.4);
}
.el-table .custom-row3 {
  background: rgba(144, 147, 153, 0.4);
}
.el-table .custom-row4 {
  background: rgba(103, 194, 58, 0.4);
}
.el-table .fixed-column {
  background: #f8f8fa;
}
</style>
<style>
.sortable-ghost {