
8 changed files with 287 additions and 0 deletions
@ -0,0 +1,28 @@ |
|||||
|
package com.yxt.supervise.cyf.api.finishproductstorage; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author feikefei |
||||
|
* @create 2023-05-22-16:01 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "成品库入库记录", description = "成品库入库记录") |
||||
|
@TableName("finish_product_storage") |
||||
|
public class FinishProductStorage extends BaseEntity { |
||||
|
//合同号
|
||||
|
private String contractNumber; |
||||
|
//供货商sid
|
||||
|
private String supplierSid; |
||||
|
//收料净重
|
||||
|
private Double weight; |
||||
|
//收料价值
|
||||
|
private Double value; |
||||
|
//入库日期
|
||||
|
private String warehousingDate; |
||||
|
//产品sid
|
||||
|
private String prodSid; |
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
package com.yxt.supervise.cyf.api.finishproductstorage; |
||||
|
|
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author feikefei |
||||
|
* @create 2023-05-22-16:05 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "成品库入库记录 传输对象数据", description = "成品库入库记录 传输对象数据") |
||||
|
public class FinishProductStorageDto implements Dto { |
||||
|
private String id; |
||||
|
private String sid; |
||||
|
|
||||
|
|
||||
|
//合同编号
|
||||
|
private String contractNumber; |
||||
|
//供货商sid
|
||||
|
private String supplierSid; |
||||
|
//收料净重
|
||||
|
private Double weight; |
||||
|
//收料价值
|
||||
|
private Double value; |
||||
|
//入库日期
|
||||
|
private String warehousingDate; |
||||
|
//商品类别sid
|
||||
|
private String prodSid; |
||||
|
//备注
|
||||
|
private String remarks; |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package com.yxt.supervise.cyf.api.finishproductstorage; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author feikefei |
||||
|
* @create 2023-05-23-9:35 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "成品库入库记录 分页传输对象", description = "成品库入库记录 分页传输对象") |
||||
|
public class FinishProductStorageQuery implements Query { |
||||
|
private String id; |
||||
|
private String sid; |
||||
|
//合同号
|
||||
|
private String contractNumber; |
||||
|
//供货商sid
|
||||
|
private String supplierSid; |
||||
|
//收料净重
|
||||
|
private Double weight; |
||||
|
//收料价值
|
||||
|
private Double value; |
||||
|
//入库日期
|
||||
|
private String warehousingDate; |
||||
|
//产品sid
|
||||
|
private String prodSid; |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
package com.yxt.supervise.cyf.api.finishproductstorage; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author feikefei |
||||
|
* @create 2023-05-23-9:35 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "成品库入库记录 返回视图对象字段", description = "成品库入库记录 返回视图对象字段") |
||||
|
public class FinishProductStorageVo implements Vo { |
||||
|
private String id; |
||||
|
private String sid; |
||||
|
//合同号
|
||||
|
private String contractNumber; |
||||
|
//供货商sid
|
||||
|
private String supplierSid; |
||||
|
//收料净重
|
||||
|
private Double weight; |
||||
|
//收料价值
|
||||
|
private Double value; |
||||
|
//入库日期
|
||||
|
private String warehousingDate; |
||||
|
//产品sid
|
||||
|
private String prodSid; |
||||
|
|
||||
|
//商品类别名称
|
||||
|
private String typeName; |
||||
|
//商品类别编号
|
||||
|
private String typeNumber; |
||||
|
//商品数量
|
||||
|
private Double amount; |
||||
|
//商品名称
|
||||
|
private String prodName; |
||||
|
//商品编号
|
||||
|
private String prodNumber; |
||||
|
//品牌名称
|
||||
|
private String inforName; |
||||
|
//品牌编号
|
||||
|
private String inforNumber; |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package com.yxt.supervise.cyf.biz.finishproductstorage; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.supervise.cyf.api.finishproductinventory.FinishProductInventory; |
||||
|
import com.yxt.supervise.cyf.api.finishproductstorage.FinishProductStorage; |
||||
|
import com.yxt.supervise.cyf.api.finishproductstorage.FinishProductStorageVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
/** |
||||
|
* @author feikefei |
||||
|
* @create 2023-05-23-11:00 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface FinishProductStorageMapper extends BaseMapper<FinishProductStorage> { |
||||
|
|
||||
|
IPage<FinishProductStorageVo> selectPageVo(IPage<FinishProductStorage> page, @Param(Constants.WRAPPER) Wrapper<FinishProductStorage> qw); |
||||
|
|
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
<?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.yxt.supervise.cyf.biz.finishproductstorage.FinishProductStorageMapper"> |
||||
|
<select id="selectPageVo" resultType="com.yxt.supervise.cyf.api.finishproductstorage.FinishProductStorageVo"> |
||||
|
select s.*,t.name typeName,t.number typeNumber,pt.name prodName,pt.number prodNumber,i.name inforName,i.number inforNumber,pi.amount |
||||
|
from finish_product_storage s |
||||
|
left join product_type t on s.prodSid = t.sid |
||||
|
inner join product_type pt on t.pSid = pt.sid |
||||
|
left join product_information i on i.sid = pt.prodSid |
||||
|
left join finish_product_inventory pi on s.prodSid = pi.prodSid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,45 @@ |
|||||
|
package com.yxt.supervise.cyf.biz.finishproductstorage; |
||||
|
|
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.supervise.cyf.api.finishproductstorage.FinishProductStorageDto; |
||||
|
import com.yxt.supervise.cyf.api.finishproductstorage.FinishProductStorageQuery; |
||||
|
import com.yxt.supervise.cyf.api.finishproductstorage.FinishProductStorageVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @author feikefei |
||||
|
* @create 2023-05-23-10:59 |
||||
|
*/ |
||||
|
@Api(tags = "成品库入库记录") |
||||
|
@RestController |
||||
|
@RequestMapping("cyf/storage") |
||||
|
public class FinishProductStorageRest { |
||||
|
|
||||
|
@Autowired |
||||
|
private FinishProductStorageService finishProductStorageService; |
||||
|
|
||||
|
@ApiOperation("增加") |
||||
|
@PostMapping("/save") |
||||
|
public ResultBean save(@RequestBody FinishProductStorageDto dto){ |
||||
|
return finishProductStorageService.save(dto); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation("删除") |
||||
|
@GetMapping("/delete/{sid}") |
||||
|
public ResultBean delete(@PathVariable String sid){ |
||||
|
return finishProductStorageService.delete(sid); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation("成品库记录 分页查询") |
||||
|
@PostMapping("/listPage") |
||||
|
public ResultBean<PagerVo<FinishProductStorageVo>> listPage(PagerQuery<FinishProductStorageQuery> pq){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<FinishProductStorageVo> listPage = finishProductStorageService.listPage(pq); |
||||
|
return rb.success().setData(listPage); |
||||
|
} |
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
package com.yxt.supervise.cyf.biz.finishproductstorage; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.supervise.cyf.api.finishproductinventory.FinishProductInventory; |
||||
|
import com.yxt.supervise.cyf.api.finishproductstorage.FinishProductStorage; |
||||
|
import com.yxt.supervise.cyf.api.finishproductstorage.FinishProductStorageDto; |
||||
|
import com.yxt.supervise.cyf.api.finishproductstorage.FinishProductStorageQuery; |
||||
|
import com.yxt.supervise.cyf.api.finishproductstorage.FinishProductStorageVo; |
||||
|
import com.yxt.supervise.cyf.biz.finishproductinventory.FinishProductInventoryMapper; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @author feikefei |
||||
|
* @create 2023-05-23-11:00 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class FinishProductStorageService extends MybatisBaseService<FinishProductStorageMapper, FinishProductStorage> { |
||||
|
|
||||
|
@Autowired |
||||
|
private FinishProductInventoryMapper finishProductInventoryMapper; |
||||
|
|
||||
|
public ResultBean save(FinishProductStorageDto dto){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
FinishProductStorage record = new FinishProductStorage(); |
||||
|
BeanUtil.copyProperties(dto,record,"id","sid"); |
||||
|
baseMapper.insert(record); |
||||
|
FinishProductInventory finishProductInventory = finishProductInventoryMapper.selectPriceByProdSid(dto.getProdSid()); |
||||
|
if (finishProductInventory != null){ |
||||
|
finishProductInventory.setAmount(finishProductInventory.getAmount()+dto.getWeight()); |
||||
|
finishProductInventoryMapper.updateById(finishProductInventory); |
||||
|
return rb.success().setMsg("入库成功"); |
||||
|
}else { |
||||
|
FinishProductInventory inventory = new FinishProductInventory(); |
||||
|
inventory.setAmount(dto.getWeight()); |
||||
|
inventory.setProdSid(dto.getProdSid()); |
||||
|
finishProductInventoryMapper.insert(inventory); |
||||
|
return rb.success().setMsg("入库成功"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public ResultBean delete(String sid){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
baseMapper.delete(new QueryWrapper<FinishProductStorage>().eq("sid",sid)); |
||||
|
return rb.success().setMsg("删除成功"); |
||||
|
} |
||||
|
|
||||
|
public PagerVo<FinishProductStorageVo> listPage(PagerQuery<FinishProductStorageQuery> pq){ |
||||
|
FinishProductStorageQuery params = pq.getParams(); |
||||
|
QueryWrapper<FinishProductStorage> wq = new QueryWrapper<>(); |
||||
|
if (params != null){ |
||||
|
if (!params.getContractNumber().equals("")){ |
||||
|
wq.eq("s.contractNumber",params.getContractNumber()); |
||||
|
} |
||||
|
if (!params.getWarehousingDate().equals("")){ |
||||
|
wq.eq("s.warehousingDate",params.getWarehousingDate()); |
||||
|
} |
||||
|
} |
||||
|
IPage<FinishProductStorage> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<FinishProductStorageVo> pageVo = baseMapper.selectPageVo(page, wq); |
||||
|
PagerVo<FinishProductStorageVo> pageToVo = PagerUtil.pageToVo(pageVo, null); |
||||
|
return pageToVo; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue