Compare commits

...

4 Commits

Author SHA1 Message Date
王晓迪 ba8d5e3654 Merge remote-tracking branch 'origin/dev' into dev 3 weeks ago
王晓迪 77eb915a61 [fix] 3 weeks ago
王晓迪 336e6fb281 [fix] 3 weeks ago
王晓迪 aeb4de7592 [fix] 3 weeks ago
  1. 45
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryReportDamageController.java
  2. 13
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryReportDamage.java
  3. 11
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryReportDamageChild.java
  4. 2
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseInventoryReportDamageChildMapper.java
  5. 4
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryReportDamageService.java
  6. 40
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryReportDamageServiceImpl.java
  7. 9
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryReportDamageChildMapper.xml
  8. 317
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/add.html
  9. 153
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/detail.html
  10. 6
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/inventoryReportDamage.html

45
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryReportDamageController.java

@ -1,15 +1,22 @@
package com.ruoyi.warehouse.controller;
import java.util.List;
import com.ruoyi.ck.utils.Result;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.SysMakeorderBom;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.mapper.SysMakeorderBomMapper;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
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 org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamage;
@ -19,6 +26,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import javax.servlet.http.HttpServletRequest;
/**
* 仓库库存报损Controller
*
@ -34,6 +43,12 @@ public class WarehouseInventoryReportDamageController extends BaseController
@Autowired
private IWarehouseInventoryReportDamageService warehouseInventoryReportDamageService;
@Autowired
private SysDeptMapper sysDeptMapper;
@Autowired
private SysMakeorderBomMapper sysMakeorderBomMapper;
@RequiresPermissions("warehouse:inventoryReportDamage:view")
@GetMapping()
public String inventoryReportDamage()
@ -84,7 +99,7 @@ public class WarehouseInventoryReportDamageController extends BaseController
@Log(title = "仓库库存报损", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(WarehouseInventoryReportDamage warehouseInventoryReportDamage)
public AjaxResult addSave(@RequestBody WarehouseInventoryReportDamage warehouseInventoryReportDamage)
{
return toAjax(warehouseInventoryReportDamageService.insertWarehouseInventoryReportDamage(warehouseInventoryReportDamage));
}
@ -136,5 +151,23 @@ public class WarehouseInventoryReportDamageController extends BaseController
return toAjax(warehouseInventoryReportDamageService.updateWarehouseInventoryReportDamage(warehouseInventoryReportDamage));
}
@GetMapping("/getUserDeptName")
@ResponseBody
public Result getUserDeptName(HttpServletRequest request) throws Exception {
SysUser curUser = ShiroUtils.getSysUser();
SysDept dept = sysDeptMapper.selectDeptById(curUser.getDeptId());
return Result.getSuccessResult(dept.getDeptName());
}
/**
* 仓库库存报损物料列表生产单关联
*/
@GetMapping("/materialInMakeOrderSelect/{makeNo}")
public String materialInMakeOrderSelect(@PathVariable("makeNo") String makeNo, ModelMap mmap)
{
List<WarehouseMaterialVO> warehouseMaterialVOS = warehouseInventoryReportDamageService.getMaterialListByMakeNo(makeNo);
mmap.put("materialList", warehouseMaterialVOS);
return "/warehouse/inventoryCheck/materialSelect";
}
}

13
ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryReportDamage.java

@ -1,5 +1,6 @@
package com.ruoyi.warehouse.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -57,11 +58,11 @@ public class WarehouseInventoryReportDamage extends BaseEntity
/** 物料数合计 */
@Excel(name = "物料数合计")
private String materialTotal;
private int materialTotal;
/** 数量合计 */
@Excel(name = "数量合计")
private String numTotal;
private BigDecimal numTotal;
/** 仓库ID */
@Excel(name = "仓库ID")
@ -186,21 +187,21 @@ public class WarehouseInventoryReportDamage extends BaseEntity
{
return materialName;
}
public void setMaterialTotal(String materialTotal)
public void setMaterialTotal(int materialTotal)
{
this.materialTotal = materialTotal;
}
public String getMaterialTotal()
public int getMaterialTotal()
{
return materialTotal;
}
public void setNumTotal(String numTotal)
public void setNumTotal(BigDecimal numTotal)
{
this.numTotal = numTotal;
}
public String getNumTotal()
public BigDecimal getNumTotal()
{
return numTotal;
}

11
ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryReportDamageChild.java

@ -51,6 +51,9 @@ public class WarehouseInventoryReportDamageChild extends BaseEntity
@Excel(name = "品牌")
private String materialBrand;
// 单位
private String materialUnit;
/** 实际报废数量 */
@Excel(name = "实际报废数量")
private BigDecimal actualScrapQuantity;
@ -276,6 +279,14 @@ public class WarehouseInventoryReportDamageChild extends BaseEntity
return applyDept;
}
public String getMaterialUnit() {
return materialUnit;
}
public void setMaterialUnit(String materialUnit) {
this.materialUnit = materialUnit;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

2
ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseInventoryReportDamageChildMapper.java

@ -26,7 +26,7 @@ public interface WarehouseInventoryReportDamageChildMapper
* @param reportDamageCode 仓库库存报损物料信息code
* @return 仓库库存报损物料信息
*/
public WarehouseInventoryReportDamageChild selectWarehouseInventoryReportDamageChildByCode(String reportDamageCode);
public List<WarehouseInventoryReportDamageChild> selectWarehouseInventoryReportDamageChildByCode(String reportDamageCode);
/**
* 查询仓库库存报损物料信息列表

4
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryReportDamageService.java

@ -1,6 +1,8 @@
package com.ruoyi.warehouse.service;
import java.util.List;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamage;
/**
@ -72,4 +74,6 @@ public interface IWarehouseInventoryReportDamageService
* @return
*/
int restoreWarehouseInventoryReportDamageById(Long reportDamageId);
public List<WarehouseMaterialVO> getMaterialListByMakeNo(String makeNo);
}

40
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryReportDamageServiceImpl.java

@ -1,5 +1,6 @@
package com.ruoyi.warehouse.service.impl;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -10,7 +11,12 @@ import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.system.domain.SysMakeorderBom;
import com.ruoyi.system.mapper.SysMakeorderBomMapper;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamageChild;
import com.ruoyi.warehouse.mapper.WarehouseInventoryReportDamageChildMapper;
import com.ruoyi.warehouse.service.IWarehouseInventoryReportDamageChildService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -35,6 +41,11 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
@Autowired
private IWarehouseInventoryReportDamageChildService warehouseInventoryReportDamageChildService;
@Autowired
private WarehouseInventoryReportDamageChildMapper damageChildMapper;
@Autowired
private SysMakeorderBomMapper sysMakeorderBomMapper;
/**
* 查询仓库库存报损
*
@ -44,7 +55,12 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
@Override
public WarehouseInventoryReportDamage selectWarehouseInventoryReportDamageById(Long reportDamageId)
{
return warehouseInventoryReportDamageMapper.selectWarehouseInventoryReportDamageById(reportDamageId);
WarehouseInventoryReportDamage warehouseInventoryReportDamage = warehouseInventoryReportDamageMapper.selectWarehouseInventoryReportDamageById(reportDamageId);
List<WarehouseInventoryReportDamageChild> reportDamageChildList = damageChildMapper.selectWarehouseInventoryReportDamageChildByCode(warehouseInventoryReportDamage.getReportDamageCode());
if(StringUtils.isNotEmpty(reportDamageChildList)){
warehouseInventoryReportDamage.setWarehouseInventoryReportDamageChildList(reportDamageChildList);
}
return warehouseInventoryReportDamage;
}
/**
@ -79,11 +95,14 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
warehouseInventoryReportDamage.setCreateTime(DateUtils.getNowDate());
String loginName = ShiroUtils.getLoginName();
warehouseInventoryReportDamage.setCreateBy(loginName);
warehouseInventoryReportDamage.setCreateTime(DateUtils.getNowDate());
BigDecimal sumTotal = BigDecimal.ZERO;
//报损子表数据
//判断子表数据是否为空
if(StringUtils.isNotEmpty(warehouseInventoryReportDamage.getWarehouseInventoryReportDamageChildList())){
for(WarehouseInventoryReportDamageChild warehouseInventoryReportDamageChild:warehouseInventoryReportDamage.getWarehouseInventoryReportDamageChildList()) {
//子表数据不为空,则插入子表数据
sumTotal = sumTotal.add(warehouseInventoryReportDamageChild.getActualScrapQuantity());
warehouseInventoryReportDamageChild.setMakeNo(warehouseInventoryReportDamage.getMakeNo());
warehouseInventoryReportDamageChild.setReportDamageCode(newCode);
warehouseInventoryReportDamageChild.setCreateTime(DateUtils.getNowDate());
@ -99,6 +118,7 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
//子表数据为空,则抛出异常
throw new BusinessException("报损子表数据为空");
}
warehouseInventoryReportDamage.setNumTotal(sumTotal);
return warehouseInventoryReportDamageMapper.insertWarehouseInventoryReportDamage(warehouseInventoryReportDamage);
}
@ -195,6 +215,24 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
return warehouseInventoryReportDamageMapper.restoreWarehouseInventoryReportDamageById(reportDamageId);
}
public List<WarehouseMaterialVO> getMaterialListByMakeNo(String makeNo) {
List<WarehouseMaterialVO> warehouseMaterialVOS = new ArrayList<>();
List<SysMakeorderBom> makeorderBoms = sysMakeorderBomMapper.selectSysMakeorderBomByMakeNo(makeNo);
for (SysMakeorderBom makeorderBom : makeorderBoms) {
WarehouseMaterialVO warehouseMaterialVO = new WarehouseMaterialVO();
warehouseMaterialVO.setMaterialNo(makeorderBom.getMaterialNo());
warehouseMaterialVO.setMaterialName(makeorderBom.getMaterialName());
warehouseMaterialVO.setMaterialDescribe(makeorderBom.getDescribe());
warehouseMaterialVO.setMaterialUnit(makeorderBom.getUnit());
warehouseMaterialVO.setMaterialType(makeorderBom.getMaterialType());
warehouseMaterialVO.setProcessMethod(makeorderBom.getProcessMethod());
warehouseMaterialVO.setMaterialBrand(makeorderBom.getBrand());
warehouseMaterialVO.setMaterialphotoUrl(makeorderBom.getPhotoUrl());
warehouseMaterialVOS.add(warehouseMaterialVO);
}
return warehouseMaterialVOS;
}
/**
*报损单号生产规则

9
ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryReportDamageChildMapper.xml

@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialName" column="material_name" />
<result property="materialType" column="material_type" />
<result property="materialDescribe" column="material_describe" />
<result property="materialUnit" column="material_unit" />
<result property="materialBrand" column="material_brand" />
<result property="actualScrapQuantity" column="actual_scrap_quantity" />
<result property="scrapType" column="scrap_type" />
@ -37,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
actual_scrap_quantity, scrap_type, scrap_detail, quality_assessment,
estimated_value_rmb, responsible_unit, remark, warehouse_code, warehouse_name,
warehouse_store_address, apply_dept_id, apply_dept, create_time, create_by,
update_by, update_time
update_by, update_time, material_unit
from warehouse_inventory_report_damage_child
</sql>
@ -50,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="materialType != null and materialType != ''"> and material_type = #{materialType}</if>
<if test="materialDescribe != null and materialDescribe != ''"> and material_describe = #{materialDescribe}</if>
<if test="materialUnit != null and materialUnit != ''"> and material_unit = #{materialUnit}</if>
<if test="materialBrand != null and materialBrand != ''"> and material_brand = #{materialBrand}</if>
<if test="actualScrapQuantity != null "> and actual_scrap_quantity = #{actualScrapQuantity}</if>
<if test="scrapType != null and scrapType != ''"> and scrap_type = #{scrapType}</if>
@ -69,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectWarehouseInventoryReportDamageChildVo"/>
where report_damage_child_id = #{reportDamageChildId}
</select>
<select id="selectWarehouseInventoryReportDamageChildByCode" parameterType="Long" resultMap="WarehouseInventoryReportDamageChildResult">
<select id="selectWarehouseInventoryReportDamageChildByCode" parameterType="String" resultMap="WarehouseInventoryReportDamageChildResult">
<include refid="selectWarehouseInventoryReportDamageChildVo"/>
where report_damage_code = #{reportDamageCode}
</select>
@ -83,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialName != null">material_name,</if>
<if test="materialType != null">material_type,</if>
<if test="materialDescribe != null">material_describe,</if>
<if test="materialUnit != null">material_unit,</if>
<if test="materialBrand != null">material_brand,</if>
<if test="actualScrapQuantity != null">actual_scrap_quantity,</if>
<if test="scrapType != null">scrap_type,</if>
@ -109,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialName != null">#{materialName},</if>
<if test="materialType != null">#{materialType},</if>
<if test="materialDescribe != null">#{materialDescribe},</if>
<if test="materialUnit != null">#{materialUnit},</if>
<if test="materialBrand != null">#{materialBrand},</if>
<if test="actualScrapQuantity != null">#{actualScrapQuantity},</if>
<if test="scrapType != null">#{scrapType},</if>
@ -139,6 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialName != null">material_name = #{materialName},</if>
<if test="materialType != null">material_type = #{materialType},</if>
<if test="materialDescribe != null">material_describe = #{materialDescribe},</if>
<if test="materialUnit != null">material_unit = #{materialUnit},</if>
<if test="materialBrand != null">material_brand = #{materialBrand},</if>
<if test="actualScrapQuantity != null">actual_scrap_quantity = #{actualScrapQuantity},</if>
<if test="scrapType != null">scrap_type = #{scrapType},</if>

317
ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/add.html

@ -21,7 +21,7 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">申请部门:</label>
<div class="col-sm-8">
<input name="applyDept" class="form-control" type="text" required>
<select id="applyDept" name="applyDept" class="form-control" type="text" required disabled></select>
</div>
</div>
<div class="form-group">
@ -34,11 +34,17 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否关联生产单号:</label>
<label class="col-sm-3 control-label is-required">是否关联生产单号:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('yes_or_no')}">
<input type="radio" th:id="${'whetherMakeNo_' + dict.dictCode}" name="whetherMakeNo" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'whetherMakeNo_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
<!-- <div class="radio-box" th:each="dict : ${@dict.getType('yes_or_no')}">-->
<!-- <input type="radio" th:id="${'whetherMakeNo_' + dict.dictCode}" name="whetherMakeNo" th:value="${dict.dictValue}" th:checked="${dict.default}">-->
<!-- <label th:for="${'whetherMakeNo_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>-->
<!-- </div>-->
<div class="radio-inline">
<label><input type="radio" name="whetherMakeNo" value="0" checked></label>
</div>
<div class="radio-inline">
<label><input type="radio" name="whetherMakeNo" value="1"></label>
</div>
</div>
</div>
@ -48,30 +54,6 @@
<input name="makeNo" class="form-control" type="text" required>
</div>
</div>
<!-- <div class="form-group">
<label class="col-sm-3 control-label">料号:</label>
<div class="col-sm-8">
<input name="materialNo" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料名称:</label>
<div class="col-sm-8">
<input name="materialName" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料数合计:</label>
<div class="col-sm-8">
<input name="materialTotal" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">数量合计:</label>
<div class="col-sm-8">
<input name="numTotal" class="form-control" type="text">
</div>
</div> -->
<div class="form-group">
<label class="col-sm-3 control-label is-required">仓库名称:</label>
<div class="col-sm-8">
@ -81,16 +63,16 @@
</div>
</div>
<div class="form-group is-required">
<label class="col-sm-3 control-label">仓库ID:</label>
<label class="col-sm-3 control-label is-required">仓库ID:</label>
<div class="col-sm-8">
<input name="warehouseCode" class="form-control" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库存放地址:</label>
<label class="col-sm-3 control-label is-required">仓库存放地址:</label>
<div class="col-sm-8">
<input name="warehouseStoreAddress" class="form-control" type="text">
<input name="warehouseStoreAddress" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
@ -133,60 +115,101 @@
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]];
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-inventoryReportDamage-add').serialize());
}
}
var options = {
id : 'bootstrap-table-reportDamage-child',
modalName: "仓库库存报损物料信息",
columns: [
{checkbox: true},
{title: '库存报损id', field: 'reportDamageChildId', visible: false},
{title: '报损单号', field: 'reportDamageCode',},
{title: '料号', field: 'materialNo',},
{title: '图片', field: 'materialPhotourl',},
{title: '物料名称', field: 'materialName',},
{title: '物料类型', field: 'materialType',},
{title: '描述', field: 'materialDescribe',},
{title: '品牌', field: 'materialBrand',},
{title: '实际报废数量', field: 'actualScrapQuantity',},
{title: '报废类型', field: 'scrapType',},
{title: '报废明细', field: 'scrapDetail',},
{title: '品质判定', field: 'qualityAssessment',},
{title: '预估价值(RMB)', field: 'estimatedValueRmb',},
{title: '责任单位', field: 'responsibleUnit',},
{title: '备注', field: 'remark',},
{title: '关联生产单号', field: 'makeNo',},
{title: '仓库ID', field: 'warehouseCode',},
{title: '仓库名称', field: 'warehouseName',},
{title: '仓库存放地址', field: 'warehouseStoreAddress',},
{title: '申请部门ID', field: 'applyDeptId',},
{title: '申请部门', field: 'applyDept',},
{title: '操作', align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-edit"></i>删除</a> ');
return actions.join('');
var warehouseInventoryReportDamage = {
warehouseInventoryReportDamageChildList: []
};
$("select[name='applyDept']").removeAttr("disabled");
warehouseInventoryReportDamage.applyDept = $("select[name='applyDept']").val();
warehouseInventoryReportDamage.applyTime = $("input[name='applyTime']").val();
var whetherMakeNo = $("input[name='whetherMakeNo']:checked").val();
warehouseInventoryReportDamage.whetherMakeNo = whetherMakeNo;
if(whetherMakeNo === "1"){
var makeNo = $("input[name='makeNo']").val();
warehouseInventoryReportDamage.makeNo = makeNo;
}
warehouseInventoryReportDamage.warehouseName = $("select[name='warehouseName']").val();
warehouseInventoryReportDamage.warehouseCode = $("input[name='warehouseCode']").val();
warehouseInventoryReportDamage.warehouseStoreAddress = $("input[name='warehouseStoreAddress']").val();
warehouseInventoryReportDamage.remark = $("area[name='remark']").val();
var rows = $('#bootstrap-table-reportDamage-child').bootstrapTable('getData');
// 检查表格数据是否为空
if (rows.length === 0) {
$.modal.alertWarning("请至少添加一条物料信息再保存!");
return;
} else {
warehouseInventoryReportDamage.materialTotal = rows.length;
for (var i = 0; i < rows.length; i++) {
var DamageChild = {
materialNo: rows[i].materialNo,
materialName: rows[i].materialName,
materialType: rows[i].materialType,
materialDescribe: rows[i].materialDescribe,
materialBrand: rows[i].materialBrand,
materialUnit: rows[i].materialUnit,
materialPhotourl: rows[i].materialPhotourl,
actualScrapQuantity: rows[i].actualScrapQuantity,
scrapType: rows[i].scrapType,
scrapDetail: rows[i].scrapDetail,
qualityAssessment: rows[i].qualityAssessment,
estimatedValueRmb: rows[i].estimatedValueRmb,
responsibleUnit: rows[i].responsibleUnit,
remark: rows[i].remark,
};
// console.log(DamageChild);
warehouseInventoryReportDamage.warehouseInventoryReportDamageChildList.push(DamageChild);
}
}
]
};
$.table.init(options);
console.log(warehouseInventoryReportDamage);
$.operate.saveJson(prefix+"/add",JSON.stringify(warehouseInventoryReportDamage));
}
}
function insertRow() {
var url = ctx + 'warehouse/inventoryCheck/materialSelect';
var options = {
title: '选择物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
var ifMakeNo = $("input[name='whetherMakeNo']:checked").val();
if(ifMakeNo === "1"){
var makeNo = $("input[name='makeNo']").val();
if(!makeNo){
$.modal.alertWarning("请输入生产单号!")
}else{
var url = prefix + '/materialInMakeOrderSelect/' + makeNo;
var options = {
title: '选择物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
}else{
var url = ctx + 'warehouse/inventoryCheck/materialSelect';
var options = {
title: '选择物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
}
function doSubmit(index, layero,uniqueId){
console.log(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);
var rows = $("#bootstrap-table-reportDamage-child").bootstrapTable('getData');
if(rows.length > 0){
for(var i=0;i<rows.length;i++){
var data = rows[i];
if(data.materialNo == rowData.materialNo){
$.modal.alertError("不能选择已添加过的相同物料");
return;
}
};
insertTable(rowData);
}else{
insertTable(rowData);
}
layer.close(index);
}
function insertTable(rowData){
$("#bootstrap-table-reportDamage-child").bootstrapTable('insertRow', {
index:1,
row: {
@ -197,40 +220,123 @@
materialPhotourl: rowData.materialPhotourl,
materialDescribe: rowData.materialDescribe,
materialUnit: rowData.materialUnit,
inventoryCheckNum : "",
inventoryAccountNum : "",
warehouseStoreAddress : "",
batchNumber : "",
actualScrapQuantity: "",
scrapType: "",
scrapDetail: "",
qualityAssessment: "",
estimatedValueRmb: "",
responsibleUnit: "",
remark : ""
}
})
layer.close(index);
}
// 逻辑删除前端的一行数据
function removeRow(materialNo){
$("#bootstrap-table").bootstrapTable('remove', {field: 'materialNo', values: materialNo})
$("#bootstrap-table-reportDamage-child").bootstrapTable('remove', {field: 'materialNo', values: materialNo})
}
$(function () {
var options = {
id : 'bootstrap-table-reportDamage-child',
modalName: "仓库库存报损物料信息",
columns: [
{title: '库存报损id', field: 'reportDamageChildId', visible: false},
{title: '报损单号', field: 'reportDamageCode',visible: false},
{title: '料号', field: 'materialNo',},
{title: '图片', field: 'materialPhotourl',},
{title: '物料名称', field: 'materialName',},
{title: '物料类型', field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{title: '描述', field: 'materialDescribe',},
{title: '品牌', field: 'materialBrand',},
{title: '单位', field: 'materialUnit',},
{title: '实际报废数量', field: 'actualScrapQuantity',
editable:{
type: 'text',
validate: function(v) {
if (!v) return '输入不能为空';
if (isNaN(v)) return '输入错误';
}
}
},
{title: '报废类型', field: 'scrapType',
editable:{
type: 'text',
}
},
{title: '报废明细', field: 'scrapDetail',
editable:{
type: 'text',
}
},
{title: '品质判定', field: 'qualityAssessment',
editable:{
type: 'text',
}
},
{title: '预估价值(RMB)', field: 'estimatedValueRmb',
editable:{
type: 'text',
}
},
{title: '责任单位', field: 'responsibleUnit',
editable:{
type: 'text',
}
},
{title: '备注', field: 'remark',
editable:{
type: 'text',
}
},
{
title: '报损报告',
field: 'damageReportUrl',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" ><i class="fa fa-plus"></i>上传</a> ');
return actions.join('');
}
},
{title: '操作', align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-edit"></i>删除</a> ');
return actions.join('');
}
}
]
};
$.table.init(options);
loadWarehouseCodes();
changeWhetherMakeNo();
});
//单选改变是否关联生产单号显示关联生产单号输入框
$("input[name='whetherMakeNo']").change(function () {
changeWhetherMakeNo();
getDeptName();
//单选改变是否关联生产单号显示关联生产单号输入框
$("input[name='whetherMakeNo']").change(function () {
changeWhetherMakeNo();
});
$('#stockNameSelct').on('select2:select', function(e) {
var data = e.params.data;
$("input[name='warehouseCode']").val(data.stockNo);
$("input[name='warehouseStoreAddress']").val(data.stockAddress);
});
});
//根据是否关联生产单号显示关联生产单号输入框
function changeWhetherMakeNo() {
$("#makeNoInput").display = function () {
var whetherMakeNo = $("input[name='whetherMakeNo']:checked").val();
if (whetherMakeNo == 1) {
$("#makeNoInput").show();
} else {
$("#makeNoInput").hide();
}
};
var whetherMakeNo = $("input[name='whetherMakeNo']:checked").val();
// console.log(whetherMakeNo);
if (whetherMakeNo === "1") {
$("#makeNoInput").show();
} else {
$("#makeNoInput").hide();
}
}
$("input[name='applyTime']").datetimepicker({
format: "yyyy-mm-dd",
@ -261,7 +367,7 @@
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,};
var option = {id: data[i].stockName, text: data[i].stockName,stockNo: data[i].stockNO,stockAddress: data[i].stockAddr};
options.push(option);
}
var moreDataAvaliable = (params.page * 30) < data.total_count;
@ -276,11 +382,18 @@
}
});
}
$('#stockNameSelct').on('select2:select', function(e) {
var data = e.params.data;
$("input[name='warehouseCode']").val(data.stockNO);
$("input[name='warehouseStoreAddress']").val(data.stockAddress);
});
function getDeptName(){
$.ajax({
url: prefix + "/getUserDeptName",
type: "get",
dataType: "json",
success: function (result) {
console.log(result.data);
$("select[name='applyDept']").append($('<option></option>').val(result.data).html(result.data));
}
});
}
</script>
</body>
</html>

153
ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/detail.html

@ -14,14 +14,14 @@
<input name="reportDamageCode" th:field="*{reportDamageCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">报废类型:</label>
<div class="col-sm-8">
<select name="warehousScrapType" class="form-control m-b" th:with="type=${@dict.getType('warehous_scrap_type')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehousScrapType}"></option>
</select>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label">报废类型:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <select name="warehousScrapType" class="form-control m-b" th:with="type=${@dict.getType('warehous_scrap_type')}" disabled>-->
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehousScrapType}"></option>-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">关联生产单号:</label>
<div class="col-sm-8">
@ -52,18 +52,6 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">料号:</label>
<div class="col-sm-8">
<input name="materialNo" th:field="*{materialNo}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料名称:</label>
<div class="col-sm-8">
<input name="materialName" th:field="*{materialName}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料数合计:</label>
<div class="col-sm-8">
@ -105,10 +93,7 @@
<div class="container">
<div class="form-row">
<div class="btn-group-sm" id="toolbar" role="group">
<span>选择物料</span>
<a class="btn btn-success" onclick="insertRow()">
<i class="fa fa-plus"></i> 选择物料
</a>
<span>报损物料信息</span>
</div>
</div>
<div class="row">
@ -129,84 +114,56 @@
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]];
var warehousScrapTypeDatas = [[${@dict.getType('warehous_scrap_type')}]];
var prefix = ctx + "warehouse/inventoryReportDamage";
$("#form-inventoryReportDamage-edit").validate({focusCleanup: true});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-inventoryReportDamage-edit').serialize());
}
}
var options = {
id : 'bootstrap-table-reportDamage-child',
modalName: "仓库库存报损物料信息",
columns: [
{checkbox: true},
{title: '库存报损id', field: 'reportDamageChildId', visible: false},
{title: '报损单号', field: 'reportDamageCode',},
{title: '料号', field: 'materialNo',},
{title: '图片', field: 'materialPhotourl',},
{title: '物料名称', field: 'materialName',},
{title: '物料类型', field: 'materialType',},
{title: '描述', field: 'materialDescribe',},
{title: '品牌', field: 'materialBrand',},
{title: '实际报废数量', field: 'actualScrapQuantity',},
{title: '报废类型', field: 'scrapType',},
{title: '报废明细', field: 'scrapDetail',},
{title: '品质判定', field: 'qualityAssessment',},
{title: '预估价值(RMB)', field: 'estimatedValueRmb',},
{title: '责任单位', field: 'responsibleUnit',},
{title: '备注', field: 'remark',},
{title: '关联生产单号', field: 'makeNo',},
{title: '仓库ID', field: 'warehouseCode',},
{title: '仓库名称', field: 'warehouseName',},
{title: '仓库存放地址', field: 'warehouseStoreAddress',},
{title: '申请部门ID', field: 'applyDeptId',},
{title: '申请部门', field: 'applyDept',},
{title: '操作', align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-edit"></i>删除</a> ');
return actions.join('');
}
}
]
};
$.table.init(options);
function insertRow() {
var url = ctx + 'warehouse/inventoryCheck/materialSelect';
$(function () {
var options = {
title: '选择物料',
url: url,
callBack: doSubmit
id : 'bootstrap-table-reportDamage-child',
modalName: "仓库库存报损物料信息",
data: [[${warehouseInventoryReportDamage.warehouseInventoryReportDamageChildList}]],
columns: [
{title: '库存报损id', field: 'reportDamageChildId', visible: false},
{title: '报损单号', field: 'reportDamageCode',visible: false},
{title: '料号', field: 'materialNo',},
{title: '图片', field: 'materialPhotourl',},
{title: '物料名称', field: 'materialName',},
{title: '物料类型', field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{title: '描述', field: 'materialDescribe',},
{title: '品牌', field: 'materialBrand',},
{title: '单位', field: 'materialUnit',},
{title: '实际报废数量', field: 'actualScrapQuantity',
},
{title: '报废类型', field: 'scrapType',
},
{title: '报废明细', field: 'scrapDetail',
},
{title: '品质判定', field: 'qualityAssessment',
},
{title: '预估价值(RMB)', field: 'estimatedValueRmb',
},
{title: '责任单位', field: 'responsibleUnit',
},
{title: '备注', field: 'remark',
},
{
title: '报损报告',
field: 'damageReportUrl',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" ><i class="fa fa-plus"></i>报告</a> ');
return actions.join('');
}
},
]
};
$.modal.openOptions(options);
}
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-reportDamage-child").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);
}
$.table.init(options);
});
// 逻辑删除前端的一行数据
function removeRow(materialNo){
$("#bootstrap-table").bootstrapTable('remove', {field: 'materialNo', values: materialNo})
}
$("input[name='applyTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",

6
ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/inventoryReportDamage.html

@ -102,23 +102,21 @@
{title: '报损单号', field: 'reportDamageCode',},
{title: '申请部门', field: 'applyDept',},
{title: '申请时间', field: 'applyTime',},
{title: '报废类型', field: 'warehousScrapType',
{title: '报废类型', field: 'warehousScrapType',visible: false,
formatter: function(value, row, index) {return $.table.selectDictLabel(warehousScrapTypeDatas, value);}
},
{title: '是否关联生产单号', field: 'whetherMakeNo',
formatter: function(value, row, index) {return $.table.selectDictLabel(whetherMakeNoDatas, value);}
},
{title: '生产单号', field: 'makeNo',},
{title: '料号', field: 'materialNo',},
{title: '物料名称', field: 'materialName',},
{title: '物料数合计', field: 'materialTotal',},
{title: '数量合计', field: 'numTotal',},
{title: '仓库ID', field: 'warehouseCode',},
{title: '仓库名称', field: 'warehouseName',},
{title: '仓库存放地址', field: 'warehouseStoreAddress',},
{title: '备注', field: 'remark',},
{title: '录入时间', field: 'createTime',},
{title: '录入人', field: 'createBy',},
{title: '录入时间', field: 'createTime',},
{title: '更新人', field: 'updateBy',},
{title: '操作', align: 'center',
formatter: function(value, row, index) {

Loading…
Cancel
Save