f0a2ec9a 康伟

kangwei:药剂入库供应商结算、水务公司结算功能开发-后端

1 个父辈 44b90970
正在显示 28 个修改的文件 包含 1070 行增加172 行删除
......@@ -63,6 +63,10 @@ public class DistributContractController {
Result<IPage<DistributContract>> result = new Result<IPage<DistributContract>>();
QueryWrapper<DistributContract> queryWrapper = QueryGenerator.initQueryWrapper(distributContract, req.getParameterMap());
Page<DistributContract> page = new Page<DistributContract>(pageNo, pageSize);
//启用状态:=0
if(StringUtils.isEmpty(distributContract.getUseFlag())){
queryWrapper.eq("use_flag","0");
}
IPage<DistributContract> pageList = distributContractService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
......@@ -78,9 +82,15 @@ public class DistributContractController {
Result<List<DistributContract>> result = new Result<List<DistributContract>>();
QueryWrapper<DistributContract> queryWrapper = QueryGenerator.initQueryWrapper(distributContract, req.getParameterMap());
// 需要添加条件判断
queryWrapper.eq("use_flag","1");//生效的合同
String use_flag = "0";
queryWrapper.ge("end_time", DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));// 生效时间 《 当前时间 《 失效时间
queryWrapper.le("start_time", DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
//启用状态:=0
if(StringUtils.isEmpty(distributContract.getUseFlag())){
use_flag = distributContract.getUseFlag();
}
queryWrapper.eq("use_flag",use_flag);
List<DistributContract> dataList = distributContractService.list(queryWrapper);
result.setSuccess(true);
result.setResult(dataList);
......@@ -125,22 +135,6 @@ public class DistributContractController {
}
return result;
}
/***
* 校验是否有重复的货号
* @param materialList
* @return
*/
public String checkSameGoodCode(List<DistributMaterial> materialList){
String goodCode = "";
for( DistributMaterial material : materialList){
if(goodCode.contains( material.getGoodCode() )){
goodCode = material.getGoodCode();
break;
}
goodCode = goodCode + ","+material.getGoodCode();
}
return null;
}
@AutoLog(value = "erp分销合同-通过id删除")
@ApiOperation(value="erp分销合同-通过id删除", notes="erp分销合同-通过id删除")
......@@ -249,5 +243,4 @@ public class DistributContractController {
}
return result;
}
}
......
package com.skua.modules.erp.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.query.QueryGenerator;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.erp.entity.ErpSettlement;
import com.skua.modules.erp.service.IErpSettlementService;
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.ErpSettlementVO;
import lombok.extern.slf4j.Slf4j;
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;
import io.swagger.annotations.ApiOperation;
@Slf4j
@Api(tags="药剂结算单详情")
@RestController("webErpSettlementController")
@RequestMapping("/web/erp/erpSettlement")
public class ErpSettlementController {
@Autowired
private IErpSettlementService erpSettlementService;
@AutoLog(value = "药剂结算单详情-分页列表查询")
@ApiOperation(value="药剂结算单详情-分页列表查询", notes="药剂结算单详情-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<ErpSettlement>> queryPageList(ErpSettlement erpSettlement,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<ErpSettlement>> result = new Result<IPage<ErpSettlement>>();
QueryWrapper<ErpSettlement> queryWrapper = QueryGenerator.initQueryWrapper(erpSettlement, req.getParameterMap());
Page<ErpSettlement> page = new Page<ErpSettlement>(pageNo, pageSize);
IPage<ErpSettlement> pageList = erpSettlementService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "药剂结算单详情-供应商结算")
@ApiOperation(value="药剂结算单详情-供应商结算", notes="药剂结算单详情-供应商结算")
@GetMapping(value = "/supplierSettlement")
public Result<ErpSettlementVO> supplierSettlement(@RequestParam(name="ids",required=true) String ids) {
Result<ErpSettlementVO> result = new Result<>();
List<ErpSettlementVO> settlementVOList = erpSettlementService.checkSupplierByIds(ids);
String supplierName = "";
if(settlementVOList != null ){
for(ErpSettlementVO settlementVO : settlementVOList){
if(supplierName.length() >0 ) supplierName+=",";
supplierName += settlementVO.getSupplierName();
}
}
String[] supplierNameList = supplierName.split(",");
if(supplierNameList.length > 1){
result.error500("多个供应商:"+supplierName+";请选择一个供应商");
}else{
ErpSettlementVO erpSettlementVO = erpSettlementService.supplierSettlementByMaterialIds(ids);
result.setResult(erpSettlementVO);
result.setSuccess(true);
}
return result;
}
@AutoLog(value = "药剂结算单详情-水厂结算")
@ApiOperation(value="药剂结算单详情-水厂结算", notes="药剂结算单详情-水厂结算")
@GetMapping(value = "/waterDepartSettlement")
public Result<ErpSettlementVO> waterDepartSettlement(@RequestParam(name="ids",required=true) String ids) {
Result<ErpSettlementVO> result = new Result<ErpSettlementVO>();
List<ErpSettlementVO> settlementVOList = erpSettlementService.checkSupplierByIds(ids);
String supplierName = "";
if(settlementVOList != null ){
for(ErpSettlementVO settlementVO : settlementVOList){
if(supplierName.length() >0 ) supplierName+=",";
supplierName += settlementVO.getSupplierName();
}
}
String[] supplierNameList = supplierName.split(",");
if(supplierNameList.length > 1){
result.error500("多个水厂:"+supplierName+";请选择一个水厂");
}else{
ErpSettlementVO erpSettlementVO = erpSettlementService.waterDepartSettlementByMaterialIds(ids);
result.setResult(erpSettlementVO);
result.setSuccess(true);
}
return result;
}
@AutoLog(value = "药剂结算单详情-添加")
@ApiOperation(value="药剂结算单详情-添加", notes="药剂结算单详情-添加")
@PostMapping(value = "/add")
public Result<ErpSettlementVO> add(@RequestBody ErpSettlementVO erpSettlementVO) {
Result<ErpSettlementVO> result = new Result<ErpSettlementVO>();
try {
erpSettlementService.saveSettlement(erpSettlementVO);
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
@AutoLog(value = "药剂结算单详情-编辑")
@ApiOperation(value="药剂结算单详情-编辑", notes="药剂结算单详情-编辑")
@PutMapping(value = "/edit")
public Result<ErpSettlementVO> edit(@RequestBody ErpSettlementVO erpSettlement) {
Result<ErpSettlementVO> result = new Result<ErpSettlementVO>();
ErpSettlement erpSettlementEntity = erpSettlementService.getById(erpSettlement.getId());
if(erpSettlementEntity==null) {
result.error500("未找到对应实体");
}else {
boolean ok = erpSettlementService.updateSettlement(erpSettlement);
if(ok) {
result.success("修改成功!");
}
}
return result;
}
@AutoLog(value = "药剂结算单详情-通过id删除")
@ApiOperation(value="药剂结算单详情-通过id删除", notes="药剂结算单详情-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
try {
erpSettlementService.delById(id);
} catch (Exception e) {
log.error("删除失败",e.getMessage());
return Result.error("删除失败!");
}
return Result.ok("删除成功!");
}
@AutoLog(value = "药剂结算单详情-批量删除")
@ApiOperation(value="药剂结算单详情-批量删除", notes="药剂结算单详情-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<ErpSettlement> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<ErpSettlement> result = new Result<ErpSettlement>();
if(ids==null || "".equals(ids.trim())) {
result.error500("参数不识别!");
}else {
this.erpSettlementService.removeByIds(Arrays.asList(ids.split(",")));
result.success("删除成功!");
}
return result;
}
@AutoLog(value = "药剂结算单详情-通过id查询")
@ApiOperation(value="药剂结算单详情-通过id查询", notes="药剂结算单详情-通过id查询")
@GetMapping(value = "/queryById")
public Result<ErpSettlementVO> queryById(@RequestParam(name="id",required=true) String id) {
Result<ErpSettlementVO> result = new Result<ErpSettlementVO>();
ErpSettlementVO erpSettlement = erpSettlementService.queryById(id);
if(erpSettlement==null) {
result.error500("未找到对应实体");
}else {
result.setResult(erpSettlement);
result.setSuccess(true);
}
return result;
}
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<ErpSettlement> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (ConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
ErpSettlement erpSettlement = JSON.parseObject(deString, ErpSettlement.class);
queryWrapper = QueryGenerator.initQueryWrapper(erpSettlement, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<ErpSettlement> pageList = erpSettlementService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "药剂结算单详情列表");
mv.addObject(NormalExcelConstants.CLASS, ErpSettlement.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("药剂结算单详情列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
}
......@@ -109,30 +109,33 @@ public class MaterialINController {
QueryWrapper<MaterialIN> queryWrapper = QueryGenerator.initQueryWrapper(materialIN, req.getParameterMap());
Page<MaterialIN> page = new Page<MaterialIN>(pageNo, pageSize);
/*if(StringUtils.isNotBlank(materialIN.getDepartId())){
queryWrapper.eq("depart_id",materialIN.getDepartId());
}
if(StringUtils.isNotBlank(materialIN.getAuditStatus())){
queryWrapper.eq("audit_status",materialIN.getAuditStatus());
}
if(StringUtils.isNotBlank(materialIN.getConfirmStatus())){
queryWrapper.eq("confirm_status",materialIN.getConfirmStatus());
}
if(StringUtils.isNotBlank(materialIN.getGoodCode())){
queryWrapper.like("good_code",materialIN.getGoodCode());
}
if(StringUtils.isNotBlank(materialIN.getStartTime())){
queryWrapper.ge("arrive_time",materialIN.getStartTime());
}
if(StringUtils.isNotBlank(materialIN.getEndTime())){
queryWrapper.le("arrive_time",materialIN.getEndTime());
}*/
queryWrapper.orderByDesc("arrive_time");
IPage<MaterialIN> pageList = materialINService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "erp--物料(药剂)入库-:结算分页列表")
@ApiOperation(value="erp--物料(药剂)入库:结算分页列表", notes="erp--物料(药剂)入库:结算分页列表")
@GetMapping(value = "/settlementList")
public Result<IPage<MaterialIN>> settlementList(MaterialIN materialIN,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<MaterialIN>> result = new Result<IPage<MaterialIN>>();
QueryWrapper<MaterialIN> queryWrapper = QueryGenerator.initQueryWrapper(materialIN, req.getParameterMap());
Page<MaterialIN> page = new Page<MaterialIN>(pageNo, pageSize);
queryWrapper.eq("audit_status","3");//审批通过
queryWrapper.orderByDesc("arrive_time");
IPage<MaterialIN> pageList = materialINService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "erp--物料(药剂)入库-集团审核列表")
@ApiOperation(value="erp--物料(药剂)入库-集团审核列表", notes="erp--物料(药剂)入库-集团审核列表")
@GetMapping(value = "/handleList")
......
......@@ -41,18 +41,22 @@ public class PurchaseContractController {
@AutoLog(value = "erp统购合同-分页列表查询")
@ApiOperation(value="erp统购合同-分页列表查询", notes="erp统购合同-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<ERPPurchaseContract>> queryPageList(ERPPurchaseContract ERPPurchaseContract,
public Result<IPage<ERPPurchaseContract>> queryPageList(ERPPurchaseContract purchaseContract,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<ERPPurchaseContract>> result = new Result<IPage<ERPPurchaseContract>>();
QueryWrapper<ERPPurchaseContract> queryWrapper = QueryGenerator.initQueryWrapper(ERPPurchaseContract, req.getParameterMap());
QueryWrapper<ERPPurchaseContract> queryWrapper = QueryGenerator.initQueryWrapper(purchaseContract, req.getParameterMap());
Page<ERPPurchaseContract> page = new Page<ERPPurchaseContract>(pageNo, pageSize);
// 需要添加条件判断
if(StringUtils.isEmpty(ERPPurchaseContract.getStatus())){
if(StringUtils.isEmpty(purchaseContract.getStatus())){
queryWrapper.lt("status" , "3");// >0
}
//启用状态:=0
if(StringUtils.isEmpty(purchaseContract.getUseFlag())){
queryWrapper.eq("use_flag","0");
}
// 需要添加条件判断
IPage<ERPPurchaseContract> pageList = purchaseContractService.page(page, queryWrapper);
result.setSuccess(true);
......@@ -75,6 +79,10 @@ public class PurchaseContractController {
queryWrapper.gt("status" , "0");// >0
queryWrapper.ne("status" , "2"); // 不等于2
}
//启用状态:=0
if(StringUtils.isEmpty(purchaseContract.getUseFlag())){
queryWrapper.eq("use_flag","0");
}
IPage<ERPPurchaseContract> pageList = purchaseContractService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
......@@ -86,20 +94,7 @@ public class PurchaseContractController {
@GetMapping(value = "/purchaseContractList")
public Result<List<ERPPurchaseContract>> purchaseContractList(MaterialSearchVO materialSearchVO) {
Result<List<ERPPurchaseContract>> result = new Result<List<ERPPurchaseContract>>();
/* QueryWrapper<ERPPurchaseContract> queryWrapper = new QueryWrapper<ERPPurchaseContract> (); // QueryGenerator.initQueryWrapper(ERPPurchaseContract, req.getParameterMap());
*//* queryWrapper.like("departs", BaseContextHandler.getRealDepartId());*//*
// 需要添加条件判断
//queryWrapper.like("departs",BaseContextHandler.getRealDepartId());P
queryWrapper.eq("status","3");//审核通过的数据
queryWrapper.orderByDesc("create_time");*/
List<ERPPurchaseContract> purchaseContractList = purchaseContractService.getListByDistributId( materialSearchVO);
/*Set<ERPPurchaseContract> dataList = new HashSet<>();
HashSet set = new HashSet(purchaseContractList);
purchaseContractList.clear();
purchaseContractList.addAll(set);*/
result.setSuccess(true);
result.setResult(purchaseContractList);
return result;
......@@ -145,6 +140,27 @@ public class PurchaseContractController {
return result;
}
@AutoLog(value = "erp统购合同-变更合同")
@ApiOperation(value="erp统购合同-变更合同", notes="erp统购合同-变更合同")
@PutMapping(value = "/change")
public Result<ERPPurchaseContract> change(@RequestBody PurchaseContractVO purchaseContractVO) {
Result<ERPPurchaseContract> result = new Result<ERPPurchaseContract>();
ERPPurchaseContract purchaseContractEntity = purchaseContractService.getById(purchaseContractVO.getOldContractId());
if(purchaseContractEntity ==null) {
result.error500("未找到对应实体");
}else {
String errorMsg = purchaseContractService.checkPurchaseContract(purchaseContractVO , purchaseContractEntity.getContractCode(),1);
if(StringUtils.isNotEmpty( errorMsg )){
result.error500( errorMsg );
}else{
purchaseContractService.changePurchaseContract(purchaseContractVO);
result.success("修改成功!");
}
}
return result;
}
@AutoLog(value = "erp统购合同-通过id删除")
@ApiOperation(value="erp统购合同-通过id删除", notes="erp统购合同-通过id删除")
@DeleteMapping(value = "/delete")
......
......@@ -72,7 +72,8 @@ public class DistributContract {
private String startTime;
@ApiModelProperty(value = "失效时间")
private String endTime;
@ApiModelProperty(value = "变更合同编号")
private String oldContractId;
/**申请人*/
@Excel(name = "申请人", width = 15)
@ApiModelProperty(value = "申请人")
......
......@@ -36,6 +36,13 @@ public class DistributMaterial {
@Excel(name = "分销合同编号", width = 15)
@ApiModelProperty(value = "分销合同编号")
private String contractId;
@ApiModelProperty(value = "统购合同编号")
private String purchaseContractId;
@ApiModelProperty(value = "物料编号")
private String sparepartId;
/**物料名称*/
@Excel(name = "物料名称", width = 15)
@ApiModelProperty(value = "物料名称")
......@@ -60,6 +67,15 @@ public class DistributMaterial {
@Excel(name = "分销总价", width = 15)
@ApiModelProperty(value = "分销总价")
private String distributTotalPrice;
/**税额*/
@Excel(name = "税额", width = 15)
@ApiModelProperty(value = "税额")
private String taxAmount;
/**价税合计*/
@Excel(name = "价税合计", width = 15)
@ApiModelProperty(value = "价税合计")
private String totalPriceTax;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
......
......@@ -67,10 +67,7 @@ public class ERPPurchaseContract {
@Excel(name = "采购时间", width = 15)
@ApiModelProperty(value = "采购时间")
private java.lang.String projectTime;
/**使用机构编码集合*/
@Excel(name = "使用机构编码集合", width = 15)
@ApiModelProperty(value = "使用机构编码集合")
private java.lang.String departs;
/**入库仓库编号*/
@Excel(name = "入库仓库编号", width = 15)
......@@ -95,14 +92,15 @@ public class ERPPurchaseContract {
@ApiModelProperty(value = "申请时间")
private String applyTime;
@ApiModelProperty(value = "启动标记 1.启动 0不启用")
@ApiModelProperty(value = "启动标记 0.启动 1不启用")
private String useFlag;
@ApiModelProperty(value = "生效时间")
private String startTime;
@ApiModelProperty(value = "失效时间")
private String endTime;
@ApiModelProperty(value = "变更合同编号")
private String oldContractId;
@Excel(name = "备注", width = 15)
......@@ -148,4 +146,9 @@ public class ERPPurchaseContract {
/**审批意见*/
@ApiModelProperty(value = "审批意见")
private String approveMessage;
/**使用机构编码集合*/
@ApiModelProperty(value = "使用机构编码集合:作废")
private java.lang.String departs;
}
......
package com.skua.modules.erp.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.skua.core.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 药剂结算单详情
*/
@Data
@TableName("erp_settlement")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="erp_settlement对象", description="药剂结算单详情")
public class ErpSettlement {
/**主键*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "主键")
private String id;
/**供应商id*/
@Excel(name = "供应商id", width = 15)
@ApiModelProperty(value = "供应商id")
@Dict(dictTable = "ajh_supplier_manage", dicCode="id", dicText = "supp_name")
private String supplierId;
/**水厂编号*/
@Excel(name = "水厂编号", width = 15)
@ApiModelProperty(value = "水厂编号")
private String departId;
/**采购合同*/
@ApiModelProperty(value = "采购合同")
@Dict(dictTable = "erp_purchase_contract", dicCode="id", dicText = "contract_code")
private String purchaseContractId;
/**分销合同*/
@ApiModelProperty(value = "分销合同")
@Dict(dictTable = "erp_distribut_contract", dicCode="id", dicText = "contract_code")
private String distributContractId;
/**数量*/
@Excel(name = "数量", width = 15)
@ApiModelProperty(value = "数量")
private String materialNum;
/**结算金额*/
@Excel(name = "结算金额", width = 15)
@ApiModelProperty(value = "结算金额")
private String totalPrice;
/**税额*/
@Excel(name = "税额", width = 15)
@ApiModelProperty(value = "税额")
private String taxAmount;
/**价税合计*/
@Excel(name = "价税合计", width = 15)
@ApiModelProperty(value = "价税合计")
private String totalPriceTax;
/**签字状态(1-申请,2-验收签字,3-经理签字)*/
@Excel(name = "签字状态(1-申请,2-验收签字,3-经理签字)", width = 15)
@ApiModelProperty(value = "签字状态(1-申请,2-验收签字,3-经理签字)")
private Integer signStatus;
/**结算状态(0 未结算 1 已结算)*/
@Excel(name = "结算状态(0 未结算 1 已结算)", width = 15)
@ApiModelProperty(value = "结算状态(0 未结算 1 已结算)")
private Integer status;
/**申请时间*/
@Excel(name = "申请时间", width = 15)
@ApiModelProperty(value = "申请时间")
private String applyTime;
/**申请人签字*/
@Excel(name = "申请人签字", width = 15)
@ApiModelProperty(value = "申请人签字")
private String applySign;
/**验货时间*/
@Excel(name = "验货时间", width = 15)
@ApiModelProperty(value = "验货时间")
private String inspectTime;
/**验货签字*/
@Excel(name = "验货签字", width = 15)
@ApiModelProperty(value = "验货签字")
private String inspectorSign;
/**审批人签字时间*/
@Excel(name = "审批人签字时间", width = 15)
@ApiModelProperty(value = "审批人签字时间")
private String approveTime;
/**审批签字*/
@Excel(name = "审批签字", width = 15)
@ApiModelProperty(value = "审批签字")
private String approverSign;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remarks;
/**创建人id*/
@Excel(name = "创建人id", width = 15)
@ApiModelProperty(value = "创建人id")
private String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**修改人id*/
@Excel(name = "修改人id", width = 15)
@ApiModelProperty(value = "修改人id")
private String updateBy;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
}
package com.skua.modules.erp.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.core.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 药剂结算单详情
*/
@Data
@TableName("erp_settlement_item")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="erp_settlement_item对象", description="药剂结算单详情")
public class ErpSettlementItem {
/**主键*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "主键")
private String id;
/**结算单编号*/
@Excel(name = "结算单编号", width = 15)
@ApiModelProperty(value = "结算单编号")
private String settlementId;
/**物料类别编号*/
@Excel(name = "物料类别编号", width = 15)
@ApiModelProperty(value = "物料类别编号")
@Dict(dictTable = "equipment_sparepart_type", dicCode="id", dicText = "item_text")
private String sparepartType;
/**物料编号*/
@Excel(name = "物料编号", width = 15)
@ApiModelProperty(value = "物料编号")
@Dict(dictTable = "equipment_sparepart_supplies", dicCode="id", dicText = "sparepart_name")
private String sparepartId;
/**物料名称*/
@Excel(name = "物料名称", width = 15)
@ApiModelProperty(value = "物料名称")
private String sparepartName;
/**物料编码*/
@Excel(name = "物料编码", width = 15)
@ApiModelProperty(value = "物料编码")
private String sparepartCode;
/**货号*/
@Excel(name = "货号", width = 15)
@ApiModelProperty(value = "货号")
private String goodCode;
/**规格型号*/
@Excel(name = "规格型号", width = 15)
@ApiModelProperty(value = "规格型号")
private String specification;
/**计量单位*/
@Excel(name = "计量单位", width = 15)
@ApiModelProperty(value = "计量单位")
private String measuringUnit;
/**数量*/
@Excel(name = "数量", width = 15)
@ApiModelProperty(value = "数量")
private String materialNum;
/**单价*/
@Excel(name = "单价", width = 15)
@ApiModelProperty(value = "单价")
private String unitPrice;
/**总价*/
@Excel(name = "总价", width = 15)
@ApiModelProperty(value = "总价")
private String totalPrice;
/**税额*/
@Excel(name = "税额", width = 15)
@ApiModelProperty(value = "税额")
private String taxAmount;
/**价税合计*/
@Excel(name = "价税合计", width = 15)
@ApiModelProperty(value = "价税合计")
private String totalPriceTax;
/**到货时间*/
@Excel(name = "到货时间", width = 15)
@ApiModelProperty(value = "到货时间")
private String arriveTime;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
/**删除标识,0:有效,1:删除*/
@Excel(name = "删除标识,0:有效,1:删除", width = 15)
@ApiModelProperty(value = "删除标识,0:有效,1:删除")
private Integer delFlag;
/**采购合同*/
@ApiModelProperty(value = "采购合同")
@Dict(dictTable = "erp_purchase_contract", dicCode="id", dicText = "contract_code")
private String purchaseContractId;
/**分销合同*/
@ApiModelProperty(value = "分销合同")
@Dict(dictTable = "erp_distribut_contract", dicCode="id", dicText = "contract_code")
private String distributContractId;
@TableField(exist=false)
@ApiModelProperty(value = "供应商id")
private String supplierId;
@TableField(exist=false)
@ApiModelProperty(value = "部门编号")
private String departId;
}
package com.skua.modules.erp.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.core.aspect.annotation.Dict;
import com.skua.core.util.ConvertUtils;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
......@@ -30,56 +26,56 @@ public class PurchaseMaterial {
/**主键*/
@TableId(type = IdType.UUID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "所属机构")
@Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name")
private String departId;
/**采购计划编号*/
@Excel(name = "采购合同编号", width = 15)
@ApiModelProperty(value = "采购合同编号")
private java.lang.String contractId;
@ApiModelProperty(value = "采购合同编号")
private String contractId;
/**物料类别编号*/
@Excel(name = "物料类别编号", width = 15)
@ApiModelProperty(value = "物料类别编号")
private java.lang.String sparepartType;
@ApiModelProperty(value = "物料类别编号")
private String sparepartType;
/**物料编号*/
@Excel(name = "物料编号", width = 15)
@ApiModelProperty(value = "物料编号")
private java.lang.String sparepartId;
@ApiModelProperty(value = "物料编号")
private String sparepartId;
@ApiModelProperty(value = "物料编码")
private java.lang.String sparepartCode;
private String sparepartCode;
@ApiModelProperty(value = "物料名称")
private java.lang.String sparepartName;
private String sparepartName;
/**物料编号*/
@Excel(name = "货号", width = 15)
@ApiModelProperty(value = "货号")
private java.lang.String goodCode;
@ApiModelProperty(value = "货号")
private String goodCode;
/**规格型号*/
@Excel(name = "规格型号", width = 15)
@ApiModelProperty(value = "规格型号")
private java.lang.String specification;
@ApiModelProperty(value = "规格型号")
private String specification;
/**计量单位*/
@Excel(name = "计量单位", width = 15)
@ApiModelProperty(value = "计量单位")
private java.lang.String measuringUnit;
@ApiModelProperty(value = "计量单位")
private String measuringUnit;
/**计划采购数量*/
@Excel(name = "计划采购数量", width = 15)
@ApiModelProperty(value = "计划采购数量")
private java.lang.String purchaseNum;
@ApiModelProperty(value = "计划采购数量")
private String purchaseNum;
/**单价*/
@Excel(name = "单价", width = 15)
@ApiModelProperty(value = "单价")
private java.lang.String unitPrice;
@ApiModelProperty(value = "单价")
private String unitPrice;
@Excel(name = "总价", width = 15)
@ApiModelProperty(value = "总价")
private String totalPrice;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private java.lang.String remark;
@ApiModelProperty(value = "备注")
private String remark;
/**供应商编号*/
......@@ -100,7 +96,6 @@ public class PurchaseMaterial {
@ApiModelProperty(value = "物料类别名称")
private String sparepartTypeName;
@TableField(exist=false)
@ApiModelProperty(value = "供应商名称")
private String supplierName;
......@@ -129,6 +124,14 @@ public class PurchaseMaterial {
@ApiModelProperty(value = "扩展:剩余数量")
private Double remainNum;
@TableField(exist=false)
@ApiModelProperty(value = "采购合同编号")
private String purchaseContractId;
public String getPurchaseContractId() {
return this.getContractId();
}
public Double getRemainNum() {
remainNum = ConvertUtils.getDouble(this.getPurchaseNum() ,0d) - ConvertUtils.getDouble(this.getStoreNum() ,0d);// JSUtils.divide(this.getPurchaseNum() ,this.getStoreNum());
return remainNum;
......
......@@ -4,6 +4,7 @@ import com.skua.modules.erp.entity.ERPPurchaseContract;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.skua.modules.erp.vo.MaterialSearchVO;
import com.skua.tool.annotation.Anonymous;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -19,4 +20,10 @@ public interface ERPPurchaseContractMapper extends BaseMapper<ERPPurchaseContrac
*/
@Anonymous
List<ERPPurchaseContract> getListByDistributId(MaterialSearchVO materialSearchVO);
/***
* 变更合同
* @param contractId
*/
void changePurchaseContract(@Param("contractId") String contractId);
}
......
package com.skua.modules.erp.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 药剂结算单详情
*/
public interface ErpSettlementItemMapper extends BaseMapper<ErpSettlementItem> {
public void deleteBySettlementId(@Param("settlementId") String settlementId);
}
package com.skua.modules.erp.mapper;
import java.util.List;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.skua.modules.erp.vo.ErpSettlementVO;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.erp.entity.ErpSettlement;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 药剂结算单详情
*/
public interface ErpSettlementMapper extends BaseMapper<ErpSettlement> {
//校验供应商
List<ErpSettlementVO> checkSupplierByIds(@Param("ids") String ids);
//校验水厂
List<ErpSettlementVO> checkWaterDepartByIds(@Param("ids")String ids);
// 根据入库单ids,获取结算单
List<ErpSettlementItem> querySettlementByMaterialIds(@Param("ids") String materialIds);
}
......@@ -74,4 +74,10 @@ public interface PurchaseMaterialMapper extends BaseMapper<PurchaseMaterial> {
* @return
*/
int checkContractCode(@Param("contractCode")String contractCode );
/***
* 变更合同
* @param contractId
*/
void changePurchaseContract(@Param("contractId")String contractId);
}
......
......@@ -11,4 +11,9 @@
and pc.status = 3
order by pc.create_time desc
</select>
<update id="changePurchaseContract" >
update erp_purchase_contract set use_flag = 1 where id = #{contractId}
</update>
</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.ErpSettlementItemMapper">
<delete id="deleteBySettlementId" >
delete from erp_settlement_item where settlement_id = #{settlementId}
</delete>
</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">
<!--校验供应商-->
<select id="checkSupplierByIds" resultType="com.skua.modules.erp.vo.ErpSettlementVO">
select mi.supplier_id , sm.supp_name 'supplier_name' from erp_material_in mi ,ajh_supplier_manage sm
where mi.supplier_id = sm.id
and mi.id in (${ids}) group by mi.supplier_id
</select>
<!-- 校验水厂名称 -->
<select id="checkWaterDepartByIds" resultType="com.skua.modules.erp.vo.ErpSettlementVO">
select mi.depart_id , d.depart_name from erp_material_in mi ,sys_depart d
where mi.depart_id = d.id
and mi.id in (${ids}) group by mi.depart_id
</select>
<!-- 根据入库单ids,获取结算单-->
<select id="querySettlementByMaterialIds" resultType="com.skua.modules.erp.entity.ErpSettlementItem">
select mi.* from erp_material_in mi where mi.id in (${ids}) group by mi.create_time
</select>
<select id="querySettlementByMaterialIds" resultType="com.skua.modules.erp.entity.ErpSettlementItem">
select mi.* from erp_material_in mi where mi.id in (${ids}) group by mi.create_time
</select>
<select id="querySettlementByMaterialIds" resultType="com.skua.modules.erp.entity.ErpSettlementItem">
select mi.* from erp_material_in mi where mi.id in (${ids}) group by mi.create_time
</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.MaterialINMapper">
<!--查询 入库单 -->
<select id="queryArrivalRecordByList" resultType="com.skua.modules.erp.vo.ArrivalRecordExcelExportVO">
select d.depart_name, pc.contract_code 'purchaseContractCode', dc.contract_code 'distributContractCode' , sm.supp_name 'supplierName' ,mi.*
from erp_material_in mi
left join sys_depart d on d.id = mi.depart_id
left join erp_purchase_contract pc on pc.id = mi.purchase_contract_id
left join erp_distribut_contract dc on dc.id = mi.distribut_contract_id
left join ajh_supplier_manage sm on sm.id= mi.supplier_id
<where>
mi.audit_status =3
<if test="startTime != null and startTime !=''">
and mi.arrive_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime !=''">
and mi.arrive_time &lt;= #{endTime}
</if>
<if test="goodCode != null and goodCode !=''">
and mi.good_code like CONCAT('',#{goodCode},'%')
</if>
<if test="sparepartName != null and sparepartName !=''">
and mi.sparepart_name like CONCAT('%',#{sparepartName},'%')
</if>
<if test="departId != null and departId !=''">
and mi.depart_id = #{departId}
</if>
<if test="supplierId != null and supplierId !=''">
and mi.supplier_id = #{supplierId}
</if>
</where>
order by arrive_time desc
</select>
<!--获取入库审批列表:根据部门、采购合同、供应商、药剂分组搜索 -->
<select id="selectAuditMaterialINByPage" resultType="com.skua.modules.erp.vo.ArrivalRecordExcelExportVO">
select sparepart_id , purchase_contract_id,depart_id ,supplier_id,
sum(purchase_num) 'purchase_num',measuring_unit,specification,sparepart_name,tax_amount,
purchase_price,distribut_price,sum(purchase_total_price) 'purchase_total_price',sum(distribut_total_price) 'distribut_total_price',sum(total_price_tax) 'total_price_tax'
from erp_material_in
<where>
audit_status =3
<if test="materialIN.startTime != null and materialIN.startTime !=''">
and arrive_time &gt;= #{materialIN.startTime}
</if>
<if test="materialIN.endTime != null and materialIN.endTime !=''">
and arrive_time &lt;= #{materialIN.endTime}
</if>
<if test="materialIN.departId != null and materialIN.departId !=''">
and depart_id = #{materialIN.departId}
</if>
<if test="materialIN.supplierId != null and materialIN.supplierId !=''">
and supplier_id = #{materialIN.supplierId}
</if>
<if test="materialIN.purchaseContractId != null and materialIN.purchaseContractId !=''">
and purchase_contract_id = #{materialIN.purchaseContractId}
</if>
</where>
group by sparepart_id,purchase_contract_id,depart_id,supplier_id
</select>
<!-- -->
<select id="checkNum" resultType="java.lang.Double">
select (dm.material_num - aaa.num1 - 100) num from (
select sum(material_num) 'num1' from erp_material_in where good_code = 'HH102802' and distribut_contract_id ='1850726733397950466'
)aaa
left join erp_distribut_material dm on (dm.contract_id = '1850726733397950466' and dm.good_code ='HH102802')
</select>
</mapper>
......@@ -14,7 +14,7 @@
left join equipment_sparepart_supplies ss on m.sparepart_id = ss.id
left join equipment_sparepart_type st on st.id = m.sparepart_type
left join ajh_supplier_manage sm on sm.id = m.supplier_id
where m.contract_id = #{contractId}
where m.contract_id = #{contractId} and m.del_flag = 0
</select>
......@@ -22,8 +22,8 @@
<select id="queryByPage" resultType="com.skua.modules.erp.entity.PurchaseMaterial">
select ss.sparepart_code,ss.sparepart_name, st.item_text as 'sparepart_type_name',sm.supp_name as 'supplier_name', aaa.*
from (
select m.* from erp_purchase_material m , erp_purchase_contract pc where m.contract_id = pc.id
<if test="goodCode != null and goodCode != ''">
select m.* from erp_purchase_material m , erp_purchase_contract pc where m.contract_id = pc.id and pc.use_flag='0'
<if test="goodCode != null and goodCode != ''">
AND m.good_code like concat('%', #{goodCode}, '%')
</if>
<if test="departId != null and departId != ''">
......@@ -40,14 +40,14 @@
from erp_purchase_material pm
left join equipment_sparepart_type st on st.id = pm.sparepart_type
left join ajh_supplier_manage sm on sm.id = pm.supplier_id
where pm.good_code = #{goodCode} and pm.depart_id = #{departId}
where pm.good_code = #{goodCode} and pm.depart_id = #{departId} and pm.del_flag = 0
</select>
<!-- 校验货号是否唯一 -->
<select id="checkGoodCode" resultType="java.lang.Integer">
select count(1) from erp_purchase_material
where good_code = #{goodCode}
where del_flag = 0 and good_code = #{goodCode}
<if test="id != null and id !=''">and id = #{id}</if>
</select>
<!-- 药剂入库查询结果:物料清单-->
......@@ -57,7 +57,7 @@
from (
select dc.contract_code 'distribut_contract_code', dc.id 'distribut_contract_id', dm.distribut_price ,dm.distribut_total_price,dm.material_num 'distribut_num',pm.*
from erp_distribut_contract dc , erp_distribut_material dm , erp_purchase_material pm
where dc.id = dm.contract_id and dm.good_code = pm.good_code and pm.depart_id = #{param.departId}
where dc.id = dm.contract_id and dm.good_code = pm.good_code and pm.depart_id = #{param.departId} and pm.del_flag = 0 and dc.use_flag = '0'
<if test="param.sparepartCode != null and param.sparepartCode !=''">and pm.sparepart_code =#{param.sparepartCode}</if>
<if test="param.sparepartType != null and param.sparepartType !=''">and pm.sparepart_type in (${param.sparepartType}) </if>
<if test="param.sparepartName != null and param.sparepartName !=''">and pm.sparepart_name like '%' #{param.sparepartName}'%'</if>
......@@ -67,7 +67,7 @@
</select>
<!-- 根据id或code校验合同编号是否唯一-->
<select id="checkContractCode" resultType="java.lang.Integer">
select count(1) from erp_purchase_contract where use_flag =1 and start_time gt; now() and ent_time lt; now() and contract_code = #{contractCode}
select count(1) from erp_purchase_contract where use_flag =0 and start_time &gt; now() and end_time &lt; now() and contract_code = #{contractCode}
</select>
</mapper>
......
......@@ -48,24 +48,30 @@ public interface IERPPurchaseContractService extends IService<ERPPurchaseContrac
boolean updatePurchaseContract(PurchaseContractVO purchaseContractVO);
/***
* 变更合同
* @param purchaseContractVO
*/
void changePurchaseContract(PurchaseContractVO purchaseContractVO);
/***
* 删除purchaseContractVO
* @param id
*/
public void delById(String id);
void delById(String id);
/***
* 根据id查询purchaseContractVO
* @param id
* @return
*/
public PurchaseContractVO queryById(String id);
PurchaseContractVO queryById(String id);
/**
* 根据编号获取采购清单集合
* @param contractId
* @return
*/
public List<PurchaseMaterial> queryListByContractId(String contractId);
List<PurchaseMaterial> queryListByContractId(String contractId);
/***
* 审批 采购合同
......@@ -86,4 +92,6 @@ public interface IERPPurchaseContractService extends IService<ERPPurchaseContrac
* @return
*/
List<ERPPurchaseContract> getListByDistributId(MaterialSearchVO materialSearchVO);
}
......
package com.skua.modules.erp.service;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 药剂结算单详情
*/
public interface IErpSettlementItemService extends IService<ErpSettlementItem> {
}
package com.skua.modules.erp.service;
import com.skua.modules.erp.entity.ErpSettlement;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.erp.vo.ErpSettlementVO;
import java.util.List;
/**
* 药剂结算单详情
*/
public interface IErpSettlementService extends IService<ErpSettlement> {
/***
* 校验供应商
* @param ids
* @return
*/
List<ErpSettlementVO> checkSupplierByIds(String ids);
/***
* 校验水厂
* @param ids
* @return
*/
List<ErpSettlementVO> checkWaterDepartByIds(String ids);
/**
* 新增结算单
* @param erpSettlementVO
*/
void saveSettlement(ErpSettlementVO erpSettlementVO);
/**
* 修改结算单
* @param erpSettlementVO
*/
boolean updateSettlement(ErpSettlementVO erpSettlementVO);
//根据编号查询结算单
ErpSettlementVO queryById(String id);
// 删除
void delById(String id);
//供应商结算清单
ErpSettlementVO supplierSettlementByMaterialIds(String materialIds);
//水厂结束清单
ErpSettlementVO waterDepartSettlementByMaterialIds(String materialIds);
}
......@@ -138,7 +138,7 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
@Transactional
public boolean updatePurchaseContract(PurchaseContractVO purchaseContractVO){
// ge根据计划编号删除清单集合
purchaseMaterialMapper.delByContractId(purchaseContractVO.getId() ) ;
purchaseMaterialMapper.delByContractId( purchaseContractVO.getId() ) ;
//计算采购金额
String purchaseMoney = "0";
if( purchaseContractVO.getMaterialList() != null && !purchaseContractVO.getMaterialList().isEmpty()){
......@@ -153,6 +153,30 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
int count = this.baseMapper.updateById( purchaseContractVO );
return count > 0 ? true :false;
}
/***
* 变更合同
* @param purchaseContractVO
*/
@Transactional
public void changePurchaseContract(PurchaseContractVO purchaseContractVO){
// 变更合同
baseMapper.changePurchaseContract( purchaseContractVO.getOldContractId() );
purchaseMaterialMapper.changePurchaseContract( purchaseContractVO.getId() ) ;
//计算采购金额
String purchaseMoney = "0";
if( purchaseContractVO.getMaterialList() != null && !purchaseContractVO.getMaterialList().isEmpty()){
for(PurchaseMaterial material : purchaseContractVO.getMaterialList()){
material.setId(null);
material.setContractId( purchaseContractVO.getId() );
purchaseMaterialMapper.insert( material );
purchaseMoney = BaseUtil.add(purchaseMoney, material.getTotalPrice());
}
}
purchaseContractVO.setPurchaseMoney( purchaseMoney );
this.baseMapper.insert( purchaseContractVO );
}
/***
* 删除purchaseContractVO
......
package com.skua.modules.erp.service.impl;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.skua.modules.erp.mapper.ErpSettlementItemMapper;
import com.skua.modules.erp.service.IErpSettlementItemService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 药剂结算单详情
*/
@Service
public class ErpSettlementItemServiceImpl extends ServiceImpl<ErpSettlementItemMapper, ErpSettlementItem> implements IErpSettlementItemService {
}
package com.skua.modules.erp.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.modules.equipment.entity.SupplierManage;
import com.skua.modules.equipment.mapper.SupplierManageMapper;
import com.skua.modules.erp.entity.ErpSettlement;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.skua.modules.erp.mapper.ErpSettlementItemMapper;
import com.skua.modules.erp.mapper.ErpSettlementMapper;
import com.skua.modules.erp.service.IErpSettlementService;
import com.skua.modules.erp.vo.ErpSettlementVO;
import com.skua.modules.system.entity.SysDepart;
import com.skua.modules.system.mapper.SysDepartMapper;
import com.skua.tool.util.JSUtils;
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.List;
/**
* 药剂结算单详情
*/
@Service
public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, ErpSettlement> implements IErpSettlementService {
@Resource
private ErpSettlementItemMapper settlementItemMapper;
@Resource
private SupplierManageMapper supplierManageMapper;
@Resource
private SysDepartMapper departMapper;
/**
* 新增结算单
* @param erpSettlementVO
*/
@Transactional
public void saveSettlement(ErpSettlementVO erpSettlementVO){
this.baseMapper.insert(erpSettlementVO);
if(erpSettlementVO.getItemList() != null ){
for(ErpSettlementItem settlementItem : erpSettlementVO.getItemList()){
settlementItem.setSettlementId( erpSettlementVO.getId() ) ;
settlementItemMapper.insert( settlementItem) ;
}
}
}
/**
* 修改结算单
* @param erpSettlementVO
*/
@Transactional
public boolean updateSettlement(ErpSettlementVO erpSettlementVO){
int count = this.baseMapper.updateById(erpSettlementVO);
//
settlementItemMapper.deleteBySettlementId(erpSettlementVO.getId());
if(erpSettlementVO.getItemList() != null ){
for(ErpSettlementItem settlementItem : erpSettlementVO.getItemList()){
settlementItem.setSettlementId( erpSettlementVO.getId() ) ;
settlementItemMapper.insert( settlementItem) ;
}
}
return count >0 ?true:false;
}
//根据编号查询结算单
public ErpSettlementVO queryById(String id){
ErpSettlementVO erpSettlementVO =(ErpSettlementVO) this.baseMapper.selectById(id);
QueryWrapper<ErpSettlementItem> queryWrapper = new QueryWrapper<ErpSettlementItem>();
queryWrapper.eq("settlement_id",id);
List<ErpSettlementItem> settlementItemList = settlementItemMapper.selectList(queryWrapper);
if(erpSettlementVO != null )erpSettlementVO.setItemList( settlementItemList );
return erpSettlementVO;
}
// 删除
@Transactional
public void delById(String settlementId){
this.baseMapper.deleteById( settlementId );
settlementItemMapper.deleteBySettlementId(settlementId);
}
/***
* 校验供应商
* @param ids
* @return
*/
public List<ErpSettlementVO> checkSupplierByIds(String ids){
ids = JSUtils.quoteEach(ids,",");
return this.baseMapper.checkSupplierByIds( ids );
}
/***
* 校验水厂
* @param ids
* @return
*/
public List<ErpSettlementVO> checkWaterDepartByIds(String ids){
ids = JSUtils.quoteEach(ids,",");
return this.baseMapper.checkWaterDepartByIds( ids );
}
//供应商结算清单
public ErpSettlementVO supplierSettlementByMaterialIds(String materialIds){
List<ErpSettlementItem> itemList = this.baseMapper.querySettlementByMaterialIds( materialIds );
ErpSettlementVO erpSettlementVO = new ErpSettlementVO();
if(itemList != null){
for(ErpSettlementItem settlementItem : itemList){
erpSettlementVO.setSupplierId(settlementItem.getSupplierId() );
erpSettlementVO.setPurchaseContractId( settlementItem.getPurchaseContractId() );
erpSettlementVO.setDistributContractId( settlementItem.getDistributContractId());
//数量
//金额
//税额
//价税合计
}
}
erpSettlementVO.setItemList( itemList );
SupplierManage supplierManage = supplierManageMapper.selectById(erpSettlementVO.getSupplierId());
if(supplierManage != null ){
erpSettlementVO.setSupplierName( supplierManage.getSuppName() );
}
return erpSettlementVO;
}
//水厂结束清单
public ErpSettlementVO waterDepartSettlementByMaterialIds(String materialIds){
List<ErpSettlementItem> itemList = this.baseMapper.querySettlementByMaterialIds( materialIds );
ErpSettlementVO erpSettlementVO = new ErpSettlementVO();
if(itemList != null){
for(ErpSettlementItem settlementItem : itemList){
erpSettlementVO.setSupplierId(settlementItem.getSupplierId() );
}
}
erpSettlementVO.setItemList( itemList );
SysDepart depart = departMapper.selectById(erpSettlementVO.getDepartId());
if(depart != null ){
erpSettlementVO.setDepartName( depart.getDepartName() );
}
return erpSettlementVO;
}
}
package com.skua.modules.erp.vo;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 药剂结算单详情
*/
@Data
@ApiModel(value="erp_settlement_item数据传输对象", description="药剂结算单详情")
public class ErpSettlementItemVO {
/**主键*/
@ApiModelProperty(value = "主键")
private String id;
/**结算单编号*/
@Excel(name = "结算单编号", width = 15)
@ApiModelProperty(value = "结算单编号")
private String settlementId;
/**采购合同编号*/
@Excel(name = "采购合同编号", width = 15)
@ApiModelProperty(value = "采购合同编号")
private String contractId;
/**物料类别编号*/
@Excel(name = "物料类别编号", width = 15)
@ApiModelProperty(value = "物料类别编号")
private String sparepartType;
/**物料编号*/
@Excel(name = "物料编号", width = 15)
@ApiModelProperty(value = "物料编号")
private String sparepartId;
/**物料名称*/
@Excel(name = "物料名称", width = 15)
@ApiModelProperty(value = "物料名称")
private String sparepartName;
/**物料编码*/
@Excel(name = "物料编码", width = 15)
@ApiModelProperty(value = "物料编码")
private String sparepartCode;
/**货号*/
@Excel(name = "货号", width = 15)
@ApiModelProperty(value = "货号")
private String goodCode;
/**规格型号*/
@Excel(name = "规格型号", width = 15)
@ApiModelProperty(value = "规格型号")
private String specification;
/**计量单位*/
@Excel(name = "计量单位", width = 15)
@ApiModelProperty(value = "计量单位")
private String measuringUnit;
/**数量*/
@Excel(name = "数量", width = 15)
@ApiModelProperty(value = "数量")
private String materialNum;
/**单价*/
@Excel(name = "单价", width = 15)
@ApiModelProperty(value = "单价")
private String unitPrice;
/**总价*/
@Excel(name = "总价", width = 15)
@ApiModelProperty(value = "总价")
private String totalPrice;
/**税额*/
@Excel(name = "税额", width = 15)
@ApiModelProperty(value = "税额")
private String taxAmount;
/**价税合计*/
@Excel(name = "价税合计", width = 15)
@ApiModelProperty(value = "价税合计")
private String totalPriceTax;
/**到货时间*/
@Excel(name = "到货时间", width = 15)
@ApiModelProperty(value = "到货时间")
private String arriveTime;
/**备注*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
/**删除标识,0:有效,1:删除*/
@Excel(name = "删除标识,0:有效,1:删除", width = 15)
@ApiModelProperty(value = "删除标识,0:有效,1:删除")
private Integer delFlag;
}
package com.skua.modules.erp.vo;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.modules.erp.entity.ErpSettlement;
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 com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
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 supplierName;
@TableField(exist=false)
@ApiModelProperty(value = "部门名称")
private String departName;
@TableField(exist=false)
@ApiModelProperty(value = "结算清单")
private List<ErpSettlementItem> itemList ;
}
......@@ -28,4 +28,6 @@ public class PurchaseContractVO extends ERPPurchaseContract {
@TableField(exist=false)
@ApiModelProperty(value = "审批状态 1通过2不通过")
private String approveState;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!