|
@@ -113,10 +113,12 @@ public class TwinWkEmpRotaServiceImpl implements ITwinWkEmpRotaService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void sync(KnittingEmpVO data) {
|
|
|
- TwinWkEmpRota rota = selectByEmp(data.getDate(), data.getId());
|
|
|
+ TwinWkEmpRota rota = selectByEmp(data.getDate(), data.getId(), data.getIn(), data.getOut());
|
|
|
rota.setEmpId(data.getId());
|
|
|
rota.setEmpName(data.getName());
|
|
|
rota.setEmpTeam(data.getTeam());
|
|
|
+ rota.setInTime(data.getIn());
|
|
|
+ rota.setOutTime(data.getOut());
|
|
|
Set<Integer> deviceSet = new TreeSet<>();
|
|
|
for (String s : data.getDevices()) {
|
|
|
String id = s.replace("J", "");
|
|
@@ -125,12 +127,9 @@ public class TwinWkEmpRotaServiceImpl implements ITwinWkEmpRotaService {
|
|
|
String devices = deviceSet.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
rota.setDevices(devices);
|
|
|
//2025-08-04 修改同步规则,之前是后面一条记录覆盖前一条记录,现在需要判断上下班时间
|
|
|
- if (rota.getShiftId() != null && rota.getInTime().equals(data.getIn()) && rota.getOutTime().equals(data.getOut())) {
|
|
|
+ if (rota.getShiftId() != null) {
|
|
|
updateTwinWkEmpRota(rota);
|
|
|
} else {
|
|
|
- rota.setShiftId(null);
|
|
|
- rota.setInTime(data.getIn());
|
|
|
- rota.setOutTime(data.getOut());
|
|
|
insertTwinWkEmpRota(rota);
|
|
|
}
|
|
|
}
|
|
@@ -140,10 +139,12 @@ public class TwinWkEmpRotaServiceImpl implements ITwinWkEmpRotaService {
|
|
|
* 按时间和员工号查询记录
|
|
|
*/
|
|
|
|
|
|
- private TwinWkEmpRota selectByEmp(Date date, String empId) {
|
|
|
+ private TwinWkEmpRota selectByEmp(Date date, String empId, Date in, Date out) {
|
|
|
TwinWkEmpRota search = new TwinWkEmpRota();
|
|
|
search.setEmpDate(date);
|
|
|
search.setEmpId(empId);
|
|
|
+ search.setInTime(in);
|
|
|
+ search.setOutTime(out);
|
|
|
|
|
|
List<TwinWkEmpRota> list = selectTwinWkEmpRotaList(search);
|
|
|
TwinWkEmpRota rota;
|