|
@@ -6,6 +6,10 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import vip.xiaonuo.auth.core.pojo.SaBaseLoginUser;
|
|
|
+import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
|
|
|
+import vip.xiaonuo.erp.entity.SysBaseFilterInfo;
|
|
|
+import vip.xiaonuo.erp.mapper.SysBaseFilterInfoMapper;
|
|
|
import vip.xiaonuo.production.entity.*;
|
|
|
import vip.xiaonuo.production.entity.vo.ProductionLocationVo;
|
|
|
import vip.xiaonuo.production.mapper.*;
|
|
@@ -54,6 +58,8 @@ public class ProductionTargetServiceImpl extends ServiceImpl<ProductionTargetMap
|
|
|
private ProductionWriteEnergyMapper energyMapper;
|
|
|
@Autowired
|
|
|
private IProductionWorkstopPlanService planService;
|
|
|
+ @Autowired
|
|
|
+ private SysBaseFilterInfoMapper baseFilterInfoMapper;
|
|
|
|
|
|
@Override
|
|
|
public ProductionTarget getTarget(ProductionParam productionParam) {
|
|
@@ -61,9 +67,23 @@ public class ProductionTargetServiceImpl extends ServiceImpl<ProductionTargetMap
|
|
|
String time = productionParam.getTime();
|
|
|
String produceName = productionParam.getProduceName();
|
|
|
String locationName = productionParam.getLocationName();
|
|
|
-// Integer dataType = productionParam.getDataType();
|
|
|
ProductionTarget productionTarget = new ProductionTarget();
|
|
|
- /* if (1 == dataType) {
|
|
|
+ SaBaseLoginUser loginUser = StpLoginUserUtil.getLoginUser();
|
|
|
+ QueryWrapper<SysBaseFilterInfo> baseFilterInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ baseFilterInfoQueryWrapper.eq("user_id", loginUser.getId()).eq("module_type", "produce");
|
|
|
+ SysBaseFilterInfo sysBaseFilterInfo = baseFilterInfoMapper.selectOne(baseFilterInfoQueryWrapper);
|
|
|
+ String type = "";
|
|
|
+ if (ObjectUtil.isEmpty(sysBaseFilterInfo)) {
|
|
|
+ sysBaseFilterInfo.setFilter("0");
|
|
|
+ sysBaseFilterInfo.setUserId(loginUser.getId());
|
|
|
+ sysBaseFilterInfo.setModuleType("produce");
|
|
|
+ baseFilterInfoMapper.insert(sysBaseFilterInfo);
|
|
|
+ type = "0";
|
|
|
+ } else {
|
|
|
+ type = sysBaseFilterInfo.getFilter();//填报实际产量 0 erp数据 1填报数据
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("0".equals(type)) {
|
|
|
QueryWrapper<ProductionWorkstopPlan> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq(StringUtils.isNotBlank(orgId), "org_id", orgId);
|
|
|
queryWrapper.between("create_time", time + "-01 00:00:00", time + "-31 23:59:59");
|
|
@@ -97,7 +117,7 @@ public class ProductionTargetServiceImpl extends ServiceImpl<ProductionTargetMap
|
|
|
}
|
|
|
}
|
|
|
productionTarget.setActualProduction(workstopPlan.getActualProduction());
|
|
|
- } else {*/
|
|
|
+ } else {
|
|
|
QueryWrapper<ProductionWritePlan> queryWrapper1 = new QueryWrapper<>();
|
|
|
queryWrapper1.eq(StringUtils.isNotBlank(orgId), "org_id", orgId);
|
|
|
queryWrapper1.eq(StringUtils.isNotBlank(locationName), "location_name", locationName);
|
|
@@ -122,7 +142,7 @@ public class ProductionTargetServiceImpl extends ServiceImpl<ProductionTargetMap
|
|
|
}
|
|
|
}
|
|
|
productionTarget.setActualProduction(writePlan.getActualProduction());
|
|
|
-// }
|
|
|
+ }
|
|
|
|
|
|
QueryWrapper<ProductionWriteRate> rateQueryWrapper = new QueryWrapper<>();
|
|
|
rateQueryWrapper.eq(StringUtils.isNotBlank(orgId), "org_id", orgId);
|