add(tyre): 添加轮胎收货功能

新增收货功能页面和接口,支持按入库编码批量入库轮胎
优化入库编码的Excel提示信息,去除重复内容
master
zch 3 days ago
parent 33005c8bf9
commit 03c3b819f1

@ -12,11 +12,13 @@ import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.vo.BaseTyreVo; import com.ruoyi.system.domain.vo.BaseTyreVo;
import com.ruoyi.system.service.IBaseInventoryService;
import com.ruoyi.system.service.IBaseTyreService; import com.ruoyi.system.service.IBaseTyreService;
import com.ruoyi.system.service.IRecordCheckService; import com.ruoyi.system.service.IRecordCheckService;
import com.ruoyi.system.service.IRecordTyreInstallService; import com.ruoyi.system.service.IRecordTyreInstallService;
import com.ruoyi.system.service.IRecordWarehousingService; import com.ruoyi.system.service.IRecordWarehousingService;
import com.ruoyi.system.service.ITyreStatDetailService; import com.ruoyi.system.service.ITyreStatDetailService;
import com.ruoyi.system.domain.vo.InboundBatchPreviewVo;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -58,6 +60,9 @@ public class BaseTyreController extends BaseController
@Autowired @Autowired
private ITyreStatDetailService tyreStatDetailService; private ITyreStatDetailService tyreStatDetailService;
@Autowired
private IBaseInventoryService baseInventoryService;
@RequiresPermissions("tyre:tyre:view") @RequiresPermissions("tyre:tyre:view")
@GetMapping() @GetMapping()
public String tyre() public String tyre()
@ -491,4 +496,54 @@ public class BaseTyreController extends BaseController
return prefix + "/typreDetill2"; return prefix + "/typreDetill2";
} }
/**
*
*/
@RequiresPermissions("tyre:tyre:receive")
@GetMapping("/receive")
public String receive()
{
return prefix + "/receive";
}
/**
* /
*/
@RequiresPermissions("tyre:tyre:receive")
@PostMapping("/receive/preview")
@ResponseBody
public AjaxResult receivePreview(@RequestParam("inboundCode") String inboundCode)
{
InboundBatchPreviewVo data = baseInventoryService.previewBatchByCode(inboundCode);
return AjaxResult.success("批次预览成功", data);
}
/**
*
*/
@RequiresPermissions("tyre:tyre:receive")
@Log(title = "轮胎收货", businessType = BusinessType.IMPORT)
@PostMapping("/receive")
@ResponseBody
public AjaxResult receiveSubmit(@RequestParam("inboundCode") String inboundCode)
{
int rows = baseInventoryService.batchInboundByCode(inboundCode, ShiroUtils.getLoginName());
return rows > 0 ? AjaxResult.success("收货完成,成功处理 " + rows + " 条", rows)
: AjaxResult.error("收货失败或无可入库轮胎");
}
/**
*
*/
@RequiresPermissions("tyre:tyre:receive")
@Log(title = "轮胎收货撤回", businessType = BusinessType.UPDATE)
@PostMapping("/receive/rollback")
@ResponseBody
public AjaxResult receiveRollback(@RequestParam("inboundCode") String inboundCode)
{
int rows = baseInventoryService.rollbackBatchInboundByCode(inboundCode, ShiroUtils.getLoginName());
return rows > 0 ? AjaxResult.success("收货撤回完成,成功处理 " + rows + " 条", rows)
: AjaxResult.error("收货撤回失败或无可撤回轮胎");
}
} }

@ -0,0 +1,115 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('轮胎收货')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12">
<form id="formId" class="form-inline">
<div class="form-group">
<label>入库编码:</label>
<input id="inboundCode" name="inboundCode" type="text"
class="form-control" placeholder="请输入供应商提供的入库编码" autocomplete="off"
style="width: 280px;"/>
</div>
<a class="btn btn-primary" onclick="doPreview()"><i class="fa fa-search"></i> 查询</a>
</form>
<div id="previewPanel" class="mt20" style="display:none;">
<div class="alert alert-info" id="previewSummary"></div>
<div class="table-responsive" style="max-height: 300px; overflow-y: auto;">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>RFID</th>
<th>胎号</th>
<th>品牌</th>
<th>型号</th>
<th>状态</th>
</tr>
</thead>
<tbody id="previewTbody"></tbody>
</table>
</div>
</div>
<div class="text-right mt20">
<a id="confirmBtn" class="btn btn-success disabled" onclick="doConfirm()"
shiro:hasPermission="tyre:tyre:receive">
<i class="fa fa-check"></i> 确认入库
</a>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "tyre/tyre";
var lastPreview = null;
function doPreview() {
var code = $.trim($("#inboundCode").val());
if (!code) { $.modal.alertWarning("请输入入库编码"); return; }
$.modal.loading("正在查询...");
$.ajax({
url: prefix + "/receive/preview",
type: "post",
data: { inboundCode: code },
success: function (res) {
$.modal.closeLoading();
if (res.code !== 0) { $.modal.alertError(res.msg); return; }
lastPreview = res.data || {};
renderPreview(lastPreview);
$("#confirmBtn").toggleClass("disabled", !(lastPreview.pending > 0));
},
error: function () {
$.modal.closeLoading();
$.modal.alertError("网络异常,请重试");
}
});
}
function renderPreview(data) {
var summary = "批次:" + data.inboundCode + ",共 " + data.total + " 条,已入库 "
+ data.exists + " 条,<b style='color:red'>待入库 " + data.pending + " 条</b>";
$("#previewSummary").html(summary);
var rows = "";
var items = data.items || [];
for (var i = 0; i < items.length; i++) {
var item = items[i];
var statusLabel = item.status === '待入库'
? '<span class="label label-warning">待入库</span>'
: '<span class="label label-success">已存在库存记录</span>';
rows += "<tr><td>" + (item.tyreEpc || '') + "</td><td>" + (item.tyreNo || '')
+ "</td><td>" + (item.tyreBrand || '') + "</td><td>" + (item.tyreModel || '')
+ "</td><td>" + statusLabel + "</td></tr>";
}
$("#previewTbody").html(rows);
$("#previewPanel").show();
}
function doConfirm() {
if (!lastPreview || !lastPreview.pending || lastPreview.pending <= 0) { return; }
var code = lastPreview.inboundCode;
$.modal.confirm("确认按批次 [" + code + "] 一次性入库 " + lastPreview.pending + " 条?", function () {
$.modal.loading("正在入库...");
$.ajax({
url: prefix + "/receive",
type: "post",
data: { inboundCode: code },
success: function (res) {
$.modal.closeLoading();
if (res.code !== 0) { $.modal.alertError(res.msg); return; }
$.modal.msgSuccess("已入库 " + res.data + " 条");
doPreview();
},
error: function () {
$.modal.closeLoading();
$.modal.alertError("网络异常,请重试");
}
});
});
}
</script>
</body>
</html>

@ -80,6 +80,9 @@
<a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="tyre:tyre:import"> <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="tyre:tyre:import">
<i class="fa fa-upload"></i> 导入 <i class="fa fa-upload"></i> 导入
</a> </a>
<a class="btn btn-info" onclick="openReceive()" shiro:hasPermission="tyre:tyre:receive">
<i class="fa fa-inbox"></i> 收货
</a>
</div> </div>
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>
@ -223,6 +226,10 @@
}; };
$.table.init(options); $.table.init(options);
}); });
function openReceive() {
var url = ctx + "tyre/tyre/receive";
$.modal.openOptions({ title: "收货", url: url, width: 720, height: 520 });
}
</script> </script>
<script id="importTpl" type="text/template"> <script id="importTpl" type="text/template">
<form enctype="multipart/form-data" class="mt20 mb10"> <form enctype="multipart/form-data" class="mt20 mb10">

@ -42,8 +42,7 @@ public class BaseTyreVo {
/** 入库编码 */ /** 入库编码 */
@Excel(name = "入库编码", color = IndexedColors.RED, @Excel(name = "入库编码", color = IndexedColors.RED,
prompt = "Excel 第一行必须填写默认入库编码,后续空行自动沿用最近一次出现的编码;" + prompt = "Excel 第一行必须填写默认入库编码,后续空行自动沿用最近一次出现的编码;" +
"如中途填写新编码,则从该行开始切换为新批次,直到再次填写其他编码。" + "如中途填写新编码,则从该行开始切换为新批次,直到再次填写其他编码。" )
"Excel 第一行必须填写默认入库编码,后续空行自动沿用最近一次出现的编码;如中途填写新编码,则从该行开始切换为新批次,直到再次填写其他编码。")
private String inboundCode; private String inboundCode;
public @NotBlank(message = "胎号不能为空") String getTyreNo() { public @NotBlank(message = "胎号不能为空") String getTyreNo() {

@ -163,6 +163,7 @@ public class BaseInventoryServiceImpl implements IBaseInventoryService
baseTyre.setTeam(team); baseTyre.setTeam(team);
baseTyre.setCreateBy(baseInventory.getCreateBy()); baseTyre.setCreateBy(baseInventory.getCreateBy());
baseTyre.setDeptId(sysUser.getDeptId()); baseTyre.setDeptId(sysUser.getDeptId());
baseTyre.setInventoryStatus("0"); // 入库后库存状态置为在仓
baseTyreMapper.insertBaseTyre(baseTyre); baseTyreMapper.insertBaseTyre(baseTyre);
}else { }else {
baseTyre.setTyreId(baseTyres.getTyreId()); baseTyre.setTyreId(baseTyres.getTyreId());
@ -170,6 +171,7 @@ public class BaseInventoryServiceImpl implements IBaseInventoryService
baseTyre.setTeam(team); baseTyre.setTeam(team);
baseTyre.setUpdateBy(baseInventory.getCreateBy()); baseTyre.setUpdateBy(baseInventory.getCreateBy());
baseTyre.setDeptId(sysUser.getDeptId()); baseTyre.setDeptId(sysUser.getDeptId());
baseTyre.setInventoryStatus("0"); // 入库后库存状态置为在仓
baseTyreMapper.updateBaseTyre(baseTyre); baseTyreMapper.updateBaseTyre(baseTyre);
} }
} }

@ -63,7 +63,7 @@ public class InboundBatchServiceImpl implements IInboundBatchService
inventory.setTyreRfid(tyre.getTyreEpc()); // 绑定轮胎 RFID inventory.setTyreRfid(tyre.getTyreEpc()); // 绑定轮胎 RFID
inventory.setTyreOutsideId(tyre.getTyreNo()); // 绑定轮胎外部编号 inventory.setTyreOutsideId(tyre.getTyreNo()); // 绑定轮胎外部编号
inventory.setNumber(1L); // 数量默认为 1 inventory.setNumber(1L); // 数量默认为 1
inventory.setStatus("0"); // 0 表示在库状态 inventory.setStatus("0"); //参考insertInventoryByPda
inventory.setCreateBy(operName); // 记录创建人 inventory.setCreateBy(operName); // 记录创建人
inventory.setCreateTime(now); // 记录创建时间 inventory.setCreateTime(now); // 记录创建时间
inventory.setUpdateTime(now); // 记录更新时间 inventory.setUpdateTime(now); // 记录更新时间
@ -76,7 +76,7 @@ public class InboundBatchServiceImpl implements IInboundBatchService
RecordWarehousing record = new RecordWarehousing(); // 新建入库流水 RecordWarehousing record = new RecordWarehousing(); // 新建入库流水
record.setTyreRfid(tyre.getTyreEpc()); // 绑定轮胎 RFID record.setTyreRfid(tyre.getTyreEpc()); // 绑定轮胎 RFID
record.setType("0"); // 0 表示入库类型 record.setType("0"); // 参考insertInventoryByPda
record.setCreateBy(operName); // 记录操作人 record.setCreateBy(operName); // 记录操作人
record.setCreateTime(now); // 记录操作时间 record.setCreateTime(now); // 记录操作时间
record.setRemark("批量入库[" + inboundCode + "]"); // 备注携带批次号 record.setRemark("批量入库[" + inboundCode + "]"); // 备注携带批次号
@ -108,6 +108,7 @@ public class InboundBatchServiceImpl implements IInboundBatchService
updateTyre.setTyreId(tyre.getTyreId()); // 指定待更新的轮胎档案 updateTyre.setTyreId(tyre.getTyreId()); // 指定待更新的轮胎档案
updateTyre.setTeam(baseTyreMapper.getTeamByUser(operName)); // 同步车队归属 updateTyre.setTeam(baseTyreMapper.getTeamByUser(operName)); // 同步车队归属
updateTyre.setDeptId(sysUser.getDeptId()); // 同步部门归属 updateTyre.setDeptId(sysUser.getDeptId()); // 同步部门归属
updateTyre.setInventoryStatus("0"); // 入库后库存状态更新为在仓0=在仓1=出仓NULL=已发货待入库)
updateTyre.setUpdateBy(operName); // 记录更新人 updateTyre.setUpdateBy(operName); // 记录更新人
updateTyre.setUpdateTime(now); // 记录更新时间 updateTyre.setUpdateTime(now); // 记录更新时间
int tyreRows = baseTyreMapper.updateBaseTyre(updateTyre); // 执行更新 int tyreRows = baseTyreMapper.updateBaseTyre(updateTyre); // 执行更新

Loading…
Cancel
Save