Browse Source

[update]:生产订单-生产入库-成品物料添加设备履历

dev
youjianchi 7 months ago
parent
commit
f3e7f5a3ec
  1. 153
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpEquipmentResume.java
  2. 10
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpInboundOrderDetail.java
  3. 77
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpEquipmentResumeMapper.java
  4. 75
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpEquipmentResumeService.java
  5. 134
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpEquipmentResumeServiceImpl.java
  6. 20
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpInboundOrderServiceImpl.java
  7. 28
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java
  8. 28
      ruoyi-admin/src/main/java/com/ruoyi/system/dto/SysEquipMaterialDto.java
  9. 119
      ruoyi-admin/src/main/resources/mapper/erp/ErpEquipmentResumeMapper.xml
  10. 61
      ruoyi-admin/src/main/resources/static/ruoyi/js/common.js
  11. 215
      ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html
  12. 108
      ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html

153
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpEquipmentResume.java

@ -0,0 +1,153 @@
package com.ruoyi.erp.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 设备履历对象 erp_equipment_resume
*
* @author ruoyi
* @date 2024-04-27
*/
public class ErpEquipmentResume extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 删除标志(0代表存在 1代表删除) */
private String delFlag;
/** 生产订单号 */
@Excel(name = "生产订单号")
private String makeNo;
/** 关联销售订单号 */
@Excel(name = "关联销售订单号")
private String saleNo;
/** 料号 */
@Excel(name = "料号")
private String materialNo;
/** 入库单号 */
@Excel(name = "入库单号")
private String inboundOrderNo;
/** 出货设备id */
@Excel(name = "出货设备id")
private String equipmentId;
/** 设备型号 */
@Excel(name = "设备型号")
private String equipmentModel;
/** 流水号 */
@Excel(name = "流水号")
private String serialNo;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
public void setMakeNo(String makeNo)
{
this.makeNo = makeNo;
}
public String getMakeNo()
{
return makeNo;
}
public void setSaleNo(String saleNo)
{
this.saleNo = saleNo;
}
public String getSaleNo()
{
return saleNo;
}
public void setMaterialNo(String materialNo)
{
this.materialNo = materialNo;
}
public String getMaterialNo()
{
return materialNo;
}
public void setInboundOrderNo(String inboundOrderNo)
{
this.inboundOrderNo = inboundOrderNo;
}
public String getInboundOrderNo()
{
return inboundOrderNo;
}
public void setEquipmentId(String equipmentId)
{
this.equipmentId = equipmentId;
}
public String getEquipmentId()
{
return equipmentId;
}
public void setEquipmentModel(String equipmentModel)
{
this.equipmentModel = equipmentModel;
}
public String getEquipmentModel()
{
return equipmentModel;
}
public void setSerialNo(String serialNo)
{
this.serialNo = serialNo;
}
public String getSerialNo()
{
return serialNo;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("makeNo", getMakeNo())
.append("saleNo", getSaleNo())
.append("materialNo", getMaterialNo())
.append("inboundOrderNo", getInboundOrderNo())
.append("equipmentId", getEquipmentId())
.append("equipmentModel", getEquipmentModel())
.append("serialNo", getSerialNo())
.toString();
}
}

10
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpInboundOrderDetail.java

@ -46,6 +46,8 @@ public class ErpInboundOrderDetail extends BaseEntity
@Excel(name = "加工费单价")
private BigDecimal processFeeUnitPrice;
private String equipResumeArrayStr;
public void setId(Long id)
{
this.id = id;
@ -119,6 +121,14 @@ public class ErpInboundOrderDetail extends BaseEntity
return processFeeUnitPrice;
}
public String getEquipResumeArrayStr() {
return equipResumeArrayStr;
}
public void setEquipResumeArrayStr(String equipResumeArrayStr) {
this.equipResumeArrayStr = equipResumeArrayStr;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

77
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpEquipmentResumeMapper.java

@ -0,0 +1,77 @@
package com.ruoyi.erp.mapper;
import java.util.List;
import com.ruoyi.erp.domain.ErpEquipmentResume;
/**
* 设备履历Mapper接口
*
* @author ruoyi
* @date 2024-04-27
*/
public interface ErpEquipmentResumeMapper
{
/**
* 查询设备履历
*
* @param id 设备履历ID
* @return 设备履历
*/
public ErpEquipmentResume selectErpEquipmentResumeById(Long id);
/**
* 查询设备履历列表
*
* @param erpEquipmentResume 设备履历
* @return 设备履历集合
*/
public List<ErpEquipmentResume> selectErpEquipmentResumeList(ErpEquipmentResume erpEquipmentResume);
/**
* 新增设备履历
*
* @param erpEquipmentResume 设备履历
* @return 结果
*/
public int insertErpEquipmentResume(ErpEquipmentResume erpEquipmentResume);
/**
* 修改设备履历
*
* @param erpEquipmentResume 设备履历
* @return 结果
*/
public int updateErpEquipmentResume(ErpEquipmentResume erpEquipmentResume);
/**
* 删除设备履历
*
* @param id 设备履历ID
* @return 结果
*/
public int deleteErpEquipmentResumeById(Long id);
/**
* 批量删除设备履历
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteErpEquipmentResumeByIds(String[] ids);
/**
* 作废设备履历
*
* @param id 设备履历ID
* @return 结果
*/
public int cancelErpEquipmentResumeById(Long id);
/**
* 恢复设备履历
*
* @param id 设备履历ID
* @return 结果
*/
public int restoreErpEquipmentResumeById(Long id);
}

75
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpEquipmentResumeService.java

@ -0,0 +1,75 @@
package com.ruoyi.erp.service;
import java.util.List;
import com.ruoyi.erp.domain.ErpEquipmentResume;
/**
* 设备履历Service接口
*
* @author ruoyi
* @date 2024-04-27
*/
public interface IErpEquipmentResumeService
{
/**
* 查询设备履历
*
* @param id 设备履历ID
* @return 设备履历
*/
public ErpEquipmentResume selectErpEquipmentResumeById(Long id);
/**
* 查询设备履历列表
*
* @param erpEquipmentResume 设备履历
* @return 设备履历集合
*/
public List<ErpEquipmentResume> selectErpEquipmentResumeList(ErpEquipmentResume erpEquipmentResume);
/**
* 新增设备履历
*
* @param erpEquipmentResume 设备履历
* @return 结果
*/
public int insertErpEquipmentResume(ErpEquipmentResume erpEquipmentResume);
/**
* 修改设备履历
*
* @param erpEquipmentResume 设备履历
* @return 结果
*/
public int updateErpEquipmentResume(ErpEquipmentResume erpEquipmentResume);
/**
* 批量删除设备履历
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteErpEquipmentResumeByIds(String ids);
/**
* 删除设备履历信息
*
* @param id 设备履历ID
* @return 结果
*/
public int deleteErpEquipmentResumeById(Long id);
/**
* 作废设备履历
* @param id 设备履历ID
* @return
*/
int cancelErpEquipmentResumeById(Long id);
/**
* 恢复设备履历
* @param id 设备履历ID
* @return
*/
int restoreErpEquipmentResumeById(Long id);
}

134
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpEquipmentResumeServiceImpl.java

@ -0,0 +1,134 @@
package com.ruoyi.erp.service.impl;
import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.erp.mapper.ErpEquipmentResumeMapper;
import com.ruoyi.erp.domain.ErpEquipmentResume;
import com.ruoyi.erp.service.IErpEquipmentResumeService;
import com.ruoyi.common.core.text.Convert;
/**
* 设备履历Service业务层处理
*
* @author ruoyi
* @date 2024-04-27
*/
@Service
public class ErpEquipmentResumeServiceImpl implements IErpEquipmentResumeService
{
@Autowired
private ErpEquipmentResumeMapper erpEquipmentResumeMapper;
@Autowired
private RedisCache redisCache;
/**
* 查询设备履历
*
* @param id 设备履历ID
* @return 设备履历
*/
@Override
public ErpEquipmentResume selectErpEquipmentResumeById(Long id)
{
return erpEquipmentResumeMapper.selectErpEquipmentResumeById(id);
}
/**
* 查询设备履历列表
*
* @param erpEquipmentResume 设备履历
* @return 设备履历
*/
@Override
public List<ErpEquipmentResume> selectErpEquipmentResumeList(ErpEquipmentResume erpEquipmentResume)
{
return erpEquipmentResumeMapper.selectErpEquipmentResumeList(erpEquipmentResume);
}
/**
* 新增设备履历
*
* @param erpEquipmentResume 设备履历
* @return 结果
*/
@Override
public int insertErpEquipmentResume(ErpEquipmentResume erpEquipmentResume)
{
String loginName = ShiroUtils.getLoginName();
erpEquipmentResume.setCreateBy(loginName);
erpEquipmentResume.setCreateTime(DateUtils.getNowDate());
// 生成编号,年月日规则
String billNo = redisCache.generateBillNo("SB");
erpEquipmentResume.setEquipmentId(billNo);
return erpEquipmentResumeMapper.insertErpEquipmentResume(erpEquipmentResume);
}
/**
* 修改设备履历
*
* @param erpEquipmentResume 设备履历
* @return 结果
*/
@Override
public int updateErpEquipmentResume(ErpEquipmentResume erpEquipmentResume)
{
String loginName = ShiroUtils.getLoginName();
erpEquipmentResume.setUpdateBy(loginName);
erpEquipmentResume.setUpdateTime(DateUtils.getNowDate());
return erpEquipmentResumeMapper.updateErpEquipmentResume(erpEquipmentResume);
}
/**
* 删除设备履历对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteErpEquipmentResumeByIds(String ids)
{
return erpEquipmentResumeMapper.deleteErpEquipmentResumeByIds(Convert.toStrArray(ids));
}
/**
* 删除设备履历信息
*
* @param id 设备履历ID
* @return 结果
*/
@Override
public int deleteErpEquipmentResumeById(Long id)
{
return erpEquipmentResumeMapper.deleteErpEquipmentResumeById(id);
}
/**
* 作废设备履历
*
* @param id 设备履历ID
* @return 结果
*/
@Override
public int cancelErpEquipmentResumeById(Long id)
{
return erpEquipmentResumeMapper.cancelErpEquipmentResumeById(id);
}
/**
* 恢复设备履历信息
*
* @param id 设备履历ID
* @return 结果
*/
@Override
public int restoreErpEquipmentResumeById(Long id)
{
return erpEquipmentResumeMapper.restoreErpEquipmentResumeById(id);
}
}

20
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpInboundOrderServiceImpl.java

@ -3,10 +3,16 @@ package com.ruoyi.erp.service.impl;
import java.util.List;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.erp.domain.ErpEquipmentResume;
import com.ruoyi.erp.domain.ErpInboundOrderDetail;
import com.ruoyi.erp.service.IErpEquipmentResumeService;
import com.ruoyi.erp.service.IErpInboundOrderDetailService;
import com.ruoyi.system.domain.SysMakeorderPickDetail;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,6 +41,9 @@ public class ErpInboundOrderServiceImpl implements IErpInboundOrderService
@Autowired
private IErpInboundOrderDetailService inboundOrderDetailService;
@Autowired
private IErpEquipmentResumeService erpEquipmentResumeService;
/**
* 查询入库单
*
@ -83,6 +92,17 @@ public class ErpInboundOrderServiceImpl implements IErpInboundOrderService
ErpInboundOrderDetail inboundOrderDetail = inboundDetails.get(i);
inboundOrderDetail.setInboundOrderNo(billNo);
inboundOrderDetailService.insertErpInboundOrderDetail(inboundOrderDetail);
String equipResumeArrayStr = inboundOrderDetail.getEquipResumeArrayStr();
if(StringUtils.isNotBlank(equipResumeArrayStr)){
List<ErpEquipmentResume> equipmentResumes = JSON.parseObject(equipResumeArrayStr, new TypeReference<List<ErpEquipmentResume>>(){});
equipmentResumes.forEach(t->{
t.setInboundOrderNo(billNo);
t.setMakeNo(erpInboundOrder.getMakeNo());
t.setSaleNo(erpInboundOrder.getSaleNo());
t.setMaterialNo(inboundOrderDetail.getMaterialNo());
erpEquipmentResumeService.insertErpEquipmentResume(t);
});
}
}
}

28
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java

@ -10,12 +10,18 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.domain.SysMakeorderDept;
import com.ruoyi.system.domain.SysSalesOrderChild;
import com.ruoyi.system.dto.SysEquipMaterialDto;
import com.ruoyi.system.dto.SysMakeorderDeptDto;
import com.ruoyi.system.service.ISysMakeOrderService;
import com.ruoyi.system.service.ISysMakeorderDeptService;
import com.ruoyi.system.service.ISysSalesOrderChildService;
import com.ruoyi.system.service.ISysSalesOrderService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@ -42,6 +48,9 @@ public class SysMakeOrderController extends BaseController
@Autowired
private ISysMakeorderDeptService makeorderDeptService;
@Autowired
private ISysSalesOrderChildService salesOrderChildService;
@GetMapping("/test")
public AjaxResult test(){
sysMakeOrderService.generateMakeOrderBySalesOrderCode("XS20240411007");
@ -126,6 +135,25 @@ public class SysMakeOrderController extends BaseController
return prefix + "/addProduceInbound";
}
/**
* 跳转添加设备履历
*/
@GetMapping("/addEquipmentResume")
public String addEquipmentResume(@RequestParam("curIndex")Integer curIndex
,@RequestParam("makeNo")String makeNo
,@RequestParam("saleNo")String saleNo
,@RequestParam("materialNo")String materialNo, ModelMap mmap)
{
SysEquipMaterialDto equipMaterialDto = new SysEquipMaterialDto();
mmap.put("currentUser", ShiroUtils.getSysUser());
SysSalesOrderChild salesOrderChild = salesOrderChildService.selectOneByQuoteIdAndMaterialCode(saleNo, materialNo);
BeanUtils.copyProperties(salesOrderChild,equipMaterialDto);
equipMaterialDto.setMakeNo(makeNo);
equipMaterialDto.setCurIndex(curIndex);
mmap.put("equipMaterial", equipMaterialDto);
return prefix + "/addEquipmentResume";
}
/**
* 部门评审

28
ruoyi-admin/src/main/java/com/ruoyi/system/dto/SysEquipMaterialDto.java

@ -0,0 +1,28 @@
package com.ruoyi.system.dto;
import com.ruoyi.erp.domain.ErpEquipmentResume;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author xiguniang
* @description 设备履历料号
* @date 2024/4/28 19:12
*/
@Data
public class SysEquipMaterialDto implements Serializable {
private static final long serialVersionUID = -3491668293466029506L;
private String quoteId;
private String materialCode;
private String materialName;
private String materialType;
private String processMethod;
private String brand;
private String photoUrl;
private String unit;
private String describe;
private String makeNo;
private Integer curIndex;
}

119
ruoyi-admin/src/main/resources/mapper/erp/ErpEquipmentResumeMapper.xml

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.erp.mapper.ErpEquipmentResumeMapper">
<resultMap type="ErpEquipmentResume" id="ErpEquipmentResumeResult">
<result property="id" column="id" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="makeNo" column="make_no" />
<result property="saleNo" column="sale_no" />
<result property="materialNo" column="material_no" />
<result property="inboundOrderNo" column="inbound_order_no" />
<result property="equipmentId" column="equipment_id" />
<result property="equipmentModel" column="equipment_model" />
<result property="serialNo" column="serial_no" />
</resultMap>
<sql id="selectErpEquipmentResumeVo">
select a.id, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.make_no, a.sale_no, a.material_no, a.inbound_order_no, a.equipment_id, a.equipment_model, a.serial_no from erp_equipment_resume a
</sql>
<select id="selectErpEquipmentResumeList" parameterType="ErpEquipmentResume" resultMap="ErpEquipmentResumeResult">
<include refid="selectErpEquipmentResumeVo"/>
<where>
<if test="makeNo != null and makeNo != ''"> and a.make_no = #{makeNo}</if>
<if test="saleNo != null and saleNo != ''"> and a.sale_no = #{saleNo}</if>
<if test="materialNo != null and materialNo != ''"> and a.material_no = #{materialNo}</if>
<if test="inboundOrderNo != null and inboundOrderNo != ''"> and a.inbound_order_no = #{inboundOrderNo}</if>
<if test="equipmentId != null and equipmentId != ''"> and a.equipment_id = #{equipmentId}</if>
<if test="equipmentModel != null and equipmentModel != ''"> and a.equipment_model = #{equipmentModel}</if>
<if test="serialNo != null and serialNo != ''"> and a.serial_no = #{serialNo}</if>
</where>
</select>
<select id="selectErpEquipmentResumeById" parameterType="Long" resultMap="ErpEquipmentResumeResult">
<include refid="selectErpEquipmentResumeVo"/>
where a.id = #{id}
</select>
<insert id="insertErpEquipmentResume" parameterType="ErpEquipmentResume" useGeneratedKeys="true" keyProperty="id">
insert into erp_equipment_resume
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="makeNo != null">make_no,</if>
<if test="saleNo != null">sale_no,</if>
<if test="materialNo != null">material_no,</if>
<if test="inboundOrderNo != null">inbound_order_no,</if>
<if test="equipmentId != null">equipment_id,</if>
<if test="equipmentModel != null">equipment_model,</if>
<if test="serialNo != null">serial_no,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="makeNo != null">#{makeNo},</if>
<if test="saleNo != null">#{saleNo},</if>
<if test="materialNo != null">#{materialNo},</if>
<if test="inboundOrderNo != null">#{inboundOrderNo},</if>
<if test="equipmentId != null">#{equipmentId},</if>
<if test="equipmentModel != null">#{equipmentModel},</if>
<if test="serialNo != null">#{serialNo},</if>
</trim>
</insert>
<update id="updateErpEquipmentResume" parameterType="ErpEquipmentResume">
update erp_equipment_resume
<trim prefix="SET" suffixOverrides=",">
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="makeNo != null">make_no = #{makeNo},</if>
<if test="saleNo != null">sale_no = #{saleNo},</if>
<if test="materialNo != null">material_no = #{materialNo},</if>
<if test="inboundOrderNo != null">inbound_order_no = #{inboundOrderNo},</if>
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
<if test="equipmentModel != null">equipment_model = #{equipmentModel},</if>
<if test="serialNo != null">serial_no = #{serialNo},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteErpEquipmentResumeById" parameterType="Long">
delete from erp_equipment_resume where id = #{id}
</delete>
<delete id="deleteErpEquipmentResumeByIds" parameterType="String">
delete from erp_equipment_resume where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="cancelErpEquipmentResumeById" parameterType="Long">
update erp_equipment_resume set del_flag = '1' where id = #{id}
</update>
<update id="restoreErpEquipmentResumeById" parameterType="Long">
update erp_equipment_resume set del_flag = '0' where id = #{id}
</update>
</mapper>

61
ruoyi-admin/src/main/resources/static/ruoyi/js/common.js

@ -404,6 +404,67 @@ var storage = {
// 主子表操作封装处理
var sub = {
editRow: function() {
var dataColumns = [];
for (var columnIndex = 0; columnIndex < table.options.columns.length; columnIndex++) {
if (table.options.columns[columnIndex].visible != false) {
dataColumns.push(table.options.columns[columnIndex]);
}
}
var params = new Array();
var data = $("#" + table.options.id).bootstrapTable('getData');
var count = data.length;
for (var dataIndex = 0; dataIndex < count; dataIndex++) {
var columns = $('#' + table.options.id + ' tr[data-index="' + dataIndex + '"] td:visible');
var obj = new Object();
for (var i = 0; i < columns.length; i++) {
var inputValue = $(columns[i]).find('input');
var selectValue = $(columns[i]).find('select');
var textareaValue = $(columns[i]).find('textarea');
var key = dataColumns[i].field;
if ($.common.isNotEmpty(inputValue.val())) {
obj[key] = inputValue.val();
} else if ($.common.isNotEmpty(selectValue.val())) {
obj[key] = selectValue.val();
} else if ($.common.isNotEmpty(textareaValue.val())) {
obj[key] = textareaValue.val();
} else {
if (key == "index" && $.common.isNotEmpty(data[dataIndex].index)) {
obj[key] = data[dataIndex].index;
} else {
obj[key] = "";
}
}
}
var item = data[dataIndex];
var extendObj = $.extend({}, item, obj);
params.push({ index: dataIndex, row: extendObj });
}
$("#" + table.options.id).bootstrapTable("updateRow", params);
},
delRow: function(column) {
sub.editRow();
var subColumn = $.common.isEmpty(column) ? "index" : column;
var ids = $.table.selectColumns(subColumn);
if (ids.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$("#" + table.options.id).bootstrapTable('remove', { field: subColumn, values: ids });
},
delRowByIndex: function(value, tableId) {
var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId;
sub.editRow();
$("#" + currentId).bootstrapTable('remove', { field: "index", values: [value] });
sub.editRow();
},
addRow: function(row, tableId) {
var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId;
table.set(currentId);
var count = $("#" + currentId).bootstrapTable('getData').length;
sub.editRow();
$("#" + currentId).bootstrapTable('insertRow', { index: count + 1, row: row });
},
editColumn: function() {
var dataColumns = [];
for (var columnIndex = 0; columnIndex < table.options.columns.length; columnIndex++) {

215
ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html

@ -0,0 +1,215 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('添加设备履历')" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal" id="form-equipMaterial-add" th:object="${equipMaterial}">
<input name="curIndex" th:field="*{curIndex}" type="hidden">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">生产订单号:</label>
<div class="col-sm-8">
<input readonly name="makeNo" th:field="*{makeNo}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">关联销售订单号:</label>
<div class="col-sm-8">
<input readonly name="saleNo" th:field="*{quoteId}" class="form-control" type="text">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">料号:</label>
<div class="col-sm-8">
<input readonly name="materialNo" th:field="*{materialCode}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">物料名称:</label>
<div class="col-sm-8">
<input readonly name="materialNo" th:field="*{materialName}" class="form-control" type="text">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">物料类型:</label>
<div class="col-sm-8">
<select disabled id="selectMaterialType" class="form-control m-b select2-multiple" th:field="*{materialType}" th:with="childList=${@category.getChildByCode('materialType')}">
<optgroup>
<option value="">请选择</option>
</optgroup>
<optgroup th:each="child: ${childList}" th:label="${child.name}">
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option>
</optgroup>
</select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">加工方式:</label>
<div class="col-sm-8">
<select disabled name="processMethod" class="form-control m-b" th:field="*{processMethod}" th:with="type=${@dict.getType('processMethod')}" required>
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">单位:</label>
<div class="col-sm-8">
<select disabled name="unit" class="form-control m-b" th:with="type=${@dict.getType('sys_unit_class')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{unit}"></option>
</select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">品牌:</label>
<div class="col-sm-8">
<input readonly name="brand" th:field="*{brand}" class="form-control" type="text">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">描述:</label>
<div class="col-sm-8">
<textarea readonly name="describe" class="form-control">[[*{describe}]]</textarea>
</div>
</div>
</div>
</div>
<div class="row">
<button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
<button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-1"></table>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var prefix = ctx + "erp/equipmentResume";
$(function(){
var options = {
id: 'bootstrap-sub-table-1',
pagination: false,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
sidePagination: "client",
columns: [{
checkbox: true
},
{
field: 'index',
align: 'center',
title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='equipResumes[%s].index' value='%s'>", index,$.table.serialNumber(index));
var columnId = $.common.sprintf("<input type='hidden' name='equipResumes[%s].id' value='%s'>", index, row.id);
return columnIndex + $.table.serialNumber(index) + columnId;
}
},
{
field: 'equipmentId',
align: 'center',
title: '出货设备id',
formatter: function(value, row, index) {
return '添加后系统自动生成';
}
},
{
field: 'equipmentModel',
align: 'center',
title: '设备型号',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control equipmentModel' type='text' name='equipResumes[%s].equipmentModel' value='%s'>", index, value);
return html;
}
},
{
field: 'serialNo',
align: 'center',
title: '流水号',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='equipResumes[%s].serialNo' value='%s'>", index, value);
return html;
}
},
{
field: 'producePic',
align: 'center',
title: '生产图片',
formatter: function(value, row, index) {
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
}
}]
};
$.table.init(options);
})
function addRow() {
var count = $("#bootstrap-sub-table-1").bootstrapTable('getData').length;
var row = {
index: $.table.serialNumber(count),
equipmentId: "",
equipmentModel: "",
serialNo: "",
producePic: "",
}
sub.addRow(row);
}
$("#form-equipMaterial-add").validate({
focusCleanup: true
});
/*function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-equipMaterial-add').serialize());
}
}*/
</script>
</body>
</html>

108
ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html

@ -164,12 +164,30 @@
},
{
field: 'currentNum',
title: '本次委内完成数',
title: '本次完成数',
formatter: function (value,row,index){
var curIndex = index;
// 物料类型是成品,通过添加设备履历表计算数量
if(row.materialType == 'chcpsb'){
return '<input readonly class = "form-control" data-id = "currentNum_'+curIndex+'" name="inboundDetails['+curIndex+'].currentNum">' +
'<input class = "form-control hidden" data-id = "equipResumeArrayStr_'+curIndex+'" name="inboundDetails['+curIndex+'].equipResumeArrayStr">';
}
return '<input class = "form-control" data-id = "currentNum_'+curIndex+'" name="inboundDetails['+curIndex+'].currentNum">';
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
// 物料类型是成品,添加设备履历表
if(row.materialType == 'chcpsb'){
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="addEquipmentResume(\'' + index + '\',\'' + row.materialCode + '\')">添加设备履历</a> ');
}
return actions.join('');
}
}
]
};
$.table.init(options);
@ -357,6 +375,94 @@
return curParams;
}
function addEquipmentResume(curIndex,materialCode){
var url = prefix + "/addEquipmentResume?makeNo="+$("#makeNo").val()+"&saleNo="+$("#saleNo").val()+"&materialNo="+materialCode+"&curIndex="+curIndex;
var options = {
title: '设备履历表',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero,uniqueId) {
debugger
var iframeWin = window[layero.find('iframe')[0]['name']];
// 行取不到
// var data = iframeWin.$('#bootstrap-sub-table-1').bootstrapTable('getData');
// alert(JSON.stringify(data));
// 取不到
// var options = iframeWin.$('#bootstrap-sub-table-1').bootstrapTable('getOptions');
// var data = options.data;
// alert(JSON.stringify(data));
var formData = iframeWin.$("#form-equipMaterial-add").serializeArray();
var formObj = serializeObject(formData);
var formObjStr = JSON.stringify(formObj);
alert(formObjStr);
// 关闭弹出框
layer.close(index);
var curIndex = formObj.curIndex;
if(formObj.equipResumes){
var currentNum = formObj.equipResumes.length;
var equipResumeArrayStr = JSON.stringify(formObj.equipResumes);
$('[data-id="currentNum_'+curIndex+'"]').val(currentNum);
$('[data-id="equipResumeArrayStr_'+curIndex+'"]').val(equipResumeArrayStr);
}
}
function serializeObject(formData) {
var obj = {};
$.each(formData, function () {
if (this.name.indexOf("[") !== -1 && this.name.indexOf("].") !== -1) {
let temp1 = this.name.split("[");
let temp2 = temp1[1].split("].");
let list_name = temp1[0];
let list_index = parseInt(temp2[0]);
let list_key = temp2[1];
// console.log(list_name, '-', list_index, '-', list_key)
if (obj[list_name]) {
// console.log(obj[list_name])
let arr = obj[list_name]
if (arr.length < list_index + 1) {
for (let i = arr.length; i < list_index + 1; i++) {
// console.log(list_index + 1)
let list_obj_temp = {}
arr.push(list_obj_temp)
}
}
let list_obj = obj[list_name][list_index];
list_obj[list_key] = this.value || '';
} else {
let arr = []
if (list_index !== 0) {
for (let i = 0; i < list_index + 1; i++) {
// console.log(list_index + 1)
let list_obj_temp = {}
arr.push(list_obj_temp)
}
}
let list_obj = {}
list_obj[list_key] = this.value || '';
arr.push(list_obj)
obj[list_name] = arr;
}
} else {
if (obj[this.name]) {
if (!obj[this.name].push) {
obj[this.name] = [obj[this.name]];
}
obj[this.name].push(this.value || '');
} else {
obj[this.name] = this.value || '';
}
}
});
return obj;
}
$("#form-makeorder-edit").validate({
focusCleanup: true
});

Loading…
Cancel
Save