Author SHA1 Message Date
王奎兴 624b7d7d6e 发测试; 2026-08-20 09:05:10 +08:00
王奎兴 0b61b813a5 Merge branch 'dev' into dev_820 2026-08-20 09:03:05 +08:00
zhaoqing 6252866f7c fix(oms):明细表保额货物类型 2026-08-19 15:29:09 +08:00
zhaoqing 15c8a2b6e6 fix(wms):明细表入库时间 2026-08-19 09:14:44 +08:00
王奎兴 4b434a2cd2 Merge branch 'refs/heads/dev' into dev_820 2026-08-18 16:36:28 +08:00
王奎兴 0376f8328c 无货主流程; 2026-08-18 16:35:33 +08:00
王奎兴 58e3882ef4 添加修改物料去除货主校验; 2026-08-18 10:20:26 +08:00
王奎兴 1d96322370 添加修改物料去除货主校验; 2026-08-18 09:53:30 +08:00
zhaoqing 19857686aa fix(system):货主租赁明细定时任务开启 发30 2026-08-14 20:28:25 +08:00
王奎兴 d079e35374 发30 2026-08-14 19:25:03 +08:00
王奎兴 466a9fa31f 发31 2026-08-14 18:54:02 +08:00
zhaoqing d74a28bceb fix(oms):运输执行单排序查询报错 2026-08-14 18:21:18 +08:00
zhaoqing 1cc123917b fix(oms):运输执行单排序 2026-08-14 17:38:34 +08:00
rcx 39ebcb70ed wip(wms): 出库报关流程暂时搁置,注释相关代码恢复原出库交接流程 2026-08-14 16:53:22 +08:00
rcx e7e64252e7 feat(wms): 出库报关流程增加通宇组织限制,仅通宇(2830)启用报关判断 2026-08-14 16:38:48 +08:00
zhaoqing a400a34b0c fix(wms):出入库复制新增时清空数量相关数据 2026-08-14 16:35:29 +08:00
zhaoqing ac349ea8a8 fix(wms):出入库复制新增时清空数量相关数据 2026-08-14 15:55:28 +08:00
rcx 7356208228 发测试 2026-08-14 15:30:04 +08:00
rcx 5963f6ed3a fix(oms) : 运输管理 - 运输业务单 - 反审核订单 : 优化异常提示信息 2026-08-14 14:49:13 +08:00
王奎兴 6f28cfdda0 Merge branch 'dev' into dev-ty1.2 2026-08-14 14:40:20 +08:00
王奎兴 5c472ad04e 分配逻辑; 2026-08-14 14:39:20 +08:00
王奎兴 070cdcd5de 仓码820 2026-08-14 14:36:46 +08:00
zhaoqing 061c5bc600 fix(wms):出入库复制新增时清空数量相关数据 2026-08-14 14:08:41 +08:00
zhaoqing e5fea50466 fix(wms):修改导出 2026-08-14 11:36:08 +08:00
rcx 6a87c5a75a fix(oms): 预约入库单列表接口补充申报数量字段
reservationStockInOrderApi/list 返回缺少申报数量,原因为查询只查主表、
未关联明细表汇总,且返回对象无对应字段

- ReservationStockInOrderPO 新增 declaredQuantity 字段
- StockInOrderResult resultMap 增加 declaredQuantity 映射
- selectStockInOrderPo 片段增加 reservation_in_material_detail
  的 DECLARED_QUANTITY 汇总子查询(按 level=1 过滤主明细行)
2026-08-14 11:02:18 +08:00
zhaoqing 63dcfaf028 fix(wms):复制新增修复 2026-08-14 09:39:41 +08:00
zhaoqing c80e4b3ca3 fix(wms):尺寸赋值修改 2026-08-13 18:08:49 +08:00
rcx 3240e57c3e fix(lease): 修复仓库出租率导出总面积、日租率计算错误
导出时总面积被算成全系统所有仓库库区面积之和(6168),日租率因此也错误(0.16)。
根因:导出方法调用 warehouseOccupancyRate(),该方法在不传 warehouseId 时
totalArea 会累加所有仓库面积。

- 导出方法不再调用 warehouseOccupancyRate(),改为自行按(业务日期+仓库)维度计算
- 总面积按仓库单独累加库区面积(通宇关务测试仓库 100,不再 6168)
- 整租/散租面积按(日期+仓库)聚合
- 日租率 = (整租+散租)/该仓库总面积×100,直接输出百分比(10.00)
- 增加总面积为0的除零保护
- 查询接口 warehouseOccupancyRate() 不受影响
2026-08-13 17:43:44 +08:00
rcx e35fa7d48e Merge remote-tracking branch 'origin/dev-ty1.2' into dev-ty1.2 2026-08-13 17:21:21 +08:00
rcx d5bdb5b419 feat(oms): 运输业务单新增反审核功能
审核通过后支持反审核,恢复订单到待审核状态以便修改
- 新增 /businessDocumentOrderApi/cancelAudit 接口
- 仅"审核通过(reviewStatus=1)"且未生成执行单的订单允许反审核
- 拆单主单反审核时级联清理生成的子单、子单地址及配送明细回填
2026-08-13 17:20:41 +08:00
王奎兴 fd1436da9c Merge branch 'dev' into dev-ty1.2
# Conflicts:
#	mhd_wms/src/main/java/com/mhd/wms/domain/handoverTaskOrder/service/HandoverTaskOrderDomainService.java
#	mhd_wms/src/main/java/com/mhd/wms/domain/stockInOrder/repository/todo/StockInOrderDO.java
#	mhd_wms/src/main/java/com/mhd/wms/domain/stockOutOrder/repository/todo/StockOutOrderDO.java
#	mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/stockInOrder/StockInOrderDTO.java
#	mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/stockOutOrder/StockOutOrderDTO.java
2026-08-13 16:46:09 +08:00
rcx 802a2994cc Merge remote-tracking branch 'origin/dev-ty1.2' into dev-ty1.2 2026-08-13 15:07:03 +08:00
rcx 3d3036cebf feat(wms): 出库报关流程改造
1. 交接环节增加 needDeclareFlag 判断:需报关单置为「已交接(13)」不扣库存,
   不需报关单维持原逻辑直接「已出库(9)」扣库存。
2. 新增定时任务每小时调 sendDec 查报关结果,dec_status=P(海关已放行) 时
   状态 13→9 并扣库存+推OMS。
3. 新增 /stockOutOrderApi/customsConfirmOut 接口支持人工触发报关确认出库。
4. 出库单状态枚举新增 13-已交接。
5. WMS 启动类新增 @EnableScheduling 开启定时任务支持。
2026-08-13 15:06:08 +08:00
zhaoqing 123a5af241 fix(oms):运输业务单排序 2026-08-13 14:15:03 +08:00
zhaoqing da31a81415 fix(oms):复制新增报错 2026-08-13 13:54:20 +08:00
zhaoqing 84d4df0809 fix(system):修改单位返回值逻辑 2026-08-13 10:31:49 +08:00
zhaoqing d17146dc4b fix(oms):运输业务单排序 2026-08-13 10:03:39 +08:00
zhaoqing 44e9eb47bc fix(system):单位返回值修改 2026-08-12 18:34:35 +08:00
rcx bc9a4f7204 Merge remote-tracking branch 'origin/dev-ty1.2' into dev-ty1.2 2026-08-12 18:18:09 +08:00
rcx b37edf7c63 feat(oms): 业务单号改为yyMMdd+每日序号(每日重置,对齐TMS长度)
对应需求#072703,单号规则:年月日001,后面001每天重置
2026-08-12 18:17:29 +08:00
zhaoqing f6125e68bf fix(bms):sql 2026-08-12 18:04:51 +08:00
zhaoqing d6037d5846 fix(bms):单位 数量 单价 2026-08-12 18:01:34 +08:00
zhaoqing df51abe33f fix(wms):total_volume,total_area字段可为空 2026-08-12 17:53:31 +08:00
zhaoqing 5cf46604fa feat(system):查询信息根据编码和组织ID 2026-08-12 16:44:47 +08:00
王奎兴 208024a6cc Merge remote-tracking branch 'origin/dev' into dev 2026-08-12 15:20:46 +08:00
王奎兴 1d01431354 货主账号查询入库业务单报错处理; 2026-08-12 15:20:36 +08:00
高正杨 cbaab0ffee 收货上架单号规则; 2026-08-12 15:09:13 +08:00
王奎兴 a310c9dfa6 Merge remote-tracking branch 'origin/dev' into dev 2026-08-12 14:02:09 +08:00
王奎兴 3866bfee05 生成单号规则处理;+ 2026-08-12 14:01:56 +08:00
zhaoqing 5032cf2413 fix(bms):收款时间查询 2026-08-12 11:40:13 +08:00
zhaoqing a10cfb0f55 fix(bms):收款设置收款时间 2026-08-12 10:19:57 +08:00
秦鸿展 59ede5ceb7 31 2026-08-12 00:04:33 +08:00
秦鸿展 de4d4fa70d 30 2026-08-12 00:00:43 +08:00
秦鸿展 7e496834ae 30 2026-08-11 23:16:20 +08:00
秦鸿展 300b5ac239 角色信息分配错误 2026-08-11 23:11:25 +08:00
秦鸿展 9519d8610b 31 2026-08-11 18:20:37 +08:00
秦鸿展 064a87e751 委托方导入修改 2026-08-11 18:15:58 +08:00
rcx 9e2dc508a8 feat(lease): 新增仓库出租率及客户租赁明细导出功能
- 新增 WarehouseLeaseExportVO(10列:仓库/业务日期/整租面积/散租面积/总面积/日租率/组织/货主/租赁方式/租赁面积)
- LeaseApplicationService 新增 exportOccupancyRate 方法,复用出租率与明细查询,按日期+仓库映射拼接汇总列
- ShipperLeaseDetailsApi 新增 GET /export 接口,入参与查询接口一致,使用项目通用 ExcelUtil 导出
- 业务日期按降序排序,日期格式 yyyy-MM-dd
对应需求:仓库出租率 - 增加导出功能(出租率+客户租赁明细)
2026-08-11 18:05:00 +08:00
rcx 6a84abf6dd feat(system模块lease): 租赁管理增加停用功能,停用后不参与出租率计算
- LEASE 表新增 status 字段(1=启用,0=停用)
- Lease/LeasePO/LeaseDO/LeaseDTO 新增 status 字段
- LeaseMapper.xml 增加 status 查询字段与过滤条件
- 新增 LeaseApi.updateStatus 接口(PUT /updateStatus/{leaseIds}/{status})
- 出租率计算(shipperLeaseDetails)过滤 status=1,停用租赁不再生成出租率数据
一个SQL文件,增加了一个字段,在测试和生产环境都需要执行
对应需求:仓库出租率 - 租赁管理增加停用功能
2026-08-11 18:03:09 +08:00
zhaoqing 8b4e785de3 fix(wms):出入库查询和导出修改 2026-08-11 17:46:49 +08:00
赵辉 c95fdfc067 委托方查询修改 2026-08-11 11:50:40 +08:00
zhaoqing 40a906a9fb fix(system):修改库区库位查询 添加nullify条件 2026-08-11 11:07:40 +08:00
rcx d91aadca0b feat(oms): 入仓委托单「下发到WMS」功能开发
实现 issueOrder 下发逻辑,推送主单与明细至 WMS;增加已审核校验、防重复下发、仓库必填校验
2026-08-11 09:16:28 +08:00
王奎兴 898cc32452 发测30 2026-08-11 02:03:10 +08:00
王奎兴 6cf2a8bc74 发测31 2026-08-11 02:01:20 +08:00
王奎兴 bce9969589 发测30 2026-08-11 01:58:44 +08:00
王奎兴 b73eb84b87 发测30 2026-08-10 22:32:58 +08:00
王奎兴 7d0d24ea77 发测31 2026-08-10 22:26:36 +08:00
秦鸿展 dd5280ab78 30 2026-08-10 21:51:08 +08:00
秦鸿展 bc6b2ba777 BI月台动态真实数据 2026-08-10 21:20:35 +08:00
秦鸿展 f58691615b BI月台动态真实数据 2026-08-10 21:01:04 +08:00
王奎兴 15fdace0bc 发测试 2026-08-10 20:59:25 +08:00
王奎兴 0904b78846 调整备注无效修改; 2026-08-10 20:56:12 +08:00
秦鸿展 734b51bfec BI月台动态真实数据 2026-08-10 20:10:54 +08:00
王奎兴 784d04ebec Merge remote-tracking branch 'origin/dev' into dev 2026-08-10 20:04:08 +08:00
王奎兴 b29632cebc 发30 2026-08-10 20:03:59 +08:00
秦鸿展 3211cfe892 Merge remote-tracking branch 'origin/dev' into dev 2026-08-10 20:00:38 +08:00
秦鸿展 32e8be5363 BI月台动态真实数据 2026-08-10 20:00:20 +08:00
王奎兴 207734c75e 发31 2026-08-10 20:00:10 +08:00
秦鸿展 8eb280f2b9 BI月台动态真实数据 2026-08-10 19:58:05 +08:00
120 changed files with 2333 additions and 799 deletions
@@ -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 {
/** /**
@@ -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-审核通过")
@@ -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;
}
}
} }
@@ -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())
@@ -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();
@@ -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();
@@ -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;
+2 -2
View File
@@ -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>
@@ -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
@@ -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);
@@ -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;
} }
} }
@@ -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);
@@ -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);
@@ -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
@@ -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;
} }
@@ -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;
} }
@@ -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;
} }
@@ -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;
} }
@@ -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));
}
} }
@@ -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;
} }
@@ -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;
} }
@@ -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;
} }
@@ -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;
} }
@@ -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;
} }
@@ -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;
// ===== 以下为仓库当日汇总列(同一仓库同一天的多行会重复,属正常)=====
}
@@ -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());
}
} }
@@ -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));
}
} }
@@ -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 &lt;= #{time} AND a.start_date &lt;= #{time}
AND a.end_date &gt;= #{time} AND a.end_date &gt;= #{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>
@@ -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
@@ -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;
} }
@@ -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;
} }
+4 -4
View File
@@ -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"/>
@@ -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);
} }
@@ -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);
@@ -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);
} }
@@ -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) {
@@ -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);
} }
@@ -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自动扩位)
* 示例: 2608040012608049992608041000
*/
@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);
}
}
@@ -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;
} }
@@ -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;
} }
@@ -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;
/** /**
* 计划入库数量取入库单明细中的入库数量汇总 * 计划入库数量取入库单明细中的入库数量汇总
*/ */
@@ -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的入库单
@@ -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() + "]已下发,不可重复下发");
}
// 校验3WMS 必填字段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);
@@ -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);
} }
//设置物料信息 //设置物料信息
@@ -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;
} }
@@ -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();
@@ -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);
// //统计总物料种数 // //统计总物料种数
@@ -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;
} }
@@ -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;
} }
@@ -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;
} }
@@ -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;
} }
@@ -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
* @ExcelIgnoreLong类型字段若被自动映射到非数字列会抛出ExcelDataConvertException
*/
@ExcelIgnore
private Long materialInventoryId;
@ExcelIgnore
private Long materialBaseInfoId;
} }
@@ -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();
@@ -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
@@ -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);
}
/** /**
* 生成出库预约单号 * 生成出库预约单号
*/ */
@@ -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));
}
/** /**
* 批量执行业务单 * 批量执行业务单
*/ */
@@ -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文件批量导入按名称匹配基础数据
*/ */
@@ -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) &lt;= 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}
@@ -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}
@@ -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,
@@ -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"
@@ -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执行库存扣减+交接状态更新
@@ -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 = "";
// 方式1Stream拼接逗号分隔 if (listNc != null && listNc.size() > 0) {
codeStr = listNc.stream() // 方式1Stream拼接逗号分隔
.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>>>() {}
// 方式1Stream拼接逗号分隔 );
codeStr = listNc.stream() String codeStr = "";
.map(map -> map.get("code")) if (listNc != null && listNc.size() > 0) {
.filter(Objects::nonNull) // 过滤code为空 // 方式1Stream拼接逗号分隔
.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
*/ */
@@ -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);
} }
} }
} }
@@ -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);
@@ -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);
@@ -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);
@@ -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 查报关结果
// * 放行/结关的 状态 139 + 扣库存 + 推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 查报关状态
// * 放行/结关 状态 139 + 扣库存 + 推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) {
// // 放行状态 139 + 扣库存 + 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 推 OMSpushOms 入参是 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();
@@ -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);
/** /**
* 新增物料明细 * 新增物料明细
*/ */
@@ -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);
} }
@@ -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)){
@@ -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;
}
@@ -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;
} }
@@ -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;
} }
@@ -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;
} }
@@ -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);
/** /**
* 新增物料明细 * 新增物料明细
*/ */
@@ -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);
} }
@@ -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);
} }
} }
@@ -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;
} }
@@ -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