|
@@ -1,9 +1,14 @@
|
|
|
package org.jeecg.modules.appInterface.service.impl;
|
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import org.jeecg.modules.appInterface.entity.FbsWorkingStatistics;
|
|
|
import org.jeecg.modules.appInterface.mapper.FbsWorkingStatisticsMapper;
|
|
|
import org.jeecg.modules.appInterface.service.IFbsWorkingStatisticsService;
|
|
|
+import org.jeecg.modules.fbsAbnormalWorkingHours.entity.FbsAbnormalWorkingHours;
|
|
|
+import org.jeecg.modules.fbsAbnormalWorkingHours.entity.FbsAbnormalWorkingHoursDescribe;
|
|
|
+import org.jeecg.modules.fbsAbnormalWorkingHours.service.IFbsAbnormalWorkingHoursDescribeService;
|
|
|
+import org.jeecg.modules.fbsAbnormalWorkingHours.service.IFbsAbnormalWorkingHoursService;
|
|
|
import org.jeecg.modules.fbsWorkshopDispatchList.entity.FbsWorkshopDispatchList;
|
|
|
import org.jeecg.modules.fbsWorkshopDispatchList.service.IFbsWorkshopDispatchListService;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -13,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -31,6 +37,12 @@ public class FbsWorkingStatisticsServiceImpl extends ServiceImpl<FbsWorkingStati
|
|
|
@Resource
|
|
|
IFbsWorkshopDispatchListService iFbsWorkshopDispatchListService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ IFbsAbnormalWorkingHoursService iFbsAbnormalWorkingHoursService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ IFbsAbnormalWorkingHoursDescribeService iFbsAbnormalWorkingHoursDescribeService;
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String,Object> getByMaterial(String dateString) {
|
|
|
// List<FbsWorkingStatistics> fbsWorkingStatisticsList=fbsWorkingStatisticsMapper.getByMaterial(dateString);
|
|
@@ -102,6 +114,54 @@ public class FbsWorkingStatisticsServiceImpl extends ServiceImpl<FbsWorkingStati
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void startOperation(FbsWorkingStatistics fbsWorkingStatistics,FbsWorkshopDispatchList fbsWorkshopDispatchList) {
|
|
|
+ if(fbsWorkshopDispatchList!=null){
|
|
|
+ Date date = new Date();
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ QueryWrapper<FbsAbnormalWorkingHours> queryWrapper=new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(FbsAbnormalWorkingHours::getDelFlag,"0");
|
|
|
+ queryWrapper.eq("date_format(date,'%Y-%m-%d')",formatter.format(date));
|
|
|
+ List<FbsAbnormalWorkingHours> fbsAbnormalWorkingHoursList=iFbsAbnormalWorkingHoursService.list(queryWrapper);
|
|
|
+ if(fbsAbnormalWorkingHoursList!=null&&fbsAbnormalWorkingHoursList.size()>0){
|
|
|
+ //主键id
|
|
|
+ String fbsAbnormalWorkingHoursId=fbsAbnormalWorkingHoursList.get(0).getId();
|
|
|
+ //生产订单号
|
|
|
+ String productionOrderNumberName=fbsWorkshopDispatchList.getProductionOrderNumberName();
|
|
|
+ //查询异常子表信息
|
|
|
+ QueryWrapper<FbsAbnormalWorkingHoursDescribe> queryWrapper1=new QueryWrapper<>();
|
|
|
+ queryWrapper1.lambda().eq(FbsAbnormalWorkingHoursDescribe::getDelFlag,"0");
|
|
|
+ queryWrapper1.lambda().eq(FbsAbnormalWorkingHoursDescribe::getAbnormalWorkingHoursId,fbsAbnormalWorkingHoursId);
|
|
|
+ queryWrapper1.lambda().eq(FbsAbnormalWorkingHoursDescribe::getProductionOrderNumberName,productionOrderNumberName);
|
|
|
+ List<FbsAbnormalWorkingHoursDescribe> fbsAbnormalWorkingHoursDescribeList=iFbsAbnormalWorkingHoursDescribeService.list(queryWrapper1);
|
|
|
+ if(fbsAbnormalWorkingHoursDescribeList==null||fbsAbnormalWorkingHoursDescribeList.size()<=0){
|
|
|
+ FbsAbnormalWorkingHoursDescribe fbsAbnormalWorkingHoursDescribe=new FbsAbnormalWorkingHoursDescribe();
|
|
|
+ fbsAbnormalWorkingHoursDescribe.setAbnormalWorkingHoursId(fbsAbnormalWorkingHoursId);
|
|
|
+ fbsAbnormalWorkingHoursDescribe.setProductionOrderNumberName(productionOrderNumberName);
|
|
|
+ fbsAbnormalWorkingHoursDescribe.setProductId(fbsWorkshopDispatchList.getProductId());
|
|
|
+ fbsAbnormalWorkingHoursDescribe.setProduct(fbsWorkshopDispatchList.getProduct());
|
|
|
+ fbsAbnormalWorkingHoursDescribe.setPlannedQuantity(fbsWorkshopDispatchList.getPlannedQuantity());
|
|
|
+ //获取最大排序
|
|
|
+ QueryWrapper<FbsAbnormalWorkingHoursDescribe> queryWrapper2=new QueryWrapper<>();
|
|
|
+ queryWrapper2.lambda().eq(FbsAbnormalWorkingHoursDescribe::getDelFlag,"0");
|
|
|
+ queryWrapper2.lambda().eq(FbsAbnormalWorkingHoursDescribe::getAbnormalWorkingHoursId,fbsAbnormalWorkingHoursId);
|
|
|
+ queryWrapper2.lambda().orderByDesc(FbsAbnormalWorkingHoursDescribe::getSort);
|
|
|
+ List<FbsAbnormalWorkingHoursDescribe> fbsAbnormalWorkingHoursDescribeList2=iFbsAbnormalWorkingHoursDescribeService.list(queryWrapper2);
|
|
|
+ if(fbsAbnormalWorkingHoursDescribeList2!=null&&fbsAbnormalWorkingHoursDescribeList2.size()>0){
|
|
|
+ fbsAbnormalWorkingHoursDescribe.setSort(fbsAbnormalWorkingHoursDescribeList2.get(0).getSort()+1);
|
|
|
+ }else{
|
|
|
+ fbsAbnormalWorkingHoursDescribe.setSort(1);
|
|
|
+ }
|
|
|
+ fbsAbnormalWorkingHoursDescribe.setDelFlag("0");
|
|
|
+ //保存
|
|
|
+ iFbsAbnormalWorkingHoursDescribeService.save(fbsAbnormalWorkingHoursDescribe);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public BigDecimal getDecimalNew(String d){
|
|
|
BigDecimal decimal= new BigDecimal(d);
|
|
|
return decimal;
|