|
@@ -15,18 +15,22 @@ import com.fjhx.mes.entity.report.po.ReportLossesDetails;
|
|
|
import com.fjhx.mes.entity.report.vo.ReportLossesDetailsVo;
|
|
|
import com.fjhx.mes.mapper.report.ReportLossesDetailsMapper;
|
|
|
import com.fjhx.mes.service.report.ReportLossesDetailsService;
|
|
|
+import com.fjhx.tenant.utils.DeptUstil;
|
|
|
import com.fjhx.wms.entity.stock.emums.JournalType;
|
|
|
import com.fjhx.wms.entity.stock.po.StockWait;
|
|
|
import com.fjhx.wms.entity.stock.po.StockWaitDetails;
|
|
|
import com.fjhx.wms.service.stock.StockWaitDetailsService;
|
|
|
import com.fjhx.wms.service.stock.StockWaitService;
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
@@ -79,6 +83,14 @@ public class ReportLossesDetailsServiceImpl extends ServiceImpl<ReportLossesDeta
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ Long companyId = SecurityUtils.getCompanyId();
|
|
|
+ if (!Objects.equals(companyId, 100L)) {
|
|
|
+ wrapper.eq("rld", ReportLossesDetails::getCompanyId, companyId);
|
|
|
+ } else {
|
|
|
+ wrapper.eq("rld", ReportLossesDetails::getCompanyId, dto.getCompanyId());
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
wrapper.groupBy("rld.id");
|
|
|
|
|
@@ -90,6 +102,15 @@ public class ReportLossesDetailsServiceImpl extends ServiceImpl<ReportLossesDeta
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ List<Long> companyIds = records.stream().map(ReportLossesDetailsVo::getCompanyId).collect(Collectors.toList());
|
|
|
+ Map<Long, String> companyNameMap = DeptUstil.getDeptNameMap(companyIds);
|
|
|
+
|
|
|
+ for (ReportLossesDetailsVo record : records) {
|
|
|
+
|
|
|
+ record.setCompanyName(companyNameMap.get(record.getCompanyId()));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
productInfoService.attributeAssign(records, ReportLossesDetailsVo::getMaterialId, (item, product) -> {
|
|
|
item.setMaterialCode(product.getCustomCode());
|
|
@@ -112,6 +133,10 @@ public class ReportLossesDetailsServiceImpl extends ServiceImpl<ReportLossesDeta
|
|
|
@DSTransactional
|
|
|
@Override
|
|
|
public void add(ReportLossesDetailsDto dto) {
|
|
|
+
|
|
|
+ Long companyId = SecurityUtils.getCompanyId();
|
|
|
+ dto.setCompanyId(companyId);
|
|
|
+
|
|
|
this.save(dto);
|
|
|
|
|
|
|
|
@@ -151,6 +176,15 @@ public class ReportLossesDetailsServiceImpl extends ServiceImpl<ReportLossesDeta
|
|
|
@Override
|
|
|
public JSONObject lossesStatistics(ReportLossesDetailsSelectDto dto) {
|
|
|
IWrapper<Object> wrapper = IWrapper.getWrapper();
|
|
|
+
|
|
|
+
|
|
|
+ Long companyId = SecurityUtils.getCompanyId();
|
|
|
+ if (!Objects.equals(companyId, 100L)) {
|
|
|
+ wrapper.eq("rld", ReportLossesDetails::getCompanyId, companyId);
|
|
|
+ } else {
|
|
|
+ wrapper.eq("rld", ReportLossesDetails::getCompanyId, dto.getCompanyId());
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
Integer pastDay = dto.getPastDay();
|
|
|
if (ObjectUtil.isNotEmpty(pastDay)) {
|