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
This commit is contained in:
Binary file not shown.
@@ -18,7 +18,7 @@ import java.util.Set;
|
||||
/**
|
||||
* bms财务结算系统feign调用接口
|
||||
*/
|
||||
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface BmsServiceFeign {
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface OmsServiceFeign {
|
||||
|
||||
|
||||
@@ -66,4 +66,8 @@ public interface OmsServiceFeign {
|
||||
@ApiOperation("批量推送")
|
||||
@PostMapping("/reservationStockOutOrderApi/batchPushByNumber")
|
||||
public AjaxResult batchPushByNumber(@RequestBody List<String> numberList);
|
||||
|
||||
@ApiOperation("保存电子签名记录")
|
||||
@PostMapping("/electronicSignatureApi/saveSignature")
|
||||
public AjaxResult saveSignature(@RequestBody ElectronicSignatureSyncDTO saveDTO);
|
||||
}
|
||||
@@ -165,6 +165,10 @@ public interface UserServiceFeign {
|
||||
@GetMapping("/userShipperApi/userShipperListAll")
|
||||
public AjaxResult<?> userShipperListAll();
|
||||
|
||||
@ApiOperation("查询租户下全部托运人")
|
||||
@GetMapping("/userShipperApi/userShipperListAllByOrg")
|
||||
public AjaxResult<?> userShipperListAllByOrg(@RequestParam("orgCode") Long orgCode);
|
||||
|
||||
@ApiOperation("查询租户下全部承运人")
|
||||
@GetMapping("/userDriverApi/userDriverListAll")
|
||||
public AjaxResult<?> userDriverListAll();
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class)
|
||||
public interface WlhyServiceFeign {
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Map;
|
||||
* @description: TODO
|
||||
* @date 2024/5/10 8:58
|
||||
**/
|
||||
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface WmsServiceFeign {
|
||||
|
||||
/**
|
||||
@@ -141,4 +141,14 @@ public interface WmsServiceFeign {
|
||||
@ApiOperation("生成拣货单")
|
||||
@PostMapping("/stockOutOrderApi/genPickingOrderByOms")
|
||||
public AjaxResult genPickingOrderByOms(@RequestBody com.mhd.system.api.domain.StockOutOrderDTO stockOutOrderDTO);
|
||||
|
||||
/**
|
||||
* OMS批量签名:更新WMS入/出库单签名字段
|
||||
*
|
||||
* <p>OMS端勾选记录批量签名后,通过此Feign调用WMS的 /stockSignatureApi/batchSign 接口,
|
||||
* 同步更新WMS stock_in_order / stock_out_order 表的签名状态、签名时间、签名图片、签名备注。</p>
|
||||
*/
|
||||
@ApiOperation("OMS批量签名-同步WMS入/出库单签名字段")
|
||||
@PostMapping("/stockSignatureApi/batchSign")
|
||||
public AjaxResult batchSignWms(@RequestBody SignatureBatchFeignDTO dto);
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class)
|
||||
public interface YmsServiceFeign {
|
||||
|
||||
/**
|
||||
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package com.mhd.system.api.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子签名同步DTO(WMS端通过Feign调用OMS)
|
||||
*/
|
||||
@Data
|
||||
public class ElectronicSignatureSyncDTO {
|
||||
|
||||
@ApiModelProperty("订单ID")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty("订单号")
|
||||
private String orderNumber;
|
||||
|
||||
@ApiModelProperty("订单类型:IN-入库 OUT-出库")
|
||||
private String orderType;
|
||||
|
||||
@ApiModelProperty("组织ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("仓库ID")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
private Long createBy;
|
||||
|
||||
@ApiModelProperty("创建人姓名")
|
||||
private String createByName;
|
||||
|
||||
@ApiModelProperty("物料明细列表")
|
||||
private List<MaterialDetailItem> materialDetailList;
|
||||
|
||||
@Data
|
||||
public static class MaterialDetailItem {
|
||||
|
||||
@ApiModelProperty("物料基础信息ID")
|
||||
private Long materialBaseInfoId;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
@ApiModelProperty("单位代码")
|
||||
private String unitCode;
|
||||
|
||||
@ApiModelProperty("单位名称")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty("批次号")
|
||||
private String batchNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
private String lotNumber;
|
||||
|
||||
@ApiModelProperty("仓库ID")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("库区ID")
|
||||
private Long storageSectionId;
|
||||
|
||||
@ApiModelProperty("库区编码")
|
||||
private String storageSectionCode;
|
||||
|
||||
@ApiModelProperty("库区名称")
|
||||
private String storageSectionName;
|
||||
|
||||
@ApiModelProperty("库位ID")
|
||||
private Long storageLocationId;
|
||||
|
||||
@ApiModelProperty("库位编码")
|
||||
private String storageLocationCode;
|
||||
|
||||
@ApiModelProperty("库位名称")
|
||||
private String storageLocationName;
|
||||
|
||||
@ApiModelProperty("业务唯一ID")
|
||||
private Long uniqueId;
|
||||
}
|
||||
}
|
||||
+21
-3
@@ -240,9 +240,7 @@ public class InMaterialDetail extends BaseVOEntity {
|
||||
@ApiModelProperty("父级唯一Id")
|
||||
private Long parentUniqueId;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
@ApiModelProperty("越库单id")
|
||||
private Long overStockId;
|
||||
@@ -376,4 +374,24 @@ public class InMaterialDetail extends BaseVOEntity {
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private Date drinkDate;
|
||||
|
||||
@ApiModelProperty("来货验收是否合格;1 合格,0 不合格")
|
||||
@Excel(name = "来货验收是否合格;1 合格,0 不合格")
|
||||
private String arrivalAcceptQualified;
|
||||
|
||||
@ApiModelProperty("包装是否破损;1 破损,0 完好")
|
||||
@Excel(name = "包装是否破损;1 破损,0 完好")
|
||||
private String packageDamaged;
|
||||
|
||||
@ApiModelProperty("是否解冻 / 水渍;1 是,0 否")
|
||||
@Excel(name = "是否解冻 / 水渍;1 是,0 否")
|
||||
private String isThawWaterstain;
|
||||
|
||||
@ApiModelProperty("问题货是否已通知客户;1 已通知,0 未通知")
|
||||
@Excel(name = "问题货是否已通知客户;1 已通知,0 未通知")
|
||||
private String notifyCustomerAbnormal;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.mhd.system.api.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OMS→WMS 批量签名 Feign DTO
|
||||
*
|
||||
* <p>OMS端批量签名时,通过此DTO调用WMS的批量签名接口,
|
||||
* 更新WMS stock_in_order / stock_out_order 表的签名字段。</p>
|
||||
*/
|
||||
@Data
|
||||
public class SignatureBatchFeignDTO {
|
||||
|
||||
@ApiModelProperty("入库单ID列表")
|
||||
private List<Long> inOrderIds;
|
||||
|
||||
@ApiModelProperty("出库单ID列表")
|
||||
private List<Long> outOrderIds;
|
||||
|
||||
@ApiModelProperty("签名状态:2-已签名")
|
||||
private Integer signatureStatus;
|
||||
|
||||
@ApiModelProperty("签名时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date signatureTime;
|
||||
|
||||
@ApiModelProperty("手写签名图片(base64或URL,单张)")
|
||||
private String signaturePic;
|
||||
|
||||
@ApiModelProperty("拍照取证图片(逗号分隔多张URL)")
|
||||
private String evidencePics;
|
||||
|
||||
@ApiModelProperty("签名备注")
|
||||
private String signatureRemark;
|
||||
}
|
||||
@@ -124,4 +124,20 @@ public class WarehouseFeignPO extends BaseVOEntity{
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
|
||||
@ApiModelProperty("订单号生成规则(0-日期累加 1-历史累加)")
|
||||
@Excel(name = "单号生成规则")
|
||||
private String orderNoGenerateRule;
|
||||
|
||||
@ApiModelProperty("入库单号首字母前缀")
|
||||
@Excel(name = "入库单号首字母前缀")
|
||||
private String inOrderNoPrefix;
|
||||
|
||||
@ApiModelProperty("出库单号首字母前缀")
|
||||
@Excel(name = "出库单号首字母前缀")
|
||||
private String outOrderNoPrefix;
|
||||
|
||||
@ApiModelProperty("样品出库单号首字母前缀")
|
||||
@Excel(name = "样品出库单号首字母前缀")
|
||||
private String sampleOutOrderNoPrefix;
|
||||
|
||||
}
|
||||
+5
@@ -90,6 +90,11 @@ public class RemoteOmsFeignFallbackFactory implements FallbackFactory<OmsService
|
||||
public AjaxResult batchPushByNumber(List<String> numberList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult saveSignature(ElectronicSignatureSyncDTO saveDTO) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+5
@@ -140,6 +140,11 @@ public class RemoteUserFeignFallbackFactory implements FallbackFactory<UserServi
|
||||
return AjaxResult.error("获取租户托运人失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult<?> userShipperListAllByOrg(Long orgCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult<?> userDriverListAll() {
|
||||
return AjaxResult.error("获取租户承运人失败");
|
||||
|
||||
+6
@@ -119,6 +119,12 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
|
||||
public AjaxResult genPickingOrderByOms(StockOutOrderDTO stockOutOrderDTO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult batchSignWms(SignatureBatchFeignDTO dto) {
|
||||
log.error("WMS批量签名调用失败");
|
||||
return AjaxResult.error("WMS批量签名调用失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.mhd.bi.domain.biPlatformRealData.repository.mapper;
|
||||
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO;
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO;
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO;
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 月台监测-真实数据 Mapper
|
||||
* 数据来源:TEST_NGWL_YMS 库(达梦,跨库访问)
|
||||
* 注:列名按达梦默认大写规则;若实际库中小写请反馈调整
|
||||
*/
|
||||
public interface BiPlatformRealDataMapper {
|
||||
|
||||
/** 作业车辆状态列表 */
|
||||
List<RealPlatformVehiclePO> queryVehicles();
|
||||
|
||||
/** 月台实时概览(总数 / 当前作业中) */
|
||||
RealPlatformOverviewPO queryPlatformOverview();
|
||||
|
||||
/** 今日作业任务数 */
|
||||
Long countTodayTasks();
|
||||
|
||||
/** 车辆状态统计(今日) */
|
||||
RealVehicleStatusPO queryVehicleStatusToday();
|
||||
|
||||
/** 本月任务量 */
|
||||
Long countMonthTasks();
|
||||
|
||||
/** 任务负荷(今日 24 小时) */
|
||||
List<RealTaskLoadPO> queryTaskLoadToday();
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.mhd.bi.domain.biPlatformRealData.repository.po;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 月台实时概览(真实数据,来自 TEST_NGWL_YMS.QMS_WINDOW_INFO)
|
||||
*/
|
||||
@Data
|
||||
public class RealPlatformOverviewPO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 月台总数 */
|
||||
private Long totalPlatforms;
|
||||
|
||||
/** 当前作业中(月台作业状态=占用) */
|
||||
private Long operatingPlatforms;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.mhd.bi.domain.biPlatformRealData.repository.po;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 月台监测-作业车辆(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS 等)
|
||||
*/
|
||||
@Data
|
||||
public class RealPlatformVehiclePO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车牌号(qms_main_business.CARNO) */
|
||||
private String plateNumber;
|
||||
|
||||
/** 流程状态(qms_main_business.FLOWSTATUS) */
|
||||
private String status;
|
||||
|
||||
/** 叫号月台(qms_queue_list.WINDOWNAME) */
|
||||
private String platformId;
|
||||
|
||||
/** 月台作业时长,分钟(EXITTIME - ENTRYTIME) */
|
||||
private Long platformDuration;
|
||||
|
||||
/** 预约申请时间(qms_main_business.CREATE_TIME) */
|
||||
private String appointmentTime;
|
||||
|
||||
/** 作业楼层(qms_window_info.PLATFORMFLOOR) */
|
||||
private String workFloor;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.mhd.bi.domain.biPlatformRealData.repository.po;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 任务负荷统计(按小时,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS)
|
||||
*/
|
||||
@Data
|
||||
public class RealTaskLoadPO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 0-23 小时 */
|
||||
private Integer hourOfDay;
|
||||
|
||||
/** 该小时段任务数 */
|
||||
private Long taskCount;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.mhd.bi.domain.biPlatformRealData.repository.po;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 作业车辆状态统计(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS)
|
||||
*/
|
||||
@Data
|
||||
public class RealVehicleStatusPO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 今日预约车辆 */
|
||||
private Long todayReservedVehicles;
|
||||
|
||||
/** 当前未签到 */
|
||||
private Long notCheckedIn;
|
||||
|
||||
/** 当前作业中 */
|
||||
private Long operatingVehicles;
|
||||
|
||||
/** 作业完成 */
|
||||
private Long completedVehicles;
|
||||
}
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
package com.mhd.bi.domain.biPlatformRealData.service;
|
||||
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.mapper.BiPlatformRealDataMapper;
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO;
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO;
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO;
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO;
|
||||
import com.mhd.bi.domain.biSnapshotSync.support.BiSnapshotWeeklyRandomDataBuilder;
|
||||
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.TaskLoadItemVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 月台监测-真实数据业务层(封装 YMS 跨库查询)
|
||||
* 注:列名大小写、字段类型需以实际库为准;若 YMS 库无数据/无权限,相关方法应返回空/0,不影响写死字段写入快照
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BiPlatformRealDataService {
|
||||
|
||||
@Resource
|
||||
private BiPlatformRealDataMapper biPlatformRealDataMapper;
|
||||
|
||||
public List<RealPlatformVehiclePO> queryVehicles() {
|
||||
try {
|
||||
return biPlatformRealDataMapper.queryVehicles();
|
||||
} catch (Exception e) {
|
||||
log.error("【YMS】查询作业车辆列表失败: {}", e.getMessage(), e);
|
||||
return java.util.Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
public RealPlatformOverviewPO queryPlatformOverview() {
|
||||
try {
|
||||
RealPlatformOverviewPO po = biPlatformRealDataMapper.queryPlatformOverview();
|
||||
if (po == null) {
|
||||
po = new RealPlatformOverviewPO();
|
||||
}
|
||||
if (po.getTotalPlatforms() == null) po.setTotalPlatforms(0L);
|
||||
if (po.getOperatingPlatforms() == null) po.setOperatingPlatforms(0L);
|
||||
return po;
|
||||
} catch (Exception e) {
|
||||
log.error("【YMS】查询月台概览失败: {}", e.getMessage(), e);
|
||||
RealPlatformOverviewPO po = new RealPlatformOverviewPO();
|
||||
po.setTotalPlatforms(0L);
|
||||
po.setOperatingPlatforms(0L);
|
||||
return po;
|
||||
}
|
||||
}
|
||||
|
||||
public long countTodayTasks() {
|
||||
try {
|
||||
Long n = biPlatformRealDataMapper.countTodayTasks();
|
||||
return n == null ? 0L : n;
|
||||
} catch (Exception e) {
|
||||
log.error("【YMS】统计今日作业任务失败: {}", e.getMessage(), e);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
public RealVehicleStatusPO queryVehicleStatusToday() {
|
||||
try {
|
||||
RealVehicleStatusPO po = biPlatformRealDataMapper.queryVehicleStatusToday();
|
||||
if (po == null) po = new RealVehicleStatusPO();
|
||||
if (po.getTodayReservedVehicles() == null) po.setTodayReservedVehicles(0L);
|
||||
if (po.getNotCheckedIn() == null) po.setNotCheckedIn(0L);
|
||||
if (po.getOperatingVehicles() == null) po.setOperatingVehicles(0L);
|
||||
if (po.getCompletedVehicles() == null) po.setCompletedVehicles(0L);
|
||||
return po;
|
||||
} catch (Exception e) {
|
||||
log.error("【YMS】统计车辆状态失败: {}", e.getMessage(), e);
|
||||
RealVehicleStatusPO po = new RealVehicleStatusPO();
|
||||
po.setTodayReservedVehicles(0L);
|
||||
po.setNotCheckedIn(0L);
|
||||
po.setOperatingVehicles(0L);
|
||||
po.setCompletedVehicles(0L);
|
||||
return po;
|
||||
}
|
||||
}
|
||||
|
||||
public long countMonthTasks() {
|
||||
try {
|
||||
Long n = biPlatformRealDataMapper.countMonthTasks();
|
||||
return n == null ? 0L : n;
|
||||
} catch (Exception e) {
|
||||
log.error("【YMS】统计本月任务量失败: {}", e.getMessage(), e);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
public List<RealTaskLoadPO> queryTaskLoadToday() {
|
||||
try {
|
||||
return biPlatformRealDataMapper.queryTaskLoadToday();
|
||||
} catch (Exception e) {
|
||||
log.error("【YMS】统计任务负荷失败: {}", e.getMessage(), e);
|
||||
return java.util.Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时组装月台监测数据:真实字段查 YMS 库,写死字段保留静态值。
|
||||
* 每次调用实时查库,不经过快照表。
|
||||
*/
|
||||
public PlatformSurveillanceVO buildRealTimePlatformSurveillance() {
|
||||
Random r = new Random();
|
||||
PlatformSurveillanceVO template = BiSnapshotWeeklyRandomDataBuilder.platformSurveillance(r);
|
||||
|
||||
// 作业车辆列表
|
||||
List<RealPlatformVehiclePO> realVehicles = queryVehicles();
|
||||
List<PlatformVehicleItemVO> vehicleVos = new ArrayList<>();
|
||||
for (RealPlatformVehiclePO rv : realVehicles) {
|
||||
PlatformVehicleItemVO v = new PlatformVehicleItemVO();
|
||||
v.setAppointmentTime(rv.getAppointmentTime());
|
||||
v.setWorkFloor(rv.getWorkFloor());
|
||||
v.setPlateNumber(rv.getPlateNumber());
|
||||
v.setStatus(translateFlowStatus(rv.getStatus()));
|
||||
v.setPlatformId(rv.getPlatformId());
|
||||
v.setPlatformDuration(rv.getPlatformDuration() == null ? 0 : rv.getPlatformDuration().intValue());
|
||||
vehicleVos.add(v);
|
||||
}
|
||||
if (!vehicleVos.isEmpty()) {
|
||||
template.setVehicles(vehicleVos);
|
||||
}
|
||||
|
||||
// 月台实时概览
|
||||
RealPlatformOverviewPO ov = queryPlatformOverview();
|
||||
if (template.getPlatformOverview() != null) {
|
||||
template.getPlatformOverview().setTotalPlatforms(ov.getTotalPlatforms().intValue());
|
||||
template.getPlatformOverview().setOperatingPlatforms(ov.getOperatingPlatforms().intValue());
|
||||
int total = ov.getTotalPlatforms().intValue();
|
||||
int occ = ov.getOperatingPlatforms().intValue();
|
||||
double rate = total > 0 ? Math.round(((double) occ / total) * 100.0 * 100.0) / 100.0 : 0d;
|
||||
template.getPlatformOverview().setCurrentOccupancyRate(rate);
|
||||
}
|
||||
long todayTasks = countTodayTasks();
|
||||
if (template.getPlatformOverview() != null) {
|
||||
template.getPlatformOverview().setTodayTasks((int) todayTasks);
|
||||
}
|
||||
|
||||
// 作业车辆状态统计
|
||||
RealVehicleStatusPO vs = queryVehicleStatusToday();
|
||||
if (template.getVehicleStatus() != null) {
|
||||
template.getVehicleStatus().setTodayReservedVehicles(vs.getTodayReservedVehicles().intValue());
|
||||
template.getVehicleStatus().setNotCheckedIn(vs.getNotCheckedIn().intValue());
|
||||
template.getVehicleStatus().setOperatingVehicles(vs.getOperatingVehicles().intValue());
|
||||
template.getVehicleStatus().setCompletedVehicles(vs.getCompletedVehicles().intValue());
|
||||
}
|
||||
|
||||
// 本月任务统计 taskTotal
|
||||
long monthTasks = countMonthTasks();
|
||||
if (template.getMonthlyTaskStatistics() != null) {
|
||||
template.getMonthlyTaskStatistics().setTaskTotal((int) monthTasks);
|
||||
}
|
||||
|
||||
// 任务负荷(今日 24 小时)
|
||||
List<RealTaskLoadPO> loads = queryTaskLoadToday();
|
||||
if (!loads.isEmpty() && template.getTaskLoadStatistics() != null) {
|
||||
Map<Integer, Long> hourMap = new HashMap<>();
|
||||
for (RealTaskLoadPO l : loads) {
|
||||
hourMap.put(l.getHourOfDay(), l.getTaskCount());
|
||||
}
|
||||
for (TaskLoadItemVO item : template.getTaskLoadStatistics()) {
|
||||
Integer hour = parseHourFromLabel(item.getTime());
|
||||
if (hour != null) {
|
||||
Long n = hourMap.get(hour);
|
||||
if (n != null) item.setTaskCount(n.intValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return template;
|
||||
}
|
||||
|
||||
private static Integer parseHourFromLabel(String label) {
|
||||
if (label == null) return null;
|
||||
try {
|
||||
String s = label.replace("时", "").trim();
|
||||
return Integer.parseInt(s);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* FLOW_STATUS 数字转中文:1已预约 2已签到 3已叫号 4已过号 5已进场 6已称重 7已装车 8二次称重 9已结算 10已还卡 11已出场 12已取消
|
||||
*/
|
||||
private static String translateFlowStatus(String flowStatus) {
|
||||
if (flowStatus == null) return null;
|
||||
switch (flowStatus.trim()) {
|
||||
case "1": return "已预约";
|
||||
case "2": return "已签到";
|
||||
case "3": return "已叫号";
|
||||
case "4": return "已过号";
|
||||
case "5": return "已进场";
|
||||
case "6": return "已称重";
|
||||
case "7": return "已装车";
|
||||
case "8": return "二次称重";
|
||||
case "9": return "已结算";
|
||||
case "10": return "已还卡";
|
||||
case "11": return "已出场";
|
||||
case "12": return "已取消";
|
||||
default: return flowStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -85,7 +85,7 @@ public final class BiReportSnapshotMapperSupport {
|
||||
.entryOvertimeRate(0).overtimeCount(0).platformOnTimeRate(0)
|
||||
.avgPlatformDuration(0d).yardOnTimeRate(0).avgYardDuration(0d).build())
|
||||
.platformOverview(PlatformOverviewVO.builder()
|
||||
.totalPlatforms(0).currentOccupancyRate(0).operatingPlatforms(0).todayTasks(0).build())
|
||||
.totalPlatforms(0).currentOccupancyRate(0d).operatingPlatforms(0).todayTasks(0).build())
|
||||
.vehicleStatus(VehicleStatusVO.builder()
|
||||
.todayReservedVehicles(0).notCheckedIn(0).operatingVehicles(0).completedVehicles(0).build())
|
||||
.avgOperationDurationTrend(Collections.emptyList())
|
||||
|
||||
+91
-2
@@ -13,10 +13,20 @@ import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformSurveillance
|
||||
import com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone.HkMacaoServiceZoneVO;
|
||||
import com.mhd.bi.interfaces.facadeApi.biReport.vo.transportZone.TransportOperationZoneVO;
|
||||
import com.mhd.bi.interfaces.facadeApi.biReport.vo.warehouseZone.WarehouseOperationZoneVO;
|
||||
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformVehicleItemVO;
|
||||
import com.mhd.bi.domain.biPlatformRealData.service.BiPlatformRealDataService;
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO;
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO;
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO;
|
||||
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
@@ -34,6 +44,7 @@ public class BiReportSnapshotSyncService {
|
||||
|
||||
private final BiSnapshotWriteMapper biSnapshotWriteMapper;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final BiPlatformRealDataService biPlatformRealDataService;
|
||||
|
||||
/**
|
||||
* 依次同步各快照表;单表失败不影响其它表,只记日志。
|
||||
@@ -137,9 +148,87 @@ public class BiReportSnapshotSyncService {
|
||||
return BiSnapshotWeeklyRandomDataBuilder.warehouseTransport(new Random());
|
||||
}
|
||||
|
||||
/** TODO 业务落地:改为查询真实数据。临时实现见 {@link BiSnapshotWeeklyRandomDataBuilder#platformSurveillance(Random)}。 */
|
||||
/** TODO 业务落地:部分字段改为真实数据,其余仍写死。 */
|
||||
protected PlatformSurveillanceVO buildPlatformSurveillanceSnapshot() {
|
||||
return BiSnapshotWeeklyRandomDataBuilder.platformSurveillance(new Random());
|
||||
Random r = new Random();
|
||||
// 写死数据复用原 builder
|
||||
PlatformSurveillanceVO template = BiSnapshotWeeklyRandomDataBuilder.platformSurveillance(r);
|
||||
|
||||
// ====== 真实数据:作业车辆列表 ======
|
||||
List<RealPlatformVehiclePO> realVehicles = biPlatformRealDataService.queryVehicles();
|
||||
List<PlatformVehicleItemVO> vehicleVos = new ArrayList<>();
|
||||
for (RealPlatformVehiclePO rv : realVehicles) {
|
||||
PlatformVehicleItemVO v = new PlatformVehicleItemVO();
|
||||
v.setAppointmentTime(rv.getAppointmentTime());
|
||||
v.setWorkFloor(rv.getWorkFloor());
|
||||
v.setPlateNumber(rv.getPlateNumber());
|
||||
v.setStatus(rv.getStatus());
|
||||
v.setPlatformId(rv.getPlatformId());
|
||||
v.setPlatformDuration(rv.getPlatformDuration() == null ? 0 : rv.getPlatformDuration().intValue());
|
||||
vehicleVos.add(v);
|
||||
}
|
||||
if (!vehicleVos.isEmpty()) {
|
||||
template.setVehicles(vehicleVos);
|
||||
}
|
||||
|
||||
// ====== 真实数据:月台实时概览 ======
|
||||
RealPlatformOverviewPO ov = biPlatformRealDataService.queryPlatformOverview();
|
||||
if (template.getPlatformOverview() != null) {
|
||||
template.getPlatformOverview().setTotalPlatforms(ov.getTotalPlatforms().intValue());
|
||||
template.getPlatformOverview().setOperatingPlatforms(ov.getOperatingPlatforms().intValue());
|
||||
int total = ov.getTotalPlatforms().intValue();
|
||||
int occ = ov.getOperatingPlatforms().intValue();
|
||||
double rate = total > 0 ? Math.round(((double) occ / total) * 100.0 * 100.0) / 100.0 : 0d;
|
||||
template.getPlatformOverview().setCurrentOccupancyRate(rate);
|
||||
}
|
||||
long todayTasks = biPlatformRealDataService.countTodayTasks();
|
||||
if (template.getPlatformOverview() != null) {
|
||||
template.getPlatformOverview().setTodayTasks((int) todayTasks);
|
||||
}
|
||||
|
||||
// ====== 真实数据:作业车辆状态统计 ======
|
||||
RealVehicleStatusPO vs = biPlatformRealDataService.queryVehicleStatusToday();
|
||||
if (template.getVehicleStatus() != null) {
|
||||
template.getVehicleStatus().setTodayReservedVehicles(vs.getTodayReservedVehicles().intValue());
|
||||
template.getVehicleStatus().setNotCheckedIn(vs.getNotCheckedIn().intValue());
|
||||
template.getVehicleStatus().setOperatingVehicles(vs.getOperatingVehicles().intValue());
|
||||
template.getVehicleStatus().setCompletedVehicles(vs.getCompletedVehicles().intValue());
|
||||
}
|
||||
|
||||
// ====== 真实数据:本月任务统计 taskTotal ======
|
||||
long monthTasks = biPlatformRealDataService.countMonthTasks();
|
||||
if (template.getMonthlyTaskStatistics() != null) {
|
||||
template.getMonthlyTaskStatistics().setTaskTotal((int) monthTasks);
|
||||
}
|
||||
|
||||
// ====== 真实数据:任务负荷(今日 24 小时) ======
|
||||
List<RealTaskLoadPO> loads = biPlatformRealDataService.queryTaskLoadToday();
|
||||
if (!loads.isEmpty() && template.getTaskLoadStatistics() != null) {
|
||||
Map<Integer, Long> hourMap = new HashMap<>();
|
||||
for (RealTaskLoadPO l : loads) {
|
||||
hourMap.put(l.getHourOfDay(), l.getTaskCount());
|
||||
}
|
||||
for (com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskLoadItemVO item : template.getTaskLoadStatistics()) {
|
||||
Integer hour = parseHourFromLabel(item.getTime());
|
||||
if (hour != null) {
|
||||
Long n = hourMap.get(hour);
|
||||
if (n != null) item.setTaskCount(n.intValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return template;
|
||||
}
|
||||
|
||||
private static Integer parseHourFromLabel(String label) {
|
||||
if (label == null) return null;
|
||||
// "15时" -> 15
|
||||
try {
|
||||
String s = label.replace("时", "").trim();
|
||||
return Integer.parseInt(s);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-1
@@ -127,6 +127,8 @@ public final class BiSnapshotWeeklyRandomDataBuilder {
|
||||
for (String[] row : Baseline.P_PLATES) {
|
||||
int dur = jitterInt(Integer.parseInt(row[3]), r);
|
||||
vehicles.add(PlatformVehicleItemVO.builder()
|
||||
.appointmentTime(Baseline.P_APPOINTMENT_TIME)
|
||||
.workFloor(Baseline.P_WORK_FLOOR)
|
||||
.plateNumber(row[0])
|
||||
.status(row[1])
|
||||
.platformId(row[2])
|
||||
@@ -145,7 +147,7 @@ public final class BiSnapshotWeeklyRandomDataBuilder {
|
||||
|
||||
PlatformOverviewVO overview = PlatformOverviewVO.builder()
|
||||
.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)))
|
||||
.todayTasks(Math.max(0, jitterInt(Baseline.P_TASKS, r)))
|
||||
.build();
|
||||
@@ -394,6 +396,8 @@ public final class BiSnapshotWeeklyRandomDataBuilder {
|
||||
static final String[] W_CUST_NAMES = {"华东冷链", "华南汽配", "西南快消", "华北家电", "跨境达"};
|
||||
static final int[] W_CUST_AMT = {198, 172, 205, 189, 221};
|
||||
|
||||
static final String P_APPOINTMENT_TIME = "2026-08-03 09:30:00";
|
||||
static final String P_WORK_FLOOR = "一楼";
|
||||
static final String[][] P_PLATES = {
|
||||
{"粤A12345", "待入场", "#12", "88"},
|
||||
{"闽D99887", "作业中", "#07", "142"},
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mhd.bi.interfaces.facadeApi.biReport;
|
||||
import com.mhd.bi.domain.biSnapshotSync.service.BiReportSnapshotSyncService;
|
||||
import com.mhd.bi.domain.biComprehensive.service.BiComprehensiveReportService;
|
||||
import com.mhd.bi.domain.biPlatformSurveillance.service.BiPlatformSurveillanceReportService;
|
||||
import com.mhd.bi.domain.biPlatformRealData.service.BiPlatformRealDataService;
|
||||
import com.mhd.bi.domain.biOverallOperation.service.BiOverallOperationReportService;
|
||||
import com.mhd.bi.domain.biHkMacaoServiceZone.service.BiHkMacaoServiceZoneReportService;
|
||||
import com.mhd.bi.domain.biTransportOperationZone.service.BiTransportOperationZoneReportService;
|
||||
@@ -48,6 +49,9 @@ public class BiReportApi extends BaseController {
|
||||
@Autowired
|
||||
private BiPlatformSurveillanceReportService biPlatformSurveillanceReportService;
|
||||
|
||||
@Autowired
|
||||
private BiPlatformRealDataService biPlatformRealDataService;
|
||||
|
||||
@Autowired
|
||||
private BiOverallOperationReportService biOverallOperationReportService;
|
||||
|
||||
@@ -92,12 +96,12 @@ public class BiReportApi extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 月台监测指标查询(按照 del_flag=1,按 create_time 最新一条)
|
||||
* 月台监测指标查询(实时查 YMS 库,真实字段 + 写死字段)
|
||||
*/
|
||||
@ApiOperation(value = "月台监测指标查询", notes = "返回 DEL_FLAG=1 且 CREATE_TIME 最新的一条快照")
|
||||
@ApiOperation(value = "月台监测指标查询", notes = "每次调用实时查询 YMS 库组装;部分字段为真实业务数据,部分为写死数据")
|
||||
@GetMapping("/platformSurveillance")
|
||||
public BiApiResult<PlatformSurveillanceVO> platformSurveillance() {
|
||||
PlatformSurveillanceVO data = biPlatformSurveillanceReportService.loadLatestPlatformSurveillance();
|
||||
PlatformSurveillanceVO data = biPlatformRealDataService.buildRealTimePlatformSurveillance();
|
||||
return BiApiResult.ok(data);
|
||||
}
|
||||
//园区物流大屏接口----------------------------------------------------------------------
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public class PlatformOverviewVO {
|
||||
private Integer totalPlatforms;
|
||||
|
||||
@ApiModelProperty("当前占用率,单位:%")
|
||||
private Integer currentOccupancyRate;
|
||||
private Double currentOccupancyRate;
|
||||
|
||||
@ApiModelProperty("当前作业中,单位:个")
|
||||
private Integer operatingPlatforms;
|
||||
|
||||
+6
@@ -14,6 +14,12 @@ import lombok.NoArgsConstructor;
|
||||
@ApiModel("月台监测-作业车辆")
|
||||
public class PlatformVehicleItemVO {
|
||||
|
||||
@ApiModelProperty("预约申请时间")
|
||||
private String appointmentTime;
|
||||
|
||||
@ApiModelProperty("作业楼层")
|
||||
private String workFloor;
|
||||
|
||||
@ApiModelProperty("车牌号码")
|
||||
private String plateNumber;
|
||||
|
||||
|
||||
@@ -16,17 +16,17 @@ spring:
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.5:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
#线上正式环境
|
||||
server-addr: 10.102.192.31:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
server-addr: 10.102.192.30:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.31:6848
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mhd.bi.domain.biPlatformRealData.repository.mapper.BiPlatformRealDataMapper">
|
||||
|
||||
<!-- 作业车辆状态列表(vehicles):
|
||||
plateNumber <- qms_main_business.CAR_NO
|
||||
status <- qms_main_business.FLOW_STATUS
|
||||
platformId <- qms_main_business.WINDOW_NAME(叫号月台,主业务表直接有)
|
||||
platformDuration <- qms_main_business.EXIT_TIME - ENTRY_TIME(分钟)
|
||||
appointmentTime <- qms_main_business.CREATE_TIME
|
||||
workFloor <- qms_window_info.PLATFORM_FLOOR(按 WINDOW_NAME 关联)
|
||||
-->
|
||||
<select id="queryVehicles" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO">
|
||||
SELECT
|
||||
mb.CAR_NO AS plateNumber,
|
||||
mb.FLOW_STATUS AS status,
|
||||
mb.WINDOW_NAME AS platformId,
|
||||
CASE
|
||||
WHEN mb.EXIT_TIME IS NOT NULL AND mb.ENTRY_TIME IS NOT NULL
|
||||
THEN CAST((mb.EXIT_TIME - mb.ENTRY_TIME) * 24 * 60 AS BIGINT)
|
||||
ELSE 0
|
||||
END AS platformDuration,
|
||||
TO_CHAR(mb.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') AS appointmentTime,
|
||||
wi.PLATFORM_FLOOR AS workFloor
|
||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS mb
|
||||
LEFT JOIN NGWL_TEST_YMS.QMS_WINDOW_INFO wi
|
||||
ON wi.WINDOW_NAME = mb.WINDOW_NAME
|
||||
ORDER BY mb.CREATE_TIME DESC
|
||||
</select>
|
||||
|
||||
<!-- 月台概览:totalPlatforms(总条数)、operatingPlatforms(作业状态=占用,JOB_STATUS: 0空闲 1占用) -->
|
||||
<select id="queryPlatformOverview" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO">
|
||||
SELECT
|
||||
COUNT(1) AS totalPlatforms,
|
||||
SUM(CASE WHEN JOB_STATUS = 1 THEN 1 ELSE 0 END) AS operatingPlatforms
|
||||
FROM NGWL_TEST_YMS.QMS_WINDOW_INFO
|
||||
</select>
|
||||
|
||||
<!-- 今日作业任务:实际进入时间是今日的 -->
|
||||
<select id="countTodayTasks" resultType="java.lang.Long">
|
||||
SELECT COUNT(1)
|
||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
||||
WHERE ENTRY_TIME IS NOT NULL
|
||||
AND TRUNC(ENTRY_TIME) = TRUNC(SYSDATE)
|
||||
</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
|
||||
SUM(CASE WHEN TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS todayReservedVehicles,
|
||||
SUM(CASE WHEN FLOW_STATUS = '1' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS notCheckedIn,
|
||||
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 FLOW_STATUS = '11' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS completedVehicles
|
||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
||||
</select>
|
||||
|
||||
<!-- 本月任务量:实际进入时间是本月的 -->
|
||||
<select id="countMonthTasks" resultType="java.lang.Long">
|
||||
SELECT COUNT(1)
|
||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
||||
WHERE ENTRY_TIME IS NOT NULL
|
||||
AND TO_CHAR(ENTRY_TIME, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
|
||||
</select>
|
||||
|
||||
<!-- 任务负荷(今日 24 小时时段):按 EXTRACT(HOUR FROM ENTRY_TIME) 统计 -->
|
||||
<select id="queryTaskLoadToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO">
|
||||
SELECT
|
||||
EXTRACT(HOUR FROM ENTRY_TIME) AS hourOfDay,
|
||||
COUNT(1) AS taskCount
|
||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
||||
WHERE ENTRY_TIME IS NOT NULL
|
||||
AND TRUNC(ENTRY_TIME) = TRUNC(SYSDATE)
|
||||
GROUP BY EXTRACT(HOUR FROM ENTRY_TIME)
|
||||
ORDER BY EXTRACT(HOUR FROM ENTRY_TIME)
|
||||
</select>
|
||||
</mapper>
|
||||
+16
@@ -130,4 +130,20 @@ public class Warehouse extends BaseVOEntity{
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
|
||||
@ApiModelProperty("订单号生成规则0日期累加1历史累加")
|
||||
@Excel(name = "单号生成规则")
|
||||
private String orderNoGenerateRule;
|
||||
|
||||
@ApiModelProperty("入库单号首字母前缀")
|
||||
@Excel(name = "入库单号首字母前缀")
|
||||
private String inOrderNoPrefix;
|
||||
|
||||
@ApiModelProperty("出库单号首字母前缀")
|
||||
@Excel(name = "出库单号首字母前缀")
|
||||
private String outOrderNoPrefix;
|
||||
|
||||
@ApiModelProperty("样品出库单号首字母前缀")
|
||||
@Excel(name = "样品出库单号首字母前缀")
|
||||
private String sampleOutOrderNoPrefix;
|
||||
|
||||
}
|
||||
+17
@@ -131,4 +131,21 @@ public class WarehousePO extends BaseVOEntity{
|
||||
@ApiModelProperty("作业模式")
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
|
||||
|
||||
@ApiModelProperty("订单号生成规则")
|
||||
@Excel(name = "单号生成规则")
|
||||
private String orderNoGenerateRule;
|
||||
|
||||
@ApiModelProperty("入库单号首字母前缀")
|
||||
@Excel(name = "入库单号首字母前缀")
|
||||
private String inOrderNoPrefix;
|
||||
|
||||
@ApiModelProperty("出库单号首字母前缀")
|
||||
@Excel(name = "出库单号首字母前缀")
|
||||
private String outOrderNoPrefix;
|
||||
|
||||
@ApiModelProperty("样品出库单号首字母前缀")
|
||||
@Excel(name = "样品出库单号首字母前缀")
|
||||
private String sampleOutOrderNoPrefix;
|
||||
}
|
||||
+17
@@ -139,4 +139,21 @@ public class WarehouseDO extends BaseVOEntity{
|
||||
@ApiModelProperty("作业模式")
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
|
||||
|
||||
@ApiModelProperty("订单号生成规则")
|
||||
@Excel(name = "单号生成规则")
|
||||
private String orderNoGenerateRule;
|
||||
|
||||
@ApiModelProperty("入库单号首字母前缀")
|
||||
@Excel(name = "入库单号首字母前缀")
|
||||
private String inOrderNoPrefix;
|
||||
|
||||
@ApiModelProperty("出库单号首字母前缀")
|
||||
@Excel(name = "出库单号首字母前缀")
|
||||
private String outOrderNoPrefix;
|
||||
|
||||
@ApiModelProperty("样品出库单号首字母前缀")
|
||||
@Excel(name = "样品出库单号首字母前缀")
|
||||
private String sampleOutOrderNoPrefix;
|
||||
}
|
||||
+17
@@ -144,4 +144,21 @@ public class WarehouseDTO extends BaseVOEntity{
|
||||
@ApiModelProperty("作业模式")
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
|
||||
|
||||
@ApiModelProperty("订单号生成规则")
|
||||
@Excel(name = "单号生成规则")
|
||||
private String orderNoGenerateRule;
|
||||
|
||||
@ApiModelProperty("入库单号首字母前缀")
|
||||
@Excel(name = "入库单号首字母前缀")
|
||||
private String inOrderNoPrefix;
|
||||
|
||||
@ApiModelProperty("出库单号首字母前缀")
|
||||
@Excel(name = "出库单号首字母前缀")
|
||||
private String outOrderNoPrefix;
|
||||
|
||||
@ApiModelProperty("样品出库单号首字母前缀")
|
||||
@Excel(name = "样品出库单号首字母前缀")
|
||||
private String sampleOutOrderNoPrefix;
|
||||
}
|
||||
+6
-1
@@ -39,6 +39,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="isEnable" column="IS_ENABLE" />
|
||||
<result property="workMode" column="WORK_MODE" />
|
||||
<result property="taskMode" column="TASK_MODE" />
|
||||
<result property="sampleOutOrderNoPrefix" column="SAMPLE_OUT_ORDER_NO_PREFIX" />
|
||||
<result property="orderNoGenerateRule" column="ORDER_NO_GENERATE_RULE" />
|
||||
<result property="inOrderNoPrefix" column="IN_ORDER_NO_PREFIX" />
|
||||
<result property="outOrderNoPrefix" column="OUT_ORDER_NO_PREFIX" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
@@ -47,7 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
warehouse_type, warehouse_type_name, warehouse_structure, warehouse_nature, warm_layer_code, warm_layer_name,
|
||||
director_name, director_phone, region_code, region_name, detail_address, longitude, latitude, building_region,
|
||||
usage_region, remark, opening_up, nullify, create_time, create_by, create_by_name, update_time, update_by,
|
||||
update_by_name, del_flag, IS_ENABLE ,WORK_MODE,TASK_MODE
|
||||
update_by_name, del_flag, IS_ENABLE ,WORK_MODE,TASK_MODE,SAMPLE_OUT_ORDER_NO_PREFIX,ORDER_NO_GENERATE_RULE,IN_ORDER_NO_PREFIX,
|
||||
OUT_ORDER_NO_PREFIX
|
||||
from warehouse
|
||||
</sql>
|
||||
|
||||
|
||||
+60
-36
@@ -161,11 +161,22 @@ public class UserShipperApplicationService {
|
||||
|
||||
// 先保存前端传递的 organizationId(如果存在)
|
||||
Long frontendOrganizationId = userShipperDO.getOrganizationId();
|
||||
|
||||
|
||||
// 获取当前登录用户的组织信息
|
||||
Long loginUserOrganizationId = userPo.getOrganizationId();
|
||||
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 为 2827 时,可查全部组织数据;其他组织只能查自己
|
||||
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L)) {
|
||||
@@ -184,32 +195,13 @@ public class UserShipperApplicationService {
|
||||
log.info("托运人列表查询 - 南光组织查询所有组织:不设置组织过滤条件");
|
||||
}
|
||||
} else {
|
||||
// 其他组织:设置 organizationId,只查询当前组织的数据
|
||||
// 其他组织只能查询自己组织的数据,不能查询其他组织的数据
|
||||
if (frontendOrganizationId != null) {
|
||||
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
|
||||
if (!frontendOrganizationId.equals(loginUserOrganizationId)) {
|
||||
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
|
||||
log.warn("托运人列表查询 - 前端传递的组织ID {} 与当前登录用户的组织ID {} 不一致,使用当前登录用户的组织ID进行过滤",
|
||||
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);
|
||||
}
|
||||
}
|
||||
// 其他组织:设置 organizationId 为当前登录组织ID。
|
||||
// 查询条件为:a.organization_id = 本组织 OR b.org_code LIKE 本组织ID
|
||||
// 即委托方初始绑定本组织、或 org_code 中包含本组织(被授权给本组织)时,均可查到。
|
||||
// 不设置 topOrganizationId,避免跨顶级组织授权(org_code 已包含本组织)被顶级组织条件拦截。
|
||||
userShipperDO.setOrganizationId(loginUserOrganizationId);
|
||||
userShipperDO.setTopOrganizationId(null);
|
||||
log.info("托运人列表查询 - 其他组织按本组织及 org_code 查询:organizationId={}", loginUserOrganizationId);
|
||||
}
|
||||
|
||||
log.info("托运人列表查询 - 设置组织ID后,查询参数:organizationId={}, topOrganizationId={}, userId={}",
|
||||
@@ -413,10 +405,15 @@ public class UserShipperApplicationService {
|
||||
shipperDO.setShipperEnterpriseName(companyName);
|
||||
// NC客户编码使用模板中的独立字段,不再复用登录账号
|
||||
shipperDO.setCustomerNcCode(ncCustomerCode);
|
||||
// 联系人 -> user表 user_name + user_shipper表 user_name_shipper
|
||||
shipperDO.setUserName(contactName);
|
||||
// 公司名称 -> user表 user_name + user_shipper表 user_name_shipper
|
||||
shipperDO.setUserName(companyName);
|
||||
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);
|
||||
// 地址 -> user表 user_area_name,详细地址 -> user表 user_area_address
|
||||
shipperDO.setUserAreaName(address);
|
||||
@@ -461,16 +458,30 @@ public class UserShipperApplicationService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入时若账号没有任何角色,则补分配企业货主角色
|
||||
* 导入委托方时,确保账号仅绑定企业货主(company)角色。
|
||||
* 注意:authShipper 会把“当前登录管理员的所有角色”都分配给导入用户,
|
||||
* 因此这里必须保证用户最终只绑定 company 角色——若现有角色不是“唯一的 company 角色”,
|
||||
* 一律删除后重新分配,避免残留 ownerCargo 等多条错误角色。
|
||||
*/
|
||||
private void assignCompanyRoleIfMissing(Long userId, Long organizationId) {
|
||||
if (userId == null || organizationId == null) {
|
||||
return;
|
||||
}
|
||||
// 查询用户现有角色
|
||||
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;
|
||||
}
|
||||
// 否则:删除所有现有角色(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 过滤,不适用)
|
||||
RolePO rolePO = roleDomainService.selectByRoleCodeAndOrganizationId(RoleEnum.COMPANY.getCode(), organizationId);
|
||||
if (rolePO == null) {
|
||||
@@ -547,8 +558,15 @@ public class UserShipperApplicationService {
|
||||
userDO.setUserId(userId);
|
||||
if (StringUtils.isNotBlank(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.setUserAreaName(address);
|
||||
userDO.setUserAreaAddress(detailedAddress);
|
||||
@@ -564,8 +582,8 @@ public class UserShipperApplicationService {
|
||||
userDO.setUserSalt(salt);
|
||||
}
|
||||
userDomainService.updateUser(userDO);
|
||||
// 如果该账号没有任何角色,补分配企业货主角色,避免登录报“账号未授权角色信息”
|
||||
assignCompanyRoleIfMissing(userId, existingShipper.getOrganizationId());
|
||||
// 如果该账号没有企业货主(company)角色,补分配当前导入组织下的 company 角色,避免登录报“账号未授权角色信息”
|
||||
assignCompanyRoleIfMissing(userId, currentOrgId);
|
||||
}
|
||||
|
||||
// 3. 更新 orgCode 中当前组织的 ncCustomer
|
||||
@@ -1306,6 +1324,12 @@ public class UserShipperApplicationService {
|
||||
return userShipperDomainService.userShipperList(userShipperDO);
|
||||
}
|
||||
|
||||
public List<UserShipperPo> userShipperListAllByOrg(Long orgCode) {
|
||||
UserShipperDO userShipperDO = new UserShipperDO();
|
||||
userShipperDO.setOrganizationId(orgCode);
|
||||
return userShipperDomainService.userShipperList(userShipperDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* E签宝回调接口-认证授权完成
|
||||
* @param jsonObject 回调参数
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class UserShipperDomainService {
|
||||
}
|
||||
}
|
||||
|
||||
// @DataPermissions(cacheName = "master")
|
||||
// @DataPermissions(cacheName = "master")
|
||||
public List<UserShipperPo> userShipperList(UserShipperDO userShipperDO) {
|
||||
// 数据权限逻辑已在 UserShipperApplicationService.userShipperList 中处理
|
||||
// 这里不再重复处理数据权限,直接使用传入的参数进行查询
|
||||
|
||||
@@ -212,6 +212,15 @@ public class UserShipperAPI extends BaseController {
|
||||
return AjaxResult.success("操作成功",list);
|
||||
}
|
||||
|
||||
@Log(title = "托运人管理-查询租户下所有托运人", description ="查询租户下所有托运人",businessType = BusinessType.INQUIRE)
|
||||
@ApiOperation("查询租户下所有托运人")
|
||||
@GetMapping("/userShipperListAllByOrg")
|
||||
public AjaxResult userShipperListAllByOrg(@RequestParam("orgCode") Long orgCode) {
|
||||
//转换实体
|
||||
List<UserShipperPo> list = userShipperApplicationService.userShipperListAllByOrg(orgCode);
|
||||
return AjaxResult.success("操作成功",list);
|
||||
}
|
||||
|
||||
@Log(title = "托运人管理-修改授权额度 结算天数 使用额度", description ="修改授权额度 结算天数 使用额度",businessType = BusinessType.INQUIRE)
|
||||
@ApiOperation("修改授权额度和结算天数")
|
||||
@PutMapping("/settlementInfo")
|
||||
|
||||
@@ -20,15 +20,15 @@ spring:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.30:6848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.31:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.30:6848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.31:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
|
||||
@@ -781,11 +781,11 @@
|
||||
/*组织ID - 数据隔离:南光组织(organizationId=2827)查询全部,其他组织查询自己组织的数据*/
|
||||
<if test="organizationId !=null">
|
||||
AND (
|
||||
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}, '%')
|
||||
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
|
||||
</if>
|
||||
|
||||
@@ -378,13 +378,23 @@
|
||||
and b.parent_shipper_id = #{parentShipperId}
|
||||
</if>
|
||||
/*用户组织ID*/
|
||||
<if test="organizationId !=null">
|
||||
/*用户组织ID*/
|
||||
<if test="organizationId !=null or (orgCode != null and orgCode != '')">
|
||||
AND (
|
||||
<if test="organizationId !=null">
|
||||
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>
|
||||
/*组织名称*/
|
||||
|
||||
+41
@@ -7,6 +7,7 @@ import com.mhd.bms.application.server.receiptManage.ReceiptManageApplicationServ
|
||||
import com.mhd.bms.domain.billManage.entity.BillDetail;
|
||||
import com.mhd.bms.domain.billManage.entity.BillManage;
|
||||
import com.mhd.bms.domain.billManage.repository.facade.IBillDetailService;
|
||||
import com.mhd.bms.domain.billManage.repository.facade.IBillManageService;
|
||||
import com.mhd.bms.domain.billManage.repository.mapper.BillDetailMapper;
|
||||
import com.mhd.bms.domain.billManage.repository.po.BillDetailPO;
|
||||
import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
|
||||
@@ -78,6 +79,8 @@ public class BillManageApplicationService {
|
||||
private BillDetailMapper billDetailMapper;
|
||||
@Autowired
|
||||
private NcLogMapper ncLogMapper;
|
||||
@Autowired
|
||||
private IBillManageService billManageService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -445,6 +448,7 @@ public class BillManageApplicationService {
|
||||
billManageDO.setReconciliationStatus(1);
|
||||
billManageDO.setCreateTime(new Date());
|
||||
billManageDO.setCreateBy(loginUser.getUserid());
|
||||
billManageDO.setSalesmanId(String.valueOf(loginUser.getUserid()));
|
||||
billManageDO.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
billManageDO.setUpdateTime(new Date());
|
||||
billManageDO.setUpdateBy(loginUser.getUserid());
|
||||
@@ -466,6 +470,16 @@ public class BillManageApplicationService {
|
||||
for (BillDetailDTO billDetailDTO : billDetailDTOListNoBillingStatementId) {
|
||||
BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
|
||||
BeanUtils.copyProperties(billDetailDTO, billingStatementDTO);
|
||||
|
||||
String firstSubjectCode = billDetailDTO.getFirstSubjectCode();
|
||||
Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode);
|
||||
BigDecimal amount = billingStatementDTO.getBillingAmount();
|
||||
BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal taxFreeFee = amount.subtract(taxAmount);
|
||||
billingStatementDTO.setTaxAmount(taxAmount);
|
||||
billingStatementDTO.setTaxFreeFee(taxFreeFee);
|
||||
billingStatementDTO.setTaxRate(taxRate);
|
||||
billingStatementDTO.setBillingAmount(amount);
|
||||
billingStatementDTO.setAccountExpenseType(billDetailDTO.getBillType());
|
||||
billingStatementDTO.setBillManageId(billManageDO.getBillManageId());
|
||||
billingStatementDTO.setBillingState(3);
|
||||
@@ -495,6 +509,33 @@ public class BillManageApplicationService {
|
||||
billingStatementApplicationService.update(billingStatementDO);
|
||||
}
|
||||
//保存账单明细
|
||||
double allTaxRate = 0.0d;
|
||||
BigDecimal allTaxAmount = BigDecimal.ZERO;
|
||||
BigDecimal allTaxFreeFee = BigDecimal.ZERO;
|
||||
for (BillDetailDTO item : billDetailDTOList) {
|
||||
String firstSubjectCode = item.getFirstSubjectCode();
|
||||
Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode);
|
||||
BigDecimal amount = item.getBillingAmount();
|
||||
BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal taxFreeFee = amount.subtract(taxAmount);
|
||||
item.setTaxAmount(taxAmount);
|
||||
item.setTaxFreeFee(taxFreeFee);
|
||||
item.setTaxRate(taxRate);
|
||||
item.setBillManageId(billManageDO.getBillManageId());
|
||||
item.setBillNumber(billManageDO.getBillNumber());
|
||||
allTaxRate += taxRate;
|
||||
allTaxAmount = allTaxAmount.add(taxAmount);
|
||||
allTaxFreeFee = allTaxFreeFee.add(taxFreeFee);
|
||||
}
|
||||
|
||||
BillManage billManage = billManageService.getById(billManageDO.getBillManageId());
|
||||
if (billManage != null) {
|
||||
billManage.setTaxRate(allTaxRate);
|
||||
billManage.setTaxAmount(allTaxAmount);
|
||||
billManage.setTaxFreeFee(allTaxFreeFee);
|
||||
billManage.setSalesmanId(String.valueOf(loginUser.getUserid()));
|
||||
billManageService.updateById(billManage);
|
||||
}
|
||||
Boolean flagTwo = billDetailDomainService.saveBatch(billDetailDTOList);
|
||||
//保存操作记录
|
||||
BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
|
||||
|
||||
+2
@@ -585,6 +585,8 @@ public class BillingStatementApplicationService {
|
||||
此方法只进行实体返回,并不进行数据保存
|
||||
*/
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
billingStatementDO.setAccountExpenseType(billingStatementDO.getAccountExpenseType());
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
|
||||
+1
-1
@@ -274,7 +274,7 @@ public class SettlementCustomersApplicationService {
|
||||
SyncDictCache dictCache,
|
||||
List<SettlementCustomers> toInsert,
|
||||
List<SettlementCustomers> toUpdate) {
|
||||
AjaxResult ajaxResult = userServiceFeign.userShipperListAll();
|
||||
AjaxResult ajaxResult = userServiceFeign.userShipperListAllByOrg(loginUser.getUserPo().getOrganizationId());
|
||||
List<UserShipperPo> userShipperPoList = parseFeignList(ajaxResult, UserShipperPo.class);
|
||||
if (userShipperPoList.isEmpty()) {
|
||||
return;
|
||||
|
||||
+3
-1
@@ -38,4 +38,6 @@ public interface IBillDetailService extends IService<BillDetail>
|
||||
public BillDetailPO getInfo(Long billDetailId);
|
||||
|
||||
List<BillDetailPO> getDetailsByBillManageId(Long billManageId);
|
||||
}
|
||||
|
||||
List<BillDetail> getDetailsByBillManageIdAndGroup(Long billManageId);
|
||||
}
|
||||
+6
-1
@@ -5,6 +5,7 @@ import com.mhd.bms.domain.billManage.entity.BillDetail;
|
||||
import com.mhd.bms.domain.billManage.repository.po.BillDetailPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -17,4 +18,8 @@ public interface BillDetailMapper extends BaseMapper<BillDetail>
|
||||
{
|
||||
|
||||
List<BillDetailPO> getDetailsByBillManageId(@Param("billManageId") Long billManageId);
|
||||
}
|
||||
|
||||
List<BillDetail> getDetailsByBillManageIdAndGroup(@Param("billManageId") Long billManageId);
|
||||
|
||||
Double getTaxRate(@Param("code") String code);
|
||||
}
|
||||
+2
@@ -44,4 +44,6 @@ public interface BillManageMapper extends BaseMapper<BillManage>
|
||||
String getDeptName(@Param("dictCode") String dictCode);
|
||||
|
||||
String getOrgCodeNc(@Param("organizationId") Long organizationId);
|
||||
|
||||
Long getShipperId(@Param("userId") Long userId, @Param("organizationId") Long organizationId);
|
||||
}
|
||||
+6
-1
@@ -75,4 +75,9 @@ public class BillDetailImpl extends ServiceImpl<BillDetailMapper, BillDetail> im
|
||||
public List<BillDetailPO> getDetailsByBillManageId(Long billManageId) {
|
||||
return billDetailMapper.getDetailsByBillManageId(billManageId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BillDetail> getDetailsByBillManageIdAndGroup(Long billManageId) {
|
||||
return billDetailMapper.getDetailsByBillManageIdAndGroup(billManageId);
|
||||
}
|
||||
}
|
||||
+1196
-522
File diff suppressed because it is too large
Load Diff
@@ -264,4 +264,6 @@ public class BillManageDO extends BaseVOEntity{
|
||||
private String paymentAccountId;
|
||||
@ApiModelProperty("收款帐户名称")
|
||||
private String paymentAccountName;
|
||||
@ApiModelProperty("业务员ID")
|
||||
private String salesmanId;
|
||||
}
|
||||
+4
@@ -100,6 +100,10 @@ public class BillingStatementPO extends BaseVOEntity{
|
||||
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
|
||||
private Integer accountExpenseType;
|
||||
|
||||
@ApiModelProperty("收支类型(1-应收,2-应付)")
|
||||
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
|
||||
private Integer billType;
|
||||
|
||||
@ApiModelProperty("流水备注")
|
||||
@Excel(name = "流水备注")
|
||||
private String billingRemark;
|
||||
|
||||
+4
@@ -101,6 +101,10 @@ public class BillingStatementDO extends BaseVOEntity{
|
||||
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
|
||||
private Integer accountExpenseType;
|
||||
|
||||
@ApiModelProperty("收支类型(1-应收,2-应付)")
|
||||
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
|
||||
private Integer billType;
|
||||
|
||||
@ApiModelProperty("流水备注")
|
||||
@Excel(name = "流水备注")
|
||||
private String billingRemark;
|
||||
|
||||
+4
@@ -102,6 +102,10 @@ public class BillingStatementDTO extends BaseVOEntity{
|
||||
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
|
||||
private Integer accountExpenseType;
|
||||
|
||||
@ApiModelProperty("收支类型(1-应收,2-应付)")
|
||||
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
|
||||
private Integer billType;
|
||||
|
||||
@ApiModelProperty("流水备注")
|
||||
@Excel(name = "流水备注")
|
||||
private String billingRemark;
|
||||
|
||||
@@ -18,15 +18,15 @@ spring:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.30:6848
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.30:6848
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
|
||||
@@ -27,5 +27,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND bd.bill_manage_id = #{billManageId}
|
||||
</select>
|
||||
|
||||
<select id="getDetailsByBillManageIdAndGroup" resultType="com.mhd.bms.domain.billManage.entity.BillDetail" parameterType="java.lang.Long">
|
||||
SELECT
|
||||
SUM(BILLING_AMOUNT) as BILLING_AMOUNT,
|
||||
SUM(TAX_AMOUNT) as TAX_AMOUNT,
|
||||
SUM(TAX_FREE_FEE) as TAX_FREE_FEE,
|
||||
AVG(TAX_RATE) as TAX_RATE,
|
||||
BILL_MANAGE_ID as BILL_MANAGE_ID,
|
||||
TOP_ORGANIZATION_ID as TOP_ORGANIZATION_ID,
|
||||
ORGANIZATION_NAME,
|
||||
INVOICE_ITEM,
|
||||
INVOICE_ITEM_NAME,
|
||||
FEE_TYPE,
|
||||
BILL_NUMBER
|
||||
FROM
|
||||
bill_detail
|
||||
WHERE
|
||||
del_flag = 1
|
||||
AND bill_manage_id = #{billManageId} GROUP BY INVOICE_ITEM,INVOICE_ITEM_NAME,FEE_TYPE
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
<select id="getTaxRate" resultType="java.lang.Double" parameterType="java.lang.String">
|
||||
SELECT
|
||||
rate
|
||||
FROM
|
||||
NGWL_TEST_SYSTEM.EXPENSE_ACCOUNT
|
||||
WHERE
|
||||
del_flag = 1
|
||||
AND SUBJECT_CODE = #{code}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -169,4 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
SELECT NC_CODE FROM NGWL_TEST_PRODUCT."SYS_ORGANIZATION" where DEL_FLAG = 1 and organization_id = #{organizationId} limit 1
|
||||
</select>
|
||||
|
||||
<select id="getShipperId" resultType="java.lang.Long">
|
||||
SELECT SHIPPER_ID FROM NGWL_TEST_USER."USER_SHIPPER" where DEL_FLAG = '1' and user_id = #{userId} and organization_id = #{organizationId} limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -200,10 +200,6 @@
|
||||
<if test="settlementCustomersDO.organizationId != null">
|
||||
AND (
|
||||
a.organization_id = #{settlementCustomersDO.organizationId}
|
||||
OR b.org_code LIKE concat('%"code":"', #{settlementCustomersDO.organizationId}, '"%')
|
||||
OR b.org_code LIKE concat('%code:', #{settlementCustomersDO.organizationId}, '%')
|
||||
OR b.org_code LIKE concat('%code: ', #{settlementCustomersDO.organizationId}, '%')
|
||||
OR b.org_code LIKE concat('%"code":', #{settlementCustomersDO.organizationId}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="settlementCustomersDO.topOrganizationId != null and settlementCustomersDO.topOrganizationId != ''">
|
||||
@@ -216,4 +212,4 @@
|
||||
and a.customer_type_code = #{settlementCustomersDO.customerTypeCode}
|
||||
</if>
|
||||
</sql>
|
||||
</mapper>
|
||||
</mapper>
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package com.mhd.oms.domain.electronicSignature.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 电子签名主表 electronic_signature
|
||||
*/
|
||||
@Data
|
||||
@TableName("ELECTRONIC_SIGNATURE")
|
||||
public class ElectronicSignature extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("签名ID")
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long signatureId;
|
||||
|
||||
@ApiModelProperty("订单ID")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty("订单号")
|
||||
private String orderNumber;
|
||||
|
||||
@ApiModelProperty("订单类型:IN-入库 OUT-出库")
|
||||
private String orderType;
|
||||
|
||||
@ApiModelProperty("签名状态:1-待签名 2-已签名")
|
||||
private Integer signatureStatus;
|
||||
|
||||
@ApiModelProperty("签名时间")
|
||||
private Date signatureTime;
|
||||
|
||||
@ApiModelProperty("手写签名图片")
|
||||
private String signaturePic;
|
||||
|
||||
@ApiModelProperty("拍照取证图片")
|
||||
private String evidencePics;
|
||||
|
||||
@ApiModelProperty("签名备注")
|
||||
private String signatureRemark;
|
||||
|
||||
@ApiModelProperty("签名方式:1-扫描二维码 2-电子签名 3-打印手写签名 4-超时自动签名")
|
||||
private Integer signatureMode;
|
||||
|
||||
@ApiModelProperty("组织ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("仓库ID")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.mhd.oms.domain.electronicSignature.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 电子签名物料明细表 electronic_signature_material_detail
|
||||
*/
|
||||
@Data
|
||||
@TableName("ELECTRONIC_SIGNATURE_MATERIAL_DETAIL")
|
||||
public class ElectronicSignatureMaterialDetail extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("明细ID")
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long detailId;
|
||||
|
||||
@ApiModelProperty("签名ID")
|
||||
private Long signatureId;
|
||||
|
||||
@ApiModelProperty("物料基础信息ID")
|
||||
private Long materialBaseInfoId;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
@ApiModelProperty("单位代码")
|
||||
private String unitCode;
|
||||
|
||||
@ApiModelProperty("单位名称")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty("批次号")
|
||||
private String batchNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
private String lotNumber;
|
||||
|
||||
@ApiModelProperty("仓库ID")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("库区ID")
|
||||
private Long storageSectionId;
|
||||
|
||||
@ApiModelProperty("库区编码")
|
||||
private String storageSectionCode;
|
||||
|
||||
@ApiModelProperty("库区名称")
|
||||
private String storageSectionName;
|
||||
|
||||
@ApiModelProperty("库位ID")
|
||||
private Long storageLocationId;
|
||||
|
||||
@ApiModelProperty("库位编码")
|
||||
private String storageLocationCode;
|
||||
|
||||
@ApiModelProperty("库位名称")
|
||||
private String storageLocationName;
|
||||
|
||||
@ApiModelProperty("业务唯一ID")
|
||||
private Long uniqueId;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子签名物料明细Service接口
|
||||
*/
|
||||
public interface IElectronicSignatureMaterialDetailService extends IService<ElectronicSignatureMaterialDetail> {
|
||||
|
||||
/**
|
||||
* 根据签名ID逻辑删除明细
|
||||
*/
|
||||
int deleteBySignatureId(Long signatureId);
|
||||
|
||||
/**
|
||||
* 批量插入明细
|
||||
*/
|
||||
boolean batchInsert(List<ElectronicSignatureMaterialDetail> detailList);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.todo.ElectronicSignatureDO;
|
||||
|
||||
/**
|
||||
* 电子签名Service接口
|
||||
*/
|
||||
public interface IElectronicSignatureService extends IService<ElectronicSignature> {
|
||||
|
||||
/**
|
||||
* 保存电子签名
|
||||
*/
|
||||
Boolean saveSignature(ElectronicSignatureDO electronicSignatureDO);
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
import com.mhd.oms.interfaces.dto.electronicSignature.ElectronicSignatureQueryDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子签名Mapper接口
|
||||
*/
|
||||
public interface ElectronicSignatureMapper extends BaseMapper<ElectronicSignature> {
|
||||
|
||||
@Select("SELECT NGWL_TEST_OMS.SEQ_ELECTRONIC_SIGNATURE.NEXTVAL FROM DUAL")
|
||||
Long nextSignatureId();
|
||||
|
||||
@Select("SELECT NGWL_TEST_OMS.SEQ_ES_MATERIAL_DETAIL.NEXTVAL FROM DUAL")
|
||||
Long nextDetailId();
|
||||
|
||||
@Select("SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE WHERE ORDER_ID = #{orderId} AND ORDER_TYPE = #{orderType} AND DEL_FLAG = 1")
|
||||
ElectronicSignature selectByOrderIdAndType(@Param("orderId") Long orderId, @Param("orderType") String orderType);
|
||||
|
||||
/**
|
||||
* 分页查询电子签名列表(需配合PageHelper使用)
|
||||
*/
|
||||
@Select("<script>"
|
||||
+ "SELECT s.* FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE s WHERE s.DEL_FLAG = 1"
|
||||
+ "<if test='params.orderType != null and params.orderType != \"\"'> AND s.ORDER_TYPE = #{params.orderType}</if>"
|
||||
+ "<if test='params.orderNumber != null and params.orderNumber != \"\"'> AND s.ORDER_NUMBER LIKE CONCAT('%', #{params.orderNumber}, '%')</if>"
|
||||
+ "<if test='params.signatureStatus != null'> AND s.SIGNATURE_STATUS = #{params.signatureStatus}</if>"
|
||||
+ "<if test='params.signatureMode != null'> AND s.SIGNATURE_MODE = #{params.signatureMode}</if>"
|
||||
+ "<if test='params.organizationId != null'> AND s.ORGANIZATION_ID = #{params.organizationId}</if>"
|
||||
+ "<if test='params.organizationName != null and params.organizationName != \"\"'> AND s.ORGANIZATION_NAME LIKE CONCAT('%', #{params.organizationName}, '%')</if>"
|
||||
+ "<if test='params.warehouseId != null'> AND s.WAREHOUSE_ID = #{params.warehouseId}</if>"
|
||||
+ "<if test='params.warehouseName != null and params.warehouseName != \"\"'> AND s.WAREHOUSE_NAME LIKE CONCAT('%', #{params.warehouseName}, '%')</if>"
|
||||
+ "<if test='params.createTimeFrom != null'> AND s.CREATE_TIME >= #{params.createTimeFrom}</if>"
|
||||
+ "<if test='params.createTimeTo != null'> AND s.CREATE_TIME <= #{params.createTimeTo}</if>"
|
||||
+ " ORDER BY s.CREATE_TIME DESC"
|
||||
+ "</script>")
|
||||
List<ElectronicSignature> selectSignatureList(@Param("params") ElectronicSignatureQueryDTO queryDTO);
|
||||
|
||||
/**
|
||||
* 根据签名ID查询
|
||||
*/
|
||||
@Select("SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE WHERE SIGNATURE_ID = #{signatureId} AND DEL_FLAG = 1")
|
||||
ElectronicSignature selectBySignatureId(@Param("signatureId") Long signatureId);
|
||||
|
||||
/**
|
||||
* 根据签名ID查询物料明细列表
|
||||
*/
|
||||
@Select("SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE_MATERIAL_DETAIL WHERE SIGNATURE_ID = #{signatureId} AND DEL_FLAG = 1")
|
||||
List<ElectronicSignatureMaterialDetail> selectMaterialDetailBySignatureId(@Param("signatureId") Long signatureId);
|
||||
|
||||
/**
|
||||
* 批量签名:根据签名ID列表更新签名信息
|
||||
*/
|
||||
@Update("<script>"
|
||||
+ "UPDATE NGWL_TEST_OMS.ELECTRONIC_SIGNATURE SET "
|
||||
+ "SIGNATURE_STATUS = 2, "
|
||||
+ "SIGNATURE_TIME = #{signatureTime}, "
|
||||
+ "<if test='signaturePic != null and signaturePic != \"\"'>SIGNATURE_PIC = #{signaturePic}, </if>"
|
||||
+ "<if test='evidencePics != null and evidencePics != \"\"'>EVIDENCE_PICS = #{evidencePics}, </if>"
|
||||
+ "<if test='signatureRemark != null and signatureRemark != \"\"'>SIGNATURE_REMARK = #{signatureRemark}, </if>"
|
||||
+ "<if test='signatureMode != null'>SIGNATURE_MODE = #{signatureMode}, </if>"
|
||||
+ "UPDATE_TIME = #{signatureTime} "
|
||||
+ "WHERE SIGNATURE_ID IN "
|
||||
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
|
||||
+ " AND DEL_FLAG = 1 AND SIGNATURE_STATUS = 1"
|
||||
+ "</script>")
|
||||
int batchUpdateSign(@Param("signatureIds") List<Long> signatureIds,
|
||||
@Param("signatureTime") Date signatureTime,
|
||||
@Param("signaturePic") String signaturePic,
|
||||
@Param("evidencePics") String evidencePics,
|
||||
@Param("signatureRemark") String signatureRemark,
|
||||
@Param("signatureMode") Integer signatureMode);
|
||||
|
||||
|
||||
@Update("<script>"
|
||||
+ "UPDATE NGWL_TEST_OMS.ELECTRONIC_SIGNATURE SET "
|
||||
+ "SIGNATURE_STATUS = 2, "
|
||||
+ "SIGNATURE_TIME = #{signatureTime}, "
|
||||
+ "<if test='signaturePic != null and signaturePic != \"\"'>SIGNATURE_PIC = #{signaturePic}, </if>"
|
||||
+ "<if test='evidencePics != null and evidencePics != \"\"'>EVIDENCE_PICS = #{evidencePics}, </if>"
|
||||
+ "<if test='signatureRemark != null and signatureRemark != \"\"'>SIGNATURE_REMARK = #{signatureRemark}, </if>"
|
||||
+ "<if test='signatureMode != null'>SIGNATURE_MODE = #{signatureMode}, </if>"
|
||||
+ "UPDATE_TIME = #{signatureTime} "
|
||||
+ "WHERE ORDER_ID IN "
|
||||
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
|
||||
+ " AND DEL_FLAG = 1 AND SIGNATURE_STATUS = 1"
|
||||
+ "</script>")
|
||||
int batchUpdateSignByOrder(@Param("signatureIds") List<Long> signatureIds,
|
||||
@Param("signatureTime") Date signatureTime,
|
||||
@Param("signaturePic") String signaturePic,
|
||||
@Param("evidencePics") String evidencePics,
|
||||
@Param("signatureRemark") String signatureRemark,
|
||||
@Param("signatureMode") Integer signatureMode);
|
||||
|
||||
/**
|
||||
* 根据签名ID列表批量查询
|
||||
*/
|
||||
@Select("<script>"
|
||||
+ "SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE "
|
||||
+ "WHERE SIGNATURE_ID IN "
|
||||
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
|
||||
+ " AND DEL_FLAG = 1"
|
||||
+ "</script>")
|
||||
List<ElectronicSignature> selectBySignatureIds(@Param("signatureIds") List<Long> signatureIds);
|
||||
|
||||
|
||||
@Select("<script>"
|
||||
+ "SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE "
|
||||
+ "WHERE ORDER_ID IN "
|
||||
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
|
||||
+ " AND DEL_FLAG = 1"
|
||||
+ "</script>")
|
||||
List<ElectronicSignature> selectByOrderIds(@Param("signatureIds") List<Long> signatureIds);
|
||||
|
||||
|
||||
@Update("UPDATE NGWL_TEST_WMS.STOCK_IN_ORDER SET SIGNATURE_STATUS = 2,SIGNATURE_TIME =now() WHERE IN_ORDER_ID = #{id}")
|
||||
int updateIn( @Param("id") Long id);
|
||||
|
||||
@Update("UPDATE NGWL_TEST_WMS.STOCK_OUT_ORDER SET SIGNATURE_STATUS = 2,SIGNATURE_TIME =now() WHERE OUT_ORDER_ID = #{id}")
|
||||
int updateOut(@Param("id") Long id);
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* 电子签名物料明细Mapper接口
|
||||
*/
|
||||
public interface ElectronicSignatureMaterialDetailMapper extends BaseMapper<ElectronicSignatureMaterialDetail> {
|
||||
|
||||
@Update("UPDATE NGWL_TEST_OMS.ELECTRONIC_SIGNATURE_MATERIAL_DETAIL SET DEL_FLAG = 2 WHERE SIGNATURE_ID = #{signatureId} AND DEL_FLAG = 1")
|
||||
int logicDeleteBySignatureId(@Param("signatureId") Long signatureId);
|
||||
|
||||
@Select("SELECT NGWL_TEST_OMS.SEQ_ES_MATERIAL_DETAIL.NEXTVAL FROM DUAL")
|
||||
Long nextDetailId();
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureService;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.mapper.ElectronicSignatureMapper;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.todo.ElectronicSignatureDO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 电子签名Service业务层处理
|
||||
*/
|
||||
@Service
|
||||
public class ElectronicSignatureImpl extends ServiceImpl<ElectronicSignatureMapper, ElectronicSignature> implements IElectronicSignatureService {
|
||||
|
||||
@Autowired
|
||||
private ElectronicSignatureMapper electronicSignatureMapper;
|
||||
|
||||
@Override
|
||||
public Boolean saveSignature(ElectronicSignatureDO electronicSignatureDO) {
|
||||
ElectronicSignature entity = new ElectronicSignature();
|
||||
BeanUtils.copyProperties(electronicSignatureDO, entity);
|
||||
Long id = electronicSignatureMapper.nextSignatureId();
|
||||
entity.setSignatureId(id);
|
||||
entity.setSignatureMode(2); // 2-电子签名
|
||||
return this.save(entity);
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureMaterialDetailService;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.mapper.ElectronicSignatureMaterialDetailMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子签名物料明细Service业务层处理
|
||||
*/
|
||||
@Service
|
||||
public class ElectronicSignatureMaterialDetailImpl extends ServiceImpl<ElectronicSignatureMaterialDetailMapper, ElectronicSignatureMaterialDetail> implements IElectronicSignatureMaterialDetailService {
|
||||
|
||||
@Autowired
|
||||
private ElectronicSignatureMaterialDetailMapper electronicSignatureMaterialDetailMapper;
|
||||
|
||||
@Override
|
||||
public int deleteBySignatureId(Long signatureId) {
|
||||
return electronicSignatureMaterialDetailMapper.logicDeleteBySignatureId(signatureId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean batchInsert(List<ElectronicSignatureMaterialDetail> detailList) {
|
||||
if (detailList == null || detailList.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
for (ElectronicSignatureMaterialDetail detail : detailList) {
|
||||
Long detailId = electronicSignatureMaterialDetailMapper.nextDetailId();
|
||||
detail.setDetailId(detailId);
|
||||
this.save(detail);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.todo;
|
||||
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子签名保存入参
|
||||
*/
|
||||
@Data
|
||||
public class ElectronicSignatureDO {
|
||||
|
||||
/** 订单ID */
|
||||
private Long orderId;
|
||||
|
||||
/** 订单号 */
|
||||
private String orderNumber;
|
||||
|
||||
/** 订单类型:IN-入库 OUT-出库 */
|
||||
private String orderType;
|
||||
|
||||
/** 组织ID */
|
||||
private Long organizationId;
|
||||
|
||||
/** 组织名称 */
|
||||
private String organizationName;
|
||||
|
||||
/** 一级组织ID */
|
||||
private Long topOrganizationId;
|
||||
|
||||
/** 仓库ID */
|
||||
private Long warehouseId;
|
||||
|
||||
/** 仓库编码 */
|
||||
private String warehouseCode;
|
||||
|
||||
/** 仓库名称 */
|
||||
private String warehouseName;
|
||||
|
||||
/** 创建人 */
|
||||
private Long createBy;
|
||||
|
||||
/** 创建人姓名 */
|
||||
private String createByName;
|
||||
|
||||
/** 物料明细列表 */
|
||||
private List<ElectronicSignatureMaterialDetail> materialDetailList;
|
||||
}
|
||||
+311
@@ -0,0 +1,311 @@
|
||||
package com.mhd.oms.domain.electronicSignature.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureMaterialDetailService;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureService;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.mapper.ElectronicSignatureMapper;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.todo.ElectronicSignatureDO;
|
||||
import com.mhd.oms.interfaces.dto.electronicSignature.ElectronicSignatureBatchSignDTO;
|
||||
import com.mhd.oms.interfaces.dto.electronicSignature.ElectronicSignatureQueryDTO;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.SignatureBatchFeignDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 电子签名领域服务
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ElectronicSignatureDomainService {
|
||||
|
||||
@Autowired
|
||||
private IElectronicSignatureService electronicSignatureService;
|
||||
|
||||
@Autowired
|
||||
private IElectronicSignatureMaterialDetailService electronicSignatureMaterialDetailService;
|
||||
|
||||
@Autowired
|
||||
private ElectronicSignatureMapper electronicSignatureMapper;
|
||||
|
||||
@Autowired(required = false)
|
||||
private WmsServiceFeign wmsServiceFeign;
|
||||
|
||||
/**
|
||||
* 保存电子签名记录(生成待签名记录)
|
||||
* 业务规则:
|
||||
* 1. 查询是否已有签名记录
|
||||
* 2. 若已签名(SIGNATURE_STATUS=2),跳过
|
||||
* 3. 若待签名(SIGNATURE_STATUS=1),覆盖明细(先逻辑删除旧明细,再插入新明细)
|
||||
* 4. 若不存在,新增主表+明细
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean saveSignature(ElectronicSignatureDO electronicSignatureDO) {
|
||||
Long orderId = electronicSignatureDO.getOrderId();
|
||||
String orderType = electronicSignatureDO.getOrderType();
|
||||
|
||||
// 查询是否已有签名记录
|
||||
ElectronicSignature existing = electronicSignatureMapper.selectByOrderIdAndType(orderId, orderType);
|
||||
|
||||
if (existing != null) {
|
||||
// 已签名,跳过
|
||||
if (existing.getSignatureStatus() != null && existing.getSignatureStatus() == 2) {
|
||||
log.info("订单 {} 已签名,跳过生成签名记录", electronicSignatureDO.getOrderNumber());
|
||||
return true;
|
||||
}
|
||||
|
||||
// 待签名,覆盖:逻辑删除旧明细,插入新明细
|
||||
log.info("订单 {} 已有待签名记录,覆盖明细", electronicSignatureDO.getOrderNumber());
|
||||
electronicSignatureMaterialDetailService.deleteBySignatureId(existing.getSignatureId());
|
||||
batchInsertDetails(existing.getSignatureId(), electronicSignatureDO.getMaterialDetailList());
|
||||
return true;
|
||||
}
|
||||
|
||||
// 不存在,新增
|
||||
log.info("订单 {} 生成新的待签名记录", electronicSignatureDO.getOrderNumber());
|
||||
electronicSignatureService.saveSignature(electronicSignatureDO);
|
||||
|
||||
// 查询刚插入的记录以获取签名ID
|
||||
ElectronicSignature newEntity = electronicSignatureMapper.selectByOrderIdAndType(orderId, orderType);
|
||||
if (newEntity != null) {
|
||||
batchInsertDetails(newEntity.getSignatureId(), electronicSignatureDO.getMaterialDetailList());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 保存电子签名记录(生成待签名记录)
|
||||
* 业务规则:
|
||||
* 1. 查询是否已有签名记录
|
||||
* 2. 若已签名(SIGNATURE_STATUS=2),跳过
|
||||
* 3. 若待签名(SIGNATURE_STATUS=1),覆盖明细(先逻辑删除旧明细,再插入新明细)
|
||||
* 4. 若不存在,新增主表+明细
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean inQqcode(ElectronicSignatureDO electronicSignatureDO) {
|
||||
Long orderId = electronicSignatureDO.getOrderId();
|
||||
ElectronicSignature existing = electronicSignatureService.getOne(new LambdaQueryWrapper<ElectronicSignature>()
|
||||
.eq(ElectronicSignature::getOrderId, orderId)
|
||||
.eq(ElectronicSignature::getDelFlag, 1), false);
|
||||
if (existing != null) {
|
||||
existing.setSignatureTime(new Date()); // 设置签名时间
|
||||
existing.setSignatureStatus(2); // 设置签名状态为已签名
|
||||
existing.setSignatureMode(1); // 设置签名方式为1-二维码
|
||||
electronicSignatureService.updateById(existing);
|
||||
electronicSignatureMapper.updateIn(existing.getOrderId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean outQqcode(ElectronicSignatureDO electronicSignatureDO) {
|
||||
Long orderId = electronicSignatureDO.getOrderId();
|
||||
ElectronicSignature existing = electronicSignatureService.getOne(new LambdaQueryWrapper<ElectronicSignature>()
|
||||
.eq(ElectronicSignature::getOrderId, orderId)
|
||||
.eq(ElectronicSignature::getDelFlag, 1), false);
|
||||
if (existing != null) {
|
||||
existing.setSignatureTime(new Date()); // 设置签名时间
|
||||
existing.setSignatureStatus(2); // 设置签名状态为已签名
|
||||
existing.setSignatureMode(1); // 设置签名方式为1-二维码
|
||||
electronicSignatureService.updateById(existing);
|
||||
electronicSignatureMapper.updateOut(existing.getOrderId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询电子签名列表
|
||||
*/
|
||||
public List<ElectronicSignature> querySignatureList(ElectronicSignatureQueryDTO queryDTO) {
|
||||
return electronicSignatureMapper.selectSignatureList(queryDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单编号查询电子签名列表
|
||||
*/
|
||||
public List<ElectronicSignature> getByOrderNumber(ElectronicSignatureQueryDTO queryDTO) {
|
||||
return electronicSignatureMapper.selectList(new LambdaQueryWrapper<ElectronicSignature>()
|
||||
.eq(ElectronicSignature::getOrderNumber, queryDTO.getOrderNumber())
|
||||
.eq(ElectronicSignature::getDelFlag, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据签名ID查询
|
||||
*/
|
||||
public ElectronicSignature getSignatureById(Long signatureId) {
|
||||
return electronicSignatureMapper.selectBySignatureId(signatureId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据签名ID查询物料明细
|
||||
*/
|
||||
public List<ElectronicSignatureMaterialDetail> queryMaterialDetailBySignatureId(Long signatureId) {
|
||||
return electronicSignatureMapper.selectMaterialDetailBySignatureId(signatureId);
|
||||
}
|
||||
|
||||
private void batchInsertDetails(Long signatureId, List<ElectronicSignatureMaterialDetail> detailList) {
|
||||
if (detailList == null || detailList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (ElectronicSignatureMaterialDetail detail : detailList) {
|
||||
detail.setSignatureId(signatureId);
|
||||
}
|
||||
electronicSignatureMaterialDetailService.batchInsert(detailList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量签名:勾选多条记录后批量签名
|
||||
*
|
||||
* <p>业务流程:
|
||||
* 1. 查询OMS电子签名表,获取每条记录的 orderId + orderType
|
||||
* 2. 更新OMS ELECTRONIC_SIGNATURE表:signatureStatus=2(已签名)、signatureTime、signaturePic、
|
||||
* evidencePics、signatureRemark、signatureMode
|
||||
* 3. 按订单类型分组后,调用WMS Feign更新WMS stock_in_order / stock_out_order表
|
||||
* </p>
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int batchSign(ElectronicSignatureBatchSignDTO dto) {
|
||||
List<Long> signatureIds = dto.getSignatureIds();
|
||||
if (CollectionUtil.isEmpty(signatureIds)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 1. 查询签名记录,获取 orderId + orderType
|
||||
List<ElectronicSignature> signatureList = electronicSignatureMapper.selectBySignatureIds(signatureIds);
|
||||
if (CollectionUtil.isEmpty(signatureList)) {
|
||||
log.warn("批量签名失败:未找到有效的签名记录");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 2. 更新OMS电子签名表
|
||||
Date now = new Date();
|
||||
String evidencePicsStr = null;
|
||||
if (CollectionUtil.isNotEmpty(dto.getEvidencePics())) {
|
||||
evidencePicsStr = String.join(",", dto.getEvidencePics());
|
||||
}
|
||||
|
||||
int updated = electronicSignatureMapper.batchUpdateSign(
|
||||
signatureIds, now,
|
||||
dto.getSignaturePic(),
|
||||
evidencePicsStr,
|
||||
dto.getSignatureRemark(),
|
||||
2);
|
||||
log.info("批量签名:OMS电子签名表更新 {} 条", updated);
|
||||
|
||||
// 3. 按订单类型分组,调用WMS更新入/出库表
|
||||
if (wmsServiceFeign != null) {
|
||||
try {
|
||||
// 分组:IN-入库、OUT-出库
|
||||
List<Long> inOrderIds = signatureList.stream()
|
||||
.filter(s -> "IN".equals(s.getOrderType()))
|
||||
.map(ElectronicSignature::getOrderId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<Long> outOrderIds = signatureList.stream()
|
||||
.filter(s -> "OUT".equals(s.getOrderType()))
|
||||
.map(ElectronicSignature::getOrderId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 构建 WMS 批量签名 DTO(一次调用同时处理入库+出库)
|
||||
SignatureBatchFeignDTO wmsDto = new SignatureBatchFeignDTO();
|
||||
wmsDto.setInOrderIds(inOrderIds.isEmpty() ? null : inOrderIds);
|
||||
wmsDto.setOutOrderIds(outOrderIds.isEmpty() ? null : outOrderIds);
|
||||
wmsDto.setSignatureStatus(2);
|
||||
wmsDto.setSignatureTime(now);
|
||||
wmsDto.setSignaturePic(dto.getSignaturePic());
|
||||
wmsDto.setEvidencePics(evidencePicsStr);
|
||||
wmsDto.setSignatureRemark(dto.getSignatureRemark());
|
||||
|
||||
log.info("批量签名:调用WMS更新入/出库单,入库{}条,出库{}条",
|
||||
inOrderIds.size(), outOrderIds.size());
|
||||
wmsServiceFeign.batchSignWms(wmsDto);
|
||||
} catch (Exception e) {
|
||||
log.error("批量签名:调用WMS更新入/出库表失败", e);
|
||||
// WMS更新失败不影响OMS表更新结果,仅记录日志
|
||||
}
|
||||
}
|
||||
|
||||
return updated;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int batchSignByWmsId(ElectronicSignatureBatchSignDTO dto) {
|
||||
List<Long> signatureIds = dto.getSignatureIds();
|
||||
if (CollectionUtil.isEmpty(signatureIds)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 1. 查询签名记录,获取 orderId + orderType
|
||||
List<ElectronicSignature> signatureList = electronicSignatureMapper.selectByOrderIds(signatureIds);
|
||||
if (CollectionUtil.isEmpty(signatureList)) {
|
||||
log.warn("批量签名失败:未找到有效的签名记录");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 2. 更新OMS电子签名表
|
||||
Date now = new Date();
|
||||
String evidencePicsStr = null;
|
||||
if (CollectionUtil.isNotEmpty(dto.getEvidencePics())) {
|
||||
evidencePicsStr = String.join(",", dto.getEvidencePics());
|
||||
}
|
||||
|
||||
int updated = electronicSignatureMapper.batchUpdateSignByOrder(
|
||||
signatureIds, now,
|
||||
dto.getSignaturePic(),
|
||||
evidencePicsStr,
|
||||
dto.getSignatureRemark(),
|
||||
2);
|
||||
log.info("批量签名:OMS电子签名表更新 {} 条", updated);
|
||||
|
||||
// 3. 按订单类型分组,调用WMS更新入/出库表
|
||||
// if (wmsServiceFeign != null) {
|
||||
// try {
|
||||
// // 分组:IN-入库、OUT-出库
|
||||
// List<Long> inOrderIds = signatureList.stream()
|
||||
// .filter(s -> "IN".equals(s.getOrderType()))
|
||||
// .map(ElectronicSignature::getOrderId)
|
||||
// .distinct()
|
||||
// .collect(Collectors.toList());
|
||||
// List<Long> outOrderIds = signatureList.stream()
|
||||
// .filter(s -> "OUT".equals(s.getOrderType()))
|
||||
// .map(ElectronicSignature::getOrderId)
|
||||
// .distinct()
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// // 构建 WMS 批量签名 DTO(一次调用同时处理入库+出库)
|
||||
// SignatureBatchFeignDTO wmsDto = new SignatureBatchFeignDTO();
|
||||
// wmsDto.setInOrderIds(inOrderIds.isEmpty() ? null : inOrderIds);
|
||||
// wmsDto.setOutOrderIds(outOrderIds.isEmpty() ? null : outOrderIds);
|
||||
// wmsDto.setSignatureStatus(2);
|
||||
// wmsDto.setSignatureTime(now);
|
||||
// wmsDto.setSignaturePic(dto.getSignaturePic());
|
||||
// wmsDto.setEvidencePics(evidencePicsStr);
|
||||
// wmsDto.setSignatureRemark(dto.getSignatureRemark());
|
||||
//
|
||||
// log.info("批量签名:调用WMS更新入/出库单,入库{}条,出库{}条",
|
||||
// inOrderIds.size(), outOrderIds.size());
|
||||
// wmsServiceFeign.batchSignWms(wmsDto);
|
||||
// } catch (Exception e) {
|
||||
// log.error("批量签名:调用WMS更新入/出库表失败", e);
|
||||
// // WMS更新失败不影响OMS表更新结果,仅记录日志
|
||||
// }
|
||||
// }
|
||||
|
||||
return updated;
|
||||
}
|
||||
}
|
||||
+6
@@ -3,6 +3,7 @@ package com.mhd.oms.domain.executionInMaterialDetail.repository.facade;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.entity.ExecutionInMaterialDetail;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.InventoryAdjustmentRecordPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailBaseDO;
|
||||
@@ -65,4 +66,9 @@ public interface IExecutionInMaterialDetailService extends IService<ExecutionInM
|
||||
public ExecutionInMaterialDetailPO getInfo(Long materialDetailId);
|
||||
|
||||
public List<InventoryAdjustmentRecordPO> getkctzjl(Long materialBaseInfoId, String orderNumber, String adjustType);
|
||||
|
||||
/**
|
||||
* 入库明细查询(关联入库执行单)
|
||||
*/
|
||||
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
|
||||
}
|
||||
+6
@@ -3,6 +3,7 @@ package com.mhd.oms.domain.executionInMaterialDetail.repository.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.entity.ExecutionInMaterialDetail;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.InventoryAdjustmentRecordPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
|
||||
@@ -30,4 +31,9 @@ public interface ExecutionInMaterialDetailMapper extends BaseMapper<ExecutionInM
|
||||
|
||||
public List<InventoryAdjustmentRecordPO> getkctzjl(@Param("materialBaseInfoId") Long materialBaseInfoId, @Param("orderNumber") String orderNumber, @Param("adjustType") String adjustType);
|
||||
|
||||
/**
|
||||
* 入库明细查询(关联入库执行单)
|
||||
*/
|
||||
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
|
||||
|
||||
}
|
||||
+9
@@ -12,6 +12,7 @@ import com.mhd.oms.domain.executionInMaterialDetail.entity.ExecutionInMaterialDe
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.facade.IExecutionInMaterialDetailService;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.mapper.ExecutionInMaterialDetailMapper;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.InventoryAdjustmentRecordPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailBaseDO;
|
||||
@@ -309,4 +310,12 @@ public class ExecutionInMaterialDetailImpl extends ServiceImpl<ExecutionInMateri
|
||||
return inMaterialDetailMapper.getkctzjl(materialBaseInfoId, orderNumber, adjustType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库明细查询(关联入库执行单)
|
||||
*/
|
||||
@Override
|
||||
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
return inMaterialDetailMapper.queryInOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.mhd.oms.domain.executionInMaterialDetail.repository.po;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 入库明细查询结果(关联入库执行单)
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Data
|
||||
public class ExecutionInMaterialDetailWithOrderPO extends ExecutionInMaterialDetailPO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("入库单状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
|
||||
private Integer inOrderStatus;
|
||||
|
||||
@ApiModelProperty("入库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
|
||||
private Integer inOrderAuditStatus;
|
||||
|
||||
@ApiModelProperty("货主ID")
|
||||
private Long orderShipperId;
|
||||
|
||||
@ApiModelProperty("货主编码")
|
||||
private String orderShipperCode;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
private String orderShipperName;
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.mhd.oms.domain.executionInMaterialDetail.repository.todo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 入库明细查询参数 DTO
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Data
|
||||
public class ExecutionInMaterialDetailQueryDTO extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("仓库id")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("货主id")
|
||||
private Long shipperId;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
private String shipperName;
|
||||
|
||||
@ApiModelProperty("入库单类型编码")
|
||||
private String inOrderTypeCode;
|
||||
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
|
||||
private Integer inStatus;
|
||||
|
||||
@ApiModelProperty("预计到货时间 开始")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date inOrderExpectStartTime;
|
||||
|
||||
@ApiModelProperty("预计到货时间 结束")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date inOrderExpectEndTime;
|
||||
|
||||
@ApiModelProperty("物料基础信息id")
|
||||
private Long materialBaseInfoId;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
private String materialName;
|
||||
}
|
||||
+16
@@ -2,7 +2,9 @@ package com.mhd.oms.domain.executionInMaterialDetail.service;
|
||||
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -69,4 +71,18 @@ public class ExecutionInMaterialDetailApplicationService {
|
||||
return inMaterialDetailDomainService.getInfo(materialDetailId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库明细查询(关联入库执行单)
|
||||
*/
|
||||
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1) {
|
||||
queryOrderOverStockDO.setTopOrganizationId(topOrganizationId);
|
||||
}
|
||||
}
|
||||
return inMaterialDetailDomainService.queryInOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -8,6 +8,8 @@ import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDTO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailQueryDTO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -62,4 +64,13 @@ public class ExecutionInMaterialDetailAssembler {
|
||||
return inMaterialDetailDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库明细查询 DTO → QueryOrderOverStockDO
|
||||
*/
|
||||
public QueryOrderOverStockDO toQueryDO(ExecutionInMaterialDetailQueryDTO queryDTO) {
|
||||
QueryOrderOverStockDO queryDO = new QueryOrderOverStockDO();
|
||||
BeanUtils.copyProperties(queryDTO, queryDO, IgnoreNullUtil.getNullPropertyNames(queryDTO));
|
||||
return queryDO;
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -2,7 +2,9 @@ package com.mhd.oms.domain.executionInMaterialDetail.service;
|
||||
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.facade.IExecutionInMaterialDetailService;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -62,4 +64,11 @@ public class ExecutionInMaterialDetailDomainService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 入库明细查询(关联入库执行单)
|
||||
*/
|
||||
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
return materialDetailService.queryInOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
|
||||
}
|
||||
+6
@@ -3,6 +3,7 @@ package com.mhd.oms.domain.executionOutMaterialDetail.repository.facade;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.entity.ExecutionOutMaterialDetail;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailBaseDO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
@@ -62,4 +63,9 @@ public interface IExecutionOutMaterialDetailService extends IService<ExecutionOu
|
||||
* 查询物料明细
|
||||
*/
|
||||
public ExecutionOutMaterialDetailPO getInfo(Long materialDetailId);
|
||||
|
||||
/**
|
||||
* 出库明细查询(关联出库执行单)
|
||||
*/
|
||||
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
|
||||
}
|
||||
+6
@@ -3,6 +3,7 @@ package com.mhd.oms.domain.executionOutMaterialDetail.repository.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.entity.ExecutionOutMaterialDetail;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -67,4 +68,9 @@ public interface ExecutionOutMaterialDetailMapper extends BaseMapper<ExecutionOu
|
||||
public String getLotByKcId(@Param("id") Long id);
|
||||
|
||||
public String getInLotNo(@Param("inOrderNumber") String inOrderNumber, @Param("baseId") Long baseId);
|
||||
|
||||
/**
|
||||
* 出库明细查询(关联出库执行单)
|
||||
*/
|
||||
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
|
||||
}
|
||||
+10
@@ -12,6 +12,7 @@ import com.mhd.oms.domain.executionOutMaterialDetail.entity.ExecutionOutMaterial
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.facade.IExecutionOutMaterialDetailService;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.mapper.ExecutionOutMaterialDetailMapper;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailBaseDO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
|
||||
import com.mhd.oms.domain.executionStockInOrder.repository.mapper.ExecutionStockInOrderMapper;
|
||||
@@ -261,4 +262,13 @@ public class ExecutionOutMaterialDetailImpl extends ServiceImpl<ExecutionOutMate
|
||||
BeanUtils.copyProperties(outMaterialDetail, outMaterialDetailPO);
|
||||
return outMaterialDetailPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库明细查询(关联出库执行单)
|
||||
*/
|
||||
@Override
|
||||
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
return outMaterialDetailMapper.queryOutOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.mhd.oms.domain.executionOutMaterialDetail.repository.po;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 出库明细查询结果(关联出库执行单)
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Data
|
||||
public class ExecutionOutMaterialDetailWithOrderPO extends ExecutionOutMaterialDetailPO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("出库单状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
private Integer outOrderStatus;
|
||||
|
||||
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
|
||||
private Integer outOrderAuditStatus;
|
||||
|
||||
@ApiModelProperty("货主ID")
|
||||
private Long orderShipperId;
|
||||
|
||||
@ApiModelProperty("货主编码")
|
||||
private String orderShipperCode;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
private String orderShipperName;
|
||||
|
||||
@ApiModelProperty("出仓日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date orderOutboundDate;
|
||||
|
||||
@ApiModelProperty("出库时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date orderOutboundTime;
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.mhd.oms.domain.executionOutMaterialDetail.repository.todo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 出库明细查询参数 DTO
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Data
|
||||
public class ExecutionOutMaterialDetailQueryDTO extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("仓库id")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("货主id")
|
||||
private Long shipperId;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
private String shipperName;
|
||||
|
||||
@ApiModelProperty("出库单类型编码")
|
||||
private String outOrderTypeCode;
|
||||
|
||||
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
private Integer outStatus;
|
||||
|
||||
@ApiModelProperty("预计出库时间 开始")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date outOrderExpectStartTime;
|
||||
|
||||
@ApiModelProperty("预计出库时间 结束")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date outOrderExpectEndTime;
|
||||
|
||||
@ApiModelProperty("物料基础信息id")
|
||||
private Long materialBaseInfoId;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
private String materialName;
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.mhd.oms.domain.executionOutMaterialDetail.service;
|
||||
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出库明细ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ExecutionOutMaterialDetailApplicationService {
|
||||
@Autowired
|
||||
private ExecutionOutMaterialDetailDomainService outMaterialDetailDomainService;
|
||||
|
||||
/**
|
||||
* 出库明细查询(关联出库执行单)
|
||||
*/
|
||||
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1) {
|
||||
queryOrderOverStockDO.setTopOrganizationId(topOrganizationId);
|
||||
}
|
||||
}
|
||||
return outMaterialDetailDomainService.queryOutOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.mhd.oms.domain.executionOutMaterialDetail.service;
|
||||
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailQueryDTO;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 出库明细Assembler
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Component
|
||||
public class ExecutionOutMaterialDetailAssembler {
|
||||
|
||||
/**
|
||||
* 出库明细查询 DTO → QueryOrderOverStockDO
|
||||
*/
|
||||
public QueryOrderOverStockDO toQueryDO(ExecutionOutMaterialDetailQueryDTO queryDTO) {
|
||||
QueryOrderOverStockDO queryDO = new QueryOrderOverStockDO();
|
||||
BeanUtils.copyProperties(queryDTO, queryDO, IgnoreNullUtil.getNullPropertyNames(queryDTO));
|
||||
return queryDO;
|
||||
}
|
||||
}
|
||||
+9
@@ -5,7 +5,9 @@ package com.mhd.oms.domain.executionOutMaterialDetail.service;
|
||||
//import com.mhd.wms.domain.outMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.facade.IExecutionOutMaterialDetailService;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -64,4 +66,11 @@ public class ExecutionOutMaterialDetailDomainService {
|
||||
return outMaterialDetailService.getInfo(materialDetailId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库明细查询(关联出库执行单)
|
||||
*/
|
||||
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
return outMaterialDetailService.queryOutOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
|
||||
}
|
||||
+3
@@ -456,4 +456,7 @@ public class ExecutionStockInOrder extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty("业务计价方式")
|
||||
private String businessPriceWay;
|
||||
|
||||
@ApiModelProperty("通知单备注")
|
||||
private String noticeRemark;
|
||||
}
|
||||
+2
@@ -480,4 +480,6 @@ public class ExecutionStockInOrderPO extends BaseVOEntity {
|
||||
@ApiModelProperty("业务计价方式")
|
||||
private String businessPriceWay;
|
||||
private String khdm;
|
||||
@ApiModelProperty("通知单备注")
|
||||
private String noticeRemark;
|
||||
}
|
||||
+2
@@ -511,4 +511,6 @@ public class ExecutionStockInOrderDO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty("业务计价方式")
|
||||
private String businessPriceWay;
|
||||
@ApiModelProperty("通知单备注")
|
||||
private String noticeRemark;
|
||||
}
|
||||
+2
@@ -508,4 +508,6 @@ public class ExecutionStockInOrderDTO extends ExecutionStockInOrderBaseDTO {
|
||||
|
||||
@ApiModelProperty("业务计价方式")
|
||||
private String businessPriceWay;
|
||||
@ApiModelProperty("通知单备注")
|
||||
private String noticeRemark;
|
||||
}
|
||||
+91
-4
@@ -30,6 +30,7 @@ import com.mhd.oms.domain.executionStockInOrder.repository.todo.ExecutionStockIn
|
||||
import com.mhd.oms.domain.executionStockOutOrder.entity.ExecutionStockOutOrder;
|
||||
import com.mhd.oms.domain.executionStockOutOrder.repository.facade.IExecutionStockOutOrderService;
|
||||
import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper;
|
||||
import com.mhd.oms.domain.reserveStockInOrder.repository.mapper.ReserveStockInOrderMapper;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.*;
|
||||
@@ -43,6 +44,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -89,6 +91,8 @@ public class ExecutionStockInOrderDomainService {
|
||||
// private IShelfMaterialDetailService shelfMaterialDetailService;
|
||||
@Resource
|
||||
private ReservationStockInOrderMapper stockInOrderMapper;
|
||||
@Autowired
|
||||
private ReserveStockInOrderMapper reserveStockInOrderMapper;
|
||||
/**
|
||||
* 分页查询入库单列表
|
||||
*/
|
||||
@@ -96,14 +100,70 @@ public class ExecutionStockInOrderDomainService {
|
||||
return stockInOrderService.queryList(stockInOrderDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入库单
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insert(ExecutionStockInOrderDO stockInOrderDO) {
|
||||
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||
stockInOrderDO.setInOrderNumber(OrderSequence.getOrderCode("RK"));
|
||||
//设置入库单号
|
||||
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 = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockInOrderDO.setInOrderNumber(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);
|
||||
}
|
||||
// //设置默认值
|
||||
// setDefaultValues(stockInOrderDO);
|
||||
@@ -132,8 +192,35 @@ public class ExecutionStockInOrderDomainService {
|
||||
*/
|
||||
public Boolean batchInsert(List<ExecutionStockInOrderDO> stockInOrderDOList) {
|
||||
for (ExecutionStockInOrderDO stockInOrderDO : stockInOrderDOList){
|
||||
if (StringUtils.isBlank(stockInOrderDO.getInOrderNumber())){
|
||||
stockInOrderDO.setInOrderNumber(OrderSequence.getOrderCode("RK"));
|
||||
//设置入库单号
|
||||
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 = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockInOrderDO.setInOrderNumber(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);
|
||||
}
|
||||
// //设置物料信息
|
||||
// setMaterialDetailInfo(stockInOrderDO);
|
||||
|
||||
+103
-5
@@ -8,6 +8,7 @@ import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.OrderSequence;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.businessDeliveryDetailsLink.entity.BusinessDeliveryDetailsLink;
|
||||
import com.mhd.oms.domain.businessDeliveryDetailsLink.repository.facade.IBusinessDeliveryDetailsLinkService;
|
||||
@@ -38,6 +39,8 @@ import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.mapper
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper;
|
||||
import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper;
|
||||
import com.mhd.oms.domain.reserveStockInOrder.repository.mapper.ReserveStockInOrderMapper;
|
||||
import com.mhd.oms.domain.reserveStockOutOrder.repository.mapper.ReserveStockOutOrderMapper;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.*;
|
||||
@@ -50,6 +53,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -96,6 +100,8 @@ public class ExecutionStockOutOrderDomainService {
|
||||
private ReservationMaterialInventoryMapper reservationMaterialInventoryMapper;
|
||||
@Autowired
|
||||
private ReservationStockInOrderMapper stockInOrderMapper;
|
||||
@Autowired
|
||||
private ReserveStockOutOrderMapper reserveStockOutOrderMapper;
|
||||
/**
|
||||
* 分页查询出库单列表
|
||||
*/
|
||||
@@ -103,14 +109,74 @@ public class ExecutionStockOutOrderDomainService {
|
||||
return stockOutOrderService.queryList(stockOutOrderDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
/**
|
||||
* 新增出库单
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insert(ExecutionStockOutOrderDO stockOutOrderDO) {
|
||||
if (stockOutOrderDO.getOutOrderNumber() == null) {
|
||||
stockOutOrderDO.setOutOrderNumber(OrderSequence.getOrderCode("CK"));
|
||||
//设置单号
|
||||
Long warehouseId = stockOutOrderDO.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.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);
|
||||
}
|
||||
// 与 update / batchInsert 一致:前端传计划数量为 quantity,非 outboundQuantity
|
||||
setMaterialDetailInfo(stockOutOrderDO);
|
||||
@@ -147,8 +213,40 @@ public class ExecutionStockOutOrderDomainService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean batchInsert(List<ExecutionStockOutOrderDO> stockOutOrderDOList) {
|
||||
for (ExecutionStockOutOrderDO stockOutOrderDO : stockOutOrderDOList){
|
||||
if (StringUtils.isBlank(stockOutOrderDO.getOutOrderNumber())){
|
||||
stockOutOrderDO.setOutOrderNumber(OrderSequence.getOrderCode("CK"));
|
||||
//设置单号
|
||||
Long warehouseId = stockOutOrderDO.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.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);
|
||||
}
|
||||
//设置物料信息
|
||||
setMaterialDetailInfo(stockOutOrderDO);
|
||||
|
||||
+4
@@ -61,6 +61,10 @@ public class ReservationStockInOrder extends BaseVOEntity {
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行入库单号")
|
||||
@Excel(name = "执行入库单号")
|
||||
private String executionInOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
|
||||
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
|
||||
private Integer status;
|
||||
|
||||
+69
-3
@@ -39,6 +39,7 @@ import com.mhd.oms.domain.reservationStockOutOrder.repository.facade.IReservatio
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.mapper.ReservationStockOutOrderMapper;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.todo.ReservationStockOutOrderDO;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.service.ReservationStockOutOrderApplicationService;
|
||||
import com.mhd.oms.domain.reserveStockInOrder.repository.mapper.ReserveStockInOrderMapper;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
@@ -87,7 +88,8 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
||||
private IReservationInMaterialDetailService materialDetailService;
|
||||
@Autowired
|
||||
private ReservationStockInOrderDomainService reservationStockInOrderDomainService;
|
||||
|
||||
@Autowired
|
||||
private ReserveStockInOrderMapper reservationStockInOrderMapper;
|
||||
/**
|
||||
* 查询入库单列表
|
||||
*/
|
||||
@@ -504,12 +506,76 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
||||
return insertDomain(stockInOrderDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertDomain(ReservationStockInOrderDO stockInOrderDO) {
|
||||
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||
// if (stockInOrderDO.getInOrderNumber() == null) {
|
||||
|
||||
//设置入库单号
|
||||
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);
|
||||
}
|
||||
stockInOrderDO.setInOrderNumber(reservationStockInOrderDomainService.generateReserveOrderNumber());
|
||||
stockInOrderDO.setBusinessOrderNo(stockInOrderDO.getInOrderNumber());
|
||||
}
|
||||
// }
|
||||
// //统计总计划数
|
||||
BigDecimal quantity = stockInOrderDO.getMaterialDetailList().stream().map(ReservationInMaterialDetailDO::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
stockInOrderDO.setQuantity(quantity);
|
||||
|
||||
+8
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.entity.BusinessDocumentOrder;
|
||||
import com.mhd.oms.domain.executionStockInOrder.entity.ExecutionStockInOrder;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.po.ReservationInMaterialDetailPO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -62,6 +63,10 @@ public class ReservationStockInOrderPO extends BaseVOEntity {
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行入库单号")
|
||||
@Excel(name = "执行入库单号")
|
||||
private String executionInOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
private Integer status;
|
||||
@@ -242,6 +247,9 @@ public class ReservationStockInOrderPO extends BaseVOEntity {
|
||||
@ApiModelProperty("物料明细")
|
||||
private List<ReservationInMaterialDetailPO> materialDetailList;
|
||||
|
||||
@ApiModelProperty("执行单列表")
|
||||
private List<ExecutionStockInOrder> executionStockInOrderList;
|
||||
|
||||
@ApiModelProperty("越库单id")
|
||||
private Long overStockId;
|
||||
|
||||
|
||||
+4
@@ -59,6 +59,10 @@ public class ReservationStockInOrderDO extends BaseVOEntity {
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行入库单号")
|
||||
@Excel(name = "执行入库单号")
|
||||
private String executionInOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
private Integer status;
|
||||
|
||||
+4
@@ -59,6 +59,10 @@ public class ReservationStockInOrderDTO extends ReservationStockInOrderBaseDTO {
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行入库单号")
|
||||
@Excel(name = "执行入库单号")
|
||||
private String executionInOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
private Integer status;
|
||||
|
||||
+7
-7
@@ -136,13 +136,13 @@ public class ReservationStockInOrderApplicationService {
|
||||
}
|
||||
}
|
||||
// 前端有传warehouseId则优先使用传参;未传时才使用"用户关联仓库"作为默认值
|
||||
if (stockInOrderDO.getWarehouseId() == null) {
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO =
|
||||
SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
if (associationWarehouseCacheDO != null) {
|
||||
stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
}
|
||||
}
|
||||
// if (stockInOrderDO.getWarehouseId() == null) {
|
||||
// AssociationWarehouseCacheDO associationWarehouseCacheDO =
|
||||
// SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
// if (associationWarehouseCacheDO != null) {
|
||||
// stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// 库管角色过滤:不展示已创建(status=1)的入库单
|
||||
|
||||
+163
-4
@@ -99,6 +99,48 @@ public class ReservationStockInOrderDomainService {
|
||||
return stockInOrderService.queryList(stockInOrderDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成入库预约单号
|
||||
*/
|
||||
// public String generateReserveOrderNumber() {
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
|
||||
// String datePart = sdf.format(new Date());
|
||||
// String prefix = "R" + datePart;
|
||||
// int todayCount = reservationStockInOrderMapper.countByOrderNumberPrefix(prefix);
|
||||
// String seq = String.format("%03d", todayCount + 1);
|
||||
// return prefix + seq;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增入库单
|
||||
@@ -106,6 +148,40 @@ public class ReservationStockInOrderDomainService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insert(ReservationStockInOrderDO stockInOrderDO) {
|
||||
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||
|
||||
//设置入库单号
|
||||
// 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 = 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);
|
||||
// }
|
||||
|
||||
stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
||||
stockInOrderDO.setBusinessOrderNo(stockInOrderDO.getInOrderNumber());
|
||||
}
|
||||
@@ -136,9 +212,12 @@ public class ReservationStockInOrderDomainService {
|
||||
*/
|
||||
public Boolean batchInsert(List<ReservationStockInOrderDO> stockInOrderDOList) {
|
||||
for (ReservationStockInOrderDO stockInOrderDO : stockInOrderDOList){
|
||||
if (StringUtils.isBlank(stockInOrderDO.getInOrderNumber())){
|
||||
stockInOrderDO.setInOrderNumber(OrderSequence.getOrderCode("RK"));
|
||||
|
||||
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||
stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
||||
stockInOrderDO.setBusinessOrderNo(stockInOrderDO.getInOrderNumber());
|
||||
}
|
||||
|
||||
// //设置物料信息
|
||||
// setMaterialDetailInfo(stockInOrderDO);
|
||||
// //统计总物料种数
|
||||
@@ -247,6 +326,12 @@ public class ReservationStockInOrderDomainService {
|
||||
String inOrderNumber = stockInOrderPO.getInOrderNumber();
|
||||
List<BusinessDocumentOrder> businessDocumentOrders = businessDocumentOrderMapper.selectList(new LambdaQueryWrapper<BusinessDocumentOrder>().eq(BusinessDocumentOrder::getInOrderNumber, inOrderNumber).notIn(BusinessDocumentOrder::getOrderStatus,4,5));
|
||||
stockInOrderPO.setBusinessDocumentOrderDOList(businessDocumentOrders);
|
||||
//执行单
|
||||
List<ExecutionStockInOrder> executionStockInOrders = executionStockInOrderMapper.selectList(new LambdaQueryWrapper<ExecutionStockInOrder>()
|
||||
.eq(ExecutionStockInOrder::getBusinessInOrderNumber, inOrderNumber)
|
||||
.eq(ExecutionStockInOrder::getDelFlag, 1));
|
||||
stockInOrderPO.setExecutionStockInOrderList(executionStockInOrders);
|
||||
|
||||
inMaterialDetailDO.setInOrderNumber(inOrderNumber);
|
||||
inMaterialDetailDO.setLevel(1);
|
||||
List<ReservationInMaterialDetailPO> inMaterialDetailPOList = materialDetailService.queryList(inMaterialDetailDO);
|
||||
@@ -547,6 +632,7 @@ public class ReservationStockInOrderDomainService {
|
||||
// 按照 warehouseId 分组
|
||||
Map<Long, List<ReservationInMaterialDetail>> materialDetailGroupByWarehouse = materialDetailList.stream()
|
||||
.collect(Collectors.groupingBy(ReservationInMaterialDetail::getWarehouseId));
|
||||
List<String> executionInOrderNumbers = new ArrayList<>();
|
||||
materialDetailGroupByWarehouse.forEach((warehouseId, details) -> {
|
||||
Long topOrgId = reservationStockInOrderMapper.getTopOrgId(warehouseId);
|
||||
Long orgId = reservationStockInOrderMapper.getOrgId(warehouseId);
|
||||
@@ -574,7 +660,40 @@ public class ReservationStockInOrderDomainService {
|
||||
reservationStockInOrder.setWarehouseCode(warehouseCode);
|
||||
reservationStockInOrder.setWarehouseName(warehouseName);
|
||||
reservationStockInOrder.setBusinessInOrderNumber(inOrderNumber);
|
||||
reservationStockInOrder.setInOrderNumber(generateExecutionOrderNumber(warehouseCode));
|
||||
|
||||
|
||||
//设置入库单号
|
||||
Long warehouseId1 = reservationStockInOrder.getWarehouseId();
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId1);
|
||||
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 = reservationStockInOrder.getOrganizationId();
|
||||
Long warehouseIdForCount = reservationStockInOrder.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);
|
||||
reservationStockInOrder.setInOrderNumber(datePrefix + seq);
|
||||
// reservationStockInOrder.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);
|
||||
reservationStockInOrder.setInOrderNumber(prefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(prefix + seq);
|
||||
}
|
||||
|
||||
List<ExecutionInMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
||||
int index = 1;
|
||||
@@ -597,8 +716,11 @@ public class ReservationStockInOrderDomainService {
|
||||
BigDecimal quantity = details.stream().map(ReservationInMaterialDetail::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
reservationStockInOrder.setQuantity(quantity);
|
||||
executionStockInOrderService.save(reservationStockInOrder);
|
||||
executionInOrderNumbers.add(reservationStockInOrder.getInOrderNumber());
|
||||
executionInMaterialDetailService.saveBatch(inMaterialDetailList);
|
||||
});
|
||||
byId.setExecutionInOrderNumber(String.join(",", executionInOrderNumbers));
|
||||
stockInOrderService.updateById(byId);
|
||||
}
|
||||
|
||||
|
||||
@@ -700,6 +822,7 @@ public class ReservationStockInOrderDomainService {
|
||||
// 按照 warehouseId 分组
|
||||
Map<Long, List<ReservationInMaterialDetail>> materialDetailGroupByWarehouse = materialDetailList.stream()
|
||||
.collect(Collectors.groupingBy(ReservationInMaterialDetail::getWarehouseId));
|
||||
List<String> executionInOrderNumbers = new ArrayList<>();
|
||||
materialDetailGroupByWarehouse.forEach((warehouseId, details) -> {
|
||||
if (warehouseId == null) warehouseId = warehouseId1;
|
||||
|
||||
@@ -727,7 +850,40 @@ public class ReservationStockInOrderDomainService {
|
||||
reservationStockInOrder.setWarehouseCode(warehouseCode);
|
||||
reservationStockInOrder.setWarehouseName(warehouseName);
|
||||
reservationStockInOrder.setBusinessInOrderNumber(inOrderNumber);
|
||||
reservationStockInOrder.setInOrderNumber(generateExecutionOrderNumber(warehouseCode));
|
||||
|
||||
|
||||
//设置入库单号
|
||||
// Long warehouseId1 = reservationStockInOrder.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 = reservationStockInOrder.getOrganizationId();
|
||||
Long warehouseIdForCount = reservationStockInOrder.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);
|
||||
reservationStockInOrder.setInOrderNumber(datePrefix + seq);
|
||||
// reservationStockInOrder.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);
|
||||
reservationStockInOrder.setInOrderNumber(prefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(prefix + seq);
|
||||
}
|
||||
|
||||
List<ExecutionInMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
||||
int index = 1;
|
||||
@@ -749,6 +905,7 @@ public class ReservationStockInOrderDomainService {
|
||||
}
|
||||
BigDecimal quantity = details.stream().map(ReservationInMaterialDetail::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
reservationStockInOrder.setQuantity(quantity);
|
||||
executionInOrderNumbers.add(reservationStockInOrder.getInOrderNumber());
|
||||
executionStockInOrderService.save(reservationStockInOrder);
|
||||
executionInMaterialDetailService.saveBatch(inMaterialDetailList);
|
||||
ExecutionStockInOrderDO param = new ExecutionStockInOrderDO();
|
||||
@@ -758,6 +915,8 @@ public class ReservationStockInOrderDomainService {
|
||||
param.setInOrderIds(inOrderIdList1);
|
||||
stockInOrderApplicationService.issueOrder(param);
|
||||
});
|
||||
byId.setExecutionInOrderNumber(String.join(",", executionInOrderNumbers));
|
||||
stockInOrderService.updateById(byId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
@@ -50,6 +50,10 @@ public class ReservationStockOutOrder extends BaseVOEntity {
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行出库单号")
|
||||
@Excel(name = "执行出库单号")
|
||||
private String executionOutOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库状态: 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-已复核")
|
||||
private Integer status;
|
||||
|
||||
+8
@@ -3,6 +3,7 @@ package com.mhd.oms.domain.reservationStockOutOrder.repository.po;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import com.mhd.oms.domain.executionStockOutOrder.entity.ExecutionStockOutOrder;
|
||||
import com.mhd.oms.domain.reservationDeliveryDetailsLink.entity.ReservationDeliveryDetailsLink;
|
||||
import com.mhd.oms.domain.reservationDeliveryDetailsLink.repository.po.ReservationDeliveryDetailsLinkPO;
|
||||
import com.mhd.oms.domain.reservationOutMaterialDetail.repository.po.ReservationOutMaterialDetailPO;
|
||||
@@ -56,6 +57,10 @@ public class ReservationStockOutOrderPO extends BaseVOEntity {
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行出库单号")
|
||||
@Excel(name = "执行出库单号")
|
||||
private String executionOutOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
private Integer status;
|
||||
@@ -261,6 +266,9 @@ public class ReservationStockOutOrderPO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty("物料明细")
|
||||
private List<ReservationOutMaterialDetailPO> materialDetailList;
|
||||
|
||||
@ApiModelProperty("执行单列表")
|
||||
private List<ExecutionStockOutOrder> executionStockOutOrderList;
|
||||
//
|
||||
// @ApiModelProperty("出库单复核统计")
|
||||
// private ReservationOutMaterialCheckPO outMaterialCheckPO;
|
||||
|
||||
+4
@@ -52,6 +52,10 @@ public class ReservationStockOutOrderDO extends BaseVOEntity {
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行出库单号")
|
||||
@Excel(name = "执行出库单号")
|
||||
private String executionOutOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
private Integer status;
|
||||
|
||||
+4
@@ -50,6 +50,10 @@ public class ReservationStockOutOrderDTO extends ReservationStockOutOrderBaseDTO
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行出库单号")
|
||||
@Excel(name = "执行出库单号")
|
||||
private String executionOutOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
private Integer status;
|
||||
|
||||
+11
@@ -16,6 +16,8 @@ import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.uuid.IdGenerator;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.executionStockOutOrder.entity.ExecutionStockOutOrder;
|
||||
import com.mhd.oms.domain.executionStockOutOrder.repository.mapper.ExecutionStockOutOrderMapper;
|
||||
import com.mhd.oms.domain.gwLog.entity.GwLog;
|
||||
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
|
||||
import com.mhd.oms.domain.reservationDeliveryDetailsLink.entity.ReservationDeliveryDetailsLink;
|
||||
@@ -111,6 +113,8 @@ public class ReservationStockOutOrderApplicationService {
|
||||
private ReservationOutMaterialDetailMapper reservationOutMaterialDetailMapper;
|
||||
@Autowired
|
||||
private ReservationDeliveryDetailsLinkMapper reservationDeliveryDetailsLinkMapper;
|
||||
@Autowired
|
||||
private ExecutionStockOutOrderMapper executionStockOutOrderMapper;
|
||||
|
||||
@Autowired
|
||||
private ReservationStockInOrderMapper reservationStockInOrderMapper;
|
||||
@@ -306,6 +310,13 @@ public class ReservationStockOutOrderApplicationService {
|
||||
return stockOutOrderPO;
|
||||
}
|
||||
stockOutOrderPO.setKhdm(userNcCode);
|
||||
|
||||
//执行单
|
||||
List<ExecutionStockOutOrder> executionStockInOrders = executionStockOutOrderMapper.selectList(new LambdaQueryWrapper<ExecutionStockOutOrder>()
|
||||
.eq(ExecutionStockOutOrder::getBusinessOutOrderNumber, stockOutOrderPO.getOutOrderNumber())
|
||||
.eq(ExecutionStockOutOrder::getDelFlag, 1));
|
||||
stockOutOrderPO.setExecutionStockOutOrderList(executionStockInOrders);
|
||||
|
||||
if (stockOutOrderPO.getMaterialDetailList() != null && stockOutOrderPO.getMaterialDetailList().size() > 0) {
|
||||
List<ReservationOutMaterialDetailPO> materialDetailList = stockOutOrderPO.getMaterialDetailList();
|
||||
if (CollectionUtils.isEmpty(materialDetailList)) {
|
||||
|
||||
+153
-5
@@ -122,7 +122,35 @@ public class ReservationStockOutOrderDomainService {
|
||||
public List<ReservationStockOutOrderPO> queryList(ReservationStockOutOrderDO stockOutOrderDO) {
|
||||
return stockOutOrderService.queryList(stockOutOrderDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增出库单
|
||||
@@ -133,6 +161,42 @@ public class ReservationStockOutOrderDomainService {
|
||||
stockOutOrderDO.setOutOrderNumber(generateReserveOrderNumber());
|
||||
stockOutOrderDO.setBusinessOrderNo(stockOutOrderDO.getOutOrderNumber());
|
||||
}
|
||||
//设置单号
|
||||
// Long warehouseId = stockOutOrderDO.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.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);
|
||||
// }
|
||||
|
||||
// 与 update / batchInsert 一致:前端传计划数量为 quantity,非 outboundQuantity
|
||||
setMaterialDetailInfo(stockOutOrderDO);
|
||||
stockOutOrderDO.setMaterialQuantity(stockOutOrderDO.getMaterialDetailList().size());
|
||||
@@ -172,9 +236,13 @@ public class ReservationStockOutOrderDomainService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean batchInsert(List<ReservationStockOutOrderDO> stockOutOrderDOList) {
|
||||
for (ReservationStockOutOrderDO stockOutOrderDO : stockOutOrderDOList){
|
||||
if (StringUtils.isBlank(stockOutOrderDO.getOutOrderNumber())){
|
||||
stockOutOrderDO.setOutOrderNumber(OrderSequence.getOrderCode("CK"));
|
||||
|
||||
|
||||
if (stockOutOrderDO.getOutOrderNumber() == null) {
|
||||
stockOutOrderDO.setOutOrderNumber(generateReserveOrderNumber());
|
||||
stockOutOrderDO.setBusinessOrderNo(stockOutOrderDO.getOutOrderNumber());
|
||||
}
|
||||
|
||||
//设置物料信息
|
||||
setMaterialDetailInfo(stockOutOrderDO);
|
||||
//统计种类
|
||||
@@ -364,6 +432,7 @@ public class ReservationStockOutOrderDomainService {
|
||||
for (Long inOrderId : inOrderIds) {
|
||||
ReservationStockOutOrder byId = stockOutOrderService.getById(inOrderId);
|
||||
String inOrderNumber = byId.getOutOrderNumber();
|
||||
List<String> executionInOrderNumbers = new ArrayList<>();
|
||||
List<ReservationOutMaterialDetail> materialDetailList = outMaterialDetailService.list(new QueryWrapper<ReservationOutMaterialDetail>().lambda().eq(ReservationOutMaterialDetail::getOutOrderNumber, inOrderNumber));
|
||||
|
||||
// 按照 warehouseId 分组
|
||||
@@ -396,7 +465,43 @@ public class ReservationStockOutOrderDomainService {
|
||||
// reservationStockInOrder.setTopOrganizationId(topOrgId);
|
||||
|
||||
reservationStockInOrder.setBusinessOutOrderNumber(inOrderNumber);
|
||||
reservationStockInOrder.setOutOrderNumber(generateExecutionOrderNumber(warehouseCode));
|
||||
// reservationStockInOrder.setOutOrderNumber(generateExecutionOrderNumber(warehouseCode));
|
||||
|
||||
//设置单号
|
||||
Long warehouseId1 = reservationStockInOrder.getWarehouseId();
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId1);
|
||||
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);
|
||||
reservationStockInOrder.setOutOrderNumber(datePrefix + seq);
|
||||
// reservationStockInOrder.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);
|
||||
reservationStockInOrder.setOutOrderNumber(prefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(prefix + seq);
|
||||
}
|
||||
|
||||
|
||||
List<ExecutionOutMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
||||
@@ -415,8 +520,11 @@ public class ReservationStockOutOrderDomainService {
|
||||
BigDecimal quantity = details.stream().map(ReservationOutMaterialDetail::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
reservationStockInOrder.setQuantity(quantity);
|
||||
executionStockOutOrderService.save(reservationStockInOrder);
|
||||
executionInOrderNumbers.add(reservationStockInOrder.getOutOrderNumber());
|
||||
executionOutMaterialDetailService.saveBatch(inMaterialDetailList);
|
||||
});
|
||||
byId.setExecutionOutOrderNumber(String.join(",", executionInOrderNumbers));
|
||||
stockOutOrderService.updateById(byId);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
@@ -496,6 +604,7 @@ public class ReservationStockOutOrderDomainService {
|
||||
// 按照 warehouseId 分组
|
||||
Map<Long, List<ReservationOutMaterialDetail>> materialDetailGroupByWarehouse = materialDetailList.stream()
|
||||
.collect(Collectors.groupingBy(ReservationOutMaterialDetail::getWarehouseId));
|
||||
List<String> executionInOrderNumbers = new ArrayList<>();
|
||||
materialDetailGroupByWarehouse.forEach((warehouseId, details) -> {
|
||||
if (warehouseId == null) warehouseId = warehouseId1;
|
||||
Long topOrgId = reservationStockInOrderMapper.getTopOrgId(warehouseId);
|
||||
@@ -521,7 +630,43 @@ public class ReservationStockOutOrderDomainService {
|
||||
reservationStockInOrder.setWarehouseCode(warehouseCode);
|
||||
reservationStockInOrder.setWarehouseName(warehouseName);
|
||||
reservationStockInOrder.setBusinessOutOrderNumber(inOrderNumber);
|
||||
reservationStockInOrder.setOutOrderNumber(generateExecutionOrderNumber(warehouseCode));
|
||||
|
||||
|
||||
//设置单号
|
||||
// Long warehouseId1 = reservationStockInOrder.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.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);
|
||||
reservationStockInOrder.setOutOrderNumber(datePrefix + seq);
|
||||
// reservationStockInOrder.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);
|
||||
reservationStockInOrder.setOutOrderNumber(prefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(prefix + seq);
|
||||
}
|
||||
|
||||
List<ExecutionOutMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
||||
for (ReservationOutMaterialDetail reservationOutMaterialDetail : details) {
|
||||
@@ -538,6 +683,7 @@ public class ReservationStockOutOrderDomainService {
|
||||
}
|
||||
BigDecimal quantity = details.stream().map(ReservationOutMaterialDetail::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
reservationStockInOrder.setQuantity(quantity);
|
||||
executionInOrderNumbers.add(reservationStockInOrder.getOutOrderNumber());
|
||||
executionStockOutOrderService.save(reservationStockInOrder);
|
||||
executionOutMaterialDetailService.saveBatch(inMaterialDetailList);
|
||||
|
||||
@@ -549,6 +695,8 @@ public class ReservationStockOutOrderDomainService {
|
||||
param.setOutOrderIds(ids);
|
||||
stockOutOrderApplicationService.issueOrder(param);
|
||||
});
|
||||
byId.setExecutionOutOrderNumber(String.join(",", executionInOrderNumbers));
|
||||
stockOutOrderService.updateById(byId);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user