ea8f9ea7 康伟

kangwei:药剂结算联调

1 个父辈 ff66599c
package com.skua.modules.erp.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.util.*;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
......@@ -15,6 +11,7 @@ import com.skua.core.context.BaseContextHandler;
import com.skua.core.query.QueryGenerator;
import com.skua.core.util.ConvertUtils;
import com.skua.core.util.DateUtils;
import com.skua.modules.common.service.ICommonSqlService;
import com.skua.modules.erp.entity.ErpSettlement;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.skua.modules.erp.service.IErpSettlementService;
......@@ -22,23 +19,21 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.erp.vo.ErpSettlementFormVO;
import com.skua.modules.erp.vo.ErpSettlementItemVO;
import com.skua.modules.erp.vo.ErpSettlementVO;
import com.skua.modules.erp.vo.SparepartSettlementVO;
import com.skua.modules.productionduty.utils.HolidaysUtils;
import com.skua.modules.quartz.util.BaseUtil;
import io.netty.util.internal.StringUtil;
import com.skua.tool.util.JSUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
......@@ -51,9 +46,11 @@ import io.swagger.annotations.ApiOperation;
public class ErpSettlementController {
@Autowired
private IErpSettlementService erpSettlementService;
@Autowired
private ICommonSqlService commonSqlService;
@AutoLog(value = "药剂结算单详情-分页列表查询")
@ApiOperation(value="药剂结算单详情-分页列表查询", notes="药剂结算单详情-分页列表查询")
@ApiOperation(value="药剂结算单详情-分页列表查询(settlementType = 0 供应商结算集合,settlementType= 1 水厂结算)", notes="药剂结算单详情-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<ErpSettlement>> queryPageList(ErpSettlement erpSettlement,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
......@@ -68,70 +65,110 @@ public class ErpSettlementController {
return result;
}
@AutoLog(value = "药剂结算单详情-供应商结算")
@ApiOperation(value="药剂结算单详情-供应商结算", notes="药剂结算单详情-供应商结算")
@AutoLog(value = "药剂结算单详情-根据ids生成供应商结算")
@ApiOperation(value="药剂结算单详情-根据ids生成供应商结算", notes="药剂结算单详情-供应商结算")
@GetMapping(value = "/supplierSettlement")
public Result<ErpSettlementVO> supplierSettlement(@RequestParam(name="ids",required=true) String ids) {
Result<ErpSettlementVO> result = new Result<>();
ErpSettlementVO erpSettlementVO = null;
List<ErpSettlementVO> settlementVOList = erpSettlementService.supplierSettlement(ids);
List<ErpSettlementVO> settlementVOList = erpSettlementService.supplierSettlement(JSUtils.quoteEach(ids,","));
if(settlementVOList==null || settlementVOList.isEmpty()) {
result.error500("根据供应商与合同号未找到实体");
return result;
}
String supplierName = "";
String contractCode = "";
if(settlementVOList != null ){
for(ErpSettlementVO settlementVO : settlementVOList){
erpSettlementVO = settlementVO;
erpSettlementVO.setSettlementType("0");
if(supplierName.length() >0 ) supplierName+=",";
supplierName += settlementVO.getSupplierName();
contractCode += settlementVO.getContractCode();
}
}
String[] supplierNameList = supplierName.split(",");
if(supplierNameList.length > 1){
result.error500("查询多个供应商:"+supplierName+"记录;请选择某一个供应商");
if(settlementVOList != null && settlementVOList.size() > 1){
result.error500("查询多个供应商:"+supplierName+";合同号:"+contractCode+"记录;请选择某一个供应商,同一合同");
}else{
List<ErpSettlementItem> erpSettlementItemList = erpSettlementService.querySupplierSettlementByMaterialIds(ids);
List<ErpSettlementItemVO> erpSettlementItemList = erpSettlementService.querySupplierSettlementByMaterialIds(JSUtils.quoteEach(ids,","));
erpSettlementVO.setItemList( erpSettlementItemList );
erpSettlementVO.setSparepartSettlementList( converErpSettlementItemList(erpSettlementItemList) );
result.setResult(erpSettlementVO);
result.setSuccess(true);
}
return result;
}
@AutoLog(value = "药剂结算单详情-水厂结算")
@ApiOperation(value="药剂结算单详情-水厂结算", notes="药剂结算单详情-水厂结算")
@AutoLog(value = "药剂结算单详情-根据ids生成水厂结算")
@ApiOperation(value="药剂结算单详情-根据ids生成水厂结算", notes="药剂结算单详情-水厂结算")
@GetMapping(value = "/waterDepartSettlement")
public Result<ErpSettlementVO> waterDepartSettlement(@RequestParam(name="ids",required=true) String ids) {
Result<ErpSettlementVO> result = new Result<ErpSettlementVO>();
ErpSettlementVO erpSettlementVO = null;
List<ErpSettlementVO> settlementVOList = erpSettlementService.waterDepartSettlement(ids);
List<ErpSettlementVO> settlementVOList = erpSettlementService.waterDepartSettlement(JSUtils.quoteEach(ids,","));
if(settlementVOList==null || settlementVOList.isEmpty()) {
result.error500("根据部门与合同号未找到实体");
return result;
}
String supplierName = "";
String departName = "";
String contractCode = "";
if(settlementVOList != null ){
for(ErpSettlementVO settlementVO : settlementVOList){
erpSettlementVO = settlementVO;
if(supplierName.length() >0 ) supplierName+=",";
supplierName += settlementVO.getSupplierName();
erpSettlementVO.setSettlementType("1");
if(departName.length() >0 ) departName+=",";
departName += settlementVO.getDepartName();
contractCode += settlementVO.getContractCode();
}
}
String[] supplierNameList = supplierName.split(",");
if(supplierNameList.length > 1){
result.error500("查询出多个水厂:"+supplierName+"记录;请选择某一个水厂");
String[] supplierNameList = departName.split(",");
if(settlementVOList != null && settlementVOList.size() > 1){
result.error500("查询出多个水厂:"+departName+";合同编号:"+contractCode+"记录;请选择某一个水厂,同一合同");
}else{
List<ErpSettlementItem> settlementItemList = erpSettlementService.queryWaterDepartSettlementByMaterialIds(ids);
List<ErpSettlementItemVO> settlementItemList = erpSettlementService.queryWaterDepartSettlementByMaterialIds(JSUtils.quoteEach(ids,","));
erpSettlementVO.setItemList(settlementItemList );
//送货单以及物资验收单
erpSettlementVO.setSparepartSettlementList( converErpSettlementItemList(settlementItemList) );
result.setResult(erpSettlementVO);
result.setSuccess(true);
}
return result;
}
@AutoLog(value = "药剂结算单详情-添加")
@ApiOperation(value="药剂结算单详情-添加", notes="药剂结算单详情-添加")
/***
* 转换ErpSettlementItem
* @return
*/
private List<SparepartSettlementVO> converErpSettlementItemList(List<ErpSettlementItemVO> settlementItemList ){
String jtDepartName = commonSqlService.queryForString("select depart_name from sys_depart order by parent_id asc limit 1");
Map<String, SparepartSettlementVO> sparepartSettlementMap = new HashedMap();
SparepartSettlementVO sparepartSettlementVO = null;
if(settlementItemList != null ){
for( ErpSettlementItemVO settlementItem : settlementItemList){
sparepartSettlementVO = sparepartSettlementMap.get(settlementItem.getSparepartId());
if(sparepartSettlementVO == null ){
//String projectName,String departName, String contractCode, String sparepartName, String specification, String goodOrigin, String goodBrand
sparepartSettlementVO = new SparepartSettlementVO(settlementItem.getProjectName(),settlementItem.getDepartName(),settlementItem.getContractCode(),
settlementItem.getSparepartName(),settlementItem.getSpecification(),settlementItem.getGoodCode() ,settlementItem.getGoodBrand() );
sparepartSettlementVO.setJtDepartName(jtDepartName);
sparepartSettlementVO.setSupplierName( settlementItem.getSupplierName() );
sparepartSettlementVO.setContractName(settlementItem.getContractName() );
sparepartSettlementMap.put( settlementItem.getSparepartId() ,sparepartSettlementVO );
}
sparepartSettlementVO.addErpSettlementItem( settlementItem );
}
}
return new ArrayList(sparepartSettlementMap.values());
}
@AutoLog(value = "药剂结算单-添加")
@ApiOperation(value="药剂结算单-添加", notes="药剂结算单-添加")
@PostMapping(value = "/add")
public Result<ErpSettlementVO> add(@RequestBody ErpSettlementVO erpSettlementVO) {
Result<ErpSettlementVO> result = new Result<ErpSettlementVO>();
......@@ -266,7 +303,7 @@ public class ErpSettlementController {
return result;
}
@AutoLog(value = "药剂结算单详情-导出:(供应商)送货单以及物资验收单")
/* @AutoLog(value = "药剂结算单详情-导出:(供应商)送货单以及物资验收单")
@ApiOperation(value="药剂结算单详情-导出:(供应商)送货单以及物资验收单", notes="药剂结算单详情-导出:送货单以及物资验收单")
@GetMapping(value = "/exportSupplierSupplierFormPDF")
public Result<ErpSettlementFormVO> exportSupplierSupplierFormPDF(@RequestParam(name="id",required=true) String id) {
......@@ -293,7 +330,7 @@ public class ErpSettlementController {
result.setSuccess(true);
}
return result;
}
}*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
......
......@@ -35,6 +35,8 @@ public class DistributContract {
@ApiModelProperty(value = "所属机构")
@Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name")
private String departId;
@ApiModelProperty(value = "项目名称")
private String projectName;
/**合同名称*/
@Excel(name = "合同名称", width = 15)
@ApiModelProperty(value = "合同名称")
......
......@@ -50,6 +50,8 @@ public class ERPPurchaseContract {
@ApiModelProperty(value = "采购类型:招标采购/询价采购")
@Dict(dicCode = "purchase_type")
private java.lang.String purchaseType;
@ApiModelProperty(value = "合同名称")
private String contractName;
/**合同编号*/
@Excel(name = "合同编号", width = 15)
@ApiModelProperty(value = "合同编号")
......@@ -68,7 +70,6 @@ public class ERPPurchaseContract {
@ApiModelProperty(value = "采购时间")
private java.lang.String projectTime;
/**入库仓库编号*/
@Excel(name = "入库仓库编号", width = 15)
@ApiModelProperty(value = "入库仓库编号")
......@@ -98,11 +99,9 @@ public class ERPPurchaseContract {
private String startTime;
@ApiModelProperty(value = "失效时间")
private String endTime;
@ApiModelProperty(value = "变更合同编号")
private String oldContractId;
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
......
......@@ -29,6 +29,9 @@ public class ErpSettlement {
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "结算类型:0 供应商结算,1 水厂结算")
private String settlementType;
/**供应商id*/
@Excel(name = "供应商id", width = 15)
@ApiModelProperty(value = "供应商id")
......@@ -82,6 +85,7 @@ public class ErpSettlement {
@ApiModelProperty(value = "结算日期")
private String settlementTime;
/**申请人签字*/
@Excel(name = "申请人签字", width = 15)
@ApiModelProperty(value = "申请人签字")
......@@ -103,7 +107,11 @@ public class ErpSettlement {
@ApiModelProperty(value = "审批签字")
private String approverSign;
@ApiModelProperty(value = "开始时间")
private String startDate;
@ApiModelProperty(value = "结束时间")
private String endDate;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
......
......@@ -108,4 +108,6 @@ public class ErpSettlementItem {
@ApiModelProperty(value = "分销合同")
private String distributContractId;
}
......
......@@ -34,6 +34,8 @@ public class MaterialAcceptanceForm {
@Excel(name = "入库单号", width = 15)
@ApiModelProperty(value = "入库单号")
private String inOrder;
@ApiModelProperty(value = "技术文件/资料")
private String jishuFilePath;
/**外观情况*/
@Excel(name = "外观情况", width = 15)
@ApiModelProperty(value = "外观情况")
......
......@@ -202,12 +202,16 @@ public class MaterialIN {
@ApiModelProperty(value = "物料类别")
private String sparepartTypeName;
@ApiModelProperty(value = "入库编号")
private String equipmentInId;
@ApiModelProperty(value = "出库编号")
private String equipmentOutId;
@ApiModelProperty(value = "供应商结算,0:未结算,1:已结算")
private Integer supplierSettlementFlag;
@ApiModelProperty(value = "水厂结算,0:未结算,1:已结算")
private Integer waterDepartSettlementFlag;
}
......
......@@ -2,6 +2,7 @@ package com.skua.modules.erp.mapper;
import java.util.List;
import com.skua.modules.erp.vo.ErpSettlementItemVO;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -11,5 +12,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface ErpSettlementItemMapper extends BaseMapper<ErpSettlementItem> {
public void deleteBySettlementId(@Param("settlementId") String settlementId);
void deleteBySettlementId(@Param("settlementId") String settlementId);
List<ErpSettlementItemVO> queryListBySupplier(@Param("settlementId") String settlementId);
List<ErpSettlementItemVO> queryListByWaterDepart(@Param("settlementId") String settlementId);
}
......
......@@ -19,12 +19,12 @@ public interface ErpSettlementMapper extends BaseMapper<ErpSettlement> {
List<ErpSettlementVO> waterDepartSettlement(@Param("ids")String ids);
// 根据入库单ids,获取【供应商】结算单详情
List<ErpSettlementItem> querySupplierSettlementByMaterialIds(@Param("ids") String materialIds);
List<ErpSettlementItemVO> querySupplierSettlementByMaterialIds(@Param("ids") String materialIds);
// 根据入库单ids,获取【水厂】结算单详情
List<ErpSettlementItem> queryWaterDepartSettlementByMaterialIds(@Param("ids") String materialIds);
List<ErpSettlementItemVO> queryWaterDepartSettlementByMaterialIds(@Param("ids") String materialIds);
//(供应商)送货单以及物资验收单
List<ErpSettlementItemVO> querySupplierSettlementFormById(@Param("id")String id);
/// List<ErpSettlementItemVO> querySupplierSettlementFormById(@Param("id")String id);
//(水厂) 送货单以及物资验收单
List<ErpSettlementItemVO> queryWaterDepartSettlementFormById(@Param("id")String id);
// List<ErpSettlementItemVO> queryWaterDepartSettlementFormById(@Param("id")String id);
}
......
......@@ -5,5 +5,24 @@
<delete id="deleteBySettlementId" >
delete from erp_settlement_item where settlement_id = #{settlementId}
</delete>
<!-- 结算单详情:供应商-->
<select id="queryListBySupplier" resultType="com.skua.modules.erp.vo.ErpSettlementItemVO">
select d.depart_name, pc.project_name, pc.contract_name, mf.jishu_file_path, mf.appearance_info, mf.matched_info ,mf.handle_msg,mf.sender_sign,mf.receiver_sign, pm.good_brand , pm.good_origin, si.*
from erp_settlement_item si
left join sys_depart d on d.id = si.depart_id
left join erp_purchase_material pm on (pm.contract_id =si.purchase_contract_id and pm.good_code = si.good_code )
left join erp_material_acceptance_form mf on mf.id = si.id
left join erp_purchase_contract pc on si.purchase_contract_id = pc.id
where si.settlement_id = #{settlementId}
</select>
<!-- 结算单详情:水厂-->
<select id="queryListByWaterDepart" resultType="com.skua.modules.erp.vo.ErpSettlementItemVO">
select d.depart_name, dc.contract_name ,dc.project_name, mf.jishu_file_path, mf.appearance_info, mf.matched_info ,mf.handle_msg,mf.sender_sign,mf.receiver_sign, pm.good_brand , pm.good_origin, si.*
from erp_settlement_item si
left join sys_depart d on d.id = si.depart_id
left join erp_purchase_material pm on (pm.contract_id =si.purchase_contract_id and pm.good_code = si.good_code )
left join erp_material_acceptance_form mf on mf.id = si.id
left join erp_distribut_contract dc on si.distribut_contract_id = dc.id
where si.settlement_id = #{settlementId}
</select>
</mapper>
......
<?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.skua.modules.erp.mapper.ErpSettlementMapper">
<!--供应商结算 -->
<!--根据ids获取:供应商结算单 -->
<select id="supplierSettlement" resultType="com.skua.modules.erp.vo.ErpSettlementVO">
select sm.supp_name 'supplierName', d.depart_name ,aaa.* from (
select pm.supplier_id ,pc.contract_code, mi.purchase_contract_id ,pc.project_name, mi.depart_id,
......@@ -16,17 +16,24 @@
left join sys_depart d on aaa.depart_id = d.id
</select>
<!-- 根据入库单ids,获取供应商结算单详情-->
<select id="querySupplierSettlementByMaterialIds" resultType="com.skua.modules.erp.entity.ErpSettlementItem">
select pc.contract_code, mi.purchase_contract_id , pm.unit_price ,mi.material_num, pm.tax_amount ,(pm.unit_price * mi.material_num) total_price,(pm.unit_price * mi.material_num *(100+pm.tax_amount) /100) total_price_tax,
<select id="querySupplierSettlementByMaterialIds" resultType="com.skua.modules.erp.vo.ErpSettlementItemVO">
select sm.supp_name 'supplierName',d.depart_name, mf.jishu_file_path, mf.appearance_info, mf.matched_info ,mf.handle_msg,mf.sender_sign,mf.receiver_sign,
pc.contract_name,pc.contract_code,pc.project_name , mi.purchase_contract_id , pm.good_brand , pm.good_origin, pm.unit_price ,mi.material_num, pm.tax_amount ,round(pm.unit_price * mi.material_num,2) total_price,
round(pm.unit_price * mi.material_num *(100+pm.tax_amount) /100 ,2) total_price_tax,
mi.arrive_time ,mi.remark,mi.sparepart_type,mi.sparepart_id,mi.sparepart_name,mi.sparepart_code,mi.specification, mi.measuring_unit,mi.good_code,mi.id 'material_in_id'
from erp_material_in mi ,erp_purchase_contract pc , erp_purchase_material pm
where mi.audit_status = 3 and mi.purchase_contract_id = pc.id and pm.good_code = mi.good_code and pm.contract_id = mi.purchase_contract_id
from erp_material_in mi
left join erp_purchase_contract pc on mi.purchase_contract_id = pc.id
left join sys_depart d on d.id = mi.depart_id
left join erp_purchase_material pm on (pm.contract_id =mi.purchase_contract_id and pm.good_code = mi.good_code )
left join erp_material_acceptance_form mf on mf.id = mi.id
left join ajh_supplier_manage sm on pm.supplier_id = sm.id
where mi.audit_status = 3
and mi.id in (${ids})
order by mi.arrive_time asc
</select>
<!--水厂结算 -->
<select id="waterDepartSettlement" resultType="com.skua.modules.erp.vo.ErpSettlementVO">
<!-- 根据ids获取:水厂结算单 -->
<!-- <select id="waterDepartSettlement" resultType="com.skua.modules.erp.vo.ErpSettlementVO">
select d.depart_name ,aaa.* from (
select mi.depart_id ,dc.contract_code, mi.distribut_contract_id ,sum(mi.material_num) material_num, dc.contract_name 'project_name', round(sum(dm.distribut_price * mi.material_num),2) total_price,
round(sum(dm.distribut_price * mi.material_num *(100+dm.tax_amount) /100),2) total_price_tax
......@@ -36,21 +43,26 @@
group by mi.depart_id ,dc.contract_code
)aaa
left join sys_depart d on aaa.depart_id = d.id
</select>
</select>-->
<!-- 根据入库单ids,获取水厂结算单详情-->
<select id="queryWaterDepartSettlementByMaterialIds" resultType="com.skua.modules.erp.entity.ErpSettlementItem">
select dc.contract_code, mi.distribut_contract_id , dm.distribut_price 'unit_price' , mi.material_num, dm.tax_amount ,(dm.distribut_price * mi.material_num) total_price,
(dm.distribut_price * mi.material_num *(100+dm.tax_amount) /100) total_price_tax,
mi.arrive_time ,mi.remark,mi.sparepart_type,mi.sparepart_id,mi.sparepart_name,mi.sparepart_code,mi.specification,
mi.measuring_unit,mi.good_code,mi.id 'material_in_id'
from erp_material_in mi ,erp_distribut_contract dc , erp_distribut_material dm
where mi.audit_status = 3 and mi.distribut_contract_id = dc.id and dm.good_code = mi.good_code and dm.contract_id = mi.distribut_contract_id
<select id="queryWaterDepartSettlementByMaterialIds" resultType="com.skua.modules.erp.vo.ErpSettlementVO">
select d.depart_name, dc.contract_name ,dc.project_name, dc.contract_code, dm.distribut_price 'unit_price' , pm.good_brand , pm.good_origin, mf.jishu_file_path, mf.appearance_info, mf.matched_info ,mf.handle_msg,mf.sender_sign,mf.receiver_sign, dm.tax_amount ,
round(dm.distribut_price * mi.material_num,2) total_price,
round(dm.distribut_price * mi.material_num *(100+dm.tax_amount) /100,2) total_price_tax, mi.depart_id , mi.distribut_contract_id ,mi.purchase_contract_id, mi.material_num,
mi.arrive_time ,mi.remark,mi.sparepart_type,mi.sparepart_id,mi.sparepart_name,mi.sparepart_code,mi.specification, mi.measuring_unit,mi.good_code,mi.id 'material_in_id'
from erp_material_in mi
left join erp_distribut_material dm on (dm.good_code = mi.good_code and dm.contract_id = mi.distribut_contract_id)
left join erp_distribut_contract dc on mi.distribut_contract_id = dc.id
left join sys_depart d on d.id = mi.depart_id
left join erp_purchase_material pm on (pm.contract_id =mi.purchase_contract_id and pm.good_code = mi.good_code )
left join erp_material_acceptance_form mf on mf.id = mi.id
where mi.audit_status = 3
and mi.id in (${ids})
order by mi.arrive_time asc
</select>
<select id="querySupplierSettlementFormById" resultType="com.skua.modules.erp.vo.ErpSettlementItemVO">
select d.depart_name,pc.project_name ,pc.contract_code,sm.supp_name as supplier_name,mi.arrive_time, maf.appearance_info ,maf.matched_info ,maf.handle_msg ,maf.sender_sign ,maf.receiver_sign ,aaa.*
select d.depart_name,pc.project_name ,pc.contract_code,pc.contract_name,sm.supp_name as supplier_name,mi.arrive_time, mf.jishu_file_path, mf.appearance_info, mf.matched_info ,mf.handle_msg,maf.appearance_info ,maf.matched_info ,maf.handle_msg ,maf.sender_sign ,maf.receiver_sign ,aaa.*
from (
select si.sparepart_name,si.material_num,si.specification,si.measuring_unit,s.purchase_contract_id,s.supplier_id,si.material_in_id
from erp_settlement s ,erp_settlement_item si where s.id = si.settlement_id and s.id = #{id}
......@@ -63,7 +75,7 @@
</select>
<select id="queryWaterDepartSettlementFormById" resultType="com.skua.modules.erp.vo.ErpSettlementItemVO">
select d.depart_name,dc.contract_code,dc.contract_name as project_name ,mi.arrive_time, maf.appearance_info ,maf.matched_info ,maf.handle_msg ,maf.sender_sign ,maf.receiver_sign ,aaa.*
select d.depart_name,dc.contract_code,dc.contract_name , dc.project_name ,mi.arrive_time,mf.jishu_file_path, mf.appearance_info, mf.matched_info ,mf.handle_msg, maf.appearance_info ,maf.matched_info ,maf.handle_msg ,maf.sender_sign ,maf.receiver_sign ,aaa.*
from (
select si.sparepart_name,si.material_num,si.specification,si.measuring_unit,
s.distribut_contract_id,s.supplier_id,si.material_in_id
......
......@@ -4,6 +4,7 @@ import com.skua.modules.erp.entity.ErpSettlement;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.skua.modules.erp.vo.ErpSettlementFormVO;
import com.skua.modules.erp.vo.ErpSettlementItemVO;
import com.skua.modules.erp.vo.ErpSettlementVO;
import org.apache.ibatis.annotations.Param;
......@@ -31,19 +32,20 @@ public interface IErpSettlementService extends IService<ErpSettlement> {
// 删除
void delById(String id);
//供应商结算
List<ErpSettlementVO> supplierSettlement(String materialInIds);
// 根据入库单ids,获取【供应商】结算单详情
List<ErpSettlementItem> querySupplierSettlementByMaterialIds(String materialInIds);
// 根据入库单ids,获取【供应商】结算单详情
List<ErpSettlementItemVO> querySupplierSettlementByMaterialIds(String materialInIds);
// 根据入库单ids,获取【水厂】结算单详情
List<ErpSettlementItemVO> queryWaterDepartSettlementByMaterialIds( String materialInIds);
//供应商结算
List<ErpSettlementVO> supplierSettlement(String materialInIds);
//水厂结算
List<ErpSettlementVO> waterDepartSettlement(String materialInIds);
// 根据入库单ids,获取【水厂】结算单详情
List<ErpSettlementItem> queryWaterDepartSettlementByMaterialIds( String materialInIds);
// (供应商)送货单以及物资验收单
ErpSettlementFormVO querySupplierSettlementFormById(String id);
// ErpSettlementFormVO querySupplierSettlementFormById(String id);
//(水厂) 送货单以及物资验收单
ErpSettlementFormVO queryWaterDepartSettlementFormById(String id);
// ErpSettlementFormVO queryWaterDepartSettlementFormById(String id);
}
......
package com.skua.modules.erp.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.modules.common.service.ICommonSqlService;
import com.skua.modules.equipment.entity.SupplierManage;
import com.skua.modules.equipment.mapper.SupplierManageMapper;
import com.skua.modules.erp.entity.ErpSettlement;
......@@ -11,17 +12,22 @@ import com.skua.modules.erp.service.IErpSettlementService;
import com.skua.modules.erp.vo.ErpSettlementFormVO;
import com.skua.modules.erp.vo.ErpSettlementItemVO;
import com.skua.modules.erp.vo.ErpSettlementVO;
import com.skua.modules.erp.vo.SparepartSettlementVO;
import com.skua.modules.system.entity.SysDepart;
import com.skua.modules.system.mapper.SysDepartMapper;
import com.skua.tool.util.JSUtils;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 药剂结算单详情
......@@ -31,10 +37,8 @@ public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, E
@Resource
private ErpSettlementItemMapper settlementItemMapper;
@Resource
private SupplierManageMapper supplierManageMapper;
@Resource
private SysDepartMapper departMapper;
@Autowired
private ICommonSqlService commonSqlService;
/**
* 新增结算单
* @param erpSettlementVO
......@@ -72,15 +76,39 @@ public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, E
//根据编号查询结算单
public ErpSettlementVO queryById(String id){
ErpSettlement erpSettlement = this.baseMapper.selectById(id);
QueryWrapper<ErpSettlementItem> queryWrapper = new QueryWrapper<ErpSettlementItem>();
queryWrapper.eq("settlement_id",id);
List<ErpSettlementItem> settlementItemList = settlementItemMapper.selectList(queryWrapper);
List<ErpSettlementItemVO> settlementItemList = null;
if("0".equals( erpSettlement.getSettlementType())){ //供应商
settlementItemList = settlementItemMapper.queryListBySupplier(id);
}
if("1".equals( erpSettlement.getSettlementType())){ //水厂
settlementItemList = settlementItemMapper.queryListByWaterDepart(id);
}
ErpSettlementVO erpSettlementVO = new ErpSettlementVO();
if(erpSettlement != null ){
//BeanUtils.copyProperties(有值的对象, 要被赋值的对象);
BeanUtils.copyProperties(erpSettlement, erpSettlementVO);
erpSettlementVO.setItemList( settlementItemList );
String jtDepartName = commonSqlService.queryForString("select depart_name from sys_depart order by parent_id asc limit 1");
Map<String, SparepartSettlementVO> sparepartSettlementMap = new HashedMap();
SparepartSettlementVO sparepartSettlementVO = null;
if(settlementItemList != null ){
for( ErpSettlementItemVO settlementItemVO : settlementItemList){
sparepartSettlementVO = sparepartSettlementMap.get(settlementItemVO.getSparepartId());
if(sparepartSettlementVO == null ){
//String projectName,String departName, String contractCode, String sparepartName, String specification, String goodOrigin, String goodBrand
sparepartSettlementVO = new SparepartSettlementVO(settlementItemVO.getProjectName(),settlementItemVO.getDepartName(),settlementItemVO.getContractCode(),
settlementItemVO.getSparepartName(),settlementItemVO.getSpecification(),settlementItemVO.getGoodCode() ,settlementItemVO.getGoodBrand() );
sparepartSettlementVO.setJtDepartName(jtDepartName);
sparepartSettlementMap.put( settlementItemVO.getSparepartId() ,sparepartSettlementVO );
}
sparepartSettlementVO.addErpSettlementItem( settlementItemVO );
}
}
//送货单以及物资验收单
erpSettlementVO.setSparepartSettlementList( new ArrayList(sparepartSettlementMap.values()) );
}
return erpSettlementVO;
}
......@@ -102,15 +130,15 @@ public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, E
}
// 根据入库单ids,获取【供应商】结算单详情
public List<ErpSettlementItem> querySupplierSettlementByMaterialIds(String materialInIds){
public List<ErpSettlementItemVO> querySupplierSettlementByMaterialIds(String materialInIds){
return this.baseMapper.querySupplierSettlementByMaterialIds( materialInIds );
}
// 根据入库单ids,获取【水厂】结算单详情
public List<ErpSettlementItem> queryWaterDepartSettlementByMaterialIds( String materialInIds){
public List<ErpSettlementItemVO> queryWaterDepartSettlementByMaterialIds( String materialInIds){
return this.baseMapper.queryWaterDepartSettlementByMaterialIds( materialInIds );
}
// 送货单以及物资验收单
/* // 送货单以及物资验收单
public ErpSettlementFormVO querySupplierSettlementFormById(String id){
List<ErpSettlementItemVO> itemList = this.baseMapper.querySupplierSettlementFormById( id );
ErpSettlementFormVO erpSettlementFormVO = new ErpSettlementFormVO();
......@@ -145,5 +173,5 @@ public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, E
}
erpSettlementFormVO.setItemList(itemList );
return erpSettlementFormVO;
}
}*/
}
......
package com.skua.modules.erp.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.modules.erp.entity.ErpSettlementItem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -10,11 +11,19 @@ import lombok.Data;
@Data
@ApiModel(value="erp_settlement_item数据传输对象", description="药剂结算单详情")
public class ErpSettlementItemVO extends ErpSettlementItem {
@ApiModelProperty(value = "合同编号")
private String contractCode;
@ApiModelProperty(value = "产地")
private String goodOrigin;
@ApiModelProperty(value = "品牌")
private String goodBrand;
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "合同名称")
private String contractName;
@ApiModelProperty(value = "合同编码")
private String contractCode;
@ApiModelProperty(value = "供应商名称")
private String supplierName;
......@@ -22,6 +31,8 @@ public class ErpSettlementItemVO extends ErpSettlementItem {
private String departName;
@ApiModelProperty(value = "技术文件/资料")
private String jishuFilePath;
/**外观情况*/
@ApiModelProperty(value = "外观情况")
private String appearanceInfo;
......@@ -31,10 +42,8 @@ public class ErpSettlementItemVO extends ErpSettlementItem {
/**处理意见*/
@ApiModelProperty(value = "处理意见")
private String handleMsg;
/**送货/供方人员签字*/
@ApiModelProperty(value = "送货/供方人员签字")
private String senderSign;
/**收货人员签字*/
@ApiModelProperty(value = "收货人员签字")
@ApiModelProperty(value = "验收人员签字")
private String receiverSign;
@ApiModelProperty(value = "送货人员签字")
private String senderSign;
}
......
......@@ -25,20 +25,21 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@Data
@ApiModel(value="erp_settlement数据传输对象", description="药剂结算单详情")
public class ErpSettlementVO extends ErpSettlement {
@TableField(exist=false)
@ApiModelProperty(value = "项目名称")
private String projectName;
@TableField(exist=false)
@ApiModelProperty(value = "供应商名称")
private String supplierName;
@TableField(exist=false)
@ApiModelProperty(value = "部门名称")
private String departName;
@TableField(exist=false)
@ApiModelProperty(value = "结算清单")
private List<ErpSettlementItem> itemList ;
private List<ErpSettlementItemVO> itemList ;
@ApiModelProperty(value = "物料结算记录")
private List<SparepartSettlementVO> sparepartSettlementList ;
}
......
package com.skua.modules.erp.vo;
import com.skua.modules.erp.entity.ErpSettlementItem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.ArrayList;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="物料结算对象", description="物料结算对象")
public class SparepartSettlementVO {
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "供应商名称")
private String supplierName;
@ApiModelProperty(value = "部门名称")
private String departName;
@ApiModelProperty(value = "合同名称")
private String contractName;
/**合同编号*/
@ApiModelProperty(value = "合同编号")
private String contractCode;
@ApiModelProperty(value = "药剂名称")
private String sparepartName;
@ApiModelProperty(value = "规格型号")
private String specification;
@ApiModelProperty(value = "产地")
private String goodOrigin;
@ApiModelProperty(value = "品牌")
private String goodBrand;
@ApiModelProperty(value = "集团名称")
private String jtDepartName;
@ApiModelProperty(value = "结算清单")
private List<ErpSettlementItemVO> itemList ;
public SparepartSettlementVO(){
}
public SparepartSettlementVO(String projectName,String departName, String contractCode, String sparepartName, String specification, String goodOrigin, String goodBrand) {
this.projectName = projectName;
this.contractCode = contractCode;
this.sparepartName = sparepartName;
this.specification = specification;
this.goodOrigin = goodOrigin;
this.goodBrand = goodBrand;
}
public void addErpSettlementItem(ErpSettlementItemVO settlementItem){
if(itemList == null ) itemList = new ArrayList<>();
itemList.add( settlementItem ) ;
}
}
......@@ -44,6 +44,7 @@ public class SysUser implements Serializable {
/**
* 密码
*/
private String password;
/**
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!