erp接口

This commit is contained in:
zjf committed 2025-02-27 16:14:15 +08:00
1 parent 0bb5f749e4
commit 45fa3999e1
9 files changed
+103 -10

No files matched your search

@@ -10,21 +10,21 @@ import lombok.Getter;
@Getter
public enum InventoryTypeEnum {
CGRK(1, "CGSQ"),
CKDD(2, "CGDD"),
CKRK(3, "CGRK"),
CKTH(4, "CGTH"),
LSCK(5, "LSCK"),
LSTH(6, "LSTH")
CGRK("1", "CGSQ"),
CKDD("2", "CGDD"),
CKRK("3", "CGRK"),
CKTH("4", "CGTH"),
LSCK("5", "LSCK"),
LSTH("6", "LSTH")
;
private final Integer type;
private final String type;
private final String value;
// 根据数字返回对应的值
public static String getValueByType(int type) {
public static String getValueByType(String type) {
for (InventoryTypeEnum v : InventoryTypeEnum.values()) {
if (v.type == type) {
if (v.type.equals(type)) {
return v.value;
}
}
@@ -1,5 +1,6 @@
package com.bsd.pjcloud.supermarket.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -24,6 +25,10 @@ public class SupermarketSpuUpdateStockReqDTO {
@NotNull(message = "商品 SPU 不能为空")
private List<Item> items;
@Schema(description = "下单设备类型,0默认安卓机,1移动端")
private int deviceType;
@Data
public static class Item {
@@ -0,0 +1,62 @@
package com.bsd.pjcloud.supermarket.dto.supplier;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class SmErpSupplierImportDto {
@ExcelProperty("货商编号")
private String supplierCode;
@ExcelProperty("货商名称")
private String supplierName;
@ExcelProperty("地址")
private String address;
@ExcelProperty("邮编")
private String postalCode;
@ExcelProperty("联系人")
private String linkName;
@ExcelProperty("联系电话")
private String phone;
@ExcelProperty("传真")
private String fax;
@ExcelProperty("税号")
private String taxNumber;
@ExcelProperty("开户行及帐号")
private String bankAccount;
@ExcelProperty("货商类别")
private String supplierCategory;
@ExcelProperty("货商地区")
private String supplierRegion;
@ExcelProperty("建档人")
private String creator;
@ExcelProperty("状态")
private String status;
@ExcelProperty("期初应付款")
private Double initialPayable;
@ExcelProperty("其它1")
private String other1;
@ExcelProperty("其它2")
private String other2;
@ExcelProperty("其它3")
private String other3;
@ExcelProperty("拼音简码")
private String pinyinCode;
}
@@ -82,4 +82,7 @@ public class SmErpAuxiliaryCodeEntity extends Model<SmErpAuxiliaryCodeEntity> {
*/
@Schema(description="租户编号")
private Long tenantId;
@Schema(description="包装单位id")
private Long unitId;
}
@@ -162,6 +162,9 @@ public class SmErpInventoryRecordsEntity extends Model<SmErpInventoryRecordsEnti
@Schema(description="租户编号")
private Long tenantId;
@Schema(description="设备类型")
private Integer deviceType;
@Schema(description="商品名称")
@TableField(exist = false)
private String productName;
@@ -41,7 +41,7 @@ public class SmErpCommonController {
*/
@Operation(summary = "获取业务流水编号" , description = "获取业务流水编号" )
@GetMapping("/getSequence")
public R getErpSpuPage(@RequestParam("type")Integer type) {
public R getErpSpuPage(@RequestParam("type")String type) {
String valueByType = InventoryTypeEnum.getValueByType(type);
String s = sequence.nextNo();
String result = valueByType + "-" + s;
@@ -7,6 +7,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.sequence.sequence.Sequence;
import com.bsd.pjcloud.supermarket.constant.InventoryTypeEnum;
import com.bsd.pjcloud.supermarket.constant.OrderTypeEnum;
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuQueryDTO;
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
import com.bsd.pjcloud.supermarket.dto.cgplan.ErpCgPlanDTO;
@@ -30,9 +33,11 @@ import com.bsd.pjcloud.supermarket.vo.sm.smspu.SmErpPageScopeVo;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
@@ -56,6 +61,9 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
private final SmErpStockService smErpStockService;
@Autowired
private Sequence sequence;
@Override
@Transactional
public R saveSpu(SmErpSpuEntity supermarketSpu) {
@@ -187,6 +195,16 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
updateStockDTOS.add(updateStockDTO);
}
smErpStockService.updateStock(updateStockDTOS);
//todo 生成出入库记录
// SmErpInventoryRecordsEntity smErpInventoryRecordsEntity = new SmErpInventoryRecordsEntity();
// String s = sequence.nextNo();
// String result = InventoryTypeEnum.LSCK.getValue() + "-" + s;
// smErpInventoryRecordsEntity.setInventoryCode(result);
// smErpInventoryRecordsEntity.setInventoryDate(LocalDate.now());
// smErpInventoryRecordsEntity.setInventoryType(InventoryTypeEnum.LSCK.getType());
// smErpInventoryRecordsEntity.setOrderType(OrderTypeEnum.CK.getType());
// smErpInventoryRecordsEntity.setDeviceType(updateStockReqDTO.getDeviceType());
return R.ok();
}
@@ -13,5 +13,6 @@
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
<result property="unitId" column="unit_id"/>
</resultMap>
</mapper>
@@ -26,5 +26,6 @@
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
<result property="deviceType" column="device_type"/>
</resultMap>
</mapper>