懒羊羊
2023-12-25 8759663d283a103b4578e8f9365cd8818cfa2f3f
工单优化
已修改7个文件
128 ■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/domain/OmProductionOrdeInfo.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/IOmProductionOrdeInfoService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/impl/OmProductionOrdeInfoServiceImpl.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/resources/mapper/om/productionOrde/OmProductionOrdeInfoMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/api/main/om/productionOrde/productionOrde.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/om/productionOrde/index.vue 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java
@@ -101,4 +101,14 @@
    {
        return toAjax(omProductionOrdeInfoService.deleteOmProductionOrdeInfoByIds(ids));
    }
    /**
     * table列上移下移
     */
    @Log(title = "生产工单", businessType = BusinessType.DELETE)
    @GetMapping("/upDownMove")
    public AjaxResult upDownMove(OmProductionOrdeInfo omProductionOrdeInfo)
    {
        return toAjax(omProductionOrdeInfoService.upDownMove(omProductionOrdeInfo));
    }
}
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/domain/OmProductionOrdeInfo.java
@@ -83,6 +83,8 @@
    /** 上线完工标记 */
    private String onlineCompletionMark;
    private Long frontEndId;
    /** 需求日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "需求日期", width = 30, dateFormat = "yyyy-MM-dd")
@@ -156,7 +158,35 @@
    /** 预留字段4 */
    private String spareField4;
    public void setId(Long id)
    private Long[] idNums;
    private String flag;
    public String getFlag() {
        return flag;
    }
    public void setFlag(String flag) {
        this.flag = flag;
    }
    public Long[] getIdNums() {
        return idNums;
    }
    public void setIdNums(Long[] idNums) {
        this.idNums = idNums;
    }
    public Long getFrontEndId() {
        return frontEndId;
    }
    public void setFrontEndId(Long frontEndId) {
        this.frontEndId = frontEndId;
    }
    public void setId(Long id)
    {
        this.id = id;
    }
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/IOmProductionOrdeInfoService.java
@@ -59,4 +59,6 @@
     * @return 结果
     */
    public int deleteOmProductionOrdeInfoById(Long id);
    int upDownMove(OmProductionOrdeInfo omProductionOrdeInfo);
}
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/impl/OmProductionOrdeInfoServiceImpl.java
@@ -1,6 +1,8 @@
package com.jcdm.main.om.productionOrde.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import com.jcdm.common.utils.DateUtils;
import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo;
import com.jcdm.main.om.productionOrde.mapper.OmProductionOrdeInfoMapper;
@@ -19,6 +21,9 @@
{
    @Autowired
    private OmProductionOrdeInfoMapper omProductionOrdeInfoMapper;
    @Autowired
    private IOmProductionOrdeInfoService omProductionOrdeInfoService;
    /**
     * 查询生产工单
@@ -93,4 +98,33 @@
    {
        return omProductionOrdeInfoMapper.deleteOmProductionOrdeInfoById(id);
    }
    @Override
    public int upDownMove(OmProductionOrdeInfo omProductionOrdeInfo) {
        long currentId = omProductionOrdeInfo.getFrontEndId();
        List<OmProductionOrdeInfo> omProductionOrdeInfos = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo);
        List<Long> idList = omProductionOrdeInfos.stream()
                .map(OmProductionOrdeInfo::getId) // 提取id属性
                .collect(Collectors.toList());
        int index = idList.indexOf(currentId);
        long moveId = 0L;
        if(omProductionOrdeInfo.getFlag().equals("up")){
            moveId = idList.get(index - 1);
        }else {
            moveId = idList.get(index + 1);
        }
        OmProductionOrdeInfo  currentInfo = new OmProductionOrdeInfo();
        currentInfo.setId(currentId);
        List<OmProductionOrdeInfo> currentOrdeInfos = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(currentInfo);
        String currentStreamNumber = currentOrdeInfos.get(0).getStreamNumber();
        OmProductionOrdeInfo  moveInfo = new OmProductionOrdeInfo();
        moveInfo.setId(moveId);
        List<OmProductionOrdeInfo> moveOrdeInfos = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(moveInfo);
        String moveStreamNumber = moveOrdeInfos.get(0).getStreamNumber();
        moveOrdeInfos.get(0).setStreamNumber(currentStreamNumber);
        omProductionOrdeInfoService.updateOmProductionOrdeInfo(moveOrdeInfos.get(0));
        currentOrdeInfos.get(0).setStreamNumber(moveStreamNumber);
        omProductionOrdeInfoService.updateOmProductionOrdeInfo(currentOrdeInfos.get(0));
        return 1;
    }
}
jcdm-main/src/main/resources/mapper/om/productionOrde/OmProductionOrdeInfoMapper.xml
@@ -51,7 +51,8 @@
    <select id="selectOmProductionOrdeInfoList" parameterType="OmProductionOrdeInfo" resultMap="OmProductionOrdeInfoResult">
        <include refid="selectOmProductionOrdeInfoVo"/>
        <where>
        <where>
            <if test="id != null  and id != ''"> and id like concat('%', #{id}, '%')</if>
            <if test="workOrderNo != null  and workOrderNo != ''"> and work_order_no like concat('%', #{workOrderNo}, '%')</if>
            <if test="salesOrderCode != null  and salesOrderCode != ''"> and sales_order_code like concat('%', #{salesOrderCode}, '%')</if>
            <if test="productCode != null  and productCode != ''"> and product_code like concat('%', #{productCode}, '%')</if>
@@ -67,6 +68,7 @@
            <if test="softwareVersionCode != null  and softwareVersionCode != ''"> and software_version_code like concat('%', #{softwareVersionCode}, '%')</if>
            <if test="productCompanyCode != null  and productCompanyCode != ''"> and product_company_code like concat('%', #{productCompanyCode}, '%')</if>
        </where>
        ORDER BY stream_number DESC
    </select>
    
    <select id="selectOmProductionOrdeInfoById" parameterType="Long" resultMap="OmProductionOrdeInfoResult">
jcdm-ui/src/api/main/om/productionOrde/productionOrde.js
@@ -9,6 +9,14 @@
  })
}
export function upDownMove(query) {
  return request({
    url: '/om/productionOrde/upDownMove',
    method: 'get',
    params: query
  })
}
// 查询生产工单详细
export function getProductionOrde(id) {
  return request({
jcdm-ui/src/views/main/om/productionOrde/index.vue
@@ -143,7 +143,7 @@
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          icon="el-icon-upload2"
          :disabled="move"
          size="mini"
          @click="moveUp"
@@ -378,7 +378,7 @@
import { listProductBom } from "@/api/main/bs/ProductBom/ProductBom";
import { listTechnologyRoute} from "@/api/main/bs/technologyRoute/technologyRoute";
import ItemSelect  from "@/components/itemSelect/single.vue";
import { listProductionOrde, getProductionOrde, delProductionOrde, addProductionOrde, updateProductionOrde } from "@/api/main/om/productionOrde/productionOrde";
import { upDownMove, listProductionOrde, getProductionOrde, delProductionOrde, addProductionOrde, updateProductionOrde } from "@/api/main/om/productionOrde/productionOrde";
export default {
  name: "ProductionOrde",
@@ -434,6 +434,10 @@
        marketAreaCode: null,
        softwareVersionCode: null,
        productCompanyCode: null,
        frontEndId: 0,
        idNums: null,
        flag: null,
      },
      // 表单参数
      form: {},
@@ -454,11 +458,27 @@
    this.initWorkshop();
  },
  methods: {
    moveUp(){
      this.$modal.msgSuccess("上移");
    moveUp(row){
      const ids = row.id || this.ids
      let str = JSON.stringify(ids);
      let num = BigInt(str.replace(/[\[\]]/g, ''));
      this.queryParams.frontEndId = num
      this.queryParams.idNums = ids
      this.queryParams.flag = 'up'
      upDownMove(this.queryParams).then(response => {
        this.getList();
      });
    },
    down(selection){
      this.$modal.msgSuccess("下移");
    down(row){
      const ids = row.id || this.ids
      let str = JSON.stringify(ids);
      let num = BigInt(str.replace(/[\[\]]/g, ''));
      this.queryParams.frontEndId = num
      this.queryParams.idNums = ids
      this.queryParams.flag = 'down'
      upDownMove(this.queryParams).then(response => {
        this.getList();
      });
    },
    initWorkshop(){
      listWorkshop(this.queryParams).then(response => {
@@ -591,12 +611,6 @@
      // if (selection.length === 1) {
      //   this.move = false;
      // }
      if (selection.length > 0) {
        this.selectedRowIndex = this.productionOrdeList.indexOf(rows[0]); // 获取选中行的索引
      } else {
        this.selectedRowIndex = -1; // 如果没有选中行,则将索引设为-1
      }
    },
    /** 新增按钮操作 */