Commit b5531cfe by zhangtw

入库管理使用仓库、库位、货主组件

parent 5a3df889
......@@ -39,7 +39,7 @@ export function updateMaterials(data) {
export function delMaterials(id) {
return request({
url: '/inventory/materials/' + id,
method: 'delete'
method: 'put'
})
}
......
......@@ -39,7 +39,7 @@ export function updateMaterials_category(data) {
export function delMaterials_category(id) {
return request({
url: '/inventory/materials_category/' + id,
method: 'delete'
method: 'put'
})
}
......@@ -49,4 +49,4 @@ export function categoryTreeSelect() {
url: '/inventory/materials_category/categoryTree',
method: 'get'
})
}
\ No newline at end of file
}
......@@ -23,18 +23,26 @@
@search="handleQuery"
@reset="resetQuery"
>
<el-form-item label="入库单号" prop="orderId">
<el-form-item label="物料SAPNO" prop="sapNo">
<el-input
v-model="queryParams.orderId"
placeholder="请输入入库单号"
v-model="queryParams.sapNo"
placeholder="请输入物料SAPNO"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="系统编号" prop="systemNo">
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryParams.systemNo"
placeholder="请输入系统编号"
v-model="queryParams.materialName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="关联入库单单号" prop="orderId">
<el-input
v-model="queryParams.orderId"
placeholder="请输入入库单单号"
clearable
@keyup.enter.native="handleQuery"
/>
......@@ -47,29 +55,35 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="入库类型" prop="orderTypeId">
<el-select v-model="queryParams.orderTypeId" placeholder="请选择入库类型" clearable>
<el-form-item label="所在仓库" prop="warehouseId">
<el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable
@change="handleQuery"
filterable
>
<el-option
v-for="item in inBoundTypeOptions"
:key="item.orderTypeId"
:label="item.orderTypeName"
:value="item.orderTypeId"
v-for="item in warehouseOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="入库单状态" prop="orderStatus">
<el-select v-model="queryParams.orderStatus" placeholder="请选择入库单状态" clearable>
<!-- 库位ID下拉框:修正数据源 + 唯一key -->
<el-form-item label="库位ID" prop="locationId">
<el-select v-model="queryParams.locationId" placeholder="请选择库位ID" clearable>
<!-- 替换为库位专属数据源(需补充 locationOptions 定义) -->
<el-option
v-for="item in inBoundStatusOptions"
:key="item.orderStatus"
:label="item.orderStatusName"
:value="item.orderStatus"
v-for="item in locationOptions"
:key="item.locationId"
:label="item.locationName"
:value="item.locationId"
/>
</el-select>
</el-form-item>
<el-form-item label="订单类型" prop="orderType">
<el-select v-model="queryParams.orderType" placeholder="请选择订单类型" clearable>
<el-form-item label="标签颜色" prop="labelColor">
<el-select v-model="queryParams.locationId" placeholder="请选择标签颜色" clearable>
<el-option
v-for="item in orderTypeOptions"
:key="item.orderType"
......@@ -87,13 +101,14 @@
height="100%"
:data="inboundList"
@selection-change="handleSelectionChange"
:row-key="(row) => row.materialId + '_' + row.orderId"
>
<el-table-column label="物料SAPNO" align="center" prop="materialId" width="200"/>
<el-table-column label="物料名称" align="center" prop="materialName" width="200"/>
<el-table-column label="关联入库单ID" align="center" prop="orderId" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="批次ID" align="center" prop="batchId" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="仓库ID" align="center" prop="warehouseId" width="200"/>
<el-table-column label="库位ID" align="center" prop="locationId" width="200"/>
<el-table-column label="所在仓库" align="center" prop="warehousesName" width="200"/>
<el-table-column label="库位ID" align="center" prop="locationName" width="200"/>
<el-table-column label="入库数量" align="center" prop="actualQuantity" width="200"/>
<el-table-column label="件数" align="center" prop="actualPackages" width="200"/>
<el-table-column label="单价" align="center" prop="unitPrice" width="200"/>
......@@ -198,6 +213,7 @@ import { batchAddInventory } from "@/api/inventory/inventory"
import InboundItems from "@/views/inventory/inbound_items/index.vue"
import PageTitle from "@/components/PageTitle" // 引入字典页面的标题组件
import PageWrapperSearch from "@/components/Search/PageWrapperSearch" // 引入搜索包装组件
import { listWarehouses } from "@/api/inventory/warehouses"
export default {
name: "Inbound",
......@@ -221,6 +237,12 @@ export default {
{ orderType: '1', orderTypeName: '订单类型1' },
{ orderType: '2', orderTypeName: '订单类型2' }
],
// 仓库列表
warehouseOptions: [],
// 库位列表
locationOptions: [],
loadingWarehouse: false,
// 可编辑状态
isEditable: true,
// 物料组件显示
materialSelectOpen: false,
......@@ -310,8 +332,33 @@ export default {
},
created() {
this.getList()
// 初始化仓库信息
this.getWarehouseOptions()
},
methods: {
//初始化仓库信息
getWarehouseOptions() {
this.loadingWarehouse = true
listWarehouses({ pageNum: 1, pageSize: 100 }).then(response => {
const rows = response.rows || []
this.warehouseOptions = rows.map(item => ({
label: `${item.warehousesName || item.name || '未命名仓库'} (${item.warehouseCode || item.code || item.warehousesCode || ''})`,
// 用仓库ID + 编码作为唯一key,避免空值重复
value: item.id || item.warehouseCode || item.code,
key: item.id || item.warehouseCode || Date.now() + Math.random()
})).filter(option => option.value)
this.loadingWarehouse = false
}).catch(error => {
console.error('获取仓库列表失败:', error)
this.warehouseOptions = []
this.loadingWarehouse = false
})
},
getWarehouseName(warehouseId) {
if (!warehouseId) return ''
const warehouse = this.warehouseOptions.find(item => item.value === warehouseId)
return warehouse ? warehouse.label : warehouseId
},
/** 查询入库列表 */
getList() {
this.loading = true
......@@ -389,7 +436,7 @@ export default {
getInbound(id).then(response => {
this.form = response.data
// 加载明细数据
this.inboundOrderId = id
this.inboundOrderId = id
this.$nextTick(() => {
})
this.open = true
......@@ -715,4 +762,4 @@ export default {
.dialog-footer {
text-align: center;
}
</style>
\ No newline at end of file
</style>
......@@ -151,7 +151,47 @@
<template slot-scope="scope">
<!-- 可编辑模式 -->
<template v-if="scope.row.editable && column.editable !== false">
<template v-if="column.type === 'select'">
<!-- 仓库选择 -->
<template v-if="column.prop === 'warehousesName'">
<el-input
v-model="scope.row.warehousesName"
size="small"
readonly
placeholder="请选择仓库"
@focus="$emit('open-warehouse-selector', scope.row)"
:suffix-icon="''"
>
<template v-if="scope.row.warehousesName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearWarehouse(scope.row)"
></i>
</template>
</el-input>
</template>
<!-- 库位选择 -->
<template v-else-if="column.prop === 'locationName'">
<el-input
v-model="scope.row.locationName"
size="small"
readonly
placeholder="请选择库位"
@focus="$emit('open-location-selector', scope.row)"
:suffix-icon="''"
:disabled="!scope.row.warehouseId"
>
<template v-if="scope.row.locationName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearLocation(scope.row)"
></i>
</template>
</el-input>
</template>
<!-- 其他选择框 -->
<template v-else-if="column.type === 'select'">
<el-select
v-model="scope.row[column.prop]"
size="small"
......@@ -166,6 +206,7 @@
/>
</el-select>
</template>
<!-- 数字输入框 -->
<template v-else-if="column.type === 'number'">
<el-input-number
v-model="scope.row[column.prop]"
......@@ -177,6 +218,7 @@
@change="handleNumberChange(scope.row, column.prop)"
/>
</template>
<!-- 普通输入框 -->
<template v-else>
<el-input
v-model="scope.row[column.prop]"
......@@ -201,8 +243,15 @@
<template v-else-if="column.type === 'number'">
{{ formatNumber(scope.row[column.prop]) }}
</template>
<!-- 仓库/库位兜底显示 -->
<template v-else-if="column.prop === 'warehousesName'">
{{ scope.row.warehousesName || scope.row.warehouseId || '-' }}
</template>
<template v-else-if="column.prop === 'locationName'">
{{ scope.row.locationName || scope.row.locationCode || scope.row.locationId || '-' }}
</template>
<template v-else>
{{ scope.row[column.prop] }}
{{ scope.row[column.prop] || '-' }}
</template>
</template>
</template>
......@@ -292,13 +341,20 @@ export default {
default: () => [
{ prop: 'materialId', label: '货物ID', width: '150', editable: false },
{ prop: 'materialName', label: '货物名称', width: '150', editable: false },
{ prop: 'warehouseId', label: '仓库ID', width: '150', editable: true,
type: 'select',
options: [{ label: '仓库A', value: 'WH001' }, { label: '仓库B', value: 'WH002' }, { label: '仓库C', value: 'WH003' }]
{
prop: 'warehousesName',
label: '仓库',
width: '150',
editable: true,
idProp: 'warehouseId'
},
{ prop: 'locationId', label: '库位ID', width: '150', editable: true,
type: 'select',
options: [{ label: '库位A1', value: 'LOC001' }, { label: '库位A2', value: 'LOC002' }, { label: '库位B1', value: 'LOC003' }]
{
prop: 'locationName',
label: '库位',
width: '150',
editable: true,
idProp: 'locationId',
codeProp: 'locationCode'
},
{ prop: 'plannedQuantity', label: '计划数量', width: '100', type: 'number', editable: true },
{ prop: 'actualQuantity', label: '实际数量', width: '100', type: 'number', editable: true },
......@@ -320,8 +376,6 @@ export default {
},
data() {
return {
showSearch: true,
loading: false,
selectedRows: [],
......@@ -392,7 +446,7 @@ export default {
immediate: true,
handler(newVal) {
// 核心:过滤 null/空值,只在有效时执行逻辑
if (!newVal) return
if (!newVal) return
this.loadRelatedData(newVal)
this.displayData.forEach(item => {
if (!item.inboundOrderId) item.inboundOrderId = newVal
......@@ -443,8 +497,9 @@ export default {
this.loading = true
this.queryParams.inboundOrderId = inboundOrderId
listInbound_itemsAndMname(this.queryParams).then(response => {
console.log(response.rows)
this.displayData = response.rows.map(item => ({
...item,
materialName: item.materialName,
editable: false,
......@@ -456,7 +511,7 @@ export default {
}).catch(() => {
this.loading = false
}).finally(() => {
})
},
......@@ -547,7 +602,9 @@ export default {
unitPrice: 0,
remark: null,
editable: true,
inboundOrderId: null,
tempId: Date.now() + Math.random()
}
this.displayData.push(newItem)
const totalPages = Math.ceil(this.displayData.length / this.queryParams.pageSize)
......@@ -654,6 +711,23 @@ export default {
this.$emit('cell-blur', { row, prop, value: row[prop] })
},
// 清除仓库选择
clearWarehouse(row) {
this.$set(row, 'warehouseId', null);
this.$set(row, 'warehousesName', null);
// 同时清除库位选择
this.clearLocation(row);
this.$emit('cell-change', { row, prop: 'warehouseId', value: null });
},
// 清除库位选择
clearLocation(row) {
this.$set(row, 'locationId', null);
this.$set(row, 'locationCode', null);
this.$set(row, 'locationName', null);
this.$emit('cell-change', { row, prop: 'locationId', value: null });
},
// 选择变化
handleSelectionChange(selection) {
this.selectedRows = selection
......@@ -745,4 +819,4 @@ export default {
:deep(.el-select .el-tag) {
margin: 0;
}
</style>
\ No newline at end of file
</style>
......@@ -312,7 +312,7 @@
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
......@@ -552,7 +552,7 @@ export default {
handleTreeClick(data) {
console.log('点击树节点:', data)
this.currentNodeId = data.sid
// 更新查询参数,按选中的分类筛选物料
this.queryParams.categoryCode = data.categoryCode
this.queryParams.categoryNameInput = null // 清空名称输入
......@@ -762,7 +762,7 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm(row.id ? '是否确认删除编号为"' + row.materialCode + '"的数据项?' : '是否确认删除选中数量为"' + ids.length + '"的数据项?' ).then(() => {
this.$modal.confirm(row.id ? '是否确认删除物料号为"' + row.sapNo + '"的数据项?' : '是否确认删除选中数量为"' + ids.length + '"的数据项?' ).then(() => {
return delMaterials(ids)
}).then(() => {
this.getList()
......
......@@ -115,7 +115,18 @@ public class MaterialsCategoryController extends BaseController
}
/**
* 删除物料分类
* 修改物料分类有效状态
*/
@PreAuthorize("@ss.hasPermi('inventory:materials_category:remove')")
@Log(title = "物料分类", businessType = BusinessType.DELETE)
@PutMapping("/{ids}")
public AjaxResult updateIsUsed(@PathVariable String[] ids)
{
return toAjax(materialsCategoryService.updateCategoryIsUsedByIds(ids));
}
/**
* 删除物料分类(暂无用)
*/
@PreAuthorize("@ss.hasPermi('inventory:materials_category:remove')")
@Log(title = "物料分类", businessType = BusinessType.DELETE)
......
......@@ -101,14 +101,15 @@ public class MaterialsController extends BaseController
}
/**
* 删除物料
* 删除物料 (修改物料有效性)
*/
@PreAuthorize("@ss.hasPermi('inventory:materials:remove')")
@Log(title = "物料", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
@PutMapping("/{ids}")
public AjaxResult updateIsUsed(@PathVariable String[] ids)
{
return toAjax(materialsService.deleteMaterialsByIds(ids));
return toAjax(materialsService.updateMaterialsIsUsed(ids));
}
/**
......@@ -155,4 +156,15 @@ public class MaterialsController extends BaseController
}
}
/**
* 删除物料 (暂时无用)
*/
@PreAuthorize("@ss.hasPermi('inventory:materials:remove')")
@Log(title = "物料", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(materialsService.deleteMaterialsByIds(ids));
}
}
......@@ -45,6 +45,8 @@ public class InboundOrders extends BaseEntity
@Excel(name = "货主ID")
private String ownerId;
private String ownerName;
/** 入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件 */
@Excel(name = "入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件")
private Long orderStatus;
......@@ -283,6 +285,14 @@ public class InboundOrders extends BaseEntity
this.inboundOrderItemsList = inboundOrderItemsList;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......@@ -308,6 +318,7 @@ public class InboundOrders extends BaseEntity
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.append("inboundOrderItemsList", getInboundOrderItemsList())
.append("ownerName", getOwnerName())
.toString();
}
}
......@@ -38,10 +38,14 @@ public class InboundItemsAndMaterialName extends BaseEntity
@Excel(name = "仓库ID")
private String warehouseId;
private String warehousesName;
/** 库位ID 检索条件 */
@Excel(name = "库位ID")
private String locationId;
private String locationName;
/** 计划数量 */
@Excel(name = "计划数量")
private Long plannedQuantity;
......@@ -330,6 +334,22 @@ public class InboundItemsAndMaterialName extends BaseEntity
this.inboundOrderId = inboundOrderId;
}
public String getWarehousesName() {
return warehousesName;
}
public void setWarehousesName(String warehousesName) {
this.warehousesName = warehousesName;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......@@ -359,6 +379,8 @@ public class InboundItemsAndMaterialName extends BaseEntity
.append("updateUserCode", getUpdateUserCode())
.append("materialName", getMaterialName())
.append("inboundOrderId", getInboundOrderId())
.append("warehousesName", getWarehousesName())
.append("locationName", getLocationName())
.toString();
}
}
......@@ -6,6 +6,7 @@ import java.util.Date;
public class InboundDetailsVO {
private static final long serialVersionUID = 1L;
@Excel(name = "物料sapNo")
private String materialId;
......@@ -18,12 +19,17 @@ public class InboundDetailsVO {
@Excel(name = "批次ID")
private String batchId;
@Excel(name = "仓库ID")
// @Excel(name = "仓库ID")
private String warehouseId;
@Excel(name = "库位ID")
@Excel(name = "仓库名")
private String warehousesName;
// @Excel(name = "库位ID")
private String locationId;
private String locationName;
@Excel(name = "入库数量")
private Long actualQuantity;
......@@ -149,15 +155,33 @@ public class InboundDetailsVO {
this.inboundDate = inboundDate;
}
public String getWarehousesName() {
return warehousesName;
}
public void setWarehousesName(String warehousesName) {
this.warehousesName = warehousesName;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
@Override
public String toString() {
return "InboundDetailsVO{" +
"sapNo='" + materialId + '\'' +
"materialId='" + materialId + '\'' +
", materialName='" + materialName + '\'' +
", orderId='" + orderId + '\'' +
", batchId='" + batchId + '\'' +
", warehouseId='" + warehouseId + '\'' +
", warehousesName='" + warehousesName + '\'' +
", locationId='" + locationId + '\'' +
", locationName='" + locationName + '\'' +
", actualQuantity=" + actualQuantity +
", actualPackages=" + actualPackages +
", labelColor='" + labelColor + '\'' +
......
......@@ -50,6 +50,14 @@ public interface MaterialsCategoryMapper
public int updateMaterialsCategory(MaterialsCategory materialsCategory);
/**
* 修改物料分类有效状态
*
* @param ids 物料分类主键
* @return 结果
*/
public int updateCategoryIsUsedByIds(String[] ids);
/**
* 删除物料分类
*
* @param id 物料分类主键
......
......@@ -57,28 +57,14 @@ public interface MaterialsMapper
public int updateMaterials(Materials materials);
/**
* 删除物料
*
* @param id 物料主键
* @return 结果
*/
public int deleteMaterialsById(String id);
/**
* 批量删除物料
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaterialsByIds(String[] ids);
/**
* 批量删除,修改物料的使用状态
* 批量修改物料的使用状态
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int updateMaterialsIsUsedByIds(String[] ids);
/**
* 批量删除,修改物料的使用状态
*
......@@ -96,4 +82,19 @@ public interface MaterialsMapper
@MapKey("sap_no")
public List<Map<String, Object>> getMapList();
/**
* 删除物料(暂无用)
*
* @param id 物料主键
* @return 结果
*/
public int deleteMaterialsById(String id);
/**
* 批量删除物料(暂无用)
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaterialsByIds(String[] ids);
}
......@@ -70,7 +70,15 @@ public interface IMaterialsCategoryService
public int updateMaterialsCategory(MaterialsCategory materialsCategory);
/**
* 批量删除物料分类
* 修改物料分类有效状态
*
* @param ids 物料分类主键
* @return 结果
*/
public int updateCategoryIsUsedByIds(String[] ids);
/**
* 批量删除物料分类(暂无用)
*
* @param ids 需要删除的物料分类主键集合
* @return 结果
......@@ -78,7 +86,7 @@ public interface IMaterialsCategoryService
public int deleteMaterialsCategoryByIds(String[] ids);
/**
* 删除物料分类信息
* 删除物料分类信息(暂无用)
*
* @param id 物料分类主键
* @return 结果
......
......@@ -46,7 +46,7 @@ public interface IMaterialsService
public int updateMaterials(Materials materials);
/**
* 批量删除物料
* 批量删除物料 (暂时无用)
*
* @param ids 需要删除的物料主键集合
* @return 结果
......@@ -54,6 +54,14 @@ public interface IMaterialsService
public int deleteMaterialsByIds(String[] ids);
/**
* 修改物料有效状态
*
* @param ids 需要删除的物料主键集合
* @return 结果
*/
public int updateMaterialsIsUsed(String[] ids);
/**
* 删除物料信息
*
* @param id 物料主键
......
......@@ -133,6 +133,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
inboundOrderItems.setId(UUID.randomUUID().toString());
inboundOrderItems.setOrderId(orderId);
inboundOrderItems.setCreateTime(DateUtils.getNowDate());
inboundOrderItems.setInboundOrderId(inboundOrders.getId());
list.add(inboundOrderItems);
}
if (list.size() > 0)
......
......@@ -168,7 +168,18 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
}
/**
* 批量删除物料分类
* 修改物料分类有效状态
*
* @param ids 物料分类
* @return 结果
*/
@Override
public int updateCategoryIsUsedByIds(String[] ids) {
return materialsCategoryMapper.updateCategoryIsUsedByIds(ids);
}
/**
* 批量删除物料分类(暂无用)
*
* @param ids 需要删除的物料分类主键
* @return 结果
......@@ -180,7 +191,7 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
}
/**
* 删除物料分类信息
* 删除物料分类信息(暂无用)
*
* @param id 物料分类主键
* @return 结果
......
......@@ -77,35 +77,23 @@ public class MaterialsServiceImpl implements IMaterialsService
}
/**
* 批量修改物料的使用状态
* 修改物料的使用状态
*
* @param ids 需要删除的物料主键
* @return 结果
*/
@Override
public int deleteMaterialsByIds(String[] ids)
{
public int updateMaterialsIsUsed(String[] ids) {
return materialsMapper.updateMaterialsIsUsedByIds(ids);
}
/**
* 删除物料信息
* 导入物料
*
* @param id 物料主键
* @param materialsList 物料列表
* @return 结果
*/
@Override
public int deleteMaterialsById(String id)
{
return materialsMapper.deleteMaterialsById(id);
}
@Override
public List<Materials> selectMaterialsByCategory(String id) {
return materialsMapper.selectMaterialsByCategory(id);
}
@Override
public String importMaterials(List<Materials> materialsList, Boolean isUpdateSupport, String operName)
{
if (StringUtils.isNull(materialsList) || materialsList.size() == 0)
......@@ -176,4 +164,33 @@ public class MaterialsServiceImpl implements IMaterialsService
public List<Map<String, Object>> getMapList(){
return materialsMapper.getMapList();
}
/**
* 删除物料信息(暂时无用)
*
* @param id 物料主键
* @return 结果
*/
@Override
public int deleteMaterialsById(String id)
{
return materialsMapper.deleteMaterialsById(id);
}
@Override
public List<Materials> selectMaterialsByCategory(String id) {
return materialsMapper.selectMaterialsByCategory(id);
}
/**
* 批量删除(暂时无用)
*
* @param ids 需要删除的物料主键
* @return 结果
*/
@Override
public int deleteMaterialsByIds(String[] ids)
{
return materialsMapper.deleteMaterialsByIds(ids);
}
}
......@@ -81,7 +81,9 @@
ii.material_id,
ii.batch_id,
ii.warehouse_id,
w.warehouses_name,
ii.location_id,
sl.location_name,
ii.planned_quantity,
ii.actual_quantity,
ii.planned_packages,
......@@ -104,6 +106,8 @@
m.material_name
FROM inbound_order_items ii
LEFT JOIN materials m ON ii.material_id = m.sap_no
left join warehouses w on ii.warehouse_id = w.id
left join storage_locations sl on ii.location_id = sl.id
<where>
<!-- 移除条件前的and,<where>标签会自动处理首个条件的and/or -->
<if test="inboundOrderId != null and inboundOrderId != ''">
......@@ -279,7 +283,9 @@
<result property="materialId" column="material_id" />
<result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehousesName" column="warehouses_name" />
<result property="locationId" column="location_id" />
<result property="locationName" column="location_name" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" />
......@@ -309,8 +315,9 @@
<result column="order_id" property="orderId" jdbcType="VARCHAR" />
<result column="batch_id" property="batchId" jdbcType="VARCHAR" />
<result column="warehouse_id" property="warehouseId" jdbcType="VARCHAR" />
<result column="location_id" property="locationId" jdbcType="VARCHAR" />
<result column="warehouses_name" property="warehousesName" jdbcType="VARCHAR" />
<result column="location_id" property="locationId" jdbcType="VARCHAR"/>
<result column="location_name" property="locationName" jdbcType="VARCHAR" />
<!-- 数值型字段 -->
<result column="actual_quantity" property="actualQuantity" jdbcType="BIGINT" />
<result column="actual_packages" property="actualPackages" jdbcType="BIGINT" />
......@@ -336,7 +343,9 @@
ioi.order_id,
ioi.batch_id,
ioi.warehouse_id,
w.warehouses_name,
ioi.location_id,
sl.location_name,
SUM(ioi.actual_quantity) AS actual_quantity,
SUM(ioi.actual_packages) AS actual_packages,
ioi.label_color,
......@@ -347,6 +356,8 @@
FROM inbound_orders io
INNER JOIN inbound_order_items ioi ON io.id = ioi.inbound_order_id
INNER JOIN materials ms ON ms.sap_no = ioi.material_id
inner join warehouses w on ioi.warehouse_id = w.id
inner join storage_locations sl on ioi.location_id = sl.id
WHERE io.order_status = 2
GROUP BY
ioi.material_id,
......
......@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="ownerId" column="owner_id" />
<result property="ownerName" column="owner_name" />
<result property="orderStatus" column="order_status" />
<result property="inboundDate" column="inbound_date" />
<result property="orderType" column="order_type" />
......@@ -32,13 +33,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<collection property="inboundOrderItemsList" ofType="InboundOrderItems" column="id" select="selectInboundOrderItemsList" />
</resultMap>
<resultMap type="InboundOrderItems" id="InboundOrderItemsResult">
<resultMap type="com.ruoyi.inventory.domain.TO.InboundItemsAndMaterialName" id="InboundOrderItemsResult">
<result property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="materialId" column="material_id" />
<result property="materialName" column="material_name" />
<result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehousesName" column="warehouses_name" />
<result property="locationId" column="location_id" />
<result property="locationName" column="location_name" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" />
......@@ -60,12 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectInboundOrdersVo">
select id, order_id, system_no, order_type_id, batch_id, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from inbound_orders
select io.id, io.order_id, io.system_no, io.order_type_id, io.batch_id, io.warehouse_id, io.owner_id, o.owner_name,
io.order_status, io.inbound_date, io.order_type, io.total_planned_quantity, io.total_actual_quantity, io.total_packages,
io.remark, io.op_user_name, io.is_used, io.sort_no, io.create_time, io.create_user_code, io.update_time, io.update_user_code
from inbound_orders io left join owners o on io.owner_id = o.id
</sql>
<select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult">
<include refid="selectInboundOrdersVo"/>
<where>
<where>
<if test="id != null and Id != ''"> and id = #{Id}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</if>
......@@ -88,17 +95,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectInboundOrdersById" parameterType="String" resultMap="InboundOrdersInboundOrderItemsResult">
select id, order_id, system_no, order_type_id, batch_id, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from inbound_orders
where id = #{id}
select io.id, io.order_id, io.system_no, io.order_type_id, io.batch_id, io.warehouse_id, io.owner_id, o.owner_name,
io.order_status, io.inbound_date, io.order_type, io.total_planned_quantity, io.total_actual_quantity, io.total_packages,
io.remark, io.op_user_name, io.is_used, io.sort_no, io.create_time, io.create_user_code, io.update_time, io.update_user_code
from inbound_orders as io
left join owners as o on io.owner_id = o.id
where io.id = #{id}
</select>
<select id="selectInboundOrderItemsList" resultMap="InboundOrderItemsResult">
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
where inbound_order_id = #{inboundOrderId}
select ioi.id, ioi.order_id, ioi.material_id, m.material_name, ioi.batch_id, ioi.warehouse_id, w.warehouses_name,
ioi.location_id, sl.location_name, ioi.planned_quantity, ioi.actual_quantity, ioi.planned_packages,
ioi.actual_packages, ioi.divisor, ioi.label_color, ioi.voucher_number, ioi.unit_price, ioi.item_status,
ioi.received_at, ioi.received_by, ioi.remark, ioi.is_used, ioi.sort_no, ioi.create_time, ioi.create_user_code,
ioi.update_time, ioi.update_user_code, ioi.inbound_order_id
from inbound_order_items as ioi
left join warehouses as w on ioi.warehouse_id = w.id
left join storage_locations as sl on ioi.location_id = sl.id
left join materials as m on ioi.material_id = m.sap_no
where ioi.inbound_order_id = #{id}
</select>
<select id="selectInboundOrdersByOrderId" resultType="InboundOrders">
select id, order_id
from inbound_orders
......
......@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMaterialsCategoryList" parameterType="MaterialsCategory" resultMap="MaterialsCategoryResult">
<include refid="selectMaterialsCategoryVo"/>
<where>
is_used != 0
<if test="id != null and id != ''"> and id = #{id}</if>
<if test="categoryCode != null and categoryCode != ''"> and category_code like concat('%', #{categoryCode}, '%')</if>
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
......@@ -31,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null "> and create_time like concat('%', #{createTime}, '%')</if>
<if test="updateTime != null "> and update_time like concat('%', #{updateTime}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<!-- <if test="isUsed != null "> and is_used = #{isUsed}</if>-->
</where>
order by sort_no asc
</select>
......@@ -38,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMaterialsCategoryById" parameterType="String" resultMap="MaterialsCategoryResult">
<include refid="selectMaterialsCategoryVo"/>
where id = #{id}
and is_used != 0
order by sort_no asc
</select>
<insert id="insertMaterialsCategory" parameterType="MaterialsCategory">
......@@ -84,6 +87,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update id="updateCategoryIsUsedByIds" parameterType="String">
update materials_category
set is_used = 0 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<delete id="deleteMaterialsCategoryById" parameterType="String">
delete from materials_category where id = #{id}
</delete>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论