You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
197 lines
6.3 KiB
Java
197 lines
6.3 KiB
Java
package com.ruoyi.asset.controller;
|
|
|
|
import java.util.List;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.ModelMap;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
import com.ruoyi.asset.domain.AmsInboundOrder;
|
|
import com.ruoyi.asset.domain.AmsAsset;
|
|
import com.ruoyi.asset.domain.AmsAssetLocation;
|
|
import com.ruoyi.asset.domain.AmsWarehouse;
|
|
import com.ruoyi.asset.constant.AssetStatus;
|
|
import com.ruoyi.asset.service.IAmsAssetLocationService;
|
|
import com.ruoyi.asset.service.IAmsAssetService;
|
|
import com.ruoyi.asset.service.IAmsInboundOrderService;
|
|
import com.ruoyi.asset.service.IAmsWarehouseService;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
/**
|
|
* 入库管理Controller
|
|
*
|
|
* @author Yangk
|
|
* @date 2026-06-10
|
|
*/
|
|
@Controller
|
|
@RequestMapping("/asset/inbound")
|
|
public class AmsInboundOrderController extends BaseController
|
|
{
|
|
private static final String ENABLED_YES = "Y";
|
|
|
|
private String prefix = "asset/inbound";
|
|
|
|
@Autowired
|
|
private IAmsInboundOrderService amsInboundOrderService;
|
|
|
|
@Autowired
|
|
private IAmsWarehouseService amsWarehouseService;
|
|
|
|
@Autowired
|
|
private IAmsAssetLocationService amsAssetLocationService;
|
|
|
|
@Autowired
|
|
private IAmsAssetService amsAssetService;
|
|
|
|
@RequiresPermissions("asset:inbound:view")
|
|
@GetMapping()
|
|
public String inbound(ModelMap mmap)
|
|
{
|
|
mmap.put("warehouseList", selectEnabledWarehouseList());
|
|
return prefix + "/inbound";
|
|
}
|
|
|
|
/**
|
|
* 查询入库管理列表
|
|
*/
|
|
@RequiresPermissions("asset:inbound:list")
|
|
@PostMapping("/list")
|
|
@ResponseBody
|
|
public TableDataInfo list(AmsInboundOrder amsInboundOrder)
|
|
{
|
|
startPage();
|
|
List<AmsInboundOrder> list = amsInboundOrderService.selectAmsInboundOrderList(amsInboundOrder);
|
|
return getDataTable(list);
|
|
}
|
|
|
|
/**
|
|
* 导出入库管理列表
|
|
*/
|
|
@RequiresPermissions("asset:inbound:export")
|
|
@Log(title = "入库管理", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
@ResponseBody
|
|
public AjaxResult export(AmsInboundOrder amsInboundOrder)
|
|
{
|
|
List<AmsInboundOrder> list = amsInboundOrderService.selectAmsInboundOrderList(amsInboundOrder);
|
|
ExcelUtil<AmsInboundOrder> util = new ExcelUtil<AmsInboundOrder>(AmsInboundOrder.class);
|
|
return util.exportExcel(list, "入库管理数据");
|
|
}
|
|
|
|
/**
|
|
* 查看入库管理详情
|
|
*/
|
|
@RequiresPermissions("asset:inbound:view")
|
|
@GetMapping("/view/{orderId}")
|
|
public String view(@PathVariable("orderId") Long orderId, ModelMap mmap)
|
|
{
|
|
AmsInboundOrder amsInboundOrder = amsInboundOrderService.selectAmsInboundOrderByOrderId(orderId);
|
|
mmap.put("amsInboundOrder", amsInboundOrder);
|
|
return prefix + "/view";
|
|
}
|
|
|
|
/**
|
|
* 新增入库管理
|
|
*/
|
|
@RequiresPermissions("asset:inbound:add")
|
|
@GetMapping("/add")
|
|
public String add(ModelMap mmap)
|
|
{
|
|
putInboundOptions(mmap);
|
|
return prefix + "/add";
|
|
}
|
|
|
|
/**
|
|
* 新增保存入库管理
|
|
*/
|
|
@RequiresPermissions("asset:inbound:add")
|
|
@Log(title = "入库管理", businessType = BusinessType.INSERT)
|
|
@PostMapping("/add")
|
|
@ResponseBody
|
|
public AjaxResult addSave(AmsInboundOrder amsInboundOrder)
|
|
{
|
|
amsInboundOrder.setCreateBy(getLoginName());
|
|
return toAjax(amsInboundOrderService.insertAmsInboundOrder(amsInboundOrder));
|
|
}
|
|
|
|
/**
|
|
* 修改入库管理
|
|
*/
|
|
@RequiresPermissions("asset:inbound:edit")
|
|
@GetMapping("/edit/{orderId}")
|
|
public String edit(@PathVariable("orderId") Long orderId, ModelMap mmap)
|
|
{
|
|
AmsInboundOrder amsInboundOrder = amsInboundOrderService.selectAmsInboundOrderByOrderId(orderId);
|
|
mmap.put("amsInboundOrder", amsInboundOrder);
|
|
putInboundOptions(mmap);
|
|
return prefix + "/edit";
|
|
}
|
|
|
|
/**
|
|
* 修改保存入库管理
|
|
*/
|
|
@RequiresPermissions("asset:inbound:edit")
|
|
@Log(title = "入库管理", businessType = BusinessType.UPDATE)
|
|
@PostMapping("/edit")
|
|
@ResponseBody
|
|
public AjaxResult editSave(AmsInboundOrder amsInboundOrder)
|
|
{
|
|
amsInboundOrder.setUpdateBy(getLoginName());
|
|
return toAjax(amsInboundOrderService.updateAmsInboundOrder(amsInboundOrder));
|
|
}
|
|
|
|
/**
|
|
* 确认入库
|
|
*/
|
|
@RequiresPermissions("asset:inbound:confirm")
|
|
@Log(title = "入库管理", businessType = BusinessType.UPDATE)
|
|
@PostMapping("/confirm/{orderId}")
|
|
@ResponseBody
|
|
public AjaxResult confirm(@PathVariable("orderId") Long orderId)
|
|
{
|
|
return toAjax(amsInboundOrderService.confirmInbound(orderId, getUserId(),
|
|
getSysUser().getUserName(), getLoginName()));
|
|
}
|
|
|
|
/**
|
|
* 删除入库管理
|
|
*/
|
|
@RequiresPermissions("asset:inbound:remove")
|
|
@Log(title = "入库管理", businessType = BusinessType.DELETE)
|
|
@PostMapping( "/remove")
|
|
@ResponseBody
|
|
public AjaxResult remove(String ids)
|
|
{
|
|
return toAjax(amsInboundOrderService.deleteAmsInboundOrderByOrderIds(ids));
|
|
}
|
|
|
|
private void putInboundOptions(ModelMap mmap)
|
|
{
|
|
mmap.put("warehouseList", selectEnabledWarehouseList());
|
|
|
|
AmsAssetLocation location = new AmsAssetLocation();
|
|
location.setEnabled(ENABLED_YES);
|
|
mmap.put("locationList", amsAssetLocationService.selectAmsAssetLocationList(location));
|
|
|
|
AmsAsset asset = new AmsAsset();
|
|
asset.setAssetStatus(AssetStatus.IN_STOCK);
|
|
mmap.put("assetList", amsAssetService.selectAmsAssetList(asset));
|
|
}
|
|
|
|
private List<AmsWarehouse> selectEnabledWarehouseList()
|
|
{
|
|
AmsWarehouse warehouse = new AmsWarehouse();
|
|
warehouse.setEnabled(ENABLED_YES);
|
|
return amsWarehouseService.selectAmsWarehouseList(warehouse);
|
|
}
|
|
}
|