Compare commits
80
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
624b7d7d6e | ||
|
|
0b61b813a5 | ||
|
|
6252866f7c | ||
|
|
15c8a2b6e6 | ||
|
|
4b434a2cd2 | ||
|
|
0376f8328c | ||
|
|
58e3882ef4 | ||
|
|
1d96322370 | ||
|
|
19857686aa | ||
|
|
d079e35374 | ||
|
|
466a9fa31f | ||
|
|
d74a28bceb | ||
|
|
1cc123917b | ||
|
|
39ebcb70ed | ||
|
|
e7e64252e7 | ||
|
|
a400a34b0c | ||
|
|
ac349ea8a8 | ||
|
|
7356208228 | ||
|
|
5963f6ed3a | ||
|
|
6f28cfdda0 | ||
|
|
5c472ad04e | ||
|
|
070cdcd5de | ||
|
|
061c5bc600 | ||
|
|
e5fea50466 | ||
|
|
6a87c5a75a | ||
|
|
63dcfaf028 | ||
|
|
c80e4b3ca3 | ||
|
|
3240e57c3e | ||
|
|
e35fa7d48e | ||
|
|
d5bdb5b419 | ||
|
|
fd1436da9c | ||
|
|
802a2994cc | ||
|
|
3d3036cebf | ||
|
|
123a5af241 | ||
|
|
da31a81415 | ||
|
|
84d4df0809 | ||
|
|
d17146dc4b | ||
|
|
44e9eb47bc | ||
|
|
bc9a4f7204 | ||
|
|
b37edf7c63 | ||
|
|
f6125e68bf | ||
|
|
d6037d5846 | ||
|
|
df51abe33f | ||
|
|
5cf46604fa | ||
|
|
208024a6cc | ||
|
|
1d01431354 | ||
|
|
cbaab0ffee | ||
|
|
a310c9dfa6 | ||
|
|
3866bfee05 | ||
|
|
5032cf2413 | ||
|
|
a10cfb0f55 | ||
|
|
59ede5ceb7 | ||
|
|
de4d4fa70d | ||
|
|
7e496834ae | ||
|
|
300b5ac239 | ||
|
|
9519d8610b | ||
|
|
064a87e751 | ||
|
|
9e2dc508a8 | ||
|
|
6a84abf6dd | ||
|
|
8b4e785de3 | ||
|
|
c95fdfc067 | ||
|
|
40a906a9fb | ||
|
|
d91aadca0b | ||
|
|
898cc32452 | ||
|
|
6cf2a8bc74 | ||
|
|
bce9969589 | ||
|
|
b73eb84b87 | ||
|
|
7d0d24ea77 | ||
|
|
dd5280ab78 | ||
|
|
bc6b2ba777 | ||
|
|
f58691615b | ||
|
|
15fdace0bc | ||
|
|
0904b78846 | ||
|
|
734b51bfec | ||
|
|
784d04ebec | ||
|
|
b29632cebc | ||
|
|
3211cfe892 | ||
|
|
32e8be5363 | ||
|
|
207734c75e | ||
|
|
8eb280f2b9 |
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE, url = "http://10.33.0.99:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||||
public interface OmsServiceFeign {
|
public interface OmsServiceFeign {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.util.Map;
|
|||||||
* @description: TODO
|
* @description: TODO
|
||||||
* @date 2024/5/10 8:58
|
* @date 2024/5/10 8:58
|
||||||
**/
|
**/
|
||||||
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||||
public interface WmsServiceFeign {
|
public interface WmsServiceFeign {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration;
|
|||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class)
|
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.33.0.99:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||||
public interface YmsServiceFeign {
|
public interface YmsServiceFeign {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+6
@@ -244,4 +244,10 @@ public class MaterialBaseInfoFeign extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty(name = "单位")
|
@ApiModelProperty(name = "单位")
|
||||||
private String unit;
|
private String unit;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "组织(多个用,分开)")
|
||||||
|
private String orgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
|
||||||
|
private Integer isNormalMaterial;
|
||||||
}
|
}
|
||||||
@@ -50,8 +50,8 @@ public class StockOutOrder extends BaseVOEntity {
|
|||||||
@Excel(name = "出库单号")
|
@Excel(name = "出库单号")
|
||||||
private String outOrderNumber;
|
private String outOrderNumber;
|
||||||
|
|
||||||
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核")
|
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接")
|
||||||
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核")
|
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
|
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
|
||||||
|
|||||||
+32
-2
@@ -9,6 +9,7 @@ import com.mhd.bi.domain.biSnapshotSync.support.BiSnapshotWeeklyRandomDataBuilde
|
|||||||
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformSurveillanceVO;
|
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformSurveillanceVO;
|
||||||
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformVehicleItemVO;
|
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformVehicleItemVO;
|
||||||
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskLoadItemVO;
|
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskLoadItemVO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -22,6 +23,7 @@ import java.util.Random;
|
|||||||
* 月台监测-真实数据业务层(封装 YMS 跨库查询)
|
* 月台监测-真实数据业务层(封装 YMS 跨库查询)
|
||||||
* 注:列名大小写、字段类型需以实际库为准;若 YMS 库无数据/无权限,相关方法应返回空/0,不影响写死字段写入快照
|
* 注:列名大小写、字段类型需以实际库为准;若 YMS 库无数据/无权限,相关方法应返回空/0,不影响写死字段写入快照
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class BiPlatformRealDataService {
|
public class BiPlatformRealDataService {
|
||||||
|
|
||||||
@@ -32,6 +34,7 @@ public class BiPlatformRealDataService {
|
|||||||
try {
|
try {
|
||||||
return biPlatformRealDataMapper.queryVehicles();
|
return biPlatformRealDataMapper.queryVehicles();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error("【YMS】查询作业车辆列表失败: {}", e.getMessage(), e);
|
||||||
return java.util.Collections.emptyList();
|
return java.util.Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,6 +49,7 @@ public class BiPlatformRealDataService {
|
|||||||
if (po.getOperatingPlatforms() == null) po.setOperatingPlatforms(0L);
|
if (po.getOperatingPlatforms() == null) po.setOperatingPlatforms(0L);
|
||||||
return po;
|
return po;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error("【YMS】查询月台概览失败: {}", e.getMessage(), e);
|
||||||
RealPlatformOverviewPO po = new RealPlatformOverviewPO();
|
RealPlatformOverviewPO po = new RealPlatformOverviewPO();
|
||||||
po.setTotalPlatforms(0L);
|
po.setTotalPlatforms(0L);
|
||||||
po.setOperatingPlatforms(0L);
|
po.setOperatingPlatforms(0L);
|
||||||
@@ -58,6 +62,7 @@ public class BiPlatformRealDataService {
|
|||||||
Long n = biPlatformRealDataMapper.countTodayTasks();
|
Long n = biPlatformRealDataMapper.countTodayTasks();
|
||||||
return n == null ? 0L : n;
|
return n == null ? 0L : n;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error("【YMS】统计今日作业任务失败: {}", e.getMessage(), e);
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,6 +77,7 @@ public class BiPlatformRealDataService {
|
|||||||
if (po.getCompletedVehicles() == null) po.setCompletedVehicles(0L);
|
if (po.getCompletedVehicles() == null) po.setCompletedVehicles(0L);
|
||||||
return po;
|
return po;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error("【YMS】统计车辆状态失败: {}", e.getMessage(), e);
|
||||||
RealVehicleStatusPO po = new RealVehicleStatusPO();
|
RealVehicleStatusPO po = new RealVehicleStatusPO();
|
||||||
po.setTodayReservedVehicles(0L);
|
po.setTodayReservedVehicles(0L);
|
||||||
po.setNotCheckedIn(0L);
|
po.setNotCheckedIn(0L);
|
||||||
@@ -86,6 +92,7 @@ public class BiPlatformRealDataService {
|
|||||||
Long n = biPlatformRealDataMapper.countMonthTasks();
|
Long n = biPlatformRealDataMapper.countMonthTasks();
|
||||||
return n == null ? 0L : n;
|
return n == null ? 0L : n;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error("【YMS】统计本月任务量失败: {}", e.getMessage(), e);
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,6 +101,7 @@ public class BiPlatformRealDataService {
|
|||||||
try {
|
try {
|
||||||
return biPlatformRealDataMapper.queryTaskLoadToday();
|
return biPlatformRealDataMapper.queryTaskLoadToday();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error("【YMS】统计任务负荷失败: {}", e.getMessage(), e);
|
||||||
return java.util.Collections.emptyList();
|
return java.util.Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,7 +122,7 @@ public class BiPlatformRealDataService {
|
|||||||
v.setAppointmentTime(rv.getAppointmentTime());
|
v.setAppointmentTime(rv.getAppointmentTime());
|
||||||
v.setWorkFloor(rv.getWorkFloor());
|
v.setWorkFloor(rv.getWorkFloor());
|
||||||
v.setPlateNumber(rv.getPlateNumber());
|
v.setPlateNumber(rv.getPlateNumber());
|
||||||
v.setStatus(rv.getStatus());
|
v.setStatus(translateFlowStatus(rv.getStatus()));
|
||||||
v.setPlatformId(rv.getPlatformId());
|
v.setPlatformId(rv.getPlatformId());
|
||||||
v.setPlatformDuration(rv.getPlatformDuration() == null ? 0 : rv.getPlatformDuration().intValue());
|
v.setPlatformDuration(rv.getPlatformDuration() == null ? 0 : rv.getPlatformDuration().intValue());
|
||||||
vehicleVos.add(v);
|
vehicleVos.add(v);
|
||||||
@@ -130,7 +138,7 @@ public class BiPlatformRealDataService {
|
|||||||
template.getPlatformOverview().setOperatingPlatforms(ov.getOperatingPlatforms().intValue());
|
template.getPlatformOverview().setOperatingPlatforms(ov.getOperatingPlatforms().intValue());
|
||||||
int total = ov.getTotalPlatforms().intValue();
|
int total = ov.getTotalPlatforms().intValue();
|
||||||
int occ = ov.getOperatingPlatforms().intValue();
|
int occ = ov.getOperatingPlatforms().intValue();
|
||||||
int rate = total > 0 ? (int) Math.round(((double) occ / total) * 100.0) : 0;
|
double rate = total > 0 ? Math.round(((double) occ / total) * 100.0 * 100.0) / 100.0 : 0d;
|
||||||
template.getPlatformOverview().setCurrentOccupancyRate(rate);
|
template.getPlatformOverview().setCurrentOccupancyRate(rate);
|
||||||
}
|
}
|
||||||
long todayTasks = countTodayTasks();
|
long todayTasks = countTodayTasks();
|
||||||
@@ -181,4 +189,26 @@ public class BiPlatformRealDataService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FLOW_STATUS 数字转中文:1已预约 2已签到 3已叫号 4已过号 5已进场 6已称重 7已装车 8二次称重 9已结算 10已还卡 11已出场 12已取消
|
||||||
|
*/
|
||||||
|
private static String translateFlowStatus(String flowStatus) {
|
||||||
|
if (flowStatus == null) return null;
|
||||||
|
switch (flowStatus.trim()) {
|
||||||
|
case "1": return "已预约";
|
||||||
|
case "2": return "已签到";
|
||||||
|
case "3": return "已叫号";
|
||||||
|
case "4": return "已过号";
|
||||||
|
case "5": return "已进场";
|
||||||
|
case "6": return "已称重";
|
||||||
|
case "7": return "已装车";
|
||||||
|
case "8": return "二次称重";
|
||||||
|
case "9": return "已结算";
|
||||||
|
case "10": return "已还卡";
|
||||||
|
case "11": return "已出场";
|
||||||
|
case "12": return "已取消";
|
||||||
|
default: return flowStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -85,7 +85,7 @@ public final class BiReportSnapshotMapperSupport {
|
|||||||
.entryOvertimeRate(0).overtimeCount(0).platformOnTimeRate(0)
|
.entryOvertimeRate(0).overtimeCount(0).platformOnTimeRate(0)
|
||||||
.avgPlatformDuration(0d).yardOnTimeRate(0).avgYardDuration(0d).build())
|
.avgPlatformDuration(0d).yardOnTimeRate(0).avgYardDuration(0d).build())
|
||||||
.platformOverview(PlatformOverviewVO.builder()
|
.platformOverview(PlatformOverviewVO.builder()
|
||||||
.totalPlatforms(0).currentOccupancyRate(0).operatingPlatforms(0).todayTasks(0).build())
|
.totalPlatforms(0).currentOccupancyRate(0d).operatingPlatforms(0).todayTasks(0).build())
|
||||||
.vehicleStatus(VehicleStatusVO.builder()
|
.vehicleStatus(VehicleStatusVO.builder()
|
||||||
.todayReservedVehicles(0).notCheckedIn(0).operatingVehicles(0).completedVehicles(0).build())
|
.todayReservedVehicles(0).notCheckedIn(0).operatingVehicles(0).completedVehicles(0).build())
|
||||||
.avgOperationDurationTrend(Collections.emptyList())
|
.avgOperationDurationTrend(Collections.emptyList())
|
||||||
|
|||||||
+1
-1
@@ -178,7 +178,7 @@ public class BiReportSnapshotSyncService {
|
|||||||
template.getPlatformOverview().setOperatingPlatforms(ov.getOperatingPlatforms().intValue());
|
template.getPlatformOverview().setOperatingPlatforms(ov.getOperatingPlatforms().intValue());
|
||||||
int total = ov.getTotalPlatforms().intValue();
|
int total = ov.getTotalPlatforms().intValue();
|
||||||
int occ = ov.getOperatingPlatforms().intValue();
|
int occ = ov.getOperatingPlatforms().intValue();
|
||||||
int rate = total > 0 ? (int) Math.round(((double) occ / total) * 100.0) : 0;
|
double rate = total > 0 ? Math.round(((double) occ / total) * 100.0 * 100.0) / 100.0 : 0d;
|
||||||
template.getPlatformOverview().setCurrentOccupancyRate(rate);
|
template.getPlatformOverview().setCurrentOccupancyRate(rate);
|
||||||
}
|
}
|
||||||
long todayTasks = biPlatformRealDataService.countTodayTasks();
|
long todayTasks = biPlatformRealDataService.countTodayTasks();
|
||||||
|
|||||||
+1
-1
@@ -147,7 +147,7 @@ public final class BiSnapshotWeeklyRandomDataBuilder {
|
|||||||
|
|
||||||
PlatformOverviewVO overview = PlatformOverviewVO.builder()
|
PlatformOverviewVO overview = PlatformOverviewVO.builder()
|
||||||
.totalPlatforms(Math.max(1, jitterInt(Baseline.P_TOT_PL, r)))
|
.totalPlatforms(Math.max(1, jitterInt(Baseline.P_TOT_PL, r)))
|
||||||
.currentOccupancyRate(jitterPercentInt(Baseline.P_OCC, r))
|
.currentOccupancyRate((double) jitterPercentInt(Baseline.P_OCC, r))
|
||||||
.operatingPlatforms(Math.max(0, jitterInt(Baseline.P_OP, r)))
|
.operatingPlatforms(Math.max(0, jitterInt(Baseline.P_OP, r)))
|
||||||
.todayTasks(Math.max(0, jitterInt(Baseline.P_TASKS, r)))
|
.todayTasks(Math.max(0, jitterInt(Baseline.P_TASKS, r)))
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ public class PlatformOverviewVO {
|
|||||||
private Integer totalPlatforms;
|
private Integer totalPlatforms;
|
||||||
|
|
||||||
@ApiModelProperty("当前占用率,单位:%")
|
@ApiModelProperty("当前占用率,单位:%")
|
||||||
private Integer currentOccupancyRate;
|
private Double currentOccupancyRate;
|
||||||
|
|
||||||
@ApiModelProperty("当前作业中,单位:个")
|
@ApiModelProperty("当前作业中,单位:个")
|
||||||
private Integer operatingPlatforms;
|
private Integer operatingPlatforms;
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ spring:
|
|||||||
username: nacos
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
#线上正式环境
|
#线上正式环境
|
||||||
server-addr: 10.102.192.31:6848
|
server-addr: 10.102.192.30:6848
|
||||||
# username: nacos
|
# username: nacos
|
||||||
# password: manhuoda@2023
|
# password: manhuoda@2023
|
||||||
config:
|
config:
|
||||||
# server-addr: 127.0.0.1:8848
|
# server-addr: 127.0.0.1:8848
|
||||||
# 线上测试环境配置 容器名+端口号
|
# 线上测试环境配置 容器名+端口号
|
||||||
# server-addr: 10.33.0.129:6010
|
# server-addr: 10.33.0.129:6010
|
||||||
server-addr: 10.102.192.31:6848
|
server-addr: 10.102.192.30:6848
|
||||||
username: nacos
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
#线上正式环境
|
#线上正式环境
|
||||||
|
|||||||
@@ -5,81 +5,75 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<mapper namespace="com.mhd.bi.domain.biPlatformRealData.repository.mapper.BiPlatformRealDataMapper">
|
<mapper namespace="com.mhd.bi.domain.biPlatformRealData.repository.mapper.BiPlatformRealDataMapper">
|
||||||
|
|
||||||
<!-- 作业车辆状态列表(vehicles):
|
<!-- 作业车辆状态列表(vehicles):
|
||||||
plateNumber <- qms_main_business.CARNO
|
plateNumber <- qms_main_business.CAR_NO
|
||||||
status <- qms_main_business.FLOWSTATUS
|
status <- qms_main_business.FLOW_STATUS
|
||||||
platformId <- qms_queue_list.WINDOWNAME(按主业务的某个窗口关联键关联;此处用 businessNo = windowNo 关联,根据实际表调整)
|
platformId <- qms_main_business.WINDOW_NAME(叫号月台,主业务表直接有)
|
||||||
platformDuration <- qms_main_business.EXITTIME - ENTRYTIME(分钟)
|
platformDuration <- qms_main_business.EXIT_TIME - ENTRY_TIME(分钟)
|
||||||
appointmentTime <- qms_main_business.CREATE_TIME(创建时间)
|
appointmentTime <- qms_main_business.CREATE_TIME
|
||||||
workFloor <- qms_window_info.PLATFORMFLOOR(按 platformId 关联窗口号)
|
workFloor <- qms_window_info.PLATFORM_FLOOR(按 WINDOW_NAME 关联)
|
||||||
注:列名按达梦默认大写规则;若实际为小写,请反馈调整 -->
|
-->
|
||||||
<select id="queryVehicles" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO">
|
<select id="queryVehicles" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO">
|
||||||
SELECT
|
SELECT
|
||||||
mb.CARNO AS plateNumber,
|
mb.CAR_NO AS plateNumber,
|
||||||
mb.FLOWSTATUS AS status,
|
mb.FLOW_STATUS AS status,
|
||||||
ql.WINDOWNAME AS platformId,
|
mb.WINDOW_NAME AS platformId,
|
||||||
CASE
|
CASE
|
||||||
WHEN mb.EXITTIME IS NOT NULL AND mb.ENTRYTIME IS NOT NULL
|
WHEN mb.EXIT_TIME IS NOT NULL AND mb.ENTRY_TIME IS NOT NULL
|
||||||
THEN CAST((mb.EXITTIME - mb.ENTRYTIME) AS BIGINT)
|
THEN CAST((mb.EXIT_TIME - mb.ENTRY_TIME) * 24 * 60 AS BIGINT)
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END AS platformDuration,
|
END AS platformDuration,
|
||||||
TO_CHAR(mb.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') AS appointmentTime,
|
TO_CHAR(mb.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') AS appointmentTime,
|
||||||
wi.PLATFORMFLOOR AS workFloor
|
wi.PLATFORM_FLOOR AS workFloor
|
||||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS mb
|
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS mb
|
||||||
LEFT JOIN NGWL_TEST_YMS.QMS_QUEUE_LIST ql ON ql.MAIN_BUSINESS_ID = mb.ID
|
LEFT JOIN NGWL_TEST_YMS.QMS_WINDOW_INFO wi
|
||||||
LEFT JOIN NGWL_TEST_YMS.QMS_WINDOW_INFO wi ON wi.WINDOW_NO = ql.WINDOWNAME
|
ON wi.WINDOW_NAME = mb.WINDOW_NAME
|
||||||
WHERE 1=1
|
|
||||||
AND mb.DEL_FLAG = 1
|
|
||||||
ORDER BY mb.CREATE_TIME DESC
|
ORDER BY mb.CREATE_TIME DESC
|
||||||
LIMIT 50
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 月台概览:totalPlatforms(总条数)、operatingPlatforms(作业状态=占用/作业中) -->
|
<!-- 月台概览:totalPlatforms(总条数)、operatingPlatforms(作业状态=占用,JOB_STATUS: 0空闲 1占用) -->
|
||||||
<select id="queryPlatformOverview" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO">
|
<select id="queryPlatformOverview" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO">
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(1) AS totalPlatforms,
|
COUNT(1) AS totalPlatforms,
|
||||||
SUM(CASE WHEN STATUS = 2 THEN 1 ELSE 0 END) AS operatingPlatforms
|
SUM(CASE WHEN JOB_STATUS = 1 THEN 1 ELSE 0 END) AS operatingPlatforms
|
||||||
FROM NGWL_TEST_YMS.QMS_WINDOW_INFO
|
FROM NGWL_TEST_YMS.QMS_WINDOW_INFO
|
||||||
WHERE DEL_FLAG = 1
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 今日作业任务:实际进入时间是今日的 -->
|
<!-- 今日作业任务:实际进入时间是今日的 -->
|
||||||
<select id="countTodayTasks" resultType="java.lang.Long">
|
<select id="countTodayTasks" resultType="java.lang.Long">
|
||||||
SELECT COUNT(1)
|
SELECT COUNT(1)
|
||||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
||||||
WHERE DEL_FLAG = 1
|
WHERE ENTRY_TIME IS NOT NULL
|
||||||
AND TRUNC(ENTRYTIME) = TRUNC(SYSDATE)
|
AND TRUNC(ENTRY_TIME) = TRUNC(SYSDATE)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 车辆状态统计:今日的统计(按预约申请时间 / 流程状态) -->
|
<!-- 车辆状态统计:今日的统计(按创建时间 / 流程状态)
|
||||||
|
FLOW_STATUS: 1已预约 2已签到 3已叫号 4已过号 5已进场 6已称重 7已装车 8二次称重 9已结算 10已还卡 11已出场 12已取消 -->
|
||||||
<select id="queryVehicleStatusToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO">
|
<select id="queryVehicleStatusToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO">
|
||||||
SELECT
|
SELECT
|
||||||
SUM(CASE WHEN TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS todayReservedVehicles,
|
SUM(CASE WHEN TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS todayReservedVehicles,
|
||||||
SUM(CASE WHEN FLOWSTATUS = '已预约' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS notCheckedIn,
|
SUM(CASE WHEN FLOW_STATUS = '1' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS notCheckedIn,
|
||||||
SUM(CASE WHEN FLOWSTATUS IN ('已进场','已称重','已装车','二次称重','已结算','已还卡') AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS operatingVehicles,
|
SUM(CASE WHEN FLOW_STATUS IN ('5','6','7','8','9','10') AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS operatingVehicles,
|
||||||
SUM(CASE WHEN FLOWSTATUS = '已出场' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS completedVehicles
|
SUM(CASE WHEN FLOW_STATUS = '11' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS completedVehicles
|
||||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
||||||
WHERE DEL_FLAG = 1
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 本月任务量:实际进入时间是本月的 -->
|
<!-- 本月任务量:实际进入时间是本月的 -->
|
||||||
<select id="countMonthTasks" resultType="java.lang.Long">
|
<select id="countMonthTasks" resultType="java.lang.Long">
|
||||||
SELECT COUNT(1)
|
SELECT COUNT(1)
|
||||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
||||||
WHERE DEL_FLAG = 1
|
WHERE ENTRY_TIME IS NOT NULL
|
||||||
AND ENTRYTIME IS NOT NULL
|
AND TO_CHAR(ENTRY_TIME, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
|
||||||
AND TO_CHAR(ENTRYTIME, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 任务负荷(今日 24 小时时段):按 HOUR(ENTRYTIME) 统计 -->
|
<!-- 任务负荷(今日 24 小时时段):按 EXTRACT(HOUR FROM ENTRY_TIME) 统计 -->
|
||||||
<select id="queryTaskLoadToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO">
|
<select id="queryTaskLoadToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO">
|
||||||
SELECT
|
SELECT
|
||||||
HOUR(ENTRYTIME) AS hourOfDay,
|
EXTRACT(HOUR FROM ENTRY_TIME) AS hourOfDay,
|
||||||
COUNT(1) AS taskCount
|
COUNT(1) AS taskCount
|
||||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
||||||
WHERE DEL_FLAG = 1
|
WHERE ENTRY_TIME IS NOT NULL
|
||||||
AND ENTRYTIME IS NOT NULL
|
AND TRUNC(ENTRY_TIME) = TRUNC(SYSDATE)
|
||||||
AND TRUNC(ENTRYTIME) = TRUNC(SYSDATE)
|
GROUP BY EXTRACT(HOUR FROM ENTRY_TIME)
|
||||||
GROUP BY HOUR(ENTRYTIME)
|
ORDER BY EXTRACT(HOUR FROM ENTRY_TIME)
|
||||||
ORDER BY HOUR(ENTRYTIME)
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
+127
-2
@@ -40,6 +40,14 @@ import org.springframework.beans.BeanUtils;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.mhd.basic.interfaces.dto.shipperLeaseDetailsApi.WarehouseLeaseExportVO;
|
||||||
|
import com.mhd.common.core.utils.poi.ExcelUtil;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -270,14 +278,15 @@ public class LeaseApplicationService {
|
|||||||
* 货主租赁明细
|
* 货主租赁明细
|
||||||
* 定时任务:每天凌晨1点执行,计算前一天的货主租赁明细
|
* 定时任务:每天凌晨1点执行,计算前一天的货主租赁明细
|
||||||
*/
|
*/
|
||||||
// @Scheduled(cron = "0 0 1 * * ?")
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
public void shipperLeaseDetails() {
|
public void shipperLeaseDetails() {
|
||||||
log.info("开始执行货主租赁明细定时任务");
|
log.info("开始执行货主租赁明细定时任务");
|
||||||
// 计算前一天的日期,将时间设置为当天的0点0分0秒,只保留日期部分
|
// 计算前一天的日期,将时间设置为当天的0点0分0秒,只保留日期部分
|
||||||
final Date yesterday = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1));
|
final Date yesterday = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1));
|
||||||
|
|
||||||
LeaseDO leaseDO = new LeaseDO();
|
LeaseDO leaseDO = new LeaseDO();
|
||||||
leaseDO.setTime(yesterday);
|
leaseDO.setTime(yesterday); // 设置查询时间
|
||||||
|
leaseDO.setStatus(1); // 只查询启用状态的租赁,停用的不参与出租率计算
|
||||||
//查询有效期内的租赁
|
//查询有效期内的租赁
|
||||||
List<LeasePO> leasePOS = queryList(leaseDO);
|
List<LeasePO> leasePOS = queryList(leaseDO);
|
||||||
List<LeasePO> entireUnit = leasePOS.stream()
|
List<LeasePO> entireUnit = leasePOS.stream()
|
||||||
@@ -494,6 +503,103 @@ public class LeaseApplicationService {
|
|||||||
return warehouseOccupancyRatesList;
|
return warehouseOccupancyRatesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出仓库出租率及客户租赁明细(单 sheet,明细行带仓库当日汇总列)
|
||||||
|
* 参数与 /warehouseOccupancyRate、/list 一致
|
||||||
|
*/
|
||||||
|
public void exportOccupancyRate(HttpServletResponse response, ShipperLeaseDetailsDO shipperLeaseDetailsDO) throws IOException {
|
||||||
|
// 注意:本方法不调用 warehouseOccupancyRate(),因为该方法在不传 warehouseId 时
|
||||||
|
// totalArea 会算成全系统所有仓库库区面积之和(如 6168),导致导出面积/日租率错误。
|
||||||
|
// 这里自行按 (业务日期 + 仓库) 维度计算,保证多仓库导出时每个仓库的面积/日租率正确。
|
||||||
|
|
||||||
|
// ===== 1. 查全部明细(用副本 DO,避免影响外部)=====
|
||||||
|
ShipperLeaseDetailsDO detailDO = new ShipperLeaseDetailsDO();
|
||||||
|
BeanUtils.copyProperties(shipperLeaseDetailsDO, detailDO);
|
||||||
|
List<ShipperLeaseDetailsPO> detailList = shipperLeaseDetailsService.queryList(detailDO);
|
||||||
|
if (detailList == null) {
|
||||||
|
detailList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 2. 预算每个仓库的总面积(启用库区的 storageRegion 累加),建 warehouseId -> totalArea 映射 =====
|
||||||
|
Set<Long> warehouseIds = detailList.stream()
|
||||||
|
.map(ShipperLeaseDetailsPO::getWarehouseId)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Map<Long, BigDecimal> warehouseTotalAreaMap = new HashMap<>();
|
||||||
|
for (Long wid : warehouseIds) {
|
||||||
|
StorageSectionDO storageSectionDO = new StorageSectionDO();
|
||||||
|
storageSectionDO.setWarehouseId(wid);
|
||||||
|
storageSectionDO.setOpeningUp(1);
|
||||||
|
List<StorageSectionPO> sections = storageSectionApplicationService.queryList(storageSectionDO);
|
||||||
|
BigDecimal area = BigDecimal.ZERO;
|
||||||
|
for (StorageSectionPO s : sections) {
|
||||||
|
area = area.add(s.getStorageRegion() == null ? BigDecimal.ZERO : s.getStorageRegion());
|
||||||
|
}
|
||||||
|
warehouseTotalAreaMap.put(wid, area);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 3. 按 (业务日期 + 仓库ID) 聚合,算每个仓库当天的整租/散租面积 =====
|
||||||
|
// summaryMap: key -> [整租面积, 散租面积]
|
||||||
|
SimpleDateFormat keySdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Map<String, BigDecimal[]> summaryMap = new HashMap<>();
|
||||||
|
for (ShipperLeaseDetailsPO d : detailList) {
|
||||||
|
String key = (d.getBusinessDate() == null ? "" : keySdf.format(d.getBusinessDate()))
|
||||||
|
+ "_" + d.getWarehouseId();
|
||||||
|
BigDecimal[] arr = summaryMap.computeIfAbsent(key, k -> new BigDecimal[]{BigDecimal.ZERO, BigDecimal.ZERO});
|
||||||
|
BigDecimal leaseArea = d.getLeaseArea() == null ? BigDecimal.ZERO : d.getLeaseArea();
|
||||||
|
if ("整租".equals(d.getLeaseType())) {
|
||||||
|
arr[0] = arr[0].add(leaseArea);
|
||||||
|
} else {
|
||||||
|
arr[1] = arr[1].add(leaseArea);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 4. 明细为主,每行拼上对应仓库当天的汇总(总面积/日租率按仓库单独算)=====
|
||||||
|
List<WarehouseLeaseExportVO> exportList = new ArrayList<>();
|
||||||
|
for (ShipperLeaseDetailsPO d : detailList) {
|
||||||
|
WarehouseLeaseExportVO vo = new WarehouseLeaseExportVO();
|
||||||
|
// 明细列
|
||||||
|
vo.setBusinessDate(d.getBusinessDate());
|
||||||
|
vo.setOrganizationName(d.getOrganizationName());
|
||||||
|
vo.setWarehouseName(d.getWarehouseName());
|
||||||
|
vo.setCargoOwnerName(d.getCargoOwnerName());
|
||||||
|
vo.setLeaseType(d.getLeaseType());
|
||||||
|
vo.setLeaseArea(d.getLeaseArea());
|
||||||
|
// 汇总列
|
||||||
|
String key = (d.getBusinessDate() == null ? "" : keySdf.format(d.getBusinessDate()))
|
||||||
|
+ "_" + d.getWarehouseId();
|
||||||
|
BigDecimal[] arr = summaryMap.get(key);
|
||||||
|
BigDecimal entireLeaseArea = (arr != null) ? arr[0] : BigDecimal.ZERO;
|
||||||
|
BigDecimal fractionalLeaseArea = (arr != null) ? arr[1] : BigDecimal.ZERO;
|
||||||
|
vo.setEntireLeaseArea(entireLeaseArea);
|
||||||
|
vo.setFractionalLeaseArea(fractionalLeaseArea);
|
||||||
|
// 该仓库的总面积(按仓库单独算,不再用全局总和)
|
||||||
|
BigDecimal widTotalArea = warehouseTotalAreaMap.getOrDefault(d.getWarehouseId(), BigDecimal.ZERO);
|
||||||
|
vo.setTotalArea(widTotalArea);
|
||||||
|
// 日租率 = (整租+散租) / 总面积 × 100,保留2位小数(直接输出百分比值,如 10.00)
|
||||||
|
BigDecimal leaseSum = entireLeaseArea.add(fractionalLeaseArea);
|
||||||
|
BigDecimal dailyRate = widTotalArea.compareTo(BigDecimal.ZERO) == 0
|
||||||
|
? BigDecimal.ZERO
|
||||||
|
: leaseSum.multiply(new BigDecimal("100")).divide(widTotalArea, 2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
vo.setDailyRentalRate(dailyRate);
|
||||||
|
exportList.add(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 5. 按业务日期降序、仓库名升序排序(null 排最后)=====
|
||||||
|
exportList.sort(Comparator
|
||||||
|
.comparing(WarehouseLeaseExportVO::getBusinessDate, Comparator.nullsLast(Comparator.reverseOrder()))
|
||||||
|
.thenComparing(WarehouseLeaseExportVO::getWarehouseName, Comparator.nullsLast(Comparator.naturalOrder())));
|
||||||
|
|
||||||
|
// ===== 6. 用 ExcelUtil 导出(项目通用做法,单 sheet)=====
|
||||||
|
String fileName = URLEncoder.encode("仓库出租率导出", "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||||
|
|
||||||
|
ExcelUtil<WarehouseLeaseExportVO> util = new ExcelUtil<>(WarehouseLeaseExportVO.class);
|
||||||
|
util.exportExcel(response, exportList, "仓库出租率");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务整租推送到bms
|
* 定时任务整租推送到bms
|
||||||
@@ -581,6 +687,25 @@ public class LeaseApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用/停用租赁
|
||||||
|
* @param leaseIds 租赁ID列表
|
||||||
|
* @param status 目标状态:1=启用,0=停用
|
||||||
|
*/
|
||||||
|
public Boolean updateStatus(List<Long> leaseIds, Integer status) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
Long updateBy = loginUser != null ? loginUser.getUserid() : null;
|
||||||
|
String updateByName = loginUser != null ? loginUser.getUsername() : null;
|
||||||
|
if (leaseIds == null || leaseIds.isEmpty()) {
|
||||||
|
throw new ServiceException("租赁ID不能为空");
|
||||||
|
}
|
||||||
|
if (status == null || (status != 0 && status != 1)) {
|
||||||
|
throw new ServiceException("状态值无效:1=启用,0=停用");
|
||||||
|
}
|
||||||
|
log.info("启用/停用租赁--结束,leaseIds={},状态={},更新人id={},更新人名称={}",leaseIds,status==0?"停用":"启用",updateBy,updateByName);
|
||||||
|
return leaseDomainService.updateStatus(leaseIds, status, updateBy, updateByName);
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * @description 设置数据字典键值
|
// * @description 设置数据字典键值
|
||||||
// * @author ZhouGY
|
// * @author ZhouGY
|
||||||
|
|||||||
+35
-5
@@ -30,11 +30,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@@ -580,6 +576,40 @@ public class ExpenseAccountApplicationService {
|
|||||||
return expenseAccountDomainService.getInfoByCode2(subjectCode,topOrganizationId);
|
return expenseAccountDomainService.getInfoByCode2(subjectCode,topOrganizationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码和组织ID查询
|
||||||
|
*/
|
||||||
|
public ExpenseAccountPO getInfoByOrgAndCode(String subjectCode, Long organizationId) {
|
||||||
|
if(!StringUtils.isNotEmpty(subjectCode)){
|
||||||
|
throw new ServiceException("费用科目编码不能为空");
|
||||||
|
}
|
||||||
|
if(organizationId == null){
|
||||||
|
throw new ServiceException("组织ID不能为空");
|
||||||
|
}
|
||||||
|
ExpenseAccountPO expenseAccountPO = expenseAccountDomainService.getInfoByOrgAndCode(subjectCode, organizationId);
|
||||||
|
// // 组装计费单位列表:单位-单位英文
|
||||||
|
// List<String> unit = new ArrayList<>();
|
||||||
|
// if (expenseAccountPO != null) {
|
||||||
|
// unit.add(expenseAccountPO.getBillingUnit() + "-" + expenseAccountPO.getBillingUnitEn());
|
||||||
|
// unit.add(expenseAccountPO.getBillingUnit2() + "-" + expenseAccountPO.getBillingUnitEn2());
|
||||||
|
// expenseAccountPO.setUnit(unit);
|
||||||
|
// }
|
||||||
|
// 组装计费单位列表(数组)
|
||||||
|
List<Map<String, String>> unit = new ArrayList<>();
|
||||||
|
if (expenseAccountPO != null) {
|
||||||
|
Map<String, String> unit1 = new HashMap<>();
|
||||||
|
unit1.put("unit", expenseAccountPO.getBillingUnit() + "-" + expenseAccountPO.getBillingUnitEn());
|
||||||
|
unit.add(unit1);
|
||||||
|
|
||||||
|
Map<String, String> unit2 = new HashMap<>();
|
||||||
|
unit2.put("unit", expenseAccountPO.getBillingUnit2() + "-" + expenseAccountPO.getBillingUnitEn2());
|
||||||
|
unit.add(unit2);
|
||||||
|
|
||||||
|
expenseAccountPO.setUnit(unit);
|
||||||
|
}
|
||||||
|
return expenseAccountPO;
|
||||||
|
}
|
||||||
|
|
||||||
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO){
|
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO){
|
||||||
setDataPermissionForSearch(searchExpenseAccountDO);
|
setDataPermissionForSearch(searchExpenseAccountDO);
|
||||||
return expenseAccountDomainService.selectExpenseAccount(searchExpenseAccountDO);
|
return expenseAccountDomainService.selectExpenseAccount(searchExpenseAccountDO);
|
||||||
|
|||||||
+13
-10
@@ -157,15 +157,18 @@ public class MaterialBaseInfoApplicationService {
|
|||||||
* @param materialBaseInfoDO
|
* @param materialBaseInfoDO
|
||||||
*/
|
*/
|
||||||
private void shipperParam(MaterialBaseInfoDO materialBaseInfoDO){
|
private void shipperParam(MaterialBaseInfoDO materialBaseInfoDO){
|
||||||
AjaxResult ajaxResult = userServiceFeign.getInfo(materialBaseInfoDO.getShipperId());
|
Long shipperId = materialBaseInfoDO.getShipperId();
|
||||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
if (shipperId != null && shipperId != 0l) {
|
||||||
throw new ServiceException("获取货主信息失败");
|
AjaxResult ajaxResult = userServiceFeign.getInfo(materialBaseInfoDO.getShipperId());
|
||||||
}
|
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||||
UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
|
throw new ServiceException("获取货主信息失败");
|
||||||
// 如果原始shipperName不为空,保留原始值(导入或手动输入时应该保留完整名称)
|
}
|
||||||
// 只有在原始shipperName为空时,才使用查询到的userName
|
UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
|
||||||
if (materialBaseInfoDO.getShipperName() == null || materialBaseInfoDO.getShipperName().trim().isEmpty()) {
|
// 如果原始shipperName不为空,保留原始值(导入或手动输入时应该保留完整名称)
|
||||||
materialBaseInfoDO.setShipperName(userPo.getUserName());
|
// 只有在原始shipperName为空时,才使用查询到的userName
|
||||||
|
if (materialBaseInfoDO.getShipperName() == null || materialBaseInfoDO.getShipperName().trim().isEmpty()) {
|
||||||
|
materialBaseInfoDO.setShipperName(userPo.getUserName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,4 +185,4 @@ public class MaterialBaseInfoApplicationService {
|
|||||||
//return materialBaseInfoDomainService.getMaterialStockList(shipperName,materialName,machineCode,topOrganizationId,pageNum,pageSize);/**/
|
//return materialBaseInfoDomainService.getMaterialStockList(shipperName,materialName,machineCode,topOrganizationId,pageNum,pageSize);/**/
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
@@ -58,6 +58,11 @@ public interface IExpenseAccountService extends IService<ExpenseAccount>
|
|||||||
*/
|
*/
|
||||||
ExpenseAccountPO getInfoByCode(ExpenseAccountDO expenseAccountDO);
|
ExpenseAccountPO getInfoByCode(ExpenseAccountDO expenseAccountDO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据费用科目code和组织ID查询费用信息
|
||||||
|
*/
|
||||||
|
ExpenseAccountPO getInfoByOrgAndCode(ExpenseAccountDO expenseAccountDO);
|
||||||
|
|
||||||
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO);
|
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO);
|
||||||
|
|
||||||
public List<QueryExpenseAccountPO> selectOtherExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO);
|
public List<QueryExpenseAccountPO> selectOtherExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO);
|
||||||
|
|||||||
+5
@@ -39,6 +39,11 @@ public interface ExpenseAccountMapper extends BaseMapper<ExpenseAccount>
|
|||||||
*/
|
*/
|
||||||
ExpenseAccountPO getInfoByCode(@Param("expenseAccountDO") ExpenseAccountDO expenseAccountDO);
|
ExpenseAccountPO getInfoByCode(@Param("expenseAccountDO") ExpenseAccountDO expenseAccountDO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据费用科目code和组织ID查询费用信息
|
||||||
|
*/
|
||||||
|
ExpenseAccountPO getInfoByOrgAndCode(@Param("expenseAccountDO") ExpenseAccountDO expenseAccountDO);
|
||||||
|
|
||||||
public List<QueryExpenseAccountPO> selectExpenseAccount(@Param("searchExpenseAccountDO") SearchExpenseAccountDO searchExpenseAccountDO);
|
public List<QueryExpenseAccountPO> selectExpenseAccount(@Param("searchExpenseAccountDO") SearchExpenseAccountDO searchExpenseAccountDO);
|
||||||
|
|
||||||
public List<QueryExpenseAccountPO> selectOtherExpenseAccount(@Param("searchExpenseAccountDO") SearchExpenseAccountDO searchExpenseAccountDO);
|
public List<QueryExpenseAccountPO> selectOtherExpenseAccount(@Param("searchExpenseAccountDO") SearchExpenseAccountDO searchExpenseAccountDO);
|
||||||
|
|||||||
+5
@@ -129,6 +129,11 @@ public class ExpenseAccountImpl extends ServiceImpl<ExpenseAccountMapper, Expens
|
|||||||
return expenseAccountMapper.getInfoByCode(expenseAccountDO);
|
return expenseAccountMapper.getInfoByCode(expenseAccountDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExpenseAccountPO getInfoByOrgAndCode(ExpenseAccountDO expenseAccountDO) {
|
||||||
|
return expenseAccountMapper.getInfoByOrgAndCode(expenseAccountDO);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统科目查询
|
* 系统科目查询
|
||||||
* 社会车辆:service_items_code='SHCL',upper_subject_code='shcl_clyf',society_status=1
|
* 社会车辆:service_items_code='SHCL',upper_subject_code='shcl_clyf',society_status=1
|
||||||
|
|||||||
+5
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModel;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||||
|
|
||||||
@@ -159,4 +160,8 @@ public class ExpenseAccountPO extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty("nc科目编码")
|
@ApiModelProperty("nc科目编码")
|
||||||
private String ncSubjectCode;
|
private String ncSubjectCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("计费单位列表(单位-单位英文)")
|
||||||
|
private List<Map<String, String>> unit;
|
||||||
|
|
||||||
}
|
}
|
||||||
+10
@@ -101,6 +101,16 @@ public class ExpenseAccountDomainService {
|
|||||||
expenseAccountDO.setTopOrganizationId(topOrganizationId);
|
expenseAccountDO.setTopOrganizationId(topOrganizationId);
|
||||||
return expenseAccountService.getInfoByCode(expenseAccountDO);
|
return expenseAccountService.getInfoByCode(expenseAccountDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码和组织ID查询费用科目信息
|
||||||
|
*/
|
||||||
|
public ExpenseAccountPO getInfoByOrgAndCode(String subjectCode, Long organizationId) {
|
||||||
|
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
|
||||||
|
expenseAccountDO.setSubjectCode(subjectCode);
|
||||||
|
expenseAccountDO.setOrganizationId(organizationId);
|
||||||
|
return expenseAccountService.getInfoByOrgAndCode(expenseAccountDO);
|
||||||
|
}
|
||||||
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO){
|
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO){
|
||||||
return expenseAccountService.selectExpenseAccount(searchExpenseAccountDO);
|
return expenseAccountService.selectExpenseAccount(searchExpenseAccountDO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,4 +96,7 @@ public class Lease extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty("业务员ID")
|
@ApiModelProperty("业务员ID")
|
||||||
private String salesmanId;
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("状态:1=正常,0=停用")
|
||||||
|
private Integer status;
|
||||||
}
|
}
|
||||||
+3
@@ -97,4 +97,7 @@ public class LeasePO extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty("业务员ID")
|
@ApiModelProperty("业务员ID")
|
||||||
private String salesmanId;
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("状态:1=正常,0=停用")
|
||||||
|
private Integer status;
|
||||||
}
|
}
|
||||||
+3
@@ -113,4 +113,7 @@ public class LeaseDO extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty("业务员ID")
|
@ApiModelProperty("业务员ID")
|
||||||
private String salesmanId;
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("状态:1=正常,0=停用")
|
||||||
|
private Integer status;
|
||||||
}
|
}
|
||||||
+18
@@ -89,4 +89,22 @@ public class LeaseDomainService {
|
|||||||
.in(Lease::getId, leaseIds)
|
.in(Lease::getId, leaseIds)
|
||||||
.eq(Lease::getDelFlag, 1));
|
.eq(Lease::getDelFlag, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用/停用租赁
|
||||||
|
* @param leaseIds 租赁ID列表
|
||||||
|
* @param status 目标状态:1=启用,0=停用
|
||||||
|
* @param updateBy 操作人ID
|
||||||
|
* @param updateByName 操作人名称
|
||||||
|
*/
|
||||||
|
public Boolean updateStatus(List<Long> leaseIds, Integer status, Long updateBy, String updateByName) {
|
||||||
|
return leaseService.update(new UpdateWrapper<Lease>().lambda()
|
||||||
|
.set(Lease::getStatus, status)
|
||||||
|
.set(Lease::getUpdateBy, updateBy)
|
||||||
|
.set(Lease::getUpdateByName, updateByName)
|
||||||
|
.set(Lease::getUpdateTime, new Date())
|
||||||
|
.in(Lease::getId, leaseIds)
|
||||||
|
.eq(Lease::getDelFlag, 1));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+9
@@ -1,5 +1,6 @@
|
|||||||
package com.mhd.basic.domain.materialBaseInfo.entity;
|
package com.mhd.basic.domain.materialBaseInfo.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
@@ -44,14 +45,17 @@ public class MaterialBaseInfo extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty("货主id")
|
@ApiModelProperty("货主id")
|
||||||
@Excel(name = "货主id")
|
@Excel(name = "货主id")
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
private Long shipperId;
|
private Long shipperId;
|
||||||
|
|
||||||
@ApiModelProperty("货主名称")
|
@ApiModelProperty("货主名称")
|
||||||
@Excel(name = "货主名称")
|
@Excel(name = "货主名称")
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
private String shipperName;
|
private String shipperName;
|
||||||
|
|
||||||
@ApiModelProperty("物料编码")
|
@ApiModelProperty("物料编码")
|
||||||
@Excel(name = "物料编码")
|
@Excel(name = "物料编码")
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
private String materialCode;
|
private String materialCode;
|
||||||
|
|
||||||
@ApiModelProperty("物料名称")
|
@ApiModelProperty("物料名称")
|
||||||
@@ -404,4 +408,9 @@ public class MaterialBaseInfo extends BaseVOEntity{
|
|||||||
@ApiModelProperty(name = "收费标准")
|
@ApiModelProperty(name = "收费标准")
|
||||||
private BigDecimal chargeStandard;
|
private BigDecimal chargeStandard;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "组织(多个用,分开)")
|
||||||
|
private String orgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
|
||||||
|
private Integer isNormalMaterial;
|
||||||
}
|
}
|
||||||
+6
@@ -393,4 +393,10 @@ public class MaterialBaseInfoPO extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty(name = "收费标准")
|
@ApiModelProperty(name = "收费标准")
|
||||||
private BigDecimal chargeStandard;
|
private BigDecimal chargeStandard;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "组织(多个用,分开)")
|
||||||
|
private String orgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
|
||||||
|
private Integer isNormalMaterial;
|
||||||
}
|
}
|
||||||
+6
@@ -399,4 +399,10 @@ public class MaterialBaseInfoDO extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty(name = "收费标准")
|
@ApiModelProperty(name = "收费标准")
|
||||||
private BigDecimal chargeStandard;
|
private BigDecimal chargeStandard;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "组织(多个用,分开)")
|
||||||
|
private String orgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
|
||||||
|
private Integer isNormalMaterial;
|
||||||
}
|
}
|
||||||
+2
@@ -168,9 +168,11 @@ public class WarehouseDomainService {
|
|||||||
warehouseLinkagePO.setName(warehousePO.getWarehouseName());
|
warehouseLinkagePO.setName(warehousePO.getWarehouseName());
|
||||||
StorageSectionDO storageSectionDO = new StorageSectionDO();
|
StorageSectionDO storageSectionDO = new StorageSectionDO();
|
||||||
storageSectionDO.setWarehouseId(warehousePO.getWarehouseId());
|
storageSectionDO.setWarehouseId(warehousePO.getWarehouseId());
|
||||||
|
storageSectionDO.setNullify(1);
|
||||||
List<StorageSectionPO> storageSectionPOList = storageSectionService.queryList(storageSectionDO);
|
List<StorageSectionPO> storageSectionPOList = storageSectionService.queryList(storageSectionDO);
|
||||||
StorageLocationDO storageLocationDO = new StorageLocationDO();
|
StorageLocationDO storageLocationDO = new StorageLocationDO();
|
||||||
storageLocationDO.setWarehouseId(warehousePO.getWarehouseId());
|
storageLocationDO.setWarehouseId(warehousePO.getWarehouseId());
|
||||||
|
storageLocationDO.setNullify(1);
|
||||||
List<StorageLocationPO> storageLocationPOList = storageLocationService.queryList(storageLocationDO);
|
List<StorageLocationPO> storageLocationPOList = storageLocationService.queryList(storageLocationDO);
|
||||||
//根据库区唯一标识进行分组
|
//根据库区唯一标识进行分组
|
||||||
Map<String, List<StorageLocationPO>> storageLocationListMap = storageLocationPOList.stream().collect(Collectors.groupingBy(StorageLocationPO::getStorageCode));
|
Map<String, List<StorageLocationPO>> storageLocationListMap = storageLocationPOList.stream().collect(Collectors.groupingBy(StorageLocationPO::getStorageCode));
|
||||||
|
|||||||
@@ -110,4 +110,7 @@ public class LeaseDTO extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty("业务员ID")
|
@ApiModelProperty("业务员ID")
|
||||||
private String salesmanId;
|
private String salesmanId;
|
||||||
|
|
||||||
|
@ApiModelProperty("状态:1=正常,0=停用")
|
||||||
|
private Integer status;
|
||||||
}
|
}
|
||||||
+6
@@ -379,4 +379,10 @@ public class MaterialBaseInfoDTO extends BaseVOEntity{
|
|||||||
@ApiModelProperty(name = "收费标准")
|
@ApiModelProperty(name = "收费标准")
|
||||||
private BigDecimal chargeStandard;
|
private BigDecimal chargeStandard;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "组织(多个用,分开)")
|
||||||
|
private String orgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
|
||||||
|
private Integer isNormalMaterial;
|
||||||
|
|
||||||
}
|
}
|
||||||
+65
@@ -0,0 +1,65 @@
|
|||||||
|
package com.mhd.basic.interfaces.dto.shipperLeaseDetailsApi;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.mhd.common.core.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库出租率及客户租赁明细 导出VO(单 sheet)
|
||||||
|
* 明细为主行,附该仓库当日汇总列
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class WarehouseLeaseExportVO {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库")
|
||||||
|
@Excel(name = "仓库")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务日期")
|
||||||
|
@Excel(name = "业务日期", width = 20, dateFormat = "yyyy-MM-dd")
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date businessDate;
|
||||||
|
|
||||||
|
@ApiModelProperty("整租面积(m²)")
|
||||||
|
@Excel(name = "整租面积(m²)")
|
||||||
|
private BigDecimal entireLeaseArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("散租面积(m²)")
|
||||||
|
@Excel(name = "散租面积(m²)")
|
||||||
|
private BigDecimal fractionalLeaseArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("总面积(m²)")
|
||||||
|
@Excel(name = "总面积(m²)")
|
||||||
|
private BigDecimal totalArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("日租率(%)")
|
||||||
|
@Excel(name = "日租率(%)")
|
||||||
|
private BigDecimal dailyRentalRate;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织名称")
|
||||||
|
@Excel(name = "组织名称")
|
||||||
|
private String organizationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主名称")
|
||||||
|
@Excel(name = "货主名称")
|
||||||
|
private String cargoOwnerName;
|
||||||
|
|
||||||
|
@ApiModelProperty("租赁方式")
|
||||||
|
@Excel(name = "租赁方式")
|
||||||
|
private String leaseType;
|
||||||
|
|
||||||
|
@ApiModelProperty("租赁面积(m²)")
|
||||||
|
@Excel(name = "租赁面积(m²)")
|
||||||
|
private BigDecimal leaseArea;
|
||||||
|
|
||||||
|
// ===== 以下为仓库当日汇总列(同一仓库同一天的多行会重复,属正常)=====
|
||||||
|
|
||||||
|
}
|
||||||
+8
@@ -328,5 +328,13 @@ public class ExpenseAccountApi extends BaseController{
|
|||||||
return AjaxResult.success(expenseAccountPO);
|
return AjaxResult.success(expenseAccountPO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据code和组织ID获取数据")
|
||||||
|
@GetMapping(value = "/getInfoByOrgAndCode")
|
||||||
|
public AjaxResult getInfoByOrgAndCode(@RequestParam("subjectCode") String subjectCode,@RequestParam("organizationId") Long organizationId)
|
||||||
|
{
|
||||||
|
ExpenseAccountPO expenseAccountPO = expenseAccountApplicationService.getInfoByOrgAndCode(subjectCode, organizationId);
|
||||||
|
return AjaxResult.success(expenseAccountPO.getUnit());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+14
@@ -130,4 +130,18 @@ public class LeaseApi extends BaseController{
|
|||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用/停用租赁
|
||||||
|
* @param leaseIds 租赁ID集合
|
||||||
|
* @param status 目标状态(启用/停用)
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@ApiOperation("启用/停用租赁")
|
||||||
|
@PutMapping("/updateStatus/{leaseIds}/{status}")
|
||||||
|
public AjaxResult updateStatus(@PathVariable("leaseIds") List<Long> leaseIds,
|
||||||
|
@PathVariable("status") Integer status)
|
||||||
|
{
|
||||||
|
return toAjax(leaseApplicationService.updateStatus(leaseIds, status));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+14
@@ -20,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -157,5 +159,17 @@ public class ShipperLeaseDetailsApi extends BaseController{
|
|||||||
return getDataTable(warehouseOccupancyRates);
|
return getDataTable(warehouseOccupancyRates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出仓库出租率及客户租赁明细
|
||||||
|
* 参数与 /warehouseOccupancyRate、/list 一致
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出仓库出租率及客户租赁明细")
|
||||||
|
@GetMapping(value = "/export", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||||
|
public void export(ShipperLeaseDetailsDTO shipperLeaseDetailsDTO, HttpServletResponse response) throws IOException
|
||||||
|
{
|
||||||
|
ShipperLeaseDetailsDO shipperLeaseDetailsDO = shipperLeaseDetailsAssembler.toDO(shipperLeaseDetailsDTO);
|
||||||
|
leaseApplicationService.exportOccupancyRate(response, shipperLeaseDetailsDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ spring:
|
|||||||
discovery:
|
discovery:
|
||||||
# server-addr: 127.0.0.1:8848
|
# server-addr: 127.0.0.1:8848
|
||||||
server-addr: 10.33.0.129:6010
|
server-addr: 10.33.0.129:6010
|
||||||
# 线上测试环境配置 容器名+端口号
|
# server-addr: 10.102.192.30:6848
|
||||||
# server-addr: 10.102.192.31:6848
|
|
||||||
username: nacos
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
#线上正式环境
|
#线上正式环境
|
||||||
@@ -24,8 +23,7 @@ spring:
|
|||||||
config:
|
config:
|
||||||
# server-addr: 127.0.0.1:8848
|
# server-addr: 127.0.0.1:8848
|
||||||
server-addr: 10.33.0.129:6010
|
server-addr: 10.33.0.129:6010
|
||||||
# 线上测试环境配置 容器名+端口号
|
# server-addr: 10.102.192.30:6848
|
||||||
# server-addr: 10.102.192.31:6848
|
|
||||||
username: nacos
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
#线上正式环境
|
#线上正式环境
|
||||||
|
|||||||
@@ -151,6 +151,22 @@
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getInfoByOrgAndCode" resultType="com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO" parameterType="com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO">
|
||||||
|
SELECT
|
||||||
|
a.* ,
|
||||||
|
b.tax_rate,
|
||||||
|
b.service_items_name,
|
||||||
|
b.service_items_code
|
||||||
|
FROM
|
||||||
|
expense_account a
|
||||||
|
LEFT JOIN service_items_manage b ON a.service_items_manage_id = b.service_items_manage_id
|
||||||
|
WHERE
|
||||||
|
a.del_flag = 1
|
||||||
|
AND a.organization_id = #{expenseAccountDO.organizationId}
|
||||||
|
AND a.subject_code = #{expenseAccountDO.subjectCode}
|
||||||
|
AND a.status = 1
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<sql id="common_where_two">
|
<sql id="common_where_two">
|
||||||
<!-- 数据权限:南光组织(organizationId=2827)查全部,其他组织查自己 -->
|
<!-- 数据权限:南光组织(organizationId=2827)查全部,其他组织查自己 -->
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateByName" column="update_by_name" />
|
<result property="updateByName" column="update_by_name" />
|
||||||
<result property="delFlag" column="del_flag" />
|
<result property="delFlag" column="del_flag" />
|
||||||
|
<result property="status" column="status" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
@@ -68,7 +69,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
a.bill_time,
|
a.bill_time,
|
||||||
a.salesman_name,
|
a.salesman_name,
|
||||||
a.settlement_currency,
|
a.settlement_currency,
|
||||||
a.salesman_id
|
a.salesman_id,
|
||||||
|
a.status
|
||||||
from lease a
|
from lease a
|
||||||
LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1
|
LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1
|
||||||
</sql>
|
</sql>
|
||||||
@@ -136,6 +138,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
AND a.start_date <= #{time}
|
AND a.start_date <= #{time}
|
||||||
AND a.end_date >= #{time}
|
AND a.end_date >= #{time}
|
||||||
</if>
|
</if>
|
||||||
|
<!-- 停用状态过滤:status 不为空时按状态过滤 -->
|
||||||
|
<if test="status != null">
|
||||||
|
AND a.status = #{status}
|
||||||
|
</if>
|
||||||
<!-- 删除标记 -->
|
<!-- 删除标记 -->
|
||||||
<choose>
|
<choose>
|
||||||
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
|
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
|
||||||
|
|||||||
+54
-36
@@ -161,11 +161,22 @@ public class UserShipperApplicationService {
|
|||||||
|
|
||||||
// 先保存前端传递的 organizationId(如果存在)
|
// 先保存前端传递的 organizationId(如果存在)
|
||||||
Long frontendOrganizationId = userShipperDO.getOrganizationId();
|
Long frontendOrganizationId = userShipperDO.getOrganizationId();
|
||||||
|
|
||||||
// 获取当前登录用户的组织信息
|
// 获取当前登录用户的组织信息
|
||||||
Long loginUserOrganizationId = userPo.getOrganizationId();
|
Long loginUserOrganizationId = userPo.getOrganizationId();
|
||||||
Long topOrganizationId = userPo.getTopOrganizationId();
|
Long topOrganizationId = userPo.getTopOrganizationId();
|
||||||
|
|
||||||
|
// 如果前端传了 orgCode(组织ID),直接按 org_code 过滤查询委托方,不覆盖组织条件
|
||||||
|
// orgCode 匹配 user_shipper.org_code JSON 数组中的 code 字段,用于精确查询委托方
|
||||||
|
if (StringUtils.isNotBlank(userShipperDO.getOrgCode())) {
|
||||||
|
// 清空 organizationId / topOrganizationId,避免被数据权限覆盖逻辑拦截 orgCode 已授权的委托方
|
||||||
|
userShipperDO.setOrganizationId(null);
|
||||||
|
userShipperDO.setTopOrganizationId(null);
|
||||||
|
log.info("托运人列表查询 - 按 orgCode 查询:orgCode={}", userShipperDO.getOrgCode());
|
||||||
|
List<UserShipperPo> userShipperList = userShipperDomainService.userShipperList(userShipperDO);
|
||||||
|
return processShipperList(userShipperList);
|
||||||
|
}
|
||||||
|
|
||||||
// 数据权限:根据 organizationId 来设置查询权限
|
// 数据权限:根据 organizationId 来设置查询权限
|
||||||
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己
|
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己
|
||||||
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L)) {
|
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L)) {
|
||||||
@@ -184,32 +195,13 @@ public class UserShipperApplicationService {
|
|||||||
log.info("托运人列表查询 - 南光组织查询所有组织:不设置组织过滤条件");
|
log.info("托运人列表查询 - 南光组织查询所有组织:不设置组织过滤条件");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 其他组织:设置 organizationId,只查询当前组织的数据
|
// 其他组织:设置 organizationId 为当前登录组织ID。
|
||||||
// 其他组织只能查询自己组织的数据,不能查询其他组织的数据
|
// 查询条件为:a.organization_id = 本组织 OR b.org_code LIKE 本组织ID
|
||||||
if (frontendOrganizationId != null) {
|
// 即委托方初始绑定本组织、或 org_code 中包含本组织(被授权给本组织)时,均可查到。
|
||||||
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
|
// 不设置 topOrganizationId,避免跨顶级组织授权(org_code 已包含本组织)被顶级组织条件拦截。
|
||||||
if (!frontendOrganizationId.equals(loginUserOrganizationId)) {
|
userShipperDO.setOrganizationId(loginUserOrganizationId);
|
||||||
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
|
userShipperDO.setTopOrganizationId(null);
|
||||||
log.warn("托运人列表查询 - 前端传递的组织ID {} 与当前登录用户的组织ID {} 不一致,使用当前登录用户的组织ID进行过滤",
|
log.info("托运人列表查询 - 其他组织按本组织及 org_code 查询:organizationId={}", loginUserOrganizationId);
|
||||||
frontendOrganizationId, loginUserOrganizationId);
|
|
||||||
userShipperDO.setOrganizationId(loginUserOrganizationId);
|
|
||||||
if (frontendOrganizationId.equals(2827L)){
|
|
||||||
userShipperDO.setOrganizationId(null);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
|
|
||||||
userShipperDO.setOrganizationId(frontendOrganizationId);
|
|
||||||
}
|
|
||||||
if (topOrganizationId != null) {
|
|
||||||
userShipperDO.setTopOrganizationId(topOrganizationId);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 前端没有传递 organizationId,使用当前登录用户的组织ID
|
|
||||||
userShipperDO.setOrganizationId(loginUserOrganizationId);
|
|
||||||
if (topOrganizationId != null) {
|
|
||||||
userShipperDO.setTopOrganizationId(topOrganizationId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("托运人列表查询 - 设置组织ID后,查询参数:organizationId={}, topOrganizationId={}, userId={}",
|
log.info("托运人列表查询 - 设置组织ID后,查询参数:organizationId={}, topOrganizationId={}, userId={}",
|
||||||
@@ -413,10 +405,15 @@ public class UserShipperApplicationService {
|
|||||||
shipperDO.setShipperEnterpriseName(companyName);
|
shipperDO.setShipperEnterpriseName(companyName);
|
||||||
// NC客户编码使用模板中的独立字段,不再复用登录账号
|
// NC客户编码使用模板中的独立字段,不再复用登录账号
|
||||||
shipperDO.setCustomerNcCode(ncCustomerCode);
|
shipperDO.setCustomerNcCode(ncCustomerCode);
|
||||||
// 联系人 -> user表 user_name + user_shipper表 user_name_shipper
|
// 公司名称 -> user表 user_name + user_shipper表 user_name_shipper
|
||||||
shipperDO.setUserName(contactName);
|
shipperDO.setUserName(companyName);
|
||||||
shipperDO.setUserNameShipper(contactName);
|
shipperDO.setUserNameShipper(contactName);
|
||||||
// 联系电话 -> user表 user_phone
|
// 登录账号 -> user表 user_member_code
|
||||||
|
shipperDO.setUserMemberCode(userAccount);
|
||||||
|
// 联系人 -> user表 emergency_contact_name
|
||||||
|
shipperDO.setEmergencyContactName(contactName);
|
||||||
|
// 联系电话 -> user表 emergency_contact_phone
|
||||||
|
shipperDO.setEmergencyContactPhone(contactPhone);
|
||||||
shipperDO.setUserPhone(contactPhone);
|
shipperDO.setUserPhone(contactPhone);
|
||||||
// 地址 -> user表 user_area_name,详细地址 -> user表 user_area_address
|
// 地址 -> user表 user_area_name,详细地址 -> user表 user_area_address
|
||||||
shipperDO.setUserAreaName(address);
|
shipperDO.setUserAreaName(address);
|
||||||
@@ -461,16 +458,30 @@ public class UserShipperApplicationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入时若账号没有任何角色,则补分配企业货主角色
|
* 导入委托方时,确保账号仅绑定企业货主(company)角色。
|
||||||
|
* 注意:authShipper 会把“当前登录管理员的所有角色”都分配给导入用户,
|
||||||
|
* 因此这里必须保证用户最终只绑定 company 角色——若现有角色不是“唯一的 company 角色”,
|
||||||
|
* 一律删除后重新分配,避免残留 ownerCargo 等多条错误角色。
|
||||||
*/
|
*/
|
||||||
private void assignCompanyRoleIfMissing(Long userId, Long organizationId) {
|
private void assignCompanyRoleIfMissing(Long userId, Long organizationId) {
|
||||||
if (userId == null || organizationId == null) {
|
if (userId == null || organizationId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 查询用户现有角色
|
||||||
List<UserRoleMenuPO> existingRoles = userRoleDomainService.selectRolesByUserId(userId);
|
List<UserRoleMenuPO> existingRoles = userRoleDomainService.selectRolesByUserId(userId);
|
||||||
if (CollUtil.isNotEmpty(existingRoles)) {
|
// 只有恰好绑定了唯一的 company 角色时,才认为正确,无需处理
|
||||||
|
boolean onlyCompany = !CollUtil.isEmpty(existingRoles)
|
||||||
|
&& existingRoles.size() == 1
|
||||||
|
&& RoleEnum.COMPANY.getCode().equals(existingRoles.get(0).getRoleCode());
|
||||||
|
if (onlyCompany) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 否则:删除所有现有角色(ownerCargo、或多个角色),重新分配 company
|
||||||
|
if (CollUtil.isNotEmpty(existingRoles)) {
|
||||||
|
log.info("导入委托方 - 用户{}角色不正确,删除原角色后重新分配company,原角色: {}",
|
||||||
|
userId, existingRoles.stream().map(UserRoleMenuPO::getRoleCode).collect(Collectors.toList()));
|
||||||
|
userRoleDomainService.deleteByUserId(userId);
|
||||||
|
}
|
||||||
// 按 role_code + organization_id 精确匹配角色(selectByOrganizationIdAndRoleCode 的 common_where 不含 roleCode 过滤,不适用)
|
// 按 role_code + organization_id 精确匹配角色(selectByOrganizationIdAndRoleCode 的 common_where 不含 roleCode 过滤,不适用)
|
||||||
RolePO rolePO = roleDomainService.selectByRoleCodeAndOrganizationId(RoleEnum.COMPANY.getCode(), organizationId);
|
RolePO rolePO = roleDomainService.selectByRoleCodeAndOrganizationId(RoleEnum.COMPANY.getCode(), organizationId);
|
||||||
if (rolePO == null) {
|
if (rolePO == null) {
|
||||||
@@ -547,8 +558,15 @@ public class UserShipperApplicationService {
|
|||||||
userDO.setUserId(userId);
|
userDO.setUserId(userId);
|
||||||
if (StringUtils.isNotBlank(userAccount)) {
|
if (StringUtils.isNotBlank(userAccount)) {
|
||||||
userDO.setUserAccount(userAccount);
|
userDO.setUserAccount(userAccount);
|
||||||
|
// 登录账号 -> user表 user_member_code
|
||||||
|
userDO.setUserMemberCode(userAccount);
|
||||||
}
|
}
|
||||||
userDO.setUserName(contactName);
|
// 公司名称 -> user表 user_name
|
||||||
|
userDO.setUserName(companyName);
|
||||||
|
// 联系人 -> user表 emergency_contact_name
|
||||||
|
userDO.setEmergencyContactName(contactName);
|
||||||
|
// 联系电话 -> user表 emergency_contact_phone
|
||||||
|
userDO.setEmergencyContactPhone(contactPhone);
|
||||||
userDO.setUserPhone(contactPhone);
|
userDO.setUserPhone(contactPhone);
|
||||||
userDO.setUserAreaName(address);
|
userDO.setUserAreaName(address);
|
||||||
userDO.setUserAreaAddress(detailedAddress);
|
userDO.setUserAreaAddress(detailedAddress);
|
||||||
@@ -564,8 +582,8 @@ public class UserShipperApplicationService {
|
|||||||
userDO.setUserSalt(salt);
|
userDO.setUserSalt(salt);
|
||||||
}
|
}
|
||||||
userDomainService.updateUser(userDO);
|
userDomainService.updateUser(userDO);
|
||||||
// 如果该账号没有任何角色,补分配企业货主角色,避免登录报“账号未授权角色信息”
|
// 如果该账号没有企业货主(company)角色,补分配当前导入组织下的 company 角色,避免登录报“账号未授权角色信息”
|
||||||
assignCompanyRoleIfMissing(userId, existingShipper.getOrganizationId());
|
assignCompanyRoleIfMissing(userId, currentOrgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 更新 orgCode 中当前组织的 ncCustomer
|
// 3. 更新 orgCode 中当前组织的 ncCustomer
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ public class UserShipperDomainService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @DataPermissions(cacheName = "master")
|
// @DataPermissions(cacheName = "master")
|
||||||
public List<UserShipperPo> userShipperList(UserShipperDO userShipperDO) {
|
public List<UserShipperPo> userShipperList(UserShipperDO userShipperDO) {
|
||||||
// 数据权限逻辑已在 UserShipperApplicationService.userShipperList 中处理
|
// 数据权限逻辑已在 UserShipperApplicationService.userShipperList 中处理
|
||||||
// 这里不再重复处理数据权限,直接使用传入的参数进行查询
|
// 这里不再重复处理数据权限,直接使用传入的参数进行查询
|
||||||
|
|||||||
@@ -20,15 +20,15 @@ spring:
|
|||||||
discovery:
|
discovery:
|
||||||
# server-addr: 127.0.0.1:8848
|
# server-addr: 127.0.0.1:8848
|
||||||
# 线上测试环境配置 容器名+端口号
|
# 线上测试环境配置 容器名+端口号
|
||||||
server-addr: 10.33.0.129:6010
|
# server-addr: 10.33.0.129:6010
|
||||||
# server-addr: 10.102.192.30:6848
|
server-addr: 10.102.192.31:6848
|
||||||
username: nacos
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
config:
|
config:
|
||||||
# server-addr: 127.0.0.1:8848
|
# server-addr: 127.0.0.1:8848
|
||||||
# 线上测试环境配置 容器名+端口号
|
# 线上测试环境配置 容器名+端口号
|
||||||
server-addr: 10.33.0.129:6010
|
# server-addr: 10.33.0.129:6010
|
||||||
# server-addr: 10.102.192.30:6848
|
server-addr: 10.102.192.31:6848
|
||||||
username: nacos
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||||
|
|||||||
@@ -781,7 +781,11 @@
|
|||||||
/*组织ID - 数据隔离:南光组织(organizationId=2827)查询全部,其他组织查询自己组织的数据*/
|
/*组织ID - 数据隔离:南光组织(organizationId=2827)查询全部,其他组织查询自己组织的数据*/
|
||||||
<if test="organizationId !=null">
|
<if test="organizationId !=null">
|
||||||
AND (
|
AND (
|
||||||
u.organization_id = #{organizationId}
|
u.organization_id = #{organizationId}
|
||||||
|
OR b.org_code LIKE concat('%"code":"', #{organizationId}, '"%')
|
||||||
|
OR b.org_code LIKE concat('%code:', #{organizationId}, '%')
|
||||||
|
OR b.org_code LIKE concat('%code: ', #{organizationId}, '%')
|
||||||
|
OR b.org_code LIKE concat('%"code":', #{organizationId}, '%')
|
||||||
)
|
)
|
||||||
AND u.organization_name IS NOT NULL
|
AND u.organization_name IS NOT NULL
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -378,9 +378,23 @@
|
|||||||
and b.parent_shipper_id = #{parentShipperId}
|
and b.parent_shipper_id = #{parentShipperId}
|
||||||
</if>
|
</if>
|
||||||
/*用户组织ID*/
|
/*用户组织ID*/
|
||||||
<if test="organizationId !=null">
|
/*用户组织ID*/
|
||||||
|
<if test="organizationId !=null or (orgCode != null and orgCode != '')">
|
||||||
AND (
|
AND (
|
||||||
|
<if test="organizationId !=null">
|
||||||
a.organization_id = #{organizationId}
|
a.organization_id = #{organizationId}
|
||||||
|
OR b.org_code LIKE concat('%"code":"', #{organizationId}, '"%')
|
||||||
|
OR b.org_code LIKE concat('%code:', #{organizationId}, '%')
|
||||||
|
OR b.org_code LIKE concat('%code: ', #{organizationId}, '%')
|
||||||
|
OR b.org_code LIKE concat('%"code":', #{organizationId}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="orgCode != null and orgCode != ''">
|
||||||
|
<if test="organizationId !=null"> OR </if>
|
||||||
|
b.org_code LIKE concat('%code:', #{orgCode}, '%')
|
||||||
|
OR b.org_code LIKE concat('%code: ', #{orgCode}, '%')
|
||||||
|
OR b.org_code LIKE concat('%"code":', #{orgCode}, '%')
|
||||||
|
OR b.org_code LIKE concat('%"code":"', #{orgCode}, '"%')
|
||||||
|
</if>
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
/*组织名称*/
|
/*组织名称*/
|
||||||
|
|||||||
@@ -88,4 +88,10 @@ public class BillDetail extends BaseVOEntity{
|
|||||||
private String invoiceItemName;
|
private String invoiceItemName;
|
||||||
@ApiModelProperty(value = "费用类别")
|
@ApiModelProperty(value = "费用类别")
|
||||||
private String feeType;
|
private String feeType;
|
||||||
|
@ApiModelProperty(value = "计费单位")
|
||||||
|
private String billingUnit;
|
||||||
|
@ApiModelProperty(value = "计费数量")
|
||||||
|
private BigDecimal billingNum;
|
||||||
|
@ApiModelProperty(value = "计费单价")
|
||||||
|
private BigDecimal billingUnitPrice;
|
||||||
}
|
}
|
||||||
@@ -134,5 +134,11 @@ public class BillDetailPO extends BaseVOEntity{
|
|||||||
private String invoiceItemName;
|
private String invoiceItemName;
|
||||||
@ApiModelProperty(value = "费用类别")
|
@ApiModelProperty(value = "费用类别")
|
||||||
private String feeType;
|
private String feeType;
|
||||||
|
@ApiModelProperty(value = "计费单位")
|
||||||
|
private String billingUnit;
|
||||||
|
@ApiModelProperty(value = "计费数量")
|
||||||
|
private BigDecimal billingNum;
|
||||||
|
@ApiModelProperty(value = "计费单价")
|
||||||
|
private BigDecimal billingUnitPrice;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -262,4 +262,9 @@ public class BillManagePO extends BaseVOEntity{
|
|||||||
@ApiModelProperty("收款帐户名称")
|
@ApiModelProperty("收款帐户名称")
|
||||||
private String paymentAccountName;
|
private String paymentAccountName;
|
||||||
private List<BillDetail> billDetailList;
|
private List<BillDetail> billDetailList;
|
||||||
|
|
||||||
|
@ApiModelProperty("最近收款时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@Excel(name = "最近收款时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date collectionTime;
|
||||||
}
|
}
|
||||||
@@ -98,4 +98,10 @@ public class BillDetailDO extends BaseVOEntity{
|
|||||||
private String invoiceItemName;
|
private String invoiceItemName;
|
||||||
@ApiModelProperty(value = "费用类别")
|
@ApiModelProperty(value = "费用类别")
|
||||||
private String feeType;
|
private String feeType;
|
||||||
|
@ApiModelProperty(value = "计费单位")
|
||||||
|
private String billingUnit;
|
||||||
|
@ApiModelProperty(value = "计费数量")
|
||||||
|
private BigDecimal billingNum;
|
||||||
|
@ApiModelProperty(value = "计费单价")
|
||||||
|
private BigDecimal billingUnitPrice;
|
||||||
}
|
}
|
||||||
+3
@@ -180,6 +180,9 @@ public class ReceiptManageDomainService {
|
|||||||
receiptManageDO.setCreateBy(loginUser.getUserPo().getUserId());
|
receiptManageDO.setCreateBy(loginUser.getUserPo().getUserId());
|
||||||
receiptManageDO.setCreateByName(loginUser.getUserPo().getUserName());
|
receiptManageDO.setCreateByName(loginUser.getUserPo().getUserName());
|
||||||
receiptManageDO.setCreateTime(new Date());
|
receiptManageDO.setCreateTime(new Date());
|
||||||
|
if (receiptManageDO.getCollectionTime() == null) {
|
||||||
|
receiptManageDO.setCollectionTime(new Date());
|
||||||
|
}
|
||||||
ReceiptManage receiptManage = new ReceiptManage();
|
ReceiptManage receiptManage = new ReceiptManage();
|
||||||
BeanUtils.copyProperties(receiptManageDO,receiptManage);
|
BeanUtils.copyProperties(receiptManageDO,receiptManage);
|
||||||
Boolean flagTwo = receiptManageService.save(receiptManage);
|
Boolean flagTwo = receiptManageService.save(receiptManage);
|
||||||
|
|||||||
@@ -139,4 +139,10 @@ public class BillDetailDTO extends BaseVOEntity{
|
|||||||
private String invoiceItemName;
|
private String invoiceItemName;
|
||||||
@ApiModelProperty(value = "费用类别")
|
@ApiModelProperty(value = "费用类别")
|
||||||
private String feeType;
|
private String feeType;
|
||||||
|
@ApiModelProperty(value = "计费单位")
|
||||||
|
private String billingUnit;
|
||||||
|
@ApiModelProperty(value = "计费数量")
|
||||||
|
private BigDecimal billingNum;
|
||||||
|
@ApiModelProperty(value = "计费单价")
|
||||||
|
private BigDecimal billingUnitPrice;
|
||||||
}
|
}
|
||||||
@@ -18,15 +18,15 @@ spring:
|
|||||||
discovery:
|
discovery:
|
||||||
# server-addr: 127.0.0.1:8848
|
# server-addr: 127.0.0.1:8848
|
||||||
# 线上测试环境配置 容器名+端口号
|
# 线上测试环境配置 容器名+端口号
|
||||||
server-addr: 10.33.0.129:6010
|
# server-addr: 10.33.0.129:6010
|
||||||
# server-addr: 10.102.192.30:6848
|
server-addr: 10.102.192.30:6848
|
||||||
username: nacos
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
config:
|
config:
|
||||||
# server-addr: 127.0.0.1:8848
|
# server-addr: 127.0.0.1:8848
|
||||||
# 线上测试环境配置 容器名+端口号
|
# 线上测试环境配置 容器名+端口号
|
||||||
server-addr: 10.33.0.129:6010
|
# server-addr: 10.33.0.129:6010
|
||||||
# server-addr: 10.102.192.30:6848
|
server-addr: 10.102.192.30:6848
|
||||||
username: nacos
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||||
|
|||||||
@@ -8,7 +8,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="queryList" parameterType="com.mhd.bms.domain.billManage.repository.todo.BillManageDO" resultType="com.mhd.bms.domain.billManage.repository.po.BillManagePO">
|
<select id="queryList" parameterType="com.mhd.bms.domain.billManage.repository.todo.BillManageDO" resultType="com.mhd.bms.domain.billManage.repository.po.BillManagePO">
|
||||||
select
|
select
|
||||||
a.*,b.SETTLEMENT_ENTITY_ID as settlementEntityId
|
a.*,
|
||||||
|
b.SETTLEMENT_ENTITY_ID as settlementEntityId,
|
||||||
|
(SELECT MAX(c.collection_time)
|
||||||
|
FROM receipt_detail rd
|
||||||
|
LEFT JOIN receipt_manage c ON rd.receipt_manage_id = c.receipt_manage_id
|
||||||
|
WHERE rd.bill_manage_id = a.bill_manage_id
|
||||||
|
AND rd.del_flag = 1
|
||||||
|
AND c.del_flag = 1) AS collectionTime
|
||||||
from bill_manage a LEFT JOIN SETTLEMENT_CUSTOMERS b on a.SETTLEMENT_CUSTOMERS_ID = b.SETTLEMENT_CUSTOMERS_ID
|
from bill_manage a LEFT JOIN SETTLEMENT_CUSTOMERS b on a.SETTLEMENT_CUSTOMERS_ID = b.SETTLEMENT_CUSTOMERS_ID
|
||||||
where a.del_flag = 1
|
where a.del_flag = 1
|
||||||
<include refid="common_where"/>
|
<include refid="common_where"/>
|
||||||
|
|||||||
+8
@@ -147,6 +147,14 @@ public class BusinessDocumentOrderApplicationService {
|
|||||||
{
|
{
|
||||||
return businessDocumentOrderDomainService.audit(businessAuditDTO);
|
return businessDocumentOrderDomainService.audit(businessAuditDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务单反审核
|
||||||
|
*/
|
||||||
|
public Boolean cancelAudit(BusinessAuditDTO businessAuditDTO)
|
||||||
|
{
|
||||||
|
return businessDocumentOrderDomainService.cancelAudit(businessAuditDTO);
|
||||||
|
}
|
||||||
public boolean execute(List<Long> ids) {
|
public boolean execute(List<Long> ids) {
|
||||||
return businessDocumentOrderDomainService.execute(ids);
|
return businessDocumentOrderDomainService.execute(ids);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -49,6 +49,11 @@ public interface IBusinessDocumentOrderService extends IService<BusinessDocument
|
|||||||
|
|
||||||
public Boolean audit( List<Long> ids, Long reviewStatus, String SalesManager,String reviewOpinion);
|
public Boolean audit( List<Long> ids, Long reviewStatus, String SalesManager,String reviewOpinion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务单反审核(将已审核订单恢复到待审核)
|
||||||
|
*/
|
||||||
|
public Boolean cancelAudit(List<Long> ids);
|
||||||
|
|
||||||
String selectByMakerCodeNc(String salesmanCodeNc);
|
String selectByMakerCodeNc(String salesmanCodeNc);
|
||||||
|
|
||||||
String selectByMakerCodeNc1(String salesmanCodeNc);
|
String selectByMakerCodeNc1(String salesmanCodeNc);
|
||||||
|
|||||||
+6
@@ -37,4 +37,10 @@ public interface BusinessDocumentOrderMapper extends BaseMapper<BusinessDocument
|
|||||||
TmsTransportNote getTmsTransportNote(@Param("tmsOrderId") String tmsOrderId);
|
TmsTransportNote getTmsTransportNote(@Param("tmsOrderId") String tmsOrderId);
|
||||||
|
|
||||||
String getPushVerifyByOrgId(@Param("organizationId") Long organizationId);
|
String getPushVerifyByOrgId(@Param("organizationId") Long organizationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计指定日期前缀(yyMMdd)下已生成的新格式业务单号数量
|
||||||
|
* 仅统计新格式(长度<=12),过滤历史16位旧数据,保证序号每日从001正确累计
|
||||||
|
*/
|
||||||
|
int countByGoodsNumberPrefix(@Param("prefix") String prefix);
|
||||||
}
|
}
|
||||||
|
|||||||
+89
-46
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.mhd.common.core.domain.po.UserPo;
|
import com.mhd.common.core.domain.po.UserPo;
|
||||||
import com.mhd.common.core.utils.OrderSequence;
|
import com.mhd.common.core.utils.OrderSequence;
|
||||||
@@ -19,6 +20,7 @@ import com.mhd.oms.domain.businessDocumentOrder.repository.facade.IBusinessDocum
|
|||||||
import com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocumentOrderMapper;
|
import com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocumentOrderMapper;
|
||||||
import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOrderPO;
|
import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOrderPO;
|
||||||
import com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO;
|
import com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO;
|
||||||
|
import com.mhd.oms.domain.businessDocumentOrder.service.GoodsNumberGenerator;
|
||||||
import com.mhd.oms.domain.executeOrder.entity.ExecuteOrder;
|
import com.mhd.oms.domain.executeOrder.entity.ExecuteOrder;
|
||||||
import com.mhd.oms.domain.executeOrder.repository.mapper.ExecuteOrderMapper;
|
import com.mhd.oms.domain.executeOrder.repository.mapper.ExecuteOrderMapper;
|
||||||
import com.mhd.oms.domain.executeOrder.repository.todo.ExecuteOrderDO;
|
import com.mhd.oms.domain.executeOrder.repository.todo.ExecuteOrderDO;
|
||||||
@@ -88,6 +90,9 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
|||||||
@Autowired
|
@Autowired
|
||||||
private WlhyServiceFeign wlhyServiceFeign;
|
private WlhyServiceFeign wlhyServiceFeign;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GoodsNumberGenerator goodsNumberGenerator;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】列表
|
* 查询【请填写功能名称】列表
|
||||||
@@ -173,28 +178,6 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String getOrderCodeByDate(Date date){
|
|
||||||
return new StringBuffer()
|
|
||||||
.append(getSecondPartByDate(date))
|
|
||||||
.append(getThreePart())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
private static String getSecondPartByDate(Date date) {
|
|
||||||
if (date == null) {
|
|
||||||
date = new Date();
|
|
||||||
}
|
|
||||||
String temp_current_time = DateUtil.format(date, datePattern());
|
|
||||||
return temp_current_time.substring(2, temp_current_time.length());
|
|
||||||
}
|
|
||||||
private static String datePattern() {
|
|
||||||
return "yyyyMMddHHmmss";
|
|
||||||
}
|
|
||||||
private static String getThreePart() {
|
|
||||||
return RandomUtil.randomNumbers(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean audit(List<Long> ids, Long reviewStatus, String SalesManager,String reviewOpinion ) {
|
public Boolean audit(List<Long> ids, Long reviewStatus, String SalesManager,String reviewOpinion ) {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();//获取登录人
|
LoginUser loginUser = SecurityUtils.getLoginUser();//获取登录人
|
||||||
@@ -225,7 +208,6 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
|||||||
BeanUtils.copyProperties(businessDocumentOrder, subOrder);
|
BeanUtils.copyProperties(businessDocumentOrder, subOrder);
|
||||||
|
|
||||||
subOrder.setId(null);
|
subOrder.setId(null);
|
||||||
subOrder.setGoodsNumber(OrderSequence.getOrderCode()); // 生成新的子单号
|
|
||||||
|
|
||||||
// 设置子单的拼单类型和主单关系
|
// 设置子单的拼单类型和主单关系
|
||||||
subOrder.setSplicingOrderType(3L); // 合单-子单
|
subOrder.setSplicingOrderType(3L); // 合单-子单
|
||||||
@@ -255,31 +237,10 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
|||||||
subOrder.setRecipientName(user.getUserName());
|
subOrder.setRecipientName(user.getUserName());
|
||||||
|
|
||||||
|
|
||||||
String orderCode = null;
|
//生成子单货源单号(yyMMdd + 当日顺序号)
|
||||||
int maxRetryCount = 100;
|
String orderCode = goodsNumberGenerator.generateUniqueGoodsNumber(subOrder.getDocumentDate());
|
||||||
int retryCount = 0;
|
|
||||||
|
|
||||||
while (retryCount < maxRetryCount) {
|
|
||||||
orderCode = getOrderCodeByDate(subOrder.getDocumentDate());
|
|
||||||
retryCount++;
|
|
||||||
|
|
||||||
List<BusinessDocumentOrder> checkOrderCodes = businessDocumentOrderMapper.selectList(
|
|
||||||
new QueryWrapper<BusinessDocumentOrder>().eq("goods_number", orderCode)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(checkOrderCodes)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (retryCount >= maxRetryCount) {
|
|
||||||
throw new com.aliyun.oss.ServiceException("生成唯一订单编号失败,已达到最大重试次数:" + maxRetryCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//生成货源单号
|
|
||||||
subOrder.setGoodsNumber(orderCode);
|
subOrder.setGoodsNumber(orderCode);
|
||||||
|
|
||||||
|
|
||||||
businessDocumentOrderMapper.insert(subOrder);
|
businessDocumentOrderMapper.insert(subOrder);
|
||||||
subOrderCount++; // 增加子单计数
|
subOrderCount++; // 增加子单计数
|
||||||
|
|
||||||
@@ -338,6 +299,88 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean cancelAudit(List<Long> ids) { // 取消审核 后端暂时未加鉴权
|
||||||
|
if (CollectionUtils.isEmpty(ids)) {
|
||||||
|
throw new ServiceException("未选择反审核的业务单");
|
||||||
|
}
|
||||||
|
for (Long id : ids) {
|
||||||
|
BusinessDocumentOrder order = businessDocumentOrderMapper.selectById(id);
|
||||||
|
if (ObjectUtil.isNull(order)) {
|
||||||
|
throw new ServiceException("未查询到业务单信息");
|
||||||
|
}
|
||||||
|
// 校验1:子单(splicingOrderType=3)不允许单独反审核,需对主单操作
|
||||||
|
if (order.getSplicingOrderType() != null && order.getSplicingOrderType() == 3L) {
|
||||||
|
throw new ServiceException("业务单【" + order.getGoodsNumber() + "】为子单,请对主单进行反审核");
|
||||||
|
}
|
||||||
|
// 校验2:仅"审核通过(reviewStatus=1)"可反审核
|
||||||
|
if (order.getReviewStatus() == null || order.getReviewStatus() != 1L) {
|
||||||
|
throw new ServiceException("业务单【" + order.getGoodsNumber() + "】非已审核状态,无法反审核");
|
||||||
|
}
|
||||||
|
// 校验3:已生成执行单的不允许反审核,需先取消执行
|
||||||
|
ExecuteOrder existExec = executeOrderMapper.selectOne(new LambdaQueryWrapper<ExecuteOrder>()
|
||||||
|
.eq(ExecuteOrder::getBusinessDocumentId, id)
|
||||||
|
.eq(ExecuteOrder::getDelFlag, 1).last("LIMIT 1"));
|
||||||
|
if (ObjectUtil.isNotNull(existExec)) {
|
||||||
|
throw new ServiceException("业务单【" + order.getGoodsNumber() + "】已生成执行单,无法进行反审核");
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isMain = order.getSplicingOrderType() != null && order.getSplicingOrderType() == 4L;
|
||||||
|
// 拆单主单(isMain):清理审核时生成的子单、子单地址、以及回填到配送明细的 subOrderId
|
||||||
|
if (isMain) {
|
||||||
|
List<BusinessDocumentOrder> subOrders = businessDocumentOrderMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<BusinessDocumentOrder>()
|
||||||
|
.eq(BusinessDocumentOrder::getMainOrderId, String.valueOf(id))
|
||||||
|
.eq(BusinessDocumentOrder::getDelFlag, 1));
|
||||||
|
if (subOrders != null && !subOrders.isEmpty()) {
|
||||||
|
List<String> subIdStrs = new ArrayList<>();
|
||||||
|
for (BusinessDocumentOrder sub : subOrders) {
|
||||||
|
// 校验4:子单若已生成执行单,主单不可反审核
|
||||||
|
ExecuteOrder subExec = executeOrderMapper.selectOne(new LambdaQueryWrapper<ExecuteOrder>()
|
||||||
|
.eq(ExecuteOrder::getBusinessDocumentId, sub.getId())
|
||||||
|
.eq(ExecuteOrder::getDelFlag, 1).last("LIMIT 1"));
|
||||||
|
if (ObjectUtil.isNotNull(subExec)) {
|
||||||
|
throw new ServiceException("子单【" + sub.getGoodsNumber() + "】已生成执行单,无法反审核主单");
|
||||||
|
}
|
||||||
|
subIdStrs.add(String.valueOf(sub.getId()));
|
||||||
|
// 逻辑删除子单(与 delete() 方法一致:delFlag 2)
|
||||||
|
sub.setDelFlag(2);
|
||||||
|
businessDocumentOrderMapper.updateById(sub);
|
||||||
|
}
|
||||||
|
// 逻辑删除子单的地址(审核时按 orderId=子单id 生成)
|
||||||
|
businessDocumentAddressMultiMapper.update(null,
|
||||||
|
new LambdaUpdateWrapper<BusinessDocumentAddressMulti>()
|
||||||
|
.in(BusinessDocumentAddressMulti::getOrderId, subIdStrs)
|
||||||
|
.set(BusinessDocumentAddressMulti::getDelFlag, 2));
|
||||||
|
// 清空审核时回填到 business_delivery_details_link.sub_order_id 的子单id
|
||||||
|
businessDeliveryDetailsLinkMapper.update(null,
|
||||||
|
new LambdaUpdateWrapper<BusinessDeliveryDetailsLink>()
|
||||||
|
.eq(BusinessDeliveryDetailsLink::getOrderId, id)
|
||||||
|
.isNotNull(BusinessDeliveryDetailsLink::getSubOrderId)
|
||||||
|
.set(BusinessDeliveryDetailsLink::getSubOrderId, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 状态复位 + 清空审核信息(用 UpdateWrapper.set 确保 null 能写入;updateById 默认不更新 null)
|
||||||
|
LambdaUpdateWrapper<BusinessDocumentOrder> updateWrapper = new LambdaUpdateWrapper<BusinessDocumentOrder>()
|
||||||
|
.eq(BusinessDocumentOrder::getId, id)
|
||||||
|
.set(BusinessDocumentOrder::getReviewStatus, 0L) // 未审核
|
||||||
|
.set(BusinessDocumentOrder::getOrderStatus, 0L) // 待审核
|
||||||
|
.set(BusinessDocumentOrder::getExecuteStatus, 0L) // 无状态
|
||||||
|
.set(BusinessDocumentOrder::getReviewId, null)
|
||||||
|
.set(BusinessDocumentOrder::getReview, null)
|
||||||
|
.set(BusinessDocumentOrder::getReviewTime, null)
|
||||||
|
.set(BusinessDocumentOrder::getReviewOpinion, null)
|
||||||
|
.set(BusinessDocumentOrder::getSalesManager, null);
|
||||||
|
if (isMain) {
|
||||||
|
updateWrapper.set(BusinessDocumentOrder::getDeliveryProgress, null); // 清空主单拆单数
|
||||||
|
}
|
||||||
|
businessDocumentOrderMapper.update(null, updateWrapper);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean execute(List<Long> ids) {
|
public Boolean execute(List<Long> ids) {
|
||||||
|
|||||||
+18
-66
@@ -102,6 +102,9 @@ public class BusinessDocumentOrderDomainService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserServiceFeign userServiceFeign;
|
private UserServiceFeign userServiceFeign;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GoodsNumberGenerator goodsNumberGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询【请填写功能名称】列表
|
* 分页查询【请填写功能名称】列表
|
||||||
*/
|
*/
|
||||||
@@ -109,26 +112,6 @@ public class BusinessDocumentOrderDomainService {
|
|||||||
return businessDocumentOrderService.queryList(businessDocumentOrderDO);
|
return businessDocumentOrderService.queryList(businessDocumentOrderDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getOrderCodeByDate(Date date){
|
|
||||||
return new StringBuffer()
|
|
||||||
.append(getSecondPartByDate(date))
|
|
||||||
.append(getThreePart())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
private static String getSecondPartByDate(Date date) {
|
|
||||||
if (date == null) {
|
|
||||||
date = new Date();
|
|
||||||
}
|
|
||||||
String temp_current_time = DateUtil.format(date, datePattern());
|
|
||||||
return temp_current_time.substring(2, temp_current_time.length());
|
|
||||||
}
|
|
||||||
private static String datePattern() {
|
|
||||||
return "yyyyMMddHHmmss";
|
|
||||||
}
|
|
||||||
private static String getThreePart() {
|
|
||||||
return RandomUtil.randomNumbers(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增【请填写功能名称】
|
* 新增【请填写功能名称】
|
||||||
*/
|
*/
|
||||||
@@ -302,30 +285,8 @@ public class BusinessDocumentOrderDomainService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//生成货源单号
|
//生成货源单号(yyMMdd + 当日顺序号,每日重置)
|
||||||
|
String orderCode = goodsNumberGenerator.generateUniqueGoodsNumber(tmsOrder.getDocumentDate());
|
||||||
String orderCode = null;
|
|
||||||
int maxRetryCount = 100;
|
|
||||||
int retryCount = 0;
|
|
||||||
|
|
||||||
while (retryCount < maxRetryCount) {
|
|
||||||
orderCode = getOrderCodeByDate(tmsOrder.getDocumentDate());
|
|
||||||
retryCount++;
|
|
||||||
|
|
||||||
List<BusinessDocumentOrder> checkOrderCodes = businessDocumentOrderMapper.selectList(
|
|
||||||
new QueryWrapper<BusinessDocumentOrder>().eq("goods_number", orderCode)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(checkOrderCodes)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (retryCount >= maxRetryCount) {
|
|
||||||
throw new ServiceException("生成唯一订单编号失败,已达到最大重试次数:" + maxRetryCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//生成货源单号
|
|
||||||
tmsOrder.setGoodsNumber(orderCode);
|
tmsOrder.setGoodsNumber(orderCode);
|
||||||
|
|
||||||
ReservationStockOutOrder reservationStockOutOrder = reservationStockOutOrderMapper.selectOne(new LambdaQueryWrapper<ReservationStockOutOrder>()
|
ReservationStockOutOrder reservationStockOutOrder = reservationStockOutOrderMapper.selectOne(new LambdaQueryWrapper<ReservationStockOutOrder>()
|
||||||
@@ -513,6 +474,8 @@ public class BusinessDocumentOrderDomainService {
|
|||||||
tmsOrderAccount.setOrderId(String.valueOf(tmsOrder.getId()));
|
tmsOrderAccount.setOrderId(String.valueOf(tmsOrder.getId()));
|
||||||
tmsOrderAccount.setCreateBy(String.valueOf(u.getUserid()));
|
tmsOrderAccount.setCreateBy(String.valueOf(u.getUserid()));
|
||||||
tmsOrderAccount.setCreateTime(new Date());
|
tmsOrderAccount.setCreateTime(new Date());
|
||||||
|
// 复制新增时科目行会带原订单的id,避免报错
|
||||||
|
tmsOrderAccount.setId(null);
|
||||||
// 设置组织信息
|
// 设置组织信息
|
||||||
if (businessDocumentOrderDO.getOrganizationId() != null) {
|
if (businessDocumentOrderDO.getOrganizationId() != null) {
|
||||||
tmsOrderAccount.setOrganizationId(businessDocumentOrderDO.getOrganizationId());
|
tmsOrderAccount.setOrganizationId(businessDocumentOrderDO.getOrganizationId());
|
||||||
@@ -774,28 +737,8 @@ public class BusinessDocumentOrderDomainService {
|
|||||||
// boolean istrue=businessDocumentOrderService.update(businessDocumentOrderDO);
|
// boolean istrue=businessDocumentOrderService.update(businessDocumentOrderDO);
|
||||||
|
|
||||||
|
|
||||||
String orderCode = null;
|
//生成货源单号(yyMMdd + 当日顺序号,每日重置) 原更新操作会将 电脑更细为当日的日期。默认和之前的逻辑一样保持不变
|
||||||
int maxRetryCount = 100;
|
String orderCode = goodsNumberGenerator.generateUniqueGoodsNumber(tmsOrder.getDocumentDate());
|
||||||
int retryCount = 0;
|
|
||||||
|
|
||||||
while (retryCount < maxRetryCount) {
|
|
||||||
orderCode = getOrderCodeByDate(tmsOrder.getDocumentDate());
|
|
||||||
retryCount++;
|
|
||||||
|
|
||||||
List<BusinessDocumentOrder> checkOrderCodes = businessDocumentOrderMapper.selectList(
|
|
||||||
new QueryWrapper<BusinessDocumentOrder>().eq("goods_number", orderCode)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(checkOrderCodes)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (retryCount >= maxRetryCount) {
|
|
||||||
throw new ServiceException("生成唯一订单编号失败,已达到最大重试次数:" + maxRetryCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//生成货源单号
|
|
||||||
tmsOrder.setGoodsNumber(orderCode);
|
tmsOrder.setGoodsNumber(orderCode);
|
||||||
|
|
||||||
ReservationStockOutOrder reservationStockOutOrder = reservationStockOutOrderMapper.selectOne(new LambdaQueryWrapper<ReservationStockOutOrder>()
|
ReservationStockOutOrder reservationStockOutOrder = reservationStockOutOrderMapper.selectOne(new LambdaQueryWrapper<ReservationStockOutOrder>()
|
||||||
@@ -989,6 +932,15 @@ public class BusinessDocumentOrderDomainService {
|
|||||||
|
|
||||||
return businessDocumentOrderService.audit(businessAuditDTO.getIds(),businessAuditDTO.getReviewStatus(),businessAuditDTO.getSalesManager(),businessAuditDTO.getReviewOpinion());
|
return businessDocumentOrderService.audit(businessAuditDTO.getIds(),businessAuditDTO.getReviewStatus(),businessAuditDTO.getSalesManager(),businessAuditDTO.getReviewOpinion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务单反审核
|
||||||
|
*/
|
||||||
|
public Boolean cancelAudit(BusinessAuditDTO businessAuditDTO)
|
||||||
|
{
|
||||||
|
return businessDocumentOrderService.cancelAudit(businessAuditDTO.getIds());
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean execute(List<Long> ids) {
|
public Boolean execute(List<Long> ids) {
|
||||||
return businessDocumentOrderService.execute(ids);
|
return businessDocumentOrderService.execute(ids);
|
||||||
}
|
}
|
||||||
|
|||||||
+53
@@ -0,0 +1,53 @@
|
|||||||
|
package com.mhd.oms.domain.businessDocumentOrder.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.mhd.common.core.exception.ServiceException;
|
||||||
|
import com.mhd.oms.domain.businessDocumentOrder.entity.BusinessDocumentOrder;
|
||||||
|
import com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocumentOrderMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务单据订单(goodsNumber)单号生成器
|
||||||
|
* 规则: yyMMdd(取自单据日期) + 当日顺序号(每日重置, 3位起步, 超999自动扩位)
|
||||||
|
* 示例: 260804001、260804999、2608041000
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class GoodsNumberGenerator {
|
||||||
|
|
||||||
|
private static final int MAX_RETRY = 100;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BusinessDocumentOrderMapper businessDocumentOrderMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成唯一业务单号
|
||||||
|
* @param documentDate 单据日期(为空取当前日期)
|
||||||
|
*/
|
||||||
|
public String generateUniqueGoodsNumber(Date documentDate) {
|
||||||
|
Date date = (documentDate == null) ? new Date() : documentDate;
|
||||||
|
String datePart = DateUtil.format(date, "yyMMdd");
|
||||||
|
|
||||||
|
// count 只查一次作为序号基线
|
||||||
|
long seq = (long) businessDocumentOrderMapper.countByGoodsNumberPrefix(datePart) + 1;
|
||||||
|
int retryCount = 0;
|
||||||
|
while (retryCount < MAX_RETRY) {
|
||||||
|
String orderCode = datePart + String.format("%03d", seq);
|
||||||
|
retryCount++;
|
||||||
|
|
||||||
|
List<BusinessDocumentOrder> exist = businessDocumentOrderMapper.selectList(
|
||||||
|
new QueryWrapper<BusinessDocumentOrder>().eq("goods_number", orderCode)
|
||||||
|
);
|
||||||
|
if (CollectionUtils.isEmpty(exist)) {
|
||||||
|
return orderCode;
|
||||||
|
}
|
||||||
|
seq++; // ← 关键:查重失败,序号往后递增找空位,而不是重新count
|
||||||
|
}
|
||||||
|
throw new ServiceException("生成唯一业务单号失败,已达到最大重试次数:" + MAX_RETRY);
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
@@ -495,4 +495,12 @@ public class ExecutionInMaterialDetailPO extends ExecutionStockInOrderBasePO {
|
|||||||
//申报总价
|
//申报总价
|
||||||
private BigDecimal amountGw;
|
private BigDecimal amountGw;
|
||||||
private String khdm;
|
private String khdm;
|
||||||
|
|
||||||
|
@ApiModelProperty("保额")
|
||||||
|
@Excel(name = "保额")
|
||||||
|
private BigDecimal insureAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty("货物类型:0-物料 1-半成品 2-成品")
|
||||||
|
@Excel(name = "货物类型")
|
||||||
|
private Integer goodsType;
|
||||||
}
|
}
|
||||||
+5
@@ -3,6 +3,8 @@ package com.mhd.oms.domain.executionInMaterialDetail.repository.po;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库明细查询结果(关联入库执行单)
|
* 入库明细查询结果(关联入库执行单)
|
||||||
*
|
*
|
||||||
@@ -27,4 +29,7 @@ public class ExecutionInMaterialDetailWithOrderPO extends ExecutionInMaterialDet
|
|||||||
|
|
||||||
@ApiModelProperty("货主名称")
|
@ApiModelProperty("货主名称")
|
||||||
private String orderShipperName;
|
private String orderShipperName;
|
||||||
|
|
||||||
|
@ApiModelProperty("入库日期")
|
||||||
|
private Date warehouseDate;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -163,6 +163,13 @@ public class ReservationStockInOrderPO extends BaseVOEntity {
|
|||||||
@Excel(name = "入库数量")
|
@Excel(name = "入库数量")
|
||||||
private BigDecimal inQuantity;
|
private BigDecimal inQuantity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申报数量:入库单明细中申报数量(DECLARED_QUANTITY)汇总
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("申报数量")
|
||||||
|
@Excel(name = "申报数量")
|
||||||
|
private BigDecimal declaredQuantity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计划入库数量:取入库单明细中的入库数量汇总
|
* 计划入库数量:取入库单明细中的入库数量汇总
|
||||||
*/
|
*/
|
||||||
|
|||||||
+7
-7
@@ -136,13 +136,13 @@ public class ReservationStockInOrderApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 前端有传warehouseId则优先使用传参;未传时才使用"用户关联仓库"作为默认值
|
// 前端有传warehouseId则优先使用传参;未传时才使用"用户关联仓库"作为默认值
|
||||||
if (stockInOrderDO.getWarehouseId() == null) {
|
// if (stockInOrderDO.getWarehouseId() == null) {
|
||||||
AssociationWarehouseCacheDO associationWarehouseCacheDO =
|
// AssociationWarehouseCacheDO associationWarehouseCacheDO =
|
||||||
SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
// SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||||
if (associationWarehouseCacheDO != null) {
|
// if (associationWarehouseCacheDO != null) {
|
||||||
stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
// stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 库管角色过滤:不展示已创建(status=1)的入库单
|
// 库管角色过滤:不展示已创建(status=1)的入库单
|
||||||
|
|||||||
+90
-85
@@ -147,44 +147,44 @@ public class ReservationStockInOrderDomainService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean insert(ReservationStockInOrderDO stockInOrderDO) {
|
public Boolean insert(ReservationStockInOrderDO stockInOrderDO) {
|
||||||
// if (stockInOrderDO.getInOrderNumber() == null) {
|
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||||
|
|
||||||
//设置入库单号
|
//设置入库单号
|
||||||
Long warehouseId = stockInOrderDO.getWarehouseId();
|
// Long warehouseId = stockInOrderDO.getWarehouseId();
|
||||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
// AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
// if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||||
throw new ServiceException("获取仓库信息失败");
|
// throw new ServiceException("获取仓库信息失败");
|
||||||
}
|
// }
|
||||||
//仓库信息
|
// //仓库信息
|
||||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
// WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
// String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||||
String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
// String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||||
if (prefix == null || prefix.isEmpty()) {
|
// if (prefix == null || prefix.isEmpty()) {
|
||||||
prefix = "RK";
|
// prefix = "RK";
|
||||||
}
|
// }
|
||||||
Long organizationId = stockInOrderDO.getOrganizationId();
|
// Long organizationId = stockInOrderDO.getOrganizationId();
|
||||||
Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
// Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
||||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
// if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
// //日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
// String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||||
String datePrefix = prefix + dateStr;
|
// String datePrefix = prefix + dateStr;
|
||||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
// List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
// int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
// String seq = String.format("%03d", maxSeq + 1);
|
||||||
stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
// stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
||||||
stockInOrderDO.setBusinessOrderNo(datePrefix + seq);
|
// stockInOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||||
} else {
|
// } else {
|
||||||
//历史累加: 前缀 + 历史最大序号+1
|
// //历史累加: 前缀 + 历史最大序号+1
|
||||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
// List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
// int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
// String seq = String.format("%03d", maxSeq + 1);
|
||||||
stockInOrderDO.setInOrderNumber(prefix + seq);
|
// stockInOrderDO.setInOrderNumber(prefix + seq);
|
||||||
stockInOrderDO.setBusinessOrderNo(prefix + seq);
|
// stockInOrderDO.setBusinessOrderNo(prefix + seq);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
||||||
// stockInOrderDO.setBusinessOrderNo(stockInOrderDO.getInOrderNumber());
|
stockInOrderDO.setBusinessOrderNo(stockInOrderDO.getInOrderNumber());
|
||||||
// }
|
}
|
||||||
// //设置默认值
|
// //设置默认值
|
||||||
// setDefaultValues(stockInOrderDO);
|
// setDefaultValues(stockInOrderDO);
|
||||||
// //设置物料信息
|
// //设置物料信息
|
||||||
@@ -213,37 +213,9 @@ public class ReservationStockInOrderDomainService {
|
|||||||
public Boolean batchInsert(List<ReservationStockInOrderDO> stockInOrderDOList) {
|
public Boolean batchInsert(List<ReservationStockInOrderDO> stockInOrderDOList) {
|
||||||
for (ReservationStockInOrderDO stockInOrderDO : stockInOrderDOList){
|
for (ReservationStockInOrderDO stockInOrderDO : stockInOrderDOList){
|
||||||
|
|
||||||
//设置入库单号
|
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||||
Long warehouseId = stockInOrderDO.getWarehouseId();
|
stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
||||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
stockInOrderDO.setBusinessOrderNo(stockInOrderDO.getInOrderNumber());
|
||||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
|
||||||
throw new ServiceException("获取仓库信息失败");
|
|
||||||
}
|
|
||||||
//仓库信息
|
|
||||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
|
||||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
|
||||||
String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
|
||||||
if (prefix == null || prefix.isEmpty()) {
|
|
||||||
prefix = "RK";
|
|
||||||
}
|
|
||||||
Long organizationId = stockInOrderDO.getOrganizationId();
|
|
||||||
Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
|
||||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
|
||||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
|
||||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
|
||||||
String datePrefix = prefix + dateStr;
|
|
||||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
|
||||||
stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
|
||||||
stockInOrderDO.setBusinessOrderNo(datePrefix + seq);
|
|
||||||
} else {
|
|
||||||
//历史累加: 前缀 + 历史最大序号+1
|
|
||||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
|
||||||
stockInOrderDO.setInOrderNumber(prefix + seq);
|
|
||||||
stockInOrderDO.setBusinessOrderNo(prefix + seq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// //设置物料信息
|
// //设置物料信息
|
||||||
@@ -581,6 +553,31 @@ public class ReservationStockInOrderDomainService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean issueOrder(ReservationStockInOrderDO stockInOrderDO) {
|
public Boolean issueOrder(ReservationStockInOrderDO stockInOrderDO) {
|
||||||
|
|
||||||
|
// ===== 新增校验 =====
|
||||||
|
List<Long> inOrderIds = stockInOrderDO.getInOrderIds();
|
||||||
|
if (inOrderIds == null || inOrderIds.isEmpty()) {
|
||||||
|
throw new ServiceException("下发失败:未选择单据");
|
||||||
|
}
|
||||||
|
List<ReservationStockInOrder> checkOrders = stockInOrderService.list(
|
||||||
|
new QueryWrapper<ReservationStockInOrder>().lambda()
|
||||||
|
.in(ReservationStockInOrder::getInOrderId, inOrderIds));
|
||||||
|
for (ReservationStockInOrder order : checkOrders) {
|
||||||
|
// 校验1:必须已审核(issueStatus==2 表示审核成功)
|
||||||
|
if (order.getIssueStatus() == null || order.getIssueStatus() != 2) {
|
||||||
|
throw new ServiceException("下发失败:单据[" + order.getInOrderNumber() + "]未审核,无法下发");
|
||||||
|
}
|
||||||
|
// 校验2:防止重复下发(issueTime 有值表示已下发过)
|
||||||
|
if (order.getIssueTime() != null) {
|
||||||
|
throw new ServiceException("下发失败:单据[" + order.getInOrderNumber() + "]已下发,不可重复下发");
|
||||||
|
}
|
||||||
|
// 校验3:WMS 必填字段(warehouseId 不能为空)
|
||||||
|
if (order.getWarehouseId() == null) {
|
||||||
|
throw new ServiceException("下发失败:单据[" + order.getInOrderNumber() + "]缺少入库仓库,无法下发");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ===== 校验结束 =====
|
||||||
|
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
|
||||||
// 获取用户姓名(优先从UserPo获取,如果为空则使用realname,最后使用username作为兜底)
|
// 获取用户姓名(优先从UserPo获取,如果为空则使用realname,最后使用username作为兜底)
|
||||||
@@ -598,26 +595,34 @@ public class ReservationStockInOrderDomainService {
|
|||||||
.in(ReservationStockInOrder::getInOrderId, stockInOrderDO.getInOrderIds()));
|
.in(ReservationStockInOrder::getInOrderId, stockInOrderDO.getInOrderIds()));
|
||||||
|
|
||||||
//todo下发推送到wms
|
//todo下发推送到wms
|
||||||
// List<Long> inOrderIds = stockInOrderDO.getInOrderIds();
|
for (Long inOrderId : inOrderIds) {
|
||||||
// for (Long inOrderId : inOrderIds) {
|
ReservationStockInOrder byId = stockInOrderService.getById(inOrderId);
|
||||||
// ReservationStockInOrder byId = stockInOrderService.getById(inOrderId);
|
StockInOrder stockInOrder = new StockInOrder();
|
||||||
// StockInOrder stockInOrder = new StockInOrder();
|
BeanUtils.copyProperties(byId, stockInOrder, "inOrderId");
|
||||||
// BeanUtils.copyProperties(byId, stockInOrder,"inOrderId");
|
stockInOrder.setOmsStockInOrderId(String.valueOf(byId.getInOrderId()));
|
||||||
// stockInOrder.setOmsStockInOrderId(String.valueOf(byId.getInOrderId()));
|
|
||||||
// wmsServiceFeign.omsInOrderAdd(stockInOrder);
|
try {
|
||||||
// String inOrderNumber = stockInOrder.getInOrderNumber();
|
wmsServiceFeign.omsInOrderAdd(stockInOrder); // 推主单
|
||||||
// List<ReservationInMaterialDetail> materialDetailList = materialDetailService.list(new QueryWrapper<ReservationInMaterialDetail>().lambda().eq(ReservationInMaterialDetail::getInOrderNumber, inOrderNumber));
|
|
||||||
// List<InMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
String inOrderNumber = stockInOrder.getInOrderNumber();
|
||||||
// for (ReservationInMaterialDetail reservationInMaterialDetail : materialDetailList) {
|
List<ReservationInMaterialDetail> materialDetailList = materialDetailService.list(
|
||||||
// InMaterialDetail inMaterialDetail = new InMaterialDetail();
|
new QueryWrapper<ReservationInMaterialDetail>().lambda()
|
||||||
// BeanUtils.copyProperties(reservationInMaterialDetail, inMaterialDetail,"materialDetailId");
|
.eq(ReservationInMaterialDetail::getInOrderNumber, inOrderNumber));
|
||||||
// inMaterialDetail.setOmsInMaterialDetail(String.valueOf(reservationInMaterialDetail.getMaterialDetailId()));
|
List<InMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
||||||
// inMaterialDetailList.add(inMaterialDetail);
|
for (ReservationInMaterialDetail reservationInMaterialDetail : materialDetailList) {
|
||||||
// }
|
InMaterialDetail inMaterialDetail = new InMaterialDetail();
|
||||||
// wmsServiceFeign.omsInOrderAddDetail(inMaterialDetailList);
|
BeanUtils.copyProperties(reservationInMaterialDetail, inMaterialDetail, "materialDetailId");
|
||||||
// }
|
inMaterialDetail.setOmsInMaterialDetail(String.valueOf(reservationInMaterialDetail.getMaterialDetailId()));
|
||||||
|
inMaterialDetailList.add(inMaterialDetail);
|
||||||
|
}
|
||||||
|
wmsServiceFeign.omsInOrderAddDetail(inMaterialDetailList); // 推明细(会触发WMS自动审核)
|
||||||
|
log.info("下发到WMS成功,单据号:{}", byId.getInOrderNumber());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("下发到WMS失败,单据号:{}", byId.getInOrderNumber(), e);
|
||||||
|
throw new ServiceException("下发到WMS失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
//todo下发推送到入库业务单
|
//todo下发推送到入库业务单
|
||||||
List<Long> inOrderIds = stockInOrderDO.getInOrderIds();
|
|
||||||
for (Long inOrderId : inOrderIds) {
|
for (Long inOrderId : inOrderIds) {
|
||||||
// Long inOrderId = stockInOrderDO.getInOrderId();
|
// Long inOrderId = stockInOrderDO.getInOrderId();
|
||||||
ReservationStockInOrder byId = stockInOrderService.getById(inOrderId);
|
ReservationStockInOrder byId = stockInOrderService.getById(inOrderId);
|
||||||
|
|||||||
+41
-69
@@ -157,42 +157,45 @@ public class ReservationStockOutOrderDomainService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean insert(ReservationStockOutOrderDO stockOutOrderDO) {
|
public Boolean insert(ReservationStockOutOrderDO stockOutOrderDO) {
|
||||||
|
if (stockOutOrderDO.getOutOrderNumber() == null) {
|
||||||
|
stockOutOrderDO.setOutOrderNumber(generateReserveOrderNumber());
|
||||||
|
stockOutOrderDO.setBusinessOrderNo(stockOutOrderDO.getOutOrderNumber());
|
||||||
|
}
|
||||||
//设置单号
|
//设置单号
|
||||||
Long warehouseId = stockOutOrderDO.getWarehouseId();
|
// Long warehouseId = stockOutOrderDO.getWarehouseId();
|
||||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
// AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
// if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||||
throw new ServiceException("获取仓库信息失败");
|
// throw new ServiceException("获取仓库信息失败");
|
||||||
}
|
// }
|
||||||
//仓库信息
|
// //仓库信息
|
||||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
// WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
// String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||||
String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
// String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
||||||
if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
// if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
||||||
prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
// prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
||||||
}
|
// }
|
||||||
if (prefix == null || prefix.isEmpty()) {
|
// if (prefix == null || prefix.isEmpty()) {
|
||||||
prefix = "CK";
|
// prefix = "CK";
|
||||||
}
|
// }
|
||||||
Long organizationId = stockOutOrderDO.getOrganizationId();
|
// Long organizationId = stockOutOrderDO.getOrganizationId();
|
||||||
Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
// Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
||||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
// if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
// //日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
// String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||||
String datePrefix = prefix + dateStr;
|
// String datePrefix = prefix + dateStr;
|
||||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
// List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
// int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
// String seq = String.format("%03d", maxSeq + 1);
|
||||||
stockOutOrderDO.setOutOrderNumber(datePrefix + seq);
|
// stockOutOrderDO.setOutOrderNumber(datePrefix + seq);
|
||||||
stockOutOrderDO.setBusinessOrderNo(datePrefix + seq);
|
// stockOutOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||||
} else {
|
// } else {
|
||||||
//历史累加: 前缀 + 历史最大序号+1
|
// //历史累加: 前缀 + 历史最大序号+1
|
||||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
// List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
// int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
// String seq = String.format("%03d", maxSeq + 1);
|
||||||
stockOutOrderDO.setOutOrderNumber(prefix + seq);
|
// stockOutOrderDO.setOutOrderNumber(prefix + seq);
|
||||||
stockOutOrderDO.setBusinessOrderNo(prefix + seq);
|
// stockOutOrderDO.setBusinessOrderNo(prefix + seq);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 与 update / batchInsert 一致:前端传计划数量为 quantity,非 outboundQuantity
|
// 与 update / batchInsert 一致:前端传计划数量为 quantity,非 outboundQuantity
|
||||||
setMaterialDetailInfo(stockOutOrderDO);
|
setMaterialDetailInfo(stockOutOrderDO);
|
||||||
@@ -235,40 +238,9 @@ public class ReservationStockOutOrderDomainService {
|
|||||||
for (ReservationStockOutOrderDO stockOutOrderDO : stockOutOrderDOList){
|
for (ReservationStockOutOrderDO stockOutOrderDO : stockOutOrderDOList){
|
||||||
|
|
||||||
|
|
||||||
//设置单号
|
if (stockOutOrderDO.getOutOrderNumber() == null) {
|
||||||
Long warehouseId = stockOutOrderDO.getWarehouseId();
|
stockOutOrderDO.setOutOrderNumber(generateReserveOrderNumber());
|
||||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
stockOutOrderDO.setBusinessOrderNo(stockOutOrderDO.getOutOrderNumber());
|
||||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
|
||||||
throw new ServiceException("获取仓库信息失败");
|
|
||||||
}
|
|
||||||
//仓库信息
|
|
||||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
|
||||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
|
||||||
String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
|
||||||
if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
|
||||||
prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
|
||||||
}
|
|
||||||
if (prefix == null || prefix.isEmpty()) {
|
|
||||||
prefix = "CK";
|
|
||||||
}
|
|
||||||
Long organizationId = stockOutOrderDO.getOrganizationId();
|
|
||||||
Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
|
||||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
|
||||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
|
||||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
|
||||||
String datePrefix = prefix + dateStr;
|
|
||||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
|
||||||
stockOutOrderDO.setOutOrderNumber(datePrefix + seq);
|
|
||||||
stockOutOrderDO.setBusinessOrderNo(datePrefix + seq);
|
|
||||||
} else {
|
|
||||||
//历史累加: 前缀 + 历史最大序号+1
|
|
||||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
|
||||||
stockOutOrderDO.setOutOrderNumber(prefix + seq);
|
|
||||||
stockOutOrderDO.setBusinessOrderNo(prefix + seq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置物料信息
|
//设置物料信息
|
||||||
|
|||||||
+7
@@ -1,5 +1,6 @@
|
|||||||
package com.mhd.oms.domain.reserveStockInOrder.repository.vo;
|
package com.mhd.oms.domain.reserveStockInOrder.repository.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||||
import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToBigDecimalConverter;
|
import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToBigDecimalConverter;
|
||||||
@@ -68,4 +69,10 @@ public class ReservedInventory {
|
|||||||
* 验证结果(导入后自动填充,不映射Excel)
|
* 验证结果(导入后自动填充,不映射Excel)
|
||||||
*/
|
*/
|
||||||
private String validationResult;
|
private String validationResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WMS物料id(解析预览接口根据货物名称匹配后自动填充,匹配不到为空,不映射Excel)
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
private Long materialBaseInfoId;
|
||||||
}
|
}
|
||||||
+29
@@ -1972,6 +1972,35 @@ public class ReserveStockInOrderApplicationService {
|
|||||||
return stockInOrderDomainService.queryNoticePrintDetail(stockInOrderDO);
|
return stockInOrderDomainService.queryNoticePrintDetail(stockInOrderDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel解析预览:根据货物名称匹配WMS对应物料并填充物料id,
|
||||||
|
* 匹配不到物料id保持为空,不阻断解析
|
||||||
|
*/
|
||||||
|
public void fillMaterialBaseInfoId(List<ReservedInventory> dataList) {
|
||||||
|
if (dataList == null || dataList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 物料名称匹配结果缓存,避免同名重复查库
|
||||||
|
Map<String, MaterialBaseInfoPO> materialCache = new HashMap<>();
|
||||||
|
for (ReservedInventory reservedInventory : dataList) {
|
||||||
|
String goodsName = reservedInventory.getGoodsName();
|
||||||
|
if (StringUtils.isBlank(goodsName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
MaterialBaseInfoPO materialBaseInfoPO = materialCache.get(goodsName);
|
||||||
|
if (materialBaseInfoPO == null && !materialCache.containsKey(goodsName)) {
|
||||||
|
List<MaterialBaseInfoPO> materialBaseInfoPOS = reserveStockInOrderMapper.getByName(goodsName);
|
||||||
|
if (materialBaseInfoPOS != null && !materialBaseInfoPOS.isEmpty()) {
|
||||||
|
materialBaseInfoPO = materialBaseInfoPOS.get(0);
|
||||||
|
}
|
||||||
|
materialCache.put(goodsName, materialBaseInfoPO);
|
||||||
|
}
|
||||||
|
if (materialBaseInfoPO != null) {
|
||||||
|
reservedInventory.setMaterialBaseInfoId(materialBaseInfoPO.getMaterialBaseInfoId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void importInData(List<ReservedInventory> dataList) {
|
public void importInData(List<ReservedInventory> dataList) {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
ReserveStockInOrderDO reserveStockInOrder = new ReserveStockInOrderDO();
|
ReserveStockInOrderDO reserveStockInOrder = new ReserveStockInOrderDO();
|
||||||
|
|||||||
+67
-62
@@ -103,39 +103,40 @@ public class ReserveStockInOrderDomainService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean insert(ReserveStockInOrderDO stockInOrderDO) {
|
public Boolean insert(ReserveStockInOrderDO stockInOrderDO) {
|
||||||
// if (stockInOrderDO.getInOrderNumber() == null) {
|
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||||
Long warehouseId = stockInOrderDO.getWarehouseId();
|
stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
||||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
// Long warehouseId = stockInOrderDO.getWarehouseId();
|
||||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
// AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||||
throw new ServiceException("获取仓库信息失败");
|
// if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||||
}
|
// throw new ServiceException("获取仓库信息失败");
|
||||||
//仓库信息
|
|
||||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
|
||||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
|
||||||
String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
|
||||||
if (prefix == null || prefix.isEmpty()) {
|
|
||||||
prefix = "RK";
|
|
||||||
}
|
|
||||||
Long organizationId = stockInOrderDO.getOrganizationId();
|
|
||||||
Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
|
||||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
|
||||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
|
||||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
|
||||||
String datePrefix = prefix + dateStr;
|
|
||||||
List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
|
||||||
stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
|
||||||
stockInOrderDO.setBusinessOrderNo(datePrefix + seq);
|
|
||||||
} else {
|
|
||||||
//历史累加: 前缀 + 历史最大序号+1
|
|
||||||
List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
|
||||||
stockInOrderDO.setInOrderNumber(prefix + seq);
|
|
||||||
stockInOrderDO.setBusinessOrderNo(prefix + seq);
|
|
||||||
}
|
|
||||||
// }
|
// }
|
||||||
|
// //仓库信息
|
||||||
|
// WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||||
|
// String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||||
|
// String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||||
|
// if (prefix == null || prefix.isEmpty()) {
|
||||||
|
// prefix = "RK";
|
||||||
|
// }
|
||||||
|
// Long organizationId = stockInOrderDO.getOrganizationId();
|
||||||
|
// Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
||||||
|
// if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||||
|
// //日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||||
|
// String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||||
|
// String datePrefix = prefix + dateStr;
|
||||||
|
// List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||||
|
// int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||||
|
// String seq = String.format("%03d", maxSeq + 1);
|
||||||
|
// stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
||||||
|
// stockInOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||||
|
// } else {
|
||||||
|
// //历史累加: 前缀 + 历史最大序号+1
|
||||||
|
// List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||||
|
// int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||||
|
// String seq = String.format("%03d", maxSeq + 1);
|
||||||
|
// stockInOrderDO.setInOrderNumber(prefix + seq);
|
||||||
|
// stockInOrderDO.setBusinessOrderNo(prefix + seq);
|
||||||
|
// }
|
||||||
|
}
|
||||||
// //设置默认值
|
// //设置默认值
|
||||||
// setDefaultValues(stockInOrderDO);
|
// setDefaultValues(stockInOrderDO);
|
||||||
// //设置物料信息
|
// //设置物料信息
|
||||||
@@ -166,37 +167,41 @@ public class ReserveStockInOrderDomainService {
|
|||||||
*/
|
*/
|
||||||
public Boolean batchInsert(List<ReserveStockInOrderDO> stockInOrderDOList) {
|
public Boolean batchInsert(List<ReserveStockInOrderDO> stockInOrderDOList) {
|
||||||
for (ReserveStockInOrderDO stockInOrderDO : stockInOrderDOList){
|
for (ReserveStockInOrderDO stockInOrderDO : stockInOrderDOList){
|
||||||
Long warehouseId = stockInOrderDO.getWarehouseId();
|
String inOrderNumber = stockInOrderDO.getInOrderNumber();
|
||||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
if (stockInOrderDO.getInOrderNumber() == null){
|
||||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
||||||
throw new ServiceException("获取仓库信息失败");
|
|
||||||
}
|
|
||||||
//仓库信息
|
|
||||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
|
||||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
|
||||||
String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
|
||||||
if (prefix == null || prefix.isEmpty()) {
|
|
||||||
prefix = "RK";
|
|
||||||
}
|
|
||||||
Long organizationId = stockInOrderDO.getOrganizationId();
|
|
||||||
Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
|
||||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
|
||||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
|
||||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
|
||||||
String datePrefix = prefix + dateStr;
|
|
||||||
List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
|
||||||
stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
|
||||||
stockInOrderDO.setBusinessOrderNo(datePrefix + seq);
|
|
||||||
} else {
|
|
||||||
//历史累加: 前缀 + 历史最大序号+1
|
|
||||||
List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
|
||||||
stockInOrderDO.setInOrderNumber(prefix + seq);
|
|
||||||
stockInOrderDO.setBusinessOrderNo(prefix + seq);
|
|
||||||
}
|
}
|
||||||
|
// Long warehouseId = stockInOrderDO.getWarehouseId();
|
||||||
|
// AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||||
|
// if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||||
|
// throw new ServiceException("获取仓库信息失败");
|
||||||
|
// }
|
||||||
|
// //仓库信息
|
||||||
|
// WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||||
|
// String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||||
|
// String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||||
|
// if (prefix == null || prefix.isEmpty()) {
|
||||||
|
// prefix = "RK";
|
||||||
|
// }
|
||||||
|
// Long organizationId = stockInOrderDO.getOrganizationId();
|
||||||
|
// Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
||||||
|
// if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||||
|
// //日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||||
|
// String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||||
|
// String datePrefix = prefix + dateStr;
|
||||||
|
// List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||||
|
// int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||||
|
// String seq = String.format("%03d", maxSeq + 1);
|
||||||
|
// stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
||||||
|
// stockInOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||||
|
// } else {
|
||||||
|
// //历史累加: 前缀 + 历史最大序号+1
|
||||||
|
// List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||||
|
// int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||||
|
// String seq = String.format("%03d", maxSeq + 1);
|
||||||
|
// stockInOrderDO.setInOrderNumber(prefix + seq);
|
||||||
|
// stockInOrderDO.setBusinessOrderNo(prefix + seq);
|
||||||
|
// }
|
||||||
// //设置物料信息
|
// //设置物料信息
|
||||||
// setMaterialDetailInfo(stockInOrderDO);
|
// setMaterialDetailInfo(stockInOrderDO);
|
||||||
// //统计总物料种数
|
// //统计总物料种数
|
||||||
|
|||||||
+5
@@ -444,4 +444,9 @@ public class ReserveStockOutOrder extends BaseVOEntity {
|
|||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
private Date outboundTime;
|
private Date outboundTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("预约业务类型")
|
||||||
|
private String reserveBusinessType;
|
||||||
|
@ApiModelProperty("预约业务类型名称")
|
||||||
|
private String reserveBusinessTypeName;
|
||||||
|
|
||||||
}
|
}
|
||||||
+4
@@ -452,4 +452,8 @@ public class ReserveStockOutOrderPO extends BaseVOEntity {
|
|||||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
private Date outboundTime;
|
private Date outboundTime;
|
||||||
|
@ApiModelProperty("预约业务类型")
|
||||||
|
private String reserveBusinessType;
|
||||||
|
@ApiModelProperty("预约业务类型名称")
|
||||||
|
private String reserveBusinessTypeName;
|
||||||
}
|
}
|
||||||
+4
@@ -490,4 +490,8 @@ public class ReserveStockOutOrderDO extends BaseVOEntity {
|
|||||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
private Date outboundTime;
|
private Date outboundTime;
|
||||||
|
@ApiModelProperty("预约业务类型")
|
||||||
|
private String reserveBusinessType;
|
||||||
|
@ApiModelProperty("预约业务类型名称")
|
||||||
|
private String reserveBusinessTypeName;
|
||||||
}
|
}
|
||||||
+4
@@ -479,4 +479,8 @@ public class ReserveStockOutOrderDTO extends ReserveStockOutOrderBaseDTO {
|
|||||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
private Date outboundTime;
|
private Date outboundTime;
|
||||||
|
@ApiModelProperty("预约业务类型")
|
||||||
|
private String reserveBusinessType;
|
||||||
|
@ApiModelProperty("预约业务类型名称")
|
||||||
|
private String reserveBusinessTypeName;
|
||||||
}
|
}
|
||||||
+14
@@ -1,5 +1,6 @@
|
|||||||
package com.mhd.oms.domain.reserveStockOutOrder.repository.vo;
|
package com.mhd.oms.domain.reserveStockOutOrder.repository.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToBigDecimalConverter;
|
import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToBigDecimalConverter;
|
||||||
import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToDateConverter;
|
import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToDateConverter;
|
||||||
@@ -35,6 +36,19 @@ public class ReservedInventoryOut {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证结果(导入后自动填充,不映射Excel)
|
* 验证结果(导入后自动填充,不映射Excel)
|
||||||
|
* @ExcelIgnore:排除在Excel列映射之外,避免被自动分配列索引
|
||||||
*/
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
private String validationResult;
|
private String validationResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WMS库存id(解析预览接口根据货物名称查询可用库存后自动填充,不映射Excel)
|
||||||
|
* @ExcelIgnore:Long类型字段若被自动映射到非数字列,会抛出ExcelDataConvertException
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
private Long materialInventoryId;
|
||||||
|
|
||||||
|
|
||||||
|
@ExcelIgnore
|
||||||
|
private Long materialBaseInfoId;
|
||||||
}
|
}
|
||||||
+40
-3
@@ -841,7 +841,7 @@ public class ReserveStockOutOrderApplicationService {
|
|||||||
* @description 审核入库单
|
* @description 审核入库单
|
||||||
* @author ZhouGY
|
* @author ZhouGY
|
||||||
* @date 2024/5/21 13:53
|
* @date 2024/5/21 13:53
|
||||||
* @param stockInOrderDO
|
* @param stockOutOrderDO
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
public Boolean auditState(ReserveStockOutOrderDO stockOutOrderDO){
|
public Boolean auditState(ReserveStockOutOrderDO stockOutOrderDO){
|
||||||
@@ -852,7 +852,7 @@ public class ReserveStockOutOrderApplicationService {
|
|||||||
* @description 下发入库单
|
* @description 下发入库单
|
||||||
* @author ZhouGY
|
* @author ZhouGY
|
||||||
* @date 2024/5/21 13:53
|
* @date 2024/5/21 13:53
|
||||||
* @param stockInOrderDO
|
* @param stockOutOrderDO
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
public Boolean issueOrder(ReserveStockOutOrderDO stockOutOrderDO){
|
public Boolean issueOrder(ReserveStockOutOrderDO stockOutOrderDO){
|
||||||
@@ -862,7 +862,7 @@ public class ReserveStockOutOrderApplicationService {
|
|||||||
* @description 审核入库单
|
* @description 审核入库单
|
||||||
* @author ZhouGY
|
* @author ZhouGY
|
||||||
* @date 2024/5/21 13:53
|
* @date 2024/5/21 13:53
|
||||||
* @param stockInOrderDO
|
* @param stockOutOrderDO
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
public Boolean orderReject(ReserveStockOutOrderDO stockOutOrderDO){
|
public Boolean orderReject(ReserveStockOutOrderDO stockOutOrderDO){
|
||||||
@@ -1355,6 +1355,43 @@ public class ReserveStockOutOrderApplicationService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel解析预览:根据货物名称查询WMS对应物料的库存信息,
|
||||||
|
* 可用数量大于导入数据件数的填充库存id;
|
||||||
|
* 物料不存在、无库存或可用数量不足时库存id保持为空,不抛异常
|
||||||
|
*/
|
||||||
|
public void fillMaterialInventoryId(List<ReservedInventoryOut> dataList) {
|
||||||
|
if (CollectionUtils.isEmpty(dataList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (ReservedInventoryOut reservedInventory : dataList) {
|
||||||
|
String goodsName = reservedInventory.getGoodsName();
|
||||||
|
BigDecimal importQuantity = reservedInventory.getQuantity() == null ? BigDecimal.ZERO : reservedInventory.getQuantity();
|
||||||
|
// 根据货物名称查询对应物料,匹配不到则库存id为空
|
||||||
|
List<MaterialBaseInfoPO> materialBaseInfoPOS = reserveStockInOrderMapper.getByName(goodsName);
|
||||||
|
if (materialBaseInfoPOS == null || materialBaseInfoPOS.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Long materialBaseInfoId = materialBaseInfoPOS.get(0).getMaterialBaseInfoId();
|
||||||
|
// 根据物料id查询对应库存,无库存则库存id为空
|
||||||
|
List<ReservationMaterialInventory> reservationMaterialInventories = reservationMaterialInventoryMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<ReservationMaterialInventory>()
|
||||||
|
.eq(ReservationMaterialInventory::getMaterialBaseInfoId, materialBaseInfoId));
|
||||||
|
if (reservationMaterialInventories == null || reservationMaterialInventories.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 取可用数量大于导入数据件数的库存,填充库存id;都不满足则库存id为空
|
||||||
|
for (ReservationMaterialInventory inventory : reservationMaterialInventories) {
|
||||||
|
BigDecimal allocationQuantity = inventory.getAllocationQuantity() == null ? BigDecimal.ZERO : inventory.getAllocationQuantity();
|
||||||
|
if (allocationQuantity.compareTo(importQuantity) > 0) {
|
||||||
|
reservedInventory.setMaterialInventoryId(inventory.getMaterialInventoryId());
|
||||||
|
reservedInventory.setMaterialBaseInfoId(inventory.getMaterialBaseInfoId());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void importInData(List<ReservedInventoryOut> dataList) {
|
public void importInData(List<ReservedInventoryOut> dataList) {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
ReserveStockOutOrderDO reserveStockOutOrder = new ReserveStockOutOrderDO();
|
ReserveStockOutOrderDO reserveStockOutOrder = new ReserveStockOutOrderDO();
|
||||||
|
|||||||
+42
-71
@@ -124,41 +124,44 @@ public class ReserveStockOutOrderDomainService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean insert(ReserveStockOutOrderDO stockOutOrderDO) {
|
public Boolean insert(ReserveStockOutOrderDO stockOutOrderDO) {
|
||||||
|
if (stockOutOrderDO.getOutOrderNumber() == null) {
|
||||||
|
stockOutOrderDO.setOutOrderNumber(generateReserveOrderNumber());
|
||||||
|
}
|
||||||
//设置单号
|
//设置单号
|
||||||
Long warehouseId = stockOutOrderDO.getWarehouseId();
|
// Long warehouseId = stockOutOrderDO.getWarehouseId();
|
||||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
// AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
// if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||||
throw new ServiceException("获取仓库信息失败");
|
// throw new ServiceException("获取仓库信息失败");
|
||||||
}
|
// }
|
||||||
//仓库信息
|
// //仓库信息
|
||||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
// WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
// String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||||
String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
// String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
||||||
if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
// if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
||||||
prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
// prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
||||||
}
|
// }
|
||||||
if (prefix == null || prefix.isEmpty()) {
|
// if (prefix == null || prefix.isEmpty()) {
|
||||||
prefix = "CK";
|
// prefix = "CK";
|
||||||
}
|
// }
|
||||||
Long organizationId = stockOutOrderDO.getOrganizationId();
|
// Long organizationId = stockOutOrderDO.getOrganizationId();
|
||||||
Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
// Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
||||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
// if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
// //日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
// String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||||
String datePrefix = prefix + dateStr;
|
// String datePrefix = prefix + dateStr;
|
||||||
List<String> orderNumbers = stockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
// List<String> orderNumbers = stockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
// int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
// String seq = String.format("%03d", maxSeq + 1);
|
||||||
stockOutOrderDO.setOutOrderNumber(datePrefix + seq);
|
// stockOutOrderDO.setOutOrderNumber(datePrefix + seq);
|
||||||
stockOutOrderDO.setBusinessOrderNo(datePrefix + seq);
|
// stockOutOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||||
} else {
|
// } else {
|
||||||
//历史累加: 前缀 + 历史最大序号+1
|
// //历史累加: 前缀 + 历史最大序号+1
|
||||||
List<String> orderNumbers = stockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
// List<String> orderNumbers = stockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
// int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
// String seq = String.format("%03d", maxSeq + 1);
|
||||||
stockOutOrderDO.setOutOrderNumber(prefix + seq);
|
// stockOutOrderDO.setOutOrderNumber(prefix + seq);
|
||||||
stockOutOrderDO.setBusinessOrderNo(prefix + seq);
|
// stockOutOrderDO.setBusinessOrderNo(prefix + seq);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// 与 update / batchInsert 一致:前端传计划数量为 quantity,非 outboundQuantity
|
// 与 update / batchInsert 一致:前端传计划数量为 quantity,非 outboundQuantity
|
||||||
@@ -188,40 +191,8 @@ public class ReserveStockOutOrderDomainService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean batchInsert(List<ReserveStockOutOrderDO> stockOutOrderDOList) {
|
public Boolean batchInsert(List<ReserveStockOutOrderDO> stockOutOrderDOList) {
|
||||||
for (ReserveStockOutOrderDO stockOutOrderDO : stockOutOrderDOList){
|
for (ReserveStockOutOrderDO stockOutOrderDO : stockOutOrderDOList){
|
||||||
//设置单号
|
if (stockOutOrderDO.getOutOrderNumber() == null) {
|
||||||
Long warehouseId = stockOutOrderDO.getWarehouseId();
|
stockOutOrderDO.setOutOrderNumber(generateReserveOrderNumber());
|
||||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
|
||||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
|
||||||
throw new ServiceException("获取仓库信息失败");
|
|
||||||
}
|
|
||||||
//仓库信息
|
|
||||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
|
||||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
|
||||||
String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
|
||||||
if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
|
||||||
prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
|
||||||
}
|
|
||||||
if (prefix == null || prefix.isEmpty()) {
|
|
||||||
prefix = "CK";
|
|
||||||
}
|
|
||||||
Long organizationId = stockOutOrderDO.getOrganizationId();
|
|
||||||
Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
|
||||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
|
||||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
|
||||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
|
||||||
String datePrefix = prefix + dateStr;
|
|
||||||
List<String> orderNumbers = stockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
|
||||||
stockOutOrderDO.setOutOrderNumber(datePrefix + seq);
|
|
||||||
stockOutOrderDO.setBusinessOrderNo(datePrefix + seq);
|
|
||||||
} else {
|
|
||||||
//历史累加: 前缀 + 历史最大序号+1
|
|
||||||
List<String> orderNumbers = stockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
|
||||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
|
||||||
String seq = String.format("%03d", maxSeq + 1);
|
|
||||||
stockOutOrderDO.setOutOrderNumber(prefix + seq);
|
|
||||||
stockOutOrderDO.setBusinessOrderNo(prefix + seq);
|
|
||||||
}
|
}
|
||||||
//设置物料信息
|
//设置物料信息
|
||||||
setMaterialDetailInfo(stockOutOrderDO);
|
setMaterialDetailInfo(stockOutOrderDO);
|
||||||
@@ -382,9 +353,9 @@ public class ReserveStockOutOrderDomainService {
|
|||||||
|
|
||||||
List<ReserveOutMaterialDetail> list = outMaterialDetailService.list(new LambdaQueryWrapper<ReserveOutMaterialDetail>().eq(ReserveOutMaterialDetail::getOutOrderNumber, stockOutOrderDO.getOutOrderNumber()));
|
List<ReserveOutMaterialDetail> list = outMaterialDetailService.list(new LambdaQueryWrapper<ReserveOutMaterialDetail>().eq(ReserveOutMaterialDetail::getOutOrderNumber, stockOutOrderDO.getOutOrderNumber()));
|
||||||
for (ReserveOutMaterialDetail reserveOutMaterialDetail : list) {
|
for (ReserveOutMaterialDetail reserveOutMaterialDetail : list) {
|
||||||
reserveOutMaterialDetail.setWarehouseId(stockOutOrderDO.getWarehouseId());
|
// reserveOutMaterialDetail.setWarehouseId(stockOutOrderDO.getWarehouseId());
|
||||||
reserveOutMaterialDetail.setWarehouseCode(stockOutOrderDO.getWarehouseCode());
|
// reserveOutMaterialDetail.setWarehouseCode(stockOutOrderDO.getWarehouseCode());
|
||||||
reserveOutMaterialDetail.setWarehouseName(stockOutOrderDO.getWarehouseName());
|
// reserveOutMaterialDetail.setWarehouseName(stockOutOrderDO.getWarehouseName());
|
||||||
outMaterialDetailService.updateById(reserveOutMaterialDetail);
|
outMaterialDetailService.updateById(reserveOutMaterialDetail);
|
||||||
}
|
}
|
||||||
//todo下发推送到wms
|
//todo下发推送到wms
|
||||||
|
|||||||
+25
@@ -296,6 +296,31 @@ public class ReserveStockOutOrderApi extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅解析Excel文件内容并返回,不执行入库
|
||||||
|
* 同时根据货物名称查询WMS对应物料库存,可用数量大于件数的返回库存id,匹配不到库存id返回空
|
||||||
|
*/
|
||||||
|
@ApiOperation("解析导入Excel(仅解析不入库)")
|
||||||
|
@PostMapping("/parseExcel")
|
||||||
|
public ResponseEntity<Map<String, Object>> parseExcel(@RequestParam("file") MultipartFile file) {
|
||||||
|
List<ReservedInventoryOut> dataList = null;
|
||||||
|
try {
|
||||||
|
dataList = ExcelParseUtil.parseExcel(file);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据货物名称查询WMS库存并填充库存id,匹配不到库存id返回空
|
||||||
|
stockOutOrderApplicationService.fillMaterialInventoryId(dataList);
|
||||||
|
|
||||||
|
Map<String, Object> successResponse = new HashMap<>();
|
||||||
|
successResponse.put("code", 200);
|
||||||
|
successResponse.put("message", "Excel解析成功");
|
||||||
|
successResponse.put("dataCount", dataList.size());
|
||||||
|
successResponse.put("details", dataList);
|
||||||
|
return ResponseEntity.ok(successResponse);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成出库预约单号
|
* 生成出库预约单号
|
||||||
*/
|
*/
|
||||||
|
|||||||
+10
@@ -108,6 +108,16 @@ public class BusinessDocumentOrderApi extends BaseController{
|
|||||||
return AjaxResult.success(businessDocumentOrderApplicationService.audit(businessAuditDTO));
|
return AjaxResult.success(businessDocumentOrderApplicationService.audit(businessAuditDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务单反审核(将已审核订单恢复到待审核,便于修改)
|
||||||
|
*/
|
||||||
|
@ApiOperation("业务单反审核")
|
||||||
|
@PostMapping(value = "/cancelAudit")
|
||||||
|
public AjaxResult cancelAudit(@RequestBody BusinessAuditDTO businessAuditDTO)
|
||||||
|
{
|
||||||
|
return toAjax(businessDocumentOrderApplicationService.cancelAudit(businessAuditDTO));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量执行【业务单】
|
* 批量执行【业务单】
|
||||||
*/
|
*/
|
||||||
|
|||||||
+46
@@ -260,6 +260,52 @@ public class ReserveStockInOrderApi extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅解析Excel文件内容并返回,不执行入库
|
||||||
|
* 同时根据货物名称匹配WMS物料并返回物料id,匹配不到返回空
|
||||||
|
*/
|
||||||
|
@ApiOperation("解析导入Excel(仅解析不入库)")
|
||||||
|
@PostMapping("/parseExcel")
|
||||||
|
public ResponseEntity<Map<String, Object>> parseExcel(@RequestParam("file") MultipartFile file) {
|
||||||
|
try {
|
||||||
|
List<ReservedInventory> dataList = ExcelParseUtil.parseExcel(file);
|
||||||
|
|
||||||
|
// 根据货物名称匹配WMS物料并填充物料id,匹配不到返回空
|
||||||
|
stockInOrderApplicationService.fillMaterialBaseInfoId(dataList);
|
||||||
|
|
||||||
|
Map<String, Object> successResponse = new HashMap<>();
|
||||||
|
successResponse.put("code", 200);
|
||||||
|
successResponse.put("message", "Excel解析成功");
|
||||||
|
successResponse.put("dataCount", dataList.size());
|
||||||
|
successResponse.put("details", dataList);
|
||||||
|
return ResponseEntity.ok(successResponse);
|
||||||
|
|
||||||
|
} catch (ValidationException e) {
|
||||||
|
// 数据验证失败响应
|
||||||
|
Map<String, Object> errorResponse = new HashMap<>();
|
||||||
|
errorResponse.put("code", 400);
|
||||||
|
errorResponse.put("message", "数据验证失败");
|
||||||
|
errorResponse.put("errorDetails", e.getMessage());
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(errorResponse);
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
// 文件处理失败响应
|
||||||
|
Map<String, Object> errorResponse = new HashMap<>();
|
||||||
|
errorResponse.put("code", 500);
|
||||||
|
errorResponse.put("message", "文件处理失败");
|
||||||
|
errorResponse.put("errorDetails", e.getMessage());
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 其他未知错误响应
|
||||||
|
Map<String, Object> errorResponse = new HashMap<>();
|
||||||
|
errorResponse.put("code", 500);
|
||||||
|
errorResponse.put("message", e.getMessage());
|
||||||
|
errorResponse.put("errorDetails", e.getMessage());
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 老系统入库预约单数据导入(主表+明细两个Excel文件批量导入,按名称匹配基础数据)
|
* 老系统入库预约单数据导入(主表+明细两个Excel文件批量导入,按名称匹配基础数据)
|
||||||
*/
|
*/
|
||||||
|
|||||||
+8
-1
@@ -709,7 +709,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<select id="queryList" parameterType="com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO" resultMap="BusinessDocumentOrderResult">
|
<select id="queryList" parameterType="com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO" resultMap="BusinessDocumentOrderResult">
|
||||||
<include refid="selectBusinessDocumentOrderPo"/>
|
<include refid="selectBusinessDocumentOrderPo"/>
|
||||||
<include refid="selectBusinessDocumentOrderPo1"/>
|
<include refid="selectBusinessDocumentOrderPo1"/>
|
||||||
order by create_time desc
|
order by lay_date desc, create_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByMakerCodeNc" parameterType="java.lang.String" resultType="java.lang.String">
|
<select id="selectByMakerCodeNc" parameterType="java.lang.String" resultType="java.lang.String">
|
||||||
select DOCUMENT_PREPARER_NC_code from NGWL_TEST_USER."USER" where USER_ID = #{salesmanCodeNc}</select>
|
select DOCUMENT_PREPARER_NC_code from NGWL_TEST_USER."USER" where USER_ID = #{salesmanCodeNc}</select>
|
||||||
@@ -1272,4 +1272,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select PUSH_VERIFY from NGWL_TEST_PRODUCT.SYS_ORGANIZATION where ORGANIZATION_ID = #{organizationId}
|
select PUSH_VERIFY from NGWL_TEST_PRODUCT.SYS_ORGANIZATION where ORGANIZATION_ID = #{organizationId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countByGoodsNumberPrefix" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(1)
|
||||||
|
FROM business_document_order
|
||||||
|
WHERE goods_number LIKE concat(#{prefix}, '%')
|
||||||
|
AND LENGTH(goods_number) <= 12
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<select id="queryList" parameterType="com.mhd.oms.domain.executeOrder.repository.todo.ExecuteOrderDO" resultMap="ExecuteOrderResult">
|
<select id="queryList" parameterType="com.mhd.oms.domain.executeOrder.repository.todo.ExecuteOrderDO" resultMap="ExecuteOrderResult">
|
||||||
<include refid="selectExecuteOrderPo"/>
|
<include refid="selectExecuteOrderPo"/>
|
||||||
<include refid="selectExecuteOrderPo1"/>
|
<include refid="selectExecuteOrderPo1"/>
|
||||||
order by CREATE_TIME desc
|
order by lay_date desc, CREATE_TIME desc
|
||||||
</select>
|
</select>
|
||||||
<select id="getOrgNameByOrgId" resultType="java.lang.String">
|
<select id="getOrgNameByOrgId" resultType="java.lang.String">
|
||||||
select ORGANIZATION_NAME from NGWL_TEST_PRODUCT.SYS_ORGANIZATION where ORGANIZATION_ID=#{organizationId}
|
select ORGANIZATION_NAME from NGWL_TEST_PRODUCT.SYS_ORGANIZATION where ORGANIZATION_ID=#{organizationId}
|
||||||
|
|||||||
+7
-1
@@ -97,6 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="erpCurrGw" column="erp_curr_gw" />
|
<result property="erpCurrGw" column="erp_curr_gw" />
|
||||||
<result property="erpPriceGw" column="erp_price_gw" />
|
<result property="erpPriceGw" column="erp_price_gw" />
|
||||||
<result property="amountGw" column="amount_gw" />
|
<result property="amountGw" column="amount_gw" />
|
||||||
|
<result property="insureAmount" column="insure_amount" />
|
||||||
|
<result property="goodsType" column="goods_type" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
@@ -366,6 +368,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="orderShipperId" column="order_shipper_id" />
|
<result property="orderShipperId" column="order_shipper_id" />
|
||||||
<result property="orderShipperCode" column="order_shipper_code" />
|
<result property="orderShipperCode" column="order_shipper_code" />
|
||||||
<result property="orderShipperName" column="order_shipper_name" />
|
<result property="orderShipperName" column="order_shipper_name" />
|
||||||
|
<result property="warehouseDate" column="warehouse_date" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="queryInOrderDetailList" parameterType="com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO"
|
<select id="queryInOrderDetailList" parameterType="com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO"
|
||||||
@@ -400,13 +403,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
a.single_volume, a.single_gross_weight, a.lot_no,
|
a.single_volume, a.single_gross_weight, a.lot_no,
|
||||||
a.drink_date, a.fire_insure_fee, a.unit_price,
|
a.drink_date, a.fire_insure_fee, a.unit_price,
|
||||||
a.line_num_gw, a.spec_gw, a.unit_gw, a.qty_gw, a.erp_curr_gw, a.erp_price_gw, a.amount_gw,
|
a.line_num_gw, a.spec_gw, a.unit_gw, a.qty_gw, a.erp_curr_gw, a.erp_price_gw, a.amount_gw,
|
||||||
|
c.insure_amount, c.goods_type,
|
||||||
b.shipper_id as order_shipper_id,
|
b.shipper_id as order_shipper_id,
|
||||||
b.shipper_code as order_shipper_code,
|
b.shipper_code as order_shipper_code,
|
||||||
b.shipper_name as order_shipper_name,
|
b.shipper_name as order_shipper_name,
|
||||||
b.status as in_order_status,
|
b.status as in_order_status,
|
||||||
b.audit_status as in_order_audit_status
|
b.audit_status as in_order_audit_status,
|
||||||
|
b.warehouse_date
|
||||||
from execution_in_material_detail a
|
from execution_in_material_detail a
|
||||||
left join execution_stock_in_order b on a.in_order_number = b.in_order_number
|
left join execution_stock_in_order b on a.in_order_number = b.in_order_number
|
||||||
|
left join material_base_info c on a.material_base_info_id = c.material_base_info_id
|
||||||
<where>
|
<where>
|
||||||
<if test="organizationId != null ">
|
<if test="organizationId != null ">
|
||||||
and a.organization_id = #{organizationId}
|
and a.organization_id = #{organizationId}
|
||||||
|
|||||||
+8
@@ -33,6 +33,7 @@
|
|||||||
<result property="directWarehouse" column="direct_warehouse" />
|
<result property="directWarehouse" column="direct_warehouse" />
|
||||||
<result property="annexUrl" column="annex_url" />
|
<result property="annexUrl" column="annex_url" />
|
||||||
<result property="quantity" column="quantity" />
|
<result property="quantity" column="quantity" />
|
||||||
|
<result property="declaredQuantity" column="declared_quantity" />
|
||||||
<result property="planInQuantity" column="plan_in_quantity" />
|
<result property="planInQuantity" column="plan_in_quantity" />
|
||||||
<result property="receiptQuantity" column="receipt_quantity" />
|
<result property="receiptQuantity" column="receipt_quantity" />
|
||||||
<result property="shelvesQuantity" column="shelves_quantity" />
|
<result property="shelvesQuantity" column="shelves_quantity" />
|
||||||
@@ -136,6 +137,13 @@
|
|||||||
<!-- where sso.in_order_number = a.in_order_number-->
|
<!-- where sso.in_order_number = a.in_order_number-->
|
||||||
<!-- and sso.del_flag = 1-->
|
<!-- and sso.del_flag = 1-->
|
||||||
<!-- ) as shelves_quantity,-->
|
<!-- ) as shelves_quantity,-->
|
||||||
|
-- 申报数量:入库单明细表 reservation_in_material_detail 的 DECLARED_QUANTITY 汇总
|
||||||
|
(select ifnull(sum(imd.declared_quantity), 0)
|
||||||
|
from reservation_in_material_detail imd
|
||||||
|
where imd.in_order_number = a.in_order_number
|
||||||
|
and imd.del_flag = 1
|
||||||
|
and (imd.level is null or imd.level = 1)
|
||||||
|
) as declared_quantity,
|
||||||
a.weight_limit, a.volume_limit, a.cancel_order, a.cancel_remark, a.cancel_by,a.PICTURE_URL,
|
a.weight_limit, a.volume_limit, a.cancel_order, a.cancel_remark, a.cancel_by,a.PICTURE_URL,
|
||||||
a.cancel_by_name, a.cancel_time, a.close_order, a.close_remark, a.close_by, a.close_by_name, a.close_time, a.remark, a.create_time, a.create_by,
|
a.cancel_by_name, a.cancel_time, a.close_order, a.close_remark, a.close_by, a.close_by_name, a.close_time, a.remark, a.create_time, a.create_by,
|
||||||
a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag, a.over_stock_id, a.over_stock_status, a.over_stock_type,
|
a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag, a.over_stock_id, a.over_stock_status, a.over_stock_type,
|
||||||
|
|||||||
+3
-1
@@ -95,6 +95,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="reservationOrderSource" column="RESERVATION_ORDER_SOURCE" />
|
<result property="reservationOrderSource" column="RESERVATION_ORDER_SOURCE" />
|
||||||
<result property="outboundTime" column="OUTBOUND_TIME" />
|
<result property="outboundTime" column="OUTBOUND_TIME" />
|
||||||
<result property="businessOrderNo" column="BUSINESS_ORDER_NO" />
|
<result property="businessOrderNo" column="BUSINESS_ORDER_NO" />
|
||||||
|
<result property="reserveBusinessType" column="RESERVE_BUSINESS_TYPE" />
|
||||||
|
<result property="reserveBusinessTypeName" column="RESERVE_BUSINESS_TYPE_NAME" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
@@ -112,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
a.COMPLETE_TIME,a.ORDER_DATE,a.TRANSPORT_MODE_CODE,a.TRANSPORT_MODE_NAME,a.SUPERVISION_MODE_CODE,a.SUPERVISION_MODE_NAME,
|
a.COMPLETE_TIME,a.ORDER_DATE,a.TRANSPORT_MODE_CODE,a.TRANSPORT_MODE_NAME,a.SUPERVISION_MODE_CODE,a.SUPERVISION_MODE_NAME,
|
||||||
a.CUSTOMS_INSPECTION_FLAG,a.NEED_DECLARE_FLAG,a.NEED_TRANSPORT_FLAG,a.picture_app,a.reservation_audit_time,a.reservation_audit_name
|
a.CUSTOMS_INSPECTION_FLAG,a.NEED_DECLARE_FLAG,a.NEED_TRANSPORT_FLAG,a.picture_app,a.reservation_audit_time,a.reservation_audit_name
|
||||||
,a.reservation_audit_id,a.issue_name,a.issue_id,a.issue_time,a.issue_status,a.tms_order_number,
|
,a.reservation_audit_id,a.issue_name,a.issue_id,a.issue_time,a.issue_status,a.tms_order_number,
|
||||||
a.DIRECTOR_NAME ,a.DIRECTOR_PHONE,a.DIRECTOR_ID,a.RESERVATION_ORDER_SOURCE,a.OUTBOUND_TIME
|
a.DIRECTOR_NAME ,a.DIRECTOR_PHONE,a.DIRECTOR_ID,a.RESERVATION_ORDER_SOURCE,a.OUTBOUND_TIME,a.RESERVE_BUSINESS_TYPE,a.RESERVE_BUSINESS_TYPE_NAME
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableRyFeignClients
|
@EnableRyFeignClients
|
||||||
@@ -15,6 +16,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
|||||||
@MapperScan("com.mhd.wms.domain.**.mapper")
|
@MapperScan("com.mhd.wms.domain.**.mapper")
|
||||||
@EnableMethodCache(basePackages = "com.mhd.platform.domain.**.cache")
|
@EnableMethodCache(basePackages = "com.mhd.platform.domain.**.cache")
|
||||||
@EnableAsync
|
@EnableAsync
|
||||||
|
//@EnableScheduling
|
||||||
@ComponentScan(basePackages = {
|
@ComponentScan(basePackages = {
|
||||||
"com.mhd.wms",
|
"com.mhd.wms",
|
||||||
"com.mhd.system.api.factory"
|
"com.mhd.system.api.factory"
|
||||||
|
|||||||
+9
-2
@@ -270,10 +270,17 @@ public class HandoverTaskOrderApplicationService {
|
|||||||
.eq(HandoverTaskOrder::getOrderNumber, orderNumber)
|
.eq(HandoverTaskOrder::getOrderNumber, orderNumber)
|
||||||
.set(HandoverTaskOrder::getBillingJson, handoverTaskOrderDO.getBillingJson())
|
.set(HandoverTaskOrder::getBillingJson, handoverTaskOrderDO.getBillingJson())
|
||||||
.set(HandoverTaskOrder::getPictureApp, handoverTaskOrderDO.getPictureApp()));
|
.set(HandoverTaskOrder::getPictureApp, handoverTaskOrderDO.getPictureApp()));
|
||||||
// 2. PDA上传图片插入出库管理,状态改为已出库
|
// // 2. 状态按是否报关:仅通宇(2830)+需报关→已交接(13),否则→已出库(9)
|
||||||
|
// StockOutOrder soo = stockOutOrderService.getOne(new LambdaQueryWrapper<StockOutOrder>()
|
||||||
|
// .eq(StockOutOrder::getOutOrderNumber, orderNumber));
|
||||||
|
// boolean needCustoms = soo != null
|
||||||
|
// && Long.valueOf(2830L).equals(soo.getOrganizationId())
|
||||||
|
// && "1".equals(soo.getNeedDeclareFlag());
|
||||||
|
// int targetStatus = needCustoms ? 13 : 9;
|
||||||
stockOutOrderService.update(new LambdaUpdateWrapper<StockOutOrder>()
|
stockOutOrderService.update(new LambdaUpdateWrapper<StockOutOrder>()
|
||||||
.eq(StockOutOrder::getOutOrderNumber, orderNumber)
|
.eq(StockOutOrder::getOutOrderNumber, orderNumber)
|
||||||
.set(StockOutOrder::getStatus, "9")
|
// .set(StockOutOrder::getStatus, targetStatus)
|
||||||
|
.set(StockOutOrder::getStatus, 9) // 不注释之后需要删除
|
||||||
.set(StockOutOrder::getBillingJson, handoverTaskOrderDO.getBillingJson())
|
.set(StockOutOrder::getBillingJson, handoverTaskOrderDO.getBillingJson())
|
||||||
.set(StockOutOrder::getPictureApp, handoverTaskOrderDO.getPictureApp()));
|
.set(StockOutOrder::getPictureApp, handoverTaskOrderDO.getPictureApp()));
|
||||||
// 3. 参考PC端完成交接:根据orderNumber查询交接单ID,执行库存扣减+交接状态更新
|
// 3. 参考PC端完成交接:根据orderNumber查询交接单ID,执行库存扣减+交接状态更新
|
||||||
|
|||||||
+74
-45
@@ -257,31 +257,33 @@ public class MaterialBaseInfoApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Long shipperId = materialBaseInfoDO.getShipperId();
|
Long shipperId = materialBaseInfoDO.getShipperId();
|
||||||
String customerCodeNcJson = null;
|
if (shipperId != null&&shipperId != 0L) {
|
||||||
if (shipperId != null) {
|
String customerCodeNcJson = null;
|
||||||
customerCodeNcJson = materialBaseInfoMapper.getCustomerCodeNcJson(shipperId.toString());
|
if (shipperId != null) {
|
||||||
}
|
customerCodeNcJson = materialBaseInfoMapper.getCustomerCodeNcJson(shipperId.toString());
|
||||||
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
}
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||||
List<Map<String, Object>> listNc = null;
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
try {
|
List<Map<String, Object>> listNc = null;
|
||||||
listNc = objectMapper.readValue(
|
try {
|
||||||
customerCodeNcJson,
|
listNc = objectMapper.readValue(
|
||||||
new com.fasterxml.jackson.core.type.TypeReference<List<Map<String, Object>>>() {}
|
customerCodeNcJson,
|
||||||
);
|
new com.fasterxml.jackson.core.type.TypeReference<List<Map<String, Object>>>() {}
|
||||||
String codeStr = "";
|
);
|
||||||
if (listNc != null && listNc.size() > 0) {
|
String codeStr = "";
|
||||||
// 方式1:Stream拼接,逗号分隔
|
if (listNc != null && listNc.size() > 0) {
|
||||||
codeStr = listNc.stream()
|
// 方式1:Stream拼接,逗号分隔
|
||||||
.map(map -> map.get("code"))
|
codeStr = listNc.stream()
|
||||||
.filter(Objects::nonNull) // 过滤code为空
|
.map(map -> map.get("code"))
|
||||||
.map(Object::toString)
|
.filter(Objects::nonNull) // 过滤code为空
|
||||||
.collect(Collectors.joining(","));
|
.map(Object::toString)
|
||||||
materialBaseInfoDO.setOrgId(codeStr);
|
.collect(Collectors.joining(","));
|
||||||
|
materialBaseInfoDO.setOrgId(codeStr);
|
||||||
|
}
|
||||||
|
// codeStr 就是拼接好的字符串
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
// codeStr 就是拼接好的字符串
|
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Long materialBaseInfoId = materialBaseInfoDomainService.insert(materialBaseInfoDO);
|
Long materialBaseInfoId = materialBaseInfoDomainService.insert(materialBaseInfoDO);
|
||||||
@@ -316,30 +318,35 @@ public class MaterialBaseInfoApplicationService {
|
|||||||
*/
|
*/
|
||||||
public Boolean update(MaterialBaseInfoDO materialBaseInfoDO) {
|
public Boolean update(MaterialBaseInfoDO materialBaseInfoDO) {
|
||||||
Long shipperId = materialBaseInfoDO.getShipperId();
|
Long shipperId = materialBaseInfoDO.getShipperId();
|
||||||
String customerCodeNcJson = materialBaseInfoMapper.getCustomerCodeNcJson(shipperId.toString());
|
//设置货主信息
|
||||||
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
shipperParam(materialBaseInfoDO);
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
if (shipperId != null&&shipperId!=0l) {
|
||||||
List<Map<String, Object>> listNc = null;
|
String customerCodeNcJson = materialBaseInfoMapper.getCustomerCodeNcJson(shipperId.toString());
|
||||||
try {
|
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||||
listNc = objectMapper.readValue(
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
customerCodeNcJson,
|
List<Map<String, Object>> listNc = null;
|
||||||
new com.fasterxml.jackson.core.type.TypeReference<List<Map<String, Object>>>() {}
|
try {
|
||||||
);
|
listNc = objectMapper.readValue(
|
||||||
String codeStr = "";
|
customerCodeNcJson,
|
||||||
if (listNc != null && listNc.size() > 0) {
|
new com.fasterxml.jackson.core.type.TypeReference<List<Map<String, Object>>>() {}
|
||||||
// 方式1:Stream拼接,逗号分隔
|
);
|
||||||
codeStr = listNc.stream()
|
String codeStr = "";
|
||||||
.map(map -> map.get("code"))
|
if (listNc != null && listNc.size() > 0) {
|
||||||
.filter(Objects::nonNull) // 过滤code为空
|
// 方式1:Stream拼接,逗号分隔
|
||||||
.map(Object::toString)
|
codeStr = listNc.stream()
|
||||||
.collect(Collectors.joining(","));
|
.map(map -> map.get("code"))
|
||||||
materialBaseInfoDO.setOrgId(codeStr);
|
.filter(Objects::nonNull) // 过滤code为空
|
||||||
|
.map(Object::toString)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
materialBaseInfoDO.setOrgId(codeStr);
|
||||||
|
}
|
||||||
|
// codeStr 就是拼接好的字符串
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
// codeStr 就是拼接好的字符串
|
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
materialBaseInfoDomainService.update(materialBaseInfoDO);
|
materialBaseInfoDomainService.update(materialBaseInfoDO);
|
||||||
Long materialBaseInfoId = materialBaseInfoDO.getMaterialBaseInfoId();
|
Long materialBaseInfoId = materialBaseInfoDO.getMaterialBaseInfoId();
|
||||||
// 商品/公共/仓控 子表:Feign/前端常只带业务字段、未带子表主键,需按 material_base_info_id 补全后再 update,否则 WHERE xxx_id=? 为 null 导致 Updates: 0
|
// 商品/公共/仓控 子表:Feign/前端常只带业务字段、未带子表主键,需按 material_base_info_id 补全后再 update,否则 WHERE xxx_id=? 为 null 导致 Updates: 0
|
||||||
@@ -381,6 +388,28 @@ public class MaterialBaseInfoApplicationService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 封装货主信息
|
||||||
|
* @author ZhouGY
|
||||||
|
* @date 2024/5/9 20:43
|
||||||
|
* @param materialBaseInfoDO
|
||||||
|
*/
|
||||||
|
private void shipperParam(MaterialBaseInfoDO materialBaseInfoDO){
|
||||||
|
Long shipperId = materialBaseInfoDO.getShipperId();
|
||||||
|
if (shipperId != null && shipperId != 0l) {
|
||||||
|
AjaxResult ajaxResult = userServiceFeign.getInfo(materialBaseInfoDO.getShipperId());
|
||||||
|
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||||
|
throw new ServiceException("获取货主信息失败");
|
||||||
|
}
|
||||||
|
UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
|
||||||
|
// 如果原始shipperName不为空,保留原始值(导入或手动输入时应该保留完整名称)
|
||||||
|
// 只有在原始shipperName为空时,才使用查询到的userName
|
||||||
|
if (materialBaseInfoDO.getShipperName() == null || materialBaseInfoDO.getShipperName().trim().isEmpty()) {
|
||||||
|
materialBaseInfoDO.setShipperName(userPo.getUserName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑物料时从库中反查子表主键,避免仅传 batchId 等字段时子表主键为 null 无法 UPDATE。
|
* 编辑物料时从库中反查子表主键,避免仅传 batchId 等字段时子表主键为 null 无法 UPDATE。
|
||||||
*/
|
*/
|
||||||
|
|||||||
+3
-2
@@ -476,7 +476,8 @@ public class ReviewOrderApplicationService {
|
|||||||
handoverTaskOrderDO.setShipperId(stockOutOrderPO.getShipperId());
|
handoverTaskOrderDO.setShipperId(stockOutOrderPO.getShipperId());
|
||||||
handoverTaskOrderDO.setShipperName(stockOutOrderPO.getShipperName());
|
handoverTaskOrderDO.setShipperName(stockOutOrderPO.getShipperName());
|
||||||
handoverTaskOrderDO.setSerialNumber(OrderSequence.getOrderCode("JJZYLS"));
|
handoverTaskOrderDO.setSerialNumber(OrderSequence.getOrderCode("JJZYLS"));
|
||||||
handoverTaskOrderDO.setTaskNumber(OrderSequence.getOrderCode("JJZY"));
|
// handoverTaskOrderDO.setTaskNumber(OrderSequence.getOrderCode("JJZY"));
|
||||||
|
handoverTaskOrderDO.setTaskNumber("HD-"+stockOutOrderPO.getOutOrderNumber());
|
||||||
handoverTaskOrderDO.setStatus(1);
|
handoverTaskOrderDO.setStatus(1);
|
||||||
handoverTaskOrderDO.setOrderTypeCode(stockOutOrderPO.getOrderTypeCode());
|
handoverTaskOrderDO.setOrderTypeCode(stockOutOrderPO.getOrderTypeCode());
|
||||||
handoverTaskOrderDO.setOrderTypeName(stockOutOrderPO.getOrderTypeName());
|
handoverTaskOrderDO.setOrderTypeName(stockOutOrderPO.getOrderTypeName());
|
||||||
@@ -1302,4 +1303,4 @@ public class ReviewOrderApplicationService {
|
|||||||
setter.accept(parsed);
|
setter.accept(parsed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+34
@@ -36,6 +36,7 @@ import com.mhd.wms.domain.handoverTaskOrder.repository.facade.IHandoverTaskOrder
|
|||||||
import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
|
import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.facade.IInMaterialDetailService;
|
import com.mhd.wms.domain.inMaterialDetail.repository.facade.IInMaterialDetailService;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
|
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
|
||||||
|
import com.mhd.wms.domain.inMaterialDetail.repository.po.InStockListMaterialAgg;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
|
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
|
||||||
import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo;
|
import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo;
|
||||||
import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService;
|
import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService;
|
||||||
@@ -242,7 +243,40 @@ public class StockInOrderApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<StockInOrderPO> stockInOrderPOS = stockInOrderDomainService.queryList(stockInOrderDO);
|
List<StockInOrderPO> stockInOrderPOS = stockInOrderDomainService.queryList(stockInOrderDO);
|
||||||
|
if (CollectionUtils.isEmpty(stockInOrderPOS)) {
|
||||||
|
return stockInOrderPOS;
|
||||||
|
}
|
||||||
|
List<String> inOrderNumbers = stockInOrderPOS.stream()
|
||||||
|
.map(StockInOrderPO::getInOrderNumber)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 列表页展示:按入库单号批量取去重后的 Invoice No
|
||||||
|
Map<String, String> invoiceNoByNum = new HashMap<>();
|
||||||
|
inMaterialDetailService.selectDistinctInvoiceNoForStockInList(inOrderNumbers)
|
||||||
|
.stream()
|
||||||
|
.filter(a -> StringUtils.isNotBlank(a.getInvoiceNo()))
|
||||||
|
.forEach(a -> invoiceNoByNum.merge(a.getInOrderNumber(), a.getInvoiceNo().trim(), (o, n) -> o + "," + n));
|
||||||
|
|
||||||
|
// 导出场景(needDetail=true):批量取出完整明细树(level=1 父行 + children),按入库单号分组挂到列表
|
||||||
|
// 注释掉 needDetail 判断:列表/导出统一返回明细
|
||||||
|
Map<String, List<InMaterialDetailPO>> detailByNum = Collections.emptyMap();
|
||||||
|
// if (Boolean.TRUE.equals(stockInOrderDO.getNeedDetail()) && !CollectionUtils.isEmpty(inOrderNumbers)) {
|
||||||
|
if (!CollectionUtils.isEmpty(inOrderNumbers)) {
|
||||||
|
InMaterialDetailDO detailQuery = new InMaterialDetailDO();
|
||||||
|
detailQuery.setInOrderNumberList(inOrderNumbers);
|
||||||
|
List<InMaterialDetailPO> detailTreeList = inMaterialDetailService.queryListChildren(detailQuery);
|
||||||
|
detailByNum = detailTreeList.stream()
|
||||||
|
.collect(Collectors.groupingBy(InMaterialDetailPO::getInOrderNumber));
|
||||||
|
}
|
||||||
|
|
||||||
for (StockInOrderPO stockInOrderPO : stockInOrderPOS) {
|
for (StockInOrderPO stockInOrderPO : stockInOrderPOS) {
|
||||||
|
if (invoiceNoByNum.containsKey(stockInOrderPO.getInOrderNumber())) {
|
||||||
|
stockInOrderPO.setInvoiceNo(invoiceNoByNum.get(stockInOrderPO.getInOrderNumber()));
|
||||||
|
}
|
||||||
|
// if (Boolean.TRUE.equals(stockInOrderDO.getNeedDetail())) {
|
||||||
|
stockInOrderPO.setMaterialDetailList(detailByNum.getOrDefault(stockInOrderPO.getInOrderNumber(), Collections.emptyList()));
|
||||||
|
// }
|
||||||
Long inOrderId = stockInOrderPO.getInOrderId();
|
Long inOrderId = stockInOrderPO.getInOrderId();
|
||||||
List<ReceiptOrderAccount> list = receiptOrderAccountService.list(new LambdaQueryWrapper<ReceiptOrderAccount>().eq(ReceiptOrderAccount::getOrderId, inOrderId).eq(ReceiptOrderAccount::getInOrOut, "in"));
|
List<ReceiptOrderAccount> list = receiptOrderAccountService.list(new LambdaQueryWrapper<ReceiptOrderAccount>().eq(ReceiptOrderAccount::getOrderId, inOrderId).eq(ReceiptOrderAccount::getInOrOut, "in"));
|
||||||
stockInOrderPO.setReceiptOrderAccountList(list);
|
stockInOrderPO.setReceiptOrderAccountList(list);
|
||||||
|
|||||||
+26
@@ -253,9 +253,35 @@ public class StockOutOrderApplicationService {
|
|||||||
accountByOrderId = accounts.stream().collect(Collectors.groupingBy(ReceiptOrderAccount::getOrderId));
|
accountByOrderId = accounts.stream().collect(Collectors.groupingBy(ReceiptOrderAccount::getOrderId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 列表页展示:按出库单号批量取去重后的 Invoice No
|
||||||
|
Map<String, String> invoiceNoByNum = new HashMap<>();
|
||||||
|
outMaterialDetailService.selectDistinctInvoiceNoForStockOutList(outOrderNumbers)
|
||||||
|
.stream()
|
||||||
|
.filter(a -> StringUtils.isNotBlank(a.getInvoiceNo()))
|
||||||
|
.forEach(a -> invoiceNoByNum.merge(a.getOutOrderNumber(), a.getInvoiceNo().trim(), (o, n) -> o + "," + n));
|
||||||
|
|
||||||
|
// 导出场景(needDetail=true):批量取出完整明细树(level=1 父行 + children),按出库单号分组挂到列表
|
||||||
|
// 注释掉 needDetail 判断:列表/导出统一返回明细
|
||||||
|
Map<String, List<OutMaterialDetailPO>> detailByNum = Collections.emptyMap();
|
||||||
|
// if (Boolean.TRUE.equals(stockOutOrderDO.getNeedDetail()) && !CollectionUtils.isEmpty(outOrderNumbers)) {
|
||||||
|
if (!CollectionUtils.isEmpty(outOrderNumbers)) {
|
||||||
|
OutMaterialDetailDO detailQuery = new OutMaterialDetailDO();
|
||||||
|
detailQuery.setOutOrderNumberList(outOrderNumbers);
|
||||||
|
List<OutMaterialDetailPO> detailTreeList = outMaterialDetailService.queryListChildren(detailQuery);
|
||||||
|
detailByNum = detailTreeList.stream()
|
||||||
|
.collect(Collectors.groupingBy(OutMaterialDetailPO::getOutOrderNumber));
|
||||||
|
}
|
||||||
|
|
||||||
for (StockOutOrderPO stockOutOrderPO : stockOutOrderPOS) {
|
for (StockOutOrderPO stockOutOrderPO : stockOutOrderPOS) {
|
||||||
String outOrderNumber = stockOutOrderPO.getOutOrderNumber();
|
String outOrderNumber = stockOutOrderPO.getOutOrderNumber();
|
||||||
|
|
||||||
|
if (invoiceNoByNum.containsKey(outOrderNumber)) {
|
||||||
|
stockOutOrderPO.setInvoiceNo(invoiceNoByNum.get(outOrderNumber));
|
||||||
|
}
|
||||||
|
// if (Boolean.TRUE.equals(stockOutOrderDO.getNeedDetail())) {
|
||||||
|
stockOutOrderPO.setMaterialDetailList(detailByNum.getOrDefault(outOrderNumber, Collections.emptyList()));
|
||||||
|
// }
|
||||||
|
|
||||||
List<DeliveryDetailsLink> list = deliveryDetailsLinkService.list(new LambdaQueryWrapper<DeliveryDetailsLink>().eq(DeliveryDetailsLink::getOrderNumber, outOrderNumber));
|
List<DeliveryDetailsLink> list = deliveryDetailsLinkService.list(new LambdaQueryWrapper<DeliveryDetailsLink>().eq(DeliveryDetailsLink::getOrderNumber, outOrderNumber));
|
||||||
stockOutOrderPO.setDeliveryDetailsLinkList(list);
|
stockOutOrderPO.setDeliveryDetailsLinkList(list);
|
||||||
|
|
||||||
|
|||||||
+1
@@ -2915,6 +2915,7 @@ public class StockReceiptOrderApplicationService {
|
|||||||
returnReceiptMaterialDetailDO.setTotalGrossWeight(receiptMaterialDetailDO.getTotalGrossWeight());
|
returnReceiptMaterialDetailDO.setTotalGrossWeight(receiptMaterialDetailDO.getTotalGrossWeight());
|
||||||
returnReceiptMaterialDetailDO.setTotalVolume(receiptMaterialDetailDO.getTotalVolume());
|
returnReceiptMaterialDetailDO.setTotalVolume(receiptMaterialDetailDO.getTotalVolume());
|
||||||
returnReceiptMaterialDetailDO.setTotalArea(receiptMaterialDetailDO.getTotalArea());
|
returnReceiptMaterialDetailDO.setTotalArea(receiptMaterialDetailDO.getTotalArea());
|
||||||
|
returnReceiptMaterialDetailDO.setDimensions(receiptMaterialDetailDO.getDimensions());
|
||||||
BigDecimal parentRetAlreadyQty = receiptMaterialDetailDO.getAlreadyReceiptQuantity() != null
|
BigDecimal parentRetAlreadyQty = receiptMaterialDetailDO.getAlreadyReceiptQuantity() != null
|
||||||
? receiptMaterialDetailDO.getAlreadyReceiptQuantity() : BigDecimal.ZERO;
|
? receiptMaterialDetailDO.getAlreadyReceiptQuantity() : BigDecimal.ZERO;
|
||||||
returnReceiptMaterialDetailDO.setAlreadyReceiptQuantity(parentRetAlreadyQty);
|
returnReceiptMaterialDetailDO.setAlreadyReceiptQuantity(parentRetAlreadyQty);
|
||||||
|
|||||||
+305
-183
@@ -1,5 +1,18 @@
|
|||||||
package com.mhd.wms.domain.handoverTaskOrder.service;
|
package com.mhd.wms.domain.handoverTaskOrder.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.mhd.common.core.web.domain.AjaxResult;
|
||||||
|
import com.mhd.wms.domain.customsDeclarationDetail.repository.todo.CustomsDeclarationDetailDO;
|
||||||
|
import com.mhd.wms.domain.customsDeclarationDetail.repository.facade.ICustomsDeclarationDetailService;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
@@ -86,6 +99,29 @@ public class HandoverTaskOrderDomainService {
|
|||||||
private CopyCodeReferenceDomainService copyCodeReferenceDomainService;
|
private CopyCodeReferenceDomainService copyCodeReferenceDomainService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private OmsServiceFeign omsServiceFeign;
|
private OmsServiceFeign omsServiceFeign;
|
||||||
|
// @Autowired
|
||||||
|
// private ICustomsDeclarationDetailService customsDeclarationDetailService;
|
||||||
|
|
||||||
|
// // 报关回写相关常量
|
||||||
|
// private static final String CUSTOMS_PUSH_API_URL = "http://10.102.192.15/nagu-erp-api/transfer/pushData";
|
||||||
|
// private static final String CUSTOMS_VERIFY = "ESLuxAmB6VXCgbqP1eFzxTPVRagkQ62BUkfhElrgQ6XmE/g2reHVflY/SiCSU7JD";
|
||||||
|
// // 通宇组织ID(只有通宇才启用报关出库流程)
|
||||||
|
// private static final Long TONGYU_ORGANIZATION_ID = 2830L;
|
||||||
|
// // 视为「海关已放行/结关」的状态码(建议做成 @Value("${gw.customs.pass-status:P,I,R,F,K,B}"))
|
||||||
|
// // 视为「海关已放行」的状态码(ERP 确认:只有 P=海关已放行 才表示货物可出库)
|
||||||
|
// private static final String[] CUSTOMS_PASS_STATUS = {"P"};
|
||||||
|
// // 退单/失败状态码(记告警用)
|
||||||
|
// private static final String[] CUSTOMS_FAIL_STATUS = {"E", "A", "D", "Z", "c", "H"};
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 判断是否需要走报关出库流程(仅通宇 + needDeclareFlag=1)
|
||||||
|
// * 其它组织一律走老流程(交接直接出库)
|
||||||
|
// */
|
||||||
|
// private boolean isCustomsDeclareOrder(StockOutOrder stockOutOrder) {
|
||||||
|
// return stockOutOrder != null
|
||||||
|
// && TONGYU_ORGANIZATION_ID.equals(stockOutOrder.getOrganizationId())
|
||||||
|
// && "1".equals(stockOutOrder.getNeedDeclareFlag());
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -293,16 +329,22 @@ public class HandoverTaskOrderDomainService {
|
|||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
//修改库存
|
//修改库存
|
||||||
xgkc(handoverTaskOrderIds,loginUser);
|
xgkc(handoverTaskOrderIds,loginUser);
|
||||||
//推送oms
|
//推送oms(需报关的单子等海关确认放行后再推)
|
||||||
for (Long handoverTaskOrderId : handoverTaskOrderIds) {
|
for (Long handoverTaskOrderId : handoverTaskOrderIds) {
|
||||||
HandoverTaskOrder handoverTaskOrder = handoverTaskOrderService.getById(handoverTaskOrderId);
|
// HandoverTaskOrder hto = handoverTaskOrderService.getById(handoverTaskOrderId);
|
||||||
String orderNumber = handoverTaskOrder.getOrderNumber();
|
// if (hto == null) {
|
||||||
StockOutOrder stockOutOrder = stockOutOrderService.getOne(new LambdaQueryWrapper<StockOutOrder>()
|
// continue;
|
||||||
.eq(StockOutOrder::getOutOrderNumber, orderNumber)
|
// }
|
||||||
.eq(StockOutOrder::getDelFlag, 1), false);
|
// StockOutOrder soo = stockOutOrderMapper.selectOne(new QueryWrapper<StockOutOrder>().lambda()
|
||||||
if (stockOutOrder != null && !"yang_pin_chu_ku".equals(stockOutOrder.getBusinessType())) {
|
// .eq(StockOutOrder::getOutOrderNumber, hto.getOrderNumber()));
|
||||||
pushOms(handoverTaskOrderId);
|
// if (isCustomsDeclareOrder(soo)) {
|
||||||
}
|
// continue; // 需报关(仅通宇),跳过
|
||||||
|
// }
|
||||||
|
// if (soo != null && !"yang_pin_chu_ku".equals(soo.getBusinessType())) {
|
||||||
|
// pushOms(handoverTaskOrderId);
|
||||||
|
// }
|
||||||
|
// 推送 oms ,当上面不注释时,需要将这个删除
|
||||||
|
pushOms(handoverTaskOrderId);
|
||||||
}
|
}
|
||||||
HandoverTaskOrder handoverTaskOrder = handoverTaskOrderService.getById(handoverTaskOrderIds.get(0));
|
HandoverTaskOrder handoverTaskOrder = handoverTaskOrderService.getById(handoverTaskOrderIds.get(0));
|
||||||
stockOutOrderService.update(null,new UpdateWrapper<StockOutOrder>().lambda().set(StockOutOrder::getBillingJson,handoverTaskOrderDO.getBillingJson()).eq(StockOutOrder::getOutOrderNumber,handoverTaskOrder.getOrderNumber()));
|
stockOutOrderService.update(null,new UpdateWrapper<StockOutOrder>().lambda().set(StockOutOrder::getBillingJson,handoverTaskOrderDO.getBillingJson()).eq(StockOutOrder::getOutOrderNumber,handoverTaskOrder.getOrderNumber()));
|
||||||
@@ -346,191 +388,271 @@ public class HandoverTaskOrderDomainService {
|
|||||||
if (stockOutOrder == null) {
|
if (stockOutOrder == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// // 需要报关(仅通宇+needDeclareFlag=1):交接时只改状态为「已交接(13)」,不扣库存/不推OMS,等海关确认放行后再处理
|
||||||
|
// if (isCustomsDeclareOrder(stockOutOrder)) {
|
||||||
|
// stockOutOrder.setStatus(13);
|
||||||
|
// stockOutOrderMapper.updateById(stockOutOrder);
|
||||||
|
// continue; // 跳过下方扣库存逻辑(B/C/D/E 全部延后到海关确认)
|
||||||
|
// }
|
||||||
|
// // 不需要报关:维持原逻辑,状态改「已出库(9)」+ 扣库存
|
||||||
|
|
||||||
//完成交接状态改为已出库
|
//完成交接状态改为已出库
|
||||||
stockOutOrder.setStatus(9);
|
stockOutOrder.setStatus(9);
|
||||||
stockOutOrderMapper.updateById(stockOutOrder);
|
stockOutOrderMapper.updateById(stockOutOrder);
|
||||||
List<OutMaterialDetail> outMaterialDetailList = outMaterialDetailMapper.selectList(new QueryWrapper<OutMaterialDetail>().lambda()
|
doStockOutDeduct(orderNumber, stockOutOrder, loginUser);
|
||||||
.eq(OutMaterialDetail::getOutOrderNumber, orderNumber)
|
}
|
||||||
.eq(OutMaterialDetail::getDelFlag, 1));
|
}
|
||||||
Integer review = stockOutOrder != null ? stockOutOrder.getReview() : null;
|
|
||||||
for (OutMaterialDetail outMaterialDetail : outMaterialDetailList) {
|
|
||||||
//oms详情同步
|
|
||||||
OMSWarehouseEntryDetails(outMaterialDetail);
|
|
||||||
if (outMaterialDetail.getCopyCodeReferenceIds() != null){
|
|
||||||
List<Integer> copyCodeReferenceIds = Arrays.stream(outMaterialDetail.getCopyCodeReferenceIds().split(","))
|
|
||||||
.map(Integer::parseInt).collect(Collectors.toList());
|
|
||||||
copyCodeReferenceService.lambdaUpdate()
|
|
||||||
.set(CopyCodeReference::getMaterialStatusCode, 3)
|
|
||||||
.set(CopyCodeReference::getMaterialStatusName, "已出库")
|
|
||||||
.in(CopyCodeReference::getId, copyCodeReferenceIds);
|
|
||||||
}
|
|
||||||
Long materialInventoryId = outMaterialDetail.getMaterialInventoryId();
|
|
||||||
// 复核什么扣减什么:需要复核用check_quantity,不需要复核用picking_quantity
|
|
||||||
BigDecimal effectiveQuantity = Integer.valueOf(1).equals(review)
|
|
||||||
? outMaterialDetail.getCheckQuantity()
|
|
||||||
: (outMaterialDetail.getPickingQuantity() != null ? outMaterialDetail.getPickingQuantity() : outMaterialDetail.getQuantity());
|
|
||||||
if (materialInventoryId == null || effectiveQuantity == null || effectiveQuantity.compareTo(BigDecimal.ZERO) <= 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
BigDecimal checkQuantity = effectiveQuantity;
|
|
||||||
BigDecimal checkArea = outMaterialDetail.getCheckArea();
|
|
||||||
BigDecimal checkVolume = outMaterialDetail.getCheckVolume();
|
|
||||||
BigDecimal checkGrossWeight = outMaterialDetail.getCheckGrossWeight();
|
|
||||||
BigDecimal checkNetWeight = outMaterialDetail.getCheckNetWeight();
|
|
||||||
|
|
||||||
// 初始化检查数据,避免空指针
|
/**
|
||||||
checkQuantity = checkQuantity != null ? checkQuantity : BigDecimal.ZERO;
|
* 出库扣减:同步OMS明细 + 联单状态 + 扣实物库存 + 推OMS库存
|
||||||
checkArea = checkArea != null ? checkArea : BigDecimal.ZERO;
|
* (从 xgkc 抽取,供「不需报关交接」和「海关确认」两处复用)
|
||||||
checkVolume = checkVolume != null ? checkVolume : BigDecimal.ZERO;
|
*/
|
||||||
checkGrossWeight = checkGrossWeight != null ? checkGrossWeight : BigDecimal.ZERO;
|
private void doStockOutDeduct(String orderNumber, StockOutOrder stockOutOrder, LoginUser loginUser) {
|
||||||
checkNetWeight = checkNetWeight != null ? checkNetWeight : BigDecimal.ZERO;
|
List<OutMaterialDetail> outMaterialDetailList = outMaterialDetailMapper.selectList(new QueryWrapper<OutMaterialDetail>().lambda()
|
||||||
|
.eq(OutMaterialDetail::getOutOrderNumber, orderNumber)
|
||||||
|
.eq(OutMaterialDetail::getDelFlag, 1));
|
||||||
|
Integer review = stockOutOrder.getReview();
|
||||||
|
for (OutMaterialDetail outMaterialDetail : outMaterialDetailList) {
|
||||||
|
// === 以下把原 L349-513 的循环体【原样】搬进来,一行不改 ===
|
||||||
|
// oms详情同步
|
||||||
|
OMSWarehouseEntryDetails(outMaterialDetail);
|
||||||
|
if (outMaterialDetail.getCopyCodeReferenceIds() != null) {
|
||||||
|
List<Integer> copyCodeReferenceIds = Arrays.stream(outMaterialDetail.getCopyCodeReferenceIds().split(","))
|
||||||
|
.map(Integer::parseInt).collect(Collectors.toList());
|
||||||
|
copyCodeReferenceService.lambdaUpdate()
|
||||||
|
.set(CopyCodeReference::getMaterialStatusCode, 3)
|
||||||
|
.set(CopyCodeReference::getMaterialStatusName, "已出库")
|
||||||
|
.in(CopyCodeReference::getId, copyCodeReferenceIds);
|
||||||
|
}
|
||||||
|
Long materialInventoryId = outMaterialDetail.getMaterialInventoryId();
|
||||||
|
BigDecimal effectiveQuantity = Integer.valueOf(1).equals(review)
|
||||||
|
? outMaterialDetail.getCheckQuantity()
|
||||||
|
: (outMaterialDetail.getPickingQuantity() != null ? outMaterialDetail.getPickingQuantity() : outMaterialDetail.getQuantity());
|
||||||
|
if (materialInventoryId == null || effectiveQuantity == null || effectiveQuantity.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BigDecimal checkQuantity = effectiveQuantity;
|
||||||
|
BigDecimal checkArea = outMaterialDetail.getCheckArea();
|
||||||
|
BigDecimal checkVolume = outMaterialDetail.getCheckVolume();
|
||||||
|
BigDecimal checkGrossWeight = outMaterialDetail.getCheckGrossWeight();
|
||||||
|
BigDecimal checkNetWeight = outMaterialDetail.getCheckNetWeight();
|
||||||
|
checkQuantity = checkQuantity != null ? checkQuantity : BigDecimal.ZERO;
|
||||||
|
checkArea = checkArea != null ? checkArea : BigDecimal.ZERO;
|
||||||
|
checkVolume = checkVolume != null ? checkVolume : BigDecimal.ZERO;
|
||||||
|
checkGrossWeight = checkGrossWeight != null ? checkGrossWeight : BigDecimal.ZERO;
|
||||||
|
checkNetWeight = checkNetWeight != null ? checkNetWeight : BigDecimal.ZERO;
|
||||||
|
|
||||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||||
|
if (materialInventoryPO != null) {
|
||||||
|
MaterialInventoryParamDO materialInventoryParamDO = new MaterialInventoryParamDO();
|
||||||
|
materialInventoryParamDO.setArea(checkArea);
|
||||||
|
materialInventoryParamDO.setVolume(checkVolume);
|
||||||
|
materialInventoryParamDO.setGrossWeight(checkGrossWeight);
|
||||||
|
materialInventoryParamDO.setNetWeight(checkNetWeight);
|
||||||
|
materialInventoryParamDO.setQuantity(checkQuantity);
|
||||||
|
materialInventoryParamDO.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||||
|
materialInventoryParamDO.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||||
|
materialInventoryParamDO.setLotNumber(outMaterialDetail.getLotNo());
|
||||||
|
materialInventoryParamDO.setBatchNumber(outMaterialDetail.getBatchNumber());
|
||||||
|
materialInventoryParamDO.setInOrderNumber(materialInventoryPO.getInOrderNumber());
|
||||||
|
materialInventoryParamDO.setProductionDate(materialInventoryPO.getProductionDate());
|
||||||
|
materialInventoryParamDO.setExpiryDate(materialInventoryPO.getExpiryDate());
|
||||||
|
materialInventoryParamDO.setType("4");
|
||||||
|
materialInventoryParamDO.setWarehouseId(materialInventoryPO.getWarehouseId());
|
||||||
|
|
||||||
//oms库存同步
|
MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO();
|
||||||
//OMSInventorySynchronization(outMaterialDetail,checkQuantity);
|
BeanUtils.copyProperties(materialInventoryParamDO, materialInventoryOmsParamDO);
|
||||||
if (materialInventoryPO != null) {
|
materialInventoryOmsParamDO.setKctzType("出库");
|
||||||
MaterialInventoryParamDO materialInventoryParamDO = new MaterialInventoryParamDO();
|
materialInventoryOmsParamDO.setLoginUser(loginUser);
|
||||||
//更新库存数量
|
if (stockOutOrder != null && !"yang_pin_chu_ku".equals(stockOutOrder.getBusinessType())) {
|
||||||
|
materialInventoryService.kctzjl(materialInventoryParamDO,"出库",loginUser);
|
||||||
// //库存数量
|
materialInventoryService.xgkc(materialInventoryParamDO);
|
||||||
// BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
//库存推送oms
|
||||||
// oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
|
||||||
// //可用数量
|
|
||||||
// BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
|
||||||
// oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
|
||||||
// //冻结数量(出库交接不变动冻结数量)
|
|
||||||
// BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
|
||||||
// oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
|
||||||
// //扣减后库存数量
|
|
||||||
// BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(checkQuantity);
|
|
||||||
// //扣减后可用数量
|
|
||||||
// BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(checkQuantity);
|
|
||||||
// BigDecimal newFreezeQuantity = oldFreezeQuantity;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// BigDecimal oldArea = materialInventoryPO.getArea();
|
|
||||||
// BigDecimal oldVolume = materialInventoryPO.getVolume();
|
|
||||||
// BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
|
||||||
// BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
|
||||||
//
|
|
||||||
// // 初始化旧数据,避免空指针
|
|
||||||
// oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
|
||||||
// oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
|
||||||
// oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
|
||||||
// oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
|
||||||
//
|
|
||||||
// BigDecimal newArea = oldArea.subtract(checkArea);
|
|
||||||
// BigDecimal newVolume = oldVolume.subtract(checkVolume);
|
|
||||||
// BigDecimal newGrossWeight = oldGrossWeight.subtract(checkGrossWeight);
|
|
||||||
// BigDecimal newNetWeight = oldNetWeight.subtract(checkNetWeight);
|
|
||||||
//
|
|
||||||
// materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
|
||||||
// materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
|
||||||
// materialInventoryPO.setFreezeQuantity(materialInventoryPO.getFreezeQuantity().subtract(outMaterialDetail.getCheckQuantity()) );
|
|
||||||
// materialInventoryPO.setArea(newArea);
|
|
||||||
// materialInventoryPO.setVolume(newVolume);
|
|
||||||
// materialInventoryPO.setGrossWeight(newGrossWeight);
|
|
||||||
// materialInventoryPO.setNetWeight(newNetWeight);
|
|
||||||
// MaterialInventory materialInventory = new MaterialInventory();
|
|
||||||
// BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
|
||||||
//materialInventoryMapper.updateById(materialInventory);
|
|
||||||
materialInventoryParamDO.setArea(checkArea);
|
|
||||||
materialInventoryParamDO.setVolume(checkVolume);
|
|
||||||
materialInventoryParamDO.setGrossWeight(checkGrossWeight);
|
|
||||||
materialInventoryParamDO.setNetWeight(checkNetWeight);
|
|
||||||
materialInventoryParamDO.setQuantity(checkQuantity);
|
|
||||||
materialInventoryParamDO.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
|
||||||
materialInventoryParamDO.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
|
||||||
materialInventoryParamDO.setLotNumber(outMaterialDetail.getLotNo());
|
|
||||||
materialInventoryParamDO.setBatchNumber(outMaterialDetail.getBatchNumber());
|
|
||||||
materialInventoryParamDO.setInOrderNumber(materialInventoryPO.getInOrderNumber());
|
|
||||||
materialInventoryParamDO.setProductionDate(materialInventoryPO.getProductionDate());
|
|
||||||
materialInventoryParamDO.setExpiryDate(materialInventoryPO.getExpiryDate());
|
|
||||||
materialInventoryParamDO.setType("4");
|
|
||||||
materialInventoryParamDO.setWarehouseId(materialInventoryPO.getWarehouseId());
|
|
||||||
|
|
||||||
//样品出库不修改库存
|
|
||||||
MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO();
|
|
||||||
BeanUtils.copyProperties(materialInventoryParamDO, materialInventoryOmsParamDO);
|
|
||||||
materialInventoryOmsParamDO.setKctzType("出库");
|
|
||||||
materialInventoryOmsParamDO.setLoginUser(loginUser);
|
|
||||||
HandoverTaskOrder h = handoverTaskOrderService.getById(handoverTaskOrderId);
|
|
||||||
String number = h.getOrderNumber();
|
|
||||||
StockOutOrder out = stockOutOrderService.getOne(new LambdaQueryWrapper<StockOutOrder>()
|
|
||||||
.eq(StockOutOrder::getOutOrderNumber, number)
|
|
||||||
.eq(StockOutOrder::getDelFlag, 1), false);
|
|
||||||
if (out != null && !"yang_pin_chu_ku".equals(out.getBusinessType())) {
|
|
||||||
materialInventoryService.kctzjl(materialInventoryParamDO,"出库",loginUser);
|
|
||||||
materialInventoryService.xgkc(materialInventoryParamDO);
|
|
||||||
//库存推送oms
|
|
||||||
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
|
|
||||||
}
|
|
||||||
|
|
||||||
//库存调整记录
|
|
||||||
// InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
|
||||||
// inventoryAdjustmentRecord.setAdjustAction("出库");
|
|
||||||
// inventoryAdjustmentRecord.setRelateNo(orderNumber);
|
|
||||||
// inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
|
||||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
|
||||||
// inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
|
||||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
|
||||||
//// inventoryAdjustmentRecord.setAdjustBeforeStatusCode("he_ge");
|
|
||||||
//// inventoryAdjustmentRecord.setAdjustBeforeStatusName("合格");
|
|
||||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
|
||||||
// inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
|
|
||||||
// inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
|
|
||||||
// inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
|
|
||||||
// if (inventoryAdjustmentRecord.getBarCode() == null || inventoryAdjustmentRecord.getBarCode().isEmpty()){
|
|
||||||
// getBarCode(materialInventoryPO, inventoryAdjustmentRecord);
|
|
||||||
// }
|
|
||||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
|
|
||||||
// inventoryAdjustmentRecord.setAdjustType(1L);
|
|
||||||
// inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
|
|
||||||
// inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
|
|
||||||
// inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
|
|
||||||
// inventoryAdjustmentRecord.setWarehouseCode(stockOutOrder.getWarehouseCode());
|
|
||||||
// inventoryAdjustmentRecord.setWarehouseName(stockOutOrder.getWarehouseName());
|
|
||||||
// inventoryAdjustmentRecord.setWarehouseId(stockOutOrder.getWarehouseId());
|
|
||||||
// inventoryAdjustmentRecord.setStorageCode(materialInventoryPO.getStorageCode());
|
|
||||||
// inventoryAdjustmentRecord.setStorageName(materialInventoryPO.getStorageName());
|
|
||||||
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
|
||||||
// inventoryAdjustmentRecord.setStorageLocationCode(materialInventoryPO.getStorageLocationCode());
|
|
||||||
// inventoryAdjustmentRecord.setStorageLocationName(materialInventoryPO.getStorageLocationName());
|
|
||||||
// inventoryAdjustmentRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
|
||||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
|
||||||
// inventoryAdjustmentRecord.setShipperId(stockOutOrder.getShipperId());
|
|
||||||
// inventoryAdjustmentRecord.setShipperName(stockOutOrder.getShipperName());
|
|
||||||
// inventoryAdjustmentRecord.setStorageSectionId(materialInventoryPO.getStorageSectionId());
|
|
||||||
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
|
||||||
// inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
|
||||||
// UserPo userPo = loginUser.getUserPo();
|
|
||||||
// if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
|
||||||
// inventoryAdjustmentRecord.setCreateTime(new Date());
|
|
||||||
// inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
|
||||||
// inventoryAdjustmentRecord.setAllocationAfterQuantity(oldAllocationQuantity);
|
|
||||||
// inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
|
||||||
// inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity.subtract(outMaterialDetail.getCheckQuantity()));//调整后 冻结-出库
|
|
||||||
// inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity);
|
|
||||||
// inventoryAdjustmentRecord.setInventoryAfterQuantity(newInventoryQuantity);
|
|
||||||
// // 调整前:库存数量(净重、毛重、体积、面积)
|
|
||||||
// inventoryAdjustmentRecord.setNetWeight(oldNetWeight);
|
|
||||||
// inventoryAdjustmentRecord.setGrossWeight(oldGrossWeight);
|
|
||||||
// inventoryAdjustmentRecord.setVolume(oldVolume);
|
|
||||||
// inventoryAdjustmentRecord.setArea(oldArea);
|
|
||||||
// // 调整后:库存数量 - 复核时填写的数量
|
|
||||||
// inventoryAdjustmentRecord.setAdjustedNetWeight(newNetWeight);
|
|
||||||
// inventoryAdjustmentRecord.setAdjustedGrossWeight(newGrossWeight);
|
|
||||||
// inventoryAdjustmentRecord.setAdjustedVolume(newVolume);
|
|
||||||
// inventoryAdjustmentRecord.setAdjustedArea(newArea);
|
|
||||||
//
|
|
||||||
// inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 定时任务入口:每小时整点扫描「已交接(13)」状态的需报关出库单,调 sendDec 查报关结果,
|
||||||
|
// * 放行/结关的 → 状态 13→9 + 扣库存 + 推OMS;未放行 → 跳过下次再查。
|
||||||
|
// * 由 @Scheduled 触发,无需在 sys_job 表配置。
|
||||||
|
// */
|
||||||
|
// @Scheduled(cron = "0 0 * * * ?")
|
||||||
|
// public void scheduledCustomsConfirm() {
|
||||||
|
// log.info("【报关确认出库】定时任务开始执行");
|
||||||
|
// try {
|
||||||
|
// AjaxResult result = customsConfirmOut(null);
|
||||||
|
// log.info("【报关确认出库】定时任务执行完成 result={}", result);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error("【报关确认出库】定时任务执行异常", e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 海关确认出库(轮询/手动入口)
|
||||||
|
// * 对 status=13(已交接)的需报关出库单,调 sendDec 查报关状态:
|
||||||
|
// * ✅ 放行/结关 → 状态 13→9 + 扣库存 + 推OMS
|
||||||
|
// * ❌ 退单 → 保持13,记告警
|
||||||
|
// * ⏳ 进行中 → 跳过,下次再查
|
||||||
|
// * @param outOrderNumbers 传空则扫全部 status=13;传值则按指定单号处理
|
||||||
|
// */
|
||||||
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
|
// public AjaxResult customsConfirmOut(List<String> outOrderNumbers) {
|
||||||
|
// // 1. 确定处理范围(只处理通宇、status=13 且需要报关的出库单)
|
||||||
|
// LambdaQueryWrapper<StockOutOrder> qw = new LambdaQueryWrapper<StockOutOrder>()
|
||||||
|
// .eq(StockOutOrder::getOrganizationId, TONGYU_ORGANIZATION_ID)
|
||||||
|
// .eq(StockOutOrder::getStatus, 13)
|
||||||
|
// .eq(StockOutOrder::getNeedDeclareFlag, "1");
|
||||||
|
// if (outOrderNumbers != null && !outOrderNumbers.isEmpty()) {
|
||||||
|
// qw.in(StockOutOrder::getOutOrderNumber, outOrderNumbers);
|
||||||
|
// }
|
||||||
|
// List<StockOutOrder> list = stockOutOrderService.list(qw);
|
||||||
|
//
|
||||||
|
// int pass = 0, pending = 0, fail = 0;
|
||||||
|
// LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
//
|
||||||
|
// for (StockOutOrder soo : list) {
|
||||||
|
// try {
|
||||||
|
// // 2. 调 sendDec 查报关状态
|
||||||
|
// JSONArray decData = queryCustomsDeclaration(
|
||||||
|
// soo.getOutOrderNumber(),
|
||||||
|
// soo.getOrganizationId(),
|
||||||
|
// soo.getOrganizationName());
|
||||||
|
// if (decData == null || decData.isEmpty()) {
|
||||||
|
// pending++; // ERP 里还没报关单,下次再查
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 3. 判断状态(遍历全部明细,任一命中放行即整单放行)
|
||||||
|
// String decStatus = null;
|
||||||
|
// boolean passed = false, failed = false;
|
||||||
|
// for (int i = 0; i < decData.size(); i++) {
|
||||||
|
// JSONObject item = decData.getJSONObject(i);
|
||||||
|
// decStatus = item.getString("dec_status");
|
||||||
|
// if (isInList(decStatus, CUSTOMS_PASS_STATUS)) {
|
||||||
|
// passed = true;
|
||||||
|
// // 报关单号写入 customs_declaration_detail(补全出库单关联)
|
||||||
|
// saveCustomsDetail(soo, item);
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// if (isInList(decStatus, CUSTOMS_FAIL_STATUS)) {
|
||||||
|
// failed = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (passed) {
|
||||||
|
// // ✅ 放行:状态 13→9 + 扣库存 + 推 OMS
|
||||||
|
// soo.setStatus(9);
|
||||||
|
// stockOutOrderMapper.updateById(soo);
|
||||||
|
// doStockOutDeduct(soo.getOutOrderNumber(), soo, loginUser);
|
||||||
|
// pushOmsByOrderNumber(soo.getOutOrderNumber());
|
||||||
|
// pass++;
|
||||||
|
// } else if (failed) {
|
||||||
|
// // ❌ 退单:保持13,记告警日志(暂留人工处理)
|
||||||
|
// log.warn("报关退单,请人工处理 outOrderNumber={} decStatus={}",
|
||||||
|
// soo.getOutOrderNumber(), decStatus);
|
||||||
|
// fail++;
|
||||||
|
// } else {
|
||||||
|
// pending++; // 进行中
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error("海关确认出库异常 outOrderNumber={}", soo.getOutOrderNumber(), e);
|
||||||
|
// fail++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Map<String, Object> r = new HashMap<>();
|
||||||
|
// r.put("pass", pass);
|
||||||
|
// r.put("pending", pending);
|
||||||
|
// r.put("fail", fail);
|
||||||
|
// return AjaxResult.success(r);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * sendDec 查询报关回写(参考 PickingOrderApplicationService.java:771-818 模板)
|
||||||
|
// * 关键改造:① erpBillNo 传出库单号 ② 返回整个 data 数组(不只第0条) ③ 不在这里处理 dec_status
|
||||||
|
// */
|
||||||
|
// private JSONArray queryCustomsDeclaration(String erpBillNo, Long organizationId, String organizationName) throws Exception {
|
||||||
|
// Map<String, Object> param = new HashMap<>();
|
||||||
|
// param.put("beginDate", "2020-01-01");
|
||||||
|
// param.put("endDate", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
|
||||||
|
// param.put("erpBillNo", erpBillNo);
|
||||||
|
// param.put("pageIndex", 1);
|
||||||
|
// param.put("pageSize", 100);
|
||||||
|
// List<Map<String, Object>> body = new ArrayList<>();
|
||||||
|
// body.add(param);
|
||||||
|
//
|
||||||
|
// // 多租户 URL(保证查的地址和推 save_order_e 的地址一致)
|
||||||
|
// String ncUrl = pickingMaterialDetailMapper.getNcUrl("gw", organizationName, organizationId);
|
||||||
|
// String url = (ncUrl != null) ? ncUrl : CUSTOMS_PUSH_API_URL;
|
||||||
|
//
|
||||||
|
// HttpPost post = new HttpPost(url);
|
||||||
|
// post.setEntity(new StringEntity(JSONObject.toJSONString(body), "UTF-8"));
|
||||||
|
// post.setHeader("Content-type", "application/json");
|
||||||
|
// post.setHeader("apiName", "sendDec");
|
||||||
|
// post.setHeader("verify", CUSTOMS_VERIFY);
|
||||||
|
// log.info("sendDec 请求 erpBillNo={} url={} body={}", erpBillNo, url,body);
|
||||||
|
//
|
||||||
|
// try (CloseableHttpClient client = HttpClients.createDefault();
|
||||||
|
// CloseableHttpResponse resp = client.execute(post)) {
|
||||||
|
// String respStr = EntityUtils.toString(resp.getEntity());
|
||||||
|
// log.info("sendDec 响应 erpBillNo={} resp={}", erpBillNo, respStr);
|
||||||
|
// if (resp.getStatusLine().getStatusCode() == 200) {
|
||||||
|
// JSONObject json = JSONObject.parseObject(respStr);
|
||||||
|
// Integer code = json.getInteger("code");
|
||||||
|
// if (code != null && code == 200) {
|
||||||
|
// return json.getJSONArray("data");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private boolean isInList(String v, String[] arr) {
|
||||||
|
// if (v == null) return false;
|
||||||
|
// for (String s : arr) {
|
||||||
|
// if (s.equalsIgnoreCase(v)) return true;
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 报关明细写入 customs_declaration_detail
|
||||||
|
// * (补 set outOrderNumber/outOrderId,原 PickingOrder 代码这两字段漏 set 了)
|
||||||
|
// */
|
||||||
|
// private void saveCustomsDetail(StockOutOrder soo, JSONObject item) {
|
||||||
|
// try {
|
||||||
|
// CustomsDeclarationDetailDO d = new CustomsDeclarationDetailDO();
|
||||||
|
// d.setDocumentNumber(soo.getOutOrderNumber());
|
||||||
|
// d.setBondInvtNo(item.getString("entry_id"));
|
||||||
|
// Object erpGNo = item.get("erp_g_no");
|
||||||
|
// if (erpGNo != null) {
|
||||||
|
// d.setInvtRow(erpGNo instanceof Number
|
||||||
|
// ? ((Number) erpGNo).intValue()
|
||||||
|
// : Integer.parseInt(erpGNo.toString()));
|
||||||
|
// }
|
||||||
|
// d.setOutOrderNumber(soo.getOutOrderNumber());
|
||||||
|
// d.setOutOrderId(soo.getOutOrderId());
|
||||||
|
// d.setOrganizationId(soo.getOrganizationId());
|
||||||
|
// d.setOrganizationName(soo.getOrganizationName());
|
||||||
|
// d.setTopOrganizationId(soo.getTopOrganizationId());
|
||||||
|
// customsDeclarationDetailService.insert(d);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error("写报关明细失败 outOrderNumber={}", soo.getOutOrderNumber(), e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /** 按 orderNumber 推 OMS(pushOms 入参是 handoverTaskOrderId,这里包一层) */
|
||||||
|
// private void pushOmsByOrderNumber(String orderNumber) {
|
||||||
|
// List<HandoverTaskOrder> htoList = handoverTaskOrderService.list(
|
||||||
|
// new LambdaQueryWrapper<HandoverTaskOrder>()
|
||||||
|
// .eq(HandoverTaskOrder::getOrderNumber, orderNumber));
|
||||||
|
// for (HandoverTaskOrder hto : htoList) {
|
||||||
|
// pushOms(hto.getHandoverTaskOrderId());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
private void OMSInventorySynchronization(OutMaterialDetail outMaterialDetail,BigDecimal checkQuantity) {
|
private void OMSInventorySynchronization(OutMaterialDetail outMaterialDetail,BigDecimal checkQuantity) {
|
||||||
outMaterialDetail.getLotNo();
|
outMaterialDetail.getLotNo();
|
||||||
outMaterialDetail.getInOrderNumber();
|
outMaterialDetail.getInOrderNumber();
|
||||||
|
|||||||
+6
@@ -3,6 +3,7 @@ package com.mhd.wms.domain.inMaterialDetail.repository.facade;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
|
import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
|
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
|
||||||
|
import com.mhd.wms.domain.inMaterialDetail.repository.po.InStockListMaterialAgg;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailBaseDO;
|
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailBaseDO;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
|
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
|
||||||
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
|
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
|
||||||
@@ -31,6 +32,11 @@ public interface IInMaterialDetailService extends IService<InMaterialDetail>
|
|||||||
*/
|
*/
|
||||||
public List<InMaterialDetailPO> queryListChildren(InMaterialDetailDO inMaterialDetailDO);
|
public List<InMaterialDetailPO> queryListChildren(InMaterialDetailDO inMaterialDetailDO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库列表页:按入库单号批量取去重后的 Invoice No(仅 level=1)
|
||||||
|
*/
|
||||||
|
List<InStockListMaterialAgg> selectDistinctInvoiceNoForStockInList(List<String> inOrderNumbers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增物料明细
|
* 新增物料明细
|
||||||
*/
|
*/
|
||||||
|
|||||||
+7
@@ -3,8 +3,10 @@ package com.mhd.wms.domain.inMaterialDetail.repository.mapper;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
|
import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
|
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
|
||||||
|
import com.mhd.wms.domain.inMaterialDetail.repository.po.InStockListMaterialAgg;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
|
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
|
||||||
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
|
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -26,4 +28,9 @@ public interface InMaterialDetailMapper extends BaseMapper<InMaterialDetail>
|
|||||||
*/
|
*/
|
||||||
public List<InMaterialDetailPO> queryInOrderList(QueryOrderOverStockDO queryOrderOverStockDO);
|
public List<InMaterialDetailPO> queryInOrderList(QueryOrderOverStockDO queryOrderOverStockDO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库列表页:按入库单号批量取去重后的 Invoice No(仅 level=1)
|
||||||
|
*/
|
||||||
|
List<InStockListMaterialAgg> selectDistinctInvoiceNoForStockInList(@Param("inOrderNumbers") List<String> inOrderNumbers);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+10
@@ -14,6 +14,7 @@ import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
|
|||||||
import com.mhd.wms.domain.inMaterialDetail.repository.facade.IInMaterialDetailService;
|
import com.mhd.wms.domain.inMaterialDetail.repository.facade.IInMaterialDetailService;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.mapper.InMaterialDetailMapper;
|
import com.mhd.wms.domain.inMaterialDetail.repository.mapper.InMaterialDetailMapper;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
|
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
|
||||||
|
import com.mhd.wms.domain.inMaterialDetail.repository.po.InStockListMaterialAgg;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailBaseDO;
|
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailBaseDO;
|
||||||
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
|
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
|
||||||
import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService;
|
import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService;
|
||||||
@@ -26,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -86,6 +88,14 @@ public class InMaterialDetailImpl extends ServiceImpl<InMaterialDetailMapper, In
|
|||||||
return inMaterialDetailPOParentList;
|
return inMaterialDetailPOParentList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<InStockListMaterialAgg> selectDistinctInvoiceNoForStockInList(List<String> inOrderNumbers) {
|
||||||
|
if (CollectionUtils.isEmpty(inOrderNumbers)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return inMaterialDetailMapper.selectDistinctInvoiceNoForStockInList(inOrderNumbers);
|
||||||
|
}
|
||||||
|
|
||||||
private List<InMaterialDetailPO> getChildren(Long parentUniqueId, List<InMaterialDetailPO> inMaterialDetailPOList, Integer maxLevel){
|
private List<InMaterialDetailPO> getChildren(Long parentUniqueId, List<InMaterialDetailPO> inMaterialDetailPOList, Integer maxLevel){
|
||||||
List<InMaterialDetailPO> childrenCityList = inMaterialDetailPOList.stream().filter(materialDetailPO -> parentUniqueId.equals(materialDetailPO.getParentUniqueId())).collect(Collectors.toList());
|
List<InMaterialDetailPO> childrenCityList = inMaterialDetailPOList.stream().filter(materialDetailPO -> parentUniqueId.equals(materialDetailPO.getParentUniqueId())).collect(Collectors.toList());
|
||||||
if (!CollectionUtils.isEmpty(childrenCityList)){
|
if (!CollectionUtils.isEmpty(childrenCityList)){
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package com.mhd.wms.domain.inMaterialDetail.repository.po;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库列表页批量取去重后的 Invoice No。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class InStockListMaterialAgg {
|
||||||
|
private String inOrderNumber;
|
||||||
|
private String invoiceNo;
|
||||||
|
}
|
||||||
+7
-4
@@ -1,9 +1,6 @@
|
|||||||
package com.mhd.wms.domain.materialBaseInfo.entity;
|
package com.mhd.wms.domain.materialBaseInfo.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.mhd.common.core.annotation.Excel;
|
import com.mhd.common.core.annotation.Excel;
|
||||||
import com.mhd.common.core.handler.ListTypeHandler;
|
import com.mhd.common.core.handler.ListTypeHandler;
|
||||||
@@ -47,14 +44,17 @@ public class MaterialBaseInfo extends BaseVOEntity {
|
|||||||
|
|
||||||
@ApiModelProperty("货主id")
|
@ApiModelProperty("货主id")
|
||||||
@Excel(name = "货主id")
|
@Excel(name = "货主id")
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
private Long shipperId;
|
private Long shipperId;
|
||||||
|
|
||||||
@ApiModelProperty("货主编码")
|
@ApiModelProperty("货主编码")
|
||||||
@Excel(name = "货主编码")
|
@Excel(name = "货主编码")
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
private String shipperCode;
|
private String shipperCode;
|
||||||
|
|
||||||
@ApiModelProperty("货主名称")
|
@ApiModelProperty("货主名称")
|
||||||
@Excel(name = "货主名称")
|
@Excel(name = "货主名称")
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
private String shipperName;
|
private String shipperName;
|
||||||
|
|
||||||
@ApiModelProperty("物料编码")
|
@ApiModelProperty("物料编码")
|
||||||
@@ -240,4 +240,7 @@ public class MaterialBaseInfo extends BaseVOEntity {
|
|||||||
@ApiModelProperty(name = "组织(多个用,分开)")
|
@ApiModelProperty(name = "组织(多个用,分开)")
|
||||||
private String orgId;
|
private String orgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
|
||||||
|
private Integer isNormalMaterial;
|
||||||
|
|
||||||
}
|
}
|
||||||
+3
@@ -289,4 +289,7 @@ public class MaterialBaseInfoPO extends BaseVOEntity {
|
|||||||
|
|
||||||
@ApiModelProperty(name = "组织(多个用,分开)")
|
@ApiModelProperty(name = "组织(多个用,分开)")
|
||||||
private String orgId;
|
private String orgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
|
||||||
|
private Integer isNormalMaterial;
|
||||||
}
|
}
|
||||||
+3
@@ -262,4 +262,7 @@ public class MaterialBaseInfoDO extends BaseVOEntity {
|
|||||||
|
|
||||||
@ApiModelProperty(name = "组织(多个用,分开)")
|
@ApiModelProperty(name = "组织(多个用,分开)")
|
||||||
private String orgId;
|
private String orgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
|
||||||
|
private Integer isNormalMaterial;
|
||||||
}
|
}
|
||||||
+5
@@ -41,6 +41,11 @@ public interface IOutMaterialDetailService extends IService<OutMaterialDetail>
|
|||||||
*/
|
*/
|
||||||
List<OutStockListMaterialAgg> selectAggregatesForStockOutList(List<String> outOrderNumbers);
|
List<OutStockListMaterialAgg> selectAggregatesForStockOutList(List<String> outOrderNumbers);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库列表页:按出库单号批量取去重后的 Invoice No(仅 level=1)
|
||||||
|
*/
|
||||||
|
List<OutStockListMaterialAgg> selectDistinctInvoiceNoForStockOutList(List<String> outOrderNumbers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增物料明细
|
* 新增物料明细
|
||||||
*/
|
*/
|
||||||
|
|||||||
+5
@@ -60,4 +60,9 @@ public interface OutMaterialDetailMapper extends BaseMapper<OutMaterialDetail>
|
|||||||
* 出库列表页:按出库单号批量聚合(仅 level=1)
|
* 出库列表页:按出库单号批量聚合(仅 level=1)
|
||||||
*/
|
*/
|
||||||
List<OutStockListMaterialAgg> selectAggregatesForStockOutList(@Param("outOrderNumbers") List<String> outOrderNumbers);
|
List<OutStockListMaterialAgg> selectAggregatesForStockOutList(@Param("outOrderNumbers") List<String> outOrderNumbers);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库列表页:按出库单号批量取去重后的 Invoice No(仅 level=1)
|
||||||
|
*/
|
||||||
|
List<OutStockListMaterialAgg> selectDistinctInvoiceNoForStockOutList(@Param("outOrderNumbers") List<String> outOrderNumbers);
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-4
@@ -130,6 +130,14 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
|
|||||||
return outMaterialDetailMapper.selectAggregatesForStockOutList(outOrderNumbers);
|
return outMaterialDetailMapper.selectAggregatesForStockOutList(outOrderNumbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OutStockListMaterialAgg> selectDistinctInvoiceNoForStockOutList(List<String> outOrderNumbers) {
|
||||||
|
if (CollectionUtils.isEmpty(outOrderNumbers)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return outMaterialDetailMapper.selectDistinctInvoiceNoForStockOutList(outOrderNumbers);
|
||||||
|
}
|
||||||
|
|
||||||
private List<OutMaterialDetailPO> getChildren(Long parentUniqueId, List<OutMaterialDetailPO> materialDetailPOList, Integer maxLevel){
|
private List<OutMaterialDetailPO> getChildren(Long parentUniqueId, List<OutMaterialDetailPO> materialDetailPOList, Integer maxLevel){
|
||||||
List<OutMaterialDetailPO> childrenCityList = materialDetailPOList.stream().filter(materialDetailPO -> parentUniqueId.equals(materialDetailPO.getParentUniqueId())).collect(Collectors.toList());
|
List<OutMaterialDetailPO> childrenCityList = materialDetailPOList.stream().filter(materialDetailPO -> parentUniqueId.equals(materialDetailPO.getParentUniqueId())).collect(Collectors.toList());
|
||||||
if (!CollectionUtils.isEmpty(childrenCityList)){
|
if (!CollectionUtils.isEmpty(childrenCityList)){
|
||||||
@@ -400,7 +408,7 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
|
|||||||
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
|
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
|
||||||
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
|
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
|
||||||
.eq(StockOutOrder::getDelFlag, 1));
|
.eq(StockOutOrder::getDelFlag, 1));
|
||||||
if (!CollectionUtils.isEmpty(stockOutOrderList) && "yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
|
if (!CollectionUtils.isEmpty(stockOutOrderList) && !"yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
|
||||||
xgkc(outMaterialDetailList,outOrderNumber,loginUser);
|
xgkc(outMaterialDetailList,outOrderNumber,loginUser);
|
||||||
}
|
}
|
||||||
//保存物料明细信息
|
//保存物料明细信息
|
||||||
@@ -535,7 +543,7 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
|
|||||||
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
|
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
|
||||||
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
|
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
|
||||||
.eq(StockOutOrder::getDelFlag, 1));
|
.eq(StockOutOrder::getDelFlag, 1));
|
||||||
if (!CollectionUtils.isEmpty(stockOutOrderList) && "yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
|
if (!CollectionUtils.isEmpty(stockOutOrderList) && !"yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
|
||||||
qxfp(outMaterialDetailDOList,outOrderNumber,loginUser);
|
qxfp(outMaterialDetailDOList,outOrderNumber,loginUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -979,7 +987,7 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
|
|||||||
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
|
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
|
||||||
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
|
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
|
||||||
.eq(StockOutOrder::getDelFlag, 1));
|
.eq(StockOutOrder::getDelFlag, 1));
|
||||||
if (!CollectionUtils.isEmpty(stockOutOrderList) && "yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
|
if (!CollectionUtils.isEmpty(stockOutOrderList) && !"yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
|
||||||
qxfp(outMaterialDetailDOList,outOrderNumber,loginUser);
|
qxfp(outMaterialDetailDOList,outOrderNumber,loginUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1088,7 +1096,7 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
|
|||||||
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
|
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
|
||||||
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
|
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
|
||||||
.eq(StockOutOrder::getDelFlag, 1));
|
.eq(StockOutOrder::getDelFlag, 1));
|
||||||
if (!CollectionUtils.isEmpty(stockOutOrderList) && "yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
|
if (!CollectionUtils.isEmpty(stockOutOrderList) && !"yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
|
||||||
childrenqxfp(children,outOrderNumber,loginUser);
|
childrenqxfp(children,outOrderNumber,loginUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -13,4 +13,6 @@ public class OutStockListMaterialAgg {
|
|||||||
private BigDecimal totalOutboundQuantity;
|
private BigDecimal totalOutboundQuantity;
|
||||||
private BigDecimal checkQuantitySum;
|
private BigDecimal checkQuantitySum;
|
||||||
private Integer materialKindCountDistinct;
|
private Integer materialKindCountDistinct;
|
||||||
|
/** 列表页展示用:该出库单的 Invoice No */
|
||||||
|
private String invoiceNo;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -870,7 +870,7 @@ public class PickingOrderDomainService {
|
|||||||
handoverTaskOrderDO.setShipperId(pickingOrderPO.getShipperId());
|
handoverTaskOrderDO.setShipperId(pickingOrderPO.getShipperId());
|
||||||
handoverTaskOrderDO.setShipperName(pickingOrderPO.getShipperName());
|
handoverTaskOrderDO.setShipperName(pickingOrderPO.getShipperName());
|
||||||
handoverTaskOrderDO.setSerialNumber(OrderSequence.getOrderCode("JJZYLS"));
|
handoverTaskOrderDO.setSerialNumber(OrderSequence.getOrderCode("JJZYLS"));
|
||||||
handoverTaskOrderDO.setTaskNumber(OrderSequence.getOrderCode("JJZY"));
|
handoverTaskOrderDO.setTaskNumber("HD-"+pickingOrderPO.getOutOrderNumber());
|
||||||
handoverTaskOrderDO.setStatus(1);
|
handoverTaskOrderDO.setStatus(1);
|
||||||
handoverTaskOrderDO.setOrderTypeCode(pickingOrderPO.getOrderTypeCode());
|
handoverTaskOrderDO.setOrderTypeCode(pickingOrderPO.getOrderTypeCode());
|
||||||
handoverTaskOrderDO.setOrderTypeName(pickingOrderPO.getOrderTypeName());
|
handoverTaskOrderDO.setOrderTypeName(pickingOrderPO.getOrderTypeName());
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user