zouyu
4 天以前 0f102473c642142976d537af4c505b8a7161d6c5
原材料报检拆分功能V1
已修改7个文件
347 ■■■■ 文件已修改
src/api/business/materialInspection.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/file.js 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/management.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/inspectionTask/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/inspectionTask/inspection.vue 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/materialOrder/index.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/rawMaterialInspection/index.vue 202 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/business/materialInspection.js
@@ -2,7 +2,7 @@
import request from '@/utils/request'
// 查询IFS订单-待报检
export function getIfsOrder(query) {
export function getIfsOrder() {
  return request({
    url: 'insOrder/getIfsOrder',
    method: 'get',
@@ -97,3 +97,19 @@
    responseType: "blob"
  })
}
// 订单拆分模板下载
export function downloadTemplate() {
  return request({
    url: '/rawMaterialOrder/downloadTemplate',
    method: 'get',
    responseType: 'blob'
  })
}
// 确认拆分订单
export function confirmSplitOrder(data) {
  return request({
    url: '/rawMaterialOrder/confirmSplitOrder',
    method: 'post',
    data: data
  })
}
src/utils/file.js
@@ -80,3 +80,26 @@
    });
  },
};
export function transformExcel(response, tempName) {
  const relType = ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-excel;charset=UTF-8']
  let type = response.type
  if (relType.includes(type)) {
    const blob = new Blob([response], {type: 'application/vnd.ms-excel'})
    let temp = tempName
    if(response.headers){
      const disposition = response.headers["Content-Disposition"]
      temp = disposition.substring(disposition.lastIndexOf('=') + 1)
    }
    let filename = decodeURI(temp)
    // 创建一个超链接,将文件流赋进去,然后实现这个超链接的单击事件
    const elink = document.createElement('a')
    elink.download = filename
    elink.style.display = 'none'
    elink.href = URL.createObjectURL(blob)
    document.body.appendChild(elink)
    elink.click()
    URL.revokeObjectURL(elink.href) // 释放URL 对象
    document.body.removeChild(elink)
  }
}
src/views/CNAS/resourceDemand/device/component/management.vue
@@ -815,7 +815,7 @@
            delete this.formData.updateUser
            const formData = this.HaveJson(this.formData)
            formData.insProductIds = formData.insProductIds ? formData.insProductIds.join() : ''
            if (formData.authorizedPerson.length === 0) {
            if (formData.authorizedPerson && formData.authorizedPerson.length === 0) {
                formData.authorizedPerson = ''
            } else {
                formData.authorizedPerson = JSON.stringify(formData.authorizedPerson)
src/views/business/inspectionTask/index.vue
@@ -794,6 +794,7 @@
          state: this.state,
          typeSource: this.typeSource,
          orderId: this.orderId,
          isSplit: row.isSplitOrder
        },
      });
    },
src/views/business/inspectionTask/inspection.vue
@@ -735,7 +735,6 @@
        size: 10,
        current: 0,
      },
      tableLoading: false,
      // 文件列表相关--结束
      // 任务切换列表--开始
      tableData0: [],
@@ -770,6 +769,7 @@
      },
      tableLoading0: false,
      // 任务切换列表--结束
      isSplit: 0, // 是否是拆单过来的
    };
  },
  // 用于上传文件的信息
@@ -780,7 +780,7 @@
    },
  },
  created() {
    let { sonLaboratory, orderId, state, inspectorList, typeSource } =
    let { sonLaboratory, orderId, state, inspectorList, typeSource,isSplit } =
      this.$route.query;
    this.sonLaboratory = sonLaboratory;
    this.orderId = orderId;
@@ -788,6 +788,7 @@
    this.state = state;
    this.inspectorList = inspectorList;
    this.typeSource = typeSource;
    this.isSplit = isSplit;
  },
  mounted() {
    this.getTypeDicts(); // 获取紧急程度下拉框选项
@@ -2553,6 +2554,26 @@
    openAddVerifyDia() {
      this.addVerifyDia = true;
    },
    confirmSubmit(registerInsResults){
      submitPlan({
        orderId: this.orderId,
        laboratory: this.sonLaboratory,
        verifyUser: this.verifyUser,
        entrustCode: this.insOrder.entrustCode,
        registerInsResults: registerInsResults
      }).then((res) => {
        if (res.code === 200) {
          this.$message.success("操作成功");
          this.goback();
          this.submitLoading = false;
          this.addVerifyDia = false;
        }
      })
        .catch((error) => {
          console.error(error);
          this.submitLoading = false;
        });
    },
    submit() {
      if (this.verifyUser === null || this.verifyUser === "") {
        this.$message.error("请指定复核人员");
@@ -2572,25 +2593,24 @@
        laboratory: this.sonLaboratory,
      }).then((res) => {
        if (res.code === 200) {
          if (!res.data || res.data.length == 0) {
          if (!res.data || res.data.errorMsg.length == 0) {
            this.submitLoading = true;
            submitPlan({
              orderId: this.orderId,
              laboratory: this.sonLaboratory,
              verifyUser: this.verifyUser,
              entrustCode: this.insOrder.entrustCode,
            }).then((res) => {
              if (res.code === 200) {
                this.$message.success("操作成功");
                this.goback();
                this.submitLoading = false;
                this.addVerifyDia = false;
              }
            })
              .catch((error) => {
                console.error(error);
                this.submitLoading = false;
            //检验类型为原材料
            if(this.typeSource==1 && res.data.unInsOrderCount==0 && this.isSplit==1){
              const htmlStr = "是否登记IFS采购检验结果并移库?该操作会登记<span style='color:#ff4949'>同一零件同一订单的所有拆分批次</span>,请谨慎选择。"
              this.$confirm(htmlStr, '提示', {
                confirmButtonText: '是',
                cancelButtonText: '否',
                type: 'warning',
                dangerouslyUseHTMLString: true
              }).then(() => {
                this.confirmSubmit(true)
              }).catch(() => {
                this.confirmSubmit(false)
              });
            }else{
              this.confirmSubmit(false)
            }
          } else {
            let newData = [];
            const h = this.$createElement;
@@ -2626,22 +2646,23 @@
            })
              .then(() => {
                this.submitLoading = true;
                submitPlan({
                  orderId: this.orderId,
                  laboratory: this.sonLaboratory,
                  verifyUser: this.verifyUser,
                }).then((res) => {
                  if (res.code === 200) {
                    this.$message.success("操作成功");
                    this.addVerifyDia = false;
                    this.goback();
                  }
                  this.submitLoading = false;
                })
                  .catch((error) => {
                    console.error(error);
                    this.submitLoading = false;
                  });
                this.confirmSubmit(false)
                // submitPlan({
                //   orderId: this.orderId,
                //   laboratory: this.sonLaboratory,
                //   verifyUser: this.verifyUser,
                // }).then((res) => {
                //   if (res.code === 200) {
                //     this.$message.success("操作成功");
                //     this.addVerifyDia = false;
                //     this.goback();
                //   }
                //   this.submitLoading = false;
                // })
                //   .catch((error) => {
                //     console.error(error);
                //     this.submitLoading = false;
                //   });
              })
              .catch(() => { });
          }
src/views/business/materialOrder/index.vue
@@ -239,7 +239,7 @@
            }
          }
        },
        { label: '抵达的采购数量', prop: 'qtyArrived' },
        { label: '抵达的采购数量', prop: 'purQtyInStore' },
        { label: '单位', prop: 'buyUnitMeas' },
        { label: '订单号', prop: 'orderNo' },
        { label: '接收时间', prop: 'receiverDate' },
@@ -319,7 +319,7 @@
            }
          }
        },
        { label: '抵达的采购数量', prop: 'qtyArrived' },
        { label: '抵达的采购数量', prop: 'purQtyInStore' },
        { label: '单位', prop: 'buyUnitMeas' },
        { label: '订单号', prop: 'orderNo' },
        { label: '接收时间', prop: 'receiverDate' },
@@ -404,7 +404,7 @@
          }
        },
        { label: '订单号', prop: 'orderNo' },
        { label: '抵达的采购数量', prop: 'qtyArrived' },
        { label: '抵达的采购数量', prop: 'purQtyInStore' },
        { label: '下发时间', prop: 'sendTime' },
        { label: '批号', prop: 'updateBatchNo' },
        { label: '零件号', prop: 'partNo' },
@@ -590,7 +590,7 @@
          }
        },
        { label: '订单号', prop: 'orderNo' },
        { label: '抵达的采购数量', prop: 'qtyArrived' },
        { label: '抵达的采购数量', prop: 'purQtyInStore' },
        { label: '下发时间', prop: 'sendTime' },
        { label: '批号', prop: 'updateBatchNo' },
        { label: '零件号', prop: 'partNo' },
@@ -714,7 +714,7 @@
          }
        },
        { label: '订单号', prop: 'orderNo' },
        { label: '抵达的采购数量', prop: 'qtyArrived' },
        { label: '抵达的采购数量', prop: 'purQtyInStore' },
        { label: '下发时间', prop: 'sendTime' },
        { label: '批号', prop: 'updateBatchNo' },
        { label: '零件号', prop: 'partNo' },
src/views/business/rawMaterialInspection/index.vue
@@ -109,8 +109,8 @@
          <el-input v-model="declareObj.partDesc" :disabled="declareType !== 'add'" class="addObj-info" clearable
            placeholder="" size="small"></el-input>
        </el-form-item>
        <el-form-item class="declareObj-form-item" label="抵达的采购数量:" prop="qtyArrived">
          <el-input v-model="declareObj.qtyArrived" :disabled="declareType !== 'add'" class="addObj-info" clearable
        <el-form-item class="declareObj-form-item" label="抵达的采购数量:" prop="purQtyInStore">
          <el-input v-model="declareObj.purQtyInStore" :disabled="declareType !== 'add'" class="addObj-info" clearable
            placeholder="" size="small"></el-input>
        </el-form-item>
        <el-form-item v-if="declareType !== 'add'" class="declareObj-form-item" label="供应商编号:" prop="supplierId">
@@ -173,6 +173,83 @@
    <!--数据查看弹框-->
    <data-look-visible v-if="dataDialogVisible" ref="dataDialogVisible" :dataDialogVisible="dataDialogVisible"
      :dataLookInfo="dataLookInfo" @closeDataLook="closeDataLook"></data-look-visible>
    <el-dialog
      title="订单拆分"
      :visible.sync="orderSplitDialogVisible"
      :before-close="resetOrderSplitData"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :show-close="!confirmSplitOrderLoading"
      width="60%">
      <div>
        <el-divider content-position="left">订单主体</el-divider>
        <el-table
          :data="orderSplitBasicData"
          border
          :header-cell-style="{textAlign:'center'}"
          :cell-style="{textAlign:'center'}"
        >
          <el-table-column label="订单编号" prop="orderNo" :min-width="100" width="100"></el-table-column>
          <el-table-column label="零件编号" prop="partNo" :min-width="150" width="150" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件描述" prop="partDesc" :min-width="150" show-overflow-tooltip></el-table-column>
          <el-table-column label="抵达的采购数量" prop="purQtyInStore" :min-width="120" width="120"></el-table-column>
          <el-table-column label="供应商编号" prop="supplierId" :min-width="100" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="供应商名称" prop="supplierName" :min-width="100" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="批号" prop="lotBatchNo" :min-width="100" width="100"></el-table-column>
          <el-table-column label="单位" prop="buyUnitMeas" :min-width="100" width="100"></el-table-column>
        </el-table>
        <el-divider content-position="left">拆分详情</el-divider>
        <el-row>
          <el-col :span="12">
            <el-checkbox v-model="pushToMes"><span style="font-weight: bold">同步到MES</span></el-checkbox>
          </el-col>
          <el-col :span="12">
            <div style="width:100%;text-align: right;margin-bottom:5px">
              <el-upload
                style="display:inline-block;margin: 0 8px;"
                ref="upload"
                class="upload-demo"
                :headers="uploadHeader"
                :action="splitOrderAction"
                :data="{ifsId:declareObj.id}"
                :on-change="beforeUpload"
                :on-error="onError"
                :on-success="handleSuccess"
                accept=".xls,.xlsx"
                :show-file-list="false"
                :multiple="false">
                <el-button size="mini" type="primary" :loading="upLoading">导入</el-button>
              </el-upload>
              <el-button size="mini" type="primary" @click="downloadTemplate">下载模板</el-button>
            </div>
          </el-col>
        </el-row>
        <el-table
          :data="orderSplitDetailData"
          v-loading="detailDataLoading"
          :header-cell-style="{textAlign:'center'}"
          :cell-style="{textAlign:'center'}"
          border>
          <el-table-column label="零件编号" prop="partNo" :min-width="150" width="150" show-overflow-tooltip></el-table-column>
          <el-table-column label="系统编号" prop="systemNo" :min-width="90" width="90" show-overflow-tooltip></el-table-column>
          <el-table-column label="规格" prop="model" :min-width="90" width="90" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件批号" prop="lotBatchNo" :min-width="90" width="90" show-overflow-tooltip></el-table-column>
          <el-table-column label="库存数量1" prop="length" :min-width="100" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="库存数量2" prop="qtyStock" :min-width="100" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="绝缘颜色" prop="insulationColor" :min-width="90" width="90" show-overflow-tooltip></el-table-column>
          <el-table-column label="外护颜色" prop="outerColor" :min-width="90" width="90" show-overflow-tooltip></el-table-column>
          <el-table-column label="印字信息" prop="letteringInfo" :min-width="90" width="90" show-overflow-tooltip></el-table-column>
          <el-table-column label="盘号" prop="drumNo" :min-width="90" width="90" show-overflow-tooltip></el-table-column>
          <el-table-column label="库位编号" prop="locationNo" :min-width="90" width="90" show-overflow-tooltip></el-table-column>
          <el-table-column label="库位来源" prop="stockSource" :min-width="90" width="90" show-overflow-tooltip></el-table-column>
          <el-table-column label="备注" prop="remark" :min-width="90" show-overflow-tooltip></el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
    <el-button @click="resetOrderSplitData()" :disabled="confirmSplitOrderLoading">取 消</el-button>
    <el-button type="primary" @click="confirmSplitOrder()" :loading="confirmSplitOrderLoading">确 定</el-button>
  </span>
    </el-dialog>
  </div>
</template>
@@ -186,17 +263,29 @@
  getIfsByFinish,
  getIfsOrder,
  getWarehouseSubmit, inspectionReport, inspectionReportOne, rawAllExport,
  revokeInspectionReport
  revokeInspectionReport,downloadTemplate,confirmSplitOrder
} from '@/api/business/materialInspection'
import limsTable from "@/components/Table/lims-table.vue";
import {transformExcel} from '@/utils/file'
export default {
  name: 'RawMaterialInspection',
  // import 引入的组件需要注入到对象中才能使用
  components: { limsTable, DataLookVisible },
  computed:{
    splitOrderAction(){
      return this.javaApi + '/rawMaterialOrder/importSplitOrderData'
    }
  },
  data() {
    // 这里存放数据
    return {
      confirmSplitOrderLoading: false,
      detailDataLoading: false,
      pushToMes:false,//是否同步到mes
      orderSplitDialogVisible: false,
      orderSplitBasicData:[],//订单拆分主体表格数据
      orderSplitDetailData:[],//订单拆分详情表格数据
      tableData: [],
      tableLoading: false,
      column: [
@@ -236,7 +325,7 @@
          }
        },
        { label: '订单号', prop: 'orderNo' },
        { label: '抵达的采购数量', prop: 'qtyArrived', width: '140px', },
        { label: '抵达的采购数量', prop: 'purQtyInStore', width: '140px', },
        { label: '批号', prop: 'updateBatchNo' },
        { label: '零件号', prop: 'partNo' },
        { label: '零件描述', prop: 'partDesc' },
@@ -345,7 +434,7 @@
          }
        },
        { label: '订单号', prop: 'orderNo' },
        { label: '抵达的采购数量', prop: 'qtyArrived' },
        { label: '抵达的采购数量', prop: 'purQtyInStore' },
        { label: '报检时间', prop: 'declareDate' },
        { label: '批号', prop: 'updateBatchNo' },
        { label: '零件号', prop: 'partNo' },
@@ -452,7 +541,7 @@
        orderNo: '', // 订单号
        partNo: '', // 零件号
        partDesc: '', // 零件描述
        qtyArrived: '', // 抵达的采购数量
        purQtyInStore: '', // 抵达的采购数量
        supplierId: '', // 供应商编号
        supplierName: '', // 供应商名称
        updateBatchNo: '', // 批号
@@ -490,7 +579,7 @@
        partDesc: [
          { required: true, message: '请填写零件描述', trigger: 'blur' }
        ],
        qtyArrived: [
        purQtyInStore: [
          { required: false, message: '请填写抵达的采购数量', trigger: 'blur' }
        ],
        supplierName: [
@@ -537,7 +626,8 @@
        { label: '未下单', value: 3 },
        { label: '让步放行', value: 4 },
      ],
      outLoading: false
      outLoading: false,
      upLoading: false,
    }
  },
  mounted() {
@@ -545,6 +635,85 @@
  },
  // 方法集合
  methods: {
    resetOrderSplitData(){
      this.orderSplitBasicData = []
      this.orderSplitDetailData = []
      this.pushToMes = false
      this.$nextTick(()=>{
        this.confirmSplitOrderLoading = false
        this.orderSplitDialogVisible = false
        this.refreshTable()
      })
    },
    confirmSplitOrder(){
      if(this.orderSplitDetailData.length===0){
        this.$message.error('请先导入拆分数据')
        return
      }
      this.confirmSplitOrderLoading = true
      let requestData = {
        ifsId: this.declareObj.id,
        splitDetailList: this.orderSplitDetailData,
        pushToMes: this.pushToMes
      }
      confirmSplitOrder(requestData).then(res=>{
        if(res.code===200 && res.data){
          this.$message.success('订单拆分成功')
        }else if(this.pushToMes && res.code===200 && !res.data){
          this.$message.success('订单拆分成功,同步MES失败,请联系管理员')
        } else {
          let msg = res.msg || res.message
          this.$message({
            message: '订单拆分失败: '+msg,
            dangerouslyUseHTMLString: true,
            type: 'error'
          });
        }
        this.resetOrderSplitData()
      }).catch(error=>{
        console.error(error)
        this.confirmSplitOrderLoading = false
      })
    },
    handleSuccess(response) {
      if (response.code === 200) {
        this.$message.success('上传成功');
        this.orderSplitDetailData = response.data
      } else {
        let msg = response.msg || response.message
        this.$message({
          message: '上传失败: '+msg,
          dangerouslyUseHTMLString: true,
          type: 'error'
        });
      }
      this.$nextTick(()=>{
        this.upLoading = false;
        this.detailDataLoading = false
      })
    },
    onError(err, file, fileList) {
      this.$message.error('上传失败: '+err)
      this.$refs.upload.clearFiles()
    },
    beforeUpload(file) {
      if (file.size > 1024 * 1024 * 10) {
        this.$message.error('上传文件不超过10M');
        this.$refs.upload.clearFiles()
        return false;
      } else {
        this.upLoading = true;
        this.detailDataLoading = true
        return true;
      }
    },
    downloadTemplate(){
      downloadTemplate().then(res=>{
        transformExcel(res,'订单拆分导入模板.xlsx')
      }).catch(error=>{
        console.error(error)
      })
    },
    // 切换tab表格
    handleTab(m) {
      this.tabIndex = m;
@@ -738,8 +907,21 @@
    // 打开报检确认弹框
    declare(row) {
      this.declareObj = { ...row }
      this.declareDialogVisible = true
      this.declareType = 'edit'
      if(row.updateBatchNo && row.updateBatchNo==='*'){
        this.$confirm('是否要拆分该订单?', '提示', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning'
        }).then(() => {
          this.orderSplitBasicData = [row]
          this.orderSplitDialogVisible = true
        }).catch(() => {
          this.declareDialogVisible = true
        });
      }else{
        this.declareDialogVisible = true
      }
    },
    // 提交报检
    submitDeclare() {
@@ -837,7 +1019,7 @@
        orderNo: '', // 订单号
        partNo: '', // 零件号
        partDesc: '', // 零件描述
        qtyArrived: '', // 抵达的采购数量
        purQtyInStore: '', // 抵达的采购数量
        supplierId: '', // 供应商编号
        supplierName: '', // 供应商名称
        updateBatchNo: '', // 批号