Compare commits

...

3 Commits

Author SHA1 Message Date
王晓迪 23108a6844 Merge remote-tracking branch 'origin/dev' into dev 2 weeks ago
王晓迪 fcd6fbd6e4 [fix] 2 weeks ago
王晓迪 739e401af0 [fix] 2 weeks ago
  1. 26
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java
  2. 39
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryCheckDetail.java
  3. 13
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseInventoryCheckDetailMapper.java
  4. 50
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java
  5. 12
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryCheckDetailMapper.xml
  6. 15
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/add.html
  7. 141
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/detail.html
  8. 76
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/edit.html
  9. 42
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/inventoryCheck.html

26
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java

@ -4,10 +4,14 @@ import java.util.List;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO; import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryCheckDetail; import com.ruoyi.warehouse.domain.WarehouseInventoryCheckDetail;
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamageChild;
import com.ruoyi.warehouse.mapper.WarehouseInventoryCheckDetailMapper;
import com.ruoyi.warehouse.service.IWarehouseInventoryCheckDetailService;
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;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
@ -33,6 +37,12 @@ public class WarehouseInventoryCheckController extends BaseController
@Autowired @Autowired
private IWarehouseInventoryCheckService warehouseInventoryCheckService; private IWarehouseInventoryCheckService warehouseInventoryCheckService;
@Autowired
private IWarehouseInventoryCheckDetailService checkDetailService;
@Autowired
private WarehouseInventoryCheckDetailMapper checkDetailMapper;
@RequiresPermissions("warehouse:inventoryCheck:view") @RequiresPermissions("warehouse:inventoryCheck:view")
@GetMapping() @GetMapping()
public String inventoryCheck() public String inventoryCheck()
@ -60,11 +70,19 @@ public class WarehouseInventoryCheckController extends BaseController
@Log(title = "仓库库存盘点", businessType = BusinessType.EXPORT) @Log(title = "仓库库存盘点", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(WarehouseInventoryCheck warehouseInventoryCheck) public AjaxResult export(WarehouseInventoryCheck warehouseInventoryCheck,String ids)
{ {
List<WarehouseInventoryCheck> list = warehouseInventoryCheckService.selectWarehouseInventoryCheckList(warehouseInventoryCheck); if (StringUtils.isEmpty(ids)){
ExcelUtil<WarehouseInventoryCheck> util = new ExcelUtil<WarehouseInventoryCheck>(WarehouseInventoryCheck.class); WarehouseInventoryCheckDetail checkDetail = new WarehouseInventoryCheckDetail();
return util.exportExcel(list, "仓库库存盘点数据"); List<WarehouseInventoryCheckDetail> list = checkDetailService.selectWarehouseInventoryCheckDetailList(checkDetail);
ExcelUtil<WarehouseInventoryCheckDetail> util = new ExcelUtil<WarehouseInventoryCheckDetail>(WarehouseInventoryCheckDetail.class);
return util.exportExcel(list, "仓库库存报损数据");
}else {
String[] checkCodes = ids.split(",");
List<WarehouseInventoryCheckDetail> list = checkDetailMapper.selectWarehouseInventoryCheckDetailByCodes(checkCodes);
ExcelUtil<WarehouseInventoryCheckDetail> util = new ExcelUtil<WarehouseInventoryCheckDetail>(WarehouseInventoryCheckDetail.class);
return util.exportExcel(list, ids);
}
} }
/** /**

39
ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryCheckDetail.java

@ -21,50 +21,55 @@ public class WarehouseInventoryCheckDetail extends BaseEntity
private Long inventoryCheckDetailId; private Long inventoryCheckDetailId;
/** 库存盘点单号 */ /** 库存盘点单号 */
@Excel(name = "库存盘点单号", sort = 1)
private String inventoryCheckCode; private String inventoryCheckCode;
/** 库存盘点人名 */ /** 库存盘点人名 */
@Excel(name = "盘点人", sort = 13)
private String inventoryCheckName; private String inventoryCheckName;
/** 料号 */ /** 料号 */
@Excel(name = "料号") @Excel(name = "料号", sort = 2)
private String materialNo; private String materialNo;
/** 物料名称 */ /** 物料名称 */
@Excel(name = "物料名称") @Excel(name = "物料名称", sort = 3)
private String materialName; private String materialName;
/** 物料单位 */ /** 物料单位 */
@Excel(name = "物料单位") @Excel(name = "单位", sort = 10)
private String materialUnit; private String materialUnit;
/** 物料描述 */ /** 物料描述 */
@Excel(name = "物料描述") @Excel(name = "物料描述", sort = 4)
private String materialDescribe; private String materialDescribe;
/** 库存盘点数量 */ /** 库存盘点数量 */
@Excel(name = "库存盘点数量") @Excel(name = "盘点数量", sort = 11)
private Integer inventoryCheckNum; private Integer inventoryCheckNum;
/** 当时库存账上数量 */ /** 当时库存账上数量 */
@Excel(name = "当时库存账上数量") @Excel(name = "当时库存账上数量", sort = 12)
private Integer inventoryAccountNum; private Integer inventoryAccountNum;
/** 仓库存放地址 */
@Excel(name = "仓库存放地址")
private String warehouseStoreAddress;
/** 批号 */ /** 批号 */
@Excel(name = "批号") @Excel(name = "批号", sort = 5)
private Integer batchNumber; private Integer batchNumber;
/** 仓库号 */ /** 仓库号 */
@Excel(name = "仓库号", sort = 6)
private String warehouseCode; private String warehouseCode;
/** 仓库名称 */ /** 仓库名称 */
@Excel(name = "仓库名称", sort = 7)
private String warehouseName; private String warehouseName;
/** 仓库存放地址 */
@Excel(name = "仓库存放地址", sort = 8)
private String warehouseStoreAddress;
/** 库存盘点日期 */ /** 库存盘点日期 */
@Excel(name = "库存盘点日期", sort = 9, dateFormat = "yyyy-MM-dd")
private Date inventoryCheckDate; private Date inventoryCheckDate;
/** 物料数合计 */ /** 物料数合计 */
@ -73,6 +78,8 @@ public class WarehouseInventoryCheckDetail extends BaseEntity
/** 数量合计 */ /** 数量合计 */
private Integer numTotal; private Integer numTotal;
@Excel(name = "备注", sort = 14)
private String remark;
public void setInventoryCheckDetailId(Long inventoryCheckDetailId) public void setInventoryCheckDetailId(Long inventoryCheckDetailId)
{ {
this.inventoryCheckDetailId = inventoryCheckDetailId; this.inventoryCheckDetailId = inventoryCheckDetailId;
@ -218,6 +225,16 @@ public class WarehouseInventoryCheckDetail extends BaseEntity
return numTotal; return numTotal;
} }
@Override
public String getRemark() {
return remark;
}
@Override
public void setRemark(String remark) {
this.remark = remark;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

13
ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseInventoryCheckDetailMapper.java

@ -51,6 +51,14 @@ public interface WarehouseInventoryCheckDetailMapper
*/ */
public int deleteWarehouseInventoryCheckDetailById(Long inventoryCheckDetailId); public int deleteWarehouseInventoryCheckDetailById(Long inventoryCheckDetailId);
/**
* 删除仓库库存盘点详情
*
* @param inventoryCheckCode 仓库库存盘点详情ID
* @return 结果
*/
public int deleteWarehouseInventoryCheckDetailByCode(String inventoryCheckCode);
/** /**
* 批量删除仓库库存盘点详情 * 批量删除仓库库存盘点详情
* *
@ -79,4 +87,9 @@ public interface WarehouseInventoryCheckDetailMapper
* 根据盘点单号查找盘点详情信息 * 根据盘点单号查找盘点详情信息
* */ * */
List<WarehouseInventoryCheckDetail> selectInventoryCheckDetailListByCode(String inventoryCheckCode); List<WarehouseInventoryCheckDetail> selectInventoryCheckDetailListByCode(String inventoryCheckCode);
/**
* 根据盘点单号批量查找盘点详情信息
* */
List<WarehouseInventoryCheckDetail> selectWarehouseInventoryCheckDetailByCodes(String[] inventoryCheckCodes);
} }

50
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java

@ -87,28 +87,36 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh
warehouseInventoryCheck.setInventoryCheckCode(newCode); warehouseInventoryCheck.setInventoryCheckCode(newCode);
warehouseInventoryCheck.setCreateTime(DateUtils.getNowDate()); warehouseInventoryCheck.setCreateTime(DateUtils.getNowDate());
warehouseInventoryCheck.setCreateBy(loginName); warehouseInventoryCheck.setCreateBy(loginName);
List<WarehouseInventoryCheckDetail> inventoryCheckDetails = warehouseInventoryCheck.getInventoryCheckDetails();
List<WarehouseInventoryCheckDetail> inventoryCheckDetails = warehouseInventoryCheck.getInventoryCheckDetails();
int numTotal = 0;
if (StringUtils.isEmpty(inventoryCheckDetails)){ if (StringUtils.isEmpty(inventoryCheckDetails)){
log.warn("仓库盘点物料相关信息为空:{}",inventoryCheckDetails); log.warn("仓库盘点物料相关信息为空:{}",inventoryCheckDetails);
} }else{
warehouseInventoryCheck.setMaterialTotal(inventoryCheckDetails.size());
for (WarehouseInventoryCheckDetail tempInventoryCheckDetail : inventoryCheckDetails) { for (WarehouseInventoryCheckDetail tempInventoryCheckDetail : inventoryCheckDetails) {
WarehouseInventoryCheckDetail inventoryCheckDetail = new WarehouseInventoryCheckDetail(); WarehouseInventoryCheckDetail inventoryCheckDetail = new WarehouseInventoryCheckDetail();
inventoryCheckDetail.setInventoryCheckCode(newCode); inventoryCheckDetail.setInventoryCheckCode(newCode);
inventoryCheckDetail.setInventoryCheckName(warehouseInventoryCheck.getInventoryCheckName());
inventoryCheckDetail.setMaterialNo(tempInventoryCheckDetail.getMaterialNo()); inventoryCheckDetail.setMaterialNo(tempInventoryCheckDetail.getMaterialNo());
inventoryCheckDetail.setMaterialName(tempInventoryCheckDetail.getMaterialName()); inventoryCheckDetail.setMaterialName(tempInventoryCheckDetail.getMaterialName());
inventoryCheckDetail.setMaterialDescribe(tempInventoryCheckDetail.getMaterialDescribe()); inventoryCheckDetail.setMaterialDescribe(tempInventoryCheckDetail.getMaterialDescribe());
inventoryCheckDetail.setMaterialUnit(tempInventoryCheckDetail.getMaterialUnit()); inventoryCheckDetail.setMaterialUnit(tempInventoryCheckDetail.getMaterialUnit());
inventoryCheckDetail.setInventoryCheckNum(tempInventoryCheckDetail.getInventoryCheckNum()); inventoryCheckDetail.setInventoryCheckNum(tempInventoryCheckDetail.getInventoryCheckNum());
numTotal += tempInventoryCheckDetail.getInventoryCheckNum();
inventoryCheckDetail.setInventoryAccountNum(tempInventoryCheckDetail.getInventoryAccountNum()); inventoryCheckDetail.setInventoryAccountNum(tempInventoryCheckDetail.getInventoryAccountNum());
inventoryCheckDetail.setRemark(tempInventoryCheckDetail.getRemark()); inventoryCheckDetail.setRemark(tempInventoryCheckDetail.getRemark());
inventoryCheckDetail.setWarehouseCode(warehouseInventoryCheck.getWarehouseCode());
inventoryCheckDetail.setWarehouseName(warehouseInventoryCheck.getWarehouseName());
inventoryCheckDetail.setWarehouseStoreAddress(tempInventoryCheckDetail.getWarehouseStoreAddress()); inventoryCheckDetail.setWarehouseStoreAddress(tempInventoryCheckDetail.getWarehouseStoreAddress());
inventoryCheckDetail.setBatchNumber(tempInventoryCheckDetail.getBatchNumber());
inventoryCheckDetail.setCreateBy(loginName); inventoryCheckDetail.setCreateBy(loginName);
inventoryCheckDetail.setCreateTime(new Date()); inventoryCheckDetail.setCreateTime(DateUtils.getNowDate());
inventoryCheckDetail.setInventoryCheckDate(warehouseInventoryCheck.getInventoryCheckDate());
inventoryCheckDetailMapper.insertWarehouseInventoryCheckDetail(inventoryCheckDetail); inventoryCheckDetailMapper.insertWarehouseInventoryCheckDetail(inventoryCheckDetail);
} }
}
warehouseInventoryCheck.setNumTotal(numTotal);
return warehouseInventoryCheckMapper.insertWarehouseInventoryCheck(warehouseInventoryCheck); return warehouseInventoryCheckMapper.insertWarehouseInventoryCheck(warehouseInventoryCheck);
} }
@ -125,20 +133,38 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
warehouseInventoryCheck.setUpdateBy(loginName); warehouseInventoryCheck.setUpdateBy(loginName);
warehouseInventoryCheck.setUpdateTime(DateUtils.getNowDate()); warehouseInventoryCheck.setUpdateTime(DateUtils.getNowDate());
int numTotal = 0;
List<WarehouseInventoryCheckDetail> inventoryCheckDetails = warehouseInventoryCheck.getInventoryCheckDetails(); List<WarehouseInventoryCheckDetail> inventoryCheckDetails = warehouseInventoryCheck.getInventoryCheckDetails();
if (StringUtils.isEmpty(inventoryCheckDetails)){ if (StringUtils.isEmpty(inventoryCheckDetails)){
log.warn("仓库盘点物料相关信息为空:{}",inventoryCheckDetails); log.warn("仓库盘点物料相关信息为空:{}",inventoryCheckDetails);
} }else{
inventoryCheckDetailMapper.deleteWarehouseInventoryCheckDetailByCode(warehouseInventoryCheck.getInventoryCheckCode());
warehouseInventoryCheck.setMaterialTotal(inventoryCheckDetails.size());
for (WarehouseInventoryCheckDetail tempInventoryCheckDetail : inventoryCheckDetails) { for (WarehouseInventoryCheckDetail tempInventoryCheckDetail : inventoryCheckDetails) {
WarehouseInventoryCheckDetail inventoryCheckDetail = new WarehouseInventoryCheckDetail();
tempInventoryCheckDetail.setUpdateBy(loginName); inventoryCheckDetail.setInventoryCheckCode(warehouseInventoryCheck.getInventoryCheckCode());
tempInventoryCheckDetail.setUpdateTime(new Date()); inventoryCheckDetail.setInventoryCheckName(warehouseInventoryCheck.getInventoryCheckName());
inventoryCheckDetailMapper.updateWarehouseInventoryCheckDetail(tempInventoryCheckDetail); inventoryCheckDetail.setMaterialNo(tempInventoryCheckDetail.getMaterialNo());
inventoryCheckDetail.setMaterialName(tempInventoryCheckDetail.getMaterialName());
inventoryCheckDetail.setMaterialDescribe(tempInventoryCheckDetail.getMaterialDescribe());
inventoryCheckDetail.setMaterialUnit(tempInventoryCheckDetail.getMaterialUnit());
inventoryCheckDetail.setInventoryCheckNum(tempInventoryCheckDetail.getInventoryCheckNum());
numTotal += tempInventoryCheckDetail.getInventoryCheckNum();
inventoryCheckDetail.setInventoryAccountNum(tempInventoryCheckDetail.getInventoryAccountNum());
inventoryCheckDetail.setRemark(tempInventoryCheckDetail.getRemark());
inventoryCheckDetail.setWarehouseCode(warehouseInventoryCheck.getWarehouseCode());
inventoryCheckDetail.setWarehouseName(warehouseInventoryCheck.getWarehouseName());
inventoryCheckDetail.setWarehouseStoreAddress(tempInventoryCheckDetail.getWarehouseStoreAddress());
inventoryCheckDetail.setBatchNumber(tempInventoryCheckDetail.getBatchNumber());
inventoryCheckDetail.setCreateBy(loginName);
inventoryCheckDetail.setCreateTime(DateUtils.getNowDate());
inventoryCheckDetail.setInventoryCheckDate(warehouseInventoryCheck.getInventoryCheckDate());
inventoryCheckDetailMapper.insertWarehouseInventoryCheckDetail(inventoryCheckDetail);
} }
}
warehouseInventoryCheck.setNumTotal(numTotal);
return warehouseInventoryCheckMapper.updateWarehouseInventoryCheck(warehouseInventoryCheck); return warehouseInventoryCheckMapper.updateWarehouseInventoryCheck(warehouseInventoryCheck);
} }

12
ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryCheckDetailMapper.xml

@ -143,4 +143,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update warehouse_inventory_check_detail set del_flag = '0' where inventory_check_detail_id = #{inventoryCheckDetailId} update warehouse_inventory_check_detail set del_flag = '0' where inventory_check_detail_id = #{inventoryCheckDetailId}
</update> </update>
<delete id="deleteWarehouseInventoryCheckDetailByCode" parameterType="String">
delete from warehouse_inventory_check_detail where inventory_check_code = #{inventoryCheckCode}
</delete>
<select id="selectWarehouseInventoryCheckDetailByCodes" parameterType="String" resultMap="WarehouseInventoryCheckDetailResult">
<include refid="selectWarehouseInventoryCheckDetailVo"/>
where inventory_check_code in
<foreach item="inventoryCheckCode" collection="array" open="(" separator="," close=")">
#{inventoryCheckCode}
</foreach>
</select>
</mapper> </mapper>

15
ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/add.html

@ -3,6 +3,7 @@
<head> <head>
<th:block th:include="include :: header('新增仓库库存盘点')" /> <th:block th:include="include :: header('新增仓库库存盘点')" />
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -64,7 +65,7 @@
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" /> <th:block th:include="include :: datetimepicker-js" />
<!--用于可以修改列表字段的插件--> <th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-table-editable-js" /> <th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var loginName = [[${@permission.getPrincipalProperty('loginName')}]]; var loginName = [[${@permission.getPrincipalProperty('loginName')}]];
@ -132,10 +133,10 @@
$.modal.openOptions(options); $.modal.openOptions(options);
} }
//收款凭证table列表
$(function() { $(function() {
$("input[name='inventoryCheckName']").val(loginName);
var options = { var options = {
modalName: "收款凭证", modalName: "库存盘点物料",
showColumns: false, showColumns: false,
pagination: false, pagination: false,
showToggle: false, showToggle: false,
@ -143,12 +144,11 @@
showSearch:false, showSearch:false,
singleSelect:true, singleSelect:true,
columns: [ columns: [
{checkbox: false},
{title: '库存盘点详情ID', field: 'inventoryCheckDetailId', visible: false}, {title: '库存盘点详情ID', field: 'inventoryCheckDetailId', visible: false},
{title: '料号', field: 'materialNo',}, {title: '料号', field: 'materialNo',},
{title: '物料名称', field: 'materialName',}, {title: '物料名称', field: 'materialName',},
{title: '物料单位', field: 'materialUnit',},
{title: '物料描述', field: 'materialDescribe',}, {title: '物料描述', field: 'materialDescribe',},
{title: '单位', field: 'materialUnit',},
{title: '盘点数量', field: 'inventoryCheckNum', editable:true}, {title: '盘点数量', field: 'inventoryCheckNum', editable:true},
{title: '当时库存账上数量', field: 'inventoryAccountNum', editable:true}, {title: '当时库存账上数量', field: 'inventoryAccountNum', editable:true},
{title: '存放地址', field: 'warehouseStoreAddress', editable:true}, {title: '存放地址', field: 'warehouseStoreAddress', editable:true},
@ -157,7 +157,7 @@
{title: '操作', align: 'center', {title: '操作', align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.receivablesRecordsId + '\')"><i class="fa fa-remove"></i>删除</a> '); actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join(''); return actions.join('');
} }
} }
@ -165,7 +165,6 @@
}; };
$.table.init(options); $.table.init(options);
loadWarehouseCodes(); loadWarehouseCodes();
$("input[name='inventoryCheckName']").value(loginName);
}) })
function doSubmit(index, layero,uniqueId){ function doSubmit(index, layero,uniqueId){
@ -201,7 +200,7 @@
ajax: { ajax: {
theme: "bootstrap", theme: "bootstrap",
allowClear: true, allowClear: true,
placeholder: "请选择一个料号", placeholder: "请选择",
type: 'GET', // 请求类型 type: 'GET', // 请求类型
url: url, // 后端接口URL url: url, // 后端接口URL
dataType: 'json', // 预期服务器返回的数据类型 dataType: 'json', // 预期服务器返回的数据类型

141
ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/detail.html

@ -26,9 +26,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">仓库名称:</label> <label class="col-sm-3 control-label">仓库名称:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="stockName" name="warehouseName" class="form-control" th:field="*{warehouseName}" disabled /> <input id="stockName" name="warehouseName" class="form-control" th:field="*{warehouseName}" disabled />
<option value="">请选择仓库名称</option>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -84,68 +82,11 @@
autoclose: true autoclose: true
}); });
// 新增提交
function submitHandler() {
// 获取表单数据
const inventoryCheckData = $("#form-inventoryCheck-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-table').bootstrapTable('getData');
// 检查表格数据是否为空 //库存物料table列表
if (table.length===0){
$.modal.alertWarning("请至少添加一条物料数据后再保存!");
return;
}
console.log(table);
// 将表数据转换成与complaintNoticeData格式一致的数组
var materialDataList = table.map(function(item) {
// 根据实际字段名调整
return {
"inventoryCheckDetailId":item.inventoryCheckDetailId,
"materialNo": item.materialNo, // 假设id对应materialId
"materialName": item.materialName,
"materialUnit": item.materialUnit,
"materialDescribe": item.materialDescribe,
"inventoryCheckNum": item.inventoryCheckNum,
"inventoryAccountNum": item.inventoryAccountNum,
"warehouseStoreAddress": item.warehouseStoreAddress,
"batchNumber": item.batchNumber,
"remark": item.remark,
// ...其他字段
};
});
const combinedData = Object.assign({}, inventoryCheckData, { inventoryCheckDetails: materialDataList });
// 合并表单数据和表格数据
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData);
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/detail", jsonData);
}
//添加物料信息
function insertRow() {
var url = ctx + 'warehouse/inventoryCheck/materialSelect';
var options = {
title: '选择物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
//收款凭证table列表
$(function() { $(function() {
var options = { var options = {
modalName: "收款凭证", modalName: "库存物料",
url: prefix + '/getInventoryCheckDetailList', url: prefix + '/getInventoryCheckDetailList',
queryParams: queryParams, queryParams: queryParams,
showColumns: false, showColumns: false,
@ -155,7 +96,6 @@
showSearch:false, showSearch:false,
singleSelect:true, singleSelect:true,
columns: [ columns: [
{checkbox: false},
{title: '库存盘点详情ID', field: 'inventoryCheckDetailId', visible: false}, {title: '库存盘点详情ID', field: 'inventoryCheckDetailId', visible: false},
{title: '料号', field: 'materialNo',}, {title: '料号', field: 'materialNo',},
{title: '物料名称', field: 'materialName',}, {title: '物料名称', field: 'materialName',},
@ -182,81 +122,6 @@
} }
function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-materialSelect-table').bootstrapTable('getSelections')[0];
console.log("rowData: "+rowData);
$("#bootstrap-table").bootstrapTable('insertRow', {
index:1,
row: {
materialNo:rowData.materialNo,
materialName: rowData.materialName,
materialDescribe: rowData.materialDescribe,
materialUnit: rowData.materialUnit,
inventoryCheckNum : "",
inventoryAccountNum : "",
warehouseStoreAddress : "",
batchNumber : "",
remark : ""
}
})
layer.close(index);
}
// 逻辑删除前端的一行数据
function removeRow(materialNo){
$("#bootstrap-table").bootstrapTable('remove', {
field: 'materialNo',
values: materialNo
})
}
function loadWarehouseCodes() {
var url = ctx + 'stock/stockInfo/getAllWarehouseCode';
$("#stockName").select2({
ajax: {
theme: "bootstrap",
allowClear: true,
placeholder: "请选择一个料号",
type: 'GET', // 请求类型
url: url, // 后端接口URL
dataType: 'json', // 预期服务器返回的数据类型
data: function(params) {
return {
q: params.term, // 搜索关键词
page: params.page || 1 ,// 当前页码
// 其他参数
pageSize: 30
};
},
processResults: function(data, params) {
params.page = params.page || 1;
var options = [];
for (var i = 0; i < data.length; i++) {
var option = {
id: data[i].stockName,
text: data[i].stockName,
title: data[i].stockNO
};
options.push(option);
}
var moreDataAvaliable = (params.page * 30) < data.total_count;
return {
// 实现下拉实现填入stockName
results: options,
pagination: {
more: moreDataAvaliable // 是否还有更多数据
}
};
}
}
});
}
$('#stockName').on('select2:select', function(e) {
var data = e.params.data;
$("input[name='warehouseCode']").val(data.title);
});
</script> </script>
</body> </body>
</html> </html>

76
ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/edit.html

@ -91,6 +91,10 @@
obj[item.name] = item.value; obj[item.name] = item.value;
return obj; return obj;
}, {}); }, {});
const selectedOptionText = $("#stockName option:selected").text();
inventoryCheckData.warehouseName = selectedOptionText;
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 // 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-table').bootstrapTable('getData'); var table = $('#bootstrap-table').bootstrapTable('getData');
@ -152,7 +156,6 @@
showSearch:false, showSearch:false,
singleSelect:true, singleSelect:true,
columns: [ columns: [
{checkbox: false},
{title: '库存盘点详情ID', field: 'inventoryCheckDetailId', visible: false}, {title: '库存盘点详情ID', field: 'inventoryCheckDetailId', visible: false},
{title: '料号', field: 'materialNo',}, {title: '料号', field: 'materialNo',},
{title: '物料名称', field: 'materialName',}, {title: '物料名称', field: 'materialName',},
@ -166,14 +169,15 @@
{title: '操作', align: 'center', {title: '操作', align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.receivablesRecordsId + '\')"><i class="fa fa-remove"></i>删除</a> '); actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join(''); return actions.join('');
} }
} }
] ]
}; };
$.table.init(options); $.table.init(options);
loadWarehouseCodes(); var stockName = warehouseInventoryCheck.warehouseName;
loadWarehouseCodes(stockName);
}) })
function queryParams(params) { function queryParams(params) {
@ -213,51 +217,37 @@
}) })
} }
// 加载仓库Id列表函数 // 加载仓库Id列表函数
function loadWarehouseCodes() { function loadWarehouseCodes(defaultStockName) {
var url = ctx + 'stock/stockInfo/getAllWarehouseCode'; var url = ctx + 'stock/stockInfo/getAllWarehouseCode';
$("#stockName").select2({ $.ajax({
ajax: { url: url,
theme: "bootstrap", type: 'GET',
allowClear: true, dataType: 'json',
placeholder: "请选择一个料号", success: function(data) {
type: 'GET', // 请求类型 var select = $('#stockName');
url: url, // 后端接口URL $.each(data, function(i, option) {
dataType: 'json', // 预期服务器返回的数据类型 var optionElement = $('<option>', {
data: function(params) { value: option.stockNO,
return { text : option.stockName
q: params.term, // 搜索关键词 });
page: params.page || 1 ,// 当前页码 select.append(optionElement);
// 其他参数 if (option.stockName === defaultStockName) {
pageSize: 30 optionElement.prop('selected', true);
};
},
processResults: function(data, params) {
params.page = params.page || 1;
var options = [];
for (var i = 0; i < data.length; i++) {
var option = {
id: data[i].stockName,
text: data[i].stockName,
title: data[i].stockNO
};
options.push(option);
}
var moreDataAvaliable = (params.page * 30) < data.total_count;
return {
// 实现下拉实现填入stockName
results: options,
pagination: {
more: moreDataAvaliable // 是否还有更多数据
}
};
}
} }
}); });
// 给下拉框添加 change 事件监听器
select.on('change', function() {
// 获取选中的 stockNo
var selectedStockNo = $(this).val();
// 将选中的 stockNo 赋值给指定的输入框
$("input[name='warehouseCode']").val(selectedStockNo);
});
},
error: function(error) {
console.log('Error: ', error);
} }
$('#stockName').on('select2:select', function(e) {
var data = e.params.data;
$("input[name='warehouseCode']").val(data.title);
}); });
}
</script> </script>
</body> </body>

42
ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/inventoryCheck.html

@ -49,7 +49,7 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="warehouse:inventoryCheck:add"> <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="warehouse:inventoryCheck:add">
<i class="fa fa-plus"></i> 添加 <i class="fa fa-plus"></i> 添加
</a> </a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="warehouse:inventoryCheck:export"> <a class="btn btn-warning" onclick="exportExcel()" shiro:hasPermission="warehouse:inventoryCheck:export">
<i class="fa fa-download"></i> 导出 <i class="fa fa-download"></i> 导出
</a> </a>
</div> </div>
@ -89,14 +89,6 @@
title: '库存盘点人名', title: '库存盘点人名',
field: 'inventoryCheckName', field: 'inventoryCheckName',
}, },
{
title: '料号',
field: 'materialNo',
},
{
title: '物料名称',
field: 'materialName',
},
{ {
title: '仓库号', title: '仓库号',
field: 'warehouseCode', field: 'warehouseCode',
@ -121,14 +113,15 @@
title: '备注内容', title: '备注内容',
field: 'remark', field: 'remark',
}, },
{
title: '录入时间',
field: 'createTime',
},
{ {
title: '录入人', title: '录入人',
field: 'createBy', field: 'createBy',
}, },
{
title: '录入时间',
field: 'createTime',
width: 120,
},
{ {
title: '更新人', title: '更新人',
field: 'updateBy', field: 'updateBy',
@ -159,6 +152,29 @@
console.log(url); console.log(url);
$.modal.open("库存盘点详情",url); $.modal.open("库存盘点详情",url);
} }
// 导出
function exportExcel() {
var ids = $.table.selectColumns("inventoryCheckCode");
var dataParam = $("#formId").serializeArray();
let tipMsg = "确定导出当前所有数据吗?";
if ($.common.isNotEmpty(ids)) {
tipMsg = `确定导出 ${ids} 数据吗?`;
dataParam.push({ "name": "ids", "value": ids });
}
$.modal.loading("正在导出数据,请稍后...");
$.modal.confirm(tipMsg, function () {
$.post( prefix + "/export", dataParam, function (result) {
if (result.code === web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName="+ encodeURI(result.msg) + "&delete=" + true;
} else {
$.modal.alertError(result.msg);
}
$.modal.closeLoading();
});
});
}
</script> </script>
</body> </body>
</html> </html>
Loading…
Cancel
Save