diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceQuoteController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceQuoteController.java new file mode 100644 index 00000000..e86dd45c --- /dev/null +++ b/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 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 list = outsourceQuoteService.selectOutsourceQuoteList(outsourceQuote); + ExcelUtil util = new ExcelUtil(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 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)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceQuoteService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceQuoteService.java new file mode 100644 index 00000000..644043d4 --- /dev/null +++ b/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 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); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceQuoteServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceQuoteServiceImpl.java new file mode 100644 index 00000000..0271061e --- /dev/null +++ b/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 children = outsourceQuoteMapper.selectOutsourceQuoteChildList(outsourceQuote.getOutsourceQuoteCode()); + outsourceQuote.setOutsourceQuoteChildList(children); + return outsourceQuote; + } + + /** + * 查询委外报价列表 + * + * @param outsourceQuote 委外报价 + * @return 委外报价 + */ + @Override + public List 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 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 outsourceQuoteChildList = outsourceQuote.getOutsourceQuoteChildList(); + if (StringUtils.isNotNull(outsourceQuoteChildList)) + { + if (outsourceQuoteChildList.size() > 0) + { + outsourceQuoteMapper.batchOutsourceQuoteChild(outsourceQuoteChildList); + } + } + } +} diff --git a/ruoyi-admin/src/main/resources/mapper/system/OutsourceQuoteMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/OutsourceQuoteMapper.xml new file mode 100644 index 00000000..65dd14c8 --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/system/OutsourceQuoteMapper.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + insert into outsource_quote + + outsource_quote_code, + supplier_quote_code, + supplier_name, + process_amount, + tax_rate, + pricingDate, + create_by, + create_time, + update_by, + update_time, + audit_status, + remark, + + + #{outsourceQuoteCode}, + #{supplierQuoteCode}, + #{supplierName}, + #{processAmount}, + #{taxRate}, + #{pricingDate}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{auditStatus}, + #{remark}, + + + + + update outsource_quote + + outsource_quote_code = #{outsourceQuoteCode}, + supplier_quote_code = #{supplierQuoteCode}, + supplier_name = #{supplierName}, + process_amount = #{processAmount}, + tax_rate = #{taxRate}, + pricingDate = #{pricingDate}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + audit_status = #{auditStatus}, + remark = #{remark}, + + where outsource_quote_id = #{outsourceQuoteId} + + + + delete from outsource_quote where outsource_quote_id = #{outsourceQuoteId} + + + + delete from outsource_quote where outsource_quote_id in + + #{outsourceQuoteId} + + + + + delete from outsource_quote_child where outsource_process_code in + + #{outsourceProcessCode} + + + + + + + delete from outsource_quote_child where outsource_quote_code = #{outsourceQuoteCode} + + + + 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 + + ( #{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}) + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html b/ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html new file mode 100644 index 00000000..82d06124 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html @@ -0,0 +1,306 @@ + + + + + + + +
+
+

委外报价信息

+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+

委外报价工序信息

+
+
+ + + 添加 + +
+
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/outsource_quote/detail.html b/ruoyi-admin/src/main/resources/templates/system/outsource_quote/detail.html new file mode 100644 index 00000000..dd109a89 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/outsource_quote/detail.html @@ -0,0 +1,83 @@ + + + + + + +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+ + + + diff --git a/ruoyi-admin/src/main/resources/templates/system/outsource_quote/outsource_quote.html b/ruoyi-admin/src/main/resources/templates/system/outsource_quote/outsource_quote.html new file mode 100644 index 00000000..c11e7752 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/outsource_quote/outsource_quote.html @@ -0,0 +1,162 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + + - + +
  • +
  • + + +
  • +
  • + + + - + +
  • +
  • + + +
  • +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/outsource_quote/processadd.html b/ruoyi-admin/src/main/resources/templates/system/outsource_quote/processadd.html new file mode 100644 index 00000000..cbb4c4eb --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/outsource_quote/processadd.html @@ -0,0 +1,101 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • +  搜索 +  重置 +
  • +
+
+
+
+ +
+
+
+
+
+ + + + + \ No newline at end of file