容器管理功能调整

This commit is contained in:
lsymicc
2025-06-17 17:26:29 +08:00
parent ffa580c9a6
commit a5a9555202
10 changed files with 325 additions and 241 deletions

View File

@@ -0,0 +1,115 @@
package com.ruoyi.bas.container.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bas.container.domain.BasContainer;
import com.ruoyi.bas.container.service.IBasContainerService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 容器管理Controller
*
* @author ruoyi
* @date 2025-06-17
*/
@RestController
@RequestMapping("/bas/container")
public class BasContainerController extends BaseController
{
@Autowired
private IBasContainerService basContainerService;
/**
* 查询容器管理列表
*/
@PreAuthorize("@ss.hasPermi('bas:container:list')")
@GetMapping("/list")
public TableDataInfo list(BasContainer basContainer)
{
startPage();
List<BasContainer> list = basContainerService.selectBasContainerList(basContainer);
return getDataTable(list);
}
/**
* 导出容器管理列表
*/
@PreAuthorize("@ss.hasPermi('bas:container:export')")
@Log(title = "容器管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BasContainer basContainer)
{
List<BasContainer> list = basContainerService.selectBasContainerList(basContainer);
ExcelUtil<BasContainer> util = new ExcelUtil<BasContainer>(BasContainer.class);
util.exportExcel(response, list, "容器管理数据");
}
/**
* 获取容器管理详细信息
*/
@PreAuthorize("@ss.hasPermi('bas:container:query')")
@GetMapping(value = "/{containerId}")
public AjaxResult getInfo(@PathVariable("containerId") String containerId)
{
return success(basContainerService.selectBasContainerByContainerId(containerId));
}
/**
* 新增容器管理
*/
@PreAuthorize("@ss.hasPermi('bas:container:add')")
@Log(title = "容器管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BasContainer basContainer)
{
return toAjax(basContainerService.insertBasContainer(basContainer));
}
/**
* 修改容器管理
*/
@PreAuthorize("@ss.hasPermi('bas:container:edit')")
@Log(title = "容器管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BasContainer basContainer)
{
return toAjax(basContainerService.updateBasContainer(basContainer));
}
/**
* 删除容器管理
*/
@PreAuthorize("@ss.hasPermi('bas:container:remove')")
@Log(title = "容器管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{containerIds}")
public AjaxResult remove(@PathVariable String[] containerIds)
{
return toAjax(basContainerService.deleteBasContainerByContainerIds(containerIds));
}
/**
*
* @return
*/
@GetMapping("/portNames")
public AjaxResult getPortNames() {
List<String> portNames = basContainerService.getPortNames();
return AjaxResult.success(portNames);
}
}

View File

@@ -1,5 +1,8 @@
package com.ruoyi.bas.container.domain; package com.ruoyi.bas.container.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
@@ -11,6 +14,9 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi * @author ruoyi
* @date 2025-06-17 * @date 2025-06-17
*/ */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BasContainer extends BaseEntity public class BasContainer extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -28,11 +34,11 @@ public class BasContainer extends BaseEntity
private Long status; private Long status;
/** 物料种类数量 */ /** 物料种类数量 */
@Excel(name = "物料种类数量") @Excel(name = "物料种类")
private Long productTypeQuantity; private String productTypeQuantity;
/** 容量(可存放料箱数量) */ /** 容量(可存放料箱数量) */
@Excel(name = "容量", readConverterExp = "可=存放料箱数量") @Excel(name = "容量", readConverterExp = "可存放料箱数量")
private Long capacity; private Long capacity;
/** 操作人 */ /** 操作人 */
@@ -48,110 +54,4 @@ public class BasContainer extends BaseEntity
/** 备用 */ /** 备用 */
private String spare3; private String spare3;
public void setContainerId(String containerId)
{
this.containerId = containerId;
}
public String getContainerId()
{
return containerId;
}
public void setPortName(String portName)
{
this.portName = portName;
}
public String getPortName()
{
return portName;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public void setProductTypeQuantity(Long productTypeQuantity)
{
this.productTypeQuantity = productTypeQuantity;
}
public Long getProductTypeQuantity()
{
return productTypeQuantity;
}
public void setCapacity(Long capacity)
{
this.capacity = capacity;
}
public Long getCapacity()
{
return capacity;
}
public void setOperationMan(String operationMan)
{
this.operationMan = operationMan;
}
public String getOperationMan()
{
return operationMan;
}
public void setSpare1(String spare1)
{
this.spare1 = spare1;
}
public String getSpare1()
{
return spare1;
}
public void setSpare2(String spare2)
{
this.spare2 = spare2;
}
public String getSpare2()
{
return spare2;
}
public void setSpare3(String spare3)
{
this.spare3 = spare3;
}
public String getSpare3()
{
return spare3;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("containerId", getContainerId())
.append("portName", getPortName())
.append("status", getStatus())
.append("productTypeQuantity", getProductTypeQuantity())
.append("capacity", getCapacity())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("operationMan", getOperationMan())
.append("spare1", getSpare1())
.append("spare2", getSpare2())
.append("spare3", getSpare3())
.toString();
}
} }

View File

@@ -58,4 +58,13 @@ public interface BasContainerMapper
* @return 结果 * @return 结果
*/ */
public int deleteBasContainerByContainerIds(String[] containerIds); public int deleteBasContainerByContainerIds(String[] containerIds);
/**
* 获取点位管理的点位值集合
*
* @return 结果
*/
List<String> selectPortNames();
} }

View File

@@ -58,4 +58,10 @@ public interface IBasContainerService
* @return 结果 * @return 结果
*/ */
public int deleteBasContainerByContainerId(String containerId); public int deleteBasContainerByContainerId(String containerId);
/**
* 获取点位名称集合
* @return
*/
public List<String> getPortNames();
} }

View File

@@ -93,4 +93,13 @@ public class BasContainerServiceImpl implements IBasContainerService
{ {
return basContainerMapper.deleteBasContainerByContainerId(containerId); return basContainerMapper.deleteBasContainerByContainerId(containerId);
} }
/**
* 获取点位名称集合
* @return
*/
public List<String> getPortNames() {
return basContainerMapper.selectPortNames();
}
} }

View File

@@ -0,0 +1,104 @@
package com.ruoyi.bas.containerDetails.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bas.containerDetails.domain.BasContainerDetails;
import com.ruoyi.bas.containerDetails.service.IBasContainerDetailsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 容器物料明细Controller
*
* @author ruoyi
* @date 2025-06-17
*/
@RestController
@RequestMapping("/bas/containerDetails")
public class BasContainerDetailsController extends BaseController
{
@Autowired
private IBasContainerDetailsService basContainerDetailsService;
/**
* 查询容器物料明细列表
*/
@PreAuthorize("@ss.hasPermi('bas:containerDetails:list')")
@GetMapping("/list")
public TableDataInfo list(BasContainerDetails basContainerDetails)
{
startPage();
List<BasContainerDetails> list = basContainerDetailsService.selectBasContainerDetailsList(basContainerDetails);
return getDataTable(list);
}
/**
* 导出容器物料明细列表
*/
@PreAuthorize("@ss.hasPermi('bas:containerDetails:export')")
@Log(title = "容器物料明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BasContainerDetails basContainerDetails)
{
List<BasContainerDetails> list = basContainerDetailsService.selectBasContainerDetailsList(basContainerDetails);
ExcelUtil<BasContainerDetails> util = new ExcelUtil<BasContainerDetails>(BasContainerDetails.class);
util.exportExcel(response, list, "容器物料明细数据");
}
/**
* 获取容器物料明细详细信息
*/
@PreAuthorize("@ss.hasPermi('bas:containerDetails:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(basContainerDetailsService.selectBasContainerDetailsById(id));
}
/**
* 新增容器物料明细
*/
@PreAuthorize("@ss.hasPermi('bas:containerDetails:add')")
@Log(title = "容器物料明细", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BasContainerDetails basContainerDetails)
{
return toAjax(basContainerDetailsService.insertBasContainerDetails(basContainerDetails));
}
/**
* 修改容器物料明细
*/
@PreAuthorize("@ss.hasPermi('bas:containerDetails:edit')")
@Log(title = "容器物料明细", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BasContainerDetails basContainerDetails)
{
return toAjax(basContainerDetailsService.updateBasContainerDetails(basContainerDetails));
}
/**
* 删除容器物料明细
*/
@PreAuthorize("@ss.hasPermi('bas:containerDetails:remove')")
@Log(title = "容器物料明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(basContainerDetailsService.deleteBasContainerDetailsByIds(ids));
}
}

View File

@@ -1,5 +1,8 @@
package com.ruoyi.bas.containerDetails.domain; package com.ruoyi.bas.containerDetails.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
@@ -11,6 +14,9 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi * @author ruoyi
* @date 2025-06-17 * @date 2025-06-17
*/ */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BasContainerDetails extends BaseEntity public class BasContainerDetails extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -50,108 +56,5 @@ public class BasContainerDetails extends BaseEntity
@Excel(name = "备用") @Excel(name = "备用")
private String spare3; private String spare3;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setContainerId(String containerId)
{
this.containerId = containerId;
}
public String getContainerId()
{
return containerId;
}
public void setProductId(String productId)
{
this.productId = productId;
}
public String getProductId()
{
return productId;
}
public void setProductName(String productName)
{
this.productName = productName;
}
public String getProductName()
{
return productName;
}
public void setQuantity(Long quantity)
{
this.quantity = quantity;
}
public Long getQuantity()
{
return quantity;
}
public void setUnit(String unit)
{
this.unit = unit;
}
public String getUnit()
{
return unit;
}
public void setSpare1(String spare1)
{
this.spare1 = spare1;
}
public String getSpare1()
{
return spare1;
}
public void setSpare2(String spare2)
{
this.spare2 = spare2;
}
public String getSpare2()
{
return spare2;
}
public void setSpare3(String spare3)
{
this.spare3 = spare3;
}
public String getSpare3()
{
return spare3;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("containerId", getContainerId())
.append("productId", getProductId())
.append("productName", getProductName())
.append("quantity", getQuantity())
.append("unit", getUnit())
.append("spare1", getSpare1())
.append("spare2", getSpare2())
.append("spare3", getSpare3())
.toString();
}
} }

View File

@@ -48,7 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productTypeQuantity != null">product_type_quantity,</if> <if test="productTypeQuantity != null">product_type_quantity,</if>
<if test="capacity != null">capacity,</if> <if test="capacity != null">capacity,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if> <!-- <if test="updateTime != null">update_time,</if>-->
update_time,
<if test="operationMan != null">operation_man,</if> <if test="operationMan != null">operation_man,</if>
<if test="spare1 != null">spare1,</if> <if test="spare1 != null">spare1,</if>
<if test="spare2 != null">spare2,</if> <if test="spare2 != null">spare2,</if>
@@ -61,7 +62,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productTypeQuantity != null">#{productTypeQuantity},</if> <if test="productTypeQuantity != null">#{productTypeQuantity},</if>
<if test="capacity != null">#{capacity},</if> <if test="capacity != null">#{capacity},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if> <!-- <if test="updateTime != null">#{updateTime},</if>-->
GETDATE(),
<if test="operationMan != null">#{operationMan},</if> <if test="operationMan != null">#{operationMan},</if>
<if test="spare1 != null">#{spare1},</if> <if test="spare1 != null">#{spare1},</if>
<if test="spare2 != null">#{spare2},</if> <if test="spare2 != null">#{spare2},</if>
@@ -77,7 +79,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productTypeQuantity != null">product_type_quantity = #{productTypeQuantity},</if> <if test="productTypeQuantity != null">product_type_quantity = #{productTypeQuantity},</if>
<if test="capacity != null">capacity = #{capacity},</if> <if test="capacity != null">capacity = #{capacity},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <!-- <if test="updateTime != null">update_time = #{updateTime},</if>-->
GETDATE(),
<if test="operationMan != null">operation_man = #{operationMan},</if> <if test="operationMan != null">operation_man = #{operationMan},</if>
<if test="spare1 != null">spare1 = #{spare1},</if> <if test="spare1 != null">spare1 = #{spare1},</if>
<if test="spare2 != null">spare2 = #{spare2},</if> <if test="spare2 != null">spare2 = #{spare2},</if>
@@ -96,4 +99,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{containerId} #{containerId}
</foreach> </foreach>
</delete> </delete>
<select id="selectPortNames" resultType="string">
SELECT DISTINCT port_name FROM bas_product_port WHERE port_name != null or port_name != ''
</select>
</mapper> </mapper>

View File

@@ -46,7 +46,7 @@ export function delContainer(containerId) {
// 获取点位名称 // 获取点位名称
export function getPortNames() { export function getPortNames() {
return request({ return request({
url: '/product/port/list', url: '/bas/container/portNames',
method: 'get' method: 'get'
}); });
} }

View File

@@ -12,10 +12,10 @@
<el-form-item label="点位名称" prop="portName"> <el-form-item label="点位名称" prop="portName">
<el-select v-model="queryParams.portName" placeholder="请选择点位名称" clearable> <el-select v-model="queryParams.portName" placeholder="请选择点位名称" clearable>
<el-option <el-option
v-for="dict in portNameOptions" v-for="(item, index) in portNameOptions"
:key="dict.dictValue" :key="index"
:label="dict.dictLabel" :label="item"
:value="dict.dictValue" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -50,7 +50,7 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['bas:container:add']" v-hasPermi="['bas:container:add']"
>新增</el-button> >新增/绑定</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@@ -72,9 +72,9 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['bas:container:remove']" v-hasPermi="['bas:container:remove']"
>删除</el-button> >删除/解绑</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
@@ -83,7 +83,7 @@
@click="handleExport" @click="handleExport"
v-hasPermi="['bas:container:export']" v-hasPermi="['bas:container:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@@ -132,19 +132,28 @@
<el-input v-model="form.containerId" placeholder="请输入容器编号" /> <el-input v-model="form.containerId" placeholder="请输入容器编号" />
</el-form-item> </el-form-item>
<el-form-item label="点位名称" prop="portName"> <el-form-item label="点位名称" prop="portName">
<el-select v-model="queryParams.portName" placeholder="请选择点位名称" clearable> <el-select v-model="form.portName" placeholder="请选择点位名称" clearable>
<el-option <el-option
disabled v-for="(item, index) in portNameOptions"
v-for="item in portNameOptions" :key="index"
:key="item.dictValue" :label="item"
:label="item.dictLabel" :value="item"
:value="item.dictValue" ></el-option>
></el-option> </el-select>
</el-select>
</el-form-item>
<el-form-item label="物料种类" prop="productTypeQuantity">
<el-input v-model="form.productTypeQuantity" placeholder="请输入物料种类" />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="portName">
<el-select v-model="form.status" placeholder="请选择货架状态" clearable>
<el-option
v-for="status in dict.type.stock_status.slice(0, 2)"
:key="status.value"
:label="status.label"
:value="status.value">
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="物料种类" prop="productTypeQuantity">
<el-input v-model="form.productTypeQuantity" placeholder="请输入物料种类" />
</el-form-item> -->
<el-form-item label="操作人" prop="operationMan"> <el-form-item label="操作人" prop="operationMan">
<el-input v-model="form.operationMan" placeholder="请输入操作人" /> <el-input v-model="form.operationMan" placeholder="请输入操作人" />
</el-form-item> </el-form-item>
@@ -158,10 +167,12 @@
</template> </template>
<script> <script>
import { listContainer, getContainer, delContainer, addContainer, updateContainer } from "@/api/bas/container" import { listContainer, getContainer, delContainer, addContainer, updateContainer, getPortNames } from "@/api/bas/container"
import { get } from "sortablejs"
export default { export default {
name: "Container", name: "Container",
dicts: ['stock_status'],
data() { data() {
return { return {
// 遮罩层 // 遮罩层
@@ -194,6 +205,7 @@ export default {
operationMan: null, operationMan: null,
}, },
portNameOptions: [], portNameOptions: [],
statusOptions: ['空', '有货'],
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
@@ -203,6 +215,7 @@ export default {
}, },
created() { created() {
this.getList() this.getList()
// this.getPortNames()
}, },
methods: { methods: {
/** 查询容器管理列表 */ /** 查询容器管理列表 */
@@ -210,13 +223,27 @@ export default {
this.loading = true this.loading = true
listContainer(this.queryParams).then(response => { listContainer(this.queryParams).then(response => {
this.containerList = response.rows this.containerList = response.rows
this.portNameOptions = response.portNameOptions
this.total = response.total this.total = response.total
this.loading = false this.loading = false
}) })
console.log(response)
console.log(this.portNameOptions) //@@@
getPortNames().then(res => {
if (res.code === 200) {
// this.portNameOptions = res.data || [];
this.portNameOptions = Array.isArray(res.data) ? [...res.data] : [];
// console.log(this.portNameOptions);
} else {
this.$message.error('获取点位名称失败');
}
})
.catch(error => {
this.$message.error('请求异常,请检查网络');
console.error(error);
});
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false this.open = false
@@ -275,15 +302,19 @@ export default {
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.containerId != null) { if (this.title === "修改容器管理") {
updateContainer(this.form).then(response => { updateContainer(this.form).then(response => {
this.$modal.msgSuccess("修改成功") this.$modal.msgSuccess("修改成功")
this.open = false this.open = false
this.getList() this.getList()
}) })
} else { } else {
//@@@
this.form.productTypeQuantity = 'Type-01';
this.form.capacity = 10;
addContainer(this.form).then(response => { addContainer(this.form).then(response => {
this.$modal.msgSuccess("新增成功") this.$modal.msgSuccess("新增成功")
// console.log(this.form.containerId + this.form.portName +this.form.operationMan);
this.open = false this.open = false
this.getList() this.getList()
}) })