change - 新增薪资明细接口去掉班组、更新人员工资计算方法

main
yinq 3 weeks ago
parent 8c919c713f
commit cd2cde0f16

@ -0,0 +1,38 @@
package com.os.common.constant;
/**
* MES
*
* @author ruoyi
*/
public class MesConstants
{
/**
* -
*/
public static final String MES_PROCESS_OUT_CLOTH = "1010";
/**
* -
*/
public static final String MES_PROCESS_FORMING = "1011";
/**
* -
*/
public static final String MES_PROCESS_LAGGING = "1012";
/**
* -
*/
public static final String MES_PROCESS_VULCANIZATION = "1020";
/**
* -270
*/
public static final String MES_PROCESS_270_FILM = "1030";
}

@ -47,7 +47,7 @@ public class ERPStaffSalary
private String groupId;
/** 事件日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JsonProperty(value = "EventDate")
private Date eventDate;

@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.os.common.utils.StringUtils;
import com.os.mes.api.domain.*;
import com.os.mes.api.service.IERPPortService;
@ -24,10 +25,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.*;
/**
@ -176,7 +174,7 @@ public class ERPPortServiceImpl implements IERPPortService {
erpStaffSalary.setController(ERPConstants.addSalaryController);
erpStaffSalary.setActionName(ERPConstants.addSalaryActionName);
erpStaffSalary.setIdCard(recordStaffSalary.getIdCard());
erpStaffSalary.setGroupId(recordStaffSalary.getGroupId());
// erpStaffSalary.setGroupId(recordStaffSalary.getGroupId());
erpStaffSalary.setEventDate(recordStaffSalary.getEventDate());
erpStaffSalary.setSalaryCategory(recordStaffSalary.getSalaryCategory());
erpStaffSalary.setRevenueClass(recordStaffSalary.getRevenueClass());
@ -185,6 +183,8 @@ public class ERPPortServiceImpl implements IERPPortService {
try {
// 创建ObjectMapper实例 对象转JSON字符串
ObjectMapper objectMapper = new ObjectMapper();
// objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
// objectMapper.setTimeZone(TimeZone.getTimeZone("UTC"));
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE);
requestParam = objectMapper.writeValueAsString(erpStaffSalary);
result = ApiUtils.sendERPHttpPost(ERPConstants.ERP_URL, requestParam);
@ -208,6 +208,7 @@ public class ERPPortServiceImpl implements IERPPortService {
HashMap returnData = (HashMap) hashMap.get("ReturnData");
HashMap<String, Object> data = (HashMap<String, Object>) returnData.get("data");
objectId = String.valueOf(data.get("ObjectId"));
logger.info("新增【薪资明细】成功:" + requestParam + "|" + result);
} catch (Exception e) {
logger.warn("新增【薪资明细】异常:" + requestParam + "|" + result + "|" + e);
}

@ -154,9 +154,9 @@ public class ProdOrderInfo extends BaseEntity {
private String printName;
/**
*
* ERP0 1
*/
@Excel(name = "预留标识")
@Excel(name = "ERP上传标识0未上传 1已上传")
private String isFlag;
/**

@ -143,6 +143,20 @@ public class ProdPlanExecuteUser extends BaseEntity {
@JsonProperty(value = "SulfurizationArea")
private BigDecimal SulfurizationArea;
/**
*
*/
@Excel(name = "压延包胶面积")
@JsonProperty(value = "RollCoatingArea")
private BigDecimal RollCoatingArea;
/**
*
*/
@Excel(name = "压延出布面积")
@JsonProperty(value = "RolledFabricArea")
private BigDecimal RolledFabricArea;
/** 身份证 */
@Excel(name = "身份证")
private String idCard;
@ -159,6 +173,50 @@ public class ProdPlanExecuteUser extends BaseEntity {
@Excel(name = "班组名称")
private String teamName;
/**
*
*/
@Excel(name = "生产次数(锅数)")
private String batchNumber;
/**
*
*/
@Excel(name = "输送带长度规格")
private String BeltLengthSpecifications;
public BigDecimal getRollCoatingArea() {
return RollCoatingArea;
}
public void setRollCoatingArea(BigDecimal rollCoatingArea) {
RollCoatingArea = rollCoatingArea;
}
public BigDecimal getRolledFabricArea() {
return RolledFabricArea;
}
public void setRolledFabricArea(BigDecimal rolledFabricArea) {
RolledFabricArea = rolledFabricArea;
}
public String getBeltLengthSpecifications() {
return BeltLengthSpecifications;
}
public void setBeltLengthSpecifications(String beltLengthSpecifications) {
BeltLengthSpecifications = beltLengthSpecifications;
}
public String getBatchNumber() {
return batchNumber;
}
public void setBatchNumber(String batchNumber) {
this.batchNumber = batchNumber;
}
public String getIdCard() {
return idCard;
}

@ -114,6 +114,7 @@ public class ProdPlanErpInfoServiceImpl implements IProdPlanErpInfoService {
if (StringUtils.isNotEmpty(equipmentNo)) {
BaseDeviceLedger deviceLedger = deviceLedgerMapper.selectBaseDeviceLedgerByDeviceCode(equipmentNo);
if (StringUtils.isNotNull(deviceLedger)){
// 出布、成型、包胶、硫化
planErpInfo.setStationCode(deviceLedger.getProductLineCode());
planErpInfo.setProcessCode(deviceLedger.getProcessCode());
}

@ -52,6 +52,7 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
*/
@Override
public int insertProdPlanInfo(ProdPlanInfo prodPlanInfo) {
prodPlanInfo.setCreatedTime(DateUtils.getNowDate());
return prodPlanInfoMapper.insertProdPlanInfo(prodPlanInfo);
}
@ -63,6 +64,7 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
*/
@Override
public int updateProdPlanInfo(ProdPlanInfo prodPlanInfo) {
prodPlanInfo.setUpdatedTime(DateUtils.getNowDate());
return prodPlanInfoMapper.updateProdPlanInfo(prodPlanInfo);
}

@ -104,6 +104,19 @@ public class RecordStaffSalary extends BaseEntity
/** 工序编号 */
private String processCode;
/**
*
*/
private String orderCode;
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getProcessCode() {
return processCode;
}

@ -5,6 +5,7 @@ import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
import com.os.common.constant.MesConstants;
import com.os.common.exception.ServiceException;
import com.os.common.utils.DateUtils;
import com.os.common.utils.StringUtils;
@ -172,8 +173,8 @@ public class RecordStaffSalaryServiceImpl implements IRecordStaffSalaryService {
long objId = 1L;
String taskCode = PlanCodeUtils.getTaskCode();
Map<String, List<ProdPlanExecuteUser>> orderCodeMap = planUserList.stream().collect(Collectors.groupingBy(ProdPlanExecuteUser::getOrderCode));
for (String planCode : orderCodeMap.keySet()) {
List<ProdPlanExecuteUser> orderCodeUserList = orderCodeMap.get(planCode);
for (String orderCode : orderCodeMap.keySet()) {
List<ProdPlanExecuteUser> orderCodeUserList = orderCodeMap.get(orderCode);
for (ProdPlanExecuteUser prodPlanExecuteUser : orderCodeUserList) {
//工序工资系数
BigDecimal coefficient = new BigDecimal(0);
@ -181,29 +182,42 @@ public class RecordStaffSalaryServiceImpl implements IRecordStaffSalaryService {
BigDecimal totalArea = 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();
totalArea = orderCodeUserList.stream().filter(e -> e.getProcessCode().equals("1002"))
.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"))
.map(ProdPlanExecuteUser::getWageCoefficient).reduce(BigDecimal.ZERO, BigDecimal::add);
beltTotalArea = prodPlanExecuteUser.getSulfurizationArea();
}
//出布工序
if (prodPlanExecuteUser.getProcessCode().equals(MesConstants.MES_PROCESS_OUT_CLOTH)) {
coefficient = salaryData.getDistributionCoefficient();
beltTotalArea = prodPlanExecuteUser.getRolledFabricArea();
}
//成型工序
if (prodPlanExecuteUser.getProcessCode().equals("1001")) {
coefficient = salaryData.getFormingCoefficient();
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);
wageCoefficientSum = orderCodeUserList.stream().filter(e -> e.getProcessCode().equals("1001"))
.map(ProdPlanExecuteUser::getWageCoefficient).reduce(BigDecimal.ZERO, BigDecimal::add);
if (prodPlanExecuteUser.getProcessCode().equals(MesConstants.MES_PROCESS_FORMING)) {
beltTotalArea = prodPlanExecuteUser.getFormingArea();
}
//包胶工序
if (prodPlanExecuteUser.getProcessCode().equals(MesConstants.MES_PROCESS_LAGGING)) {
coefficient = salaryData.getEncapsulationCoefficient();
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);//员工收入
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);
}
@ -221,9 +235,13 @@ public class RecordStaffSalaryServiceImpl implements IRecordStaffSalaryService {
String teamCode = prodPlanExecuteUser.getTeamCode();
String teamName = prodPlanExecuteUser.getTeamName();
String idCard = prodPlanExecuteUser.getIdCard();
String revenueReason = prodPlanExecuteUser.getStationName().substring(0, 2) + " "
+ prodPlanExecuteUser.getBeltLengthSpecifications() + " " + prodPlanExecuteUser.getOrderCode();
RecordStaffSalary staffSalary = new RecordStaffSalary();
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;
}
}
@ -243,6 +261,8 @@ public class RecordStaffSalaryServiceImpl implements IRecordStaffSalaryService {
staffSalary.setTeamName(teamName);
staffSalary.setBeginDate(beginOrderDate);
staffSalary.setEndDate(endOrderDate);
staffSalary.setRevenueReason(revenueReason);
staffSalary.setOrderCode(prodPlanExecuteUser.getOrderCode());
result.add(staffSalary);
} else {
staffSalary.setRevenueAmount(staffSalary.getRevenueAmount().add(revenueAmount));
@ -436,7 +456,13 @@ public class RecordStaffSalaryServiceImpl implements IRecordStaffSalaryService {
for (RecordStaffSalary staffSalary : recordStaffSalaryList) {
String objectId = portService.addSalaryBreakdown(staffSalary);
staffSalary.setObjectId(objectId);
staffSalary.setCreateTime(DateUtils.getNowDate());
recordStaffSalaryMapper.insertRecordStaffSalary(staffSalary);
//更新ERP上传标识
ProdOrderInfo orderInfo = new ProdOrderInfo();
orderInfo.setOrderCode(staffSalary.getOrderCode());
orderInfo.setIsFlag("1");
prodOrderInfoMapper.updateProdOrderInfo(orderInfo);
}
});
thread.start(); //启动新线程

@ -160,7 +160,7 @@
<select id="selectProdOrderDetailList" parameterType="ProdOrderDetail" resultMap="ProdOrderDetailResult">
<include refid="selectProdOrderDetailVo"/>
<where>
<if test="SeqNo != null and SeqNo != ''">and SeqNo = #{SeqNo}</if>
<if test="SeqNo != null and SeqNo != ''">and SeqNo like concat('%', #{SeqNo}, '%')</if>
<if test="params.beginOrderDate != null and params.beginOrderDate != '' and params.endOrderDate != null and params.endOrderDate != ''">
and OrderDate between #{params.beginOrderDate} and #{params.endOrderDate}
</if>

@ -213,7 +213,7 @@
<select id="selectProdOrderInfoList" parameterType="ProdOrderInfo" resultMap="ProdOrderInfoResult">
<include refid="selectProdOrderInfoVo"/>
<where>
<if test="orderCode != null and orderCode != ''">and poi.order_code = #{orderCode}</if>
<if test="orderCode != null and orderCode != ''">and poi.order_code like concat('%', #{orderCode}, '%')</if>
<if test="saleOrderCode != null and saleOrderCode != ''">and poi.sale_order_code = #{saleOrderCode}</if>
<if test="saleOrderLineNumber != null and saleOrderLineNumber != ''">and sale_order_line_number =
#{saleOrderLineNumber}

@ -19,6 +19,7 @@
<result property="createdTime" column="created_time"/>
<result property="updatedBy" column="updated_by"/>
<result property="updatedTime" column="updated_time"/>
<result property="batchNumber" column="batch_number"/>
<result property="staffName" column="staff_name"/>
<result property="stationName" column="station_name"/>
<result property="wageCoefficient" column="wage_coefficient"/>
@ -27,6 +28,9 @@
<result property="SulfurizationArea" column="SulfurizationArea"/>
<result property="idCard" column="pass_word"/>
<result property="teamCode" column="team_code"/>
<result property="BeltLengthSpecifications" column="BeltLengthSpecifications"/>
<result property="RollCoatingArea" column="RollCoatingArea"/>
<result property="RolledFabricArea" column="RolledFabricArea"/>
</resultMap>
<sql id="selectProdPlanExecuteUserVo">
@ -44,14 +48,18 @@
ppeu.created_time,
ppeu.updated_by,
ppeu.updated_time,
ppeu.batch_number,
bsi.staff_name,
bsi.wage_coefficient,
bpl.product_line_name station_name,
pod.BeltRequiredLength,
pod.SulfurizationArea,
pod.RolledFabricArea,
pod.RollCoatingArea,
pod.FormingArea,
bsi.pass_word,
bsi.team_code
bsi.team_code,
pod.BeltLengthSpecifications
from prod_plan_execute_user ppeu
left join base_staff_info bsi on bsi.staff_id = ppeu.staff_id
left join base_product_line bpl on bpl.product_line_code = ppeu.station_code
@ -71,6 +79,7 @@
<if test="planBeginDate != null ">and ppeu.plan_begin_date = #{planBeginDate}</if>
<if test="planEndDate != null ">and ppeu.plan_end_date = #{planEndDate}</if>
<if test="isFlag != null and isFlag != ''">and ppeu.is_flag = #{isFlag}</if>
<if test="batchNumber != null and batchNumber != ''">and ppeu.batch_number = #{batchNumber}</if>
<if test="params.beginOrderDate != null and params.beginOrderDate != '' and params.endOrderDate != null and params.endOrderDate != ''">
and FORMAT(ppeu.plan_end_date, 'yyyy-MM-dd') between #{params.beginOrderDate} and #{params.endOrderDate}
</if>

@ -70,6 +70,8 @@
ppi.updated_time,
ppi.plan_begin_time,
ppi.plan_end_time,
ppi.plan_status,
ppi.process_code,
ppi.import_flag
from prod_plan_info ppi
left join base_product_line bpl on bpl.product_line_code = ppi.station_code

Loading…
Cancel
Save