<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">

      <el-form-item label="物料编码" prop="bomItemCode">
        <el-input v-model="queryParams.bomItemCode" placeholder="请输入BOM物料编码" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="物料名称" prop="bomItemName">
        <el-input v-model="queryParams.bomItemName" placeholder="请输入BOM物料名称" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>


      <el-form-item label="状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择0为作废1为新建2为审核" clearable>
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['md:bom:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['md:bom:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['md:bom:remove']">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['md:bom:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="bomList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="流水号" align="center" prop="bomId" />
      <el-table-column label="主BOM/替代BOM" align="center" prop="bomType" />
      <el-table-column label="BOM物料ID" align="center" prop="bomItemId" />
      <el-table-column label="BOM物料编码" align="center" prop="bomItemCode" />
      <el-table-column label="BOM物料名称" align="center" prop="bomItemName" />
      <el-table-column label="BOM物料规格" align="center" prop="bomItemSpec" />
      <el-table-column label="BOM物料单位" align="center" prop="unitOfMeasure" />
      <el-table-column label="BOM物料单位" align="center" prop="measureName" />
      <el-table-column label="物料单位数量,一般为1" align="center" prop="quantity" />
      <el-table-column label="母件损耗率(小数)" align="center" prop="loss" />
      <el-table-column label="备注" align="center" prop="bomVersion" />
      <el-table-column label="备注" align="center" prop="bomVersionDesc" />
      <el-table-column label="备注" align="center" prop="bomVersionDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.bomVersionDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="bomReplace" />
      <el-table-column label="备注" align="center" prop="bomReplaceDesc" />
      <el-table-column label="审核人员" align="center" prop="auditorUser" />
      <el-table-column label="审核时间" align="center" prop="auditorTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.auditorTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核意见" align="center" prop="auditorMessage" />

      <el-table-column label="status" align="center" prop="status" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['md:bom:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
            v-hasPermi="['md:bom:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 添加或修改BOM管理对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="960px" size="small" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row>
          <el-col span="12">
            <el-form-item label="类型" prop="bomType">
              <el-select v-model="form.bomType" placeholder="请选择主BOM/替代BOM">
                <el-option label="主BOM" value="主BOM" />
                <el-option label="替代BOM" value="替代BOM" />
              </el-select>
            </el-form-item>
          </el-col>

          <el-col span="12">
            <el-form-item label="产品编号" prop="itemCode">
              <el-input v-model="form.bomItemCode" placeholder="请选择产品">
                <el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
              </el-input>
              <ItemSelect ref="itemSelect" @onSelected="onItemSelected"> </ItemSelect>
            </el-form-item>
          </el-col>

        </el-row>


        <el-row>
          <el-col span="12">
            <el-form-item label="物料名称" prop="bomItemName">
              <el-input v-model="form.bomItemName" placeholder="请输入BOM物料名称" />
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item label="物料单位" prop="measureName">
              <el-input v-model="form.measureName" placeholder="请输入BOM物料单位" />
            </el-form-item>
          </el-col>
        </el-row>
 
        <el-row>
          <el-col span="12">
            <el-form-item label="单位数量" prop="quantity">
              <el-input v-model="form.quantity" placeholder="请输入物料单位数量,一般为1" value="1" />
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item label="损耗率(小数)" prop="loss">
              <el-input v-model="form.loss" placeholder="请输入母件损耗率(小数)" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="12">
          <el-form-item label="版本" prop="bomVersion">
          <el-input v-model="form.bomVersion" placeholder="请输入备注" />
        </el-form-item>
      </el-col>
        <el-col span="12">
        <el-form-item label="版本说明" prop="bomVersionDesc">
          <el-input v-model="form.bomVersionDesc" placeholder="请输入备注" />
        </el-form-item>
      </el-col>
        </el-row>



        <el-form-item label="状态">
          <el-radio-group v-model="form.status">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listBom, getBom, delBom, addBom, updateBom } from "@/api/mes/md/bom";
import ItemSelect from "@/components/itemSelect/single.vue";

export default {
  name: "Bom",
  dicts: ['mes_order_status', 'mes_workorder_sourcetype', 'mes_workorder_type'],
  components: {
    ItemSelect
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // BOM管理表格数据
      bomList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        bomType: null, bomItemId: null, bomItemCode: null, bomItemName: null, bomItemSpec: null, unitOfMeasure: null, measureName: null, quantity: null, loss: null, bomVersion: null, bomVersionDesc: null, bomVersionDate: null, bomReplace: null, bomReplaceDesc: null, auditorUser: null, auditorTime: null, auditorMessage: null, attr1: null, attr2: null, attr3: null, attr4: null, attr5: null, attr6: null, attr7: null, attr8: null, attr9: null, attr10: null, attr11: null, attr12: null, attr13: null, attr14: null, attr15: null, status: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        bomType: [
          { required: true, message: "主BOM/替代BOM不能为空", trigger: "change" }
        ], bomItemId: [
          { required: true, message: "BOM物料ID不能为空", trigger: "blur" }
        ], bomItemCode: [
          { required: true, message: "BOM物料编码不能为空", trigger: "blur" }
        ], bomItemName: [
          { required: true, message: "BOM物料名称不能为空", trigger: "blur" }
        ], unitOfMeasure: [
          { required: true, message: "BOM物料单位不能为空", trigger: "blur" }
        ], measureName: [
          { required: true, message: "BOM物料单位不能为空", trigger: "blur" }
        ], quantity: [
          { required: true, message: "物料单位数量,一般为1不能为空", trigger: "blur" }
        ], loss: [
          { required: true, message: "母件损耗率(小数)不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询BOM管理列表 */
    getList() {
      this.loading = true;
      listBom(this.queryParams).then(response => {
        this.bomList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        bomId: null, bomType: null, bomItemId: null, bomItemCode: null, bomItemName: null, bomItemSpec: null, unitOfMeasure: null, measureName: null, quantity: null, loss: null, bomVersion: null, bomVersionDesc: null, bomVersionDate: null, bomReplace: null, bomReplaceDesc: null, auditorUser: null, auditorTime: null, auditorMessage: null, attr1: null, attr2: null, attr3: null, attr4: null, attr5: null, attr6: null, attr7: null, attr8: null, attr9: null, attr10: null, attr11: null, attr12: null, attr13: null, attr14: null, attr15: null, createBy: null, createTime: null, updateBy: null, updateTime: null, status: "0", remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.bomId)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加BOM管理";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const bomId = row.bomId || this.ids
      getBom(bomId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改BOM管理";
      });
    },
    //打开选择料号对话框
    handleSelectProduct() {
      this.$refs.itemSelect.showFlag = true;
    },
    //物料选择弹出框,选择物料时执行
    onItemSelected(obj) {
      console.log("选择料号");
      console.log(obj);
      if (obj != undefined && obj != null) {
        this.form.bomItemId = obj.itemId;
        this.form.bomItemCode = obj.itemCode;
        this.form.bomItemName = obj.itemName;
        this.form.bomItemSpc = obj.specification;
        this.form.unitOfMeasure = obj.unitOfMeasure;
        this.fomr.measureName=obj.measureName;
      }
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.bomId != null) {
            updateBom(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addBom(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const bomIds = row.bomId || this.ids;
      this.$modal.confirm('是否确认删除BOM管理编号为"' + bomIds + '"的数据项?').then(function () {
        return delBom(bomIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('md/bom/export', {
        ...this.queryParams
      }, `bom_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>

<template>
	<view class="container">
		<!-- 显示收料单表头 -->
		<uni-section title="扫码委外收料表身" type="line" class="mb-10">
			<template v-slot:right>
				查询清单
			</template>

			<uni-collapse>
				<uni-collapse-item :title="'委外收料单:'+outreceive.receiveCode+'  状态:'+outreceive.status"
					thumb="/static/images/workorder.png">

					<view class="content">

						<view class="container">
							<uni-list>


								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'location-filled'}" title="ID"
									:rightText="outreceive.receiveId" />


								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="类型"
									:rightText="outreceive.receiveType" />

								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="供应商"
									:rightText="outreceive.vendorCode" />
								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'chat-filled'}" title="供应商名称"
									:rightText="outreceive.vendorName" />


								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'calendar-filled'}" title="开单时间"
									:rightText="outreceive.createTime" />

							</uni-list>


						</view>

					</view>

				</uni-collapse-item>


				<view class="dist-flex">
					<button type="primary" class="uni-btn-small" size="mini"
						@click="openAddOutreceiveLine">增加收料数量</button>
					<button type="primary" class="uni-btn-small" size="mini" @click="openEditOutissueLine"
						v-show="false">修改收料数量</button>
					<button type="primary" class="uni-btn-small" size="mini"
						@click="openQueryOutreceiveLine">查询收料明细</button>
				</view>



			</uni-collapse>
		</uni-section>
		<!-- 显示收料单表头 -->

		<!-- 显示收料单明细 -->
		<uni-section title="查询收料单明细" type="line" class="mb-10" v-show="showQueryOutreceiveLine">
			<template v-slot:right>
			</template>

			<uni-collapse v-for="(value, key, index) in outrececLineList">
				<uni-collapse-item :title="'料号:'+value.productCode+' 良品数:'+value.quantityQualified"
					thumb="/static/images/workorder.png">


					<view class="container">
						<view class="container">
							<uni-list>

								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'location-filled'}" title="ID"
									:rightText="value.receiveLineId" />


								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="委外工单号码"
									:rightText="value.outworkorderCode" />

								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="生产工单号码"
									:rightText="value.workorderCode" />

								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="委外工序"
									:rightText="value.productCode" />

								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="工序名称"
									:rightText="value.productName" />

								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="需求数量"
									:rightText="value.quantityScrot" />

								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="发料数量"
									:rightText="value.quantityIssue" />

								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="收料良品数"
									:rightText="value.quantityQualified" />

								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="收料不良品数"
									:rightText="value.quantityUnquanlified" />

								<uni-list-item showExtraIcon="true" :extraIcon="{type: 'wallet-filled'}" title="收料时间"
									:rightText="value.createTime" />

							</uni-list>
						</view>
					</view>


				</uni-collapse-item>

			</uni-collapse>
		</uni-section>
		<!-- 显示收料单明细 -->
		<!-- 编辑收料单明细 -->
		<view class="content example" v-show="showEditOutreceiveLine">

			<uni-forms ref="form" :model="outreceiveLine" labelWidth="100px">

				<uni-forms-item label="扫码委外发料行码" name="issueCode" label-width="100">

					<view class="dist-flex">
						<uni-easyinput v-model="outreceiveLine.issueCode" placeholder="委外工单号码"></uni-easyinput>
						<uni-icons type="camera-filled" size="30" @click="onH5Scan"></uni-icons>
					</view>

				</uni-forms-item>

				<uni-forms-item label="收料单ID" name="receiveId" labelWidth="100">
					<uni-easyinput disabled v-model="outreceiveLine.receiveId" placeholder="收料单" />
				</uni-forms-item>

				<uni-forms-item label="收料单号" name="receiveCode" labelWidth="100">
					<uni-easyinput disabled v-model="outreceiveLine.receiveCode" placeholder="收料单" />
				</uni-forms-item>

				<uni-forms-item label="发料行ID" name="issueLineId" labelWidth="100">
					<uni-easyinput disabled v-model="outreceiveLine.issueLineId" placeholder="系统自动生成" />
				</uni-forms-item>


				<uni-forms-item label="委外工单" name="outworkorderCode" label-width="100">
					<uni-easyinput disabled v-model="outreceiveLine.outworkorderCode" placeholder="收料数量" />
				</uni-forms-item>

				<uni-forms-item label="生厂工单" name="workorderCode" label-width="100">
					<uni-easyinput disabled v-model="outreceiveLine.workorderCode" placeholder="收料数量" />
				</uni-forms-item>

				<uni-forms-item label="需求数量" name="quantityScrot" labelWidth="100">
					<uni-easyinput disabled v-model="outreceiveLine.quantityScrot" placeholder="需求数量" />
				</uni-forms-item>

				<uni-forms-item label="发料数量" name="quantity" label-width="100">
					<uni-easyinput disabled v-model="outreceiveLine.quantity" placeholder="收料数量" />
				</uni-forms-item>


				<uni-forms-item label="收料良品数" name="quantityQualifiedReceive" label-width="100">
					<uni-easyinput v-model="outreceiveLine.quantityQualifiedReceive" placeholder="收料良品数" />
				</uni-forms-item>

				<uni-forms-item label="收料不良品数" name="quantityUnqualifiedReceive" label-width="100">
					<uni-easyinput v-model="outreceiveLine.quantityUnqualifiedReceive" placeholder="收料不良品数" />
				</uni-forms-item>




			</uni-forms>




			</uni-section>

			<view style="text-align: center;">

				<button type="primary" @click="submitForm" size="mini">保存委外收料单明细</button>

			</view>

		</view>
		<!-- 编辑收料单明细 -->



	</view>
</template>

<script>
	import {
		getUserProfile
	} from "@/api/system/user"
	import {
		updateUserProfile
	} from "@/api/system/user"
	import {
		listWorkorder
	} from "@/api/mes/pro/workorder"
	import {
		listOutworkorder
	} from "@/api/mes/pro/outworkorder"
	import {
		getOutissue,
		addOutissue,
		listOutissue,
		updateOutissue,
		getOutissueByIssueCode
	} from "@/api/mes/pro/outissue.js"
	import {
		getOutissueLine,
		addOutissueLine,
		listOutissueLine,
		updateOutissueLine
	} from "@/api/mes/pro/outissueLine.js"
	import {
		getOutrececive,
		addOutrececive,
		listOutrececive,
		updateOutrececive,
		getOutreceiveByReceiveCode
	} from "@/api/mes/pro/outreceive.js"
	import {
		getOutreceiveLine,
		addOutreceiveLine,
		listOutreceiveLine,
		updateOutreceiveLine
	} from "@/api/mes/pro/outreceiveLine.js"


	import {
		listUser,
		getUser,
		delUser,
		addUser,
		updateUser,
		resetUserPwd,
		changeUserStatus
	} from "@/api/system/user"
	import {
		getJsapiSignature
	} from "@/api/notice/qywx.js"
	import storage from '@/utils/storage'
	import {
		getDicts
	} from "@/api/system/dict/data"
	import {
		listVendor,
		getVendor,
		delVendor,
		addVendor,
		updateVendor
	} from "@/api/mes/md/vendor"
	import {
		genCode
	} from "@/api/system/autocode/rule"
	import {
		listOutworkorderline
	} from "../../../../api/mes/pro/outworkorderline"


	export default {
		dicts: ['mes_order_status'],
		data() {
			return {
				vendorList: [],
				selectVendorCode: null,
				rules: {
					nickName: {
						rules: [{
							required: true,
							errorMessage: '用户昵称不能为空'
						}]
					},
					phonenumber: {
						rules: [{
							required: true,
							errorMessage: '手机号码不能为空'
						}, {
							pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
							errorMessage: '请输入正确的手机号码'
						}]
					},
					email: {
						rules: [{
							required: true,
							errorMessage: '邮箱地址不能为空'
						}, {
							format: 'email',
							errorMessage: '请输入正确的邮箱地址'
						}]
					}
				},
				workorderCodeList: [],
				selectWorkorderCode: null,
				outworkorderCodeList: [],
				selectOutworkorderCode: null,
				outworkorderLineProductList: [],
				outworkorderLineWorkorderList: [],
				outissueCodeList: [],
				outissueLineList: [],
				selectOutissueCode: null,
				selectProductCode: null,
				workorderList: [],
				protaskList: [],
				receiveCode: null,
				outissue: {
					issueId: null,
					issueCode: null,
					issueName: null,
					issueType: null,
					orderSource: null,
					sourceCode: null,
					productId: null,
					productCode: null,
					productName: null,
					productSpc: null,
					unitOfMeasure: null,
					quantity: null,
					quantityProduced: null,
					quantityChanged: null,
					quantityScheduled: null,
					clientId: null,
					clientCode: null,
					clientName: null,
					vendorId: null,
					vendorCode: null,
					vendorName: null,
					requestDate: null,
					parentId: null,
					status: null,
					remark: null,
					createBy: null,
					createTime: null,
					updateBy: null,
					updateTime: null
				},
				outissueline: {
					issueLineId: null,
					issueId: null,
					issueCode: null,
					issueName: null,
					issueType: null,
					outworkorderId: null,
					outwrkorderCode: null,
					outworkorderLineId: null,
					workorderId: null,
					workorderCode: null,
					lineNo: null,
					routeId: null,
					routeCode: null,
					processId: null,
					processCode: null,
					processName: null,
					productId: null,
					productCode: null,
					productName: null,
					productSpc: null,
					unitOfMeasure: null,
					quantity: null,
					quantityProduced: null,
					quantityChanged: null,
					quantityScheduled: null,
					quantityScrot: null,
					clientId: null,
					clientCode: null,
					clientName: null,
					vendorId: null,
					vendorCode: null,
					vendorName: null,
					requestDate: null,
					parentId: null,
					status: null,
					remark: null,
					createBy: null,
					createTime: null,
					updateBy: null,
					updateTime: null
				},
				outissueLineList: [],
				outreceive: {
					receiveId: null,
					receiveCode: null,
					receiveName: null,
					receiveType: null,
					orderSource: null,
					sourceCode: null,
					productId: null,
					productCode: null,
					productName: null,
					productSpc: null,
					unitOfMeasure: null,
					quantity: null,
					quantityProduced: null,
					quantityChanged: null,
					quantityScheduled: null,
					clientId: null,
					clientCode: null,
					clientName: null,
					vendorId: null,
					vendorCode: null,
					vendorName: null,
					requestDate: null,
					parentId: null,
					status: null,
					remark: null,
					createBy: null,
					createTime: null,
					updateBy: null,
					updateTime: null
				},
				outreceiveLine: {
					receiveLineId: null,
					receiveId: null,
					receiveCode: null,
					receiveName: null,
					receiveType: null,
					issueId: null,
					issueCode: null,
					issueName: null,
					issueType: null,
					issueLineId: null,
					outworkorderId: null,
					outwrkorderCode: null,
					outworkorderLineId: null,
					workorderId: null,
					workorderCode: null,
					lineNo: null,
					routeId: null,
					routeCode: null,
					processId: null,
					processCode: null,
					processName: null,
					productId: null,
					productCode: null,
					productName: null,
					productSpc: null,
					unitOfMeasure: null,
					quantity: null,
					quantityProduced: null,
					quantityChanged: null,
					quantityScheduled: null,
					quantityScrot: null,
					quantityIssue: null,
					quantityUnquanlified: null,
					clientId: null,
					clientCode: null,
					clientName: null,
					vendorId: null,
					vendorCode: null,
					vendorName: null,
					requestDate: null,
					parentId: null,
					status: null,
					remark: null,
					createBy: null,
					createTime: null,
					updateBy: null,
					updateTime: null
				},
				outreceiveLineList: [],


				workorderStatus: [],
				// 遮罩层
				loading: true,
				showEditOutworkorderLine: false,
				showQueryOutworkorderLine: false,
				showOutissueLine: false,
				showQueryOutreceiveLine: false,
				showEditOutreceiveLine: false,
				// 查询参数
				queryOutissueParams: {
					issueCode: null,
				},
				queryOutissueLineParams: {
					issueCode: null,
				},
				queryOutreceiveParams: {
					receiveCode: null,
				},
				queryOutreceiveLineParams: {
					receiveCode: null,
				},

				queryOutworkorderLineParams: {
					outworkorderCode: null,
				},
				//卡片相关数据
				cover: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg',
				avatar: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png',
				extraIcon: {
					color: '#4cd964',
					size: '22',
					type: 'gear-filled'
				}

			}
		},
		created() {

		},
		onLoad: function(option) {

			this.receiveCode = JSON.parse(decodeURIComponent(option.item));
			console.log("receiveCode:" + this.receiveCode)
			this.outreceive.receiveCode = this.receiveCode
			this.queryOutreceiveParams.receiveCode = this.receiveCode
			this.queryOutreceiveLineParams.receiveCode = this.receiveCode
			this.queryOutreceive();
			this.queryOutreceiveLineList();
			this.queryListOutworkorder();

			//调用微信扫一扫的配置
			this.getCofig()
		},
		onReady() {
			//设定Form提交的规则
			this.$refs.form.setRules(this.rules)
		},
		methods: {
			/** 提交按钮 保存报工按钮 */
			submitForm() {
				console.log("保存委外收料单开始")
				console.log(this.outissueLineList)
				this.$refs.form.validate().then(res => {


					console.log("收料行数据");
					console.log(this.outreceiveLine);
					addOutreceiveLine(this.outreceiveLine).then(response => {

						//this.showEditOutworkorderLine=false						
						this.$modal.msgSuccess("新增成功:" + this.outreceiveLine.productName);
					});



				});

				console.log("保存委外收料单结束")
			},
			changeOutissue(e) {
				console.log("选择委外发料单号码")
				console.log(e)
				let row = JSON.parse(e)
				console.log(row.issueCode)
				this.showOutissueLine = true


				this.queryOutissueParams.issueCode = row.issueCode;
				this.outworkorderLineProductList = []
				this.outworkorderLineWorkorderList = []

				this.outissueline.productCode = null
				this.outissueline.productName = null
				this.outissueline.quantityScrot = null
				this.outissueline.quantity = null

				this.outworkorderCodeList = []

				listOutissueLine(this.queryOutissueParams).then(response => {

					this.loading = false;
					this.outissueLineList = response.rows;

					for (var i in response.rows) {

						this.outworkorderCodeList.push({
							value: JSON.stringify(response.rows[i]),
							text: response.rows[i].outworkorderCode
						});
					}

				})
				//委外工单发料列表
				console.log(row.outworkorderCodeList)


			},
			changeOutworkorder(e) {
				console.log("选择委外工单号码")
				console.log(e)
				let row = JSON.parse(e)
				console.log(row.outworkorderCode)
				this.queryOutworkorderLineParams.outworkorderCode = row.outworkorderCode;
				this.outworkorderLineProductList = []
				this.outworkorderLineWorkorderList = []

				this.outissueline.productCode = null
				this.outissueline.productName = null
				this.outissueline.quantityScrot = null
				this.outissueline.quantity = null


				listOutworkorderline(this.queryOutworkorderLineParams).then(response => {
					//this.protaskList = response.rows;
					this.loading = false;
					for (var i in response.rows) {
						this.outworkorderLineProductList.push({
							value: JSON.stringify(response.rows[i]),
							text: response.rows[i].productCode + "|" + response.rows[i].productName
						});
						this.outworkorderLineWorkorderList.push({
							value: JSON.stringify(response.rows[i]),
							text: response.rows[i].workorderCode
						});
					}

				})
				//委外工单发料列表
				console.log(row.outworkorderLineProductList)


			},
			changeOutworkorderLineWorkorder(e) {
				console.log("选择委外工单明细的生产工单")
				console.log(e)
				let row = JSON.parse(e)
				console.log(row)

				this.outissueline.processId = row.processId
				this.outissueline.productCode = row.productCode
				this.outissueline.productName = row.productName
				this.outissueline.quantityScrot = row.quantity

				this.outissueline.outworkorderId = row.outworkorderId
				this.outissueline.outworkorderCode = row.outworkorderCode
				this.outissueline.outworkorderLineId = row.outworkorderLineId

				this.outissueline.workorderId = row.workorderId
				this.outissueline.workorderCode = row.workorderCode

				this.outissueline.routeId = row.routeId
				this.outissueline.routeCode = row.routeCode
				this.outissueline.routeName = row.routeName

				this.outissueline.processId = row.processId
				this.outissueline.processCode = row.processCode
				this.outissueline.processName = row.processName


			},
			changeUser(e) {
				console.log("选择审核人")
				console.log(e)
				let row = JSON.parse(e)
				console.log(row.userName)
				this.feedback.recordUser = row.userName
				this.feedback.recordNick = row.nickNamethis.outissueline.outworkorderId = row.outworkorderId
				this.loading = true
				getOutissueByreceiveCode(this.receiveCode).then(response => {
					this.loading = false;
					console.log("委外收料单表头");
					console.log(response.data);
					this.outissue = response.data;
					this.outissueline.issueId = response.data.issueId;
					this.outissueline.receiveCode = response.data.receiveCode;

				});
			},
			queryOutreceive() {
				this.loading = true
				getOutreceiveByReceiveCode(this.receiveCode).then(response => {
					this.loading = false;
					console.log("委外收料单表头");
					console.log(response.data);
					this.outreceive = response.data;
				});
			},
			queryOutreceiveLineList() {
				this.loading = true
				listOutreceiveLine(this.queryOutreceiveLineParams).then(response => {
					this.loading = false;
					console.log("委外收料单明细");
					console.log(response.rows);
					this.outrececLineList = response.rows;

				});
			},
			queryListOutissue() {
				console.log("查询委外发料单-可发料范围")
				listOutissue().then(response => {
					this.loading = false;
					for (var i in response.rows) {
						this.outissueCodeList.push({
							value: JSON.stringify(response.rows[i]),
							text: response.rows[i].issueCode
						});
					}

				});
				console.log(this.outissueCodeList);
				console.log("查询委外发料单-可发料范围")
			},
			queryListOutworkorder() {
				console.log("查询委外工单清单-可发料范围")
				listOutworkorder().then(response => {
					this.loading = false;
					for (var i in response.rows) {
						this.outworkorderCodeList.push({
							value: JSON.stringify(response.rows[i]),
							text: response.rows[i].outworkorderCode
						});
					}

				});
				console.log(this.outworkorderCodeList);
				console.log("查询委外工单清单-可发料范围")
			},
			getListProTask() {
				console.log("查询排产任务开始")
				listProtask(this.queryProTaskParams).then(response => {
					//this.protaskList = response.rows;
					this.loading = false;
					for (var i in response.rows) {
						this.protaskList.push({
							value: JSON.stringify(response.rows[i]),
							text: response.rows[i].taskCode + "|" + response.rows[i].workstationName
						});
					}

				});

				console.log(this.protaskList);
				console.log("查询排产任务结束")
			},
			openAddOutreceiveLine() {
				//this.$refs.showRight.open();
				//this.$tab.navigateTo('/pages/mes/pro/workorder/saveowoissueline?item=' + encodeURIComponent(JSON.stringify(this
				//	.outissue)));
				this.showEditOutreceiveLine = true;
				this.showQueryOutreceiveLine = false;
				//查询发料单可发料列表
				//this.queryListOutissue();

			},
			openQueryOutreceiveLine() {
				console.log("查询委外工单收料明细")

				this.showQueryOutreceiveLine = true;
				this.showEditOutreceiveLine = false;

				this.queryOutreceiveLineList();
			},

			closeDrawer() {
				this.$refs.showRight.close();
			},

			//微信扫描save
			onH5Scan() {
				//如果有调用相关的内容,要使用that的这个常量
				const that = this;
				console.log('onH5Scan进来了');
				this.$wx.scanQRCode({
					needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
					scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
					success: function(res) {
						//alert(JSON.stringify(res))  //测试使用
						var result = res.resultStr; // 当 needResult 为 1 时,扫码返回的结果
						var resultArr = result.split(',') // 扫描结果以逗号分割数组
						var codeContent = resultArr[resultArr.length - 1] // 获取数组最后一个元素,也就是最终的内容
						扫描结果赋值
						console.log('onH5Scan——success');
						console.log("onH5Scan" + result + "===" + resultArr + "===" + codeContent);

						var str = codeContent.trim();

						var array = str.split('^');
						alert(array);
						
						that.outreceiveLine.receiveId=that.outreceive.receiveId
						that.outreceiveLine.receiveCode=that.outreceive.receiveCode

						that.outreceiveLine.issueLineId = parseInt(array[0])
						that.outreceiveLine.issueId = parseInt(array[1])
						that.outreceiveLine.issueCode = array[2]


						that.outreceiveLine.outworkorderLineId = parseInt(array[3])
						that.outreceiveLine.outworkorderId = parseInt(array[4])
						that.outreceiveLine.outworkorderCode = array[5]


						that.outreceiveLine.workorderId = parseInt(array[6])
						that.outreceiveLine.workorderCode = array[7]


						that.outreceiveLine.productId = parseInt(array[8])
						that.outreceiveLine.productCode = array[9]
						that.outreceiveLine.productName = array[10]


						that.outreceiveLine.routeId = parseInt(array[11])
						that.outreceiveLine.routeCode = array[12]
						//that.outissueline.routeName = array[13]

						that.outreceiveLine.processId = parseInt(array[14])
						that.outreceiveLine.processCode = array[15]
						that.outreceiveLine.processName = array[16]

						that.outreceiveLine.quantityScrot = parseFloat(array[17])
						that.outreceiveLine.quantity = array[18]




					},
					fail: function(response) {
						if (res.errMsg.indexOf('function_not_exist') > 0) {
							console.log('onH5Scan版本过低请升级');
						}
						uni.showToast({
							icon: "none",
							title: "onH5Scan——调用扫码失败" + response.errMsg
						})
					},
				});
			},
			// 配置信息
			getCofig() {

				const that = this;
				let url = window.location.href.split('#')[0];
				let params = {
					'url': url
				}
				getJsapiSignature(params).then(res => {
					const result = res;

					if (res) {
						that.wxConfig(
							result.appId,
							result.timestamp,
							result.nonceStr,
							result.signature
						);
					} else {
						alert('获取配置信息返回为空');
					}
				})
			},
			//wx.config的配置
			wxConfig(appId, timestamp, nonceStr, signature) {
				this.$wx.config({
					debug: false, // 开启调试模式,
					appId: appId, // 必填,企业号的唯一标识
					timestamp: timestamp, // 必填,生成签名的时间戳
					nonceStr: nonceStr, // 必填,生成签名的随机串
					signature: signature, // 必填,签名
					jsApiList: [
						'chooseImage',
						'previewImage',
						'uploadImage',
						'downloadImage',
						'scanQRCode',
						'checkJsApi'
					], // 必填,需要使用的JS接口列表
				});


				this.$wx.ready(() => {
					this.$wx.checkJsApi({ //判断当前客户端版本是否支持指定JS接口
						jsApiList: [
							'chooseImage',
							'previewImage',
							'uploadImage',
							'downloadImage',
							'scanQRCode',
						],
						success: function(
							res
						) { // 以键值对的形式返回,可用true,不可用false。如:{"checkResult":{"scanQRCode":true},"errMsg":"checkJsApi:ok"}
							//alert(res)
							//取消配置提示框
							this.$modal.msgSuccess(res.checkResult)
							if (res.checkResult.scanQRCode != true) {
								this.$modal.msgSuccess('抱歉,当前客户端版本不支持扫一扫')
							}

						},
						fail: function(res) { //检测getNetworkType该功能失败时处理
							this.$modal.msgSuccess(res)
							alert('checkJsApi error');
						}
					});

					console.log("wxConfig配置完成,扫码前准备完成");
					//this.$modal.msgSuccess("wxConfig配置完成,扫码前准备完成")
				})
				this.$wx.error(function(res) {
					this.$modal.msgSuccess('wxConfig出错了:' + res.errMsg)
					console.log('wxConfig出错了:' + res.errMsg);
					//wx.config配置错误,会弹出窗口哪里错误,然后根据微信文档查询即可。
				});
			},

		}
	}
</script>

<style lang="scss">
	page {
		background-color: #ffffff;
	}

	.example {
		padding: 15px;
		background-color: #ffffff;
	}

	.segmented-control {
		margin-bottom: 15px;
	}

	.button-group {
		margin-top: 15px;
		display: flex;
		justify-content: space-around;
	}

	.form-item {
		display: flex;
		align-items: center;
		flex: 1;
	}

	.button {
		display: flex;
		align-items: center;
		height: 35px;
		line-height: 35px;
		margin-left: 10px;
	}

	.dist-flex {
		display: flex !important;
	}

	/*卡片格式*/
	.container {
		overflow: hidden;
	}

	.custom-cover {
		flex: 1;
		flex-direction: row;
		position: relative;
	}

	.cover-content {
		position: absolute;
		bottom: 0;
		left: 0;
		right: 0;
		height: 40px;
		background-color: rgba($color: #000000, $alpha: 0.4);
		display: flex;
		flex-direction: row;
		align-items: center;
		padding-left: 15px;
		font-size: 14px;
		color: #fff;
	}

	.card-actions {
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		align-items: center;
		height: 45px;
		border-top: 1px #eee solid;
	}

	.card-actions-item {
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.card-actions-item-text {
		font-size: 12px;
		color: #666;
		margin-left: 5px;
	}

	.cover-image {
		flex: 1;
		height: 150px;
	}

	.no-border {
		border-width: 0;
	}
</style>
ALTER TABLE ryvue_mes.pro_task ADD first_flag INT NULL COMMENT '首道工序(0否/1是)';
ALTER TABLE ryvue_mes.pro_task ADD last_flag INT NULL COMMENT '末道工序(0否/1是)';
ALTER TABLE ryvue_mes.pro_task ADD bf_flag INT NULL COMMENT 'BFFlag 倒冲工序(0否/1是)';
ALTER TABLE ryvue_mes.pro_task ADD report_flag INT NULL COMMENT 'ReportFlag 报告点 (0否/1是)';
ALTER TABLE ryvue_mes.pro_task ADD fee_flag INT NULL COMMENT 'FeeFlag 计费点(0否/1是)';
ALTER TABLE ryvue_mes.pro_task ADD delivery_days DECIMAL NULL COMMENT 'DeliveryDays 交货天数';

 

/*收货单相关资料*/
ALTER TABLE weishui_mes_qas.wm_item_recpt ADD delivery_code varchar(100) NULL COMMENT '送货单';
ALTER TABLE weishui_mes_qas.wm_item_recpt ADD express_type varchar(100) NULL COMMENT '快递单类别';
ALTER TABLE weishui_mes_qas.wm_item_recpt ADD express_code varchar(100) NULL COMMENT '快递单号';
ALTER TABLE weishui_mes_qas.wm_item_recpt ADD express_company varchar(100) NULL COMMENT '快递公司';
ALTER TABLE weishui_mes_qas.wm_item_recpt ADD express_telephone varchar(100) NULL COMMENT '快递电话';
ALTER TABLE weishui_mes_qas.wm_item_recpt ADD express_person varchar(100) NULL COMMENT '快递人员';
ALTER TABLE weishui_mes_qas.wm_item_recpt ADD delivery_time varchar(100) NULL COMMENT '送货时间';
ALTER TABLE weishui_mes_qas.wm_item_recpt ADD delivery_person varchar(100) NULL COMMENT '送货人员';
ALTER TABLE weishui_mes_qas.wm_item_recpt ADD delivery_telephone varchar(100) NULL COMMENT '送货电话';
字典注解的地方
import Vue from 'vue'
import App from './App'
import wx from 'weixin-js-sdk'
import store from './store' // store
import plugins from './plugins' // plugins
import './permission' // permission
//字典
import { getDicts } from "@/api/system/dict/data"
// 字典标签组件
import DictTag from '@/components/DictTag'
// 字典数据组件
import DictData from '@/components/DictData'

Vue.use(plugins)
//安装字典
DictData.install()

Vue.config.productionTip = false
Vue.prototype.$store = store
Vue.prototype.getDicts = getDicts
//全局注册字典
Vue.component('DictTag', DictTag)


App.mpType = 'app'

const app = new Vue({
  ...App
})

app.$mount()
2  在D:\ideaProject\RuoYi-App-master\components目录,添加从前端的项目复制DictData,DictTag两个目录的全部文件
3在D:\ideaProject\RuoYi-App-master\utils目录,添加从前端的项目复制utils的文件,存在的文件就跳过
4 在组件文件中直接使用<dict-tag

4.1 定义字典的内容

dicts: ['mes_order_status','mes_workorder_sourcetype','mes_workorder_type'],

dict-tag标签的语法,vaule属性可以使用变量

<dict-tag :options="dict.type.mes_order_status" value="CONFIRMED" />
<template>
	<view class="normal-login-container">
		<view class="logo-content align-center justify-center flex">
			<image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
			</image>
			<text class="title">若依移动端登录</text>
			<view>
				 
					<dict-tag :options="dict.type.mes_order_status" value="CONFIRMED" />
			 
			</view>
		</view>
		<view class="login-form-content">
			<view class="input-item flex align-center">
				<view class="iconfont icon-user icon"></view>
				<input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
			</view>
			<view class="input-item flex align-center">
				<view class="iconfont icon-password icon"></view>
				<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
			</view>
			<view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">
				<view class="iconfont icon-code icon"></view>
				<input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
				<view class="login-code">
					<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
				</view>
			</view>
			<view class="action-btn">
				<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
			</view>
			<view class="reg text-center" v-if="register">
				<text class="text-grey1">没有账号?</text>
				<text @click="handleUserRegister" class="text-blue">立即注册</text>
			</view>
			<view class="xieyi text-center">
				<text class="text-grey1">登录即代表同意</text>
				<text @click="handleUserAgrement" class="text-blue">《用户协议》</text>
				<text @click="handlePrivacy" class="text-blue">《隐私协议》</text>
			</view>

		</view>
	</view>
</template>

<script>
	import {
		getCodeImg
	} from '@/api/login'

	export default {
		dicts: ['mes_order_status','mes_workorder_sourcetype','mes_workorder_type'],
		data() {
			return {
				codeUrl: "",
				captchaEnabled: true,
				// 用户注册开关
				register: false,
				globalConfig: getApp().globalData.config,
				loginForm: {
					username: "admin",
					password: "admin123",
					code: "",
					uuid: ''
				}
			}
		},
		created() {
			this.getCode()
		},
		methods: {
			// 用户注册
			handleUserRegister() {
				this.$tab.redirectTo(`/pages/register`)
			},
			// 隐私协议
			handlePrivacy() {
				let site = this.globalConfig.appInfo.agreements[0]
				this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
			},
			// 用户协议
			handleUserAgrement() {
				let site = this.globalConfig.appInfo.agreements[1]
				this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
			},
			// 获取图形验证码
			getCode() {
				getCodeImg().then(res => {
					this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
					if (this.captchaEnabled) {
						this.codeUrl = 'data:image/gif;base64,' + res.img
						this.loginForm.uuid = res.uuid
					}
				})
			},
			// 登录方法
			async handleLogin() {
				if (this.loginForm.username === "") {
					this.$modal.msgError("请输入您的账号")
				} else if (this.loginForm.password === "") {
					this.$modal.msgError("请输入您的密码")
				} else if (this.loginForm.code === "" && this.captchaEnabled) {
					this.$modal.msgError("请输入验证码")
				} else {
					this.$modal.loading("登录中,请耐心等待...")
					this.pwdLogin()
				}
			},
			// 密码登录
			async pwdLogin() {
				this.$store.dispatch('Login', this.loginForm).then(() => {
					this.$modal.closeLoading()
					this.loginSuccess()
				}).catch(() => {
					if (this.captchaEnabled) {
						this.getCode()
					}
				})
			},
			// 登录成功后,处理函数
			loginSuccess(result) {
				// 设置用户信息
				this.$store.dispatch('GetInfo').then(res => {
					this.$tab.reLaunch('/pages/index')
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #ffffff;
	}

	.normal-login-container {
		width: 100%;

		.logo-content {
			width: 100%;
			font-size: 21px;
			text-align: center;
			padding-top: 15%;

			image {
				border-radius: 4px;
			}

			.title {
				margin-left: 10px;
			}
		}

		.login-form-content {
			text-align: center;
			margin: 20px auto;
			margin-top: 15%;
			width: 80%;

			.input-item {
				margin: 20px auto;
				background-color: #f5f6f7;
				height: 45px;
				border-radius: 20px;

				.icon {
					font-size: 38rpx;
					margin-left: 10px;
					color: #999;
				}

				.input {
					width: 100%;
					font-size: 14px;
					line-height: 20px;
					text-align: left;
					padding-left: 15px;
				}

			}

			.login-btn {
				margin-top: 40px;
				height: 45px;
			}

			.reg {
				margin-top: 15px;
			}

			.xieyi {
				color: #333;
				margin-top: 20px;
			}

			.login-code {
				height: 38px;
				float: right;

				.login-code-img {
					height: 38px;
					position: absolute;
					margin-left: 10px;
					width: 200rpx;
				}
			}
		}
	}
</style>

1 为表添加数据同步相关的信息 

ALTER TABLE ryvue_mes.out_workorder ADD sync_id varchar(100) NULL COMMENT '同步ID(接名名称或AP名行或JOB名称等)';
ALTER TABLE ryvue_mes.out_workorder ADD sync_status INT NULL COMMENT '同步状态(0成功1失败2执行3重传)';
ALTER TABLE ryvue_mes.out_workorder ADD sync_time DATETIME NULL COMMENT '同步完成时间';
ALTER TABLE ryvue_mes.out_workorder ADD sync_qty INT NULL COMMENT '同步记录数';
ALTER TABLE ryvue_mes.out_workorder ADD sync_message varchar(100) NULL COMMENT '同步消息';
ALTER TABLE ryvue_mes.pro_route ADD run_card_flag INT NULL COMMENT '启用流转卡 (0否1是)';
ALTER TABLE ryvue_mes.pro_route ADD aux_unit_code varchar(100) NULL COMMENT '辅助计量单位';
ALTER TABLE ryvue_mes.pro_route ADD runcard_batch_qty DECIMAL NULL COMMENT '流转卡批量数据';
ALTER TABLE ryvue_mes.pro_route ADD route_tyype INT NULL COMMENT 'RountingType 类型(1-主要/2-替代)  ';
ALTER TABLE ryvue_mes.pro_route ADD route_version varchar(100) NULL COMMENT '版本';
ALTER TABLE ryvue_mes.pro_route ADD version_desc varchar(100) NULL COMMENT '版本说明';
ALTER TABLE ryvue_mes.pro_route ADD version_start_date DATE NULL COMMENT '版本生效日期';
ALTER TABLE ryvue_mes.pro_route ADD version_end_date DATE NULL COMMENT '版本结束日期';
ALTER TABLE ryvue_mes.pro_route ADD ident_code varchar(100) NULL COMMENT '替代标识';
ALTER TABLE ryvue_mes.pro_route ADD ident_desc varchar(100) NULL COMMENT '替代说明';
ALTER TABLE ryvue_mes.pro_route ADD auditor_user varchar(100) NULL COMMENT '审核人员';
ALTER TABLE ryvue_mes.pro_route ADD auditor_time DATETIME NULL;
ALTER TABLE ryvue_mes.pro_route ADD close_user varchar(100) NULL COMMENT '关闭人员';
ALTER TABLE ryvue_mes.pro_route ADD close_time varchar(100) NULL;
ALTER TABLE ryvue_mes.pro_route ADD change_rate DECIMAL NULL COMMENT '换算率';
ALTER TABLE ryvue_mes.pro_route ADD update_count varchar(100) NULL COMMENT '修改次数';
ALTER TABLE ryvue_mes.pro_route ADD print_count varchar(100) NULL COMMENT '打印次数';
<select id="checkFirstProTask" parameterType="ProTask" resultMap="ProTaskResult">
        <include refid="selectProTaskVo"/>
        <where>
            <if test="workorderCode != null  and workorderCode != ''"> and t.workorder_code = #{workorderCode}</if>
            <if test="processCode != null"> and t.process_code = #{processCode} </if>
            <if test="workorderCode != null  and workorderCode != ''"> and (workorder_code,process_order_num)  in (select workorder_code,min(process_order_num) from  ryvue_mes.pro_task  where workorder_code =#{workorderCode} ) </if>

        </where>
    </select>

    <select id="checkLastProTask" parameterType="ProTask" resultMap="ProTaskResult">
        <include refid="selectProTaskVo"/>
        <where>
            <if test="workorderCode != null  and workorderCode != ''"> and t.workorder_code = #{workorderCode}</if>
            <if test="processCode != null"> and t.process_code = #{processCode} </if>
            <if test="workorderCode != null  and workorderCode != ''"> and (workorder_code,process_order_num)  in (select workorder_code,min(process_order_num) from  pro_task  where workorder_code =#{workorderCode} ) </if>
        </where>
    </select>


    <select id="queryPreviousProTask" parameterType="ProTask" resultMap="ProTaskResult">
        <include refid="selectProTaskVo"/>
        <where>
            <if test="workorderCode != null  and workorderCode != ''"> and t.workorder_code = #{workorderCode}</if>
            <if test="workorderCode != null  and workorderCode != '' and  processCode != null  "> and process_order_num  < (select  min(process_order_num) from  pro_task  where workorder_code =#{workorderCode}  and process_code = #{processCode} ) </if>
        </where>
        order by process_order_num desc  limit 1
    </select>
    
    <select id="queryNextProTask" parameterType="ProTask" resultMap="ProTaskResult">
        <include refid="selectProTaskVo"/>
        <where>
            <if test="workorderCode != null  and workorderCode != ''"> and t.workorder_code = #{workorderCode}</if>
            <if test="workorderCode != null  and workorderCode != '' and  processCode != null  "> and process_order_num  > (select  min(process_order_num) from  pro_task  where workorder_code =#{workorderCode}  and process_code = #{processCode} ) </if>
        </where>
        order by process_order_num    limit 1
    </select>

若依启动时是如何将字典初始进redis中的_ico