|
|
@ -5,6 +5,7 @@ import java.math.RoundingMode;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.os.common.constant.MesConstants;
|
|
|
|
import com.os.common.exception.ServiceException;
|
|
|
|
import com.os.common.exception.ServiceException;
|
|
|
|
import com.os.common.utils.DateUtils;
|
|
|
|
import com.os.common.utils.DateUtils;
|
|
|
|
import com.os.common.utils.StringUtils;
|
|
|
|
import com.os.common.utils.StringUtils;
|
|
|
@ -172,8 +173,8 @@ public class RecordStaffSalaryServiceImpl implements IRecordStaffSalaryService {
|
|
|
|
long objId = 1L;
|
|
|
|
long objId = 1L;
|
|
|
|
String taskCode = PlanCodeUtils.getTaskCode();
|
|
|
|
String taskCode = PlanCodeUtils.getTaskCode();
|
|
|
|
Map<String, List<ProdPlanExecuteUser>> orderCodeMap = planUserList.stream().collect(Collectors.groupingBy(ProdPlanExecuteUser::getOrderCode));
|
|
|
|
Map<String, List<ProdPlanExecuteUser>> orderCodeMap = planUserList.stream().collect(Collectors.groupingBy(ProdPlanExecuteUser::getOrderCode));
|
|
|
|
for (String planCode : orderCodeMap.keySet()) {
|
|
|
|
for (String orderCode : orderCodeMap.keySet()) {
|
|
|
|
List<ProdPlanExecuteUser> orderCodeUserList = orderCodeMap.get(planCode);
|
|
|
|
List<ProdPlanExecuteUser> orderCodeUserList = orderCodeMap.get(orderCode);
|
|
|
|
for (ProdPlanExecuteUser prodPlanExecuteUser : orderCodeUserList) {
|
|
|
|
for (ProdPlanExecuteUser prodPlanExecuteUser : orderCodeUserList) {
|
|
|
|
//工序工资系数
|
|
|
|
//工序工资系数
|
|
|
|
BigDecimal coefficient = new BigDecimal(0);
|
|
|
|
BigDecimal coefficient = new BigDecimal(0);
|
|
|
@ -181,29 +182,42 @@ public class RecordStaffSalaryServiceImpl implements IRecordStaffSalaryService {
|
|
|
|
BigDecimal totalArea = new BigDecimal(0);
|
|
|
|
BigDecimal totalArea = new BigDecimal(0);
|
|
|
|
///参加该工序的所有人的工资系数的总和
|
|
|
|
///参加该工序的所有人的工资系数的总和
|
|
|
|
BigDecimal wageCoefficientSum = new BigDecimal(0);
|
|
|
|
BigDecimal wageCoefficientSum = new BigDecimal(0);
|
|
|
|
|
|
|
|
///该工序的输送带面积
|
|
|
|
|
|
|
|
BigDecimal beltTotalArea = new BigDecimal(0);
|
|
|
|
|
|
|
|
//当前工序编号
|
|
|
|
|
|
|
|
String currentProcessCode = null;
|
|
|
|
//硫化工序 工序硫化的工资 = 硫化系数*硫化面积*(工资系数/参加该工序的所有人的工资系数的总和)
|
|
|
|
//硫化工序 工序硫化的工资 = 硫化系数*硫化面积*(工资系数/参加该工序的所有人的工资系数的总和)
|
|
|
|
//硫化面积=硫化米数/客户要求总米数*硫化面积
|
|
|
|
//硫化面积=硫化米数/客户要求总米数*硫化面积
|
|
|
|
if (prodPlanExecuteUser.getProcessCode().equals("1002")) {
|
|
|
|
if (prodPlanExecuteUser.getProcessCode().equals(MesConstants.MES_PROCESS_VULCANIZATION)) {
|
|
|
|
coefficient = salaryData.getVulcanizationCoefficient();
|
|
|
|
coefficient = salaryData.getVulcanizationCoefficient();
|
|
|
|
totalArea = orderCodeUserList.stream().filter(e -> e.getProcessCode().equals("1002"))
|
|
|
|
beltTotalArea = prodPlanExecuteUser.getSulfurizationArea();
|
|
|
|
.map(e -> e.getCompleteAmount().divide(e.getBeltRequiredLength(), 6, RoundingMode.HALF_UP)
|
|
|
|
}
|
|
|
|
.multiply(e.getSulfurizationArea())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
//出布工序
|
|
|
|
wageCoefficientSum = orderCodeUserList.stream().filter(e -> e.getProcessCode().equals("1002"))
|
|
|
|
if (prodPlanExecuteUser.getProcessCode().equals(MesConstants.MES_PROCESS_OUT_CLOTH)) {
|
|
|
|
.map(ProdPlanExecuteUser::getWageCoefficient).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
coefficient = salaryData.getDistributionCoefficient();
|
|
|
|
|
|
|
|
beltTotalArea = prodPlanExecuteUser.getRolledFabricArea();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//成型工序
|
|
|
|
//成型工序
|
|
|
|
if (prodPlanExecuteUser.getProcessCode().equals("1001")) {
|
|
|
|
if (prodPlanExecuteUser.getProcessCode().equals(MesConstants.MES_PROCESS_FORMING)) {
|
|
|
|
coefficient = salaryData.getFormingCoefficient();
|
|
|
|
beltTotalArea = prodPlanExecuteUser.getFormingArea();
|
|
|
|
totalArea = orderCodeUserList.stream().filter(e -> e.getProcessCode().equals("1001"))
|
|
|
|
}
|
|
|
|
.map(e -> e.getCompleteAmount().divide(e.getBeltRequiredLength(), 6, RoundingMode.HALF_UP)
|
|
|
|
//包胶工序
|
|
|
|
.multiply(e.getFormingArea())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
if (prodPlanExecuteUser.getProcessCode().equals(MesConstants.MES_PROCESS_LAGGING)) {
|
|
|
|
wageCoefficientSum = orderCodeUserList.stream().filter(e -> e.getProcessCode().equals("1001"))
|
|
|
|
coefficient = salaryData.getEncapsulationCoefficient();
|
|
|
|
.map(ProdPlanExecuteUser::getWageCoefficient).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
beltTotalArea = prodPlanExecuteUser.getRollCoatingArea();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
totalArea = prodPlanExecuteUser.getCompleteAmount()
|
|
|
|
|
|
|
|
.divide(prodPlanExecuteUser.getBeltRequiredLength(), 12, RoundingMode.HALF_UP)
|
|
|
|
|
|
|
|
.multiply(beltTotalArea);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wageCoefficientSum = orderCodeUserList.stream().filter(e -> e.getPlanCode().equals(prodPlanExecuteUser.getPlanCode())
|
|
|
|
|
|
|
|
&& e.getBatchNumber().equals(prodPlanExecuteUser.getBatchNumber()))
|
|
|
|
|
|
|
|
.map(ProdPlanExecuteUser::getWageCoefficient).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal revenueAmount = new BigDecimal(0);//员工收入
|
|
|
|
BigDecimal revenueAmount = new BigDecimal(0);//员工收入
|
|
|
|
if (wageCoefficientSum.compareTo(BigDecimal.ZERO) > 0){
|
|
|
|
if (wageCoefficientSum.compareTo(BigDecimal.ZERO) > 0){
|
|
|
|
BigDecimal staffCoefficient = prodPlanExecuteUser.getWageCoefficient().divide(wageCoefficientSum, 6, RoundingMode.HALF_UP);
|
|
|
|
BigDecimal staffCoefficient = prodPlanExecuteUser.getWageCoefficient().divide(wageCoefficientSum, 12, RoundingMode.HALF_UP);
|
|
|
|
revenueAmount = coefficient.multiply(totalArea).multiply(staffCoefficient).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
revenueAmount = coefficient.multiply(totalArea).multiply(staffCoefficient).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -221,9 +235,13 @@ public class RecordStaffSalaryServiceImpl implements IRecordStaffSalaryService {
|
|
|
|
String teamCode = prodPlanExecuteUser.getTeamCode();
|
|
|
|
String teamCode = prodPlanExecuteUser.getTeamCode();
|
|
|
|
String teamName = prodPlanExecuteUser.getTeamName();
|
|
|
|
String teamName = prodPlanExecuteUser.getTeamName();
|
|
|
|
String idCard = prodPlanExecuteUser.getIdCard();
|
|
|
|
String idCard = prodPlanExecuteUser.getIdCard();
|
|
|
|
|
|
|
|
String revenueReason = prodPlanExecuteUser.getStationName().substring(0, 2) + " "
|
|
|
|
|
|
|
|
+ prodPlanExecuteUser.getBeltLengthSpecifications() + " " + prodPlanExecuteUser.getOrderCode();
|
|
|
|
|
|
|
|
|
|
|
|
RecordStaffSalary staffSalary = new RecordStaffSalary();
|
|
|
|
RecordStaffSalary staffSalary = new RecordStaffSalary();
|
|
|
|
for (RecordStaffSalary staff : result) {
|
|
|
|
for (RecordStaffSalary staff : result) {
|
|
|
|
if (staff.getCardId().equals(idCard) && staff.getGroupId().equals(prodPlanExecuteUser.getTeamCode())) {
|
|
|
|
if (staff.getIdCard().equals(idCard) && staff.getGroupId().equals(prodPlanExecuteUser.getTeamCode())
|
|
|
|
|
|
|
|
&& staff.getRevenueReason().equals(revenueReason)) {
|
|
|
|
staffSalary = staff;
|
|
|
|
staffSalary = staff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -243,6 +261,8 @@ public class RecordStaffSalaryServiceImpl implements IRecordStaffSalaryService {
|
|
|
|
staffSalary.setTeamName(teamName);
|
|
|
|
staffSalary.setTeamName(teamName);
|
|
|
|
staffSalary.setBeginDate(beginOrderDate);
|
|
|
|
staffSalary.setBeginDate(beginOrderDate);
|
|
|
|
staffSalary.setEndDate(endOrderDate);
|
|
|
|
staffSalary.setEndDate(endOrderDate);
|
|
|
|
|
|
|
|
staffSalary.setRevenueReason(revenueReason);
|
|
|
|
|
|
|
|
staffSalary.setOrderCode(prodPlanExecuteUser.getOrderCode());
|
|
|
|
result.add(staffSalary);
|
|
|
|
result.add(staffSalary);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
staffSalary.setRevenueAmount(staffSalary.getRevenueAmount().add(revenueAmount));
|
|
|
|
staffSalary.setRevenueAmount(staffSalary.getRevenueAmount().add(revenueAmount));
|
|
|
@ -436,7 +456,13 @@ public class RecordStaffSalaryServiceImpl implements IRecordStaffSalaryService {
|
|
|
|
for (RecordStaffSalary staffSalary : recordStaffSalaryList) {
|
|
|
|
for (RecordStaffSalary staffSalary : recordStaffSalaryList) {
|
|
|
|
String objectId = portService.addSalaryBreakdown(staffSalary);
|
|
|
|
String objectId = portService.addSalaryBreakdown(staffSalary);
|
|
|
|
staffSalary.setObjectId(objectId);
|
|
|
|
staffSalary.setObjectId(objectId);
|
|
|
|
|
|
|
|
staffSalary.setCreateTime(DateUtils.getNowDate());
|
|
|
|
recordStaffSalaryMapper.insertRecordStaffSalary(staffSalary);
|
|
|
|
recordStaffSalaryMapper.insertRecordStaffSalary(staffSalary);
|
|
|
|
|
|
|
|
//更新ERP上传标识
|
|
|
|
|
|
|
|
ProdOrderInfo orderInfo = new ProdOrderInfo();
|
|
|
|
|
|
|
|
orderInfo.setOrderCode(staffSalary.getOrderCode());
|
|
|
|
|
|
|
|
orderInfo.setIsFlag("1");
|
|
|
|
|
|
|
|
prodOrderInfoMapper.updateProdOrderInfo(orderInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
thread.start(); //启动新线程
|
|
|
|
thread.start(); //启动新线程
|
|
|
|