Browse Source

[feat] 委外加工

整合新增委外报价 controller
整合新增委外报价  Service
整合新增委外报价  ServiceImpl
整合新增委外报价  Mapper
整合新增委外报价  Mapper.xml
整合新增委外报价 相关前端页面
dev
liuxiaoxu 4 months ago
parent
commit
19065295d7
  1. 164
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceQuoteController.java
  2. 71
      ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceQuoteService.java
  3. 152
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceQuoteServiceImpl.java
  4. 163
      ruoyi-admin/src/main/resources/mapper/system/OutsourceQuoteMapper.xml
  5. 306
      ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html
  6. 83
      ruoyi-admin/src/main/resources/templates/system/outsource_quote/detail.html
  7. 162
      ruoyi-admin/src/main/resources/templates/system/outsource_quote/outsource_quote.html
  8. 101
      ruoyi-admin/src/main/resources/templates/system/outsource_quote/processadd.html

164
ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceQuoteController.java

@ -0,0 +1,164 @@
package com.ruoyi.system.controller;
import java.util.List;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.OutsourceQuote;
import com.ruoyi.system.domain.OutsourceQuoteChild;
import com.ruoyi.system.domain.Vo.OutsourceQuoteVO;
import com.ruoyi.system.service.IOutsourceProcessService;
import com.ruoyi.system.service.IOutsourceQuoteService;
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.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 委外报价Controller
*
* @author ruoyi
* @date 2024-07-01
*/
@Controller
@RequestMapping("/system/outsource_quote")
public class OutsourceQuoteController extends BaseController
{
private String prefix = "system/outsource_quote";
@Autowired
private IOutsourceQuoteService outsourceQuoteService;
@Autowired
private IOutsourceProcessService outsourceProcessService;
@RequiresPermissions("system:outsource_quote:view")
@GetMapping()
public String outsource_quote()
{
return prefix + "/outsource_quote";
}
/**
* 查询委外报价列表
*/
@RequiresPermissions("system:outsource_quote:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(OutsourceQuote outsourceQuote)
{
startPage();
List<OutsourceQuote> list = outsourceQuoteService.selectOutsourceQuoteList(outsourceQuote);
return getDataTable(list);
}
/**
* 导出委外报价列表
*/
@RequiresPermissions("system:outsource_quote:export")
@Log(title = "委外报价", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(OutsourceQuote outsourceQuote)
{
List<OutsourceQuote> list = outsourceQuoteService.selectOutsourceQuoteList(outsourceQuote);
ExcelUtil<OutsourceQuote> util = new ExcelUtil<OutsourceQuote>(OutsourceQuote.class);
return util.exportExcel(list, "委外报价数据");
}
/**
* 表格细节视图
*/
@RequiresPermissions("system:outsource_quote:detail")
@GetMapping("/detail/{outsourceQuoteId}")
public String detail(@PathVariable("outsourceQuoteId") int outsourceQuoteId, ModelMap mmap)
{
mmap.put("outsourceQuote", outsourceQuoteService.selectOutsourceQuoteByOutsourceQuoteId(outsourceQuoteId));
return prefix + "/detail";
}
/**
* 新增委外报价
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增委外报价
*/
@GetMapping("/processadd")
public String processadd()
{
return prefix + "/processadd";
}
/**
* 新增保存委外报价
*/
@RequiresPermissions("system:outsource_quote:add")
@Log(title = "委外报价", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(OutsourceQuoteVO childVO)
{
System.out.println(childVO);
return toAjax(outsourceQuoteService.insertOutsourceQuote(childVO));
}
/**
* 修改委外报价
*/
@RequiresPermissions("system:outsource_quote:edit")
@GetMapping("/edit/{outsourceQuoteId}")
public String edit(@PathVariable("outsourceQuoteId") Integer outsourceQuoteId, ModelMap mmap)
{
OutsourceQuote outsourceQuote = outsourceQuoteService.selectOutsourceQuoteByOutsourceQuoteId(outsourceQuoteId);
System.out.println(outsourceQuote.toString());
mmap.put("outsourceQuote", outsourceQuote);
return prefix + "/edit";
}
/**
* 修改保存委外报价
*/
@RequiresPermissions("system:outsource_quote:edit")
@Log(title = "委外报价", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@RequestBody OutsourceQuoteVO childVO)
{
System.out.println(childVO.toString());
List<OutsourceQuoteChild> children = childVO.getOutsourceQuoteChildList();
for (OutsourceQuoteChild child:children) {
child.setOutsourceQuoteCode(childVO.getOutsourceQuoteCode());
child.setSupplierCode(childVO.getSupplierQuoteCode());
child.setSupplierName(childVO.getSupplierName());
child.setTaxRate(childVO.getTaxRate());
}
OutsourceQuote outsourceQuote = new OutsourceQuote();
outsourceQuote.setPricingDate(childVO.getPricingDate());
outsourceQuote.setProcessAmount(children.size());
outsourceQuote.setSupplierQuoteCode(childVO.getSupplierQuoteCode());
outsourceQuote.setSupplierName(childVO.getSupplierName());
outsourceQuote.setOutsourceQuoteChildList(children);
return toAjax(outsourceQuoteService.updateOutsourceQuote(outsourceQuote));
}
/**
* 删除委外报价
*/
@RequiresPermissions("system:outsource_quote:remove")
@Log(title = "委外报价", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(outsourceQuoteService.deleteOutsourceQuoteByOutsourceQuoteIds(ids));
}
}

71
ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceQuoteService.java

@ -0,0 +1,71 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.OutsourceQuote;
import com.ruoyi.system.domain.Vo.OutsourceQuoteVO;
import java.util.List;
/**
* 委外报价Service接口
*
* @author ruoyi
* @date 2024-07-01
*/
public interface IOutsourceQuoteService
{
/**
* 查询委外报价
*
* @param outsourceQuoteId 委外报价主键
* @return 委外报价
*/
public OutsourceQuote selectOutsourceQuoteByOutsourceQuoteId(Integer outsourceQuoteId);
/**
* 查询委外报价列表
*
* @param outsourceQuote 委外报价
* @return 委外报价集合
*/
public List<OutsourceQuote> selectOutsourceQuoteList(OutsourceQuote outsourceQuote);
/**
* 新增委外报价
*
* @param childVO 委外报价
* @return 结果
*/
public int insertOutsourceQuote(OutsourceQuoteVO childVO);
/**
* 修改委外报价
*
* @param outsourceQuote 委外报价
* @return 结果
*/
public int updateOutsourceQuote(OutsourceQuote outsourceQuote);
/**
* 批量删除委外报价
*
* @param outsourceQuoteIds 需要删除的委外报价主键集合
* @return 结果
*/
public int deleteOutsourceQuoteByOutsourceQuoteIds(String outsourceQuoteIds);
/**
* 删除委外报价信息
*
* @param outsourceQuoteId 委外报价主键
* @return 结果
*/
public int deleteOutsourceQuoteByOutsourceQuoteId(Integer outsourceQuoteId);
/**
* 新增委外报价工序信息信息
*
* @param outsourceQuote 委外报价对象
*/
public void insertOutsourceQuoteChild(OutsourceQuote outsourceQuote);
}

152
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceQuoteServiceImpl.java

@ -0,0 +1,152 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.OutsourceQuote;
import com.ruoyi.system.domain.OutsourceQuoteChild;
import com.ruoyi.system.domain.Vo.OutsourceQuoteVO;
import com.ruoyi.system.mapper.OutsourceQuoteMapper;
import com.ruoyi.system.service.IOutsourceQuoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.common.core.text.Convert;
/**
* 委外报价Service业务层处理
*
* @author ruoyi
* @date 2024-07-01
*/
@Service
public class OutsourceQuoteServiceImpl implements IOutsourceQuoteService
{
@Autowired
private OutsourceQuoteMapper outsourceQuoteMapper;
/**
* 查询委外报价
*
* @param outsourceQuoteId 委外报价主键
* @return 委外报价
*/
@Override
public OutsourceQuote selectOutsourceQuoteByOutsourceQuoteId(Integer outsourceQuoteId)
{
OutsourceQuote outsourceQuote = outsourceQuoteMapper.selectOutsourceQuoteByOutsourceQuoteId(outsourceQuoteId);
List<OutsourceQuoteChild> children = outsourceQuoteMapper.selectOutsourceQuoteChildList(outsourceQuote.getOutsourceQuoteCode());
outsourceQuote.setOutsourceQuoteChildList(children);
return outsourceQuote;
}
/**
* 查询委外报价列表
*
* @param outsourceQuote 委外报价
* @return 委外报价
*/
@Override
public List<OutsourceQuote> selectOutsourceQuoteList(OutsourceQuote outsourceQuote)
{
return outsourceQuoteMapper.selectOutsourceQuoteList(outsourceQuote);
}
/**
* 新增委外报价
*
* @param childVO 委外报价
* @return 结果
*/
@Transactional
@Override
public int insertOutsourceQuote(OutsourceQuoteVO childVO)
{
// System.out.println(childVO.toString());
// System.out.println(childVO.getOutsourceQuoteCode());
List<OutsourceQuoteChild> children = childVO.getOutsourceQuoteChildList();
for (OutsourceQuoteChild child:children) {
child.setOutsourceQuoteCode(childVO.getOutsourceQuoteCode());
child.setSupplierCode(childVO.getSupplierQuoteCode());
child.setSupplierName(childVO.getSupplierName());
child.setTaxRate(childVO.getTaxRate());
}
System.out.println(children);
OutsourceQuote outsourceQuote = new OutsourceQuote();
outsourceQuote.setOutsourceQuoteCode(childVO.getOutsourceQuoteCode());
outsourceQuote.setPricingDate(DateUtils.parseDate(childVO.getPricingDate()));
outsourceQuote.setProcessAmount(children.size());
outsourceQuote.setSupplierQuoteCode(childVO.getSupplierQuoteCode());
outsourceQuote.setSupplierName(childVO.getSupplierName());
outsourceQuote.setOutsourceQuoteChildList(children);
outsourceQuote.setCreateTime(DateUtils.getNowDate());
int rows = outsourceQuoteMapper.insertOutsourceQuote(outsourceQuote);
insertOutsourceQuoteChild(outsourceQuote);
return rows;
}
/**
* 修改委外报价
*
* @param outsourceQuote 委外报价
* @return 结果
*/
@Transactional
@Override
public int updateOutsourceQuote(OutsourceQuote outsourceQuote)
{
outsourceQuote.setUpdateTime(DateUtils.getNowDate());
outsourceQuoteMapper.deleteOutsourceQuoteChildByOutsourceProcessCode(outsourceQuote.getOutsourceQuoteId());
insertOutsourceQuoteChild(outsourceQuote);
return outsourceQuoteMapper.updateOutsourceQuote(outsourceQuote);
}
/**
* 批量删除委外报价
*
* @param outsourceQuoteIds 需要删除的委外报价主键
* @return 结果
*/
@Transactional
@Override
public int deleteOutsourceQuoteByOutsourceQuoteIds(String outsourceQuoteIds)
{
outsourceQuoteMapper.deleteOutsourceQuoteChildByOutsourceProcessCodes(Convert.toStrArray(outsourceQuoteIds));
return outsourceQuoteMapper.deleteOutsourceQuoteByOutsourceQuoteIds(Convert.toStrArray(outsourceQuoteIds));
}
/**
* 删除委外报价信息
*
* @param outsourceQuoteId 委外报价主键
* @return 结果
*/
@Transactional
@Override
public int deleteOutsourceQuoteByOutsourceQuoteId(Integer outsourceQuoteId)
{
outsourceQuoteMapper.deleteOutsourceQuoteChildByOutsourceProcessCode(outsourceQuoteId);
return outsourceQuoteMapper.deleteOutsourceQuoteByOutsourceQuoteId(outsourceQuoteId);
}
/**
* 新增委外报价工序信息
*
* @param outsourceQuote 委外报价对象
*/
public void insertOutsourceQuoteChild(OutsourceQuote outsourceQuote)
{
List<OutsourceQuoteChild> outsourceQuoteChildList = outsourceQuote.getOutsourceQuoteChildList();
if (StringUtils.isNotNull(outsourceQuoteChildList))
{
if (outsourceQuoteChildList.size() > 0)
{
outsourceQuoteMapper.batchOutsourceQuoteChild(outsourceQuoteChildList);
}
}
}
}

163
ruoyi-admin/src/main/resources/mapper/system/OutsourceQuoteMapper.xml

@ -0,0 +1,163 @@
<?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.system.mapper.OutsourceQuoteMapper">
<resultMap type="OutsourceQuote" id="OutsourceQuoteResult">
<result property="outsourceQuoteId" column="outsource_quote_id" />
<result property="outsourceQuoteCode" column="outsource_quote_code" />
<result property="supplierQuoteCode" column="supplier_quote_code" />
<result property="supplierName" column="supplier_name" />
<result property="processAmount" column="process_amount" />
<result property="taxRate" column="tax_rate" />
<result property="pricingDate" column="pricingDate" />
<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="auditStatus" column="audit_status" />
<result property="remark" column="remark" />
</resultMap>
<resultMap id="OutsourceQuoteOutsourceQuoteChildResult" type="OutsourceQuote" extends="OutsourceQuoteResult">
<collection property="outsourceQuoteChildList" ofType="OutsourceQuoteChild" column="outsource_quote_id" select="selectOutsourceQuoteChildList" />
</resultMap>
<resultMap type="OutsourceQuoteChild" id="OutsourceQuoteChildResult">
<result property="outsourceQuoteChildId" column="outsource_quote_child_id" />
<result property="outsourceQuoteCode" column="outsource_quote_code" />
<result property="outsourceProcessNo" column="outsource_process_no" />
<result property="outsourceProcessCode" column="outsource_process_code" />
<result property="outsourceProcessName" column="outsource_process_name" />
<result property="remark" column="remark" />
<result property="taxRate" column="tax_rate" />
<result property="materialRmb" column="material_rmb" />
<result property="materialNormb" column="material_noRmb" />
<result property="chargeUnit" column="charge_unit" />
<result property="supplierCode" column="supplier_code" />
<result property="supplierName" column="supplier_name" />
<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="auditStatus" column="audit_status" />
</resultMap>
<sql id="selectOutsourceQuoteVo">
select outsource_quote_id, outsource_quote_code, supplier_quote_code, supplier_name, process_amount, tax_rate, pricingDate, create_by, create_time, update_by, update_time, audit_status, remark from outsource_quote
</sql>
<select id="selectOutsourceQuoteList" parameterType="OutsourceQuote" resultMap="OutsourceQuoteResult">
<include refid="selectOutsourceQuoteVo"/>
<where>
<if test="outsourceQuoteCode != null and outsourceQuoteCode != ''"> and outsource_quote_code = #{outsourceQuoteCode}</if>
<if test="supplierQuoteCode != null and supplierQuoteCode != ''"> and supplier_quote_code = #{supplierQuoteCode}</if>
<if test="supplierName != null and supplierName != ''"> and supplier_name like concat('%', #{supplierName}, '%')</if>
<if test="taxRate != null "> and tax_rate = #{taxRate}</if>
<if test="pricingDate != null and pricingDate != ''"> and pricingDate = #{pricingDate}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
</where>
</select>
<select id="selectOutsourceQuoteByOutsourceQuoteId" parameterType="Integer" resultMap="OutsourceQuoteOutsourceQuoteChildResult">
select outsource_quote_id, outsource_quote_code, supplier_quote_code, supplier_name, process_amount, tax_rate, pricingDate, create_by, create_time, update_by, update_time, audit_status, remark
from outsource_quote
where outsource_quote_id = #{outsourceQuoteId}
</select>
<select id="selectOutsourceQuoteChildList" resultType="OutsourceQuoteChild" resultMap="OutsourceQuoteChildResult">
select outsource_quote_child_id, outsource_quote_code, outsource_process_code, outsource_process_no, outsource_process_name, remark, tax_rate, material_rmb, material_noRmb, supplier_code, supplier_name, create_by, create_time, update_by, update_time, audit_status
from outsource_quote_child
where outsource_quote_code = #{outsource_quote_code}
</select>
<insert id="insertOutsourceQuote" parameterType="OutsourceQuote" useGeneratedKeys="true" keyProperty="outsourceQuoteCode">
insert into outsource_quote
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="outsourceQuoteCode != null and outsourceQuoteCode != ''">outsource_quote_code,</if>
<if test="supplierQuoteCode != null">supplier_quote_code,</if>
<if test="supplierName != null">supplier_name,</if>
<if test="processAmount != null">process_amount,</if>
<if test="taxRate != null">tax_rate,</if>
<if test="pricingDate != null">pricingDate,</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="auditStatus != null">audit_status,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="outsourceQuoteCode != null and outsourceQuoteCode != ''">#{outsourceQuoteCode},</if>
<if test="supplierQuoteCode != null">#{supplierQuoteCode},</if>
<if test="supplierName != null">#{supplierName},</if>
<if test="processAmount != null">#{processAmount},</if>
<if test="taxRate != null">#{taxRate},</if>
<if test="pricingDate != null">#{pricingDate},</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="auditStatus != null">#{auditStatus},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateOutsourceQuote" parameterType="OutsourceQuote">
update outsource_quote
<trim prefix="SET" suffixOverrides=",">
<if test="outsourceQuoteCode != null and outsourceQuoteCode != ''">outsource_quote_code = #{outsourceQuoteCode},</if>
<if test="supplierQuoteCode != null">supplier_quote_code = #{supplierQuoteCode},</if>
<if test="supplierName != null">supplier_name = #{supplierName},</if>
<if test="processAmount != null">process_amount = #{processAmount},</if>
<if test="taxRate != null">tax_rate = #{taxRate},</if>
<if test="pricingDate != null">pricingDate = #{pricingDate},</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="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where outsource_quote_id = #{outsourceQuoteId}
</update>
<delete id="deleteOutsourceQuoteByOutsourceQuoteId" parameterType="Integer">
delete from outsource_quote where outsource_quote_id = #{outsourceQuoteId}
</delete>
<delete id="deleteOutsourceQuoteByOutsourceQuoteIds" parameterType="String">
delete from outsource_quote where outsource_quote_id in
<foreach item="outsourceQuoteId" collection="array" open="(" separator="," close=")">
#{outsourceQuoteId}
</foreach>
</delete>
<delete id="deleteOutsourceQuoteChildByOutsourceProcessCode" parameterType="String">
delete from outsource_quote_child where outsource_process_code in
<foreach item="outsourceProcessCode" collection="array" open="(" separator="," close=")">
#{outsourceProcessCode}
</foreach>
</delete>
<select id="selectQuoteChildListByProcessNo" parameterType="String" resultMap="OutsourceQuoteChildResult">
select outsource_quote_child_id, outsource_quote_code, outsource_process_code, outsource_process_no, outsource_process_name, remark, tax_rate, material_rmb, material_noRmb, supplier_code, supplier_name, create_by, create_time, update_by, update_time, audit_status,charge_unit
from outsource_quote_child
where outsource_process_no = #{outsource_process_no}
</select>
<delete id="deleteOutsourceQuoteChildByOutsourceQuoteCode" parameterType="String">
delete from outsource_quote_child where outsource_quote_code = #{outsourceQuoteCode}
</delete>
<insert id="batchOutsourceQuoteChild">
insert into outsource_quote_child( outsource_quote_child_id, outsource_quote_code, outsource_process_code, outsource_process_no, outsource_process_name, remark, tax_rate, material_rmb, material_noRmb, supplier_code, supplier_name, create_by, create_time, update_by, update_time, audit_status) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.outsourceQuoteChildId}, #{item.outsourceQuoteCode}, #{item.outsourceProcessCode}, #{item.outsourceProcessNo}, #{item.outsourceProcessName}, #{item.remark}, #{item.taxRate}, #{item.materialRmb}, #{item.materialNormb}, #{item.supplierCode}, #{item.supplierName}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.auditStatus})
</foreach>
</insert>
</mapper>

306
ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html

@ -0,0 +1,306 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('新增委外报价')" />
<style>
#form-outsource_quote-add .table{
overflow: visible;
}
</style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-outsource_quote-add">
<h4 class="form-header h4">委外报价信息</h4>
<div class="row">
<div class="form-group">
<label class="col-sm-3 control-label is-required">委外报价单号:</label>
<div class="col-sm-8">
<input name="outsourceQuoteCode" readonly="readonly" class="form-control" type="text" value="
WWBJ002">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">供应商编号:</label>
<div class="col-sm-8">
<input name="supplierQuoteCode" 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="supplierName" class="form-control" type="text">
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">税率:</label>
<div class="col-sm-8">
<input name="taxRate" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">定价日期:</label>
<div class="col-sm-8">
<input name="pricingDate" class="time-input" type="text" placeholder="请选择定价时间">
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" class="form-control" type="text">
</div>
</div>
</div>
<h4 class="form-header h4">委外报价工序信息</h4>
<div class="row">
<div class="col-xs-12">
<!-- <button type="button" class="btn btn-blue btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>-->
<a class="btn btn-success" onclick="processadd()" shiro:hasPermission="system:outsource_quote:processadd">
<i class="fa fa-plus"></i> 添加
</a>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table-process"></table>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: jquery-cxselect-js" />
<th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:inline="javascript">
var prefix = ctx + "system/outsource_quote";
var chargeUnitDatas = [[${@dict.getType("charge_unit")}]]
$("#form-outsource_quote-add").validate({
focusCleanup: true
});
// 保存信息 刷新表格
function saveJson(url, data, callback) {
var config = {
url: url,
type: "post",
dataType: "json",
contentType: "application/json;charset=utf-8",
data: data,
beforeSend: function () {
$.modal.loading("正在处理中,请稍后...");
$.modal.disable();
},
success: function(result) {
if (typeof callback == "function") {
callback(result);
}
$.operate.successCallback(result);
}
};
$.ajax(config)
};
function submitHandler() {
var url = prefix + "/add";
var outsourceQuote = {
};
if ($.validate.form()) {
var outsourceQuoteChildList = [];
// 获取表单数据
const outsourceQuoteData = $("#form-outsource_quote-add").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
outsourceQuote = {
outsourceQuoteCode: outsourceQuoteData.outsourceQuoteCode,
supplierQuoteCode: outsourceQuoteData.supplierCode,
supplierName: outsourceQuoteData.supplierName,
pricingDate: outsourceQuoteData.pricingDate,
taxRate: outsourceQuoteData.taxRate,
remark: outsourceQuoteData.remark,
processAmount: 0,
outsourceQuoteChildList: []
}
console.log(outsourceQuote);
// console.log(outsourceQuoteData);
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var rows = $('#bootstrap-table-process').bootstrapTable('getData');
// 检查表格数据是否为空
if (rows.length === 0) {
$.modal.alertWarning("请至少添加一条委外工序再保存!");
return;
}else{
outsourceQuote.processAmount = rows.length;
console.log(rows);
for(var i=0;i<rows.length;i++){
var unit = getUnit();
console.log(unit);
var quoteChild = {
outsourceProcessCode: rows.outsourceProcessCode,
outsourceProcessNo: rows.outsourceProcessNo,
outsourceProcessName: rows.outsourceProcessName,
};
}
}
// console.log(jsonData);
// 发送 AJAX 请求到后端接口
saveJson(prefix + "/add", jsonData);
// $.operate.submit(prefix + "/add", "post", "json", jsonData);
}
}
function getUnit(){
var selectElements = $('#bootstrap-table-process').find('select[id="chargeUnit"]');
// 遍历每个下拉框
var unit = [];
selectElements.each(function() {
// 获取当前下拉框的值
var selectedValue = $(this).val();
unit.push(selectedValue);
// 执行你想要的操作,比如记录值或更新其他地方的数据
console.log("Selected charge unit value:", selectedValue);
});
return unit;
}
$(function() {
var options = {
id: "bootstrap-table-process",
pagination: false,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
striped: false,
sidePagination: "client",
columns: [
{
field: 'outsourceProcessId',
align: 'center',
title: '委外工序主键',
visible: false,
},
{
field: 'outsourceProcessCode',
align: 'center',
title: '委外工序ID',
},
{
field: 'outsourceProcessNo',
align: 'center',
title: '委外工序编号',
},
{
field: 'outsourceProcessName',
align: 'center',
title: '委外工序名称',
},
{
field: 'chargeUnit',
align: 'center',
title: '计价单位',
width: 100,
// overflow: visible,
formatter: function(value, row, index) {
var html = $.common.sprintf("<select class='form-control' id='chargeUnit' data-first-title= '请选择' > " +
"<option value=''>请选择</option>" +
"<option value='0'>按重量计</option>" +
"<option value='1'>按数量计</option>" +
"<option value='2'>按面积计</option>" +
"</select>", index, value);
return html;
}
},
{
field: 'materialNormb',
align: 'center',
title: '不含税单价(RMB) ',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' id='materialNormb'>", index, value);
return html;
}
},
{
field: 'materialRmb',
align: 'center',
title: '含税单价(RMB)',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' id='materialRmb'>", index, value);
return html;
}
},
{
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 processadd() {
var url = prefix + "/processadd";
var options = {
title: '选择委外工序',
height: "500",
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
/* 选择委外工序回调 */
function doSubmit(index, layero){
// // 这里取到的是多行的
var rowData = layero.find("iframe")[0].contentWindow.getSelections();
//判断是否重复
console.log(rowData);
var rows = $("#bootstrap-table").bootstrapTable('getData').length;
if(rows>0){
for(var i=0;i<rows;i++){
var data = $("#bootstrap-table").bootstrapTable('getData')[i];
// console.log(data);
for(var j=0;j<rowData.length;j++){
if(data.outsourceProcessCode==rowData[j].outsourceProcessCode){
$.modal.alertError("不能选择已添加过的相同工序");
return;
}
}
insertTable(rowData[i]);
};
}else{
for(i=0;i<rowData.length;i++){
insertTable(rowData[i]);
}
}
layer.close(index);
}
// 插入子表数据
function insertTable(rowData) {
$("#bootstrap-table-process").bootstrapTable('insertRow', {
index: 1,
row: {
outsourceProcessNo: rowData.outsourceProcessNo,
outsourceProcessCode: rowData.outsourceProcessCode,
outsourceProcessName: rowData.outsourceProcessName,
materialNoRmb: 0.00,
materialRmb: 0.00,
}
});
}
</script>
</body>
</html>

83
ruoyi-admin/src/main/resources/templates/system/outsource_quote/detail.html

@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('委外报价详情')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-user-edit">
<div class="form-group">
<label class="col-sm-3 control-label">审核状态:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${outsourceQuote.auditStatus}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">采购员:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${outsourceQuote.createBy}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">委外报价单号:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${outsourceQuote.outsourceQuoteCode}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">供应商ID:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${outsourceQuote.supplierQuoteCode}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">供应商名称:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${outsourceQuote.supplierName}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">工序合计:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${outsourceQuote.processAmount}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">定价时间:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${outsourceQuote.pricingDate}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">录入时间:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${outsourceQuote.createTime}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">更新人:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${outsourceQuote.updateBy}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">上次更新时间:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="${outsourceQuote.updateTime}"></div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
var prefix = ctx + "system/outsource_quote";
$("#form-user-add").validate({
onkeyup: false,
focusCleanup: true
});
</script>
</body>
</html>

162
ruoyi-admin/src/main/resources/templates/system/outsource_quote/outsource_quote.html

@ -0,0 +1,162 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('委外报价列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>委外报价单号:</label>
<input type="text" name="outsourceQuoteCode"/>
</li>
<li>
<label>委外工序ID:</label>
<input type="text" name="outsourceProcessCode"/>
</li>
<li>
<label>供应商编号:</label>
<input type="text" name="supplierQuoteCode"/>
</li>
<li>
<label>供应商名称:</label>
<input type="text" name="supplierName"/>
</li>
<li>
<label>税率:</label>
<input type="text" name="taxRate"/>
</li>
<li>
<label>定价日期:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
</li>
<li>
<label>录入人:</label>
<input type="text" name="createBy"/>
</li>
<li>
<label>录入时间:</label>
<input type="text" class="time-input" id="createstartTime" placeholder="开始时间" name="params[beginTime]"/>
<span>-</span>
<input type="text" class="time-input" id="createendTime" placeholder="结束时间" name="params[endTime]"/>
</li>
<li>
<label>审核状态:</label>
<select name="auditStatus" th:with="type=${@dict.getType('audit_status')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:outsource_quote:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:outsource_quote:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:outsource_quote:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:outsource_quote:remove')}]];
var detailFlag= [[${@permission.hasPermi('system:outsource_quote:detail')}]]
var auditStatusDatas = [[${@dict.getType('audit_status')}]];
var prefix = ctx + "system/outsource_quote";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
detailUrl: prefix + "/detail/{id}",
modalName: "委外报价",
columns: [{
checkbox: true
},
{
field: 'outsourceQuoteId',
title: '委外报价ID',
visible: false
},
{
field: 'auditStatus',
title: '审核状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(auditStatusDatas, value);
}
},
// {
// field: 'createBy',
// title: '采购员'
// },
{
field: 'outsourceQuoteCode',
title: '委外报价单号'
},
{
field: 'supplierQuoteCode',
title: '供应商编号'
},
{
field: 'supplierName',
title: '供应商名称'
},
{
field: 'processAmount',
title: '工序合计'
},
{
field: 'pricingDate',
title: '定价日期'
},
{
field: 'createTime',
title: '录入时间'
},
{
field: 'updateBy',
title: '更新人'
},
{
field: 'updateTime',
title: '上次更新时间'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.outsourceQuoteId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:;" onclick="$.operate.detail(\'' + row.outsourceQuoteId + '\')"><i class="fa fa-search"></i>详情</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

101
ruoyi-admin/src/main/resources/templates/system/outsource_quote/processadd.html

@ -0,0 +1,101 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('委外工序列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label class="in">委外工序ID:</label>
<input type="text" name="outsourceProcessCode"/>
</li>
<li>
<label class="in">委外工序编号:</label>
<input type="text" name="outsourceProcessNo"/>
</li>
<li>
<label class="in">委外工序名称:</label>
<input type="text" name="outsourceProcessName"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-select-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:outsource_process:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:outsource_process:remove')}]];
var detailFlag = [[${@permission.hasPermi('system:outsource_process:detail')}]];
var prefix = ctx + "system/outsource_quote";
$(function() {
var options = {
id: "bootstrap-select-table",
url: ctx + "system/outsource_process" + "/list",
postUrl: prefix + "/processadd",
modalName: "委外工序",
columns: [{
checkbox: true
},
{
field: 'outsourceProcessId',
title: '委外工序主键',
visible: false
},
{
field: 'outsourceProcessCode',
title: '委外工序ID',
},
{
field: 'outsourceProcessNo',
title: '委外工序编号'
},
{
field: 'outsourceProcessName',
title: '委外工序名称'
},
{
field: 'remark',
title: '备注'
},
]
};
$.table.init(options);
});
function submitHandler() {
// table.set();
// var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
// if (rows.length == 0) {
// $.modal.alertWarning("请至少选择一条记录");
// return;
// }
// var url = table.options.postUrl;
// var data = { "ids": rows.join() };
// $.operate.submit(url, "post", "json", data);
};
$(".layui-layer-btn0").click(function () {
window.close();
});
function getSelections() {
return $("#" + table.options.id).bootstrapTable('getSelections');
};
</script>
</body>
</html>
Loading…
Cancel
Save