Bladeren bron

修改生产计划看板

wuhb 6 maanden geleden
bovenliggende
commit
a364b98b91

+ 4 - 4
mes/ktg-admin/src/main/resources/application-dev.yml

@@ -6,13 +6,13 @@ spring:
         druid:
             # 主库数据源
             master:
-                url: jdbc:mysql://localhost:3306/ygtx_zx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+#                url: jdbc:mysql://localhost:3306/ygtx_zx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
 #                url: jdbc:mysql://localhost:3306/yz_emcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-                #url: jdbc:mysql://175.42.33.78:3306/ygtx_emcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                url: jdbc:mysql://175.42.33.78:3306/zx_emcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                 #url: jdbc:mysql://118.195.146.34:3306/j2eedb?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
                 username: root
-                #password: ygtx@365
-                password: 123123
+                password: ygtx@365
+#                password: 123123
 #                password: yykj@365
             # 从库数据源
             slave:

+ 2 - 11
mes/ktg-mes/src/main/java/com/ktg/mes/pro/controller/ProPlanController.java

@@ -137,16 +137,7 @@ public class ProPlanController extends BaseController
     @GetMapping(value = "/getToday")
     public AjaxResult getToday()
     {
-        ProPlan proPlan = new ProPlan();
-        proPlan.setPlanDate(DateUtil.parseDate(DateUtil.today()));
-        List<ProPlan> list = proPlanService.selectProPlanList(proPlan);
-        if(list.size()>1){
-            return AjaxResult.error("今天计划超过1个");
-        }
-        if(list.size() == 1){
-            proPlan = list.get(0);
-            proPlan = proPlanService.selectProPlanByPlanId(proPlan.getPlanId());
-        }
-        return AjaxResult.success(proPlan);
+        List<ProPlan> proPlanList = proPlanService.selectProPlanByToday();
+        return AjaxResult.success(proPlanList);
     }
 }

+ 12 - 0
mes/ktg-mes/src/main/java/com/ktg/mes/pro/domain/ProPlanLine.java

@@ -70,6 +70,10 @@ public class ProPlanLine extends BaseEntity
     @Excel(name = "生产数量")
     private Long producedQty;
 
+    /** 生产NG数量 */
+    @Excel(name = "生产NG数量")
+    private Long producedQtyNg;;
+
     /** 开始时间 */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
@@ -304,6 +308,14 @@ public class ProPlanLine extends BaseEntity
         this.moldCode = moldCode;
     }
 
+    public Long getProducedQtyNg() {
+        return producedQtyNg;
+    }
+
+    public void setProducedQtyNg(Long producedQtyNg) {
+        this.producedQtyNg = producedQtyNg;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 19 - 13
mes/ktg-mes/src/main/java/com/ktg/mes/pro/mapper/ProPlanMapper.java

@@ -6,15 +6,15 @@ import com.ktg.mes.pro.domain.ProPlanLine;
 
 /**
  * 生产计划Mapper接口
- * 
+ *
  * @author wuhb
  * @date 2025-08-29
  */
-public interface ProPlanMapper 
+public interface ProPlanMapper
 {
     /**
      * 查询生产计划
-     * 
+     *
      * @param planId 生产计划主键
      * @return 生产计划
      */
@@ -22,15 +22,21 @@ public interface ProPlanMapper
 
     /**
      * 查询生产计划列表
-     * 
+     *
      * @param proPlan 生产计划
      * @return 生产计划集合
      */
     public List<ProPlan> selectProPlanList(ProPlan proPlan);
 
+    /**
+     *
+     * @return 生产计划集合
+     */
+    public List<ProPlan> selectProPlanByToday();
+
     /**
      * 新增生产计划
-     * 
+     *
      * @param proPlan 生产计划
      * @return 结果
      */
@@ -38,7 +44,7 @@ public interface ProPlanMapper
 
     /**
      * 修改生产计划
-     * 
+     *
      * @param proPlan 生产计划
      * @return 结果
      */
@@ -46,7 +52,7 @@ public interface ProPlanMapper
 
     /**
      * 删除生产计划
-     * 
+     *
      * @param planId 生产计划主键
      * @return 结果
      */
@@ -54,7 +60,7 @@ public interface ProPlanMapper
 
     /**
      * 批量删除生产计划
-     * 
+     *
      * @param planIds 需要删除的数据主键集合
      * @return 结果
      */
@@ -62,24 +68,24 @@ public interface ProPlanMapper
 
     /**
      * 批量删除生产计划明细
-     * 
+     *
      * @param planIds 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteProPlanLineByPlanIds(Long[] planIds);
-    
+
     /**
      * 批量新增生产计划明细
-     * 
+     *
      * @param proPlanLineList 生产计划明细列表
      * @return 结果
      */
     public int batchProPlanLine(List<ProPlanLine> proPlanLineList);
-    
+
 
     /**
      * 通过生产计划主键删除生产计划明细信息
-     * 
+     *
      * @param planId 生产计划ID
      * @return 结果
      */

+ 10 - 8
mes/ktg-mes/src/main/java/com/ktg/mes/pro/service/IProPlanService.java

@@ -5,15 +5,15 @@ import com.ktg.mes.pro.domain.ProPlan;
 
 /**
  * 生产计划Service接口
- * 
+ *
  * @author wuhb
  * @date 2025-08-29
  */
-public interface IProPlanService 
+public interface IProPlanService
 {
     /**
      * 查询生产计划
-     * 
+     *
      * @param planId 生产计划主键
      * @return 生产计划
      */
@@ -21,7 +21,7 @@ public interface IProPlanService
 
     /**
      * 查询生产计划列表
-     * 
+     *
      * @param proPlan 生产计划
      * @return 生产计划集合
      */
@@ -29,7 +29,7 @@ public interface IProPlanService
 
     /**
      * 新增生产计划
-     * 
+     *
      * @param proPlan 生产计划
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface IProPlanService
 
     /**
      * 修改生产计划
-     * 
+     *
      * @param proPlan 生产计划
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface IProPlanService
 
     /**
      * 批量删除生产计划
-     * 
+     *
      * @param planIds 需要删除的生产计划主键集合
      * @return 结果
      */
@@ -53,9 +53,11 @@ public interface IProPlanService
 
     /**
      * 删除生产计划信息
-     * 
+     *
      * @param planId 生产计划主键
      * @return 结果
      */
     public int deleteProPlanByPlanId(Long planId);
+
+    public List<ProPlan> selectProPlanByToday();
 }

+ 13 - 9
mes/ktg-mes/src/main/java/com/ktg/mes/pro/service/impl/ProPlanServiceImpl.java

@@ -14,19 +14,19 @@ import com.ktg.mes.pro.service.IProPlanService;
 
 /**
  * 生产计划Service业务层处理
- * 
+ *
  * @author wuhb
  * @date 2025-08-29
  */
 @Service
-public class ProPlanServiceImpl implements IProPlanService 
+public class ProPlanServiceImpl implements IProPlanService
 {
     @Autowired
     private ProPlanMapper proPlanMapper;
 
     /**
      * 查询生产计划
-     * 
+     *
      * @param planId 生产计划主键
      * @return 生产计划
      */
@@ -38,7 +38,7 @@ public class ProPlanServiceImpl implements IProPlanService
 
     /**
      * 查询生产计划列表
-     * 
+     *
      * @param proPlan 生产计划
      * @return 生产计划
      */
@@ -50,7 +50,7 @@ public class ProPlanServiceImpl implements IProPlanService
 
     /**
      * 新增生产计划
-     * 
+     *
      * @param proPlan 生产计划
      * @return 结果
      */
@@ -66,7 +66,7 @@ public class ProPlanServiceImpl implements IProPlanService
 
     /**
      * 修改生产计划
-     * 
+     *
      * @param proPlan 生产计划
      * @return 结果
      */
@@ -82,7 +82,7 @@ public class ProPlanServiceImpl implements IProPlanService
 
     /**
      * 批量删除生产计划
-     * 
+     *
      * @param planIds 需要删除的生产计划主键
      * @return 结果
      */
@@ -96,7 +96,7 @@ public class ProPlanServiceImpl implements IProPlanService
 
     /**
      * 删除生产计划信息
-     * 
+     *
      * @param planId 生产计划主键
      * @return 结果
      */
@@ -110,7 +110,7 @@ public class ProPlanServiceImpl implements IProPlanService
 
     /**
      * 新增生产计划明细信息
-     * 
+     *
      * @param proPlan 生产计划对象
      */
     public void insertProPlanLine(ProPlan proPlan)
@@ -131,4 +131,8 @@ public class ProPlanServiceImpl implements IProPlanService
             }
         }
     }
+
+    public List<ProPlan> selectProPlanByToday(){
+        return proPlanMapper.selectProPlanByToday();
+    }
 }

+ 13 - 0
mes/ktg-mes/src/main/resources/mapper/pro/ProPlanMapper.xml

@@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="specification"    column="sub_specification"    />
         <result property="plannedQty"    column="sub_planned_qty"    />
         <result property="producedQty"    column="sub_produced_qty"    />
+        <result property="producedQtyNg"    column="sub_produced_qty_ng"    />
         <result property="startDate"    column="sub_start_date"    />
         <result property="endDate"    column="sub_end_date"    />
         <result property="status"    column="sub_status"    />
@@ -85,6 +86,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where a.plan_id = #{planId}
     </select>
 
+    <select id="selectProPlanByToday" resultMap="ProPlanProPlanLineResult">
+        select a.plan_id, a.plan_code, a.plan_name, a.plan_date, a.status, a.remark, a.attr1, a.attr2, a.attr3, a.attr4, a.create_by, a.create_time, a.update_by, a.update_time,
+            b.line_id as sub_line_id, b.plan_id as sub_plan_id, b.machinery_id as sub_machinery_id,
+            (select status from dv_machinery where machinery_id = b.machinery_id) sub_machinery_status,
+            COALESCE((select sum(res6) from dv_machinery_data where machinery_code =b.machinery_code and b.start_date &lt;= create_time and create_time&lt;b.end_date), 0) as sub_produced_qty,
+            COALESCE((select sum(res7) from dv_machinery_data where machinery_code =b.machinery_code and b.start_date &lt;= create_time and create_time&lt;b.end_date), 0) as sub_produced_qty_ng,
+            b.machinery_name as sub_machinery_name, b.machinery_code as sub_machinery_code, b.mold_name as sub_mold_name, b.mold_id as sub_mold_id, b.mold_code as sub_mold_code, b.item_id as sub_item_id, b.item_code as sub_item_code, b.item_name as sub_item_name, b.specification as sub_specification, b.planned_qty as sub_planned_qty, b.start_date as sub_start_date, b.end_date as sub_end_date, b.status as sub_status, b.remark as sub_remark, b.attr1 as sub_attr1, b.attr2 as sub_attr2, b.attr3 as sub_attr3, b.attr4 as sub_attr4, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
+        from pro_plan a
+        left join pro_plan_line b on b.plan_id = a.plan_id
+        where b.start_date &lt;= CURDATE() and CURDATE() &lt; b.end_date
+    </select>
+
     <insert id="insertProPlan" parameterType="ProPlan" useGeneratedKeys="true" keyProperty="planId">
         insert into pro_plan
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 29 - 26
mes/mes-ui/src/views/mes/dv/dashboard/planMachine.vue

@@ -6,34 +6,37 @@
                 <div class="datetime">{{ currentTime }}</div>
             </div>
         </div>
-        <div class="devices">
-            <div>
-                <span>单据编号:{{ proPlan.planCode }}</span>
+        <div v-for="item in proPlan" :key="item.id" style="margin-bottom: 20px;">
+            <div class="devices">
+                <div>
+                    <span>单据编号:{{ item.planCode }}</span>
+                </div>
+                <div>
+                    <span>制单日期:{{ item.planDate }}</span>
+                </div>
             </div>
-            <div>
-                <span>制单日期:{{ proPlan.planDate }}</span>
+            <div class="devices">
+                <el-table border :data="item.proPlanLineList" 
+                :cell-style="{ color: '#fff' }"
+                :header-cell-style="{ color: '#fff' }">
+                    <el-table-column label="设备(#)" prop="machineryName" min-width="15%" /> 
+                    <el-table-column label="机台状态(#)" prop="machineryStatus" min-width="8%">
+                        <template slot-scope="scope">
+                            <dict-tag :options="dict.type.mes_machinery_status" :value="scope.row.machineryStatus"/>
+                        </template>
+                    </el-table-column> 
+                    <el-table-column label="模具工装" prop="moldName" min-width="10%" />
+                    <el-table-column label="物料名称" prop="itemName" min-width="15%" />
+                    <el-table-column label="物料编号" prop="itemCode" min-width="15%" />
+                    <el-table-column label="排产数量" prop="plannedQty" min-width="8%" />
+                    <el-table-column label="开始时间" prop="startDate" min-width="10%" />  
+                    <el-table-column label="结束时间" prop="endDate" min-width="10%" />   
+                    <el-table-column label="生产数量" prop="producedQty" min-width="8%" />
+                    <el-table-column label="NG数量" prop="producedQtyNg" min-width="8%" />
+                    <el-table-column label="备注" prop="remark" min-width="10%" />
+                </el-table>
             </div>
         </div>
-        <div class="devices">
-            <el-table border :data="proPlan.proPlanLineList" 
-            :cell-style="{ color: '#fff' }"
-            :header-cell-style="{ color: '#fff' }">
-                <el-table-column label="设备(#)" prop="machineryName" min-width="15%" /> 
-                <el-table-column label="机台状态(#)" prop="machineryStatus" min-width="8%">
-                    <template slot-scope="scope">
-                        <dict-tag :options="dict.type.mes_machinery_status" :value="scope.row.machineryStatus"/>
-                    </template>
-                </el-table-column> 
-                <el-table-column label="模具工装" prop="moldName" min-width="10%" />
-                <el-table-column label="物料名称" prop="itemName" min-width="15%" />
-                <el-table-column label="物料编号" prop="itemCode" min-width="15%" />
-                <el-table-column label="排产数量" prop="plannedQty" min-width="8%" />
-                <el-table-column label="开始时间" prop="startDate" min-width="10%" />  
-                <el-table-column label="结束时间" prop="endDate" min-width="10%" />   
-                <el-table-column label="生产数量" prop="producedQty" min-width="8%" />
-                <el-table-column label="备注" prop="remark" min-width="10%" />
-            </el-table>
-        </div>
     </div>
 </template>
 
@@ -46,7 +49,7 @@ export default {
     dicts: ['mes_machinery_status'],
     data() {
         return {
-            proPlan: '',
+            proPlan: [],
             currentTime: '',
             timeTimer: '',
             reloadTimer: '',