chenchuang 2 years ago
parent
commit
8f6775fdd1

+ 4 - 1
src/main/java/org/jeecg/modules/appInterface/controller/FbsWorkingStatisticsController.java

@@ -1139,7 +1139,7 @@ public class FbsWorkingStatisticsController {
 		 Result<IPage<FbsWorkingStatistics>> result = new Result<IPage<FbsWorkingStatistics>>();
 		 //人员编码
 		 String personnelCode=fbsWorkingStatistics.getPersonnelCode();
-		 if(StringUtils.isNotBlank(personnelCode)&&personnelCode.equals("null")){
+		 if(StringUtils.isNotBlank(personnelCode)){
 			 fbsWorkingStatistics.setPersonnelCode(null);
 		 }
 		 //开始时间结束时间
@@ -1194,6 +1194,9 @@ public class FbsWorkingStatisticsController {
 		 QueryWrapper<FbsWorkingStatistics> queryWrapper = QueryGenerator.initQueryWrapper(fbsWorkingStatistics, req.getParameterMap());
 		 queryWrapper.eq("fws.del_flag","0");
 		 queryWrapper.groupBy("fwdl.cost_item_code","fwdl.project_name","ftp.memo","fws.order_number","fws.materiel_code","fws.materiel_name","fws.fbs_technological_process_item_id","fws.fbs_technological_process_item_name");
+		 if(StringUtils.isNotBlank(personnelCode)&&!personnelCode.equals("null")){
+			 queryWrapper.having("group_concat(distinct fws.personnel_code separator ',') like {0}","%"+personnelCode+"%");
+		 }
 		 if(StringUtils.isNotBlank(costItemCode)){
 		 	queryWrapper.eq("fwdl.cost_item_code",costItemCode);
 		 }

+ 2 - 2
src/main/java/org/jeecg/modules/appInterface/mapper/xml/FbsWorkingStatisticsMapper.xml

@@ -225,8 +225,8 @@
             fws.materiel_name,
             fws.fbs_technological_process_item_id,
             fws.fbs_technological_process_item_name,
-            group_concat(fws.personnel_code separator ',') as personnelCode,
-            group_concat(fws.personnel_name separator ',') as personnelName,
+            group_concat(distinct fws.personnel_code separator ',') as personnelCode,
+            group_concat(distinct fws.personnel_name separator ',') as personnelName,
             min( fws.first_time ) as firstTime,
             max( fws.final_time ) as finalTime,
             sum( fws.working_hours ) as workingHours,

+ 5 - 5
src/main/java/org/jeecg/modules/fbsAbnormalWorkingHours/mapper/xml/FbsAbnormalWorkingHoursMapper.xml

@@ -151,11 +151,11 @@
     <select id="findByPage" resultType="org.jeecg.modules.fbsAbnormalWorkingHours.entity.FbsAbnormalWorkingHours">
         SELECT
             IFNULL(fawh.train,0)+IFNULL(fawh.meeting,0)+IFNULL(fawh.research_and_development,0)+IFNULL(fawh.five_s,0)+IFNULL(fawh.other,0) as invalidWork,
-            (select sum(IFNULL(fawhdd.abnormal_working_hours,0)) from fbs_abnormal_working_hours_describe fawhdd where fawhdd.abnormal_working_hours_id=fawh.id AND fawhdd.anomaly_classification='1' AND (fawhdd.cost_item_code=fawhd.cost_item_code or fawhd.cost_item_code is null) AND (fawhdd.project_name=fawhd.project_name or fawhd.project_name is null) AND fawhdd.production_order_number_name=fawhd.production_order_number_name AND fawhdd.product_id=fawhd.product_id AND fawhdd.product=fawhd.product) as anomalyClassification1,
-            (select sum(IFNULL(fawhdd.abnormal_working_hours,0)) from fbs_abnormal_working_hours_describe fawhdd where fawhdd.abnormal_working_hours_id=fawh.id AND fawhdd.anomaly_classification='2' AND (fawhdd.cost_item_code=fawhd.cost_item_code or fawhd.cost_item_code is null) AND (fawhdd.project_name=fawhd.project_name or fawhd.project_name is null) AND fawhdd.production_order_number_name=fawhd.production_order_number_name AND fawhdd.product_id=fawhd.product_id AND fawhdd.product=fawhd.product) as anomalyClassification2,
-            (select sum(IFNULL(fawhdd.abnormal_working_hours,0)) from fbs_abnormal_working_hours_describe fawhdd where fawhdd.abnormal_working_hours_id=fawh.id AND fawhdd.anomaly_classification='3' AND (fawhdd.cost_item_code=fawhd.cost_item_code or fawhd.cost_item_code is null) AND (fawhdd.project_name=fawhd.project_name or fawhd.project_name is null) AND fawhdd.production_order_number_name=fawhd.production_order_number_name AND fawhdd.product_id=fawhd.product_id AND fawhdd.product=fawhd.product) as anomalyClassification3,
-            (select sum(IFNULL(fawhdd.abnormal_working_hours,0)) from fbs_abnormal_working_hours_describe fawhdd where fawhdd.abnormal_working_hours_id=fawh.id AND fawhdd.anomaly_classification='4' AND (fawhdd.cost_item_code=fawhd.cost_item_code or fawhd.cost_item_code is null) AND (fawhdd.project_name=fawhd.project_name or fawhd.project_name is null) AND fawhdd.production_order_number_name=fawhd.production_order_number_name AND fawhdd.product_id=fawhd.product_id AND fawhdd.product=fawhd.product) as anomalyClassification4,
-            (select sum(IFNULL(fawhdd.abnormal_working_hours,0)) from fbs_abnormal_working_hours_describe fawhdd where fawhdd.abnormal_working_hours_id=fawh.id AND fawhdd.anomaly_classification='5' AND (fawhdd.cost_item_code=fawhd.cost_item_code or fawhd.cost_item_code is null) AND (fawhdd.project_name=fawhd.project_name or fawhd.project_name is null) AND fawhdd.production_order_number_name=fawhd.production_order_number_name AND fawhdd.product_id=fawhd.product_id AND fawhdd.product=fawhd.product) as anomalyClassification5,
+            sum((select sum(IFNULL(fawhdd.abnormal_working_hours,0)) from fbs_abnormal_working_hours_describe fawhdd where fawhdd.id=fawhd.id AND fawhdd.anomaly_classification='1'))  as anomalyClassification1,
+            sum((select sum(IFNULL(fawhdd.abnormal_working_hours,0)) from fbs_abnormal_working_hours_describe fawhdd where fawhdd.id=fawhd.id AND fawhdd.anomaly_classification='2'))  as anomalyClassification2,
+            sum((select sum(IFNULL(fawhdd.abnormal_working_hours,0)) from fbs_abnormal_working_hours_describe fawhdd where fawhdd.id=fawhd.id AND fawhdd.anomaly_classification='3'))  as anomalyClassification3,
+            sum((select sum(IFNULL(fawhdd.abnormal_working_hours,0)) from fbs_abnormal_working_hours_describe fawhdd where fawhdd.id=fawhd.id AND fawhdd.anomaly_classification='4'))  as anomalyClassification4,
+            sum((select sum(IFNULL(fawhdd.abnormal_working_hours,0)) from fbs_abnormal_working_hours_describe fawhdd where fawhdd.id=fawhd.id AND fawhdd.anomaly_classification='5'))  as anomalyClassification5,
             fawh.*
         FROM
             fbs_abnormal_working_hours fawh

+ 3 - 0
src/main/java/org/jeecg/modules/fbsPuArrivalvouch/mapper/xml/FbsPuArrivalvouchMapper.xml

@@ -106,6 +106,7 @@
         where
         <!--(a.fValidQuantity - a.fValidInQuan) &gt; 0-->
         (a.fRealQuantity - a.fValidInQuan) &gt; 0
+        and DATE_FORMAT( b.dDate, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
         and d.bPropertyCheck=1
         order by b.dDate desc
 
@@ -244,7 +245,9 @@
         LEFT JOIN PU_ArrivalVouch p ON pa.ID= p.ID
         left join Inventory d on pa.cInvCode = d.cInvCode
         WHERE
+
         (pa.fRealQuantity - pa.fValidInQuan) &gt; 0
+        and DATE_FORMAT( p.dDate, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
         AND d.bPropertyCheck=1
         <!--(pa.iQuantity-pa.fRealQuantity)>0 -->
 	    <!--and

+ 16 - 0
src/main/java/org/jeecg/modules/fbsWorkshopDispatchList/controller/FbsWorkshopDispatchListController.java

@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import io.swagger.models.auth.In;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
@@ -1087,4 +1088,19 @@ public class FbsWorkshopDispatchListController {
 		return result;
 	 }
 
+	 /**
+	  * 查询派工当月效率
+	  * @return
+	  */
+	 @GetMapping(value = "/getProduceRateTotal")
+	 public Result<Integer> getProduceRateTotal(){
+		 Result<Integer> result=new Result<>();
+		 Integer  produceRate=fbsWorkshopDispatchListService.getProduceRateTotal();
+		 if(produceRate==null){
+			 produceRate=0;
+		 }
+		 result.setResult(produceRate);
+		 return result;
+	 }
+
 }

+ 6 - 0
src/main/java/org/jeecg/modules/fbsWorkshopDispatchList/mapper/FbsWorkshopDispatchListMapper.java

@@ -205,4 +205,10 @@ public interface FbsWorkshopDispatchListMapper extends BaseMapper<FbsWorkshopDis
     * @return void
     */
     void updateSAPstateByCode(@Param("SAPState")String SAPState,@Param("code")String code);
+
+    /**
+     * 获取当月派工完成的效率
+     * @return
+     */
+    Integer getProduceRateTotal();
 }

+ 12 - 0
src/main/java/org/jeecg/modules/fbsWorkshopDispatchList/mapper/xml/FbsWorkshopDispatchListMapper.xml

@@ -572,4 +572,16 @@
     <update id="updateSAPstateByCode">
         update fbs_workshop_dispatch_list set SAP_state=#{SAPState} where production_order_number_name=#{code} and del_flag='0'
     </update>
+
+    <select id="getProduceRateTotal" resultType="java.lang.Integer">
+        SELECT
+            ROUND( sum( latest_completed_quantity * standard_working_hours_z )/ sum( man_hours_completed )* 100, 0 )
+        FROM
+            `fbs_workshop_dispatch_list`
+        WHERE
+            del_flag = '0'
+          AND latest_completed_quantity = number_of_tasks
+          AND DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' )
+          and production_order_number_name not like concat('23','%')
+    </select>
 </mapper>

+ 2 - 0
src/main/java/org/jeecg/modules/fbsWorkshopDispatchList/service/IFbsWorkshopDispatchListService.java

@@ -190,4 +190,6 @@ public interface IFbsWorkshopDispatchListService extends IService<FbsWorkshopDis
 
 
     FbsWorkshopDispatchList getPlanningReport();
+
+    Integer getProduceRateTotal();
 }

+ 6 - 0
src/main/java/org/jeecg/modules/fbsWorkshopDispatchList/service/impl/FbsWorkshopDispatchListServiceImpl.java

@@ -316,6 +316,7 @@ public class FbsWorkshopDispatchListServiceImpl extends ServiceImpl<FbsWorkshopD
                         BigDecimal latestCompletedQuantityTotal=new BigDecimal("0.0");
                         if(fbsWorkshopDispatchListEntiy.getLatestCompletedQuantityTotal()!=null){
                             latestCompletedQuantityTotal=fbsWorkshopDispatchListEntiy.getLatestCompletedQuantityTotal();
+                            fbsWorkshopDispatchList.setLatestCompletedQuantityTotal(latestCompletedQuantityTotal);
                         }
                         //剩余标准数量
                         fbsWorkshopDispatchList.setSurplusNumberOfTasksTotal(qty.subtract(latestCompletedQuantityTotal));
@@ -809,5 +810,10 @@ public class FbsWorkshopDispatchListServiceImpl extends ServiceImpl<FbsWorkshopD
         return fbsWorkshopDispatchList;
     }
 
+    @Override
+    public Integer getProduceRateTotal() {
+        return this.baseMapper.getProduceRateTotal();
+    }
+
 
 }