Commit a4d031f7 by yubin

页面修改

parent 257fada7
......@@ -56,7 +56,7 @@
<el-form-item label="物料" prop="materialId">
<el-input
v-model="queryParams.materialId"
placeholder="请输入物料编码"
placeholder="请输入物料名或sap编码"
clearable
@keyup.enter.native="handleQuery"
/>
......@@ -80,6 +80,7 @@
</el-form-item>
<el-form-item label="库位" prop="locationId">
<el-input
placeholder="请选择库位"
v-model="queryLocationName"
readonly
@focus="openLocationSelector"
......
......@@ -132,36 +132,6 @@
</el-tag>
</template>
</el-table-column>
<!-- 新增:允许存放物料列 - 修复可选链语法 -->
<el-table-column label="允许存放物料" align="center" prop="allowMaterialCodes" min-width="150">
<template slot-scope="scope">
<el-tooltip
:content="scope.row.allowMaterialCodes && scope.row.allowMaterialCodes.length ? scope.row.allowMaterialCodes.join(',') : '无'"
placement="top"
effect="light"
>
<div class="material-tags">
<el-tag
v-for="(code, index) in (scope.row.allowMaterialCodes && scope.row.allowMaterialCodes.length ? scope.row.allowMaterialCodes.slice(0, 3) : [])"
:key="index"
type="info"
size="small"
style="margin-right: 5px;"
>
{{ code }}
</el-tag>
<el-tag
v-if="scope.row.allowMaterialCodes && scope.row.allowMaterialCodes.length > 3"
type="info"
size="small"
style="background: #f0f9eb; border-color: #c2e7b0;"
>
+{{ scope.row.allowMaterialCodes.length - 3 }}
</el-tag>
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="创建日期" align="center" prop="createTime" min-width="160" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
<template slot-scope="scope">
......@@ -202,7 +172,7 @@
<el-input
v-model="form.warehousesCode"
placeholder="请输入仓库编码"
:readonly="!!form.id" <!-- 修改时编码不可改 -->
:readonly="!!form.id"
/>
</el-form-item>
</el-col>
......@@ -270,28 +240,6 @@
</el-form-item>
</el-col>
</el-row>
<!-- 新增:允许存放物料选择项(和其他页面选择器交互一致) -->
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="允许存放物料" prop="allowMaterialCodes">
<el-input
v-model="allowMaterialDisplay"
placeholder="请选择允许存放的物料(可选)"
readonly
@click="openMaterialSelector"
:suffix-icon="''"
>
<template v-if="allowMaterialDisplay" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearMaterialSelection"
></i>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
......@@ -299,25 +247,7 @@
</div>
</el-dialog>
<!-- 物料选择器弹窗 -->
<el-dialog
title="选择允许存放的物料"
:visible.sync="materialSelectorVisible"
width="1000px"
append-to-body
:close-on-click-modal="false"
>
<MaterialSelector
ref="materialSelector"
@selection-change="handleMaterialSelectionChange"
:selected-material-codes="form.allowMaterialCodes"
:multiple="true"
/>
<div slot="footer" class="dialog-footer">
<el-button @click="materialSelectorVisible = false">取消</el-button>
<el-button type="primary" @click="confirmMaterialSelection">确认选择</el-button>
</div>
</el-dialog>
<!-- 导入组件 -->
<import-excel
......@@ -334,11 +264,10 @@
<script>
import { listWarehouses, getWarehouses, delWarehouses, addWarehouses, updateWarehouses } from "@/api/inventory/warehouses"
import ImportExcel from "@/components/ImportExcel/index"
import MaterialSelector from '@/components/materialsSeletor.vue'
export default {
name: "Warehouses",
components: { ImportExcel, MaterialSelector },
components: { ImportExcel, },
dicts: ['warehouse_type', 'sys_normal_disable'],
data() {
// 自定义校验规则:验证手机号
......@@ -410,12 +339,7 @@ export default {
createUserCode: null,
updateTime: null,
updateUserCode: null,
allowMaterialCodes: [] // 允许存放的物料编码
},
// 物料选择器相关
materialSelectorVisible: false,
allowMaterialDisplay: '', // 物料选择器显示文本
tempSelectedMaterials: [], // 临时选中的物料编码
// 表单校验
rules: {
warehousesCode: [
......@@ -474,8 +398,6 @@ export default {
cancel() {
this.open = false
this.reset()
// 重置物料选择器
this.materialSelectorVisible = false
this.allowMaterialDisplay = ''
this.tempSelectedMaterials = []
},
......@@ -639,50 +561,6 @@ export default {
handleImport() {
this.$refs.import.show()
},
// 打开物料选择器
openMaterialSelector() {
// 初始化临时选中数据
this.tempSelectedMaterials = [...this.form.allowMaterialCodes]
this.materialSelectorVisible = true
// 清空子组件选中状态(如果有该方法)
this.$nextTick(() => {
if (this.$refs.materialSelector && this.$refs.materialSelector.clearSelection) {
this.$refs.materialSelector.clearSelection()
// 回显已选物料
if (this.tempSelectedMaterials.length) {
this.$refs.materialSelector.setSelection(this.tempSelectedMaterials)
}
}
})
},
// 物料选择变化回调
handleMaterialSelectionChange(selectedData) {
// 兼容不同格式的返回值
this.tempSelectedMaterials = (selectedData.materialIds || selectedData || [])
.filter(code => code && code.trim())
.map(code => code.trim())
.filter((code, index, self) => self.indexOf(code) === index)
},
// 确认物料选择
confirmMaterialSelection() {
if (!this.tempSelectedMaterials.length) {
this.allowMaterialDisplay = ''
} else {
this.allowMaterialDisplay = this.tempSelectedMaterials.join(', ')
}
this.form.allowMaterialCodes = [...this.tempSelectedMaterials]
this.materialSelectorVisible = false
},
// 清空物料选择
clearMaterialSelection() {
this.allowMaterialDisplay = ''
this.tempSelectedMaterials = []
this.form.allowMaterialCodes = []
}
}
}
</script>
......
......@@ -95,10 +95,10 @@ public class OutboundOrderItemsController extends BaseController
@PreAuthorize("@ss.hasPermi('inventory:items:export')")
@Log(title = "出库单明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, OutboundOrderItems outboundOrderItems)
public void export(HttpServletResponse response, OutboundOrdersSummaryVO outboundOrderItems)
{
List<OutboundOrderItems> list = outboundOrderItemsService.selectOutboundOrderItemsList(outboundOrderItems);
ExcelUtil<OutboundOrderItems> util = new ExcelUtil<OutboundOrderItems>(OutboundOrderItems.class);
List<OutboundOrdersSummaryVO> list = outboundOrderItemsService.selectOutboundOrdersitmesExportList(outboundOrderItems);
ExcelUtil<OutboundOrdersSummaryVO> util = new ExcelUtil<OutboundOrdersSummaryVO>(OutboundOrdersSummaryVO.class);
util.exportExcel(response, list, "出库单明细数据");
}
......
package com.ruoyi.inventory.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
......@@ -8,6 +9,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.vo.inboundVO.InboundTemplateVO;
import com.ruoyi.inventory.domain.vo.OutboundTemplateVO;
import org.springframework.beans.BeanUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -61,8 +63,8 @@ public class OutboundOrdersController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, OutboundOrders outboundOrders)
{
List<OutboundOrders> list = outboundOrdersService.selectOutboundOrdersList(outboundOrders);
ExcelUtil<OutboundOrders> util = new ExcelUtil<OutboundOrders>(OutboundOrders.class);
List<OutboundTemplateVO> list = outboundOrdersService.selectOutboundOrdersExportList(outboundOrders);
ExcelUtil<OutboundTemplateVO> util = new ExcelUtil<OutboundTemplateVO>(OutboundTemplateVO.class);
util.exportExcel(response, list, "出库单主数据");
}
......
package com.ruoyi.inventory.controller;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
......@@ -8,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
import com.ruoyi.inventory.domain.Owners;
import com.ruoyi.inventory.domain.vo.OwnerTemplateVO;
import com.ruoyi.inventory.domain.vo.StorageLocationsLocationTemplateVO;
import org.springframework.beans.BeanUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -55,8 +57,17 @@ public class StorageLocationsController extends BaseController
public void export(HttpServletResponse response, StorageLocations storageLocations)
{
List<StorageLocations> list = storageLocationsService.selectStorageLocationsList(storageLocations);
ExcelUtil<StorageLocations> util = new ExcelUtil<StorageLocations>(StorageLocations.class);
util.exportExcel(response, list, "库位数据");
List<StorageLocationsLocationTemplateVO> list1 = new ArrayList<>();
StorageLocationsLocationTemplateVO storageLocationsLocationTemplateVO = new StorageLocationsLocationTemplateVO();
for (StorageLocations loc : list) {
BeanUtils.copyProperties(loc,storageLocationsLocationTemplateVO);
storageLocationsLocationTemplateVO.setIsEnabled(String.valueOf(loc.getIsEnabled()));
storageLocationsLocationTemplateVO.setLocationType(loc.getLocationType());
storageLocationsLocationTemplateVO.setLocationUsage(String.valueOf(loc.getLocationUsage()));
list1.add(storageLocationsLocationTemplateVO);
}
ExcelUtil<StorageLocationsLocationTemplateVO> util = new ExcelUtil<StorageLocationsLocationTemplateVO>(StorageLocationsLocationTemplateVO.class);
util.exportExcel(response, list1, "库位数据");
}
/**
......
package com.ruoyi.inventory.domain;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
......@@ -13,8 +14,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi
* @date 2025-12-01
*/
@Getter
@Setter
@Data
public class StorageLocations extends BaseEntity
{
private static final long serialVersionUID = 1L;
......@@ -137,251 +137,6 @@ public class StorageLocations extends BaseEntity
/** 仓库名称 */
private String warehousesName;
// ========== getter/setter 方法保持不变 ==========
public String getAllowedCategoryNames() {
return allowedCategoryNames;
}
public void setAllowedCategoryNames(String allowedCategoryNames) {
this.allowedCategoryNames = allowedCategoryNames;
}
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public String getWarehousesId() {
return warehousesId;
}
public void setWarehousesId(String warehousesId) {
this.warehousesId = warehousesId;
}
public String getWarehousesName() {
return warehousesName;
}
public void setWarehousesName(String warehousesName) {
this.warehousesName = warehousesName;
}
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
{
return locationCode;
}
public void setLocationName(String locationName)
{
this.locationName = locationName;
}
public String getLocationName()
{
return locationName;
}
public void setWarehousesCode(String warehousesCode)
{
this.warehousesCode = warehousesCode;
}
public String getWarehousesCode()
{
return warehousesCode;
}
public void setLocationType(Long locationType)
{
this.locationType = locationType;
}
public Long getLocationType()
{
return locationType;
}
public void setZoneCode(String zoneCode)
{
this.zoneCode = zoneCode;
}
public String getZoneCode()
{
return zoneCode;
}
public void setRowCode(String rowCode)
{
this.rowCode = rowCode;
}
public String getRowCode()
{
return rowCode;
}
public void setColumnCode(String columnCode)
{
this.columnCode = columnCode;
}
public String getColumnCode()
{
return columnCode;
}
public void setLayerCode(String layerCode)
{
this.layerCode = layerCode;
}
public String getLayerCode()
{
return layerCode;
}
public void setCapacity(Long capacity)
{
this.capacity = capacity;
}
public Long getCapacity()
{
return capacity;
}
public void setVolumeCapacity(Long volumeCapacity)
{
this.volumeCapacity = volumeCapacity;
}
public Long getVolumeCapacity()
{
return volumeCapacity;
}
public void setAllowedHazardLevels(String allowedHazardLevels)
{
this.allowedHazardLevels = allowedHazardLevels;
}
public String getAllowedHazardLevels()
{
return allowedHazardLevels;
}
public void setAllowedCategoryIds(String allowedCategoryIds)
{
this.allowedCategoryIds = allowedCategoryIds;
}
public String getAllowedCategoryIds()
{
return allowedCategoryIds;
}
public void setTemperatureZone(String temperatureZone)
{
this.temperatureZone = temperatureZone;
}
public String getTemperatureZone()
{
return temperatureZone;
}
public void setIsEnabled(Long isEnabled)
{
this.isEnabled = isEnabled;
}
public Long getIsEnabled()
{
return isEnabled;
}
public void setIsUsed(Long isUsed)
{
this.isUsed = isUsed;
}
public Long getIsUsed()
{
return isUsed;
}
public void setSortNo(Long sortNo)
{
this.sortNo = sortNo;
}
public Long getSortNo()
{
return sortNo;
}
public void setCreateUserCode(String createUserCode)
{
this.createUserCode = createUserCode;
}
public String getCreateUserCode()
{
return createUserCode;
}
public void setUpdateUserCode(String updateUserCode)
{
this.updateUserCode = updateUserCode;
}
public String getUpdateUserCode()
{
return updateUserCode;
}
private String loadingArea;
/**
* 重写toString方法,补充所有新增字段
*/
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("locationCode", getLocationCode())
.append("locationName", getLocationName())
.append("warehousesCode", getWarehousesCode())
.append("warehousesId", getWarehousesId()) // 新增:仓库ID
.append("warehousesName", getWarehousesName()) // 新增:仓库名称
.append("locationType", getLocationType())
.append("zoneCode", getZoneCode())
.append("rowCode", getRowCode())
.append("columnCode", getColumnCode())
.append("layerCode", getLayerCode())
.append("capacity", getCapacity())
.append("volumeCapacity", getVolumeCapacity())
.append("allowedHazardLevels", getAllowedHazardLevels())
.append("allowedCategoryIds", getAllowedCategoryIds())
.append("allowedCategoryNames", getAllowedCategoryNames()) // 新增:分类名称
.append("temperatureZone", getTemperatureZone())
.append("isEnabled", getIsEnabled())
.append("isUsed", getIsUsed())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.toString();
}
}
\ No newline at end of file
......@@ -23,7 +23,6 @@ public class OutboundOrdersSummaryVO extends BaseEntity
// ========== 物料基础信息(来自materials表) ==========
/** 物料ID */
@Excel(name = "物料ID")
private String materialId;
/** 物料名称 */
......@@ -31,61 +30,43 @@ public class OutboundOrdersSummaryVO extends BaseEntity
private String materialName;
/** SAP编码 */
@Excel(name = "SAP编码")
@Excel(name = "SAP物料号")
private String sapNo;
/** TS编码 */
@Excel(name = "TS编码")
@Excel(name = "TS Code")
private String tsCode;
/** 危化品ID */
@Excel(name = "危化品ID")
@Excel(name = "危险类别")
private String hazardId;
/** 物料规格 */
@Excel(name = "物料规格")
@Excel(name = "规格型号")
private String specification;
/** 物料单位 */
@Excel(name = "物料单位")
@Excel(name = "计量单位")
private String materialUnit;
/** 单重 */
@Excel(name = "单")
@Excel(name = "单位重量")
private BigDecimal unitWeight;
/** 包装重量 */
@Excel(name = "包装重量")
private BigDecimal packageWeight;
// 移除表格中没有的Excel注解字段
private String itemStatus;
@Excel(name = "单价")
private String unitPrice;
/** 总重量 */
@Excel(name = "总重量")
// 以下字段表格无,全部移除@Excel注解
private BigDecimal packageWeight;
private BigDecimal totalWeight;
/** 体积 */
@Excel(name = "体积")
private BigDecimal volume;
/** 保质期天数 */
@Excel(name = "保质期天数")
private Long shelfLifeDays;
/** 存储温度 */
@Excel(name = "存储温度")
private String storageTemperature;
/** 特殊要求 */
@Excel(name = "特殊要求")
private String specialRequirements;
/** 物料排序号 */
@Excel(name = "物料排序号")
private Long sortNo;
// ========== 统计计算字段(聚合查询) ==========
/** 计划数量(汇总) */
@Excel(name = "计划数量")
private BigDecimal plannedQuantity;
......@@ -95,29 +76,25 @@ public class OutboundOrdersSummaryVO extends BaseEntity
private BigDecimal actualQuantity;
/** 总金额(汇总:单价*实际数量) */
@Excel(name = "金额")
@Excel(name = "金额")
private BigDecimal totalAmount;
// ========== 仓库信息(来自warehouses表) ==========
/** 仓库ID */
@Excel(name = "仓库ID")
// 仓库ID表格无,移除Excel注解
private String warehouseId;
/** 仓库名称 */
@Excel(name = "仓库名称")
@Excel(name = "仓库")
private String warehouseName;
// ========== 订单批次信息(来自outbound_order_items表) ==========
/** 批次号 */
@Excel(name = "批次")
@Excel(name = "批次")
private String batchCode;
/** 子订单ID(出库单明细订单ID) */
@Excel(name = "子订单ID")
// 子订单ID表格无,移除Excel注解
private String orderId;
/** 主订单ID(出库单主表订单ID) */
@Excel(name = "主订单ID")
@Excel(name = "主订单")
private String mainOrderId;
// ========== 检索条件字段 ==========
......@@ -129,10 +106,12 @@ public class OutboundOrdersSummaryVO extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endDate;
/** 库位ID(检索条件) */
@Excel(name = "库位ID 检索条件")
private String orderStatus;
// 库位ID表格无,移除Excel注解
private String locationId;
/** 库位名称 */
@Excel(name = "库位")
private String locationName;
}
\ No newline at end of file
......@@ -26,7 +26,7 @@ public class StorageLocationsLocationTemplateVO {
private String LocationUsage;
@Excel(name = "库位类型",dictType = "location_type")
private String locationType;
private Long locationType;
@Excel(name = "库位属性",dictType = "is_enabled")
private String isEnabled;
......@@ -38,7 +38,7 @@ public class StorageLocationsLocationTemplateVO {
private String turnoverDemand;
@Excel(name = "上架区")
private String zoneCode;
private String loadingArea;
@Excel(name = "拣货区")
private String pickingArea;
......
......@@ -80,5 +80,7 @@ public interface OutboundOrderItemsMapper
public int deleteOutboundOrderItemsByOrderId(String orderId);
public List<OutboundOrdersSummaryVO> selectOutboundOrdersitmesExportList(OutboundOrdersSummaryVO outboundOrderItems);
}
......@@ -5,6 +5,7 @@ import java.util.Map;
import com.ruoyi.inventory.domain.OutboundOrders;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.vo.OutboundTemplateVO;
/**
* 出库单主Mapper接口
......@@ -91,4 +92,5 @@ public interface OutboundOrdersMapper
public List<Map<String,String>> SelectOutboundOrdersMaterialsTopTenByQuantity();
public String outboundOrdersCount();
public List<OutboundTemplateVO> selectOutboundOrdersExportList(OutboundOrders outboundOrders);
}
......@@ -3,6 +3,7 @@ package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.vo.OutboundOrdersSummaryVO;
import com.ruoyi.inventory.domain.vo.OutboundTemplateVO;
/**
* 出库单明细Service接口
......@@ -68,4 +69,8 @@ public interface IOutboundOrderItemsService
public List<OutboundOrderItems> selectOutboundOrderItemsStatisticsList(OutboundOrderItems outboundOrderItems);
public List<OutboundOrdersSummaryVO> selectOutboundOrdersitmesExportList(OutboundOrdersSummaryVO outboundOrderItems);
}
......@@ -79,4 +79,6 @@ public interface IOutboundOrdersService
@Transactional(rollbackFor = Exception.class)
String importOutboundOrders(List<OutboundTemplateVO> inboundOrdersList, Boolean isUpdateSupport, String operName,Integer orderType);
public List<OutboundTemplateVO> selectOutboundOrdersExportList(OutboundOrders outboundOrders);
}
......@@ -207,6 +207,8 @@ public class InventoryServiceImpl implements IInventoryService
insertInventoryTransactions.insertInventoryTransactions(transactions);
}
//入库单确认入库日志
private void createInventoryInboundLog(Inventory inventory,
Long addQty, String createUser, Date createTime) {
......
......@@ -45,6 +45,7 @@ public class InventoryTransactionsServiceImpl implements IInventoryTransactionsS
return inventoryTransactionsMapper.selectInventoryTransactionsList(inventoryTransactions);
}
/**
* 新增库存事务
*
......
......@@ -76,6 +76,12 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
}
@Override
public List<OutboundOrdersSummaryVO> selectOutboundOrdersitmesExportList(OutboundOrdersSummaryVO outboundOrderItems) {
List<OutboundOrdersSummaryVO> list = outboundOrderItemsMapper.selectOutboundOrdersitmesExportList(outboundOrderItems);
return list;
}
@Override
public int insertOutboundOrderItems(OutboundOrderItems outboundOrderItems)
{
outboundOrderItems.setCreateTime(DateUtils.getNowDate());
......
......@@ -281,6 +281,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
if (!toUpdateInventoryMap.isEmpty()) {
List<Inventory> needUpdateList = new ArrayList<>(toUpdateInventoryMap.values());
inventoryMapper.batchUpdateInventory(needUpdateList);
needUpdateList.forEach(inv -> {
String cacheKey = buildInventoryKey(inv.getMaterialId(), inv.getLocationId(), inv.getInventoryType().toString());
......@@ -829,6 +830,12 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
}
}
@Override
public List<OutboundTemplateVO> selectOutboundOrdersExportList(OutboundOrders outboundOrders) {
List<OutboundTemplateVO> list = outboundOrdersMapper.selectOutboundOrdersExportList(outboundOrders);
return list;
}
/**
* 处理无库位明细拆分(仅拆分实际被扣减的库存ID)
*/
......
......@@ -264,13 +264,15 @@
<where>
oi.is_used = 1 and o.is_used = 1
<if test="orderId != null and orderId != ''"> and oi.order_id like concat('%', #{orderId}, '%')</if>
<if test="materialId != null and materialId != ''"> and oi.material_id = #{materialId}</if>
<if test="materialId != null and materialId != ''"> and m.sap_no like concat('%', #{materialId}, '%')or m.material_name like concat('%', #{materialId}, '%')</if>
<if test="batchCode != null and batchCode != ''"> and oi.batch_code = #{batchCode}</if>
<if test="startDate != null and startDate != ''"> and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &gt;= #{startDate}</if>
<if test="endDate != null and endDate != ''"> and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &lt;= #{endDate}</if>
<if test="warehouseId != null and warehouseId != ''"> and oi.warehouse_id = #{warehouseId}</if>
<if test="locationId != null and locationId != ''"> and oi.location_id = #{locationId}</if>
<if test="itemStatus != null "> and oi.item_status = #{itemStatus}</if>
<if test="orderStatus != null "> and o.order_status = #{orderStatus}</if>
</where>
group by oi.material_id,
m.material_name,
......@@ -357,7 +359,107 @@
o.order_id
order by sum(oi.unit_price * oi.actual_quantity) desc,m.sap_no, m.sort_no
</select>
<select id="selectOutboundOrdersitmesExportList"
parameterType="OutboundOrdersSummaryVO"
resultMap="OutboundOrdersSummaryVOResult">
select
oi.material_id,
m.material_name,
m.sap_no,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight,
sum(oi.planned_quantity) as planned_quantity,
sum(oi.actual_quantity) as actual_quantity,
oi.unit_price,
sum(oi.unit_price * oi.actual_quantity) as total_amount,
w.warehouses_name as warehouse_name,
oi.batch_code,
o.order_id as main_order_id,
sl.location_name,
-- 以下为VO中保留但无Excel注解的字段(保证关联完整性)
m.package_weight,
m.total_weight,
m.volume,
m.shelf_life_days,
m.storage_temperature,
m.special_requirements,
m.sort_no,
oi.warehouse_id,
oi.order_id as sub_order_id,
oi.location_id,
oi.item_status,
oi.remark
from outbound_order_items oi
left join outbound_orders o on oi.outbound_order_id = o.id
left join materials m on oi.material_id = m.id
left join warehouses w on oi.warehouse_id = w.id
left join storage_locations sl on oi.location_id = sl.id
<where>
oi.is_used = 1 and o.is_used = 1
-- 整合两个SQL的所有检索条件(去重且兼容)
<if test="orderId != null and orderId != ''">
and oi.order_id like concat('%', #{orderId}, '%')
</if>
<if test="materialId != null and materialId != ''">
and (m.sap_no like concat('%', #{materialId}, '%')
or m.material_name like concat('%', #{materialId}, '%')
or oi.material_id like concat('%', #{materialId}, '%'))
</if>
<if test="batchCode != null and batchCode != ''">
and oi.batch_code = #{batchCode}
</if>
<if test="startDate != null and startDate != ''">
and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &lt;= #{endDate}
</if>
<if test="warehouseId != null and warehouseId != ''">
and oi.warehouse_id = #{warehouseId}
</if>
<if test="locationId != null and locationId != ''">
and oi.location_id = #{locationId}
</if>
<if test="itemStatus != null ">
and oi.item_status = #{itemStatus}
</if>
<if test="orderStatus != null ">
and o.order_status = #{orderStatus}
</if>
</where>
-- 分组字段整合:覆盖两个SQL的分组维度,保证汇总逻辑一致
group by oi.material_id,
m.material_name,
m.sap_no,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight,
oi.unit_price,
w.warehouses_name,
oi.batch_code,
o.order_id,
sl.location_name,
m.package_weight,
m.total_weight,
m.volume,
m.shelf_life_days,
m.storage_temperature,
m.special_requirements,
m.sort_no,
oi.warehouse_id,
oi.order_id,
oi.location_id,
oi.item_status
-- 排序规则:优先按总金额降序,再按SAP编码、物料排序号
order by sum(oi.unit_price * oi.actual_quantity) desc,
m.sap_no,
m.sort_no
</select>
<!-- 批量删除:逻辑删除 -->
<update id="deleteOutboundOrderItemsByIds" parameterType="String">
update outbound_order_items
......
......@@ -71,6 +71,38 @@
<result property="inboundOrderId" column="inbound_order_id" />
</resultMap>
<resultMap id="OutboundTemplateVOMap" type="com.ruoyi.inventory.domain.vo.OutboundTemplateVO">
<id column="id" property="id"/>
<result column="inbound_date" property="inboundDate"/>
<result column="sap_no" property="sapNo"/>
<result column="material_id" property="materialId"/>
<result column="material_name" property="materialName"/>
<result column="ts_code" property="tsCode"/>
<result column="batch_code" property="batchCode"/>
<result column="planned_quantity" property="plannedQuantity"/>
<result column="divisor" property="divisor"/>
<result column="piece_weight" property="pieceWeight"/>
<result column="actual_packages" property="actualPackages"/>
<result column="actual_quantity" property="actualQuantity"/>
<result column="location_name" property="locationName"/>
<result column="location_id" property="locationId"/>
<result column="warehouse_id" property="warehouseId"/>
<result column="warehouse_name" property="warehouseName"/>
<result column="remark" property="remark"/>
<result column="label_color" property="labelColor"/>
<result column="voucher_number" property="voucherNumber"/>
<result column="insulation" property="insulation"/>
<result column="danger_check_type" property="dangerCheckType"/>
<result column="order_id" property="orderId"/>
<result column="system_no" property="systemNo"/>
<result column="order_type" property="orderType"/>
<result column="owner_id" property="ownerId"/>
<result column="owner_name" property="ownerName"/>
<result column="destination" property="destination"/>
<result column="reservation" property="reservation"/>
<result column="single_piece_weight" property="singlePieceWeight"/>
</resultMap>
<sql id="selectOutboundOrdersVo">
select
oo.id,
......@@ -106,7 +138,6 @@
<select id="selectOutboundOrdersList" parameterType="OutboundOrders" resultMap="OutboundOrdersOutboundOrderItemsResult">
<include refid="selectOutboundOrdersVo"/>
<if test="orderId != null and orderId != ''"> and oo.order_id like concat('%', #{orderId}, '%')</if>
<if test="batchCode != null and batchCode != ''"> and oo.batch_code like concat('%', #{batchCode}, '%')</if>
<if test="systemNo != null and systemNo != ''"> and oo.system_no like concat('%', #{systemNo}, '%')</if>
<if test="orderTypeId != null and orderTypeId != ''"> and oo.order_type_id = #{orderTypeId}</if>
<if test="orderType != null and orderType != ''"> and oo.order_type = #{orderType}</if>
......@@ -115,8 +146,12 @@
<if test="ownerId != null and ownerId != ''"> and oo.owner_id = #{ownerId}</if>
<if test="orderStatus != null "> and oo.order_status = #{orderStatus}</if>
<if test="isImport != null "> and oo.is_import = #{isImport}</if>
<if test="startDate != null"> and oo.inbound_date &gt;= #{startDate}</if>
<if test="endDate != null"> and oo.inbound_date &lt;= #{endDate}</if>
<if test="startDate != null and startDate != ''">
and DATE(oo.inbound_date) >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and DATE(oo.inbound_date) &lt;= #{endDate}
</if>
<if test="destination != null and destination != ''"> and oo.destination = #{destination}</if>
<if test="totalPlannedQuantity != null "> and oo.total_planned_quantity = #{totalPlannedQuantity}</if>
<if test="totalActualQuantity != null "> and oo.total_actual_quantity = #{totalActualQuantity}</if>
......@@ -371,4 +406,69 @@
WHERE id = #{item.id}
</foreach>
</update>
<select id="selectOutboundOrdersExportList"
parameterType="OutboundOrders"
resultMap="OutboundTemplateVOMap">
select
oi.id,
o.inbound_date,
m.sap_no,
m.id as material_id,
m.material_name,
m.ts_code,
oi.batch_code,
oi.planned_quantity,
oi.divisor,
m.package_weight as piece_weight,
null as actual_packages,
oi.actual_quantity,
sl.location_name,
sl.id as location_id,
w.id as warehouse_id,
w.warehouses_name as warehouse_name,
oi.remark,
oi.label_color,
oi.voucher_number,
m.storage_temperature as insulation,
m.risk_level as danger_check_type,
o.order_id,
o.system_no,
o.order_type,
ow.id as owner_id,
ow.owner_name,
o.destination,
null as reservation,
m.unit_weight as single_piece_weight
from outbound_order_items oi
left join outbound_orders o on oi.outbound_order_id = o.id
left join owners ow on o.owner_id = ow.id
left join materials m on oi.material_id = m.id
left join warehouses w on oi.warehouse_id = w.id
left join storage_locations sl on oi.location_id = sl.id
<where>
<if test="orderId != null and orderId != ''"> and o.order_id like concat('%', #{orderId}, '%')</if>
<if test="systemNo != null and systemNo != ''"> and o.system_no like concat('%', #{systemNo}, '%')</if>
<if test="orderTypeId != null and orderTypeId != ''"> and o.order_type_id = #{orderTypeId}</if>
<if test="orderType != null and orderType != ''"> and o.order_type = #{orderType}</if>
<if test="batchCode != null and batchCode != ''"> and o.batch_code like concat('%', #{batchCode}, '%')</if>
<if test="warehouseId != null and warehouseId != ''"> and o.warehouse_id = #{warehouseId}</if>
<if test="ownerId != null and ownerId != ''"> and o.owner_id = #{ownerId}</if>
<if test="orderStatus != null "> and o.order_status = #{orderStatus}</if>
<if test="isImport != null "> and o.is_import = #{isImport}</if>
<if test="startDate != null and startDate != ''">
and DATE(o.inbound_date) >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and DATE(o.inbound_date) &lt;= #{endDate}
</if>
<if test="destination != null and destination != ''"> and o.destination = #{destination}</if>
<if test="totalPlannedQuantity != null "> and o.total_planned_quantity = #{totalPlannedQuantity}</if>
<if test="totalActualQuantity != null "> and o.total_actual_quantity = #{totalActualQuantity}</if>
<if test="totalPackages != null "> and o.total_packages = #{totalPackages}</if>
<if test="sortNo != null "> and o.sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and o.create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and o.update_user_code = #{updateUserCode}</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -143,11 +143,11 @@
</update>
<update id="deleteOwnersById" parameterType="String">
update owners set is_used = 1 where id = #{id}
update owners set is_used = 0 where id = #{id}
</update>
<update id="deleteOwnersByIds" parameterType="String">
update owners set is_used = 1 where id in
update owners set is_used = 0 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
......
......@@ -37,6 +37,8 @@
<result property="pickingArea" column="picking_area" />
<result property="allowMixedProducts" column="allow_mixed_products" />
<result property="allowMixedBatches" column="allow_mixed_batches" />
<!-- 新增loading_area字段映射 -->
<result property="loadingArea" column="loading_area" />
</resultMap>
<!-- 关联仓库表的ResultMap - 继承基础ResultMap(自动包含新字段) -->
......@@ -57,7 +59,9 @@
-- 新增字段查询
sl.putaway_order, sl.picking_order, sl.location_usage,
sl.location_handling, sl.turnover_demand, sl.picking_area,
sl.allow_mixed_products, sl.allow_mixed_batches
sl.allow_mixed_products, sl.allow_mixed_batches,
-- 新增loading_area字段查询
sl.loading_area
from storage_locations sl
where sl.is_used = 1
</sql>
......@@ -73,6 +77,8 @@
sl.putaway_order, sl.picking_order, sl.location_usage,
sl.location_handling, sl.turnover_demand, sl.picking_area,
sl.allow_mixed_products, sl.allow_mixed_batches,
-- 新增loading_area字段查询
sl.loading_area,
w.warehouses_name
from storage_locations sl
left join warehouses w on sl.warehouses_id = w.id
......@@ -108,6 +114,8 @@
<if test="warehousesId != null and warehousesId != ''"> and sl.warehouses_id = #{warehousesId}</if>
<if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if>
<if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if>
<!-- 新增loading_area查询条件 -->
<if test="loadingArea != null and loadingArea != ''"> and sl.loading_area like concat('%', #{loadingArea}, '%')</if>
order by sl.sort_no desc
</select>
......@@ -131,6 +139,8 @@
<if test="pickingArea != null and pickingArea != ''"> and sl.picking_area = #{pickingArea}</if>
<if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if>
<if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if>
<!-- 新增loading_area查询条件 -->
<if test="loadingArea != null and loadingArea != ''"> and sl.loading_area = #{loadingArea}</if>
<!-- 按sort_no降序排序 -->
order by sl.sort_no desc
</select>
......@@ -145,7 +155,9 @@
-- 新增字段查询
sl.putaway_order, sl.picking_order, sl.location_usage,
sl.location_handling, sl.turnover_demand, sl.picking_area,
sl.allow_mixed_products, sl.allow_mixed_batches
sl.allow_mixed_products, sl.allow_mixed_batches,
-- 新增loading_area字段查询
sl.loading_area
from storage_locations sl
where sl.id = #{id}
</select>
......@@ -174,6 +186,8 @@
sl.putaway_order, sl.picking_order, sl.location_usage,
sl.location_handling, sl.turnover_demand, sl.picking_area,
sl.allow_mixed_products, sl.allow_mixed_batches,
-- 新增loading_area字段查询
sl.loading_area,
w.warehouses_name, w.warehouses_address, w.warehouses_manager, w.warehouses_phone
from storage_locations sl
left join warehouses w on sl.warehouses_code = w.warehouses_code
......@@ -272,6 +286,8 @@
<if test="pickingArea != null">picking_area,</if>
<if test="allowMixedProducts != null">allow_mixed_products,</if>
<if test="allowMixedBatches != null">allow_mixed_batches,</if>
<!-- 新增loading_area字段插入 -->
<if test="loadingArea != null">loading_area,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
......@@ -305,6 +321,8 @@
<if test="pickingArea != null">#{pickingArea},</if>
<if test="allowMixedProducts != null">#{allowMixedProducts},</if>
<if test="allowMixedBatches != null">#{allowMixedBatches},</if>
<!-- 新增loading_area字段值 -->
<if test="loadingArea != null">#{loadingArea},</if>
</trim>
</insert>
......@@ -317,7 +335,9 @@
is_enabled, is_used, sort_no, create_time, create_user_code,
update_time, update_user_code, warehouses_id, putaway_order, picking_order,
location_usage, location_handling, turnover_demand, picking_area,
allow_mixed_products, allow_mixed_batches
allow_mixed_products, allow_mixed_batches,
-- 新增loading_area字段
loading_area
) VALUES
<foreach collection="list" item="item" separator=",">
(
......@@ -327,7 +347,9 @@
#{item.isEnabled}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode},
#{item.updateTime}, #{item.updateUserCode}, #{item.warehousesId}, #{item.putawayOrder}, #{item.pickingOrder},
#{item.LocationUsage}, #{item.locationHandling}, #{item.turnoverDemand}, #{item.pickingArea},
#{item.allowMixedProducts}, #{item.allowMixedBatches}
#{item.allowMixedProducts}, #{item.allowMixedBatches},
-- 新增loading_area字段值
#{item.loadingArea}
)
</foreach>
</insert>
......@@ -364,6 +386,8 @@
<if test="pickingArea != null">picking_area = #{pickingArea},</if>
<if test="allowMixedProducts != null">allow_mixed_products = #{allowMixedProducts},</if>
<if test="allowMixedBatches != null">allow_mixed_batches = #{allowMixedBatches},</if>
<!-- 新增loading_area字段更新 -->
<if test="loadingArea != null">loading_area = #{loadingArea},</if>
</trim>
where id = #{id}
</update>
......@@ -409,6 +433,8 @@
<if test="pickingArea != null and pickingArea != ''"> and sl.picking_area = #{pickingArea}</if>
<if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if>
<if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if>
<!-- 新增loading_area查询条件 -->
<if test="loadingArea != null and loadingArea != ''"> and sl.loading_area = #{loadingArea}</if>
<!-- 按sort_no降序排序 -->
order by sl.sort_no desc
</select>
......@@ -432,6 +458,8 @@
<if test="pickingArea != null and pickingArea != ''"> and sl.picking_area = #{pickingArea}</if>
<if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if>
<if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if>
<!-- 新增loading_area查询条件 -->
<if test="loadingArea != null and loadingArea != ''"> and sl.loading_area = #{loadingArea}</if>
<!-- 按sort_no降序排序 -->
order by sl.sort_no desc
</select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论