bug修改;

This commit is contained in:
王奎兴
2026-07-03 17:49:31 +08:00
parent 8b66aea296
commit e4a3835ee0
17 changed files with 158 additions and 28 deletions
@@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectContractManagePo">
SELECT DISTINCT a.*
FROM CONTRACT_MANAGE a
INNER JOIN CONTRACT_MANAGE_DETAIL b
left JOIN CONTRACT_MANAGE_DETAIL b
ON a.CONTRACT_MANAGE_ID = b.CONTRACT_MANAGE_ID
where
a.del_flag = 1
@@ -209,7 +209,7 @@ public class ReconciliationApplicationService {
reconciliationPO.setSettlementCurrency(tmsOrder.getSettlementCurrency());
}
if (reconciliationPO.getSettlementCurrency() != null){
String s = tmsReceiptMapper.selectCnName(String.valueOf(reconciliationPO.getSettlementCurrency()));
String s = tmsReceiptMapper.selectCnName(String.valueOf(reconciliationPO.getSettlementCurrency()),reconciliationPO.getOrganizationId());
reconciliationPO.setSettlementCurrencyName(s);
}
}
@@ -20,5 +20,5 @@ public interface TmsReceiptMapper extends BaseMapper<TmsReceipt>
*/
public List<TmsReceiptPO> queryList(TmsReceiptDO tmsReceiptDO);
String selectCnName(@Param("settlementCount") String settlementCount);
String selectCnName(@Param("settlementCount") String settlementCount,@Param("organizationId") Long organizationId);
}
@@ -123,6 +123,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTmsReceiptPo1"/>
</select>
<select id="selectCnName" resultType="java.lang.String">
select chinese_name from NGWL_TEST_WLHY.TMS_SETTLEMENT_EXCHANGE_RATE where english_name = #{settlementCount} limit 1
select chinese_name from NGWL_TEST_WLHY.TMS_SETTLEMENT_EXCHANGE_RATE where english_name = #{settlementCount} and ORGANIZATION_ID = #{organizationId} limit 1
</select>
</mapper>
@@ -62,7 +62,9 @@ public class ExecutionStockInOrderPO extends BaseVOEntity {
@ApiModelProperty("入库单号")
@Excel(name = "入库单号")
private String inOrderNumber;
@ApiModelProperty("入库业务单号")
@Excel(name = "入库业务单号")
private String businessInOrderNumber;
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
private Integer status;
@@ -58,7 +58,9 @@ public class ExecutionStockInOrderDO extends BaseVOEntity {
@ApiModelProperty("入库单号")
@Excel(name = "入库单号")
private String inOrderNumber;
@ApiModelProperty("入库业务单号")
@Excel(name = "入库业务单号")
private String businessInOrderNumber;
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
private Integer status;
@@ -61,7 +61,9 @@ public class ExecutionStockInOrderDTO extends ExecutionStockInOrderBaseDTO {
@ApiModelProperty("入库单号")
@Excel(name = "入库单号")
private String inOrderNumber;
@ApiModelProperty("入库业务单号")
@Excel(name = "入库业务单号")
private String businessInOrderNumber;
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
private Integer status;
@@ -52,7 +52,9 @@ public class ExecutionStockOutOrderPO extends BaseVOEntity {
@ApiModelProperty("出库单号")
@Excel(name = "出库单号")
private String outOrderNumber;
@ApiModelProperty("出库单号")
@Excel(name = "出库单号")
private String businessOutOrderNumber;
@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;
@@ -51,7 +51,9 @@ public class ExecutionStockOutOrderDO extends BaseVOEntity {
@ApiModelProperty("出库单号")
@Excel(name = "出库单号")
private String outOrderNumber;
@ApiModelProperty("出库单号")
@Excel(name = "出库单号")
private String businessOutOrderNumber;
@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;
@@ -48,7 +48,9 @@ public class ExecutionStockOutOrderDTO extends ExecutionStockOutOrderBaseDTO {
@ApiModelProperty("出库单号")
@Excel(name = "出库单号")
private String outOrderNumber;
@ApiModelProperty("出库单号")
@Excel(name = "出库单号")
private String businessOutOrderNumber;
@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;
@@ -107,6 +107,7 @@
<result property="fireInsureFee" column="FIRE_INSURE_FEE" />
<result property="discount" column="DISCOUNT" />
<result property="isFreeManpowerFee" column="IS_FREE_MANPOWER_FEE" />
<result property="businessInOrderNumber" column="BUSINESS_IN_ORDER_NUMBER" />
</resultMap>
@@ -135,7 +136,7 @@
<!-- where sso.in_order_number = a.in_order_number-->
<!-- and sso.del_flag = 1-->
<!-- ) as shelves_quantity,-->
a.weight_limit, a.volume_limit, a.cancel_order, a.cancel_remark, a.cancel_by,a.PICTURE_URL,
a.weight_limit, a.volume_limit, a.cancel_order, a.cancel_remark, a.cancel_by,a.PICTURE_URL,a.business_in_order_number,
a.cancel_by_name, a.cancel_time, a.close_order, a.close_remark, a.close_by, a.close_by_name, a.close_time, a.remark, a.create_time, a.create_by,
a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag, a.over_stock_id, a.over_stock_status, a.over_stock_type,
a."TO", a.CONTACT_PERSON, a.VEHICLE_INFO, a.CONSIGNMENT_NO, a.TEL, a.DRIVER_SIGNATURE, a.FAX, a.DECLARATION_AREA, a.MANUFACTURER,
@@ -108,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="pushByName" column="PUSH_BY_NAME" />
<result property="trainNo" column="TRAIN_NO" />
<result property="amount" column="AMOUNT" />
<result property="businessOutOrderNumber" column="BUSINESS_OUT_ORDER_NUMBER" />
</resultMap>
@@ -118,7 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.priority_level_name, a.direct_warehouse, a.review, a.annex_url, a.material_quantity, a.quantity, a.weight_limit, a.volume_limit, a.check_quantity, a.cancel_order, a.cancel_remark, a.cancel_by, a.cancel_by_name,
a.cancel_time, a.close_order, a.close_remark, a.close_by, a.close_by_name, a.close_time, a.check_status,a.BUSINESS_ORDER_NO,
a.check_task_distribution, a.check_task_distribution_time, a.check_operators_by, a.check_operators_name, a.mobilize_code,
a.remark, a.create_time, a.create_by, a.create_by_name,a.business_number,a.train_no,a.amount,
a.remark, a.create_time, a.create_by, a.create_by_name,a.business_number,a.train_no,a.amount,a.business_out_order_number,
a.update_time, a.update_by, a.update_by_name, a.del_flag, a.over_stock_id, a.over_stock_status, a.over_stock_type,a."TO",
a.CONTACT_PERSON,a.VEHICLE_MODEL_PLATE,a.ENTRUST_NO,a.TEL,a.DRIVER_SIGN,a.FAX,a.DECLARE_CUSTOMS,a.MANUFACTURER,
a.CUSTOMS_DECLARER_INFO,a.DELIVERY_ADDR,a.ENTRY_EXIT_CUSTOMS,a.DEPARTURE_ARRIVAL_COUNTRY,a.CARRIER,a.CONTAINER_NO,a.CONTAINER_NO_NAME,a.OUTBOUND_DATE,
@@ -842,6 +842,14 @@ public class StockOutOrderApplicationService {
return stockOutOrderDomainService.auditState(stockOutOrderDO);
}
public Boolean cancelAuditState(StockOutOrderDO stockOutOrderDO){
return stockOutOrderDomainService.cancelAuditState(stockOutOrderDO);
}
public Boolean cancelExecution(StockOutOrderDO stockOutOrderDO){
return stockOutOrderDomainService.cancelExecution(stockOutOrderDO);
}
public Boolean execution(String outOrderNumber){
//Boolean execution = stockOutOrderDomainService.execution(outOrderNumber);
StockOutOrderDO stockOutOrderDO = new StockOutOrderDO();
@@ -604,6 +604,103 @@ public class StockOutOrderDomainService {
.in(StockOutOrder::getOutOrderId, stockOutOrderDO.getOutOrderIds()));
}
@Transactional(rollbackFor = Exception.class)
public Boolean cancelAuditState(StockOutOrderDO stockOutOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
// 获取用户姓名优先从UserPo获取如果为空则使用realname最后使用username作为兜底
String userRealName = loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null
? loginUser.getUserPo().getUserName()
: (loginUser.getRealname() != null ? loginUser.getRealname() : loginUser.getUsername());
return stockOutOrderService.update(null, new UpdateWrapper<StockOutOrder>().lambda()
.set(StockOutOrder::getStatus, 1)
.set(StockOutOrder::getAuditStatus, 1)
.set(StockOutOrder::getAuditRemark, null)
.set(StockOutOrder::getAuditBy, null)
.set(StockOutOrder::getAuditByName, null)
.set(StockOutOrder::getAuditTime, null)
.set(StockOutOrder::getUpdateBy, loginUser.getUserid())
.set(StockOutOrder::getUpdateByName, userRealName)
.set(StockOutOrder::getUpdateTime, new Date())
.in(StockOutOrder::getOutOrderId, stockOutOrderDO.getOutOrderIds()));
}
@Transactional(rollbackFor = Exception.class)
public Boolean cancelExecution(StockOutOrderDO stockOutOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
// 获取用户姓名优先从UserPo获取如果为空则使用realname最后使用username作为兜底
String userRealName = loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null
? loginUser.getUserPo().getUserName()
: (loginUser.getRealname() != null ? loginUser.getRealname() : loginUser.getUsername());
List<Long> outOrderIds = stockOutOrderDO.getOutOrderIds();
for (Long outOrderId : outOrderIds) {
StockOutOrder stockOutOrder = stockOutOrderService.getById(outOrderId);
if (stockOutOrder == null) {
throw new ServiceException("出库单不存在");
}
String outOrderNumber = stockOutOrder.getOutOrderNumber();
//逻辑删除拣货单
PickingOrder pickingOrder = pickingOrderService.getOne(new QueryWrapper<PickingOrder>().lambda()
.eq(PickingOrder::getOrderNumber, outOrderNumber)
.eq(PickingOrder::getDelFlag, 1), false);
if (pickingOrder != null) {
Integer status = pickingOrder.getStatus();
String pickingOrderNumber = pickingOrder.getPickingOrderNumber();
if (status!=1) {
throw new ServiceException("拣货单[" + pickingOrderNumber + "]已拣货,无法取消执行");
} else {
List<PickingMaterialDetail> list = pickingMaterialDetailService.list(new QueryWrapper<PickingMaterialDetail>().lambda()
.eq(PickingMaterialDetail::getPickingOrderNumber, pickingOrderNumber)
.eq(PickingMaterialDetail::getDelFlag, 1));
if (list != null && list.size() > 0) {
for (PickingMaterialDetail pickingMaterialDetail : list) {
pickingMaterialDetail.setDelFlag(2);
pickingMaterialDetailService.updateById(pickingMaterialDetail);
}
}
pickingOrder.setDelFlag(2);
pickingOrderService.updateById(pickingOrder);
}
}
//还原分配库存
List<OutMaterialDetail> list = outMaterialDetailService.list(new QueryWrapper<OutMaterialDetail>().lambda()
.eq(OutMaterialDetail::getOutOrderNumber, outOrderNumber)
.eq(OutMaterialDetail::getDelFlag, 1));
for (OutMaterialDetail materialDetail : list) {
//还原库存
BigDecimal allocationQuantity = materialDetail.getAllocationQuantity();
Long materialInventoryId = materialDetail.getMaterialInventoryId();
MaterialInventory materialInventory = materialInventoryMapper.selectById(materialInventoryId);
if (materialInventory == null) {
throw new ServiceException("库存信息不存在");
}
materialInventory.setAllocationQuantity(materialInventory.getAllocationQuantity().add(allocationQuantity));
materialInventory.setFreezeQuantity(materialInventory.getFreezeQuantity().subtract(allocationQuantity));
materialInventoryMapper.updateById(materialInventory);
//逻辑删除库存调整记录
Long uniqueId = materialDetail.getUniqueId();
String relateNo = outOrderNumber+"#"+uniqueId;
inventoryAdjustmentRecordService.update(new InventoryAdjustmentRecord(), new LambdaUpdateWrapper<InventoryAdjustmentRecord>()
.set(InventoryAdjustmentRecord::getDelFlag, 2)
.eq(InventoryAdjustmentRecord::getRelateNo, relateNo));
}
}
return stockOutOrderService.update(null, new UpdateWrapper<StockOutOrder>().lambda()
.set(StockOutOrder::getStatus, 1)
.set(StockOutOrder::getAuditStatus, 1)
.set(StockOutOrder::getAuditRemark, null)
.set(StockOutOrder::getAuditBy, null)
.set(StockOutOrder::getAuditByName, null)
.set(StockOutOrder::getAuditTime, null)
.set(StockOutOrder::getUpdateBy, loginUser.getUserid())
.set(StockOutOrder::getUpdateByName, userRealName)
.set(StockOutOrder::getUpdateTime, new Date())
.in(StockOutOrder::getOutOrderId, stockOutOrderDO.getOutOrderIds()));
}
@Transactional(rollbackFor = Exception.class)
public Boolean execution(String outOrderNumber) {
StockOutOrder stockOutOrder = stockOutOrderService.getOne(new QueryWrapper<StockOutOrder>().lambda()
@@ -96,15 +96,6 @@ public class MaterialInventoryApi extends BaseController {
startPage();
// 使用带批次属性的查询方法批次属性值从库存表中获取
List<MaterialInventoryPO> list = materialInventoryApplicationService.queryListWithBatchAttributes(materialInventoryDO);
// 按更新时间倒序排序update_time 为空的数据放最后
list.sort((o1, o2) -> {
Date t1 = o1.getUpdateTime();
Date t2 = o2.getUpdateTime();
if (t1 == null && t2 == null) return 0;
if (t1 == null) return 1;
if (t2 == null) return -1;
return t2.compareTo(t1); // desc
});
TableDataInfo tableDataInfo = getDataTable(list);
// 如果查询结果为空抛出异常提示用户该物料在库存中不存在
// if (tableDataInfo.getTotal() == 0) {
@@ -217,6 +217,26 @@ public class StockOutOrderApi extends BaseController {
return AjaxResult.success(stockOutOrderApplicationService.auditState(stockOutOrderDO));
}
/**
* 审核出库单
*/
@ApiOperation("审核出库单")
@PostMapping(value = "/cancelAuditState")
public AjaxResult cancelAuditState(@RequestBody StockOutOrderDTO stockOutOrderDTO) {
StockOutOrderDO stockOutOrderDO = stockOutOrderAssembler.toDO(stockOutOrderDTO);
return AjaxResult.success(stockOutOrderApplicationService.cancelAuditState(stockOutOrderDO));
}
/**
* 审核出库单
*/
@ApiOperation("审核出库单")
@PostMapping(value = "/cancelExecution")
public AjaxResult cancelExecution(@RequestBody StockOutOrderDTO stockOutOrderDTO) {
StockOutOrderDO stockOutOrderDO = stockOutOrderAssembler.toDO(stockOutOrderDTO);
return AjaxResult.success(stockOutOrderApplicationService.cancelExecution(stockOutOrderDO));
}
/**
* 审核出库单
*/
@@ -391,7 +391,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectMaterialInventoryPo1"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
</where>
group by a.MATERIAL_INVENTORY_ID order by a.update_time desc
group by a.MATERIAL_INVENTORY_ID order by CASE WHEN IFNULL(sum(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END, a.update_time desc
</select>
<select id="queryListByWlKw" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
@@ -404,7 +404,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectMaterialInventoryPo1"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
</where>
GROUP BY a.MATERIAL_BASE_INFO_ID,a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID order by a.update_time desc
GROUP BY a.MATERIAL_BASE_INFO_ID,a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID order by CASE WHEN IFNULL(sum(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END, a.update_time desc
</select>
<select id="queryListByKw" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
@@ -417,7 +417,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectMaterialInventoryPo1"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
</where>
GROUP BY a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID order by a.update_time desc
GROUP BY a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID order by CASE WHEN IFNULL(sum(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END, a.update_time desc
</select>
<select id="queryListByWl" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
@@ -450,7 +450,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY a.MATERIAL_BASE_INFO_ID,
loc.warehouse_id, loc.warehouse_code, loc.warehouse_name,
loc.storage_section_id, loc.storage_code, loc.storage_name,
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name order by a.update_time desc
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name order by CASE WHEN IFNULL(sum(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END, a.update_time desc
</select>
<!-- 按货主+物料汇总:A货主物料1、A货主物料2、B货主物料1、B货主物料2 为 4 行;库位取该货主+该物料下创建时间最新的一条明细 -->
@@ -484,7 +484,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY a.SHIPPER_ID, a.MATERIAL_BASE_INFO_ID,
loc.warehouse_id, loc.warehouse_code, loc.warehouse_name,
loc.storage_section_id, loc.storage_code, loc.storage_name,
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name order by a.update_time desc
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name order by CASE WHEN IFNULL(sum(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END, a.update_time desc
</select>
<select id="queryListByHz" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
@@ -497,7 +497,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectMaterialInventoryPo1"/>
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
</where>
GROUP BY a.SHIPPER_ID order by a.update_time desc
GROUP BY a.SHIPPER_ID order by CASE WHEN IFNULL(sum(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END, a.update_time desc
</select>
<resultMap type="com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO" id="MaterialQueryListResult">