Browse Source

后台 看板问题修改

chenc 4 years ago
parent
commit
3f2e62b9ff

+ 30 - 10
src/main/java/org/jeecg/modules/appInterface/controller/FbsWorkingStatisticsController.java

@@ -19,6 +19,7 @@ import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
 
 import com.alibaba.druid.support.json.JSONUtils;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.apache.commons.lang.StringUtils;
@@ -362,10 +363,10 @@ public class FbsWorkingStatisticsController {
 			 return new ResponseEntity<ResHttpStatus>(res, HttpStatus.OK);
 		 }
 
-		 String[] batchCode = entity.getBatchCode().split(",");
-		 if(batchCode.length > 0){
-			 entity.setQualifiedNumber(String.valueOf(batchCode.length));
-		 }
+//		 String[] batchCode = entity.getBatchCode().split(",");
+//		 if(batchCode.length > 0){
+//			 entity.setQualifiedNumber(String.valueOf(batchCode.length));
+//		 }
 
 		 if(StringUtils.isBlank(entity.getState())){
 			 res.setCode("1");
@@ -500,17 +501,17 @@ public class FbsWorkingStatisticsController {
 	 public Object[] saveU8(FbsWorkingStatistics entity,FbsWorkshopDispatchList workshopDispatchList,BigDecimal allHors){
 		 Object[] mapR=new Object[]{};
 	 	if(StringUtils.isNotBlank(entity.getBatchCode())){
-			String[] batchCodes=entity.getBatchCode().split(",");//解析逗号分隔的批号
 			List<Map<String,Object>> mapList=new ArrayList<>();
-			for(String batchCode:batchCodes){
-				int i=1;
+			//获取批号json数组
+			JSONArray jsonArray = JSONArray.parseArray(entity.getBatchCode());
+			for(int i=0;i<jsonArray.size();i++){
 				//明细
 				Map<String,Object> itemMap=new LinkedHashMap<>();
 				itemMap.put("CINVCODE",workshopDispatchList.getProductId());//成品存货编码
-				itemMap.put("IQUANTITY",1);//数量
+				itemMap.put("IQUANTITY",jsonArray.getJSONObject(i).get("value"));//数量
 				itemMap.put("MOCODE",workshopDispatchList.getProductionOrderNumberName());//订单号
 				itemMap.put("MOROWMO",entity.getRowNumber());//行号
-				itemMap.put("CBATCH",batchCode);//批号
+				itemMap.put("CBATCH",jsonArray.getJSONObject(i).get("key"));//批号
 				itemMap.put("cDefine27",allHors.doubleValue());//实际工时
 				Double number=Double.valueOf(entity.getQualifiedNumber());//数量
 				Double working=Double.valueOf(workshopDispatchList.getStandardWorkingHoursZ());//U8标准工时
@@ -518,8 +519,27 @@ public class FbsWorkingStatisticsController {
 				String workingTatol=df.format(number*working);
 				itemMap.put("cDefine26",workingTatol);//实际总工时
 				mapList.add(itemMap);
-				i++;
 			}
+
+//			String[] batchCodes=entity.getBatchCode().split(",");//解析逗号分隔的批号
+//			for(String batchCode:batchCodes){
+//				int i=1;
+//				//明细
+//				Map<String,Object> itemMap=new LinkedHashMap<>();
+//				itemMap.put("CINVCODE",workshopDispatchList.getProductId());//成品存货编码
+//				itemMap.put("IQUANTITY",1);//数量
+//				itemMap.put("MOCODE",workshopDispatchList.getProductionOrderNumberName());//订单号
+//				itemMap.put("MOROWMO",entity.getRowNumber());//行号
+//				itemMap.put("CBATCH",batchCode);//批号
+//				itemMap.put("cDefine27",allHors.doubleValue());//实际工时
+//				Double number=Double.valueOf(entity.getQualifiedNumber());//数量
+//				Double working=Double.valueOf(workshopDispatchList.getStandardWorkingHoursZ());//U8标准工时
+//				DecimalFormat df = new DecimalFormat("#.00");
+//				String workingTatol=df.format(number*working);
+//				itemMap.put("cDefine26",workingTatol);//实际总工时
+//				mapList.add(itemMap);
+//				i++;
+//			}
 			//表头
 			Map<String,Object> map=new LinkedHashMap<>();
 			map.put("CSTORENAME","100");//账套号

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

@@ -38,7 +38,13 @@
             AND fawhd.del_flag = '0'
             AND fawhd.product IS NOT NULL
             AND fawhd.type='产品'
-            AND date_format( fawh.date, #{dateString} ) = DATE_FORMAT( now( ), #{dateString} )
+            <if test="dateString=='%Y-%m-%d'">
+                AND date_format( fawh.date, #{dateString} ) = DATE_FORMAT(date_sub(curdate(),interval 1 day), #{dateString} )
+            </if>
+            <if test="dateString=='%Y-%m'">
+                AND date_format( fawh.date, #{dateString} ) = DATE_FORMAT( now( ), #{dateString} )
+            </if>
+
         GROUP BY
             fawhd.product,fawhd.planned_quantity
     </select>

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

@@ -91,7 +91,7 @@
         <!-- SELECT b.cVenCode '供应商编码',c.cVenName '供应商名称',a.cInvCode '物料编码',d.cInvName '物料名称',d.cInvStd '规格',
                  fValidQuantity - fRealQuantity '已到货未入库数据',b.dportdate '到货日期'-->
         SELECT b.cVenCode cVenCode,c.cVenName vendorName,a.cInvCode materialCode,d.cInvName materialName,d.cInvStd specs,
-        a.iQuantity arriveSum,CONVERT(varchar(30),b.dDate ,112) arriveDate,a.cItemName cItemName
+        (a.fRealQuantity - a.fValidInQuan) arriveSum,CONVERT(varchar(30),b.dDate ,112) arriveDate,a.cItemName cItemName
         FROM
         PU_ArrivalVouchs a
         left join PU_ArrivalVouch b on a.id = b.id
@@ -99,7 +99,7 @@
         left join Inventory d on a.cInvCode = d.cInvCode
         where
         <!--(a.fValidQuantity - a.fValidInQuan) &gt; 0-->
-        (a.iQuantity - a.fRealQuantity) &gt; 0
+        (a.fRealQuantity - a.fValidInQuan) &gt; 0
         order by b.dDate desc
 
     </select>

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

@@ -165,6 +165,39 @@ public class FbsWorkshopDispatchListController {
 		
 		return result;
 	}
+
+	 @PutMapping(value = "/editR")
+	 public Result<FbsWorkshopDispatchList> editR(@RequestBody FbsWorkshopDispatchList fbsWorkshopDispatchList) {
+		 Result<FbsWorkshopDispatchList> result = new Result<FbsWorkshopDispatchList>();
+		 FbsWorkshopDispatchList fbsWorkshopDispatchListEntity = fbsWorkshopDispatchListService.getById(fbsWorkshopDispatchList.getId());
+		 if(fbsWorkshopDispatchListEntity==null) {
+			 result.error500("未找到对应实体");
+		 }else {
+			 boolean ok = fbsWorkshopDispatchListService.updateById(fbsWorkshopDispatchList);
+			 //根据订单号和产品查询对应的单据已近派工了多少数量
+			 LambdaQueryWrapper<FbsWorkshopDispatchList> lambdaQueryWrapper=new LambdaQueryWrapper<>();
+			 lambdaQueryWrapper.eq(FbsWorkshopDispatchList::getProductionOrderNumberId,fbsWorkshopDispatchList.getProductionOrderNumberId());
+			 lambdaQueryWrapper.eq(FbsWorkshopDispatchList::getProductId,fbsWorkshopDispatchList.getProductId());
+			 lambdaQueryWrapper.eq(FbsWorkshopDispatchList::getDelFlag,'0');
+			 List<FbsWorkshopDispatchList> fbsWorkshopDispatchListList=fbsWorkshopDispatchListService.list(lambdaQueryWrapper);
+			 BigDecimal bigDecimal=new BigDecimal("0.0");
+			 //获取总数量
+			 if(fbsWorkshopDispatchListList!=null&&fbsWorkshopDispatchListList.size()>0){
+				 for(FbsWorkshopDispatchList dispatchList:fbsWorkshopDispatchListList){
+					 bigDecimal=bigDecimal.add(dispatchList.getNumberOfTasks());
+				 }
+			 }
+			 //计划数量减去所有派工数量 获取剩余数量
+			 fbsWorkshopDispatchList.setRemainingQuantity(fbsWorkshopDispatchList.getPlannedQuantity().subtract(bigDecimal));
+			 fbsWorkshopDispatchListService.updateById(fbsWorkshopDispatchList);
+			 //TODO 返回false说明什么?
+			 if(ok) {
+				 result.success("修改成功!");
+			 }
+		 }
+
+		 return result;
+	 }
 	
 	/**
 	  *   通过id删除

+ 8 - 2
src/main/java/org/jeecg/modules/fbsWorkshopDispatchList/mapper/xml/FbsWorkshopDispatchListMapper.xml

@@ -119,7 +119,13 @@
             fbs_abnormal_working_hours
         WHERE
             del_flag = '0'
-            AND date_format( date, #{dateString} ) = DATE_FORMAT( now( ),  #{dateString} )
+            <if test="dateString=='%Y-%m-%d'">
+                AND date_format( date, #{dateString} ) = DATE_FORMAT( date_sub(curdate(),interval 1 day),  #{dateString} )
+            </if>
+            <if test="dateString=='%Y-%m'">
+                AND date_format( date, #{dateString} ) = DATE_FORMAT( now( ),  #{dateString} )
+            </if>
+
     </select>
 
     <select id="getAbnormalHoursMonthReportSameDay" resultType="java.util.HashMap">
@@ -355,7 +361,7 @@
     <select id="getListWhereStartEnd" resultType="org.jeecg.modules.fbsWorkshopDispatchList.entity.FbsWorkshopDispatchList">
         SELECT
         *,
-        CONVERT ( IFNULL( (standard_working_hours), 0 ) / IFNULL( ( man_hours_completed  ), 0 ), DECIMAL ( 15, 2 ) ) * 100 as productionEfficiency,
+        CONVERT ( IFNULL( (latest_completed_quantity), 0 )*IFNULL( (standard_working_hours_z), 0 ) / IFNULL( ( man_hours_completed  ), 0 ), DECIMAL ( 15, 2 ) ) * 100 as productionEfficiency,
         CONVERT ( IFNULL( (latest_completed_quantity), 0 ) / IFNULL( ( number_of_tasks  ), 0 ), DECIMAL ( 15, 2 ) ) * 100 as achievementRate
         FROM
         fbs_workshop_dispatch_list