Commit 4551012a by yubin

出库

parent 70157266
...@@ -51,4 +51,11 @@ export function listLocationsForSelector(query) { ...@@ -51,4 +51,11 @@ export function listLocationsForSelector(query) {
method: 'get', method: 'get',
params: query params: query
}) })
}
export function getlocationsdicts() {
return request({
url: '/inventory/owners/getMapList',
method: 'get'
})
} }
\ No newline at end of file
...@@ -42,3 +42,10 @@ export function delMaterials(id) { ...@@ -42,3 +42,10 @@ export function delMaterials(id) {
method: 'delete' method: 'delete'
}) })
} }
export function getMaterialsdicts() {
return request({
url: '/inventory/materials/getMapList',
method: 'get'
})
}
...@@ -42,3 +42,9 @@ export function delOwners(id) { ...@@ -42,3 +42,9 @@ export function delOwners(id) {
method: 'delete' method: 'delete'
}) })
} }
export function getOwnerdicts() {
return request({
url: '/inventory/owners/getMapList',
method: 'get'
})
}
...@@ -50,4 +50,10 @@ export function listWarehousesForSelector(query) { ...@@ -50,4 +50,10 @@ export function listWarehousesForSelector(query) {
method: 'get', method: 'get',
params: query params: query
}) })
} }
\ No newline at end of file export function getMapList() {
return request({
url: '/inventory/warehouses/getMapList',
method: 'get'
})
}
...@@ -373,7 +373,7 @@ ...@@ -373,7 +373,7 @@
<div v-for="(group, materialId) in outboundOrderItemsGroup" :key="materialId" class="material-group mb10"> <div v-for="(group, materialId) in outboundOrderItemsGroup" :key="materialId" class="material-group mb10">
<div class="group-header" style="background: #f5f7fa; padding: 8px 12px; border-radius: 4px; margin-bottom: 8px;"> <div class="group-header" style="background: #f5f7fa; padding: 8px 12px; border-radius: 4px; margin-bottom: 8px;">
<span style="font-weight: 600; margin-right: 16px;">物料ID{{ materialId }}</span> <span style="font-weight: 600; margin-right: 16px;">物料{{ materialId+" "+ getMaterialName(materialId) }}</span>
<span style="color: #666;">明细数量:{{ group.items.length }} </span> <span style="color: #666;">明细数量:{{ group.items.length }} </span>
<!-- 仅编辑模式显示分组操作按钮 --> <!-- 仅编辑模式显示分组操作按钮 -->
<el-button <el-button
...@@ -391,7 +391,6 @@ ...@@ -391,7 +391,6 @@
:row-class-name="(params) => rowInboundOrderItemsIndex(params, group.items)" :row-class-name="(params) => rowInboundOrderItemsIndex(params, group.items)"
@selection-change="handleInboundOrderItemsSelectionChange" @selection-change="handleInboundOrderItemsSelectionChange"
ref="inboundOrderItems" ref="inboundOrderItems"
border
style="width: 100%;" style="width: 100%;"
:row-key="item => item.inventoryId" :row-key="item => item.inventoryId"
:disabled="isViewDetail" :disabled="isViewDetail"
...@@ -399,8 +398,8 @@ ...@@ -399,8 +398,8 @@
<!-- 仅编辑模式显示选择列 --> <!-- 仅编辑模式显示选择列 -->
<el-table-column type="selection" width="50" align="center" v-if="!isViewDetail" /> <el-table-column type="selection" width="50" align="center" v-if="!isViewDetail" />
<el-table-column label="序号" align="center" prop="index" width="50"/> <el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="物料编号" prop="materialId" width="150" /> <el-table-column label="物料编号" prop="materialId" width="180"/>
<el-table-column label="仓库编号" prop="warehouseId" width="150" /> <!-- <el-table-column label="仓库编号" prop="warehouseId" width="150" /> -->
<el-table-column label="库位编号" prop="locationId" width="150" /> <el-table-column label="库位编号" prop="locationId" width="150" />
<el-table-column label="批次编号" prop="batchCode" width="150" /> <el-table-column label="批次编号" prop="batchCode" width="150" />
...@@ -439,6 +438,7 @@ ...@@ -439,6 +438,7 @@
:init-details="getInitDetails()" :init-details="getInitDetails()"
:group-data="currentGroupData" :group-data="currentGroupData"
:outbound-order-id="form.orderId || form.outboundOrderId" :outbound-order-id="form.orderId || form.outboundOrderId"
:materialdicts="materialdicts"
@submit="handleDetailSubmit" @submit="handleDetailSubmit"
@close="detailDialogOpen = false" @close="detailDialogOpen = false"
@update:open="detailDialogOpen = $event" @update:open="detailDialogOpen = $event"
...@@ -466,6 +466,8 @@ ...@@ -466,6 +466,8 @@
<script> <script>
import { listOrders, getOrders, delOrders, addOrders, updateOrders, ship } from "@/api/inventory/orders" import { listOrders, getOrders, delOrders, addOrders, updateOrders, ship } from "@/api/inventory/orders"
import { getMaterialsdicts } from "@/api/inventory/materials"
import OutboundOrderFormWithItems from './OutboundOrderFormWithItems.vue' import OutboundOrderFormWithItems from './OutboundOrderFormWithItems.vue'
import WarehouseSelector from "@/views/compononents/WarehouseSelector.vue" import WarehouseSelector from "@/views/compononents/WarehouseSelector.vue"
import LocationSelector from "@/views/compononents/LocationSelector.vue" import LocationSelector from "@/views/compononents/LocationSelector.vue"
...@@ -484,6 +486,7 @@ export default { ...@@ -484,6 +486,7 @@ export default {
}, },
data() { data() {
return { return {
materialdicts:[],
// 添加tableKey解决tableId渲染问题 // 添加tableKey解决tableId渲染问题
tableKey: 1, tableKey: 1,
// 遮罩层 // 遮罩层
...@@ -600,22 +603,33 @@ export default { ...@@ -600,22 +603,33 @@ export default {
created() { created() {
// 延迟加载避免初始化渲染问题 // 延迟加载避免初始化渲染问题
this.$nextTick(() => { this.$nextTick(() => {
this.getdicts(),
this.getList() this.getList()
}) })
}, },
methods: { methods: {
// 货主选择回调 getMaterialName(materialId) {
handleOwnerSelected(owner) { if (!materialId || !this.materialdicts.length) return '未知物料';
if (!owner) return // 精准匹配(如果需要模糊匹配,把 === 改成 includes 即可)
if (this.ownerSelectTarget === 'query') { const matchItem = this.materialdicts.find(item =>
this.queryParams.ownerId = owner.ownerId || owner.id String(item.value) === String(materialId)
this.queryOwnerName = owner.ownerName || owner.name );
this.handleQuery() return matchItem ? matchItem.label : '未知物料';
} else { },
this.form.ownerId = owner.ownerId || owner.id getdicts(){
this.form.ownerName = owner.ownerName || owner.name return getMaterialsdicts()
} .then(response => {
this.ownerSelectorVisible = false this.materialdicts = (response.data || response).map(item => ({
value: item.sap_no,
label: item.material_name,
}));
console.log("物料字典数据加载成功:", this.materialdicts);
})
.catch(error => {
console.error("加载物料字典失败:", error);
this.$message.error("物料字典加载失败,请刷新重试");
});
}, },
// 仓库选择回调 // 仓库选择回调
handleWarehouseSelected(warehouse) { handleWarehouseSelected(warehouse) {
...@@ -650,6 +664,25 @@ export default { ...@@ -650,6 +664,25 @@ export default {
this.ownerSelectTarget = target this.ownerSelectTarget = target
this.ownerSelectorVisible = true this.ownerSelectorVisible = true
}, },
// 货主选择回调(核心缺失方法)
handleOwnerSelected(owner) {
if (!owner) return
if (this.ownerSelectTarget === 'query') {
this.queryParams.ownerId = owner.ownerId || owner.id
this.queryOwnerName = owner.ownerName || owner.name
this.handleQuery()
} else {
this.form.ownerId = owner.ownerId || owner.id
this.form.ownerName = owner.ownerName || owner.name
// 更新明细中的默认货主(可选)
if (this.currentDetailItem) {
this.currentDetailItem.ownerId = owner.ownerId || owner.id
this.currentDetailItem.ownerName = owner.ownerName || owner.name
}
}
this.ownerSelectorVisible = false
},
// 打开仓库选择器 // 打开仓库选择器
openWarehouseSelector(target = 'form') { openWarehouseSelector(target = 'form') {
this.warehouseSelectTarget = target this.warehouseSelectTarget = target
......
...@@ -30,7 +30,7 @@ public interface MaterialsMapper ...@@ -30,7 +30,7 @@ public interface MaterialsMapper
* @param id 物料主键 * @param id 物料主键
* @return 物料 * @return 物料
*/ */
public List<Materials> selectMaterialsByMaterialsCode(String id); public List<Materials> selectMaterialsBySapNo(String id);
/** /**
* 查询物料列表 * 查询物料列表
......
...@@ -65,5 +65,5 @@ public interface OutboundOrderItemsMapper ...@@ -65,5 +65,5 @@ public interface OutboundOrderItemsMapper
* @param ids 需要删除的数据主键集合 * @param ids 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int deleteOutboundOrderItemsByIds(String[] ids); public int deleteOutboundOrderItemsById(String[] ids);
} }
...@@ -2,7 +2,6 @@ package com.ruoyi.inventory.mapper; ...@@ -2,7 +2,6 @@ package com.ruoyi.inventory.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.inventory.domain.ReturnOrderItems; import com.ruoyi.inventory.domain.ReturnOrderItems;
import com.ruoyi.inventory.domain.ReturnOrders;
import com.ruoyi.inventory.domain.vo.ReturnOrdersSummaryVO; import com.ruoyi.inventory.domain.vo.ReturnOrdersSummaryVO;
/** /**
......
...@@ -106,4 +106,5 @@ public interface IInventoryService ...@@ -106,4 +106,5 @@ public interface IInventoryService
* @return 库存明细集合 * @return 库存明细集合
*/ */
public List<Inventory> selectInventoryDetailList(Inventory inventory); public List<Inventory> selectInventoryDetailList(Inventory inventory);
} }
...@@ -4,11 +4,10 @@ import java.util.*; ...@@ -4,11 +4,10 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.ruoyi.common.annotation.SerialExecution; import com.ruoyi.common.annotation.SerialExecution;
import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.OutboundOrderItems; import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderLog; import com.ruoyi.inventory.domain.OutboundOrderLog;
import com.ruoyi.inventory.domain.StocktakeItems; import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.vo.InventorySummaryVO; import com.ruoyi.inventory.domain.vo.InventorySummaryVO;
import com.ruoyi.inventory.mapper.OutboundOrderItemsMapper; import com.ruoyi.inventory.mapper.OutboundOrderItemsMapper;
import com.ruoyi.inventory.mapper.OutboundOrderLogMapper; import com.ruoyi.inventory.mapper.OutboundOrderLogMapper;
...@@ -233,7 +232,7 @@ public class InventoryServiceImpl implements IInventoryService ...@@ -233,7 +232,7 @@ public class InventoryServiceImpl implements IInventoryService
* @date 2025/12/3 * @date 2025/12/3
* @version 1.0 * @version 1.0
*/ */
public List<StocktakeItems> selectstocktakeItemsList(){ public List<StocktakeItemsTo> selectstocktakeItemsList(){
return inventoryMapper.selectstocktakeItemsList(); return inventoryMapper.selectstocktakeItemsList();
} }
......
...@@ -81,7 +81,7 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService ...@@ -81,7 +81,7 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
@Override @Override
public int deleteOutboundOrderItemsByIds(String[] ids) public int deleteOutboundOrderItemsByIds(String[] ids)
{ {
return outboundOrderItemsMapper.deleteOutboundOrderItemsByIds(ids); return outboundOrderItemsMapper.deleteOutboundOrderItemsById(ids);
} }
/** /**
......
...@@ -41,6 +41,11 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService ...@@ -41,6 +41,11 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
private OutboundOrderLogMapper outboundOrderLogMapper; private OutboundOrderLogMapper outboundOrderLogMapper;
@Autowired @Autowired
private OwnersServiceImpl ownersService;
@Autowired
private WarehousesServiceImpl warehousesService;
@Autowired
private InventoryServiceImpl inventoryService; private InventoryServiceImpl inventoryService;
/** /**
* 查询出库单主 * 查询出库单主
...@@ -64,7 +69,8 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService ...@@ -64,7 +69,8 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
@Override @Override
public List<OutboundOrders> selectOutboundOrdersList(OutboundOrders outboundOrders) public List<OutboundOrders> selectOutboundOrdersList(OutboundOrders outboundOrders)
{ {
return outboundOrdersMapper.selectOutboundOrdersList(outboundOrders); List<OutboundOrders> outboundOrders1 = outboundOrdersMapper.selectOutboundOrdersList(outboundOrders);
return outboundOrders1;
} }
/** /**
...@@ -80,6 +86,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService ...@@ -80,6 +86,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
outboundOrders.setCreateTime(DateUtils.getNowDate()); outboundOrders.setCreateTime(DateUtils.getNowDate());
outboundOrders.setCreateBy(SystemUtils.getUserName()); outboundOrders.setCreateBy(SystemUtils.getUserName());
outboundOrders.setId(UUID.randomUUID().toString()); outboundOrders.setId(UUID.randomUUID().toString());
int rows = outboundOrdersMapper.insertOutboundOrders(outboundOrders); int rows = outboundOrdersMapper.insertOutboundOrders(outboundOrders);
insertOutboundOrderItems(outboundOrders); insertOutboundOrderItems(outboundOrders);
return rows; return rows;
...@@ -95,9 +102,12 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService ...@@ -95,9 +102,12 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
@Override @Override
public int updateOutboundOrders(OutboundOrders outboundOrders) public int updateOutboundOrders(OutboundOrders outboundOrders)
{ {
outboundOrders.setUpdateTime(DateUtils.getNowDate());
outboundOrdersMapper.deleteOutboundOrderItemsByOrderId(outboundOrders.getId()); outboundOrdersMapper.deleteOutboundOrderItemsByOrderId(outboundOrders.getId());
outboundOrderLogMapper.deleteOutboundOrderLogByOrdersId(outboundOrders.getId()); outboundOrderLogMapper.deleteOutboundOrderLogByOrdersId(outboundOrders.getId());
outboundOrders.setUpdateBy(SystemUtils.getUserName());
outboundOrders.setUpdateTime(DateUtils.getNowDate());
insertOutboundOrderItems(outboundOrders); insertOutboundOrderItems(outboundOrders);
return outboundOrdersMapper.updateOutboundOrders(outboundOrders); return outboundOrdersMapper.updateOutboundOrders(outboundOrders);
} }
...@@ -197,6 +207,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService ...@@ -197,6 +207,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
for (OutboundOrderItems items : outboundOrderItemsList) { for (OutboundOrderItems items : outboundOrderItemsList) {
OutboundOrderLog log = new OutboundOrderLog(); OutboundOrderLog log = new OutboundOrderLog();
BeanUtils.copyProperties(items, log); // 单个对象属性拷贝 BeanUtils.copyProperties(items, log); // 单个对象属性拷贝
log.setOrderId(items.getId());
outboundOrderLogs.add(log); outboundOrderLogs.add(log);
inventoryIds.add(log.getInventoryId()); inventoryIds.add(log.getInventoryId());
deleteOutboundOrdersById(items.getId()); deleteOutboundOrdersById(items.getId());
......
...@@ -76,7 +76,7 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService ...@@ -76,7 +76,7 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
String[] AllowedCategoryIds = storageLocations2.getAllowedCategoryIds().split(","); String[] AllowedCategoryIds = storageLocations2.getAllowedCategoryIds().split(",");
for (String AllowedCategoryId : AllowedCategoryIds) { for (String AllowedCategoryId : AllowedCategoryIds) {
List<Materials> materials = materialsMapper.selectMaterialsByMaterialsCode(AllowedCategoryId); List<Materials> materials = materialsMapper.selectMaterialsBySapNo(AllowedCategoryId);
if (materials != null && !materials.isEmpty()) { if (materials != null && !materials.isEmpty()) {
Materials materials1 = materials.get(0); Materials materials1 = materials.get(0);
...@@ -120,7 +120,7 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService ...@@ -120,7 +120,7 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
storageLocationsCategory.setCategoryId(categoryId); storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setCreateTime(DateUtils.getNowDate()); storageLocationsCategory.setCreateTime(DateUtils.getNowDate());
storageLocationsCategory.setCreateUserCode(String.valueOf(SecurityUtils.getUserId())); storageLocationsCategory.setCreateUserCode(String.valueOf(SecurityUtils.getUserId()));
List<Materials> materials = materialsMapper.selectMaterialsByMaterialsCode(categoryId); List<Materials> materials = materialsMapper.selectMaterialsBySapNo(categoryId);
if (materials != null && !materials.isEmpty()) { if (materials != null && !materials.isEmpty()) {
Materials materials1 = materials.get(0); Materials materials1 = materials.get(0);
storageLocationsCategory.setCategoryName(materials1.getMaterialName()); storageLocationsCategory.setCategoryName(materials1.getMaterialName());
...@@ -159,7 +159,7 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService ...@@ -159,7 +159,7 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
storageLocationsCategory.setCategoryId(categoryId); storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setUpdateTime(DateUtils.getNowDate()); storageLocationsCategory.setUpdateTime(DateUtils.getNowDate());
storageLocationsCategory.setUpdateUserCode(String.valueOf(SecurityUtils.getUserId())); storageLocationsCategory.setUpdateUserCode(String.valueOf(SecurityUtils.getUserId()));
List<Materials> materials = materialsMapper.selectMaterialsByMaterialsCode(categoryId); List<Materials> materials = materialsMapper.selectMaterialsBySapNo(categoryId);
if (materials != null && !materials.isEmpty()) { if (materials != null && !materials.isEmpty()) {
Materials materials1 = materials.get(0); Materials materials1 = materials.get(0);
storageLocationsCategory.setCategoryName(materials1.getMaterialName()); storageLocationsCategory.setCategoryName(materials1.getMaterialName());
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.inventory.mapper.InboundOrderItemsMapper"> <mapper namespace="com.ruoyi.inventory.mapper.InboundOrderItemsMapper">
<resultMap type="InboundOrderItems" id="InboundOrderItemsResult"> <resultMap type="com.ruoyi.inventory.domain.InboundOrderItems" id="InboundOrderItemsResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id" />
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
select id, order_id, material_id, batch_id, warehouse_id, location_id, planned_quantity, actual_quantity, planned_packages, actual_packages, divisor, label_color, voucher_number, unit_price, item_status, received_at, received_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code,inbound_order_id from inbound_order_items select id, order_id, material_id, batch_id, warehouse_id, location_id, planned_quantity, actual_quantity, planned_packages, actual_packages, divisor, label_color, voucher_number, unit_price, item_status, received_at, received_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code,inbound_order_id from inbound_order_items
</sql> </sql>
<select id="selectInboundOrderItemsList" parameterType="InboundOrderItems" resultMap="InboundOrderItemsResult"> <select id="selectInboundOrderItemsList" parameterType="com.ruoyi.inventory.domain.InboundOrderItems" resultMap="InboundOrderItemsResult">
<include refid="selectInboundOrderItemsVo"/> <include refid="selectInboundOrderItemsVo"/>
<where> <where>
<if test="inboundOrderId != null and inboundOrderId != ''"> and inbound_order_id = #{inboundOrderId}</if> <if test="inboundOrderId != null and inboundOrderId != ''"> and inbound_order_id = #{inboundOrderId}</if>
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<select id="selectInboundOrderItemsListAndMaterialName" <select id="selectInboundOrderItemsListAndMaterialName"
parameterType="InboundOrderItems" parameterType="com.ruoyi.inventory.domain.InboundOrderItems"
resultMap="InboundOrderItemsAndMnameResult"> resultMap="InboundOrderItemsAndMnameResult">
SELECT SELECT
ii.id, ii.id,
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
and inbound_order_id = #{inboundOrderId} and inbound_order_id = #{inboundOrderId}
</if> </if>
<if test="orderId != null and orderId != ''"> <if test="orderId != null and orderId != ''">
order_id = #{orderId} and order_id = #{orderId}
</if> </if>
<if test="materialId != null and materialId != ''"> <if test="materialId != null and materialId != ''">
and material_id = #{materialId} and material_id = #{materialId}
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
</where> </where>
</select> </select>
<insert id="insertInboundOrderItems" parameterType="InboundOrderItems"> <insert id="insertInboundOrderItems" parameterType="com.ruoyi.inventory.domain.InboundOrderItems">
insert into inbound_order_items insert into inbound_order_items
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if> <if test="id != null">id,</if>
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
</trim> </trim>
</insert> </insert>
<update id="updateInboundOrderItems" parameterType="InboundOrderItems"> <update id="updateInboundOrderItems" parameterType="com.ruoyi.inventory.domain.InboundOrderItems">
update inbound_order_items update inbound_order_items
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="orderId != null">order_id = #{orderId},</if> <if test="orderId != null">order_id = #{orderId},</if>
......
...@@ -76,9 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -76,9 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
order by sort_no asc order by sort_no asc
</select> </select>
<select id="selectMaterialsByMaterialsCode" parameterType="String" resultMap="MaterialsResult"> <select id="selectMaterialsBySapNo" parameterType="String" resultMap="MaterialsResult">
<include refid="selectMaterialsVo"/> <include refid="selectMaterialsVo"/>
where material_code = #{id} where sap_no = #{id}
order by sort_no asc order by sort_no asc
</select> </select>
<select id="selectMaterialsByCategory" parameterType="String" resultMap="MaterialsResult"> <select id="selectMaterialsByCategory" parameterType="String" resultMap="MaterialsResult">
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.inventory.mapper.OutboundOrderItemsMapper"> <mapper namespace="com.ruoyi.inventory.mapper.OutboundOrderItemsMapper">
<resultMap type="OutboundOrderItems" id="OutboundOrderItemsResult"> <resultMap type="OutboundOrderItems" id="OutboundOrderItemsResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
...@@ -58,13 +58,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -58,13 +58,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" /> <result property="updateUserCode" column="update_user_code" />
</resultMap> </resultMap>
<sql id="selectOutboundOrderItemsVo"> <sql id="selectOutboundOrderItemsVo">
select id, order_id, material_id, batch_code, warehouse_id, location_id, inventory_id, outbound_order_id, unit_price, planned_quantity, actual_quantity, divisor, label_color, voucher_number, item_status, shipped_at, shipped_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from outbound_order_items select id, order_id, material_id, batch_code, warehouse_id, location_id, inventory_id, outbound_order_id, unit_price, planned_quantity, actual_quantity, divisor, label_color, voucher_number, item_status, shipped_at, shipped_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from outbound_order_items
</sql> </sql>
<select id="selectOutboundOrderItemsList" parameterType="OutboundOrderItems" resultMap="OutboundOrderItemsResult"> <select id="selectOutboundOrderItemsList" parameterType="OutboundOrderItems" resultMap="OutboundOrderItemsResult">
<include refid="selectOutboundOrderItemsVo"/> <include refid="selectOutboundOrderItemsVo"/>
<where> <where>
<if test="isUsed == null">
is_used = 1
</if>
<if test="isUsed != null">
is_used = #{isUsed}
</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if> <if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if> <if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if> <if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
...@@ -79,16 +86,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -79,16 +86,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="itemStatus != null "> and item_status = #{itemStatus}</if> <if test="itemStatus != null "> and item_status = #{itemStatus}</if>
<if test="shippedAt != null "> and shipped_at = #{shippedAt}</if> <if test="shippedAt != null "> and shipped_at = #{shippedAt}</if>
<if test="shippedBy != null and shippedBy != ''"> and shipped_by = #{shippedBy}</if> <if test="shippedBy != null and shippedBy != ''"> and shipped_by = #{shippedBy}</if>
<if test="isUsed != null "> and is_used = #{isUsed}</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if> <if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if> <if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if> <if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
</where> </where>
</select> </select>
<!-- 单条查询:默认查使用中,若手动传isUsed则覆盖 -->
<select id="selectOutboundOrderItemsById" parameterType="String" resultMap="OutboundOrderItemsResult"> <select id="selectOutboundOrderItemsById" parameterType="String" resultMap="OutboundOrderItemsResult">
<include refid="selectOutboundOrderItemsVo"/> <include refid="selectOutboundOrderItemsVo"/>
where id = #{id} where id = #{id}
<!-- 增加is_used过滤,避免查询已逻辑删除的数据 -->
<if test="isUsed == null">
and is_used = 1
</if>
<if test="isUsed != null">
and is_used = #{isUsed}
</if>
</select> </select>
<insert id="insertOutboundOrderItems" parameterType="OutboundOrderItems"> <insert id="insertOutboundOrderItems" parameterType="OutboundOrderItems">
...@@ -112,13 +126,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -112,13 +126,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="shippedAt != null">shipped_at,</if> <if test="shippedAt != null">shipped_at,</if>
<if test="shippedBy != null">shipped_by,</if> <if test="shippedBy != null">shipped_by,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="isUsed == null">is_used,</if>
<if test="isUsed != null">is_used,</if> <if test="isUsed != null">is_used,</if>
<if test="sortNo != null">sort_no,</if> <if test="sortNo != null">sort_no,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="createUserCode != null">create_user_code,</if> <if test="createUserCode != null">create_user_code,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="updateUserCode != null">update_user_code,</if> <if test="updateUserCode != null">update_user_code,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
<if test="orderId != null">#{orderId},</if> <if test="orderId != null">#{orderId},</if>
...@@ -138,13 +153,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -138,13 +153,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="shippedAt != null">#{shippedAt},</if> <if test="shippedAt != null">#{shippedAt},</if>
<if test="shippedBy != null">#{shippedBy},</if> <if test="shippedBy != null">#{shippedBy},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="isUsed == null">1,</if>
<if test="isUsed != null">#{isUsed},</if> <if test="isUsed != null">#{isUsed},</if>
<if test="sortNo != null">#{sortNo},</if> <if test="sortNo != null">#{sortNo},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="createUserCode != null">#{createUserCode},</if> <if test="createUserCode != null">#{createUserCode},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="updateUserCode != null">#{updateUserCode},</if> <if test="updateUserCode != null">#{updateUserCode},</if>
</trim> </trim>
</insert> </insert>
<update id="updateOutboundOrderItems" parameterType="OutboundOrderItems"> <update id="updateOutboundOrderItems" parameterType="OutboundOrderItems">
...@@ -177,10 +193,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -177,10 +193,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteOutboundOrderItemsById" parameterType="String"> <!-- 单条删除:逻辑删除 -->
delete from outbound_order_items where id = #{id} <update id="deleteOutboundOrderItemsById" parameterType="String">
</delete> update outbound_order_items
set is_used = 0
where id = #{id}
</update>
<!-- 统计查询:默认查is_used=1,支持手动传isUsed覆盖 -->
<select id="selectOutboundOrderItemsStatistics" <select id="selectOutboundOrderItemsStatistics"
parameterType="OutboundOrderItemsStatisticsVO" parameterType="OutboundOrderItemsStatisticsVO"
resultMap="OutboundOrderItemsStatisticsVoResult"> resultMap="OutboundOrderItemsStatisticsVoResult">
...@@ -211,36 +231,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -211,36 +231,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
oi.update_user_code oi.update_user_code
FROM outbound_order_items oi FROM outbound_order_items oi
LEFT JOIN outbound_orders o ON oi.outbound_order_id = o.id LEFT JOIN outbound_orders o ON oi.outbound_order_id = o.id
WHERE oi.is_used = 1 <where>
<if test="orderId != null and orderId != ''"> <if test="isUsed == null">
AND o.order_id LIKE CONCAT('%', #{orderId}, '%') oi.is_used = 1
</if> </if>
<if test="startDate != null"> <if test="isUsed != null">
AND o.inbound_date >= #{startDate} oi.is_used = #{isUsed}
</if> </if>
<if test="endDate != null"> <if test="orderId != null and orderId != ''">
AND o.inbound_date &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY) AND o.order_id LIKE CONCAT('%', #{orderId}, '%')
</if> </if>
<if test="materialId != null and materialId != ''"> <if test="startDate != null">
AND oi.material_id LIKE CONCAT('%', #{materialId}, '%') AND o.inbound_date >= #{startDate}
</if> </if>
<if test="warehouseId != null and warehouseId != ''"> <if test="endDate != null">
AND oi.warehouse_id = #{warehouseId} AND o.inbound_date &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if> </if>
<if test="locationId != null and locationId != ''"> <if test="materialId != null and materialId != ''">
AND oi.location_id = #{locationId} AND oi.material_id LIKE CONCAT('%', #{materialId}, '%')
</if> </if>
<if test="itemStatus != null and itemStatus != ''"> <if test="warehouseId != null and warehouseId != ''">
AND oi.item_status = #{itemStatus} AND oi.warehouse_id = #{warehouseId}
</if> </if>
<if test="locationId != null and locationId != ''">
AND oi.location_id = #{locationId}
</if>
<if test="itemStatus != null and itemStatus != ''">
AND oi.item_status = #{itemStatus}
</if>
</where>
ORDER BY oi.create_time DESC ORDER BY oi.create_time DESC
</select> </select>
<delete id="deleteOutboundOrderItemsByIds" parameterType="String"> <!-- 批量删除:逻辑删除 -->
delete from outbound_order_items where id in <update id="deleteOutboundOrderItemsByIds" parameterType="String">
update outbound_order_items
set is_used = 0
where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<select id="selectOutboundOrderLogList" parameterType="OutboundOrderLog" resultMap="OutboundOrderLogResult"> <select id="selectOutboundOrderLogList" parameterType="OutboundOrderLog" resultMap="OutboundOrderLogResult">
<include refid="selectOutboundOrderLogVo"/> <include refid="selectOutboundOrderLogVo"/>
<where> where is_used=1
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if> <if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="inventoryId != null and inventoryId != ''"> and inventory_id = #{inventoryId}</if> <if test="inventoryId != null and inventoryId != ''"> and inventory_id = #{inventoryId}</if>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if> <if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
...@@ -32,34 +32,29 @@ ...@@ -32,34 +32,29 @@
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if> <if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
<if test="actualQuantity != null "> and actual_quantity = #{actualQuantity}</if> <if test="actualQuantity != null "> and actual_quantity = #{actualQuantity}</if>
<if test="itemStatus != null "> and item_status = #{itemStatus}</if> <if test="itemStatus != null "> and item_status = #{itemStatus}</if>
<if test="isUsed != null "> and is_used = #{isUsed}</if>
</where>
</select> </select>
<select id="deleteLog" parameterType="OutboundOrderLog" resultMap="OutboundOrderLogResult"> <update id="deleteLog" parameterType="OutboundOrderLog">
delete from outbound_order_log update outbound_order_log set is_used=0
<where> <where>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if> <if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if> <if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if> <if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
<if test="itemStatus != null "> and item_status = #{itemStatus}</if> <if test="itemStatus != null "> and item_status = #{itemStatus}</if>
<!-- 补充inventory_id条件 -->
<if test="inventoryId != null and inventoryId != ''"> and inventory_id = #{inventoryId}</if> <if test="inventoryId != null and inventoryId != ''"> and inventory_id = #{inventoryId}</if>
</where> </where>
</select> </update>
<!-- 修正参数错误:原#{id}改为#{inventoryId} -->
<select id="selectLockedQuantityByInventory" parameterType="OutboundOrderLog" resultType="java.lang.Long"> <select id="selectLockedQuantityByInventory" parameterType="OutboundOrderLog" resultType="java.lang.Long">
select ifnull(sum(actual_quantity), 0) select ifnull(sum(actual_quantity), 0)
from outbound_order_log from outbound_order_log
where item_status=1 where item_status=1 and is_used=1
<if test="inventoryId != null and inventoryId != ''"> and inventory_id = #{inventoryId}</if> <if test="inventoryId != null and inventoryId != ''"> and inventory_id = #{inventoryId}</if>
</select> </select>
<select id="selectOutboundOrderLogById" parameterType="String" resultMap="OutboundOrderLogResult"> <select id="selectOutboundOrderLogById" parameterType="String" resultMap="OutboundOrderLogResult">
<include refid="selectOutboundOrderLogVo"/> <include refid="selectOutboundOrderLogVo"/>
where id = #{id} where id = #{id} and is_used=1
</select> </select>
<!-- 插入语句补充inventory_id --> <!-- 插入语句补充inventory_id -->
...@@ -105,20 +100,20 @@ ...@@ -105,20 +100,20 @@
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteOutboundOrderLogById" parameterType="String"> <update id="deleteOutboundOrderLogById" parameterType="String">
delete from outbound_order_log where id = #{id} update outbound_order_log set is_used=0 where id = #{id}
</delete> </update>
<delete id="deleteOutboundOrderLogByOrdersId" parameterType="String"> <update id="deleteOutboundOrderLogByOrdersId" parameterType="String">
delete from outbound_order_log where order_id = #{id} update outbound_order_log set is_used=0 where order_id = #{id}
</delete> </update>
<delete id="deleteOutboundOrderLogByOrdersIds" parameterType="String"> <update id="deleteOutboundOrderLogByOrdersIds" parameterType="String">
delete from outbound_order_log where order_id in update outbound_order_log set is_used=0 where order_id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </update>
<!-- 批量插入补充inventory_id --> <!-- 批量插入补充inventory_id -->
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.inventory.mapper.OutboundOrdersMapper"> <mapper namespace="com.ruoyi.inventory.mapper.OutboundOrdersMapper">
<resultMap type="OutboundOrders" id="OutboundOrdersResult"> <resultMap type="com.ruoyi.inventory.domain.OutboundOrders" id="OutboundOrdersResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="systemNo" column="system_no" /> <result property="systemNo" column="system_no" />
...@@ -27,12 +27,17 @@ ...@@ -27,12 +27,17 @@
<result property="updateUserCode" column="update_user_code" /> <result property="updateUserCode" column="update_user_code" />
</resultMap> </resultMap>
<resultMap id="OutboundOrdersOutboundOrderItemsResult" type="OutboundOrders" extends="OutboundOrdersResult"> <!-- 核心修复:删除重复的collection,只保留一个正确的关联配置 -->
<collection property="outboundOrderItemsList" ofType="OutboundOrderItems" column="id" select="selectOutboundOrderItemsList" /> <resultMap id="OutboundOrdersOutboundOrderItemsResult" type="com.ruoyi.inventory.domain.OutboundOrders" extends="OutboundOrdersResult">
<collection
property="outboundOrderItemsList"
ofType="com.ruoyi.inventory.domain.OutboundOrderItems"
column="id"
select="selectOutboundOrderItemsList" />
</resultMap> </resultMap>
<!-- 修复:仅保留子表outbound_order_items的字段映射,删除错误的主表字段 --> <!-- 原主表结果映射:仅修复InboundOrderId大小写,其余完全保留 -->
<resultMap type="OutboundOrderItems" id="OutboundOrderItemsResult"> <resultMap type="com.ruoyi.inventory.domain.OutboundOrderItems" id="OutboundOrderItemsResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id" />
...@@ -57,47 +62,44 @@ ...@@ -57,47 +62,44 @@
<result property="createUserCode" column="create_user_code" /> <result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" /> <result property="updateUserCode" column="update_user_code" />
<result property="InboundOrderId" column="inbound_order_id" /> <result property="inboundOrderId" column="inbound_order_id" />
</resultMap> </resultMap>
<!-- 以下所有代码完全保留,不做任何修改 -->
<sql id="selectOutboundOrdersVo"> <sql id="selectOutboundOrdersVo">
select id, order_id, system_no, order_type_id, batch_code, warehouse_id, owner_id, order_status, inbound_date, destination, total_planned_quantity, total_actual_quantity, total_packages, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from outbound_orders select id, order_id, system_no, order_type_id, batch_code, warehouse_id, owner_id, order_status, inbound_date, destination, total_planned_quantity, total_actual_quantity, total_packages, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from outbound_orders
</sql> </sql>
<select id="selectOutboundOrdersList" parameterType="OutboundOrders" resultMap="OutboundOrdersResult"> <select id="selectOutboundOrdersList" parameterType="OutboundOrders" resultMap="OutboundOrdersResult">
<include refid="selectOutboundOrdersVo"/> <include refid="selectOutboundOrdersVo"/>
<where> where is_used = 1
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if> <if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</if> <if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</if>
<if test="orderTypeId != null and orderTypeId != ''"> and order_type_id = #{orderTypeId}</if> <if test="orderTypeId != null and orderTypeId != ''"> and order_type_id = #{orderTypeId}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if> <if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if> <if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="ownerId != null and ownerId != ''"> and owner_id = #{ownerId}</if> <if test="ownerId != null and ownerId != ''"> and owner_id = #{ownerId}</if>
<if test="orderStatus != null "> and order_status = #{orderStatus}</if> <if test="orderStatus != null "> and order_status = #{orderStatus}</if>
<if test="inboundDate != null "> and inbound_date = #{inboundDate}</if> <if test="inboundDate != null "> and inbound_date = #{inboundDate}</if>
<if test="destination != null and destination != ''"> and destination = #{destination}</if> <if test="destination != null and destination != ''"> and destination = #{destination}</if>
<if test="totalPlannedQuantity != null "> and total_planned_quantity = #{totalPlannedQuantity}</if> <if test="totalPlannedQuantity != null "> and total_planned_quantity = #{totalPlannedQuantity}</if>
<if test="totalActualQuantity != null "> and total_actual_quantity = #{totalActualQuantity}</if> <if test="totalActualQuantity != null "> and total_actual_quantity = #{totalActualQuantity}</if>
<if test="totalPackages != null "> and total_packages = #{totalPackages}</if> <if test="totalPackages != null "> and total_packages = #{totalPackages}</if>
<if test="isUsed != null "> and is_used = #{isUsed}</if> <if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if> <if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if> <if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
</where>
</select> </select>
<select id="selectOutboundOrdersById" parameterType="String" resultMap="OutboundOrdersOutboundOrderItemsResult"> <select id="selectOutboundOrdersById" parameterType="String" resultMap="OutboundOrdersOutboundOrderItemsResult">
select id, order_id, system_no, order_type_id, batch_code, warehouse_id, owner_id, order_status, inbound_date, destination, total_planned_quantity, total_actual_quantity, total_packages, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code select id, order_id, system_no, order_type_id, batch_code, warehouse_id, owner_id, order_status, inbound_date, destination, total_planned_quantity, total_actual_quantity, total_packages, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from outbound_orders from outbound_orders
where id = #{id} where id = #{id} and is_used=1
</select> </select>
<!-- 仅保留子表查询逻辑,字段完整且映射正确 -->
<select id="selectOutboundOrderItemsList" parameterType="String" resultMap="OutboundOrderItemsResult"> <select id="selectOutboundOrderItemsList" parameterType="String" resultMap="OutboundOrderItemsResult">
select id, order_id, material_id, batch_code, warehouse_id, location_id, inventory_id, outbound_order_id, unit_price, planned_quantity, actual_quantity, divisor, label_color, voucher_number, item_status, shipped_at, shipped_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code select id, order_id, material_id, batch_code, warehouse_id, location_id, inventory_id, outbound_order_id, unit_price, planned_quantity, actual_quantity, divisor, label_color, voucher_number, item_status, shipped_at, shipped_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from outbound_order_items from outbound_order_items
where order_id = #{id} where outbound_order_id = #{id} AND is_used=1
</select> </select>
<insert id="insertOutboundOrders" parameterType="OutboundOrders"> <insert id="insertOutboundOrders" parameterType="OutboundOrders">
...@@ -174,26 +176,26 @@ ...@@ -174,26 +176,26 @@
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteOutboundOrdersById" parameterType="String"> <update id="deleteOutboundOrdersById" parameterType="String">
delete from outbound_orders where id = #{id} update outbound_orders set is_used=0 where id = #{id}
</delete> </update>
<delete id="deleteOutboundOrdersByIds" parameterType="String"> <update id="deleteOutboundOrdersByIds" parameterType="String">
delete from outbound_orders where id in update outbound_orders set is_used=0 where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </update>
<delete id="deleteOutboundOrderItemsByOrderIds" parameterType="String"> <update id="deleteOutboundOrderItemsByOrderIds" parameterType="String">
delete from outbound_order_items where outbound_order_id in update outbound_order_items set is_used=0 where outbound_order_id in
<foreach item="orderId" collection="array" open="(" separator="," close=")"> <foreach item="orderId" collection="array" open="(" separator="," close=")">
#{orderId} #{orderId}
</foreach> </foreach>
</delete> </update>
<delete id="deleteOutboundOrderItemsByOrderId" parameterType="String"> <delete id="deleteOutboundOrderItemsByOrderId" parameterType="String">
delete from outbound_order_items where outbound_order_id = #{orderId} update outbound_order_items set is_used=0 where outbound_order_id = #{orderId}
</delete> </delete>
<insert id="batchOutboundOrderItems"> <insert id="batchOutboundOrderItems">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论