Prechádzať zdrojové kódy

Merge branch 'master' of http://62.234.61.92:3000/wjm/mec-cloud_IntelligentManufacturing_CLIENT

lph 1 rok pred
rodič
commit
7a8ccca912
52 zmenil súbory, kde vykonal 4253 pridanie a 35 odobranie
  1. 159 0
      zkqy-admin/src/main/java/com/zkqy/web/controller/homepagestatistics/StatisticsController.java
  2. 2 2
      zkqy-admin/src/main/resources/application.yml
  3. 9 0
      zkqy-business/src/main/java/com/zkqy/business/controller/CommonController.java
  4. 73 0
      zkqy-business/src/main/java/com/zkqy/business/entity/vo/CommonTableOperationVO.java
  5. 71 0
      zkqy-business/src/main/java/com/zkqy/business/mapper/MysqlTableOperationMapper.java
  6. 36 0
      zkqy-business/src/main/java/com/zkqy/business/service/IMysqlTableOperationService.java
  7. 38 0
      zkqy-business/src/main/java/com/zkqy/business/service/impl/MysqlTableOperationServiceImpl.java
  8. 76 0
      zkqy-business/src/main/resources/mapper/dragmapper/MysqlTableOperationMapper.xml
  9. 22 0
      zkqy-common/src/main/java/com/zkqy/common/constant/DataSourceType.java
  10. 108 0
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/MaterialInventoryController.java
  11. 9 0
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductInvoiceController.java
  12. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleOrderController.java
  13. 9 0
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleProductsController.java
  14. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductCodeList.java
  15. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductHandsetOutboundRecord.java
  16. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductInventory.java
  17. 10 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductInvoice.java
  18. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductOutboundRecord.java
  19. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductWarehousingRecord.java
  20. 10 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleOrder.java
  21. 3 3
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleProducts.java
  22. 22 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductCodeListVO.java
  23. 2 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductInvoiceVO.java
  24. 12 1
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/SaleOrderVO.java
  25. 69 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/SaleProductsVo.java
  26. 6 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleOrderMapper.java
  27. 7 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleProductsMapper.java
  28. 16 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IMaterialInventoryService.java
  29. 8 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleOrderService.java
  30. 7 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleProductsService.java
  31. 148 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/MaterialInventoryServiceImpl.java
  32. 12 2
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductHandsetOutboundRecordServiceImpl.java
  33. 19 4
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInventoryServiceImpl.java
  34. 9 1
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInvoiceServiceImpl.java
  35. 21 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleOrderServiceImpl.java
  36. 5 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleProductsServiceImpl.java
  37. 11 4
      zkqy-custom-business/src/main/resources/mapper/business/ProductCodeListMapper.xml
  38. 5 1
      zkqy-custom-business/src/main/resources/mapper/business/ProductHandsetOutboundRecordMapper.xml
  39. 5 1
      zkqy-custom-business/src/main/resources/mapper/business/ProductInventoryMapper.xml
  40. 8 3
      zkqy-custom-business/src/main/resources/mapper/business/ProductInvoiceMapper.xml
  41. 7 2
      zkqy-custom-business/src/main/resources/mapper/business/ProductOutboundRecordMapper.xml
  42. 7 2
      zkqy-custom-business/src/main/resources/mapper/business/ProductWarehousingRecordMapper.xml
  43. 33 2
      zkqy-custom-business/src/main/resources/mapper/business/SaleOrderMapper.xml
  44. 21 2
      zkqy-custom-business/src/main/resources/mapper/business/SaleProductsMapper.xml
  45. 1 1
      zkqy-system/src/main/java/com/zkqy/system/mapper/SysLogininforMapper.java
  46. 47 0
      zkqy-ui/src/router/index.js
  47. 3 4
      zkqy-ui/src/views/orderMange/planTable/index.vue
  48. 645 0
      zkqy-ui/src/views/orderMange/planTable/show/fangsi.vue
  49. 663 0
      zkqy-ui/src/views/orderMange/planTable/show/fankuang.vue
  50. 660 0
      zkqy-ui/src/views/orderMange/planTable/show/luotong.vue
  51. 536 0
      zkqy-ui/src/views/orderMange/planTable/show/northWorkshop.vue
  52. 537 0
      zkqy-ui/src/views/orderMange/planTable/show/southWorkshop.vue

+ 159 - 0
zkqy-admin/src/main/java/com/zkqy/web/controller/homepagestatistics/StatisticsController.java

@@ -0,0 +1,159 @@
+package com.zkqy.web.controller.homepagestatistics;
+
+import com.zkqy.business.entity.DragForm;
+import com.zkqy.business.entity.DragTable;
+import com.zkqy.business.entity.DragTableGroup;
+import com.zkqy.business.entity.vo.CommonTableOperationVO;
+import com.zkqy.business.service.impl.DragFormServiceImpl;
+import com.zkqy.business.service.impl.DragTableGroupServiceImpl;
+import com.zkqy.business.service.impl.DragTableServiceImpl;
+import com.zkqy.business.service.impl.MysqlTableOperationServiceImpl;
+import com.zkqy.common.constant.DataSourceType;
+import com.zkqy.common.core.domain.AjaxResult;
+import com.zkqy.common.utils.SecurityUtils;
+import com.zkqy.execution.produce.dispersed.service.impl.BpmProcessServiceImpl;
+import com.zkqy.system.domain.SysLogininfor;
+import com.zkqy.system.service.ISysOperLogService;
+import com.zkqy.system.service.impl.SysLogininforServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/statistics/info")
+public class StatisticsController {
+
+     @Autowired
+     BpmProcessServiceImpl bpmProcessService;
+
+    @Autowired
+    private ISysOperLogService operLogService;
+
+    @Autowired
+    private SysLogininforServiceImpl logininforService;
+
+    @Autowired
+    DragTableServiceImpl dragTableService;
+
+    @Autowired
+    DragFormServiceImpl dragFormService;
+
+    @Autowired
+    MysqlTableOperationServiceImpl mysqlTableOperationService;
+
+    @Autowired
+    DragTableGroupServiceImpl dragTableGroupService;
+
+    /**
+     * 流程信息统计
+     * @return
+     */
+    @GetMapping("/getProcessInformation")
+     public AjaxResult getProcessInformation(){
+          List<Map> bpmProcesses = bpmProcessService.selectBpmProcessStatistics();
+          return AjaxResult.success(bpmProcesses);
+     }
+
+    /**
+     * 操作日志信息统计
+     * Operation information statistics
+     */
+    @GetMapping("/getOperationInformationStatistics")
+    public AjaxResult getOperationInformationStatistics(){
+        Long tenantId = SecurityUtils.getLoginUser().getTenantId();
+        List<Map> list = operLogService.selectOperationInformationStatistics(tenantId);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 操作日志信息统计
+     * Operation information statistics
+     */
+    @GetMapping("/getLoginInformationStatistics")
+    public AjaxResult getLoginInformationStatistics(){
+        SysLogininfor sysLogininfor=new SysLogininfor();
+        sysLogininfor.setTenantId( SecurityUtils.getLoginUser().getTenantId());
+        sysLogininfor.setWhichApplication("1");
+        List<Map> loginInformationStatistics = logininforService.getLoginInformationStatistics(sysLogininfor);
+
+        SysLogininfor sysLogininfor2=new SysLogininfor();
+        sysLogininfor2.setTenantId( SecurityUtils.getLoginUser().getTenantId());
+        sysLogininfor2.setWhichApplication("2");
+        List<Map> loginInformationStatistics1 = logininforService.getLoginInformationStatistics(sysLogininfor2);
+        List<Map> list = new ArrayList<>();
+        HashMap hashMap1=new HashMap();
+        hashMap1.put("name","客户端");
+        hashMap1.put("type","line");
+        hashMap1.put("smooth","true");
+        hashMap1.put("data",loginInformationStatistics.stream().map((item->item.get("dailyLoginCount"))).collect(Collectors.toList()));
+        hashMap1.put("date",loginInformationStatistics.stream().map((item->item.get("loginDate"))).collect(Collectors.toList()));
+        list.add(hashMap1);
+        HashMap hashMap2=new HashMap();
+        hashMap2.put("name","工具端");
+        hashMap2.put("type","line");
+        hashMap2.put("smooth","true");
+        hashMap2.put("data",loginInformationStatistics1.stream().map((item->item.get("dailyLoginCount"))).collect(Collectors.toList()));
+        hashMap2.put("date",loginInformationStatistics.stream().map((item->item.get("loginDate"))).collect(Collectors.toList()));
+        list.add(hashMap2);
+        return AjaxResult.success(list);
+    }
+
+
+    /**
+     * 数据建模统计
+     * DataModelingStatistics
+     */
+    @GetMapping("/getDataModelingStatistics")
+    public AjaxResult getDataModelingStatistics(){
+        String databaseType = SecurityUtils.getDatabaseType();
+        if (databaseType.equals(DataSourceType.MYSQL.getDataSourceName())) {
+            CommonTableOperationVO vo =new CommonTableOperationVO();
+            vo.setDatabaseName(SecurityUtils.getDatabaseName());
+            return   AjaxResult.success(mysqlTableOperationService.selectTableList(vo).size());
+        }
+        return AjaxResult.success(0);
+    }
+
+    /**
+     * 表单表格统计
+     * DataModelingStatistics
+     */
+    @GetMapping("/getTabularStatistics")
+    public AjaxResult getTabularStatistics(){
+        //表单
+        DragForm  dragForm =new DragForm();
+        int dragFormsCount = dragFormService.selectDragFormListCount(dragForm);
+        //表格
+        DragTable dragTable =new DragTable();
+        int dragTablesCount = dragTableService.selectDragTableListCount(dragTable);
+        //三级联动
+        DragTableGroup dragTableGroup =new DragTableGroup();
+        int dragTableGroupsCount = dragTableGroupService.selectDragTableGroupListCount(dragTableGroup);
+
+        List<Map> list=new ArrayList<>();
+        HashMap dragFormsMap=new HashMap();
+        dragFormsMap.put("name","表单");
+        dragFormsMap.put("value",dragFormsCount);
+        list.add(dragFormsMap);
+
+        HashMap dragTableSMap=new HashMap();
+        dragTableSMap.put("name","表格");
+        dragTableSMap.put("value",dragTablesCount);
+        list.add(dragTableSMap);
+
+        HashMap dragTableGroupsSMap=new HashMap();
+        dragTableGroupsSMap.put("name","三级联动");
+        dragTableGroupsSMap.put("value",dragTableGroupsCount);
+        list.add(dragTableGroupsSMap);
+
+        return AjaxResult.success(list);
+    }
+
+}

+ 2 - 2
zkqy-admin/src/main/resources/application.yml

@@ -105,8 +105,8 @@ token:
   header: Authorization
   # 令牌密钥
   secret: abcdefghijklmnopqrstuvwxyz
-  # 令牌有效期(默认30分钟)
-  expireTime: 3000000
+  # 令牌有效期(默认30分钟)3000000
+  expireTime: 144000000
 
 # MyBatis配置
 mybatis:

+ 9 - 0
zkqy-business/src/main/java/com/zkqy/business/controller/CommonController.java

@@ -182,4 +182,13 @@ public class CommonController extends BaseController {
     public AjaxResult dragGroupTableInfo(CommonEntity commonEntity) {
         return   AjaxResult.success(dragTableGroupService.selectDragTableGroup(commonEntity.getQueryMap().get("groupKey").toString()));
     }
+
+    /**
+     * 刷新token
+     */
+    @GetMapping("/refreshToken")
+    public AjaxResult refreshToken() {
+        return success();
+    }
+
 }

+ 73 - 0
zkqy-business/src/main/java/com/zkqy/business/entity/vo/CommonTableOperationVO.java

@@ -0,0 +1,73 @@
+package com.zkqy.business.entity.vo;
+
+/**
+ * 表操作VO
+ */
+public class CommonTableOperationVO {
+
+    /** 数据库名称 */
+    private String databaseName;
+
+    /** 数据表名称 */
+    private String tableName;
+
+    /** 数据源类型 */
+    private String databaseType;
+
+    /** 用户名称 */
+    private String username;
+
+    /** 表描述 */
+    private String tableComment;
+
+    public String getDatabaseName() {
+        return databaseName;
+    }
+
+    public void setDatabaseName(String databaseName) {
+        this.databaseName = databaseName;
+    }
+
+    public String getTableName() {
+        return tableName;
+    }
+
+    public void setTableName(String tableName) {
+        this.tableName = tableName;
+    }
+
+    public String getDatabaseType() {
+        return databaseType;
+    }
+
+    public void setDatabaseType(String databaseType) {
+        this.databaseType = databaseType;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getTableComment() {
+        return tableComment;
+    }
+
+    public void setTableComment(String tableComment) {
+        this.tableComment = tableComment;
+    }
+
+    @Override
+    public String toString() {
+        return "CommonTableOperationVO{" +
+                "databaseName='" + databaseName + '\'' +
+                ", tableName='" + tableName + '\'' +
+                ", databaseType='" + databaseType + '\'' +
+                ", username='" + username + '\'' +
+                ", tableComment='" + tableComment + '\'' +
+                '}';
+    }
+}

+ 71 - 0
zkqy-business/src/main/java/com/zkqy/business/mapper/MysqlTableOperationMapper.java

@@ -0,0 +1,71 @@
+package com.zkqy.business.mapper;
+
+
+import com.zkqy.business.entity.TableInfo;
+import com.zkqy.business.entity.vo.CommonTableOperationVO;
+import com.zkqy.business.entity.vo.TableInfoVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * mysql相关表操作
+ */
+public interface MysqlTableOperationMapper {
+
+    /**
+     * 查询当前库下所有表
+     * @param vo
+     * @return
+     */
+    List<TableInfoVO> selectTableList(CommonTableOperationVO vo);
+
+    /**
+     * 查询数据库表是否存在
+     * @param vo
+     * @return
+     */
+    int selectTableExistenceOrNot(CommonTableOperationVO vo);
+
+    /**
+     * 新建表
+     * @param tableName 表名
+     * @param tableComment 表注释
+     * @param filedList 字段
+     * @param databases 数据库
+     */
+    void createTable(@Param("tableName") String tableName, @Param("tableComment") String tableComment, @Param("filedList") List<String> filedList, @Param("databases") String databases);
+
+    /**
+     * 查询表数据总条数
+     * @param tableName 表名
+     * @return
+     */
+    int selectTableDataCount(String tableName);
+
+    /**
+     * 删除表
+     * @param vo
+     */
+    void dropTable(CommonTableOperationVO vo);
+
+    /**
+     * 查询表结构
+     * @param dataBaseName 数据库名
+     * @param tableName 表名
+     * @return
+     */
+    List<TableInfo> tableInfo(@Param("dataBaseName") String dataBaseName, @Param("tableName") String tableName);
+
+    /**
+     * 得到当前表结构sql语句
+     * @param dataBaseName 数据库
+     * @param tableName 表名
+     * @return
+     */
+//    @MapKey("tableStructureSql")
+    Map<String, String> backupTableSql(@Param("dataBaseName") String dataBaseName, @Param("tableName") String tableName);
+
+
+}

+ 36 - 0
zkqy-business/src/main/java/com/zkqy/business/service/IMysqlTableOperationService.java

@@ -0,0 +1,36 @@
+package com.zkqy.business.service;
+
+
+
+import com.zkqy.business.entity.vo.CommonTableOperationVO;
+import com.zkqy.business.entity.vo.TableInfoVO;
+
+import java.util.List;
+
+/**
+ * mysql
+ */
+public interface IMysqlTableOperationService {
+
+    /**
+     * 查询当前库下所有表
+     * @param vo
+     * @return
+     */
+    List<TableInfoVO> selectTableList(CommonTableOperationVO vo);
+
+    /**
+     * 查询表数据总条数
+     * @param tableName 表名
+     * @return
+     */
+    int selectTableDataCount(String tableName);
+
+    /**
+     * 删除表
+     * @param vo
+     */
+    void dropTable(CommonTableOperationVO vo) throws Exception;
+
+
+}

+ 38 - 0
zkqy-business/src/main/java/com/zkqy/business/service/impl/MysqlTableOperationServiceImpl.java

@@ -0,0 +1,38 @@
+package com.zkqy.business.service.impl;
+
+
+import com.zkqy.business.entity.vo.CommonTableOperationVO;
+import com.zkqy.business.entity.vo.TableInfoVO;
+import com.zkqy.business.mapper.MysqlTableOperationMapper;
+import com.zkqy.business.service.IMysqlTableOperationService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service
+public class MysqlTableOperationServiceImpl implements IMysqlTableOperationService {
+
+    @Resource
+    private MysqlTableOperationMapper mysqlTableOperationMapper;
+
+    @Override
+    public List<TableInfoVO> selectTableList(CommonTableOperationVO vo) {
+        return mysqlTableOperationMapper.selectTableList(vo);
+    }
+
+    @Override
+    public int selectTableDataCount(String tableName) {
+        return mysqlTableOperationMapper.selectTableDataCount(tableName);
+    }
+
+    @Override
+    public void dropTable(CommonTableOperationVO vo) throws Exception {
+        try {
+            mysqlTableOperationMapper.dropTable(vo);
+        }catch (Exception e){
+            throw new Exception("删除数据表失败");
+        }
+
+    }
+}

+ 76 - 0
zkqy-business/src/main/resources/mapper/dragmapper/MysqlTableOperationMapper.xml

@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zkqy.business.mapper.MysqlTableOperationMapper">
+
+    <resultMap id="mysqlTableInfoResult" type="com.zkqy.business.entity.TableInfo">
+        <result property="fieldName" column="fieldName"></result>
+        <result property="fieldType" column="fieldType"></result>
+        <result property="isNull" column="isNull" javaType="boolean"></result>
+        <result property="isPrimary" column="isPrimary" javaType="boolean"></result>
+        <result property="fieldDescription" column="fieldDescription"></result>
+        <result property="fieldLength" column="fieldLength"></result>
+        <result property="isAuto" column="isAuto" javaType="boolean"></result>
+    </resultMap>
+
+    <select id="selectTableList" resultType="com.zkqy.business.entity.vo.TableInfoVO">
+        SELECT
+            table_name tableName,
+            create_time createTime,
+            table_comment tableComment
+        FROM
+            information_schema.TABLES
+        WHERE
+            table_schema = #{databaseName}
+        <if test="tableName != null and tableName != ''">and table_name like concat('%', #{tableName}, '%')</if>
+        <if test="tableComment != null and tableComment !=''">and table_comment like concat('%', #{tableComment}, '%')</if>
+        order by createTime DESC
+    </select>
+
+    <select id="selectTableExistenceOrNot" resultType="int">
+        SELECT count(1) FROM information_schema.TABLES t, information_schema.SCHEMATA n WHERE t.table_name = #{tableName} AND n.SCHEMA_NAME = #{dataBaseName};
+    </select>
+
+    <update id="createTable">
+        CREATE TABLE IF NOT EXISTS `${databases}`.`${tableName}`
+        (
+        <foreach collection="filedList" item="filed" separator=",">
+            ${filed}
+        </foreach>
+        )COMMENT #{tableComment};
+    </update>
+
+    <select id="selectTableDataCount" resultType="int">
+        select count(1) from ${tableName}
+    </select>
+
+    <delete id="dropTable">
+        DROP TABLE IF EXISTS `${databaseName}`.`${tableName}`;
+    </delete>
+
+    <select id="tableInfo" resultMap="mysqlTableInfoResult">
+        SELECT
+            column_name fieldName,
+            IF
+                ( is_nullable = 'NO', TRUE, FALSE ) isNull,
+            data_type fieldType,
+            character_maximum_length fieldLength,
+            IF
+                ( column_key = 'PRI', TRUE, FALSE ) isPrimary,
+            column_comment fieldDescription ,
+            if(extra='auto_increment',true,false) isAuto
+        FROM
+            information_schema.COLUMNS
+        WHERE
+            table_name = #{tableName}
+          AND table_schema = #{dataBaseName}
+        ORDER BY ordinal_position asc;
+
+    </select>
+
+    <select id="backupTableSql" resultType="map">
+        SHOW CREATE TABLE `${dataBaseName}`.`${tableName}`
+    </select>
+
+</mapper>

+ 22 - 0
zkqy-common/src/main/java/com/zkqy/common/constant/DataSourceType.java

@@ -0,0 +1,22 @@
+package com.zkqy.common.constant;
+
+/**
+ * 数据源类型
+ */
+public enum DataSourceType {
+
+    MYSQL("mysql"),
+    SQLSERVER("sqlserver"),
+    ORACLE("oracle"),
+    DM("dm");
+
+    private String dataSourceName;
+
+    DataSourceType(String dataSourceName) {
+        this.dataSourceName = dataSourceName;
+    }
+
+    public String getDataSourceName() {
+        return dataSourceName;
+    }
+}

+ 108 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/MaterialInventoryController.java

@@ -100,9 +100,70 @@ public class MaterialInventoryController extends BaseController {
 //        return AjaxResult.error("入库失败");
     }
 
+    /**
+     * 扫码入库
+     * /system/inventory/insertMaterialInventoryTwo 入库
+     * /system/inventory/deliveryFromStorageTwo 出库
+     */
+    @PreAuthorize("@ss.hasPermi('system:inventory:add')")
+    @Log(title = "物料库存", businessType = BusinessType.INSERT)
+    @RequestMapping(value = "/insertMaterialInventoryTwo", method = RequestMethod.POST)
+    @ApiOperation(value = "新增物料库存")
+    public AjaxResult insertMaterialInventoryTwo(@RequestBody List<MaterialInventoryVo> materialInventoryVo) {
+        //入库操作
+        return materialInventoryService.insertMaterialInventoryTwo(materialInventoryVo);
+//        String replace = materialInventoryVo.getQtCodeNumber().replace("/r", "");
+//        materialInventoryVo.setQtCodeNumber(replace);
+//        //1、禁止重复入库
+//        InboundRecords inboundRecords = inboundRecordsMapper.selectInboundRecordsByQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+//        if (inboundRecords != null) {
+//            return AjaxResult.success("不可以重复扫码入库");
+//        }
+//        //2、判断是第一次入库还是第二次入库这个同类商品(这是一个连表语句)
+//        MaterialInventory materialInventory
+//                = materialInventoryService.selectMaterialInventoryByMaterialCodeAndSpecifications(materialInventoryVo.getMaterialCode(), materialInventoryVo.getSpecifications());
+//        int count = 0;
+//        if (materialInventory != null) { //证明已经入库过相同的产品了---库存叠加操作
+//            Double quantityOld = materialInventory.getQuantity();
+//            Double quantity = materialInventoryVo.getQuantity();
+//            Double newQuantity =quantityOld+quantity;
+//            materialInventory.setQuantity(newQuantity);
+//            materialInventory.setUpdateTime(new Date());
+//            materialInventory.setUpdateById(SecurityUtils.getUserId());
+//            count = materialInventoryService.updateMaterialInventory(materialInventory);
+//        } else { //第一次入库走插入操作) ()
+//            MaterialInventory materialInventoryObj = new MaterialInventory();
+//            materialInventoryObj.setStockNumber(String.valueOf(new Date().getTime()));//库存编号
+//            materialInventoryObj.setWarehouseEntryNumber(UUID.randomUUID().toString());//入库单编号
+//            materialInventoryObj.setMaterialCode(materialInventoryVo.getMaterialCode());//物料编号
+//            materialInventoryObj.setQuantity(materialInventoryVo.getQuantity());//数量
+//            materialInventoryObj.setCreateById(SecurityUtils.getUserId());
+//            materialInventoryObj.setCreateTime(new Date());
+//            count = materialInventoryService.insertMaterialInventory(materialInventoryObj);
+//        }
+//        if (count > 0) {
+//            InboundRecords inboundRecords1 = new InboundRecords();
+//            inboundRecords1.setInboundTime(new Date());//入库时间
+//            //物料名称需要根据物料编码查询下
+//            Materiel materiel = materielMapper.selectMaterielByMaterielCode(materialInventoryVo.getMaterialCode());
+//            inboundRecords1.setInboundAterialsName(materiel.getMaterielName());//物料名称
+//            inboundRecords1.setSpecifications(materialInventoryVo.getSpecifications());//规格代号
+//            inboundRecords1.setInboundUnit(materialInventoryVo.getInboundUnit());//单位
+//            inboundRecords1.setInboundQuantity(materialInventoryVo.getQuantity().toString());//入库数量
+//            inboundRecords1.setInboundLeader(SecurityUtils.getUsername());//仓管员
+//            inboundRecords1.setCreateById(SecurityUtils.getUserId());//创建人
+//            inboundRecords1.setCreateTime(new Date());//创建时间
+//            inboundRecords1.setQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+//            inboundRecordsMapper.insertInboundRecords(inboundRecords1); //插入入库日志信息
+//            return AjaxResult.success("入库成功");
+//        }
+//        return AjaxResult.error("入库失败");
+    }
+
 
     /**
      * 扫码出库
+     * /system/inventory/deliveryFromStorageTwo
      */
     @PreAuthorize("@ss.hasPermi('system:inventory:add')")
     @Log(title = "物料库存", businessType = BusinessType.INSERT)
@@ -151,6 +212,53 @@ public class MaterialInventoryController extends BaseController {
     }
 
 
+    @PreAuthorize("@ss.hasPermi('system:inventory:add')")
+    @Log(title = "物料库存", businessType = BusinessType.INSERT)
+    @RequestMapping(value = "/deliveryFromStorageTwo",method = RequestMethod.POST)
+    @ApiOperation(value = "扫码出库")
+    public AjaxResult deliveryFromStorageTwo(@RequestBody List<MaterialInventoryVo> materialInventoryVo) {
+        //入库操作
+        return materialInventoryService.outMaterialInventoryTwo(materialInventoryVo);
+//        //1、禁止重复入库
+//        InboundRecords inboundRecords = inboundRecordsMapper.selectInboundRecordsByQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+//        if (inboundRecords == null) {
+//            return AjaxResult.success("此货品还没有入库,不能出库");
+//        }
+//        //2、是否重复入库
+//        OutboundRecords outboundRecords = outboundRecordsMapper.selectOutboundRecordsByQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+//        if (outboundRecords != null) {
+//            return AjaxResult.success("此货品不能重复出库");
+//        }
+//        //3、根据物料编码跟规则查询库存信息
+//        MaterialInventory materialInventory
+//                = materialInventoryService.selectMaterialInventoryByMaterialCodeAndSpecifications(materialInventoryVo.getMaterialCode(), materialInventoryVo.getSpecifications());
+//        //4、出库多少减去这个数量
+//        Double quantityOld = materialInventory.getQuantity();
+//        Double quantity = materialInventoryVo.getQuantity();
+//        Double newQuantity =quantityOld-quantity;
+//        materialInventory.setQuantity(newQuantity);
+//        int count = materialInventoryService.updateMaterialInventory(materialInventory);
+//        if (count > 0) {
+//            OutboundRecords outboundRecords1 = new OutboundRecords();
+//            outboundRecords1.setOutboundTime(new Date());//出库时间
+//            //物料名称需要根据物料编码查询下
+//            Materiel materiel = materielMapper.selectMaterielByMaterielCode(materialInventoryVo.getMaterialCode());
+//            outboundRecords1.setQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+//            outboundRecords1.setOutboundAterialsName(materiel.getMaterielName());//物料名称
+//            outboundRecords1.setOutboundNo(UUID.randomUUID().toString());//出库编号
+//            outboundRecords1.setSpecifications(materialInventoryVo.getSpecifications());//规格代号
+//            outboundRecords1.setOutboundUnit(materialInventoryVo.getInboundUnit());//单位
+//            outboundRecords1.setOutboundQuantity(materialInventoryVo.getQuantity().toString());//出库数量
+//            outboundRecords1.setOutboundLeader(SecurityUtils.getUsername());//仓管员
+//            outboundRecords1.setCreateById(SecurityUtils.getUserId());//创建人
+//            outboundRecords1.setCreateTime(new Date());//创建时间
+//            outboundRecordsMapper.insertOutboundRecords(outboundRecords1); //插出库库日志信息
+//            return AjaxResult.success("出库成功");
+//        }
+//        return AjaxResult.error("出库失败");
+    }
+
+
 
     /**
      * 查询物料库存列表

+ 9 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductInvoiceController.java

@@ -2,10 +2,16 @@ package com.zkqy.business.controller;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.zkqy.common.core.domain.entity.SysRole;
+import com.zkqy.common.utils.SecurityUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.User;
 import org.springframework.web.bind.annotation.*;
 import com.zkqy.common.annotation.Log;
 import com.zkqy.common.core.controller.BaseController;
@@ -113,6 +119,9 @@ public class ProductInvoiceController extends BaseController
         return success(productInvoiceService.productInvoiceInfo(saleOrderNo));
     }
 
+    /**
+     * 查询发货单货品信息
+     */
     @GetMapping("/saleStorageDetails")
     public AjaxResult saleStorageDetails(@RequestParam("id") Long id)
     {

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleOrderController.java

@@ -131,5 +131,16 @@ public class SaleOrderController extends BaseController {
         return toAjax(saleOrderService.batchApproval(vo));
     }
 
+    /**
+     * 销售单列表--权限过滤
+     */
+    @GetMapping("/saleOrderList")
+    public TableDataInfo saleOrderList(SaleOrder saleOrder){
+        startPage();
+        List<SaleOrderVO> list = saleOrderService.saleOrderList(saleOrder);
+        return getDataTable(list);
+    }
+
+
 
 }

+ 9 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleProductsController.java

@@ -115,4 +115,13 @@ public class SaleProductsController extends BaseController {
     public AjaxResult remove(@PathVariable List<Long> ids) {
         return toAjax(saleProductsService.deleteSaleProductsByIds(ids));
     }
+
+    /**
+     * 销售出库单货品信息
+     */
+    @GetMapping("/outboundOrderInfo")
+    public AjaxResult outboundOrder(@RequestParam("saleOrderNo") String saleOrderNo){
+        return AjaxResult.success(saleProductsService.selectOutboundOrderInfo(saleOrderNo));
+    }
+
 }

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductCodeList.java

@@ -32,6 +32,9 @@ public class ProductCodeList extends BaseEntity
     @Excel(name = "货品编号")
     private Long productId;
 
+    /** 产品色泽 */
+    private String productColour;
+
     /** 等级 */
     @Excel(name = "等级")
     private String levels;
@@ -347,6 +350,14 @@ public class ProductCodeList extends BaseEntity
         this.totalGrossWeight = totalGrossWeight;
     }
 
+    public String getProductColour() {
+        return productColour;
+    }
+
+    public void setProductColour(String productColour) {
+        this.productColour = productColour;
+    }
+
     @Override
     public String toString() {
         return "ProductCodeList{" +

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductHandsetOutboundRecord.java

@@ -135,6 +135,9 @@ public class ProductHandsetOutboundRecord extends BaseEntity
     @Excel(name = "通知单号")
     private String noticeNumber;
 
+    /** 产品色泽 */
+    private String productColour;
+
     public void setId(Long id) 
     {
         this.id = id;
@@ -406,6 +409,14 @@ public class ProductHandsetOutboundRecord extends BaseEntity
         return noticeNumber;
     }
 
+    public String getProductColour() {
+        return productColour;
+    }
+
+    public void setProductColour(String productColour) {
+        this.productColour = productColour;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductInventory.java

@@ -134,6 +134,9 @@ public class ProductInventory extends BaseEntity
     @Excel(name = "合计毛重")
     private Double totalGrossWeight;
 
+    /** 产品色泽 */
+    private String productColour;
+
     public void setId(Long id) 
     {
         this.id = id;
@@ -405,6 +408,14 @@ public class ProductInventory extends BaseEntity
         return totalGrossWeight;
     }
 
+    public String getProductColour() {
+        return productColour;
+    }
+
+    public void setProductColour(String productColour) {
+        this.productColour = productColour;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 10 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductInvoice.java

@@ -116,6 +116,8 @@ public class ProductInvoice extends BaseEntity
     @Excel(name = "发货日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date deliveryDate;
 
+    /** 发货员 */
+    private String deliveryClerk;
 
     public void setId(Long id) 
     {
@@ -348,6 +350,14 @@ public class ProductInvoice extends BaseEntity
         this.customerName = customerName;
     }
 
+    public String getDeliveryClerk() {
+        return deliveryClerk;
+    }
+
+    public void setDeliveryClerk(String deliveryClerk) {
+        this.deliveryClerk = deliveryClerk;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductOutboundRecord.java

@@ -134,6 +134,9 @@ public class ProductOutboundRecord extends BaseEntity
     /** 通知单号 */
     private String noticeNumber;
 
+    /** 产品色泽 */
+    private String productColour;
+
     public void setId(Long id) 
     {
         this.id = id;
@@ -404,6 +407,14 @@ public class ProductOutboundRecord extends BaseEntity
         this.noticeNumber = noticeNumber;
     }
 
+    public String getProductColour() {
+        return productColour;
+    }
+
+    public void setProductColour(String productColour) {
+        this.productColour = productColour;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/ProductWarehousingRecord.java

@@ -130,6 +130,9 @@ public class ProductWarehousingRecord extends BaseEntity
     /** 仓库编号 */
     private Long warehouseId;
 
+    /** 产品色泽 */
+    private String productColour;
+
     public void setId(Long id) 
     {
         this.id = id;
@@ -391,6 +394,14 @@ public class ProductWarehousingRecord extends BaseEntity
         this.warehouseId = warehouseId;
     }
 
+    public String getProductColour() {
+        return productColour;
+    }
+
+    public void setProductColour(String productColour) {
+        this.productColour = productColour;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 10 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleOrder.java

@@ -128,6 +128,8 @@ public class SaleOrder extends BaseEntity
     @Excel(name = "交货日期")
     private String lotNumber;
 
+    //超级查询
+    private String queryParam;
 
     public String getLotNumber() {
         return lotNumber;
@@ -380,6 +382,14 @@ public class SaleOrder extends BaseEntity
         return deliveryDate;
     }
 
+    public String getQueryParam() {
+        return queryParam;
+    }
+
+    public void setQueryParam(String queryParam) {
+        this.queryParam = queryParam;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 3 - 3
zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleProducts.java

@@ -36,7 +36,7 @@ public class SaleProducts extends BaseEntity
 
     /** 销售数量 */
     @Excel(name = "销售数量")
-    private Long productNumber;
+    private Double productNumber;
 
     /** 销售重量 kg */
     @Excel(name = "销售重量 kg")
@@ -163,12 +163,12 @@ public class SaleProducts extends BaseEntity
     {
         return productName;
     }
-    public void setProductNumber(Long productNumber) 
+    public void setProductNumber(Double productNumber)
     {
         this.productNumber = productNumber;
     }
 
-    public Long getProductNumber() 
+    public Double getProductNumber()
     {
         return productNumber;
     }

+ 22 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductCodeListVO.java

@@ -32,6 +32,9 @@ public class ProductCodeListVO extends BaseEntity
     /** 货品编号 */
     private Long productId;
 
+    /** 产品色泽 */
+    private String productColour;
+
     /** 等级 */
     private String levels;
 
@@ -137,6 +140,9 @@ public class ProductCodeListVO extends BaseEntity
     /** 入库时间 */
     private Date warehousingTime;
 
+    /** 通知单号 */
+    private String noticeNumber;
+
     public Long getId() {
         return id;
     }
@@ -463,6 +469,22 @@ public class ProductCodeListVO extends BaseEntity
         this.warehousingTime = warehousingTime;
     }
 
+    public String getNoticeNumber() {
+        return noticeNumber;
+    }
+
+    public void setNoticeNumber(String noticeNumber) {
+        this.noticeNumber = noticeNumber;
+    }
+
+    public String getProductColour() {
+        return productColour;
+    }
+
+    public void setProductColour(String productColour) {
+        this.productColour = productColour;
+    }
+
     @Override
     public String toString() {
         return "ProductCodeListVO{" +

+ 2 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductInvoiceVO.java

@@ -441,6 +441,8 @@ public class ProductInvoiceVO extends BaseEntity
         /** 实发重量 */
         private Double actualWeight;
 
+
+
         public String getProductCode() {
             return productCode;
         }

+ 12 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/SaleOrderVO.java

@@ -24,7 +24,7 @@ public class SaleOrderVO {
     /** 预计下单时间(未使用) */
     private Date saleEstimatedTime;
 
-    /** 交货日期 */
+    /** 交货天数 */
     private String saleLeadTime;
 
     /** 订单销售产品集合编号 */
@@ -96,6 +96,9 @@ public class SaleOrderVO {
     /** 销售单编号集合 */
     private List<Long> idList;
 
+    /** 客户名称 */
+    private String customName;
+
     public Long getId() {
         return id;
     }
@@ -328,6 +331,14 @@ public class SaleOrderVO {
         this.idList = idList;
     }
 
+    public String getCustomName() {
+        return customName;
+    }
+
+    public void setCustomName(String customName) {
+        this.customName = customName;
+    }
+
     @Override
     public String toString() {
         return "SaleOrderVO{" +

+ 69 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/SaleProductsVo.java

@@ -4,14 +4,34 @@ import com.zkqy.business.domain.SaleProducts;
 
 public class SaleProductsVo extends SaleProducts {
 
+    /** 客户名称 */
     private  String customName;
 
+    /** 物料转码 */
     private  String  materieEncoding;
 
+    /** 物料色号 */
     private  String  materieColorNumber;
 
+    /** 产品规格 */
     private  String productSpecifications;
 
+    /** 产品名称 */
+    private String productName;
+
+    /** 批号 */
+    private String lotNumber;
+
+    /** 产品数量 */
+    private Double productNumber;
+
+    /** 产品单价 */
+    private String productUnitPrice;
+
+    /** 产品金额 */
+    private String productAmounts;
+
+
     public String getProductSpecifications() {
         return productSpecifications;
     }
@@ -44,4 +64,53 @@ public class SaleProductsVo extends SaleProducts {
     public void setCustomName(String customName) {
         this.customName = customName;
     }
+
+    @Override
+    public String getProductName() {
+        return productName;
+    }
+
+    @Override
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    @Override
+    public String getLotNumber() {
+        return lotNumber;
+    }
+
+    @Override
+    public void setLotNumber(String lotNumber) {
+        this.lotNumber = lotNumber;
+    }
+
+    @Override
+    public String getProductUnitPrice() {
+        return productUnitPrice;
+    }
+
+    @Override
+    public void setProductUnitPrice(String productUnitPrice) {
+        this.productUnitPrice = productUnitPrice;
+    }
+
+    @Override
+    public String getProductAmounts() {
+        return productAmounts;
+    }
+
+    @Override
+    public void setProductAmounts(String productAmounts) {
+        this.productAmounts = productAmounts;
+    }
+
+    @Override
+    public Double getProductNumber() {
+        return productNumber;
+    }
+
+    public void setProductNumber(Double productNumber) {
+        this.productNumber = productNumber;
+    }
 }

+ 6 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleOrderMapper.java

@@ -91,4 +91,10 @@ public interface SaleOrderMapper
      * 根据销售单合同号查询当前用户编号
      */
     Long selectCustomerIdBySaleNo(String saleNo);
+
+    /**
+     * 查询销售订单列表
+     */
+    List<SaleOrderVO> saleOrderList(SaleOrder saleOrder);
+
 }

+ 7 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleProductsMapper.java

@@ -94,4 +94,11 @@ public interface SaleProductsMapper
      */
     List<ProductInvoiceVO.SaleProductInfo> selectSaleProductsInfo(String saleOrderNo);
 
+    /***
+     * 查询销售出库单详情
+     * @param saleOrderNo
+     * @return
+     */
+    List<SaleProductsVo> selectOutboundOrderInfo(String saleOrderNo);
+
 }

+ 16 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/IMaterialInventoryService.java

@@ -38,6 +38,14 @@ public interface IMaterialInventoryService
      */
     public AjaxResult insertMaterialInventory(MaterialInventoryVo materialInventoryVo);
 
+    /**
+     * 入库
+     *
+     * @param materialInventoryVo 物料库存
+     * @return 结果
+     */
+    public AjaxResult insertMaterialInventoryTwo(List<MaterialInventoryVo> materialInventoryVo);
+
 
     /**
      * 出库
@@ -46,6 +54,14 @@ public interface IMaterialInventoryService
      */
     public AjaxResult outMaterialInventory(MaterialInventoryVo materialInventoryVo);
 
+    /**
+     * 出库
+     * @param materialInventoryVo
+     * @return
+     */
+    public AjaxResult outMaterialInventoryTwo(List<MaterialInventoryVo> materialInventoryVo);
+
+
     /**
      * 修改物料库存
      * 

+ 8 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleOrderService.java

@@ -72,5 +72,13 @@ public interface ISaleOrderService
      */
     int batchApproval(SaleOrderVO vo);
 
+    /**
+     * 销售单列表--权限过滤
+     * @param saleOrder
+     * @return
+     */
+    List<SaleOrderVO> saleOrderList(SaleOrder saleOrder);
+
+
 
 }

+ 7 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleProductsService.java

@@ -68,4 +68,11 @@ public interface ISaleProductsService
      * @return 结果
      */
     public int deleteSaleProductsById(Long id);
+
+    /***
+     * 查询销售出库单详情
+     * @param saleOrderNo
+     * @return
+     */
+    List<SaleProductsVo> selectOutboundOrderInfo(String saleOrderNo);
 }

+ 148 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/MaterialInventoryServiceImpl.java

@@ -15,6 +15,7 @@ import com.zkqy.common.core.domain.AjaxResult;
 import com.zkqy.common.utils.DateUtils;
 import com.zkqy.common.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.parameters.P;
 import org.springframework.stereotype.Service;
 import com.zkqy.business.mapper.MaterialInventoryMapper;
 import com.zkqy.business.domain.MaterialInventory;
@@ -41,6 +42,7 @@ public class MaterialInventoryServiceImpl implements IMaterialInventoryService
 
     @Autowired
     private MaterielMapper materielMapper;
+
     /**
      * 入库
      *
@@ -223,6 +225,152 @@ public class MaterialInventoryServiceImpl implements IMaterialInventoryService
     }
 
 
+
+    /**
+     * 入库
+     *
+     * @param materialInventoryVo 物料库存
+     * @return 结果
+     */
+    @Override
+    @Transactional
+    public AjaxResult insertMaterialInventoryTwo(List<MaterialInventoryVo> materialInventoryVo)
+    {
+        try {
+            materialInventoryVo.forEach(item->{
+                //创建时间
+                item.setCreateTime(DateUtils.getNowDate());
+                //1、如果有证明当前这个批次的码已经被扫过了
+                InboundRecords inboundRecords = inboundRecordsMapper.selectInboundRecordsByQtCodeNumber(item.getQtCodeNumber());
+                if (inboundRecords == null) {
+                //2、判断是第一次入库还是第二次入库这个同类商品(这是一个连表语句)(同一个批次查询)
+                InboundRecords inboundRecords1=new InboundRecords();
+                inboundRecords1.setLotNumber(item.getLotNumber());
+                inboundRecords1.setMaterielId(item.getMaterialId());
+                List<InboundRecords> inboundRecords2 = inboundRecordsMapper.selectInboundRecordsList(inboundRecords1);
+                //3、判断是走新增还是修改
+                int count = 0;
+                if(inboundRecords2.size()>0){
+                    //已经入过库存了,绝对会有这个信息
+                    MaterialInventory materialInventory=new MaterialInventory();
+                    materialInventory.setMaterialId(item.getMaterialId());
+                    List<MaterialInventory> materialInventories = materialInventoryMapper.selectMaterialInventoryList(materialInventory);
+                    if(materialInventories.size()>0){
+                        //没更新的物料信息
+                        MaterialInventory oldMaterialInventory   = materialInventories.get(0);
+                        //更新物料信息数量
+                        oldMaterialInventory.setQuantity(oldMaterialInventory.getQuantity()+item.getQuantity());
+                        //执行更新操作
+                        count = materialInventoryMapper.updateMaterialInventory(oldMaterialInventory);
+                    }
+                    //没有入过库走新增操作
+                }else {
+                    MaterialInventory materialInventoryObj = new MaterialInventory();
+                    materialInventoryObj.setStockNumber(String.valueOf(new Date().getTime()));//库存编号
+                    materialInventoryObj.setWarehouseEntryNumber(UUID.randomUUID().toString());//入库单编号
+                    materialInventoryObj.setMaterialCode(item.getMaterialCode());//物料编号
+                    materialInventoryObj.setQuantity(item.getQuantity());//数量
+                    materialInventoryObj.setCreateById(SecurityUtils.getUserId());
+                    materialInventoryObj.setLotNumber(item.getLotNumber());//批号
+                    materialInventoryObj.setMaterialId(item.getMaterialId());//物料id
+                    materialInventoryObj.setCreateTime(new Date());
+                    count = materialInventoryMapper.insertMaterialInventory(materialInventoryObj);
+                }
+                if(count>0){
+                    InboundRecords inboundRecords3 = new InboundRecords();
+                    inboundRecords3.setInboundTime(new Date());//入库时间
+                    //物料名称需要根据物料编码查询下
+                    Materiel materiel = materielMapper.selectMaterielById(Long.valueOf(item.getMaterialId()));
+                    inboundRecords3.setInboundAterialsName(materiel.getMaterielName());//物料名称
+                    inboundRecords3.setSpecifications(item.getSpecifications());//规格代号
+                    inboundRecords3.setInboundUnit(item.getInboundUnit());//单位
+                    inboundRecords3.setInboundQuantity(item.getQuantity().toString());//入库数量
+                    inboundRecords3.setInboundLeader(SecurityUtils.getUsername());//仓管员
+                    inboundRecords3.setCreateById(SecurityUtils.getUserId());//创建人
+                    inboundRecords3.setCreateTime(new Date());//创建时间
+                    inboundRecords3.setLotNumber(item.getLotNumber());//批号
+                    inboundRecords3.setMaterielId(item.getMaterialId());//母粒id
+                    inboundRecords3.setQtCodeNumber(item.getQtCodeNumber());//二维码唯一编码
+                    inboundRecordsMapper.insertInboundRecords(inboundRecords3); //插入入库日志信息
+                }
+                }
+            });
+        } catch (Exception e) {
+            return  AjaxResult.error("入库失败");
+        }
+        return  AjaxResult.success("入库成功");
+    }
+
+    /**
+     * 出库
+     *
+     * @param materialInventoryVo 物料库存
+     * @return 结果
+     */
+    @Override
+    @Transactional
+    public AjaxResult outMaterialInventoryTwo(List<MaterialInventoryVo> materialInventoryVo)
+    {
+        try {
+            materialInventoryVo.forEach(item->{
+                item.setCreateTime(DateUtils.getNowDate());
+                //1、没有对应的入库记录
+//                InboundRecords inboundRecords = inboundRecordsMapper.selectInboundRecordsByQtCodeNumber(item.getQtCodeNumber());
+//                if (inboundRecords == null) {
+//                    return AjaxResult.error("此货品还没有入库,不能出库");
+//                }
+                //2、二维码是否重复使用
+    //          OutboundRecords outboundRecords = outboundRecordsMapper.selectOutboundRecordsByQtCodeNumber(materialInventoryVo.getQtCodeNumber());
+    //          if (outboundRecords != null) {
+    //                return"此货品不能重复出库";
+    //          }
+                //3、根据物料编码跟规则查询库存信息
+                MaterialInventory materialInventory=new MaterialInventory();
+                materialInventory.setMaterialId(item.getMaterialId());
+                List<MaterialInventory> materialInventories = materialInventoryMapper.selectMaterialInventoryList(materialInventory);
+                if(materialInventories.size()>0){
+                    Double oldQuantity = materialInventories.get(0).getQuantity();
+//                    if(item.getQuantity()>oldQuantity){
+//                        return AjaxResult.error("库存不足"+item.getQuantity()+"个");
+//                    }
+                    Double outboundQuantity = item.getQuantity();
+                    //出库后剩余数量
+                    Double newQuantity =oldQuantity-outboundQuantity;
+                    //更新数量
+                    MaterialInventory doubleMaterialInventory = new MaterialInventory();
+                    doubleMaterialInventory.setQuantity(newQuantity);
+                    doubleMaterialInventory.setMaterialId(item.getMaterialId());
+                    //执行sql语句
+                    int count = materialInventoryMapper.updateMaterialInventoryByMaterialId(doubleMaterialInventory);
+                    //代表出库成功
+                    if(count>0){
+                        OutboundRecords outboundRecords1 = new OutboundRecords();
+                        outboundRecords1.setOutboundTime(new Date());//出库时间
+                        //物料名称需要根据物料编码查询下
+                        Materiel materiel = materielMapper.selectMaterielById(Long.valueOf(item.getMaterialId()));
+                        outboundRecords1.setQtCodeNumber(item.getQtCodeNumber());
+                        outboundRecords1.setOutboundAterialsName(materiel.getMaterielName());//物料名称
+                        outboundRecords1.setOutboundNo(UUID.randomUUID().toString());//出库编号
+                        outboundRecords1.setSpecifications(item.getSpecifications());//规格代号
+                        outboundRecords1.setOutboundUnit(item.getInboundUnit());//单位
+                        outboundRecords1.setOutboundQuantity(item.getQuantity().toString());//出库数量
+                        outboundRecords1.setOutboundLeader(SecurityUtils.getUsername());//仓管员
+                        outboundRecords1.setCreateById(SecurityUtils.getUserId());//创建人
+                        outboundRecords1.setCreateTime(new Date());//创建时间
+                        outboundRecords1.setLotNumber(item.getLotNumber());//批号
+                        outboundRecords1.setQtCodeNumber(item.getQtCodeNumber());//二维码
+                        outboundRecords1.setMaterielId(item.getMaterialId());//母粒iD
+                        outboundRecordsMapper.insertOutboundRecords(outboundRecords1); //插出库库日志信息
+                    }
+                }
+
+            });
+        } catch (Exception e) {
+//            throw new RuntimeException(e);
+            return AjaxResult.error("出库失败");
+        }
+        return AjaxResult.success("出库成功");
+    }
     /**
      * 查询物料库存
      * 

+ 12 - 2
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductHandsetOutboundRecordServiceImpl.java

@@ -113,17 +113,27 @@ public class ProductHandsetOutboundRecordServiceImpl implements IProductHandsetO
     @Override
     @Transactional
     public void productHandsetOutStorage(List<ProductCodeListVO> productCodeListVOList) {
+
+
         for (ProductCodeListVO vo : productCodeListVOList){
             //手持机出库日志
             ProductCodeList productCodeList = productCodeListMapper.selectProductCodeListById(vo.getId());
+            //校验当前码单是否已出库
+            ProductHandsetOutboundRecord productHandsetOutboundRecord1 =
+                    productHandsetOutboundRecordMapper.selectWhetherExist(productCodeList.getQrCode(), vo.getQrCodeId());
+            if (productHandsetOutboundRecord1 != null){
+                continue;
+            }
+
             ProductHandsetOutboundRecord productHandsetOutboundRecord = new ProductHandsetOutboundRecord();
             BeanUtils.copyProperties(productCodeList,productHandsetOutboundRecord);
             productHandsetOutboundRecord.setQrCodeId(vo.getQrCodeId());// 码单号唯一标识
             productHandsetOutboundRecord.setCanisterNum(vo.getCanisterNum()); //筒数
             productHandsetOutboundRecord.setSuttle(vo.getSuttle());//净重
             productHandsetOutboundRecord.setGrossWeight(vo.getGrossWeight());//毛重
-            productHandsetOutboundRecord.setDepositor(vo.getDepositor());//出库人
-            productHandsetOutboundRecord.setWarehousingTime(vo.getWarehousingTime());
+//            productHandsetOutboundRecord.setDepositor(vo.getDepositor());//出库人
+//            productHandsetOutboundRecord.setWarehousingTime(vo.getWarehousingTime());//出库时间
+            productHandsetOutboundRecord.setNoticeNumber(vo.getNoticeNumber());//通知单号
             productHandsetOutboundRecord.setRemark(productCodeList.getRemark());
             productHandsetOutboundRecord.setCreateBy(SecurityUtils.getUsername());
             productHandsetOutboundRecord.setCreateTime(DateUtils.getNowDate());

+ 19 - 4
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInventoryServiceImpl.java

@@ -120,13 +120,18 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
     @Override
     @Transactional
     public void productStorage(List<ProductCodeListVO> productCodeListVOList) {
+
         for (ProductCodeListVO vo : productCodeListVOList){
             // 日志
             ProductCodeList productCodeList = productCodeListMapper.selectProductCodeListById(vo.getId());
-
+            //校验当前货品是否已入库,已入库跳过本次循环
+            ProductWarehousingRecord productWarehousingRecord1 =
+                    productWarehousingRecordMapper.selectProductWarehousingRecordWhetherExist(productCodeList.getQrCode(), vo.getQrCodeId());
+            if(productWarehousingRecord1 != null){
+                continue;
+            }
             ProductWarehousingRecord productWarehousingRecord = new ProductWarehousingRecord();
             BeanUtils.copyProperties(productCodeList,productWarehousingRecord);
-
             productWarehousingRecord.setQrCodeId(vo.getQrCodeId());
             productWarehousingRecord.setCanisterNum(vo.getCanisterNum());//筒数
             productWarehousingRecord.setSuttle(vo.getSuttle());//净重
@@ -179,8 +184,15 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
     public AjaxResult productOutStorage(List<ProductCodeListVO> productCodeListVOList) {
 
         for (ProductCodeListVO vo : productCodeListVOList){
+
             // 出库日志
             ProductCodeList productCodeList = productCodeListMapper.selectProductCodeListById(vo.getId());
+
+            // 校验当前货品是否已出库,已出库跳过本次循环
+            ProductOutboundRecord productOutboundRecord1 = productOutboundRecordMapper.selectProductOutboundRecordWhetherExist(vo.getQrCode(), vo.getQrCodeId());
+            if(productOutboundRecord1 != null){
+                continue;
+            }
             ProductOutboundRecord productOutboundRecord = new ProductOutboundRecord();
             BeanUtils.copyProperties(productCodeList,productOutboundRecord);
             //二维码唯一标识
@@ -233,12 +245,14 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
     @Override
     @Transactional
     public AjaxResult noticeOutStorage(ProductInvoice productInvoice) {
-        //修改通知单、发货日期、发货仓库、调拨仓库
+        //修改通知单、发货日期、发货仓库、调拨仓库、发货员、
         ProductInvoice productInvoice1 = new ProductInvoice();
         productInvoice1.setId(productInvoice.getId());
         productInvoice1.setDeliveryDate(productInvoice.getDeliveryDate());
         productInvoice1.setDeliveryWarehouse(productInvoice.getDeliveryWarehouse());
         productInvoice1.setTransferWarehouse(productInvoice.getTransferWarehouse());
+        productInvoice1.setDeliveryClerk(productInvoice.getDeliveryClerk());
+        productInvoice1.setStatus("2");
         productInvoiceMapper.updateProductInvoice(productInvoice1);
 
 
@@ -252,7 +266,8 @@ public class ProductInventoryServiceImpl implements IProductInventoryService
 
             ProductOutboundRecord productOutboundRecord = new ProductOutboundRecord();
             BeanUtils.copyProperties(productHandsetOutboundRecord1,productOutboundRecord);
-
+            productOutboundRecord.setWarehousingTime(productInvoice.getDeliveryDate());
+            productOutboundRecord.setDepositor(productInvoice.getDeliveryClerk());
             productOutboundRecordMapper.insertProductOutboundRecord(productOutboundRecord);
 
             //出库 减库存、箱数、筒数、净重、毛重

+ 9 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInvoiceServiceImpl.java

@@ -137,12 +137,20 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
                 if(productOutboundRecord != null){
                     saleProductInfo.setBoxNum(productOutboundRecord.getBoxNum());
                     saleProductInfo.setWeight(productOutboundRecord.getSuttle() == null ? 0 : productOutboundRecord.getSuttle());
+                }else {
+                    saleProductInfo.setBoxNum(0);
+                    saleProductInfo.setWeight(0.0);
                 }
             }
+        }else {
+            for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
+                saleProductInfo.setBoxNum(0);
+                saleProductInfo.setWeight(0.0);
+            }
         }
         //查询当前批号库存箱数,重量
         ProductInventory productInventory1 = new ProductInventory();
-        productInventory1.setId(saleProductInfoList.get(0).getProductId());
+        productInventory1.setProductId(saleProductInfoList.get(0).getProductId());
         productInventory1.setLotNum(saleProductInfoList.get(0).getLotNum());
         ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory1);
         if(productInventory != null){

+ 21 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleOrderServiceImpl.java

@@ -7,6 +7,7 @@ import com.zkqy.business.domain.SaleProducts;
 import com.zkqy.business.domain.vo.SaleOrderVO;
 import com.zkqy.business.mapper.SaleCraftMapper;
 import com.zkqy.business.mapper.SaleProductsMapper;
+import com.zkqy.common.core.domain.entity.SysRole;
 import com.zkqy.common.utils.DateUtils;
 import com.zkqy.common.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -161,4 +162,24 @@ public class SaleOrderServiceImpl implements ISaleOrderService
     public int batchApproval(SaleOrderVO vo) {
         return saleOrderMapper.batchUpdateSaleOrder(vo);
     }
+
+    @Override
+    public List<SaleOrderVO> saleOrderList(SaleOrder saleOrder) {
+        List<SaleOrderVO> saleOrderVOS = new ArrayList<>();
+        // 查看当前用户角色
+        List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
+        //查看当前用户角色是否存在销售员角色
+        boolean containsSalesman = roles.stream().anyMatch(role -> "salesman".equals(role.getRoleKey()));
+
+        //查看当前用户是否是租户管理员,是返回全部销售单数据
+        if(SecurityUtils.isLoginUserTenantAdmin()){
+            saleOrderVOS = saleOrderMapper.saleOrderList(saleOrder);
+        }else if(containsSalesman){
+            saleOrder.setCreateById(SecurityUtils.getUserId());
+            saleOrderVOS = saleOrderMapper.saleOrderList(saleOrder);
+        }else {
+            saleOrderVOS = saleOrderMapper.saleOrderList(saleOrder);
+        }
+        return saleOrderVOS;
+    }
 }

+ 5 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleProductsServiceImpl.java

@@ -106,4 +106,9 @@ public class SaleProductsServiceImpl implements ISaleProductsService
     {
         return saleProductsMapper.deleteSaleProductsById(id);
     }
+
+    @Override
+    public List<SaleProductsVo> selectOutboundOrderInfo(String saleOrderNo) {
+        return saleProductsMapper.selectOutboundOrderInfo(saleOrderNo);
+    }
 }

+ 11 - 4
zkqy-custom-business/src/main/resources/mapper/business/ProductCodeListMapper.xml

@@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="qrCode"    column="qr_code"    />
         <result property="lotNum"    column="lot_num"    />
         <result property="productId"    column="product_id"    />
+        <result property="productColour" column="product_colour"/>
         <result property="levels"    column="levels"    />
         <result property="canisterNum"    column="canister_num"    />
         <result property="boxNum"    column="box_num"    />
@@ -46,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="qrCode"    column="qr_code"    />
         <result property="lotNum"    column="lot_num"    />
         <result property="productId"    column="product_id"    />
+        <result property="productColour" column="product_colour"/>
         <result property="levels"    column="levels"    />
         <result property="canisterNum"    column="canister_num"    />
         <result property="boxNum"    column="box_num"    />
@@ -83,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <sql id="selectProductCodeListVo">
         select id, qr_code, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time ,
-               total_canister_num, total_box_num, total_suttle, total_gross_weight from {DBNAME}.product_code_list
+               total_canister_num, total_box_num, total_suttle, total_gross_weight,product_colour from {DBNAME}.product_code_list
     </sql>
 
     <select id="selectProductCodeListList" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO" resultMap="ProductCodeListResultVO">
@@ -91,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             pcl.* ,
             p.product_name as product_name,
             p.product_specifications as product_specifications,
-            p.product_color as product_color
+            pcl.product_colour as product_color
         FROM
             {DBNAME}.product_code_list pcl
         LEFT JOIN {DBNAME}.production p ON pcl.product_id = p.id
@@ -102,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="lotNum != null  and lotNum != ''"> and pcl.lot_num = #{lotNum}</if>
             <if test="productName != null and productName != ''"> and p.product_name = #{productName}</if>
             <if test="productSpecifications != null and productSpecifications != ''"> and p.product_specifications = #{productSpecifications}</if>
-            <if test="productColor != null and productColor != ''"> and p.product_color = #{productColor}</if>
+            <if test="productColor != null and productColor != ''"> and pcl.product_colour = #{productColor}</if>
     </select>
     
     <select id="selectProductCodeListById" parameterType="Long" resultMap="ProductCodeListResult">
@@ -142,6 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="totalBoxNum != null">total_box_num,</if>
             <if test="totalSuttle != null">total_suttle,</if>
             <if test="totalGrossWeight != null">total_gross_weight,</if>
+            <if test="productColour != null">product_colour,</if>
             del_flag
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -174,6 +177,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="totalBoxNum != null">#{totalBoxNum},</if>
             <if test="totalSuttle != null">#{totalSuttle},</if>
             <if test="totalGrossWeight != null">#{totalGrossWeight},</if>
+            <if test="productColour != null">#{productColour},</if>
             '0'
          </trim>
     </insert>
@@ -210,6 +214,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="totalBoxNum != null">total_box_num = #{totalBoxNum},</if>
             <if test="totalSuttle != null">total_suttle = #{totalSuttle},</if>
             <if test="totalGrossWeight != null">total_gross_weight = #{totalGrossWeight},</if>
+            <if test="productColour != null">product_colour = #{productColour},</if>
         </trim>
         where id = #{id}
     </update>
@@ -230,17 +235,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             sp.lot_number AS lotNum,
             p.product_name AS productName,
             p.product_specifications AS productSpecifications,
-            P.product_color AS productColor,
+            concat(ml.materie_encoding,ml.materie_color_number) AS productColor,
             p.id AS productId,
             sc.direction_of_twist AS directionOfTwist
         FROM
             {DBNAME}.sale_products sp
                 LEFT JOIN {DBNAME}.production p ON sp.product_no = p.product_no
                 LEFT JOIN {DBNAME}.sale_craft sc ON sp.sale_order_no = sc.sale_order_no
+                left join {DBNAME}.materiel ml on sp.colour_number = ml.materiel_code
         WHERE
             sp.del_flag = '0'
           AND p.del_flag = '0'
           AND sc.del_flag = '0'
+            and ml.del_flag = '0'
     </select>
 
     <select id="selectMaxCodeList" resultType="string">

+ 5 - 1
zkqy-custom-business/src/main/resources/mapper/business/ProductHandsetOutboundRecordMapper.xml

@@ -40,10 +40,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="depositor"    column="depositor"    />
         <result property="warehouseId"    column="warehouse_id"    />
         <result property="noticeNumber"    column="notice_number"    />
+        <result property="productColour" column="product_colour"/>
     </resultMap>
 
     <sql id="selectProductHandsetOutboundRecordVo">
-        select id, qr_code, qr_code_id, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, warehousing_time, depositor, warehouse_id, notice_number from {DBNAME}.product_handset_outbound_record
+        select id, qr_code, qr_code_id, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, warehousing_time, depositor, warehouse_id, notice_number,product_colour from {DBNAME}.product_handset_outbound_record
     </sql>
 
     <select id="selectProductHandsetOutboundRecordList" parameterType="com.zkqy.business.domain.ProductHandsetOutboundRecord" resultMap="ProductHandsetOutboundRecordResult">
@@ -116,6 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="depositor != null">depositor,</if>
             <if test="warehouseId != null">warehouse_id,</if>
             <if test="noticeNumber != null">notice_number,</if>
+            <if test="productColour != null">product_colour,</if>
             del_flag
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -149,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="depositor != null">#{depositor},</if>
             <if test="warehouseId != null">#{warehouseId},</if>
             <if test="noticeNumber != null">#{noticeNumber},</if>
+            <if test="productColour != null">#{productColour},</if>
             '0'
          </trim>
     </insert>
@@ -190,6 +193,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="depositor != null">depositor = #{depositor},</if>
             <if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
             <if test="noticeNumber != null">notice_number = #{noticeNumber},</if>
+            <if test="productColour != null">product_colour = #{productColour},</if>
         </trim>
         where id = #{id}
     </update>

+ 5 - 1
zkqy-custom-business/src/main/resources/mapper/business/ProductInventoryMapper.xml

@@ -40,10 +40,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="totalBoxNum"    column="total_box_num"    />
         <result property="totalSuttle"    column="total_suttle"    />
         <result property="totalGrossWeight"    column="total_gross_weight"    />
+        <result property="productColour" column="product_colour"/>
     </resultMap>
 
     <sql id="selectProductInventoryVo">
-        select id, qr_code, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, warehouse_id, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, total_canister_num, total_box_num, total_suttle, total_gross_weight from {DBNAME}.product_inventory
+        select id, qr_code, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, warehouse_id, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, total_canister_num, total_box_num, total_suttle, total_gross_weight,product_colour from {DBNAME}.product_inventory
     </sql>
 
     <select id="selectProductInventoryList" parameterType="com.zkqy.business.domain.ProductInventory" resultMap="ProductInventoryResult">
@@ -120,6 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="totalBoxNum != null">total_box_num,</if>
             <if test="totalSuttle != null">total_suttle,</if>
             <if test="totalGrossWeight != null">total_gross_weight,</if>
+            <if test="productColour != null">product_colour,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="qrCode != null">#{qrCode},</if>
@@ -156,6 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="totalBoxNum != null">#{totalBoxNum},</if>
             <if test="totalSuttle != null">#{totalSuttle},</if>
             <if test="totalGrossWeight != null">#{totalGrossWeight},</if>
+            <if test="productColour != null">#{productColour},</if>
          </trim>
     </insert>
 
@@ -196,6 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="totalBoxNum != null">total_box_num = #{totalBoxNum},</if>
             <if test="totalSuttle != null">total_suttle = #{totalSuttle},</if>
             <if test="totalGrossWeight != null">total_gross_weight = #{totalGrossWeight},</if>
+            <if test="productColour != null">product_colour = #{productColour},</if>
         </trim>
         where id = #{id}
     </update>

+ 8 - 3
zkqy-custom-business/src/main/resources/mapper/business/ProductInvoiceMapper.xml

@@ -36,10 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deliveryWarehouse" column="delivery_warehouse"/>
         <result property="transferWarehouse" column="transfer_warehouse"/>
         <result property="deliveryDate" column="deliveryDate"/>
+        <result property="deliveryClerk" column="delivery_clerk"/>
     </resultMap>
 
     <sql id="selectProductInvoiceVo">
-        select id, notice_number, notice_date, salesman, customer_id, drawer, dispatch_note_remark, billing_type, truck_registration, document_type, selling_unit, calculation_type, audit_opinion, status, sale_order_no, spare1, spare2, spare3, spare4, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, delivery_warehouse, transfer_warehouse, delivery_date from {DBNAME}.product_invoice
+        select id, notice_number, notice_date, salesman, customer_id, drawer, dispatch_note_remark, billing_type, truck_registration, document_type, selling_unit, calculation_type, audit_opinion, status, sale_order_no, spare1, spare2, spare3, spare4, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, delivery_warehouse, transfer_warehouse, delivery_date,delivery_clerk from {DBNAME}.product_invoice
     </sql>
 
     <select id="selectProductInvoiceList" parameterType="com.zkqy.business.domain.ProductInvoice" resultMap="ProductInvoiceResult">
@@ -58,7 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             AND c.del_flag = '0'
             <if test="noticeNumber != null  and noticeNumber != ''"> and pi.notice_number = #{noticeNumber}</if>
             <if test="noticeDate != null "> and pi.notice_date = #{noticeDate}</if>
-            <if test="customerId != null "> and p.customer_id = #{customerId}</if>
+            <if test="customerId != null "> and c.id = #{customerId}</if>
+            <if test="status != null and status != ''"> and pi.status = #{status}</if>
     </select>
     
     <select id="selectProductInvoiceById" parameterType="Long" resultMap="ProductInvoiceResult">
@@ -94,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deliveryWarehouse != null">delivery_warehouse,</if>
             <if test="transferWarehouse != null">transfer_warehouse,</if>
             <if test="deliveryDate != null">deliveryDate,</if>
+            <if test="deliveryClerk != null">delivery_clerk,</if>
             del_flag
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -122,6 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deliveryWarehouse != null">#{deliveryWarehouse},</if>
             <if test="transferWarehouse != null">#{transferWarehouse},</if>
             <if test="deliveryDate != null">#{deliveryDate},</if>
+            <if test="deliveryClerk != null">#{deliveryClerk},</if>
             '0'
          </trim>
     </insert>
@@ -153,7 +157,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="deliveryWarehouse != null">delivery_warehouse = #{deliveryWarehouse},</if>
             <if test="transferWarehouse != null">transfer_warehouse = #{transferWarehouse},</if>
-            <if test="deliveryDate != null">deliveryDate = #{deliveryDate},</if>
+            <if test="deliveryDate != null">delivery_date = #{deliveryDate},</if>
+            <if test="deliveryClerk != null">delivery_clerk = #{deliveryClerk},</if>
         </trim>
         where id = #{id}
     </update>

+ 7 - 2
zkqy-custom-business/src/main/resources/mapper/business/ProductOutboundRecordMapper.xml

@@ -40,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="depositor"    column="depositor"    />
         <result property="warehouseId"    column="warehouse_id"    />
         <result property="noticeNumber" column="notice_number"/>
+        <result property="productColour" column="product_colour"/>
     </resultMap>
 
     <resultMap type="com.zkqy.business.domain.vo.ProductCodeListVO" id="ProductCodeListResultVO">
@@ -83,10 +84,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="warehousingTime"    column="warehousing_time"    />
         <result property="depositor"    column="depositor"    />
         <result property="warehouseId" column="warehouse_id"/>
+        <result property="productColour" column="product_colour"/>
     </resultMap>
 
     <sql id="selectProductOutboundRecordVo">
-        select id, qr_code, qr_code_id, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, warehousing_time, depositor, warehouse_id,notice_number from {DBNAME}.product_outbound_record
+        select id, qr_code, qr_code_id, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, warehousing_time, depositor, warehouse_id,notice_number,product_colour from {DBNAME}.product_outbound_record
     </sql>
 
     <select id="selectProductOutboundRecordList" parameterType="com.zkqy.business.domain.ProductOutboundRecord" resultMap="ProductOutboundRecordResult">
@@ -158,6 +160,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="depositor != null">depositor,</if>
             <if test="warehouseId != null">warehouse_id,</if>
             <if test="noticeNumber != null">notice_number,</if>
+            <if test="productColour != null">product_colour,</if>
             del_flag
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -191,6 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="depositor != null">#{depositor},</if>
             <if test="warehouseId != null">#{warehouseId},</if>
             <if test="noticeNumber != null">#{noticeNumber},</if>
+            <if test="productColour != null">#{productColour},</if>
             '0'
          </trim>
     </insert>
@@ -228,6 +232,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="depositor != null">depositor = #{depositor},</if>
             <if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
             <if test="noticeNumber != null">notice_number = #{noticeNumber},</if>
+            <if test="productColour != null">product_colour = #{productColour},</if>
         </trim>
         where id = #{id}
     </update>
@@ -248,7 +253,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         r.qr_code,
         p.product_name,
         p.product_specifications,
-        p.product_color,
+        r.product_colour as product_color,
         r.lot_num,
         r.levels,
         r.packaging,

+ 7 - 2
zkqy-custom-business/src/main/resources/mapper/business/ProductWarehousingRecordMapper.xml

@@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="warehousingTime"    column="warehousing_time"    />
         <result property="depositor"    column="depositor"    />
         <result property="warehouseId" column="warehouse_id"/>
+        <result property="productColour" column="product_colour"/>
     </resultMap>
 
     <resultMap type="com.zkqy.business.domain.vo.ProductCodeListVO" id="ProductCodeListResultVO">
@@ -82,10 +83,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="warehousingTime"    column="warehousing_time"    />
         <result property="depositor"    column="depositor"    />
         <result property="warehouseId" column="warehouse_id"/>
+        <result property="productColour" column="product_colour"/>
     </resultMap>
 
     <sql id="selectProductWarehousingRecordVo">
-        select id, qr_code, qr_code_id, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, warehousing_time, depositor,warehouse_id from {DBNAME}.product_warehousing_record
+        select id, qr_code, qr_code_id, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, warehousing_time, depositor,warehouse_id,product_colour from {DBNAME}.product_warehousing_record
     </sql>
 
     <select id="selectProductWarehousingRecordList" parameterType="com.zkqy.business.domain.ProductWarehousingRecord" resultMap="ProductWarehousingRecordResult">
@@ -154,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="warehousingTime != null">warehousing_time,</if>
             <if test="depositor != null">depositor,</if>
             <if test="warehouseId != null">warehouse_id,</if>
+            <if test="productColour">product_colour,</if>
             del_flag
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -186,6 +189,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="warehousingTime != null">#{warehousingTime},</if>
             <if test="depositor != null">#{depositor},</if>
             <if test="warehouseId != null">#{warehouseId},</if>
+            <if test="productColour">#{productColour},</if>
             '0'
          </trim>
     </insert>
@@ -226,6 +230,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="warehousingTime != null">warehousing_time = #{warehousingTime},</if>
             <if test="depositor != null">depositor = #{depositor},</if>
             <if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
+            <if test="productColour">product_colour = #{productColour},</if>
         </trim>
         where id = #{id}
     </update>
@@ -246,7 +251,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             r.qr_code,
             p.product_name,
             p.product_specifications,
-            p.product_color,
+            r.product_colour as product_color,
             r.lot_num,
             r.levels,
             r.packaging,

+ 33 - 2
zkqy-custom-business/src/main/resources/mapper/business/SaleOrderMapper.xml

@@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectSaleOrderList" parameterType="com.zkqy.business.domain.SaleOrder" resultMap="SaleOrderResult">
         <include refid="selectSaleOrderVo"/>
-        <where>  
+        where del_flag = '0'
             <if test="saleNo != null  and saleNo != ''"> and sale_no = #{saleNo}</if>
             <if test="saleCustomNo != null  and saleCustomNo != ''"> and sale_custom_no = #{saleCustomNo}</if>
             <if test="saleDate != null  and saleDate != ''"> and sale_date = #{saleDate}</if>
@@ -71,7 +71,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="processKey != null  and processKey != ''"> and process_key = #{processKey}</if>
             <if test="earnestMoney != null  and earnestMoney != ''"> and earnest_money = #{earnestMoney}</if>
             <if test="deliveryDate != null  and deliveryDate != ''"> and delivery_date = #{deliveryDate}</if>
-        </where>
     </select>
     
     <select id="selectSaleOrderById" parameterType="Long" resultMap="SaleOrderResult">
@@ -248,4 +247,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND c.del_flag = '0'
     </select>
 
+    <select id="saleOrderList" resultType="com.zkqy.business.domain.vo.SaleOrderVO">
+        SELECT
+            so.id,
+            so.sale_no,
+            so.sale_date,
+            c.custom_name,
+            so.sale_order_estimated_time,
+            so.sale_lead_time,
+            so.sale_amount_in_words,
+            so.sale_pay_type,
+            so.salesman,
+            so.sale_leader,
+            so.finance,
+            so.production,
+            so.sale_approver,
+            so.status,
+            so.order_type
+        FROM
+            {DBNAME}.sale_order so left join {DBNAME}.customer c on so.sale_custom_no = c.custom_no
+        where so.del_flag = '0' and c.del_flag = '0'
+        <if test="queryParam != null and queryParam != ''">
+            AND CONCAT(
+                IFNULL( sale_order.sale_no, '' ),
+                IFNULL( customer.custom_name, '' ),
+                IFNULL( sale_order.sale_lead_time, '' ))
+                LIKE concat('%', #{queryParam}, '%')
+        </if>
+        <if test="createById != null "> and so.create_by_id = #{createById}</if>
+        <if test="orderType != null"> and so.order_type = #{orderType}</if>
+        order by so.id desc
+    </select>
+
 </mapper>

+ 21 - 2
zkqy-custom-business/src/main/resources/mapper/business/SaleProductsMapper.xml

@@ -285,19 +285,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     pt.product_specifications AS productSpecifications,
                     sp.lot_number AS lotNum,
                     sp.product_unit_price AS unitPrice,
-                    pt.product_color AS productColor,
+                    concat(ml.materie_encoding,ml.materie_color_number)  AS productColor,
                     pt.product_type AS productType,
-                    sp.remark,
+                    sp.remark AS productRemark,
                     sp.product_number AS actualWeight
                 FROM
                     {DBNAME}.sale_products sp
                         LEFT JOIN {DBNAME}.production pt ON sp.product_no = pt.product_no
+                    left join {DBNAME}.materiel ml on sp.colour_number = ml.materiel_code
                 WHERE
                     sp.del_flag = '0'
                   AND pt.del_flag = '0'
+                   and  ml.del_flag = '0'
                   AND sp.sale_order_no = #{saleOrderNo}
             ) AS a
                 LEFT JOIN {DBNAME}.product_inventory pi ON a.productId = pi.product_id
                 AND a.lotNum = pi.lot_num AND pi.del_flag = '0'
     </select>
+
+    <select id="selectOutboundOrderInfo" resultType="com.zkqy.business.domain.vo.SaleProductsVo">
+        SELECT
+            p.product_name as productName,
+            p.product_specifications as productSpecifications,
+            sp.lot_number as lotNumber,
+            sp.product_number as productNumber,
+            sp.product_unit_price as productUnitPrice,
+            sp.product_amounts as productAmounts
+        FROM
+            {DBNAME}.sale_products sp
+                LEFT JOIN {DBNAME}.production p ON sp.product_no = p.product_no
+        WHERE
+            sp.del_flag = '0'
+          AND p.del_flag = '0'
+          and sp.sale_order_no = #{saleOrderNo}
+    </select>
 </mapper>

+ 1 - 1
zkqy-system/src/main/java/com/zkqy/system/mapper/SysLogininforMapper.java

@@ -28,7 +28,7 @@ public interface SysLogininforMapper
      */
     public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor);
 
-    public List<Map> getLoginInformationStatistics(@Param("tenantId")String tenantId,@Param("whichApplication") String whichApplication);
+    public List<Map> getLoginInformationStatistics(@Param("tenantId") String tenantId,@Param("whichApplication") String whichApplication);
 
 
     /**

+ 47 - 0
zkqy-ui/src/router/index.js

@@ -63,6 +63,53 @@ export const constantRoutes = [
   // },
 
   {
+    path: '/redirect',
+    component: Layout,
+    hidden: true,
+    children: [
+      {
+        path: '/redirect/:path(.*)',
+        component: () => import('@/views/redirect')
+      }
+    ]
+   },
+   {
+      path: '/planTable/show/northWorkshop',
+      component: () => {
+        return import('@/views/orderMange/planTable/show/northWorkshop')
+      },
+      hidden: true
+    },
+  {
+    path: '/planTable/show/southWorkshop',
+    component: () => {
+      return import('@/views/orderMange/planTable/show/southWorkshop')
+    },
+    hidden: true
+  },
+    {
+      path: '/planTable/show/fankuang',
+      component: () => {
+        return import('@/views/orderMange/planTable/show/fankuang')
+      },
+      hidden: true
+    },
+    {
+      path: '/planTable/show/fangsi',
+      component: () => {
+        return import('@/views/orderMange/planTable/show/fangsi')
+      },
+      hidden: true
+    },
+    {
+      path: '/planTable/show/luotong',
+      component: () => {
+        return import('@/views/orderMange/planTable/show/luotong')
+      },
+      hidden: true
+    },
+
+   {
     path: '/tableMange',
     component: Layout,
     hidden: true,

+ 3 - 4
zkqy-ui/src/views/orderMange/planTable/index.vue

@@ -28,11 +28,10 @@
           <el-table-column prop="listOfPendingProduction" label="待生产产品列表" header-align="center" align="center"  >
             <template slot-scope="scope">
               <div v-if="scope.row.listOfPendingProduction">
-                <div v-for="(item, index) in scope.row.listOfPendingProduction.split(',')">
-                  {{ item }}
-                  <span v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1">,</span>
+                <span v-for="(item, index) in scope.row.listOfPendingProduction.split(',')">
+                  {{ item }},
                   <br v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1" />
-                </div>
+                </span>
               </div>
             </template>
           </el-table-column>

+ 645 - 0
zkqy-ui/src/views/orderMange/planTable/show/fangsi.vue

@@ -0,0 +1,645 @@
+<template>
+  <div class="app-container" style="width: 100%;">
+        <!--表格-->
+        <el-table
+          :data="tableData"
+          ref="tableRef">
+          <el-table-column prop="machineId" fixed label="线号" header-align="center" align="center" width="111px" ></el-table-column>
+          <el-table-column prop="productionDigit" fixed label="生产位数" header-align="center" align="center" width="111.2px"></el-table-column>
+          <el-table-column label="在机产品" header-align="center" >
+            <el-table-column prop="currentColorCode" label="色号" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="currentSpecification" label="规格" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="currentLotNumber" label="批号" header-align="center"  width="90px" align="center"></el-table-column>
+            <el-table-column prop="startTime" label="上机时间" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="plannedEndTime" label="下机时间" header-align="center" width="90px" align="center"></el-table-column>
+          </el-table-column>
+          <el-table-column prop="plannedProduction" label="待生产产品列表" header-align="center" align="center"  >
+<!--            <template v-slot:default="scope">-->
+<!--              <div v-if="scope.row.plannedProduction && scope.row.plannedProduction.length > 0">-->
+<!--                <div v-for="(chunk, chunkIndex) in splitList(scope.row.plannedProduction, 5)" :key="`chunk-${chunkIndex}`">-->
+<!--                  <span v-for="(item, index) in chunk" :key="`item-${chunkIndex}-${index}`">-->
+<!--                    {{ item }}, &lt;!&ndash; 替换为实际显示每个产品的代码 &ndash;&gt;-->
+<!--                  </span>-->
+<!--                </div>-->
+<!--              </div>-->
+<!--              <div v-else>-->
+
+<!--              </div>-->
+<!--            </template>-->
+          </el-table-column>
+<!--          <el-table-column   fixed="right" label="操作" header-align="center" align="center" width="150px" >-->
+<!--            <template v-slot:default="scope">-->
+<!--              <el-dropdown>-->
+<!--                <el-button type="primary">-->
+<!--                  操作-->
+<!--                  <i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+<!--                </el-button>-->
+<!--                <el-dropdown-menu slot="dropdown">-->
+<!--                  <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>-->
+<!--                  <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>-->
+<!--                </el-dropdown-menu>-->
+<!--              </el-dropdown>-->
+<!--            </template>-->
+<!--          </el-table-column>-->
+        </el-table>
+        <!--新增计划弹窗-->
+        <el-dialog title="新增计划"  :visible.sync="nanInsertDialogTableVisible" width="1200px">
+          <el-table :data="tableData2" @row-click.self="handleRowClick">
+<!--            <el-table-column prop="salesmanId" label="业务员" header-align="center" align="center" width="100px">-->
+<!--              <template v-slot:default="scope">-->
+<!--                <el-select  v-model="scope.row.salesmanId" placeholder="请选择业务员" @change="selectedSalesmanItem(scope.row,scope.row.salesmanId)">-->
+<!--                  <el-option v-for="salesmanItem in salesmanInfo" :key="salesmanItem.saleNo" :label="salesmanItem.salesman" :value="salesmanItem.saleNo" ></el-option>-->
+<!--                </el-select>-->
+<!--              </template>-->
+<!--            </el-table-column>-->
+            <el-table-column prop="productId" label="产品" header-align="center" align="center" width="150px">
+                <template v-slot:default="scope">
+                     <el-select  v-model="scope.row.productId" placeholder="请选择待排产产品" @change="selectedChangeDate(scope.row,scope.row.productId)">
+                           <el-option v-for="product in productsInfo" :key="product.id" :label="product.productName" :value="product.id" ></el-option>
+                     </el-select>
+                </template>
+            </el-table-column>
+
+            <el-table-column prop="currentColorCode" label="色号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing"  disabled="disabled"   v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentColorCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="productionDigit" label="生产位数" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.productionDigit" placeholder="请输入生产位数" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.productionDigit }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentSpecification" label="规格" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing"  disabled="disabled"  v-model="scope.row.currentSpecification" placeholder="请输入规格" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentSpecification }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentLotNumber" label="批号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" :disabled="isDisabled"  v-model="scope.row.currentLotNumber" placeholder="请输入批号" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.currentLotNumber }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="djNumber" label="数量" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.number" placeholder="请输入数量" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.number }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="startTime" label="上机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" placeholder="请输入上机时间" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.startTime }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="plannedEndTime" label="计划下机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" placeholder="请输入计划下机时间" @blur="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.plannedEndTime }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
+              <template v-slot:default="scope">
+                <el-select  v-model="scope.row.planStatus" placeholder="请选择业务员" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                  <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" align="center">
+              <template slot-scope="scope">
+                <el-button
+                  size="mini"
+                  type="danger"
+                  @click.stop.prevent="handleDelete(scope.$index, scope.row)">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <el-button type="primary" style="width: 100%;margin-top: 30px"  @click="addEditableRow">新增计划产品</el-button>
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="nanInsertDialogTableVisible = false">取 消</el-button>
+            <el-button type="primary" @click="addPlanInfo">确 定</el-button>
+           </span>
+        </el-dialog>
+        <!--修改计划弹窗-->
+        <el-dialog title="修改计划"  :visible.sync="nanUpdateDialogTableVisible" width="1200px">
+           <!--查询条件-->
+          <el-form ref="form"  :model="formData" label-width="80px" :inline="true">
+              <el-form-item label="计划状态:">
+                <el-select v-model="formData.planStatus" placeholder="请选择计划状态">
+                  <el-option v-for="stateListItem in stateList2" :key="product.id" :label="stateListItem.name" :value="stateListItem.id" ></el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" @click="onSubmit">查询</el-button>
+                <el-button @click="reset">重置</el-button>
+              </el-form-item>
+          </el-form>
+          <!--表格-->
+          <el-table :data="tableData2" @row-click.self="handleRowClick">
+<!--            <el-table-column prop="salesmanId" label="业务员" header-align="center" align="center" width="100px">-->
+<!--              <template v-slot:default="scope">-->
+<!--                <el-select  :ref="'salesmanSelect'+scope.$index"  v-model="scope.row.salesmanId" placeholder="请选择业务员" @change="selectedSalesmanItem(scope.row,scope.row.salesmanId,scope.$index)">-->
+<!--                  <el-option v-for="salesmanItem in salesmanInfo" :key="salesmanItem.saleNo" :label="salesmanItem.salesman" :value="salesmanItem.saleNo" ></el-option>-->
+<!--                </el-select>-->
+<!--              </template>-->
+<!--            </el-table-column>-->
+            <el-table-column prop="productId" label="产品" header-align="center" align="center" width="150px">
+              <template v-slot:default="scope">
+                <el-select  :ref="'productSelected'+scope.$index" v-model="scope.row.productId" placeholder="请选择待排产产品" @change="selectedChangeDate(scope.row,scope.row.productId)">
+                  <el-option v-for="product in productsInfo" :key="product.id" :label="product.productName" :value="product.id" ></el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column prop="productionDigit" label="生产位数" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.productionDigit" placeholder="请输入生产位数" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.productionDigit }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentColorCode" label="色号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing"  disabled="disabled"  v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentColorCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentSpecification" label="规格" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing" :disabled="false" v-model="scope.row.currentSpecification" placeholder="请输入规格" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentSpecification }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentLotNumber" label="批号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing"   v-model="scope.row.currentLotNumber" placeholder="请输入批号" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.currentLotNumber }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="startTime" label="上机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" placeholder="请输入上机时间" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.startTime }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="plannedEndTime" label="计划下机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" placeholder="请输入计划下机时间" @blur="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.plannedEndTime }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
+              <template v-slot:default="scope">
+                <!--上机变停机待机-->
+                <el-select v-if="scope.row.planStatus==1" v-model="scope.row.planStatus" placeholder="计划状态">
+                  <el-option v-for="stateItem in stateList1" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+                <!--待机可以上机-->
+                <el-select v-if="scope.row.planStatus==0" v-model="scope.row.planStatus" placeholder="计划状态">
+                  <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+                <!--停机变上机-->
+                <el-select v-if="scope.row.planStatus==2" v-model="scope.row.planStatus" placeholder="计划状态">
+                  <el-option v-for="stateItem in stateList2" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+                <!--已完成-->
+                <el-select v-if="scope.row.planStatus==3" v-model="scope.row.planStatus" placeholder="计划状态">
+                  <el-option v-for="stateItem in stateList3" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" align="center">
+              <template v-slot:default="scope">
+                <el-button
+                  size="mini"
+                  type="danger"
+                  @click.stop.prevent="updateStatus(scope.$index, scope.row,scope.row.planStatus)">更新状态{{scope.row.planStatus}}</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <!--按钮信息-->
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="nanUpdateDialogTableVisible = false">取 消</el-button>
+            <el-button type="primary" @click="nanUpdateDialogTableVisible = false">确 定</el-button>
+           </span>
+        </el-dialog>
+  </div>
+</template>
+<script>
+import {
+  getProductsInfo,
+  getMaterielInfo,
+  getSalesman,
+  getSpinningPlanList,
+  addSpinningPlanList,
+  getPlanSpinningInfo,
+  updateSpinningInfoPlanOne
+} from "@/api/plan/paln.js";
+export default {
+  data() {
+    return {
+      //
+      isDisabled:true,
+      //选中的是那个车间
+      tableData:[],
+      form: {
+        product:"",
+      },
+      previousMachineId: undefined,
+      currentRowspan: 1,
+      prevRow: {},
+      tableData2: [],
+      tableDataStatus: [],
+      nanInsertDialogTableVisible:false,
+      nanUpdateDialogTableVisible:false,
+      beiInsertDialogTableVisible:false,
+      beiUpdateDialogTableVisible:false,
+      editingRowIndex: -1,
+      lastEditLine:0,
+      isEditLine:false,
+      productsInfo:[],
+      salesmanInfo:[],
+      product:{},
+      materiel:{},
+      //机台号
+      machineId:"",
+      // 待机/上机/停产
+      stateList0:[
+        {"id":0,"name":"待机"},
+        {"id":1,"name":"上机"},
+      ],
+      stateList1:[
+        {"id":0,"name":"待机"},
+        {"id":2,"name":"停机"},
+        {"id":1,"name":"上机"},
+        {"id":3,"name":"已完成"},
+      ],
+      stateList2:[
+        {"id":0,"name":"待机"},
+        {"id":2,"name":"停机"},
+        {"id":1,"name":"上机"},
+      ],
+      stateList3:[
+        {"id":3,"name":"已完成"},
+      ],
+      formData:{
+        updateSelectedProductCategory:"",
+        updateSelectedProductState:""
+      },
+    }
+  },
+  mounted() {
+    // 得到排产计划信息
+    this.getSpinningPlanList();
+    //业务员信息
+    // this.getSalesman();
+    //得到排产产品信息
+
+  },
+  methods: {
+    //五个显示为一排
+    splitList(list, chunkSize) {
+      const chunks = [];
+      for (let i = 0; i < list.length; i += chunkSize) {
+        chunks.push(list.slice(i, i + chunkSize));
+      }
+      return chunks;
+    },
+    // 查询排产信息
+    getSpinningPlanList() {
+      getSpinningPlanList({"productionLineDepartment":"纺丝部"}).then((response) => {
+        this.tableData = response.rows
+      });
+    },
+    // //查询产品的业务员信息
+    // getSalesman() {
+    //   getSalesman().then((response) => {
+    //     this.salesmanInfo = response.data;
+    //   })
+    // },
+    // //业务员下拉框切换调用的函数
+    // selectedSalesmanItem(row,saleNo,index){
+    //   this.getProductsInfo(saleNo,index);
+    // },
+    // //待投产的产品数据
+    // getProductsInfo(saleNo,sy) {
+    //   getProductsInfo(saleNo,sy).then((response) => {
+    //     this.productsInfo = response.data;
+    //     this.productsInfo.forEach(item => {
+    //       item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+    //     });
+    //   })
+    // },
+    getProductsInfo() {
+      getProductsInfo().then((response) => {
+        this.productsInfo = response.data;
+        console.log(this.productsInfo,"产品信息")
+        this.productsInfo.forEach(item => {
+          item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+        });
+      })
+    },
+    // 下拉框数据改变查询色号批号信息
+    selectedChangeDate(row,selectedProduct) {
+      //选择的那个销售产品
+      this.product = this.productsInfo.find(product => product.id === selectedProduct);
+      //得到选择的商品
+      this.form.product=selectedProduct;
+      //通过母粒编码查询到对应的母粒信息
+      let queryParams = {
+        "materielCode": this.product.colourNumber
+      }
+      //得到对应的母粒信息
+      getMaterielInfo(queryParams).then((response) => {
+        if (response.data!=null) {
+          this.materiel = response.data;
+          console.log(response.data,"规格")
+          //色号 母粒编码+色号
+          row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
+        }
+      });
+      //isDisabled(有批号就用,没批号就自己输入)
+      if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
+        row.currentLotNumber=this.product.lotNumber;
+        this.isDisabled=true;
+      }else {
+        this.isDisabled=false;
+      }
+      //产品规格
+      row.currentSpecification= this.product.productSpecifications;
+      //合同号--销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
+      row.salesmanId=this.product.saleOrderNo;
+    },
+    // 新增计划产品信息
+    handleAddPlan(row) {
+      this.getProductsInfo();
+      this.nanInsertDialogTableVisible = true
+      this.tableData2=[]
+      //先清空
+      this.machineId=""
+      //当前操作机台号
+      this.machineId=row.machineId;
+    },
+    // 删除行
+    handleDelete(index, row) {
+      // console.log(index,row)
+      // this.tableData2[a];
+      this.tableData2.splice(index, 1);
+      // 把上一编辑行置回-1
+      this.editingRowIndex = -1;
+    },
+    // 点击编辑行
+    handleRowClick(row) {
+      this.isEditLine = true;
+      //找到当前行的编辑索引
+      var rowIndex = this.tableData2.indexOf(row);
+      if (this.lastEditLine != 0 &&
+        this.editingRowIndex !== rowIndex &&
+        this.editingRowIndex !== -1 &&
+        !this.isRowFilled(this.tableData2[this.lastEditLine])) {
+        this.$message({
+          message: '请先完成上一条数据的填写',
+          type: 'warning'
+        });
+        return;
+      }
+      //编辑索引不等于当前编辑行索引
+      if (this.editingRowIndex !== rowIndex) {
+        // alert(this.editingRowIndex);
+        if (this.editingRowIndex !== -1) {
+          //把当前行变成不可编辑的
+          this.tableData2[this.editingRowIndex].isEditing = false;
+        }
+        //把当前行变成可编辑的
+        row.isEditing = true;
+        this.editingRowIndex = rowIndex;
+      }
+
+    },
+    // 光标失去焦点变成不可编辑
+    handleInputBlur(row) {
+      let rowIndex = this.tableData2.indexOf(row);
+      //编辑索引不等于当前编辑行索引
+      if (this.editingRowIndex !== rowIndex) {
+        if (this.isRowFilled(row)) {
+          row.isEditing = false;
+          //对于整个表格来说
+          this.isEditLine = false;
+          //当前编辑行置为-1
+          this.editingRowIndex = -1;
+        }
+      }
+    },
+    // 检查行是否填写完毕的示例方法
+    isRowFilled(row) {
+      return row.currentSpecification && row.productionDigit && row.startTime && row.plannedEndTime;
+    },
+    // 新增一行标记为可编辑
+    addEditableRow() {
+      this.getProductsInfo();
+      // 检查当前编辑行是否已填写完毕
+      if(this.tableData2.length!=0){
+        if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
+          this.$message({
+            message: '请先完成上一条数据的填写',
+            type: 'warning'
+          });
+          return;
+        }
+        //新增行之前先让以前的行不能编辑
+        this.tableData2.forEach(item => {
+          item.isEditing = false;
+        })
+      }
+      this.tableData2.push({
+        currentColorCode: '',
+        currentSpecification: '',
+        currentLotNumber: '',
+        productionDigit: '',
+        startTime: '',
+        plannedEndTime:'',
+        planStatus:0,
+        productId:'',
+        salesmanId:'',
+        isEditing: true // 标记为正在编辑状态
+      });
+      this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
+      this.lastEditLine = this.tableData2.length - 1
+    },
+    // 添加计划
+    addPlanInfo(){
+      const datatime=Date.now()+this.machineId;
+      //先查询计划表中有没有正在上机的
+      getPlanSpinningInfo({"machineId":this.machineId,"planStatus":1}).then(response => {
+          let i=0
+          //处理表格数据
+          this.tableData2.forEach(item=>{
+            item.timestampRandomCode=datatime;
+            item.machineId=this.machineId;
+            if(item.planStatus==1){
+              i++
+            }
+          })
+          if(i>=1&&response.data.length>0){
+            this.$message({
+              message: '只能有一个产品的状态为上机',
+              type: 'warning'
+            });
+            return;
+          }else {
+            //添加计划信息
+            addSpinningPlanList(this.tableData2).then(response => {
+              if (response.code == 200) {
+                this.$message({
+                  message: '添加成功',
+                  type: 'success'
+                });
+                this.getSpinningPlanList();
+                //最后把弹窗关掉
+                this.nanInsertDialogTableVisible=false
+              } else {
+                this.$message({
+                  message: '添加失败',
+                  type: 'error'
+                });
+                //最后把弹窗关掉
+                this.nanInsertDialogTableVisible=false
+              }
+            });
+          }
+      });
+    },
+    // 修改产品计划
+    handleEditPlan(row) {
+      this.getProductsInfo();
+      //当前操作机台号
+      this.machineId=row.machineId;
+      this.tableData2=[];
+      //弹窗
+      this.nanUpdateDialogTableVisible = true
+      getPlanSpinningInfo({"machineId":row.machineId}).then((response) => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+          item.productId=parseInt(item.productId)
+        })
+        this.tableData2=response.data;
+        console.log( this.tableData2)
+        // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
+        // this.$nextTick(() => {
+        //   // 获取第一个业务员选择框(假设表格只有一行)
+        //   this.tableDataStatus=[];
+        //   for (let i = 0; i < this.tableData2.length; i++) {
+        //     const firstSalesmanSelect = this.$refs['salesmanSelect'+i];
+        //     this.tableDataStatus.push({"index":i,"planStatus":this.tableData2[i].planStatus})
+        //     // console.log(firstSalesmanSelect,11111111)
+        //     // 触发 change 事件
+        //     if (firstSalesmanSelect) {
+        //       firstSalesmanSelect.$emit('change', {
+        //         target: {value: "ddd"},
+        //       });
+        //     }
+        //   }
+        //
+        // });
+      })
+    },
+    //弹窗里边的点击查询
+    onSubmit(){
+      this.formData.machineId=this.machineId;
+      getPlanSpinningInfo(this.formData).then(response => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+        })
+        this.tableData2=response.data;
+      });
+    },
+    //重置
+    reset(){
+      getPlanSpinningInfo({"machineId":this.machineId}).then(response => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+        })
+        this.tableData2=response.data;
+      });
+    },
+    //更新状态
+    updateStatus(ind, row,planStatus){
+      //先查询计划表中有没有正在上机的
+      getPlanSpinningInfo({"machineId":this.machineId,"planStatus":planStatus}).then(response => {
+        let i=0
+        //处理表格数据
+        this.tableData2.forEach(item=>{
+          item.machineId=this.machineId;
+          if(item.planStatus==1){
+            i++
+          }
+        })
+        if(i>=1&&response.data.length>0){
+          this.$message({
+            message: '只能有一个产品的状态为上机',
+            type: 'warning'
+          });
+          row.planStatus=planStatus;
+          return;
+        }else {
+          updateSpinningInfoPlanOne(row).then(response=>{
+            if (response.code == 200) {
+              this.$message({
+                message: '修改成功',
+                type: 'success'
+              });
+              this.getSpinningPlanList();
+              //最后把弹窗关掉
+              this.nanInsertDialogTableVisible=false
+            } else {
+              this.$message({
+                message: '修改失败',
+                type: 'error'
+              });
+              //最后把弹窗关掉
+              this.nanInsertDialogTableVisible=false
+            }
+          })
+        }
+      });
+
+    }
+  },
+  computed: {
+
+  },
+}
+</script>
+
+<style scoped>
+.el-tabs--border-card >>> .el-tabs__content {
+  padding: 0 !important;
+}
+.el-table__body-wrapper {
+  cursor: grab;
+}
+.el-table__body-wrapper.grabbing {
+  cursor: grabbing;
+}
+</style>

+ 663 - 0
zkqy-ui/src/views/orderMange/planTable/show/fankuang.vue

@@ -0,0 +1,663 @@
+<template>
+  <div class="app-container" style="width: 100%;">
+        <!--表格-->
+        <el-table
+          :data="tableData"
+          ref="tableRef">
+          <el-table-column prop="machineId" fixed label="机台号" header-align="center" align="center" width="111px" ></el-table-column>
+          <el-table-column prop="productionDigit" fixed label="生产位数" header-align="center" align="center" width="111.2px"></el-table-column>
+          <el-table-column label="在机产品" header-align="center" >
+            <el-table-column prop="currentColorCode" label="色号" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="currentSpecification" label="规格" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="currentLotNumber" label="批号" header-align="center"  width="90px" align="center"></el-table-column>
+            <el-table-column prop="startTime" label="上机时间" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="plannedEndTime" label="下机时间" header-align="center" width="90px" align="center"></el-table-column>
+          </el-table-column>
+          <el-table-column prop="plannedProduction" label="待生产产品列表" header-align="center" align="center"  >
+<!--            <template v-slot:default="scope">-->
+<!--              <div v-if="scope.row.plannedProduction && scope.row.plannedProduction.length > 0">-->
+<!--                <div v-for="(chunk, chunkIndex) in splitList(scope.row.plannedProduction, 5)" :key="`chunk-${chunkIndex}`">-->
+<!--                  <span v-for="(item, index) in chunk" :key="`item-${chunkIndex}-${index}`">-->
+<!--                    {{ item }}, &lt;!&ndash; 替换为实际显示每个产品的代码 &ndash;&gt;-->
+<!--                  </span>-->
+<!--                </div>-->
+<!--              </div>-->
+<!--              <div v-else>-->
+
+<!--              </div>-->
+<!--            </template>-->
+          </el-table-column>
+          <el-table-column   fixed="right" label="操作" header-align="center" align="center" width="150px" >
+            <template v-slot:default="scope">
+              <el-dropdown>
+                <el-button type="primary">
+                  操作
+                  <i class="el-icon-arrow-down el-icon--right"></i>
+                </el-button>
+                <el-dropdown-menu slot="dropdown">
+                  <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>
+                  <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>
+                </el-dropdown-menu>
+              </el-dropdown>
+            </template>
+          </el-table-column>
+        </el-table>
+        <!--新增计划弹窗-->
+        <el-dialog title="新增计划"  :visible.sync="nanInsertDialogTableVisible" width="1200px">
+          <el-table :data="tableData2" @row-click.self="handleRowClick">
+<!--            <el-table-column prop="salesmanId" label="业务员" header-align="center" align="center" width="100px">-->
+<!--              <template v-slot:default="scope">-->
+<!--                <el-select  v-model="scope.row.salesmanId" placeholder="请选择业务员" @change="selectedSalesmanItem(scope.row,scope.row.salesmanId)">-->
+<!--                  <el-option v-for="salesmanItem in salesmanInfo" :key="salesmanItem.saleNo" :label="salesmanItem.salesman" :value="salesmanItem.saleNo" ></el-option>-->
+<!--                </el-select>-->
+<!--              </template>-->
+<!--            </el-table-column>-->
+            <el-table-column prop="productId" label="产品" header-align="center" align="center" width="150px">
+                <template v-slot:default="scope">
+                     <el-select  v-model="scope.row.productId" placeholder="请选择待排产产品" @change="selectedChangeDate(scope.row,scope.row.productId)">
+                           <el-option v-for="product in productsInfo" :key="product.id" :label="product.productName" :value="product.id" ></el-option>
+                     </el-select>
+                </template>
+            </el-table-column>
+
+            <el-table-column prop="currentColorCode" label="色号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing"  disabled="disabled"  v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentColorCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="productionDigit" label="生产位数" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.productionDigit" placeholder="请输入生产位数" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.productionDigit }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentSpecification" label="规格" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentSpecification" placeholder="请输入规格" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentSpecification }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentLotNumber" label="批号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" :disabled="isDisabled" v-model="scope.row.currentLotNumber" placeholder="请输入批号" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.currentLotNumber }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="djNumber" label="数量" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.number" placeholder="请输入数量" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.number }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="startTime" label="上机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" placeholder="请输入上机时间" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.startTime }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="plannedEndTime" label="计划下机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" placeholder="请输入计划下机时间" @blur="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.plannedEndTime }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
+              <template v-slot:default="scope">
+                <el-select  v-model="scope.row.planStatus" placeholder="请选择计划状态">
+                  <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" align="center">
+              <template slot-scope="scope">
+                <el-button
+                  size="mini"
+                  type="danger"
+                  @click.stop.prevent="handleDelete(scope.$index, scope.row)">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <el-button type="primary" style="width: 100%;margin-top: 30px"  @click="addEditableRow">新增计划产品</el-button>
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="nanInsertDialogTableVisible = false">取 消</el-button>
+            <el-button type="primary" @click="addPlanInfo">确 定</el-button>
+           </span>
+        </el-dialog>
+        <!--修改计划弹窗-->
+        <el-dialog title="修改计划"  :visible.sync="nanUpdateDialogTableVisible" width="1200px">
+           <!--查询条件-->
+          <el-form ref="form"  :model="formData" label-width="80px" :inline="true">
+              <el-form-item label="计划状态:">
+                <el-select v-model="formData.planStatus" placeholder="请选择计划状态">
+                  <el-option v-for="stateListItem in stateList2" :key="product.id" :label="stateListItem.name" :value="stateListItem.id" ></el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" @click="onSubmit">查询</el-button>
+                <el-button @click="reset">重置</el-button>
+              </el-form-item>
+          </el-form>
+          <!--表格-->
+          <el-table :data="tableData2" @row-click.self="handleRowClick">
+<!--            <el-table-column prop="salesmanId" label="业务员" header-align="center" align="center" width="100px">-->
+<!--              <template v-slot:default="scope">-->
+<!--                <el-select  :ref="'salesmanSelect'+scope.$index"  v-model="scope.row.salesmanId" placeholder="请选择业务员" @change="selectedSalesmanItem(scope.row,scope.row.salesmanId,scope.$index)">-->
+<!--                  <el-option v-for="salesmanItem in salesmanInfo" :key="salesmanItem.saleNo" :label="salesmanItem.salesman" :value="salesmanItem.saleNo" ></el-option>-->
+<!--                </el-select>-->
+<!--              </template>-->
+<!--            </el-table-column>-->
+            <el-table-column prop="productId" label="产品" header-align="center" align="center" width="150px">
+              <template v-slot:default="scope">
+                <el-select  :ref="'productSelected'+scope.$index" v-model="scope.row.productId" placeholder="请选择待排产产品" @change="selectedChangeDate(scope.row,scope.row.productId)">
+                  <el-option v-for="product in productsInfo" :key="product.id" :label="product.productName" :value="product.id" ></el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column prop="productionDigit" label="生产位数" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.productionDigit" placeholder="请输入生产位数" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.productionDigit }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentColorCode" label="色号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing"  disabled="disabled"  v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentColorCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="weishu" label="位数" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing"   v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentColorCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentSpecification"  label="规格" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing"  disabled="disabled" v-model="scope.row.currentSpecification" placeholder="请输入规格" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentSpecification }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentLotNumber" label="批号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.currentLotNumber" placeholder="请输入批号" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.currentLotNumber }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="startTime" label="上机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" placeholder="请输入上机时间" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.startTime }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="plannedEndTime" label="计划下机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" placeholder="请输入计划下机时间" @blur="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.plannedEndTime }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
+              <template v-slot:default="scope">
+                <!--上机变停机待机-->
+                <el-select v-if="scope.row.planStatus==1" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                  <el-option v-for="stateItem in stateList1" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+                <!--待机可以上机-->
+                <el-select v-if="scope.row.planStatus==0" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                  <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+                <!--停机变上机-->
+                <el-select v-if="scope.row.planStatus==2" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                  <el-option v-for="stateItem in stateList2" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+                <!--已完成-->
+                <el-select v-if="scope.row.planStatus==3" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                  <el-option v-for="stateItem in stateList3" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" align="center">
+              <template v-slot:default="scope">
+                <el-button
+                  size="mini"
+                  type="danger"
+                  @click.stop.prevent="updateStatus(scope.$index, scope.row,scope.row.planStatus)">更新状态{{scope.row.planStatus}}</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="nanUpdateDialogTableVisible = false">取 消</el-button>
+            <el-button type="primary" @click="nanUpdateDialogTableVisible = false">确 定</el-button>
+           </span>
+        </el-dialog>
+  </div>
+</template>
+<script>
+import {
+  getProductsInfo,
+  getMaterielInfo,
+  getSalesman,
+  getSpinningPlanList,
+  addSpinningPlanList,
+  getPlanSpinningInfo,
+  updateSpinningInfoPlanOne
+} from "@/api/plan/paln.js";
+export default {
+  data() {
+    return {
+      //
+      isDisabled:true,
+      //选中的是那个车间
+      tableData:[],
+      form: {
+        product:"",
+      },
+      previousMachineId: undefined,
+      currentRowspan: 1,
+      prevRow: {},
+      tableData2: [],
+      tableDataStatus: [],
+      nanInsertDialogTableVisible:false,
+      nanUpdateDialogTableVisible:false,
+      beiInsertDialogTableVisible:false,
+      beiUpdateDialogTableVisible:false,
+      editingRowIndex: -1,
+      lastEditLine:0,
+      isEditLine:false,
+      productsInfo:[],
+      salesmanInfo:[],
+      product:{},
+      materiel:{},
+      //机台号
+      machineId:"",
+      // 待机/上机/停产
+      stateList0:[
+        {"id":0,"name":"待机"},
+        {"id":1,"name":"上机"},
+      ],
+      stateList1:[
+        {"id":0,"name":"待机"},
+        {"id":1,"name":"上机"},
+        {"id":2,"name":"停机"},
+        {"id":3,"name":"已完成"},
+      ],
+      stateList2:[
+        {"id":0,"name":"待机"},
+        {"id":2,"name":"停机"},
+        {"id":1,"name":"上机"},
+      ],
+      stateList3:[
+        {"id":3,"name":"已完成"},
+      ],
+      formData:{
+        updateSelectedProductCategory:"",
+        updateSelectedProductState:""
+      },
+    }
+  },
+  mounted() {
+    // 得到排产计划信息
+    this.getSpinningPlanList();
+    // this.getSalesman();
+    this.getProductsInfo();
+  },
+  methods: {
+    //五个显示为一排
+    splitList(list, chunkSize) {
+      const chunks = [];
+      for (let i = 0; i < list.length; i += chunkSize) {
+        chunks.push(list.slice(i, i + chunkSize));
+      }
+      return chunks;
+    },
+    // 查询排产信息
+    getSpinningPlanList() {
+      getSpinningPlanList({"productionLineDepartment":"翻框部"}).then((response) => {
+        this.tableData = response.rows
+      });
+    },
+    // //查询产品的业务员信息
+    // getSalesman() {
+    //   getSalesman().then((response) => {
+    //     this.salesmanInfo = response.data;
+    //   })
+    // },
+    // //业务员下拉框切换调用的函数
+    // selectedSalesmanItem(row,saleNo,index){
+    //   console.log("ccc",index)
+    //   this.getProductsInfo(saleNo,index);
+    // },
+    // //待投产的产品数据
+    // getProductsInfo(saleNo,sy) {
+    //   getProductsInfo(saleNo,sy).then((response) => {
+    //     this.productsInfo = response.data;
+    //     this.productsInfo.forEach(item => {
+    //       item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+    //     });
+    //   })
+    // },
+    getProductsInfo() {
+      console.log("ddddddddddddddddddddddd")
+      getProductsInfo().then((response) => {
+        this.productsInfo = response.data;
+        this.productsInfo.forEach(item => {
+          item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+        });
+      })
+    },
+    // 下拉框数据改变查询色号批号信息
+    selectedChangeDate(row,selectedProduct) {
+      //选择的那个销售产品
+      console.log(this.productsInfo,"hhhhhh")
+      this.product = this.productsInfo.find(product => product.id === selectedProduct);
+      //选择的那个产品
+      this.form.product=selectedProduct;
+
+      //通过母粒编码查询到对应的母粒信息
+      let queryParams = {
+        "materielCode": this.product.colourNumber
+      }
+      //得到对应的母粒信息
+      getMaterielInfo(queryParams).then((response) => {
+        if (response.data!=null) {
+          this.materiel = response.data;
+          //色号 母粒编码+色号
+          row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
+        }
+      });
+      //isDisabled(有批号就用,没批号就自己输入)
+      if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
+        row.currentLotNumber=this.product.lotNumber;
+        this.isDisabled=true;
+      }else {
+        this.isDisabled=false;
+      }
+      //产品规格
+      row.currentSpecification= this.product.productSpecifications;
+      //合同号--销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
+      row.salesmanId=this.product.saleOrderNo;
+    },
+    // 新增计划产品信息
+    handleAddPlan(row) {
+      this.getProductsInfo();
+      this.nanInsertDialogTableVisible = true
+      this.tableData2=[]
+      //先清空
+      this.machineId=""
+      //当前操作机台号
+      this.machineId=row.machineId;
+    },
+    // 删除行
+    handleDelete(index, row) {
+      // console.log(index,row)
+      // this.tableData2[a];
+      this.tableData2.splice(index, 1);
+      // 把上一编辑行置回-1
+      this.editingRowIndex = -1;
+    },
+    // 点击编辑行
+    handleRowClick(row) {
+      this.isEditLine = true;
+      //找到当前行的编辑索引
+      var rowIndex = this.tableData2.indexOf(row);
+      if (this.lastEditLine != 0 &&
+        this.editingRowIndex !== rowIndex &&
+        this.editingRowIndex !== -1 &&
+        !this.isRowFilled(this.tableData2[this.lastEditLine])) {
+        this.$message({
+          message: '请先完成上一条数据的填写',
+          type: 'warning'
+        });
+        return;
+      }
+      //编辑索引不等于当前编辑行索引
+      if (this.editingRowIndex !== rowIndex) {
+        // alert(this.editingRowIndex);
+        if (this.editingRowIndex !== -1) {
+          //把当前行变成不可编辑的
+          this.tableData2[this.editingRowIndex].isEditing = false;
+        }
+        //把当前行变成可编辑的
+        row.isEditing = true;
+        this.editingRowIndex = rowIndex;
+      }
+
+    },
+    // 光标失去焦点变成不可编辑
+    handleInputBlur(row) {
+      let rowIndex = this.tableData2.indexOf(row);
+      //编辑索引不等于当前编辑行索引
+      if (this.editingRowIndex !== rowIndex) {
+        if (this.isRowFilled(row)) {
+          row.isEditing = false;
+          //对于整个表格来说
+          this.isEditLine = false;
+          //当前编辑行置为-1
+          this.editingRowIndex = -1;
+        }
+      }
+    },
+    // 检查行是否填写完毕的示例方法
+    isRowFilled(row) {
+      return row.currentSpecification && row.productionDigit && row.startTime && row.plannedEndTime;
+    },
+    // 新增一行标记为可编辑
+    addEditableRow() {
+      // 检查当前编辑行是否已填写完毕
+      if(this.tableData2.length!=0){
+        if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
+          this.$message({
+            message: '请先完成上一条数据的填写',
+            type: 'warning'
+          });
+          return;
+        }
+        //新增行之前先让以前的行不能编辑
+        this.tableData2.forEach(item => {
+          item.isEditing = false;
+        })
+      }
+      this.tableData2.push({
+        currentColorCode: '',
+        currentSpecification: '',
+        currentLotNumber: '',
+        productionDigit: '',
+        startTime: '',
+        plannedEndTime:'',
+        planStatus:0,
+        productId:'',
+        salesmanId:'',
+        isEditing: true // 标记为正在编辑状态
+      });
+      this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
+      this.lastEditLine = this.tableData2.length - 1
+    },
+    // 添加计划
+    addPlanInfo(){
+      const datatime=Date.now()+this.machineId;
+      //先查询计划表中有没有正在上机的
+      getPlanSpinningInfo({"machineId":this.machineId,"planStatus":1}).then(response => {
+          let i=0
+          //处理表格数据
+          this.tableData2.forEach(item=>{
+            item.timestampRandomCode=datatime;
+            item.machineId=this.machineId;
+            if(item.planStatus==1){
+              i++
+            }
+          })
+          if(i>=1&&response.data.length>0){
+            this.$message({
+              message: '只能有一个产品的状态为上机',
+              type: 'warning'
+            });
+            return;
+          }else {
+            //添加计划信息
+            addSpinningPlanList(this.tableData2).then(response => {
+              if (response.code == 200) {
+                this.$message({
+                  message: '添加成功',
+                  type: 'success'
+                });
+                this.getSpinningPlanList();
+                //最后把弹窗关掉
+                this.nanInsertDialogTableVisible=false
+              } else {
+                this.$message({
+                  message: '添加失败',
+                  type: 'error'
+                });
+                //最后把弹窗关掉
+                this.nanInsertDialogTableVisible=false
+              }
+            });
+          }
+      });
+    },
+    // 修改产品计划
+    handleEditPlan(row) {
+      //当前操作机台号
+      this.machineId=row.machineId;
+      this.tableData2=[];
+      //弹窗
+      this.nanUpdateDialogTableVisible = true
+      getPlanSpinningInfo({"machineId":row.machineId}).then((response) => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+          item.productId=parseInt(item.productId)
+        })
+        this.tableData2=response.data;
+        console.log( this.tableData2)
+        // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
+        this.$nextTick(() => {
+          // 获取第一个业务员选择框(假设表格只有一行)
+          this.tableDataStatus=[];
+          for (let i = 0; i < this.tableData2.length; i++) {
+            const firstSalesmanSelect = this.$refs['salesmanSelect'+i];
+            this.tableDataStatus.push({"index":i,"planStatus":this.tableData2[i].planStatus})
+            // console.log(firstSalesmanSelect,11111111)
+            // 触发 change 事件
+            if (firstSalesmanSelect) {
+              firstSalesmanSelect.$emit('change', {
+                target: {value: "ddd"},
+              });
+            }
+          }
+
+        });
+      })
+    },
+    //弹窗里边的点击查询
+    onSubmit(){
+      this.formData.machineId=this.machineId;
+      getPlanSpinningInfo(this.formData).then(response => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+        })
+        this.tableData2=response.data;
+      });
+    },
+    //重置
+    reset(){
+      getPlanSpinningInfo({"machineId":this.machineId}).then(response => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+        })
+        this.tableData2=response.data;
+      });
+    },
+    //更新状态
+    updateStatus(ind, row,planStatus){
+      const a=planStatus;
+      console.log( row.planStatus,this.tableDataStatus[ind].planStatus)
+      if(planStatus==this.tableDataStatus[ind].planStatus){
+        this.$message({
+          message: '并未更改状态,不会发送请求',
+          type: 'warning'
+        });
+        return;
+      }
+      //先查询计划表中有没有正在上机的
+      getPlanSpinningInfo({"machineId":this.machineId,"planStatus":planStatus}).then(response => {
+        let i=0
+        //处理表格数据
+        this.tableData2.forEach(item=>{
+          item.machineId=this.machineId;
+          if(item.planStatus==1){
+            i++
+          }
+        })
+        if(i>=1&&response.data.length>0){
+          this.$message({
+            message: '只能有一个产品的状态为上机',
+            type: 'warning'
+          });
+          row.planStatus=planStatus;
+          return;
+        }else {
+          updateSpinningInfoPlanOne(row).then(response=>{
+            if (response.code == 200) {
+              this.$message({
+                message: '修改成功',
+                type: 'success'
+              });
+              this.getSpinningPlanList();
+              this.tableDataStatus=[]
+              for (let i = 0; i < this.tableData2.length; i++) {
+                this.tableDataStatus.push({"index": i, "planStatus": this.tableData2[i].planStatus})
+              }
+              //最后把弹窗关掉
+              this.nanInsertDialogTableVisible=false
+            } else {
+              this.$message({
+                message: '修改失败',
+                type: 'error'
+              });
+              //最后把弹窗关掉
+              this.nanInsertDialogTableVisible=false
+            }
+          })
+        }
+      });
+
+    }
+  },
+  computed: {
+
+  },
+}
+</script>
+
+<style scoped>
+.el-tabs--border-card >>> .el-tabs__content {
+  padding: 0 !important;
+}
+.el-table__body-wrapper {
+  cursor: grab;
+}
+.el-table__body-wrapper.grabbing {
+  cursor: grabbing;
+}
+</style>

+ 660 - 0
zkqy-ui/src/views/orderMange/planTable/show/luotong.vue

@@ -0,0 +1,660 @@
+<template>
+  <div class="app-container" style="width: 100%;">
+        <!--表格-->
+        <el-table
+          :data="tableData"
+          ref="tableRef">
+          <el-table-column prop="machineId" fixed label="机台号" header-align="center" align="center" width="111px" ></el-table-column>
+          <el-table-column prop="productionDigit" fixed label="生产位数" header-align="center" align="center" width="111.2px"></el-table-column>
+          <el-table-column label="在机产品" header-align="center" >
+            <el-table-column prop="currentColorCode" label="色号" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="currentSpecification" label="规格" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="currentLotNumber" label="批号" header-align="center"  width="90px" align="center"></el-table-column>
+            <el-table-column prop="startTime" label="上机时间" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="plannedEndTime" label="下机时间" header-align="center" width="90px" align="center"></el-table-column>
+          </el-table-column>
+          <el-table-column prop="plannedProduction" label="待生产产品列表" header-align="center" align="center"  >
+            <template v-slot:default="scope">
+              <div v-if="scope.row.plannedProduction && scope.row.plannedProduction.length > 0">
+                <div v-for="(chunk, chunkIndex) in splitList(scope.row.plannedProduction, 5)" :key="`chunk-${chunkIndex}`">
+                  <span v-for="(item, index) in chunk" :key="`item-${chunkIndex}-${index}`">
+                    {{ item }}, <!-- 替换为实际显示每个产品的代码 -->
+                  </span>
+                </div>
+              </div>
+              <div v-else>
+
+              </div>
+            </template>
+          </el-table-column>
+<!--          <el-table-column   fixed="right" label="操作" header-align="center" align="center" width="150px" >-->
+<!--            <template v-slot:default="scope">-->
+<!--              <el-dropdown>-->
+<!--                <el-button type="primary">-->
+<!--                  操作-->
+<!--                  <i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+<!--                </el-button>-->
+<!--                <el-dropdown-menu slot="dropdown">-->
+<!--                  <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>-->
+<!--                  <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>-->
+<!--                </el-dropdown-menu>-->
+<!--              </el-dropdown>-->
+<!--            </template>-->
+<!--          </el-table-column>-->
+        </el-table>
+        <!--新增计划弹窗-->
+        <el-dialog title="新增计划"  :visible.sync="nanInsertDialogTableVisible" width="1200px">
+          <el-table :data="tableData2" @row-click.self="handleRowClick">
+<!--            <el-table-column prop="salesmanId" label="业务员" header-align="center" align="center" width="100px">-->
+<!--              <template v-slot:default="scope">-->
+<!--                <el-select  v-model="scope.row.salesmanId" placeholder="请选择业务员" @change="selectedSalesmanItem(scope.row,scope.row.salesmanId)">-->
+<!--                  <el-option v-for="salesmanItem in salesmanInfo" :key="salesmanItem.saleNo" :label="salesmanItem.salesman" :value="salesmanItem.saleNo" ></el-option>-->
+<!--                </el-select>-->
+<!--              </template>-->
+<!--            </el-table-column>-->
+            <el-table-column prop="productId" label="产品" header-align="center" align="center" width="150px">
+                <template v-slot:default="scope">
+                     <el-select  v-model="scope.row.productId" placeholder="请选择待排产产品" @change="selectedChangeDate(scope.row,scope.row.productId)">
+                           <el-option v-for="product in productsInfo" :key="product.id" :label="product.productName" :value="product.id" ></el-option>
+                     </el-select>
+                </template>
+            </el-table-column>
+
+            <el-table-column prop="currentColorCode" label="色号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing"  disabled="disabled"  v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentColorCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="productionDigit" label="生产位数" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.productionDigit" placeholder="请输入生产位数" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.productionDigit }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentSpecification" label="规格" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentSpecification" placeholder="请输入规格" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentSpecification }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentLotNumber" label="批号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentLotNumber" placeholder="请输入批号" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.currentLotNumber }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="djNumber" label="数量" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.number" placeholder="请输入数量" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.number }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="startTime" label="上机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" placeholder="请输入上机时间" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.startTime }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="plannedEndTime" label="计划下机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" placeholder="请输入计划下机时间" @blur="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.plannedEndTime }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
+              <template v-slot:default="scope">
+                <el-select  v-model="scope.row.planStatus" placeholder="请选择业务员" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                  <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" align="center">
+              <template slot-scope="scope">
+                <el-button
+                  size="mini"
+                  type="danger"
+                  @click.stop.prevent="handleDelete(scope.$index, scope.row)">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <el-button type="primary" style="width: 100%;margin-top: 30px"  @click="addEditableRow">新增计划产品</el-button>
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="nanInsertDialogTableVisible = false">取 消</el-button>
+            <el-button type="primary" @click="addPlanInfo">确 定</el-button>
+           </span>
+        </el-dialog>
+        <!--修改计划弹窗-->
+        <el-dialog title="修改计划"  :visible.sync="nanUpdateDialogTableVisible" width="1200px">
+           <!--查询条件-->
+          <el-form ref="form"  :model="formData" label-width="80px" :inline="true">
+              <el-form-item label="计划状态:">
+                <el-select v-model="formData.planStatus" placeholder="请选择计划状态">
+                  <el-option v-for="stateListItem in stateList2" :key="product.id" :label="stateListItem.name" :value="stateListItem.id" ></el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" @click="onSubmit">查询</el-button>
+                <el-button @click="reset">重置</el-button>
+              </el-form-item>
+          </el-form>
+          <!--表格-->
+          <el-table :data="tableData2" @row-click.self="handleRowClick">
+<!--            <el-table-column prop="salesmanId" label="业务员" header-align="center" align="center" width="100px">-->
+<!--              <template v-slot:default="scope">-->
+<!--                <el-select  :ref="'salesmanSelect'+scope.$index"  v-model="scope.row.salesmanId" placeholder="请选择业务员" @change="selectedSalesmanItem(scope.row,scope.row.salesmanId,scope.$index)">-->
+<!--                  <el-option v-for="salesmanItem in salesmanInfo" :key="salesmanItem.saleNo" :label="salesmanItem.salesman" :value="salesmanItem.saleNo" ></el-option>-->
+<!--                </el-select>-->
+<!--              </template>-->
+<!--            </el-table-column>-->
+            <el-table-column prop="productId" label="产品" header-align="center" align="center" width="150px">
+              <template v-slot:default="scope">
+                <el-select  :ref="'productSelected'+scope.$index" v-model="scope.row.productId" placeholder="请选择待排产产品" @change="selectedChangeDate(scope.row,scope.row.productId)">
+                  <el-option v-for="product in productsInfo" :key="product.id" :label="product.productName" :value="product.id" ></el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column prop="productionDigit" label="生产位数" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.productionDigit" placeholder="请输入生产位数" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.productionDigit }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentColorCode" label="色号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing"  disabled="disabled"  v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentColorCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="weishu" label="位数" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing"  disabled="disabled"  v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentColorCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentSpecification" disabled="disabled" label="规格" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <!-- 如果当前行正在编辑,则显示输入框 -->
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.currentSpecification" placeholder="请输入规格" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <!-- 否则显示普通文本 -->
+                <span v-else>{{ scope.row.currentSpecification }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="currentLotNumber" label="批号" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" :disabled="isDisabled"  v-model="scope.row.currentLotNumber" placeholder="请输入批号" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.currentLotNumber }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="startTime" label="上机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" placeholder="请输入上机时间" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.startTime }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="plannedEndTime" label="计划下机时间" header-align="center" align="center">
+              <template v-slot:default="scope">
+                <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" placeholder="请输入计划下机时间" @blur="handleInputBlur(scope.row)">></el-input>
+                <span v-else>{{ scope.row.plannedEndTime }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
+              <template v-slot:default="scope">
+                <!--上机变停机待机-->
+                <el-select v-if="scope.row.planStatus==1" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                  <el-option v-for="stateItem in stateList1" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+                <!--待机可以上机-->
+                <el-select v-if="scope.row.planStatus==0" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                  <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+                <!--停机变上机-->
+                <el-select v-if="scope.row.planStatus==2" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                  <el-option v-for="stateItem in stateList2" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+                <!--已完成-->
+                <el-select v-if="scope.row.planStatus==3" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                  <el-option v-for="stateItem in stateList3" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" align="center">
+              <template v-slot:default="scope">
+                <el-button
+                  size="mini"
+                  type="danger"
+                  @click.stop.prevent="updateStatus(scope.$index, scope.row,scope.row.planStatus)">更新状态{{scope.row.planStatus}}</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="nanUpdateDialogTableVisible = false">取 消</el-button>
+            <el-button type="primary" @click="nanUpdateDialogTableVisible = false">确 定</el-button>
+           </span>
+        </el-dialog>
+  </div>
+</template>
+<script>
+import {
+  getProductsInfo,
+  getMaterielInfo,
+  getSalesman,
+  getSpinningPlanList,
+  addSpinningPlanList,
+  getPlanSpinningInfo,
+  updateSpinningInfoPlanOne
+} from "@/api/plan/paln.js";
+export default {
+  data() {
+    return {
+      //选中的是那个车间
+      tableData:[],
+      //默认是禁用
+      isDisabled:true,
+      form: {
+        product:"",
+      },
+      previousMachineId: undefined,
+      currentRowspan: 1,
+      prevRow: {},
+      tableData2: [],
+      tableDataStatus: [],
+      nanInsertDialogTableVisible:false,
+      nanUpdateDialogTableVisible:false,
+      beiInsertDialogTableVisible:false,
+      beiUpdateDialogTableVisible:false,
+      editingRowIndex: -1,
+      lastEditLine:0,
+      isEditLine:false,
+      productsInfo:[],
+      salesmanInfo:[],
+      product:{},
+      materiel:{},
+      //机台号
+      machineId:"",
+      // 待机/上机/停产
+      stateList0:[
+        {"id":0,"name":"待机"},
+        {"id":1,"name":"上机"},
+      ],
+      stateList1:[
+        {"id":0,"name":"待机"},
+        {"id":2,"name":"停机"},
+        {"id":1,"name":"上机"},
+        {"id":3,"name":"已完成"},
+      ],
+      stateList2:[
+        {"id":0,"name":"待机"},
+        {"id":2,"name":"停机"},
+        {"id":1,"name":"上机"},
+      ],
+      stateList3:[
+        {"id":3,"name":"已完成"},
+      ],
+      formData:{
+        updateSelectedProductCategory:"",
+        updateSelectedProductState:""
+      },
+    }
+  },
+  mounted() {
+    // 得到排产计划信息
+    this.getSpinningPlanList();
+    // //
+    // this.getSalesman();
+    this.getProductsInfo();
+  },
+  methods: {
+    //五个显示为一排
+    splitList(list, chunkSize) {
+      const chunks = [];
+      for (let i = 0; i < list.length; i += chunkSize) {
+        chunks.push(list.slice(i, i + chunkSize));
+      }
+      return chunks;
+    },
+    // 查询排产信息
+    getSpinningPlanList() {
+      getSpinningPlanList({"productionLineDepartment":"络筒部"}).then((response) => {
+        this.tableData = response.rows
+      });
+    },
+    // //查询产品的业务员信息
+    // getSalesman() {
+    //   getSalesman().then((response) => {
+    //     this.salesmanInfo = response.data;
+    //   })
+    // },
+    // //业务员下拉框切换调用的函数
+    // selectedSalesmanItem(row,saleNo,index){
+    //   console.log("ccc",index)
+    //   this.getProductsInfo(saleNo,index);
+    // },
+    // //待投产的产品数据
+    // getProductsInfo(saleNo,sy) {
+    //   getProductsInfo(saleNo,sy).then((response) => {
+    //     this.productsInfo = response.data;
+    //     this.productsInfo.forEach(item => {
+    //       item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+    //     });
+    //   })
+    // },
+    //待投产的产品数据
+    getProductsInfo() {
+      getProductsInfo().then((response) => {
+        this.productsInfo = response.data;
+        this.productsInfo.forEach(item => {
+          item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+        });
+      })
+    },
+    // 下拉框数据改变查询色号批号信息
+    selectedChangeDate(row,selectedProduct) {
+      //选择的那个销售产品
+      this.product = this.productsInfo.find(product => product.id === selectedProduct);
+      this.form.product=selectedProduct;
+      //通过母粒编码查询到对应的母粒信息
+      let queryParams = {
+        "materielCode": this.product.colourNumber
+      }
+      //得到对应的母粒信息
+      getMaterielInfo(queryParams).then((response) => {
+        if (response.data!=null) {
+          this.materiel = response.data;
+          //色号 母粒编码+色号
+          row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
+        }
+      });
+      //isDisabled(有批号就用,没批号就自己输入)
+      if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
+        row.currentLotNumber=this.product.lotNumber;
+        this.isDisabled=true;
+      }else {
+        this.isDisabled=false;
+      }
+      //产品规格
+      row.currentSpecification= this.product.productSpecifications;
+      //合同号--销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
+      row.salesmanId=this.product.saleOrderNo;
+    },
+    // 新增计划产品信息
+    handleAddPlan(row) {
+      this.nanInsertDialogTableVisible = true
+      this.tableData2=[]
+      //先清空
+      this.machineId=""
+      //当前操作机台号
+      this.machineId=row.machineId;
+    },
+    // 删除行
+    handleDelete(index, row) {
+      // console.log(index,row)
+      // this.tableData2[a];
+      this.tableData2.splice(index, 1);
+      // 把上一编辑行置回-1
+      this.editingRowIndex = -1;
+    },
+    // 点击编辑行
+    handleRowClick(row) {
+      this.isEditLine = true;
+      //找到当前行的编辑索引
+      var rowIndex = this.tableData2.indexOf(row);
+      if (this.lastEditLine != 0 &&
+        this.editingRowIndex !== rowIndex &&
+        this.editingRowIndex !== -1 &&
+        !this.isRowFilled(this.tableData2[this.lastEditLine])) {
+        this.$message({
+          message: '请先完成上一条数据的填写',
+          type: 'warning'
+        });
+        return;
+      }
+      //编辑索引不等于当前编辑行索引
+      if (this.editingRowIndex !== rowIndex) {
+        // alert(this.editingRowIndex);
+        if (this.editingRowIndex !== -1) {
+          //把当前行变成不可编辑的
+          this.tableData2[this.editingRowIndex].isEditing = false;
+        }
+        //把当前行变成可编辑的
+        row.isEditing = true;
+        this.editingRowIndex = rowIndex;
+      }
+
+    },
+    // 光标失去焦点变成不可编辑
+    handleInputBlur(row) {
+      let rowIndex = this.tableData2.indexOf(row);
+      //编辑索引不等于当前编辑行索引
+      if (this.editingRowIndex !== rowIndex) {
+        if (this.isRowFilled(row)) {
+          row.isEditing = false;
+          //对于整个表格来说
+          this.isEditLine = false;
+          //当前编辑行置为-1
+          this.editingRowIndex = -1;
+        }
+      }
+    },
+    // 检查行是否填写完毕的示例方法
+    isRowFilled(row) {
+      return row.currentSpecification && row.productionDigit && row.startTime && row.plannedEndTime;
+    },
+    // 新增一行标记为可编辑
+    addEditableRow() {
+      // 检查当前编辑行是否已填写完毕
+      if(this.tableData2.length!=0){
+        if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
+          this.$message({
+            message: '请先完成上一条数据的填写',
+            type: 'warning'
+          });
+          return;
+        }
+        //新增行之前先让以前的行不能编辑
+        this.tableData2.forEach(item => {
+          item.isEditing = false;
+        })
+      }
+      this.tableData2.push({
+        currentColorCode: '',
+        currentSpecification: '',
+        currentLotNumber: '',
+        productionDigit: '',
+        startTime: '',
+        plannedEndTime:'',
+        planStatus:0,
+        productId:'',
+        salesmanId:'',
+        isEditing: true // 标记为正在编辑状态
+      });
+      this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
+      this.lastEditLine = this.tableData2.length - 1
+    },
+    // 添加计划
+    addPlanInfo(){
+      const datatime=Date.now()+this.machineId;
+      //先查询计划表中有没有正在上机的
+      getPlanSpinningInfo({"machineId":this.machineId,"planStatus":1}).then(response => {
+          let i=0
+          //处理表格数据
+          this.tableData2.forEach(item=>{
+            item.timestampRandomCode=datatime;
+            item.machineId=this.machineId;
+            if(item.planStatus==1){
+              i++
+            }
+          })
+          if(i>=1&&response.data.length>0){
+            this.$message({
+              message: '只能有一个产品的状态为上机',
+              type: 'warning'
+            });
+            return;
+          }else {
+            //添加计划信息
+            addSpinningPlanList(this.tableData2).then(response => {
+              if (response.code == 200) {
+                this.$message({
+                  message: '添加成功',
+                  type: 'success'
+                });
+                this.getSpinningPlanList();
+                //最后把弹窗关掉
+                this.nanInsertDialogTableVisible=false
+              } else {
+                this.$message({
+                  message: '添加失败',
+                  type: 'error'
+                });
+                //最后把弹窗关掉
+                this.nanInsertDialogTableVisible=false
+              }
+            });
+          }
+      });
+    },
+    // 修改产品计划
+    handleEditPlan(row) {
+      //当前操作机台号
+      this.machineId=row.machineId;
+      this.tableData2=[];
+      //弹窗
+      this.nanUpdateDialogTableVisible = true
+      getPlanSpinningInfo({"machineId":row.machineId}).then((response) => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+          item.productId=parseInt(item.productId)
+        })
+        this.tableData2=response.data;
+        console.log( this.tableData2)
+        // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
+        this.$nextTick(() => {
+          // 获取第一个业务员选择框(假设表格只有一行)
+          this.tableDataStatus=[];
+          for (let i = 0; i < this.tableData2.length; i++) {
+            const firstSalesmanSelect = this.$refs['salesmanSelect'+i];
+            this.tableDataStatus.push({"index":i,"planStatus":this.tableData2[i].planStatus})
+            // console.log(firstSalesmanSelect,11111111)
+            // 触发 change 事件
+            if (firstSalesmanSelect) {
+              firstSalesmanSelect.$emit('change', {
+                target: {value: "ddd"},
+              });
+            }
+          }
+
+        });
+      })
+    },
+    //弹窗里边的点击查询
+    onSubmit(){
+      this.formData.machineId=this.machineId;
+      getPlanSpinningInfo(this.formData).then(response => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+        })
+        this.tableData2=response.data;
+      });
+    },
+    //重置
+    reset(){
+      getPlanSpinningInfo({"machineId":this.machineId}).then(response => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+        })
+        this.tableData2=response.data;
+      });
+    },
+    //更新状态
+    updateStatus(ind, row,planStatus){
+      const a=planStatus;
+      console.log( row.planStatus,this.tableDataStatus[ind].planStatus)
+      if(planStatus==this.tableDataStatus[ind].planStatus){
+        this.$message({
+          message: '并未更改状态,不会发送请求',
+          type: 'warning'
+        });
+        return;
+      }
+      //先查询计划表中有没有正在上机的
+      getPlanSpinningInfo({"machineId":this.machineId,"planStatus":planStatus}).then(response => {
+        let i=0
+        //处理表格数据
+        this.tableData2.forEach(item=>{
+          item.machineId=this.machineId;
+          if(item.planStatus==1){
+            i++
+          }
+        })
+        if(i>=1&&response.data.length>0){
+          this.$message({
+            message: '只能有一个产品的状态为上机',
+            type: 'warning'
+          });
+          row.planStatus=planStatus;
+          return;
+        }else {
+          updateSpinningInfoPlanOne(row).then(response=>{
+            if (response.code == 200) {
+              this.$message({
+                message: '修改成功',
+                type: 'success'
+              });
+              this.getSpinningPlanList();
+              this.tableDataStatus=[]
+              for (let i = 0; i < this.tableData2.length; i++) {
+                this.tableDataStatus.push({"index": i, "planStatus": this.tableData2[i].planStatus})
+              }
+              //最后把弹窗关掉
+              this.nanInsertDialogTableVisible=false
+            } else {
+              this.$message({
+                message: '修改失败',
+                type: 'error'
+              });
+              //最后把弹窗关掉
+              this.nanInsertDialogTableVisible=false
+            }
+          })
+        }
+      });
+
+    }
+  },
+  computed: {
+
+  },
+}
+</script>
+
+<style scoped>
+.el-tabs--border-card >>> .el-tabs__content {
+  padding: 0 !important;
+}
+.el-table__body-wrapper {
+  cursor: grab;
+}
+.el-table__body-wrapper.grabbing {
+  cursor: grabbing;
+}
+</style>

+ 536 - 0
zkqy-ui/src/views/orderMange/planTable/show/northWorkshop.vue

@@ -0,0 +1,536 @@
+<template>
+  <div class="app-container" style="width: 100%;">
+    <!--表格-->
+    <el-table
+      :data="tableData"
+      ref="tableRef"
+      :span-method="spanMethod2">
+      <el-table-column prop="machineId" fixed label="机台号" header-align="center" align="center" width="111px" ></el-table-column>
+      <el-table-column prop="productType" fixed label="产品类别" header-align="center" align="center" width="111.2px"></el-table-column>
+      <el-table-column label="在机产品" header-align="center" >
+        <el-table-column prop="currentColorCode" label="色号" header-align="center" width="90px" align="center"></el-table-column>
+        <el-table-column prop="currentSpecification" label="规格" header-align="center" width="90px" align="center"></el-table-column>
+        <el-table-column prop="currentLotNumber" label="批号" header-align="center"  width="90px" align="center"></el-table-column>
+        <el-table-column prop="currentSpindleCount" label="锭数" header-align="center" width="90px" align="center"></el-table-column>
+        <el-table-column prop="startTime" label="上机时间" header-align="center" width="90px" align="center"></el-table-column>
+        <el-table-column prop="plannedEndTime" label="下机时间" header-align="center" width="90px" align="center"></el-table-column>
+      </el-table-column>
+      <!--          <el-table-column  label="待上机产品" header-align="center" align="center">-->
+      <!--            <el-table-column prop="djCurrentColorCode" label="色号" header-align="center" align="center"></el-table-column>-->
+      <!--            <el-table-column prop="djCurrentSpecification" label="规格" header-align="center" align="center"></el-table-column>-->
+      <!--            <el-table-column prop="djNumber" label="数量" header-align="center" align="center"></el-table-column>-->
+      <!--            <el-table-column prop="djCurrentLotNumber" label="原丝批号" header-align="center" align="center"></el-table-column>-->
+      <!--          </el-table-column>-->
+      <el-table-column prop="listOfPendingProduction" label="待生产产品列表" header-align="center" align="center"  >
+        <template slot-scope="scope">
+          <div v-if="scope.row.listOfPendingProduction">
+            <span v-for="(item, index) in scope.row.listOfPendingProduction.split(',')">
+              {{ item }},
+              <br v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1" />
+            </span>
+          </div>
+        </template>
+      </el-table-column>
+<!--      <el-table-column   fixed="right" label="操作" header-align="center" align="center" width="150px" >-->
+<!--        <template slot-scope="scope">-->
+<!--          <el-dropdown>-->
+<!--            <el-button type="primary">-->
+<!--              操作-->
+<!--              <i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+<!--            </el-button>-->
+<!--            <el-dropdown-menu slot="dropdown">-->
+<!--              <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>-->
+<!--              <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>-->
+<!--            </el-dropdown-menu>-->
+<!--          </el-dropdown>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+    </el-table>
+  </div>
+</template>
+<script>
+import {
+  ammunitionPlanInfo,
+  getProductsInfo,
+  getMaterielInfo,
+  addMaterielInfo,
+  getSalesman,
+  getAllPlanListByMachineId,
+  getAllPlanListByProductTypeAndStatus, updatePlanOne
+} from "@/api/plan/paln.js";
+export default {
+  data() {
+    return {
+      //选中的是那个车间
+      selectedWorkshop:"南车间",
+      tableData:[],
+      isDisabled:true,
+      form: {
+        product:"",
+      },
+      previousMachineId: undefined,
+      currentRowspan: 1,
+      prevRow: {},
+      tableData2: [],
+      nanInsertDialogTableVisible:false,
+      nanUpdateDialogTableVisible:false,
+      beiInsertDialogTableVisible:false,
+      beiUpdateDialogTableVisible:false,
+      editingRowIndex: -1,
+      lastEditLine:0,
+      queryParams:{ productionLineDepartment:"加弹部",
+        productionLineWorkshop:"南车间"},
+      isEditLine:false,
+      productsInfo:[],
+      salesmanInfo:[],
+      product:{},
+      materiel:{},
+      // 机台号
+      machineId:"",
+      // 待机/上机/停产
+      stateList0:[
+        {"id":0,"name":"待机"},
+        {"id":1,"name":"上机"},
+      ],
+      stateList1:[
+        {"id":0,"name":"待机"},
+        {"id":2,"name":"停机"},
+        {"id":1,"name":"上机"},
+        {"id":3,"name":"已完成"},
+      ],
+      stateList2:[
+        {"id":0,"name":"待机"},
+        {"id":2,"name":"停机"},
+        {"id":1,"name":"上机"},
+      ],
+      formData:{
+        updateSelectedProductCategory:"",
+        updateSelectedProductState:""
+      },
+      // 产品类别
+      productTypeList:[{value:"A面",lable:"A面"},{value:"B面",lable:"B面"}],
+    }
+  },
+  mounted() {
+    // 得到排产计划信息
+    this.getAmmunitionPlanInfo();
+    // 得到业务员信息
+    // this.getSalesman();
+    this.getProductsInfo();
+  },
+  methods: {
+    // 查询排产信息
+    getAmmunitionPlanInfo() {
+      ammunitionPlanInfo(this.queryParams).then((response) => {
+        this.tableData = response.data
+      });
+    },
+    // 合并单元格
+    spanMethod2({ row, column, rowIndex, columnIndex }) {
+      //第二列合并
+      if (columnIndex === 1) {
+        if(row.productType == null) {
+          return;
+        }
+        const prevRow2 = this.tableData[rowIndex - 1]; // 上一行数据
+        let nextRow2 = this.tableData[rowIndex + 1]; // 下一行数据
+
+        // 当上一行的数据(machineId和productType)等于当前行数据时,当前行单元格隐藏
+        if (
+          prevRow2 &&
+          prevRow2.machineId === row.machineId &&
+          prevRow2.productType === row.productType
+        ) {
+          return { rowspan: 0, colspan: 0 };
+        } else {
+          // 反之,则循环判断若下一行数据(machineId和productType)等于当前行数据,则当前行开始进行合并单元格
+          let countRowspan2 = 1; // 用于合并计数多少单元格
+          while (
+            nextRow2 &&
+            nextRow2.machineId === row.machineId &&
+            nextRow2.productType === row.productType
+            ) {
+            nextRow2 = this.tableData[++countRowspan2 + rowIndex];
+          }
+          if (countRowspan2 > 1) {
+            return { rowspan: countRowspan2, colspan: 1 };
+          }
+        }
+      }
+      //待生产列表
+      if (columnIndex === 8) {
+        const prevRow2 = this.tableData[rowIndex - 1] //上一行数据
+        let nextRow2 = this.tableData[rowIndex + 1] //下一行数据
+        // 当上一行的数据等于当前行数据时,当前行单元格隐藏
+
+        console.log(row.listOfPendingProduction)
+        if(row.listOfPendingProduction==null||row.listOfPendingProduction==undefined|| row.listOfPendingProduction==""){
+          return;
+        }
+        if (prevRow2 &&
+          prevRow2.machineId === row.machineId &&
+          prevRow2.productType === row.productType
+        ) {
+          return { rowspan: 0, colspan: 0 }
+        } else {
+          // 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
+          let countRowspan2 = 1 //用于合并计数多少单元格
+          while (nextRow2 &&
+            nextRow2.listOfPendingProduction === row.listOfPendingProduction&&
+            nextRow2.machineId === row.machineId &&
+            nextRow2.productType === row.productType
+            ) {
+            nextRow2 = this.tableData[++countRowspan2 + rowIndex]
+          }
+          if (countRowspan2 > 1) {
+            return { rowspan: countRowspan2, colspan: 1 }
+          }
+        }
+      }
+      //合并最后一列操作列
+      const lastColumnIndex = this.$refs.tableRef.store.states.columns.length - 1; // 获取表格最后一列的索引
+      if (columnIndex === lastColumnIndex && column.label === '操作') { // 判断是否为最后一列且标签为'操作'
+        const machineIdColumnIndex = 0; // 机台号列的索引假定为0
+        const currentMachineId = row.machineId;
+
+        let countRowspan = 1;
+        const prevRow = this.tableData[rowIndex - 1];
+
+        if (prevRow && prevRow.machineId === currentMachineId) {
+          return { rowspan: 0, colspan: 0 };
+        } else {
+          let nextRow = this.tableData[rowIndex + 1];
+
+          while (
+            nextRow &&
+            nextRow.machineId === currentMachineId
+            ) {
+            nextRow = this.tableData[++countRowspan + rowIndex];
+          }
+
+          if (countRowspan > 1) {
+            return { rowspan: countRowspan, colspan: 1 };
+          }
+        }
+      }
+      //第一列机台号合并
+      if (columnIndex === 0) {
+        //定义需要合并的列字段,有哪些列需要合并,就自定义添加字段即可
+        const fields = ['machineId']
+        // 当前行的数据
+        const cellValue = row[column.property]
+        let countRowspan = 1 //用于合并计数多少单元格
+        // 判断只合并定义字段的列数据
+        if (cellValue && fields.includes(column.property)) {
+          const prevRow = this.tableData[rowIndex - 1] //上一行数据
+          let nextRow = this.tableData[rowIndex + 1] //下一行数据
+          // 当上一行的数据等于当前行数据时,当前行单元格隐藏
+          if (prevRow && prevRow[column.property] === cellValue) {
+            return { rowspan: 0, colspan: 0 }
+          } else {
+            // 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
+            let countRowspan = 1 //用于合并计数多少单元格
+            while (nextRow && nextRow[column.property] === cellValue) {
+              nextRow = this.tableData[++countRowspan + rowIndex]
+            }
+            if (countRowspan > 1) {
+              return { rowspan: countRowspan, colspan: 1 }
+            }
+          }
+        }
+      }
+    },
+    //查询产品的业务员信息
+    // getSalesman() {
+    //   getSalesman().then((response) => {
+    //     this.salesmanInfo = response.data;
+    //   })
+    // },
+    // //业务员下拉框切换调用的函数
+    // selectedSalesmanItem(row,saleNo,index){
+    //   this.getProductsInfo(saleNo,index);
+    // },
+    // //待投产的产品数据
+    // getProductsInfo(saleNo,sy) {
+    //   getProductsInfo(saleNo,sy).then((response) => {
+    //     this.productsInfo = response.data;
+    //     this.productsInfo.forEach(item => {
+    //       item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+    //     });
+    //   })
+    // },
+    getProductsInfo() {
+      getProductsInfo().then((response) => {
+        this.productsInfo = response.data;
+        this.productsInfo.forEach(item => {
+          item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+        });
+      })
+    },
+    // 下拉框数据改变查询色号批号信息
+    selectedChangeDate(row,selectedProduct) {
+      //选择的那个销售产品
+      this.product = this.productsInfo.find(product => product.id === selectedProduct);
+      this.form.product=selectedProduct;
+      //通过母粒编码查询到对应的母粒信息
+      let queryParams = {
+        "materielCode": this.product.colourNumber
+      }
+      //得到对应的母粒信息
+      getMaterielInfo(queryParams).then((response) => {
+        if (response.data!=null) {
+          this.materiel = response.data;
+          //色号 母粒编码+色号
+          row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
+        }
+      });
+      //isDisabled(有批号就用,没批号就自己输入)
+      if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
+        row.currentLotNumber=this.product.lotNumber;
+        this.isDisabled=true;
+      }else {
+        this.isDisabled=false;
+      }
+      //产品规格
+      row.currentSpecification= this.product.productSpecifications;
+      //销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
+      row.salesmanId=this.product.saleOrderNo;
+    },
+    // 新增计划产品信息
+    handleAddPlan(row) {
+      if(this.selectedWorkshop=="南车间"){
+        this.nanInsertDialogTableVisible = true
+      }else{
+        this.beiInsertDialogTableVisible = true
+      }
+      this.tableData2=[]
+      //先清空
+      this.machineId=""
+      //当前操作机台号
+      this.machineId=row.machineId;
+    },
+
+    // tab栏点击切换
+    tabClick(tab, event) {
+      // console.log('当前点击的标签名称:', tab.name);
+      this.selectedWorkshop = tab.name;
+      // productionLineName getProductionLineNo productionLineDepartment productionLineWorkshop
+      this.queryParams.productionLineWorkshop = tab.name;
+      this.getAmmunitionPlanInfo();
+    },
+    // 删除行
+    handleDelete(index, row) {
+      // console.log(index,row)
+      // this.tableData2[a];
+      this.tableData2.splice(index, 1);
+      // 把上一编辑行置回-1
+      this.editingRowIndex = -1;
+    },
+    // 点击编辑行
+    handleRowClick(row) {
+      this.isEditLine = true;
+      // alert(this.lastEditLine+"编辑行")
+      //找到当前行的编辑索引
+      var rowIndex = this.tableData2.indexOf(row);
+
+      if (this.lastEditLine != 0 &&
+        this.editingRowIndex !== rowIndex &&
+        this.editingRowIndex !== -1 &&
+        !this.isRowFilled(this.tableData2[this.lastEditLine])) {
+        this.$message({
+          message: '请先完成上一条数据的填写',
+          type: 'warning'
+        });
+        return;
+      }
+      //编辑索引不等于当前编辑行索引
+      if (this.editingRowIndex !== rowIndex) {
+        // alert(this.editingRowIndex);
+        if (this.editingRowIndex !== -1) {
+          //把当前行变成不可编辑的
+          this.tableData2[this.editingRowIndex].isEditing = false;
+        }
+        //把当前行变成可编辑的
+        row.isEditing = true;
+        this.editingRowIndex = rowIndex;
+      }
+
+    },
+    // 光标失去焦点变成不可编辑
+    handleInputBlur(row) {
+      let rowIndex = this.tableData2.indexOf(row);
+      //编辑索引不等于当前编辑行索引
+      if (this.editingRowIndex !== rowIndex) {
+        if (this.isRowFilled(row)) {
+          row.isEditing = false;
+          //对于整个表格来说
+          this.isEditLine = false;
+          //当前编辑行置为-1
+          this.editingRowIndex = -1;
+        }
+      }
+    },
+    // 检查行是否填写完毕的示例方法
+    isRowFilled(row) {
+      return row.currentSpecification && row.currentSpindleCount && row.number && row.startTime && row.plannedEndTime;
+    },
+    // 新增一行标记为可编辑
+    addEditableRow() {
+      // 检查当前编辑行是否已填写完毕
+      if(this.tableData2.length!=0){
+        if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
+          this.$message({
+            message: '请先完成上一条数据的填写',
+            type: 'warning'
+          });
+          return;
+        }
+        //新增行之前先让以前的行不能编辑
+        this.tableData2.forEach(item => {
+          item.isEditing = false;
+        })
+      }
+      this.tableData2.push({
+        currentColorCode: '',
+        currentSpecification: '',
+        currentLotNumber: '',
+        currentSpindleCount: '',
+        number: '',
+        startTime: '',
+        plannedEndTime:'',
+        planStatus:0,
+        productId:'',
+        salesmanId:'',
+        isEditing: true // 标记为正在编辑状态
+      });
+      this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
+      this.lastEditLine = this.tableData2.length - 1
+    },
+    // 添加计划
+    addPlanInfo(){
+      const datatime=Date.now()+this.machineId;
+      //处理表格数据
+      this.tableData2.forEach(item=>{
+        item.timestampRandomCode=datatime;
+        item.machineId=this.machineId;
+      })
+      //时间戳
+      let data={
+        //机台号
+        machineId: this.machineId,
+        timestampRandomCode:datatime,
+        //计划信息
+        detailsOfTheRefuelingPlans: this.tableData2
+      }
+      //添加计划信息
+      addMaterielInfo(data).then(response => {
+        if (response.code == 200) {
+          this.$message({
+            message: '添加成功',
+            type: 'success'
+          });
+          this.getAmmunitionPlanInfo();
+          //最后把弹窗关掉
+          this.nanInsertDialogTableVisible=false
+          //更改订单投产信息的批号,
+        } else {
+          this.$message({
+            message: '添加失败',
+            type: 'error'
+          });
+          //最后把弹窗关掉
+          this.nanInsertDialogTableVisible=false
+        }
+      });
+
+    },
+    // 修改产品计划
+    handleEditPlan(row) {
+      this.tableData2=[];
+      //弹窗
+      if(this.selectedWorkshop=="南车间"){
+        this.nanUpdateDialogTableVisible = true
+      }else{
+        this.beiUpdateDialogTableVisible = true
+      }
+      this.tableData2=[];
+      getAllPlanListByMachineId(row.machineId).then((response) => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+          item.productId=parseInt(item.productId)
+        })
+        this.tableData2=response.data;
+        console.log( this.tableData2)
+        // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
+        this.$nextTick(() => {
+          // 获取第一个业务员选择框(假设表格只有一行)
+          for (let i = 0; i < this.tableData2.length; i++) {
+            const firstSalesmanSelect = this.$refs['salesmanSelect'+i];
+            // console.log(firstSalesmanSelect,11111111)
+            // 触发 change 事件
+            if (firstSalesmanSelect) {
+              firstSalesmanSelect.$emit('change', {
+                target: {value: "ddd"},
+              });
+            }
+          }
+
+        });
+      })
+
+
+    },
+    //弹窗里边的点击查询
+    onSubmit(){
+      this.formData.machineId=this.machineId;
+      getAllPlanListByProductTypeAndStatus(this.formData).then(response => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+        })
+        this.tableData2=response.data;
+      });
+    },
+    //更新状态
+    updateStatus(ind, row){
+      console.log(row);
+      updatePlanOne(row).then(response=>{
+        if (response.code == 200) {
+          this.$message({
+            message: '修改成功',
+            type: 'success'
+          });
+          this.getAmmunitionPlanInfo();
+          //最后把弹窗关掉
+          this.nanInsertDialogTableVisible=false
+        } else {
+          this.$message({
+            message: '修改失败',
+            type: 'error'
+          });
+          //最后把弹窗关掉
+          this.nanInsertDialogTableVisible=false
+        }
+      })
+    }
+  },
+  computed: {
+
+  },
+}
+</script>
+
+<style scoped>
+.el-tabs--border-card >>> .el-tabs__content {
+  padding: 0 !important;
+}
+.el-table__body-wrapper {
+  cursor: grab;
+}
+.el-table__body-wrapper.grabbing {
+  cursor: grabbing;
+}
+</style>

+ 537 - 0
zkqy-ui/src/views/orderMange/planTable/show/southWorkshop.vue

@@ -0,0 +1,537 @@
+<template>
+  <div class="app-container" style="width: 100%;">
+
+        <!--表格-->
+        <el-table
+          :data="tableData"
+          ref="tableRef"
+          :span-method="spanMethod2">
+          <el-table-column prop="machineId" fixed label="机台号" header-align="center" align="center" width="111px" ></el-table-column>
+          <el-table-column prop="productType" fixed label="产品类别" header-align="center" align="center" width="111.2px"></el-table-column>
+          <el-table-column label="在机产品" header-align="center" >
+            <el-table-column prop="currentColorCode" label="色号" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="currentSpecification" label="规格" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="currentLotNumber" label="批号" header-align="center"  width="90px" align="center"></el-table-column>
+            <el-table-column prop="currentSpindleCount" label="锭数" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="startTime" label="上机时间" header-align="center" width="90px" align="center"></el-table-column>
+            <el-table-column prop="plannedEndTime" label="下机时间" header-align="center" width="90px" align="center"></el-table-column>
+          </el-table-column>
+          <!--          <el-table-column  label="待上机产品" header-align="center" align="center">-->
+          <!--            <el-table-column prop="djCurrentColorCode" label="色号" header-align="center" align="center"></el-table-column>-->
+          <!--            <el-table-column prop="djCurrentSpecification" label="规格" header-align="center" align="center"></el-table-column>-->
+          <!--            <el-table-column prop="djNumber" label="数量" header-align="center" align="center"></el-table-column>-->
+          <!--            <el-table-column prop="djCurrentLotNumber" label="原丝批号" header-align="center" align="center"></el-table-column>-->
+          <!--          </el-table-column>-->
+          <el-table-column prop="listOfPendingProduction" label="待生产产品列表" header-align="center" align="center"  >
+            <template slot-scope="scope">
+              <div v-if="scope.row.listOfPendingProduction">
+                <span v-for="(item, index) in scope.row.listOfPendingProduction.split(',')">
+                  {{ item }},
+                  <br v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1" />
+                </span>
+              </div>
+            </template>
+          </el-table-column>
+<!--          <el-table-column   fixed="right" label="操作" header-align="center" align="center" width="150px" >-->
+<!--            <template slot-scope="scope">-->
+<!--              <el-dropdown>-->
+<!--                <el-button type="primary">-->
+<!--                  操作-->
+<!--                  <i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+<!--                </el-button>-->
+<!--                <el-dropdown-menu slot="dropdown">-->
+<!--                  <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>-->
+<!--                  <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>-->
+<!--                </el-dropdown-menu>-->
+<!--              </el-dropdown>-->
+<!--            </template>-->
+<!--          </el-table-column>-->
+        </el-table>
+  </div>
+</template>
+<script>
+import {
+  ammunitionPlanInfo,
+  getProductsInfo,
+  getMaterielInfo,
+  addMaterielInfo,
+  getSalesman,
+  getAllPlanListByMachineId,
+  getAllPlanListByProductTypeAndStatus, updatePlanOne
+} from "@/api/plan/paln.js";
+export default {
+  data() {
+    return {
+      //选中的是那个车间
+      selectedWorkshop:"北车间",
+      tableData:[],
+      isDisabled:true,
+      form: {
+        product:"",
+      },
+      previousMachineId: undefined,
+      currentRowspan: 1,
+      prevRow: {},
+      tableData2: [],
+      nanInsertDialogTableVisible:false,
+      nanUpdateDialogTableVisible:false,
+      beiInsertDialogTableVisible:false,
+      beiUpdateDialogTableVisible:false,
+      editingRowIndex: -1,
+      lastEditLine:0,
+      queryParams:{ productionLineDepartment:"加弹部",
+        productionLineWorkshop:"北车间"},
+      isEditLine:false,
+      productsInfo:[],
+      salesmanInfo:[],
+      product:{},
+      materiel:{},
+      // 机台号
+      machineId:"",
+      // 待机/上机/停产
+      stateList0:[
+        {"id":0,"name":"待机"},
+        {"id":1,"name":"上机"},
+      ],
+      stateList1:[
+        {"id":0,"name":"待机"},
+        {"id":2,"name":"停机"},
+        {"id":1,"name":"上机"},
+        {"id":3,"name":"已完成"},
+      ],
+      stateList2:[
+        {"id":0,"name":"待机"},
+        {"id":2,"name":"停机"},
+        {"id":1,"name":"上机"},
+      ],
+      formData:{
+        updateSelectedProductCategory:"",
+        updateSelectedProductState:""
+      },
+      // 产品类别
+      productTypeList:[{value:"A面",lable:"A面"},{value:"B面",lable:"B面"}],
+    }
+  },
+  mounted() {
+    // 得到排产计划信息
+    this.getAmmunitionPlanInfo();
+    // 得到业务员信息
+    // this.getSalesman();
+    this.getProductsInfo();
+  },
+  methods: {
+    // 查询排产信息
+    getAmmunitionPlanInfo() {
+      ammunitionPlanInfo(this.queryParams).then((response) => {
+        this.tableData = response.data
+      });
+    },
+    // 合并单元格
+    spanMethod2({ row, column, rowIndex, columnIndex }) {
+      //第二列合并
+      if (columnIndex === 1) {
+        if(row.productType == null) {
+          return;
+        }
+        const prevRow2 = this.tableData[rowIndex - 1]; // 上一行数据
+        let nextRow2 = this.tableData[rowIndex + 1]; // 下一行数据
+
+        // 当上一行的数据(machineId和productType)等于当前行数据时,当前行单元格隐藏
+        if (
+          prevRow2 &&
+          prevRow2.machineId === row.machineId &&
+          prevRow2.productType === row.productType
+        ) {
+          return { rowspan: 0, colspan: 0 };
+        } else {
+          // 反之,则循环判断若下一行数据(machineId和productType)等于当前行数据,则当前行开始进行合并单元格
+          let countRowspan2 = 1; // 用于合并计数多少单元格
+          while (
+            nextRow2 &&
+            nextRow2.machineId === row.machineId &&
+            nextRow2.productType === row.productType
+            ) {
+            nextRow2 = this.tableData[++countRowspan2 + rowIndex];
+          }
+          if (countRowspan2 > 1) {
+            return { rowspan: countRowspan2, colspan: 1 };
+          }
+        }
+      }
+      //待生产列表
+      if (columnIndex === 8) {
+        const prevRow2 = this.tableData[rowIndex - 1] //上一行数据
+        let nextRow2 = this.tableData[rowIndex + 1] //下一行数据
+        // 当上一行的数据等于当前行数据时,当前行单元格隐藏
+
+        console.log(row.listOfPendingProduction)
+        if(row.listOfPendingProduction==null||row.listOfPendingProduction==undefined|| row.listOfPendingProduction==""){
+          return;
+        }
+        if (prevRow2 &&
+          prevRow2.machineId === row.machineId &&
+          prevRow2.productType === row.productType
+        ) {
+          return { rowspan: 0, colspan: 0 }
+        } else {
+          // 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
+          let countRowspan2 = 1 //用于合并计数多少单元格
+          while (nextRow2 &&
+            nextRow2.listOfPendingProduction === row.listOfPendingProduction&&
+            nextRow2.machineId === row.machineId &&
+            nextRow2.productType === row.productType
+            ) {
+            nextRow2 = this.tableData[++countRowspan2 + rowIndex]
+          }
+          if (countRowspan2 > 1) {
+            return { rowspan: countRowspan2, colspan: 1 }
+          }
+        }
+      }
+      //合并最后一列操作列
+      const lastColumnIndex = this.$refs.tableRef.store.states.columns.length - 1; // 获取表格最后一列的索引
+      if (columnIndex === lastColumnIndex && column.label === '操作') { // 判断是否为最后一列且标签为'操作'
+        const machineIdColumnIndex = 0; // 机台号列的索引假定为0
+        const currentMachineId = row.machineId;
+
+        let countRowspan = 1;
+        const prevRow = this.tableData[rowIndex - 1];
+
+        if (prevRow && prevRow.machineId === currentMachineId) {
+          return { rowspan: 0, colspan: 0 };
+        } else {
+          let nextRow = this.tableData[rowIndex + 1];
+
+          while (
+            nextRow &&
+            nextRow.machineId === currentMachineId
+            ) {
+            nextRow = this.tableData[++countRowspan + rowIndex];
+          }
+
+          if (countRowspan > 1) {
+            return { rowspan: countRowspan, colspan: 1 };
+          }
+        }
+      }
+      //第一列机台号合并
+      if (columnIndex === 0) {
+        //定义需要合并的列字段,有哪些列需要合并,就自定义添加字段即可
+        const fields = ['machineId']
+        // 当前行的数据
+        const cellValue = row[column.property]
+        let countRowspan = 1 //用于合并计数多少单元格
+        // 判断只合并定义字段的列数据
+        if (cellValue && fields.includes(column.property)) {
+          const prevRow = this.tableData[rowIndex - 1] //上一行数据
+          let nextRow = this.tableData[rowIndex + 1] //下一行数据
+          // 当上一行的数据等于当前行数据时,当前行单元格隐藏
+          if (prevRow && prevRow[column.property] === cellValue) {
+            return { rowspan: 0, colspan: 0 }
+          } else {
+            // 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
+            let countRowspan = 1 //用于合并计数多少单元格
+            while (nextRow && nextRow[column.property] === cellValue) {
+              nextRow = this.tableData[++countRowspan + rowIndex]
+            }
+            if (countRowspan > 1) {
+              return { rowspan: countRowspan, colspan: 1 }
+            }
+          }
+        }
+      }
+    },
+    //查询产品的业务员信息
+    // getSalesman() {
+    //   getSalesman().then((response) => {
+    //     this.salesmanInfo = response.data;
+    //   })
+    // },
+    // //业务员下拉框切换调用的函数
+    // selectedSalesmanItem(row,saleNo,index){
+    //   this.getProductsInfo(saleNo,index);
+    // },
+    // //待投产的产品数据
+    // getProductsInfo(saleNo,sy) {
+    //   getProductsInfo(saleNo,sy).then((response) => {
+    //     this.productsInfo = response.data;
+    //     this.productsInfo.forEach(item => {
+    //       item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+    //     });
+    //   })
+    // },
+    getProductsInfo() {
+      getProductsInfo().then((response) => {
+        this.productsInfo = response.data;
+        this.productsInfo.forEach(item => {
+          item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+        });
+      })
+    },
+    // 下拉框数据改变查询色号批号信息
+    selectedChangeDate(row,selectedProduct) {
+      //选择的那个销售产品
+      this.product = this.productsInfo.find(product => product.id === selectedProduct);
+      this.form.product=selectedProduct;
+      //通过母粒编码查询到对应的母粒信息
+      let queryParams = {
+        "materielCode": this.product.colourNumber
+      }
+      //得到对应的母粒信息
+      getMaterielInfo(queryParams).then((response) => {
+        if (response.data!=null) {
+          this.materiel = response.data;
+          //色号 母粒编码+色号
+          row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
+        }
+      });
+      //isDisabled(有批号就用,没批号就自己输入)
+      if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
+        row.currentLotNumber=this.product.lotNumber;
+        this.isDisabled=true;
+      }else {
+        this.isDisabled=false;
+      }
+      //产品规格
+      row.currentSpecification= this.product.productSpecifications;
+      //销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
+      row.salesmanId=this.product.saleOrderNo;
+    },
+    // 新增计划产品信息
+    handleAddPlan(row) {
+      if(this.selectedWorkshop=="南车间"){
+        this.nanInsertDialogTableVisible = true
+      }else{
+        this.beiInsertDialogTableVisible = true
+      }
+      this.tableData2=[]
+      //先清空
+      this.machineId=""
+      //当前操作机台号
+      this.machineId=row.machineId;
+    },
+
+    // tab栏点击切换
+    tabClick(tab, event) {
+      // console.log('当前点击的标签名称:', tab.name);
+      this.selectedWorkshop = tab.name;
+      // productionLineName getProductionLineNo productionLineDepartment productionLineWorkshop
+      this.queryParams.productionLineWorkshop = tab.name;
+      this.getAmmunitionPlanInfo();
+    },
+    // 删除行
+    handleDelete(index, row) {
+      // console.log(index,row)
+      // this.tableData2[a];
+      this.tableData2.splice(index, 1);
+      // 把上一编辑行置回-1
+      this.editingRowIndex = -1;
+    },
+    // 点击编辑行
+    handleRowClick(row) {
+      this.isEditLine = true;
+      // alert(this.lastEditLine+"编辑行")
+      //找到当前行的编辑索引
+      var rowIndex = this.tableData2.indexOf(row);
+
+      if (this.lastEditLine != 0 &&
+        this.editingRowIndex !== rowIndex &&
+        this.editingRowIndex !== -1 &&
+        !this.isRowFilled(this.tableData2[this.lastEditLine])) {
+        this.$message({
+          message: '请先完成上一条数据的填写',
+          type: 'warning'
+        });
+        return;
+      }
+      //编辑索引不等于当前编辑行索引
+      if (this.editingRowIndex !== rowIndex) {
+        // alert(this.editingRowIndex);
+        if (this.editingRowIndex !== -1) {
+          //把当前行变成不可编辑的
+          this.tableData2[this.editingRowIndex].isEditing = false;
+        }
+        //把当前行变成可编辑的
+        row.isEditing = true;
+        this.editingRowIndex = rowIndex;
+      }
+
+    },
+    // 光标失去焦点变成不可编辑
+    handleInputBlur(row) {
+      let rowIndex = this.tableData2.indexOf(row);
+      //编辑索引不等于当前编辑行索引
+      if (this.editingRowIndex !== rowIndex) {
+        if (this.isRowFilled(row)) {
+          row.isEditing = false;
+          //对于整个表格来说
+          this.isEditLine = false;
+          //当前编辑行置为-1
+          this.editingRowIndex = -1;
+        }
+      }
+    },
+    // 检查行是否填写完毕的示例方法
+    isRowFilled(row) {
+      return row.currentSpecification && row.currentSpindleCount && row.number && row.startTime && row.plannedEndTime;
+    },
+    // 新增一行标记为可编辑
+    addEditableRow() {
+      // 检查当前编辑行是否已填写完毕
+      if(this.tableData2.length!=0){
+        if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
+          this.$message({
+            message: '请先完成上一条数据的填写',
+            type: 'warning'
+          });
+          return;
+        }
+        //新增行之前先让以前的行不能编辑
+        this.tableData2.forEach(item => {
+          item.isEditing = false;
+        })
+      }
+      this.tableData2.push({
+        currentColorCode: '',
+        currentSpecification: '',
+        currentLotNumber: '',
+        currentSpindleCount: '',
+        number: '',
+        startTime: '',
+        plannedEndTime:'',
+        planStatus:0,
+        productId:'',
+        salesmanId:'',
+        isEditing: true // 标记为正在编辑状态
+      });
+      this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
+      this.lastEditLine = this.tableData2.length - 1
+    },
+    // 添加计划
+    addPlanInfo(){
+      const datatime=Date.now()+this.machineId;
+      //处理表格数据
+      this.tableData2.forEach(item=>{
+        item.timestampRandomCode=datatime;
+        item.machineId=this.machineId;
+      })
+      //时间戳
+      let data={
+        //机台号
+        machineId: this.machineId,
+        timestampRandomCode:datatime,
+        //计划信息
+        detailsOfTheRefuelingPlans: this.tableData2
+      }
+      //添加计划信息
+      addMaterielInfo(data).then(response => {
+        if (response.code == 200) {
+          this.$message({
+            message: '添加成功',
+            type: 'success'
+          });
+          this.getAmmunitionPlanInfo();
+          //最后把弹窗关掉
+          this.nanInsertDialogTableVisible=false
+          //更改订单投产信息的批号,
+        } else {
+          this.$message({
+            message: '添加失败',
+            type: 'error'
+          });
+          //最后把弹窗关掉
+          this.nanInsertDialogTableVisible=false
+        }
+      });
+
+    },
+    // 修改产品计划
+    handleEditPlan(row) {
+      this.tableData2=[];
+      //弹窗
+      if(this.selectedWorkshop=="南车间"){
+        this.nanUpdateDialogTableVisible = true
+      }else{
+        this.beiUpdateDialogTableVisible = true
+      }
+      this.tableData2=[];
+      getAllPlanListByMachineId(row.machineId).then((response) => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+          item.productId=parseInt(item.productId)
+        })
+        this.tableData2=response.data;
+        console.log( this.tableData2)
+        // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
+        this.$nextTick(() => {
+          // 获取第一个业务员选择框(假设表格只有一行)
+          for (let i = 0; i < this.tableData2.length; i++) {
+            const firstSalesmanSelect = this.$refs['salesmanSelect'+i];
+            // console.log(firstSalesmanSelect,11111111)
+            // 触发 change 事件
+            if (firstSalesmanSelect) {
+              firstSalesmanSelect.$emit('change', {
+                target: {value: "ddd"},
+              });
+            }
+          }
+
+        });
+      })
+
+
+    },
+    //弹窗里边的点击查询
+    onSubmit(){
+      this.formData.machineId=this.machineId;
+      getAllPlanListByProductTypeAndStatus(this.formData).then(response => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+        })
+        this.tableData2=response.data;
+      });
+    },
+    //更新状态
+    updateStatus(ind, row){
+      console.log(row);
+      updatePlanOne(row).then(response=>{
+        if (response.code == 200) {
+          this.$message({
+            message: '修改成功',
+            type: 'success'
+          });
+          this.getAmmunitionPlanInfo();
+          //最后把弹窗关掉
+          this.nanInsertDialogTableVisible=false
+        } else {
+          this.$message({
+            message: '修改失败',
+            type: 'error'
+          });
+          //最后把弹窗关掉
+          this.nanInsertDialogTableVisible=false
+        }
+      })
+    }
+  },
+  computed: {
+
+  },
+}
+</script>
+
+<style scoped>
+.el-tabs--border-card >>> .el-tabs__content {
+  padding: 0 !important;
+}
+.el-table__body-wrapper {
+  cursor: grab;
+}
+.el-table__body-wrapper.grabbing {
+  cursor: grabbing;
+}
+</style>