修复采购模块接口404的错误
This commit is contained in:
parent
c4c28c8e70
commit
b2fa19a4cc
|
|
@ -77,6 +77,11 @@
|
||||||
<artifactId>security</artifactId>
|
<artifactId>security</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.qihangerp.service</groupId>
|
||||||
|
<artifactId>erp</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>cn.qihangerp.module</groupId>-->
|
<!-- <groupId>cn.qihangerp.module</groupId>-->
|
||||||
<!-- <artifactId>goods</artifactId>-->
|
<!-- <artifactId>goods</artifactId>-->
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
package cn.qihangerp.oms.controller;
|
||||||
|
|
||||||
|
import cn.qihangerp.common.AjaxResult;
|
||||||
|
import cn.qihangerp.common.PageQuery;
|
||||||
|
import cn.qihangerp.common.PageResult;
|
||||||
|
import cn.qihangerp.common.TableDataInfo;
|
||||||
|
import cn.qihangerp.model.bo.PurchaseOrderAddBo;
|
||||||
|
import cn.qihangerp.model.bo.PurchaseOrderOptionBo;
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrder;
|
||||||
|
import cn.qihangerp.model.query.PurchaseOrderSearchBo;
|
||||||
|
import cn.qihangerp.module.erp.service.ErpPurchaseOrderService;
|
||||||
|
import cn.qihangerp.security.common.BaseController;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品管理Controller
|
||||||
|
*
|
||||||
|
* @author qihang
|
||||||
|
* @date 2023-12-29
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/erp/purchase")
|
||||||
|
public class PurchaseOrderController extends BaseController
|
||||||
|
{
|
||||||
|
private final ErpPurchaseOrderService erpPurchaseOrderService;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(PurchaseOrderSearchBo bo, PageQuery pageQuery)
|
||||||
|
{
|
||||||
|
PageResult<ErpPurchaseOrder> pageResult = erpPurchaseOrderService.queryPageList(bo, pageQuery);
|
||||||
|
return getDataTable(pageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/detail/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
ErpPurchaseOrder detail = erpPurchaseOrderService.getDetailById(id);
|
||||||
|
return AjaxResult.success(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
public AjaxResult add(@RequestBody PurchaseOrderAddBo addBo, HttpServletRequest request)
|
||||||
|
{
|
||||||
|
addBo.setCreateBy(getUsername());
|
||||||
|
return toAjax(erpPurchaseOrderService.createPurchaseOrder(addBo));
|
||||||
|
}
|
||||||
|
@PutMapping("/updateStatus")
|
||||||
|
public AjaxResult updateStatus(@RequestBody PurchaseOrderOptionBo req, HttpServletRequest request)
|
||||||
|
{
|
||||||
|
req.setUpdateBy(getUsername());
|
||||||
|
int result = erpPurchaseOrderService.updateScmPurchaseOrder(req);
|
||||||
|
if(result == -1){
|
||||||
|
return new AjaxResult(0,"状态不正确");
|
||||||
|
}else{
|
||||||
|
return toAjax(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package cn.qihangerp.model.bo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单对象 scm_purchase_order
|
||||||
|
*
|
||||||
|
* @author qihang
|
||||||
|
* @date 2023-12-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PurchaseOrderAddBo
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/** 供应商id */
|
||||||
|
private Long contactId;
|
||||||
|
|
||||||
|
/** 订单编号 */
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
/** 订单日期 */
|
||||||
|
private Date orderDate;
|
||||||
|
|
||||||
|
|
||||||
|
/** 订单总金额 */
|
||||||
|
private BigDecimal orderAmount;
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
private List<PurchaseOrderAddItemBo> goodsList;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package cn.qihangerp.model.bo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单对象 scm_purchase_order
|
||||||
|
*
|
||||||
|
* @author qihang
|
||||||
|
* @date 2023-12-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PurchaseOrderAddItemBo {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String colorImage;
|
||||||
|
private String goodsName;
|
||||||
|
private BigDecimal purPrice;
|
||||||
|
private Long quantity;
|
||||||
|
private BigDecimal amount;
|
||||||
|
private Long goodsId;
|
||||||
|
private String colorValue;
|
||||||
|
private String number;
|
||||||
|
private String sizeValue;
|
||||||
|
private String skuCode;
|
||||||
|
private String styleValue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
package cn.qihangerp.model.bo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class PurchaseOrderOptionBo {
|
||||||
|
private Long id;
|
||||||
|
private String optionType;//操作类型(audit:审核;confirm:确认(和供应商确认成功);SupplierShip:供应商发货)
|
||||||
|
private String remark;
|
||||||
|
private String auditUser;
|
||||||
|
|
||||||
|
private String confirmUser;//采购单确认人
|
||||||
|
|
||||||
|
// 供应商发货
|
||||||
|
private Date supplierDeliveryTime;
|
||||||
|
private String shipCompany;
|
||||||
|
private String shipNo;
|
||||||
|
|
||||||
|
private BigDecimal shipCost;
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
public String getConfirmUser() {
|
||||||
|
return confirmUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfirmUser(String confirmUser) {
|
||||||
|
this.confirmUser = confirmUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getShipCost() {
|
||||||
|
return shipCost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShipCost(BigDecimal shipCost) {
|
||||||
|
this.shipCost = shipCost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getTotalAmount() {
|
||||||
|
return totalAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalAmount(BigDecimal totalAmount) {
|
||||||
|
this.totalAmount = totalAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getSupplierDeliveryTime() {
|
||||||
|
return supplierDeliveryTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSupplierDeliveryTime(Date supplierDeliveryTime) {
|
||||||
|
this.supplierDeliveryTime = supplierDeliveryTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShipCompany() {
|
||||||
|
return shipCompany;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShipCompany(String shipCompany) {
|
||||||
|
this.shipCompany = shipCompany;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShipNo() {
|
||||||
|
return shipNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShipNo(String shipNo) {
|
||||||
|
this.shipNo = shipNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUpdateBy() {
|
||||||
|
return updateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateBy(String updateBy) {
|
||||||
|
this.updateBy = updateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOptionType() {
|
||||||
|
return optionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptionType(String optionType) {
|
||||||
|
this.optionType = optionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAuditUser() {
|
||||||
|
return auditUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuditUser(String auditUser) {
|
||||||
|
this.auditUser = auditUser;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
package cn.qihangerp.model.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单
|
||||||
|
* @TableName erp_purchase_order
|
||||||
|
*/
|
||||||
|
@TableName(value ="erp_purchase_order")
|
||||||
|
@Data
|
||||||
|
public class ErpPurchaseOrder {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商id
|
||||||
|
*/
|
||||||
|
private Long supplierId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
private String orderNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单日期
|
||||||
|
*/
|
||||||
|
private Date orderDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建时间
|
||||||
|
*/
|
||||||
|
private Long orderTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单总金额
|
||||||
|
*/
|
||||||
|
private BigDecimal orderAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物流费用
|
||||||
|
*/
|
||||||
|
private BigDecimal shipAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态 0待审核1已审核101供应商已确认102供应商已发货2已收货3已入库
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购单审核人
|
||||||
|
*/
|
||||||
|
private String auditUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核时间
|
||||||
|
*/
|
||||||
|
private Long auditTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商确认时间
|
||||||
|
*/
|
||||||
|
private Date supplierConfirmTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商发货时间
|
||||||
|
*/
|
||||||
|
private Date supplierDeliveryTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货时间
|
||||||
|
*/
|
||||||
|
private Date receivedTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库时间
|
||||||
|
*/
|
||||||
|
private Date stockInTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<ErpPurchaseOrderItem> itemList;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
package cn.qihangerp.model.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单明细
|
||||||
|
* @TableName erp_purchase_order_item
|
||||||
|
*/
|
||||||
|
@TableName(value ="erp_purchase_order_item")
|
||||||
|
@Data
|
||||||
|
public class ErpPurchaseOrderItem {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
private String orderNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 150501采购 150502退货
|
||||||
|
*/
|
||||||
|
private String transType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购货金额
|
||||||
|
*/
|
||||||
|
private Double amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单日期
|
||||||
|
*/
|
||||||
|
private Date orderDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private Long goodsId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品编码
|
||||||
|
*/
|
||||||
|
private String goodsNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String goodsName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格id
|
||||||
|
*/
|
||||||
|
private Long specId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格编码
|
||||||
|
*/
|
||||||
|
private String specNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 颜色
|
||||||
|
*/
|
||||||
|
private String colorValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String colorImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 尺码
|
||||||
|
*/
|
||||||
|
private String sizeValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 款式
|
||||||
|
*/
|
||||||
|
private String styleValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单价
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 折扣额
|
||||||
|
*/
|
||||||
|
private BigDecimal disAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 折扣率
|
||||||
|
*/
|
||||||
|
private BigDecimal disRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量(采购单据)
|
||||||
|
*/
|
||||||
|
private Long quantity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已入库数量
|
||||||
|
*/
|
||||||
|
private Long inqty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库的仓库id
|
||||||
|
*/
|
||||||
|
private Integer locationid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1删除 0正常
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(同billStatus)0待审核1正常2已作废3已入库
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
package cn.qihangerp.model.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单物流表
|
||||||
|
* @TableName erp_purchase_order_ship
|
||||||
|
*/
|
||||||
|
@TableName(value ="erp_purchase_order_ship")
|
||||||
|
@Data
|
||||||
|
public class ErpPurchaseOrderShip {
|
||||||
|
/**
|
||||||
|
* 采购单ID(主键)
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商id
|
||||||
|
*/
|
||||||
|
private Long supplierId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物流公司
|
||||||
|
*/
|
||||||
|
private String shipCompany;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物流单号
|
||||||
|
*/
|
||||||
|
private String shipNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运费
|
||||||
|
*/
|
||||||
|
private BigDecimal freight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货时间
|
||||||
|
*/
|
||||||
|
private Date shipTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货时间
|
||||||
|
*/
|
||||||
|
private Date receiptTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0未收货1已收货2已入库)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 说明
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退回数量
|
||||||
|
*/
|
||||||
|
private Integer backCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库时间
|
||||||
|
*/
|
||||||
|
private Date stockInTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库数量
|
||||||
|
*/
|
||||||
|
private Integer stockInCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单日期
|
||||||
|
*/
|
||||||
|
private Date orderDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单编号
|
||||||
|
*/
|
||||||
|
private String orderNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单商品规格数
|
||||||
|
*/
|
||||||
|
private Integer orderSpecUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单商品数
|
||||||
|
*/
|
||||||
|
private Integer orderGoodsUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购订单总件数
|
||||||
|
*/
|
||||||
|
private Integer orderSpecUnitTotal;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.qihangerp.model.query;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单查询对象
|
||||||
|
*
|
||||||
|
* @author haoxr
|
||||||
|
* @since 2022/10/28
|
||||||
|
*/
|
||||||
|
@Schema(description ="菜单查询对象")
|
||||||
|
@Data
|
||||||
|
public class MenuQuery {
|
||||||
|
|
||||||
|
@Schema(description="关键字(菜单名称)")
|
||||||
|
private String keywords;
|
||||||
|
|
||||||
|
@Schema(description="状态(1->显示;0->隐藏)")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package cn.qihangerp.model.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PurchaseOrderSearchBo {
|
||||||
|
// 供应商id
|
||||||
|
private Integer supplierId;
|
||||||
|
private String orderNum;
|
||||||
|
private String orderStatus;
|
||||||
|
private String startTime;
|
||||||
|
private String endTime;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.qihangerp.service</groupId>
|
||||||
|
<artifactId>serviceImpl</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>erp</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.qihangerp.core</groupId>
|
||||||
|
<artifactId>common</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.qihangerp.model</groupId>
|
||||||
|
<artifactId>model</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.qihangerp.module.erp.mapper;
|
||||||
|
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrderItem;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 1
|
||||||
|
* @description 针对表【erp_purchase_order_item(采购订单明细)】的数据库操作Mapper
|
||||||
|
* @createDate 2025-09-09 09:51:48
|
||||||
|
* @Entity cn.qihangerp.model.entity.ErpPurchaseOrderItem
|
||||||
|
*/
|
||||||
|
public interface ErpPurchaseOrderItemMapper extends BaseMapper<ErpPurchaseOrderItem> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.qihangerp.module.erp.mapper;
|
||||||
|
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrder;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 1
|
||||||
|
* @description 针对表【erp_purchase_order(采购订单)】的数据库操作Mapper
|
||||||
|
* @createDate 2025-09-09 09:51:48
|
||||||
|
* @Entity cn.qihangerp.model.entity.ErpPurchaseOrder
|
||||||
|
*/
|
||||||
|
public interface ErpPurchaseOrderMapper extends BaseMapper<ErpPurchaseOrder> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.qihangerp.module.erp.mapper;
|
||||||
|
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrderShip;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 1
|
||||||
|
* @description 针对表【erp_purchase_order_ship(采购订单物流表)】的数据库操作Mapper
|
||||||
|
* @createDate 2025-09-09 10:40:41
|
||||||
|
* @Entity cn.qihangerp.model.entity.ErpPurchaseOrderShip
|
||||||
|
*/
|
||||||
|
public interface ErpPurchaseOrderShipMapper extends BaseMapper<ErpPurchaseOrderShip> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package cn.qihangerp.module.erp.service;
|
||||||
|
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrderItem;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 1
|
||||||
|
* @description 针对表【erp_purchase_order_item(采购订单明细)】的数据库操作Service
|
||||||
|
* @createDate 2025-09-09 09:51:48
|
||||||
|
*/
|
||||||
|
public interface ErpPurchaseOrderItemService extends IService<ErpPurchaseOrderItem> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package cn.qihangerp.module.erp.service;
|
||||||
|
|
||||||
|
import cn.qihangerp.common.PageQuery;
|
||||||
|
import cn.qihangerp.common.PageResult;
|
||||||
|
import cn.qihangerp.model.bo.PurchaseOrderAddBo;
|
||||||
|
import cn.qihangerp.model.bo.PurchaseOrderOptionBo;
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrder;
|
||||||
|
import cn.qihangerp.model.query.PurchaseOrderSearchBo;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 1
|
||||||
|
* @description 针对表【erp_purchase_order(采购订单)】的数据库操作Service
|
||||||
|
* @createDate 2025-09-09 09:51:48
|
||||||
|
*/
|
||||||
|
public interface ErpPurchaseOrderService extends IService<ErpPurchaseOrder> {
|
||||||
|
PageResult<ErpPurchaseOrder> queryPageList(PurchaseOrderSearchBo bo, PageQuery pageQuery);
|
||||||
|
ErpPurchaseOrder getDetailById(Long id);
|
||||||
|
int createPurchaseOrder(PurchaseOrderAddBo addBo);
|
||||||
|
int updateScmPurchaseOrder(PurchaseOrderOptionBo request);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package cn.qihangerp.module.erp.service;
|
||||||
|
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrderShip;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 1
|
||||||
|
* @description 针对表【erp_purchase_order_ship(采购订单物流表)】的数据库操作Service
|
||||||
|
* @createDate 2025-09-09 10:40:41
|
||||||
|
*/
|
||||||
|
public interface ErpPurchaseOrderShipService extends IService<ErpPurchaseOrderShip> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.qihangerp.module.erp.service.impl;
|
||||||
|
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrderItem;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import cn.qihangerp.module.erp.service.ErpPurchaseOrderItemService;
|
||||||
|
import cn.qihangerp.module.erp.mapper.ErpPurchaseOrderItemMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 1
|
||||||
|
* @description 针对表【erp_purchase_order_item(采购订单明细)】的数据库操作Service实现
|
||||||
|
* @createDate 2025-09-09 09:51:48
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ErpPurchaseOrderItemServiceImpl extends ServiceImpl<ErpPurchaseOrderItemMapper, ErpPurchaseOrderItem>
|
||||||
|
implements ErpPurchaseOrderItemService{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,276 @@
|
||||||
|
package cn.qihangerp.module.erp.service.impl;
|
||||||
|
|
||||||
|
import cn.qihangerp.common.PageQuery;
|
||||||
|
import cn.qihangerp.common.PageResult;
|
||||||
|
import cn.qihangerp.common.utils.DateUtils;
|
||||||
|
|
||||||
|
import cn.qihangerp.model.bo.PurchaseOrderAddBo;
|
||||||
|
import cn.qihangerp.model.bo.PurchaseOrderAddItemBo;
|
||||||
|
import cn.qihangerp.model.bo.PurchaseOrderOptionBo;
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrder;
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrderItem;
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrderShip;
|
||||||
|
import cn.qihangerp.model.query.PurchaseOrderSearchBo;
|
||||||
|
import cn.qihangerp.module.erp.mapper.ErpPurchaseOrderItemMapper;
|
||||||
|
import cn.qihangerp.module.erp.mapper.ErpPurchaseOrderShipMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import cn.qihangerp.module.erp.service.ErpPurchaseOrderService;
|
||||||
|
import cn.qihangerp.module.erp.mapper.ErpPurchaseOrderMapper;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 1
|
||||||
|
* @description 针对表【erp_purchase_order(采购订单)】的数据库操作Service实现
|
||||||
|
* @createDate 2025-09-09 09:51:48
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class ErpPurchaseOrderServiceImpl extends ServiceImpl<ErpPurchaseOrderMapper, ErpPurchaseOrder>
|
||||||
|
implements ErpPurchaseOrderService{
|
||||||
|
private final ErpPurchaseOrderMapper erpPurchaseOrderMapper;
|
||||||
|
private final ErpPurchaseOrderItemMapper erpPurchaseOrderItemMapper;
|
||||||
|
private final ErpPurchaseOrderShipMapper shipMapper;
|
||||||
|
|
||||||
|
private final String DATE_PATTERN =
|
||||||
|
"^(?:(?:(?:\\d{4}-(?:0?[1-9]|1[0-2])-(?:0?[1-9]|1\\d|2[0-8]))|(?:(?:(?:\\d{2}(?:0[48]|[2468][048]|[13579][26])|(?:(?:0[48]|[2468][048]|[13579][26])00))-0?2-29))$)|(?:(?:(?:\\d{4}-(?:0?[13578]|1[02]))-(?:0?[1-9]|[12]\\d|30))$)|(?:(?:(?:\\d{4}-0?[13-9]|1[0-2])-(?:0?[1-9]|[1-2]\\d|30))$)|(?:(?:(?:\\d{2}(?:0[48]|[13579][26]|[2468][048])|(?:(?:0[48]|[13579][26]|[2468][048])00))-0?2-29))$)$";
|
||||||
|
private final Pattern DATE_FORMAT = Pattern.compile(DATE_PATTERN);
|
||||||
|
@Override
|
||||||
|
public PageResult<ErpPurchaseOrder> queryPageList(PurchaseOrderSearchBo bo, PageQuery pageQuery) {
|
||||||
|
if(org.springframework.util.StringUtils.hasText(bo.getStartTime())){
|
||||||
|
Matcher matcher = DATE_FORMAT.matcher(bo.getStartTime());
|
||||||
|
boolean b = matcher.find();
|
||||||
|
if(b){
|
||||||
|
bo.setStartTime(bo.getStartTime()+" 00:00:00");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(org.springframework.util.StringUtils.hasText(bo.getEndTime())){
|
||||||
|
Matcher matcher = DATE_FORMAT.matcher(bo.getEndTime());
|
||||||
|
boolean b = matcher.find();
|
||||||
|
if(b){
|
||||||
|
bo.setEndTime(bo.getEndTime()+" 23:59:59");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<ErpPurchaseOrder> queryWrapper = new LambdaQueryWrapper<ErpPurchaseOrder>()
|
||||||
|
.eq(bo.getSupplierId()!=null, ErpPurchaseOrder::getSupplierId,bo.getSupplierId())
|
||||||
|
.eq(org.springframework.util.StringUtils.hasText(bo.getOrderNum()), ErpPurchaseOrder::getOrderNum,bo.getOrderNum())
|
||||||
|
.eq(bo.getOrderStatus()!=null, ErpPurchaseOrder::getStatus,bo.getOrderStatus())
|
||||||
|
.ge(org.springframework.util.StringUtils.hasText(bo.getStartTime()), ErpPurchaseOrder::getOrderTime,bo.getStartTime()+" 00:00:00")
|
||||||
|
.le(org.springframework.util.StringUtils.hasText(bo.getEndTime()), ErpPurchaseOrder::getOrderTime,bo.getEndTime()+" 23:59:59")
|
||||||
|
;
|
||||||
|
|
||||||
|
pageQuery.setOrderByColumn("order_time");
|
||||||
|
pageQuery.setIsAsc("desc");
|
||||||
|
Page<ErpPurchaseOrder> pages = erpPurchaseOrderMapper.selectPage(pageQuery.build(), queryWrapper);
|
||||||
|
|
||||||
|
// 查询子订单
|
||||||
|
if(pages.getRecords()!=null){
|
||||||
|
for (ErpPurchaseOrder order:pages.getRecords()) {
|
||||||
|
order.setItemList(erpPurchaseOrderItemMapper.selectList(new LambdaQueryWrapper<ErpPurchaseOrderItem>().eq(ErpPurchaseOrderItem::getOrderId, order.getId())));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageResult.build(pages);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErpPurchaseOrder getDetailById(Long id) {
|
||||||
|
ErpPurchaseOrder order = erpPurchaseOrderMapper.selectById(id);
|
||||||
|
if(order!=null){
|
||||||
|
order.setItemList(erpPurchaseOrderItemMapper.selectList(new LambdaQueryWrapper<ErpPurchaseOrderItem>().eq(ErpPurchaseOrderItem::getOrderId, order.getId())));
|
||||||
|
return order;
|
||||||
|
}else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public int createPurchaseOrder(PurchaseOrderAddBo addBo) {
|
||||||
|
if(addBo.getGoodsList() == null || addBo.getGoodsList().isEmpty()) return -1;
|
||||||
|
// 添加主表
|
||||||
|
ErpPurchaseOrder erpPurchaseOrder = new ErpPurchaseOrder();
|
||||||
|
|
||||||
|
erpPurchaseOrder.setOrderNum("PUR"+ DateUtils.parseDateToStr("yyyyMMddHHmmss",new Date()));
|
||||||
|
erpPurchaseOrder.setOrderAmount(addBo.getOrderAmount());
|
||||||
|
erpPurchaseOrder.setCreateTime(DateUtils.getNowDate());
|
||||||
|
erpPurchaseOrder.setOrderDate(addBo.getOrderDate());
|
||||||
|
erpPurchaseOrder.setSupplierId(addBo.getContactId());
|
||||||
|
erpPurchaseOrder.setOrderTime(System.currentTimeMillis()/1000);
|
||||||
|
erpPurchaseOrder.setCreateBy(addBo.getCreateBy());
|
||||||
|
erpPurchaseOrder.setStatus(0);
|
||||||
|
erpPurchaseOrder.setShipAmount(BigDecimal.ZERO);
|
||||||
|
erpPurchaseOrderMapper.insert(erpPurchaseOrder);
|
||||||
|
|
||||||
|
// 添加子表
|
||||||
|
for (PurchaseOrderAddItemBo item:addBo.getGoodsList()) {
|
||||||
|
ErpPurchaseOrderItem orderItem = new ErpPurchaseOrderItem();
|
||||||
|
orderItem.setOrderDate(addBo.getOrderDate());
|
||||||
|
orderItem.setOrderId(erpPurchaseOrder.getId());
|
||||||
|
orderItem.setOrderNum(erpPurchaseOrder.getOrderNum());
|
||||||
|
if(item.getAmount()!=null) {
|
||||||
|
orderItem.setAmount(item.getAmount().doubleValue());
|
||||||
|
}else{
|
||||||
|
|
||||||
|
orderItem.setAmount(item.getPurPrice()==null?0.0:item.getPurPrice().multiply(BigDecimal.valueOf(item.getQuantity())).doubleValue());
|
||||||
|
}
|
||||||
|
orderItem.setGoodsId(item.getGoodsId());
|
||||||
|
orderItem.setGoodsNum(item.getNumber());
|
||||||
|
orderItem.setIsDelete(0);
|
||||||
|
orderItem.setPrice(item.getPurPrice());
|
||||||
|
orderItem.setQuantity(item.getQuantity());
|
||||||
|
orderItem.setSpecId(item.getId());
|
||||||
|
orderItem.setSpecNum(item.getSkuCode());
|
||||||
|
orderItem.setStatus(0);
|
||||||
|
orderItem.setTransType("Purchase");
|
||||||
|
orderItem.setGoodsName(item.getGoodsName());
|
||||||
|
orderItem.setColorValue(item.getColorValue());
|
||||||
|
orderItem.setColorImage(item.getColorImage());
|
||||||
|
orderItem.setSizeValue(item.getSizeValue());
|
||||||
|
orderItem.setStyleValue(item.getStyleValue());
|
||||||
|
|
||||||
|
erpPurchaseOrderItemMapper.insert(orderItem);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateScmPurchaseOrder(PurchaseOrderOptionBo request) {
|
||||||
|
ErpPurchaseOrder order = erpPurchaseOrderMapper.selectById(request.getId());
|
||||||
|
if(order == null) return -1;
|
||||||
|
|
||||||
|
|
||||||
|
if(request.getOptionType().equals("audit")){
|
||||||
|
if(order.getStatus() !=0){
|
||||||
|
// 状态不是待审核的
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ErpPurchaseOrder erpPurchaseOrder = new ErpPurchaseOrder();
|
||||||
|
erpPurchaseOrder.setId(order.getId());
|
||||||
|
erpPurchaseOrder.setUpdateBy(request.getUpdateBy());
|
||||||
|
erpPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
erpPurchaseOrder.setAuditUser(request.getAuditUser());
|
||||||
|
erpPurchaseOrder.setAuditTime(System.currentTimeMillis()/1000);
|
||||||
|
erpPurchaseOrder.setRemark(request.getRemark());
|
||||||
|
erpPurchaseOrder.setStatus(1);
|
||||||
|
return erpPurchaseOrderMapper.updateById(erpPurchaseOrder);
|
||||||
|
}
|
||||||
|
else if (request.getOptionType().equals("confirm")) {
|
||||||
|
if(order.getStatus() !=1){
|
||||||
|
// 状态不是已审核的不能确认
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// 查询数据
|
||||||
|
List<ErpPurchaseOrderItem> items = erpPurchaseOrderItemMapper.selectList(new LambdaQueryWrapper<ErpPurchaseOrderItem>().eq(ErpPurchaseOrderItem::getOrderId, request.getId()));
|
||||||
|
|
||||||
|
Map<Long, List<ErpPurchaseOrderItem>> goodsGroup = items.stream().collect(Collectors.groupingBy(x -> x.getGoodsId()));
|
||||||
|
Long total = items.stream().mapToLong(ErpPurchaseOrderItem::getQuantity).sum();
|
||||||
|
// 生成费用信息
|
||||||
|
// ScmPurchaseOrderCost cost = new ScmPurchaseOrderCost();
|
||||||
|
// cost.setId(order.getId());
|
||||||
|
// cost.setOrderId(order.getId());
|
||||||
|
// cost.setSupplierId(order.getSupplierId());
|
||||||
|
// cost.setOrderNum(order.getOrderNum());
|
||||||
|
// cost.setOrderDate(order.getOrderDate());
|
||||||
|
// cost.setOrderGoodsUnit(goodsGroup.size());
|
||||||
|
// cost.setOrderSpecUnit(items.size());
|
||||||
|
// cost.setOrderSpecUnitTotal(total.intValue());
|
||||||
|
// cost.setOrderAmount(order.getOrderAmount());
|
||||||
|
// cost.setActualAmount(request.getTotalAmount());
|
||||||
|
// cost.setFreight(BigDecimal.ZERO);
|
||||||
|
// cost.setConfirmUser(request.getConfirmUser());
|
||||||
|
// cost.setConfirmTime(new Date());
|
||||||
|
// cost.setCreateBy(request.getUpdateBy());
|
||||||
|
// cost.setPayAmount(BigDecimal.ZERO);
|
||||||
|
// cost.setPayCount(0);
|
||||||
|
// cost.setStatus(0);
|
||||||
|
// costMapper.insert(cost);
|
||||||
|
|
||||||
|
// 更新主表
|
||||||
|
ErpPurchaseOrder erpPurchaseOrder = new ErpPurchaseOrder();
|
||||||
|
erpPurchaseOrder.setId(order.getId());
|
||||||
|
erpPurchaseOrder.setUpdateBy(request.getUpdateBy());
|
||||||
|
erpPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
erpPurchaseOrder.setStatus(101);
|
||||||
|
erpPurchaseOrder.setSupplierConfirmTime(new Date());
|
||||||
|
erpPurchaseOrderMapper.updateById(erpPurchaseOrder);
|
||||||
|
}
|
||||||
|
else if (request.getOptionType().equals("SupplierShip")) {
|
||||||
|
if(order.getStatus() !=101 && order.getStatus()!=1){
|
||||||
|
// 状态不是已确认的不能发货
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// 查询数据
|
||||||
|
List<ErpPurchaseOrderItem> items = erpPurchaseOrderItemMapper.selectList(new LambdaQueryWrapper<ErpPurchaseOrderItem>().eq(ErpPurchaseOrderItem::getOrderId, request.getId()));
|
||||||
|
|
||||||
|
Map<Long, List<ErpPurchaseOrderItem>> goodsGroup = items.stream().collect(Collectors.groupingBy(x -> x.getGoodsId()));
|
||||||
|
Long total = items.stream().mapToLong(ErpPurchaseOrderItem::getQuantity).sum();
|
||||||
|
|
||||||
|
// 生成物流信息
|
||||||
|
ErpPurchaseOrderShip ship = new ErpPurchaseOrderShip();
|
||||||
|
|
||||||
|
ship.setId(order.getId());
|
||||||
|
ship.setOrderId(order.getId());
|
||||||
|
ship.setSupplierId(order.getSupplierId());
|
||||||
|
ship.setOrderNum(order.getOrderNum());
|
||||||
|
ship.setOrderDate(order.getOrderDate());
|
||||||
|
ship.setOrderGoodsUnit(goodsGroup.size());
|
||||||
|
ship.setOrderSpecUnit(items.size());
|
||||||
|
ship.setOrderSpecUnitTotal(total.intValue());
|
||||||
|
ship.setShipCompany(request.getShipCompany());
|
||||||
|
ship.setShipNum(request.getShipNo());
|
||||||
|
ship.setFreight(request.getShipCost());
|
||||||
|
ship.setShipTime(request.getSupplierDeliveryTime());
|
||||||
|
ship.setCreateBy(request.getUpdateBy());
|
||||||
|
ship.setCreateTime(new Date());
|
||||||
|
ship.setStatus(0);
|
||||||
|
ship.setBackCount(0);
|
||||||
|
ship.setStockInCount(0);
|
||||||
|
shipMapper.insert(ship);
|
||||||
|
// 更新费用表
|
||||||
|
|
||||||
|
|
||||||
|
// ScmSupplier scmSupplier = supplierMapper.selectScmSupplierById(order.getContactId());
|
||||||
|
// 生成应付信息fms_payable_purchase
|
||||||
|
// ScmPurchaseOrderPayable payable = new ScmPurchaseOrderPayable();
|
||||||
|
// payable.setSupplierId(order.getSupplierId());
|
||||||
|
//// fmsPP.setSupplierName(scmSupplier!=null ? scmSupplier.getName():"数据库未找到供应商信息");
|
||||||
|
// payable.setAmount(order.getOrderAmount().add(request.getShipCost()));
|
||||||
|
// payable.setDate(new Date());
|
||||||
|
// payable.setPurchaseOrderNum(order.getOrderNum());
|
||||||
|
// payable.setPurchaseDesc("{采购商品总数量:"+total+",不同款式:"+goodsGroup.size()+",不同SKU:"+items.size()+",商品总价:"+order.getOrderAmount()+",运费:"+request.getShipCost()+"}");
|
||||||
|
// payable.setStatus(0);
|
||||||
|
// payable.setCreateTime(new Date());
|
||||||
|
// payable.setCreateBy(request.getUpdateBy());
|
||||||
|
// payableMapper.insert(payable);
|
||||||
|
|
||||||
|
// 更新主表
|
||||||
|
ErpPurchaseOrder erpPurchaseOrder = new ErpPurchaseOrder();
|
||||||
|
erpPurchaseOrder.setId(order.getId());
|
||||||
|
erpPurchaseOrder.setUpdateBy(request.getUpdateBy());
|
||||||
|
erpPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
erpPurchaseOrder.setStatus(102);
|
||||||
|
erpPurchaseOrder.setSupplierDeliveryTime(new Date());
|
||||||
|
erpPurchaseOrder.setShipAmount(request.getShipCost());
|
||||||
|
erpPurchaseOrderMapper.updateById(erpPurchaseOrder);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.qihangerp.module.erp.service.impl;
|
||||||
|
|
||||||
|
import cn.qihangerp.model.entity.ErpPurchaseOrderShip;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import cn.qihangerp.module.erp.service.ErpPurchaseOrderShipService;
|
||||||
|
import cn.qihangerp.module.erp.mapper.ErpPurchaseOrderShipMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 1
|
||||||
|
* @description 针对表【erp_purchase_order_ship(采购订单物流表)】的数据库操作Service实现
|
||||||
|
* @createDate 2025-09-09 10:40:41
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ErpPurchaseOrderShipServiceImpl extends ServiceImpl<ErpPurchaseOrderShipMapper, ErpPurchaseOrderShip>
|
||||||
|
implements ErpPurchaseOrderShipService{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?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="cn.qihangerp.module.erp.mapper.ErpPurchaseOrderItemMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="cn.qihangerp.model.entity.ErpPurchaseOrderItem">
|
||||||
|
<id property="id" column="id" />
|
||||||
|
<result property="orderId" column="order_id" />
|
||||||
|
<result property="orderNum" column="order_num" />
|
||||||
|
<result property="transType" column="trans_type" />
|
||||||
|
<result property="amount" column="amount" />
|
||||||
|
<result property="orderDate" column="order_date" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="goodsId" column="goods_id" />
|
||||||
|
<result property="goodsNum" column="goods_num" />
|
||||||
|
<result property="goodsName" column="goods_name" />
|
||||||
|
<result property="specId" column="spec_id" />
|
||||||
|
<result property="specNum" column="spec_num" />
|
||||||
|
<result property="colorValue" column="color_value" />
|
||||||
|
<result property="colorImage" column="color_image" />
|
||||||
|
<result property="sizeValue" column="size_value" />
|
||||||
|
<result property="styleValue" column="style_value" />
|
||||||
|
<result property="price" column="price" />
|
||||||
|
<result property="disAmount" column="dis_amount" />
|
||||||
|
<result property="disRate" column="dis_rate" />
|
||||||
|
<result property="quantity" column="quantity" />
|
||||||
|
<result property="inqty" column="inQty" />
|
||||||
|
<result property="locationid" column="locationId" />
|
||||||
|
<result property="isDelete" column="is_delete" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,order_id,order_num,trans_type,amount,order_date,
|
||||||
|
remark,goods_id,goods_num,goods_name,spec_id,
|
||||||
|
spec_num,color_value,color_image,size_value,style_value,
|
||||||
|
price,dis_amount,dis_rate,quantity,inQty,
|
||||||
|
locationId,is_delete,status
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?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="cn.qihangerp.module.erp.mapper.ErpPurchaseOrderMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="cn.qihangerp.model.entity.ErpPurchaseOrder">
|
||||||
|
<id property="id" column="id" />
|
||||||
|
<result property="supplierId" column="supplier_id" />
|
||||||
|
<result property="orderNum" column="order_num" />
|
||||||
|
<result property="orderDate" column="order_date" />
|
||||||
|
<result property="orderTime" column="order_time" />
|
||||||
|
<result property="orderAmount" column="order_amount" />
|
||||||
|
<result property="shipAmount" column="ship_amount" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="auditUser" column="audit_user" />
|
||||||
|
<result property="auditTime" column="audit_time" />
|
||||||
|
<result property="supplierConfirmTime" column="supplier_confirm_time" />
|
||||||
|
<result property="supplierDeliveryTime" column="supplier_delivery_time" />
|
||||||
|
<result property="receivedTime" column="received_time" />
|
||||||
|
<result property="stockInTime" column="stock_in_time" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,supplier_id,order_num,order_date,order_time,order_amount,
|
||||||
|
ship_amount,remark,status,audit_user,audit_time,
|
||||||
|
supplier_confirm_time,supplier_delivery_time,received_time,stock_in_time,create_by,
|
||||||
|
create_time,update_by,update_time
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?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="cn.qihangerp.module.erp.mapper.ErpPurchaseOrderShipMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="cn.qihangerp.model.entity.ErpPurchaseOrderShip">
|
||||||
|
<id property="id" column="id" />
|
||||||
|
<result property="supplierId" column="supplier_id" />
|
||||||
|
<result property="orderId" column="order_id" />
|
||||||
|
<result property="shipCompany" column="ship_company" />
|
||||||
|
<result property="shipNum" column="ship_num" />
|
||||||
|
<result property="freight" column="freight" />
|
||||||
|
<result property="shipTime" column="ship_time" />
|
||||||
|
<result property="receiptTime" column="receipt_time" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="backCount" column="back_count" />
|
||||||
|
<result property="stockInTime" column="stock_in_time" />
|
||||||
|
<result property="stockInCount" column="stock_in_count" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="orderDate" column="order_date" />
|
||||||
|
<result property="orderNum" column="order_num" />
|
||||||
|
<result property="orderSpecUnit" column="order_spec_unit" />
|
||||||
|
<result property="orderGoodsUnit" column="order_goods_unit" />
|
||||||
|
<result property="orderSpecUnitTotal" column="order_spec_unit_total" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,supplier_id,order_id,ship_company,ship_num,freight,
|
||||||
|
ship_time,receipt_time,create_by,create_time,status,
|
||||||
|
remark,back_count,stock_in_time,stock_in_count,update_by,
|
||||||
|
update_time,order_date,order_num,order_spec_unit,order_goods_unit,
|
||||||
|
order_spec_unit_total
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
<module>dou</module>
|
<module>dou</module>
|
||||||
<module>tao</module>
|
<module>tao</module>
|
||||||
<module>pdd</module>
|
<module>pdd</module>
|
||||||
|
<module>erp</module>
|
||||||
|
|
||||||
</modules>
|
</modules>
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
||||||
// 查询采购订单列表
|
// 查询采购订单列表
|
||||||
export function listPurchaseOrder(query) {
|
export function listPurchaseOrder(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/erp/purchase/list',
|
url: '/api/erp-api/erp/purchase/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue