业务单据与本地单据优化
parent
a9cf69056b
commit
da79ec6e4f
@ -0,0 +1,77 @@
|
||||
package com.glxp.sale.admin.controller.inventory;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.sale.admin.entity.inout.OrderEntity;
|
||||
import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity;
|
||||
import com.glxp.sale.admin.entity.inventory.InvProductEntity;
|
||||
import com.glxp.sale.admin.req.inout.DeleteRequest;
|
||||
import com.glxp.sale.admin.req.inout.OrderQueryRequest;
|
||||
import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest;
|
||||
import com.glxp.sale.admin.req.inventory.FilterInvProductRequest;
|
||||
import com.glxp.sale.admin.res.PageSimpleResponse;
|
||||
import com.glxp.sale.admin.res.inventory.InvProductResponse;
|
||||
import com.glxp.sale.admin.service.inventory.InvProductDetailService;
|
||||
import com.glxp.sale.admin.service.inventory.InvProductService;
|
||||
import com.glxp.sale.common.enums.ResultEnum;
|
||||
import com.glxp.sale.common.res.BaseResponse;
|
||||
import com.glxp.sale.common.util.ResultVOUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class InvProductsController {
|
||||
|
||||
@Resource
|
||||
InvProductService invProductService;
|
||||
@Resource
|
||||
InvProductDetailService invProductDetailService;
|
||||
|
||||
@GetMapping("spms/inv/products/filter")
|
||||
public BaseResponse filterInvProduct(FilterInvProductRequest filterInvProductRequest) {
|
||||
List<InvProductResponse> invProductResponses = invProductService.filterJoinInvProduct(filterInvProductRequest);
|
||||
PageInfo<InvProductResponse> pageInfo;
|
||||
pageInfo = new PageInfo<>(invProductResponses);
|
||||
PageSimpleResponse<InvProductResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(invProductResponses);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("spms/inv/products/filterDetail")
|
||||
public BaseResponse filterInvProductDetail(FilterInvProductDetailRequest filterInvProductRequest) {
|
||||
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.filterInvProduct(filterInvProductRequest);
|
||||
PageInfo<InvProductDetailEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(invProductDetailEntities);
|
||||
PageSimpleResponse<InvProductDetailEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(invProductDetailEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("spms/inv/products/delete")
|
||||
public BaseResponse deleteInvProduct(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
String id = deleteRequest.getId();
|
||||
InvProductEntity invProductEntity = invProductService.selectById(id);
|
||||
if (invProductEntity != null) {
|
||||
invProductService.deleteById(id);
|
||||
invProductDetailService.deleteByProductId(invProductEntity.getId() + "");
|
||||
return ResultVOUtils.success("删除成功");
|
||||
} else {
|
||||
return ResultVOUtils.error(500, "删除失败!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.glxp.sale.admin.dao.inventory;
|
||||
|
||||
import com.glxp.sale.admin.entity.inventory.InvProductEntity;
|
||||
import com.glxp.sale.admin.req.inventory.FilterInvProductRequest;
|
||||
import com.glxp.sale.admin.res.inventory.InvProductResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface InvProductDao {
|
||||
|
||||
|
||||
List<InvProductEntity> filterInvProduct(FilterInvProductRequest filterInvProductRequest);
|
||||
|
||||
List<InvProductResponse> filterJoinInvProduct(FilterInvProductRequest filterInvProductRequest);
|
||||
|
||||
boolean insertInvProduct(InvProductEntity invProductEntity);
|
||||
|
||||
boolean updateInvProduct(InvProductEntity invProductEntity);
|
||||
|
||||
InvProductEntity selectById(@Param("id") String id);
|
||||
|
||||
boolean deleteById(@Param("id") String id);
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.glxp.sale.admin.dao.inventory;
|
||||
|
||||
import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity;
|
||||
import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface InvProductDetailDao {
|
||||
|
||||
List<InvProductDetailEntity> filterInvProductDetail(FilterInvProductDetailRequest filterInvProductDetailRequest);
|
||||
|
||||
boolean insertInvProductDetail(InvProductDetailEntity invProductDetailEntity);
|
||||
|
||||
boolean insertInvProductDetails(List<InvProductDetailEntity> invProductDetailEntitys);
|
||||
|
||||
boolean updateInvProductDetail(InvProductDetailEntity invProductDetailEntity);
|
||||
|
||||
boolean deleteById(@Param("id") String id);
|
||||
|
||||
boolean deleteByProductId(@Param("productIdFk") String productIdFk);
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.glxp.sale.admin.entity.inventory;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class InvProductDetailEntity {
|
||||
private Integer id;
|
||||
private String code;
|
||||
private String productIdFk;
|
||||
private String orderIdFk;
|
||||
private String customerId;
|
||||
private String mainAction;
|
||||
private String action;
|
||||
private Integer count;
|
||||
private Date updateTime;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.glxp.sale.admin.entity.inventory;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InvProductEntity {
|
||||
private Integer id;
|
||||
private String productsName;
|
||||
private String nameCode;
|
||||
private String relIdFk;
|
||||
private String ggxh;
|
||||
private String batchNo;
|
||||
private String productionDate;
|
||||
private String expireDate;
|
||||
private String ylqxzcrbarmc;
|
||||
private String zczbhhzbapzbh;
|
||||
private Integer inCount;
|
||||
private Integer outCount;
|
||||
private Integer reCount;
|
||||
private String customerId;
|
||||
|
||||
public Integer getInCount() {
|
||||
if (inCount == null)
|
||||
return 0;
|
||||
return inCount;
|
||||
}
|
||||
|
||||
public Integer getOutCount() {
|
||||
if (outCount == null)
|
||||
return 0;
|
||||
return outCount;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.glxp.sale.admin.req.inventory;
|
||||
|
||||
import com.glxp.sale.admin.req.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FilterInvProductDetailRequest extends ListPageRequest {
|
||||
|
||||
private String id;
|
||||
private String code;
|
||||
private String productIdFk;
|
||||
private String customerId;
|
||||
private String mainAction;
|
||||
private String action;
|
||||
private Integer count;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.glxp.sale.admin.req.inventory;
|
||||
|
||||
import com.glxp.sale.admin.req.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FilterInvProductRequest extends ListPageRequest {
|
||||
|
||||
private String id;
|
||||
private String cpmctymc;
|
||||
private String nameCode;
|
||||
private String relIdFk;
|
||||
private String ggxh;
|
||||
private String batchNo;
|
||||
private String productionDate;
|
||||
private String expireDate;
|
||||
private String ylqxzcrbarmc;
|
||||
private String zczbhhzbapzbh;
|
||||
private String customerId;
|
||||
private String productsName;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.glxp.sale.admin.res.inventory;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InvProductResponse {
|
||||
private Integer id;
|
||||
private String cpmctymc;
|
||||
private String nameCode;
|
||||
private String relIdFk;
|
||||
private String ggxh;
|
||||
private String batchNo;
|
||||
private String productionDate;
|
||||
private String expireDate;
|
||||
private String ylqxzcrbarmc;
|
||||
private String zczbhhzbapzbh;
|
||||
private Integer inCount;
|
||||
private Integer outCount;
|
||||
private Integer reCount;
|
||||
private String customerId;
|
||||
|
||||
public Integer getInCount() {
|
||||
if (inCount == null)
|
||||
return 0;
|
||||
return inCount;
|
||||
}
|
||||
|
||||
public Integer getOutCount() {
|
||||
if (outCount == null)
|
||||
return 0;
|
||||
return outCount;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.glxp.sale.admin.service.inventory;
|
||||
|
||||
import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity;
|
||||
import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface InvProductDetailService {
|
||||
|
||||
|
||||
List<InvProductDetailEntity> filterInvProduct(FilterInvProductDetailRequest filterInvProductDetailRequest);
|
||||
|
||||
boolean insertInvProduct(InvProductDetailEntity invProductDetailEntity);
|
||||
|
||||
boolean insertInvProducts(List<InvProductDetailEntity> invProductDetailEntitys);
|
||||
|
||||
boolean updateInvProduct(InvProductDetailEntity invProductDetailEntity);
|
||||
|
||||
boolean deleteById(String id);
|
||||
|
||||
boolean deleteByProductId(String productIdFk);
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.glxp.sale.admin.service.inventory;
|
||||
|
||||
import com.glxp.sale.admin.entity.inventory.InvProductEntity;
|
||||
import com.glxp.sale.admin.req.inventory.FilterInvProductRequest;
|
||||
import com.glxp.sale.admin.res.inventory.InvProductResponse;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface InvProductService {
|
||||
|
||||
List<InvProductEntity> filterInvProduct(FilterInvProductRequest filterInvProductRequest);
|
||||
|
||||
List<InvProductResponse> filterJoinInvProduct(FilterInvProductRequest filterInvProductRequest);
|
||||
|
||||
InvProductEntity selectByUuid(String uuid, String batchNo);
|
||||
|
||||
InvProductEntity selectById(String id);
|
||||
|
||||
boolean insertInvProduct(InvProductEntity invProductEntity);
|
||||
|
||||
boolean updateInvProduct(InvProductEntity invProductEntity);
|
||||
|
||||
boolean deleteById(String id);
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.glxp.sale.admin.service.inventory.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.sale.admin.dao.inventory.InvProductDetailDao;
|
||||
import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity;
|
||||
import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest;
|
||||
import com.glxp.sale.admin.service.inventory.InvProductDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class InvProductDetailServiceImpl implements InvProductDetailService {
|
||||
|
||||
@Resource
|
||||
InvProductDetailDao invProductDetailDao;
|
||||
|
||||
@Override
|
||||
public List<InvProductDetailEntity> filterInvProduct(FilterInvProductDetailRequest filterInvProductDetailRequest) {
|
||||
if (filterInvProductDetailRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterInvProductDetailRequest.getPage() != null) {
|
||||
int offset = (filterInvProductDetailRequest.getPage() - 1) * filterInvProductDetailRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterInvProductDetailRequest.getLimit());
|
||||
}
|
||||
List<InvProductDetailEntity> data = invProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertInvProduct(InvProductDetailEntity invProductDetailEntity) {
|
||||
return invProductDetailDao.insertInvProductDetail(invProductDetailEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertInvProducts(List<InvProductDetailEntity> invProductDetailEntitys) {
|
||||
return invProductDetailDao.insertInvProductDetails(invProductDetailEntitys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateInvProduct(InvProductDetailEntity invProductDetailEntity) {
|
||||
return invProductDetailDao.updateInvProductDetail(invProductDetailEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(String id) {
|
||||
return invProductDetailDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteByProductId(String productIdFk) {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.glxp.sale.admin.service.inventory.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.sale.admin.dao.inventory.InvProductDao;
|
||||
import com.glxp.sale.admin.entity.inventory.InvProductEntity;
|
||||
import com.glxp.sale.admin.req.inventory.FilterInvProductRequest;
|
||||
import com.glxp.sale.admin.res.inventory.InvProductResponse;
|
||||
import com.glxp.sale.admin.service.inventory.InvProductService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class InvProductServiceImpl implements InvProductService {
|
||||
|
||||
@Resource
|
||||
InvProductDao invProductDao;
|
||||
|
||||
@Override
|
||||
public List<InvProductEntity> filterInvProduct(FilterInvProductRequest filterInvProductRequest) {
|
||||
if (filterInvProductRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterInvProductRequest.getPage() != null) {
|
||||
int offset = (filterInvProductRequest.getPage() - 1) * filterInvProductRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterInvProductRequest.getLimit());
|
||||
}
|
||||
List<InvProductEntity> data = invProductDao.filterInvProduct(filterInvProductRequest);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InvProductResponse> filterJoinInvProduct(FilterInvProductRequest filterInvProductRequest) {
|
||||
if (filterInvProductRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (filterInvProductRequest.getPage() != null) {
|
||||
int offset = (filterInvProductRequest.getPage() - 1) * filterInvProductRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterInvProductRequest.getLimit());
|
||||
}
|
||||
List<InvProductResponse> data = invProductDao.filterJoinInvProduct(filterInvProductRequest);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvProductEntity selectByUuid(String uuid, String batchNo) {
|
||||
FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
|
||||
filterInvProductRequest.setRelIdFk(uuid);
|
||||
filterInvProductRequest.setBatchNo(batchNo);
|
||||
List<InvProductEntity> data = filterInvProduct(filterInvProductRequest);
|
||||
if (data != null && data.size() > 0) {
|
||||
return data.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvProductEntity selectById(String id) {
|
||||
return invProductDao.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertInvProduct(InvProductEntity invProductEntity) {
|
||||
return invProductDao.insertInvProduct(invProductEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateInvProduct(InvProductEntity invProductEntity) {
|
||||
return invProductDao.updateInvProduct(invProductEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(String id) {
|
||||
return invProductDao.deleteById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package com.glxp.sale.admin.thread;
|
||||
|
||||
import com.glxp.sale.admin.constant.ConstantStatus;
|
||||
import com.glxp.sale.admin.constant.ConstantType;
|
||||
import com.glxp.sale.admin.entity.basic.BussinessTypeEntity;
|
||||
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
|
||||
import com.glxp.sale.admin.entity.inout.ErpOrderEntity;
|
||||
import com.glxp.sale.admin.entity.inout.FilterErpOrderRequest;
|
||||
import com.glxp.sale.admin.entity.inout.OrderEntity;
|
||||
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
|
||||
import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity;
|
||||
import com.glxp.sale.admin.entity.inventory.InvProductEntity;
|
||||
import com.glxp.sale.admin.req.basic.FilterUdiInfoRequest;
|
||||
import com.glxp.sale.admin.res.basic.UdiRelevanceResponse;
|
||||
import com.glxp.sale.admin.service.basic.BussinessTypeService;
|
||||
import com.glxp.sale.admin.service.basic.UdiInfoService;
|
||||
import com.glxp.sale.admin.service.basic.UdiRelevanceService;
|
||||
import com.glxp.sale.admin.service.inout.CodesService;
|
||||
import com.glxp.sale.admin.service.inout.OrderDetailService;
|
||||
import com.glxp.sale.admin.service.inout.OrderService;
|
||||
import com.glxp.sale.admin.service.inventory.InvProductDetailService;
|
||||
import com.glxp.sale.admin.service.inventory.InvProductService;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class InvProductsTrService {
|
||||
|
||||
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private OrderDetailService myErpOrderService;
|
||||
@Resource
|
||||
private CodesService codesService;
|
||||
@Resource
|
||||
private UdiRelevanceService udiRelevanceService;
|
||||
@Resource
|
||||
private UdiInfoService udiInfoService;
|
||||
@Resource
|
||||
private BussinessTypeService bussinessTypeService;
|
||||
|
||||
@Resource
|
||||
private InvProductService invProductService;
|
||||
@Resource
|
||||
private InvProductDetailService invProductDetailService;
|
||||
|
||||
|
||||
@Async
|
||||
public void genInvProducts(String orderId) {
|
||||
OrderEntity orderEntity = orderService.findById(orderId);
|
||||
if (orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_SUCCESS &&
|
||||
(orderEntity.getContrastStatus() == ConstantStatus.ORDER_CHECK_SUCCESS ||
|
||||
orderEntity.getContrastStatus() == ConstantStatus.ORDER_CHECK_UN)) {
|
||||
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest();
|
||||
filterErpOrderRequest.setOrderId(orderId);
|
||||
List<ErpOrderEntity> erpOrderEntities = myErpOrderService.filterAllMyErpOrder(filterErpOrderRequest);
|
||||
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderEntity.getAction());
|
||||
if (erpOrderEntities != null && erpOrderEntities.size() > 0) {
|
||||
for (ErpOrderEntity erpOrderEntity : erpOrderEntities) {
|
||||
|
||||
String nameCode = erpOrderEntity.getNameCode();
|
||||
String erpId = erpOrderEntity.getGoodsid();
|
||||
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
|
||||
filterUdiInfoRequest.setNameCode(nameCode);
|
||||
|
||||
if (bussinessTypeEntity.getThirdSysFk().equals("thirdId")) {
|
||||
filterUdiInfoRequest.setThirdId(erpId);
|
||||
} else if (bussinessTypeEntity.getThirdSysFk().equals("thirdId1")) {
|
||||
filterUdiInfoRequest.setThirdId1(erpId);
|
||||
} else if (bussinessTypeEntity.getThirdSysFk().equals("thirdId2")) {
|
||||
filterUdiInfoRequest.setThirdId2(erpId);
|
||||
} else if (bussinessTypeEntity.getThirdSysFk().equals("thirdId3")) {
|
||||
filterUdiInfoRequest.setThirdId3(erpId);
|
||||
} else if (bussinessTypeEntity.getThirdSysFk().equals("thirdId4")) {
|
||||
filterUdiInfoRequest.setThirdId4(erpId);
|
||||
}
|
||||
|
||||
List<UdiRelevanceResponse> udiRelevanceResponses = udiRelevanceService.filterUdiRelevance(filterUdiInfoRequest);
|
||||
String relId = null;
|
||||
if (udiRelevanceResponses != null && udiRelevanceResponses.size() > 0) {
|
||||
relId = udiRelevanceResponses.get(0).getId() + "";
|
||||
}
|
||||
if (relId != null) {
|
||||
InvProductEntity invProductEntity = invProductService.selectByUuid(relId, erpOrderEntity.getBatchNo());
|
||||
if (invProductEntity == null) {
|
||||
invProductEntity = new InvProductEntity();
|
||||
invProductEntity.setRelIdFk(relId);
|
||||
invProductEntity.setBatchNo(erpOrderEntity.getBatchNo());
|
||||
invProductEntity.setCustomerId(orderEntity.getCustomerId());
|
||||
invProductEntity.setExpireDate(erpOrderEntity.getExpireDate());
|
||||
invProductEntity.setProductionDate(erpOrderEntity.getProductDate());
|
||||
invProductEntity.setGgxh(erpOrderEntity.getPackSpec());
|
||||
invProductEntity.setNameCode(erpOrderEntity.getNameCode());
|
||||
invProductEntity.setProductsName(erpOrderEntity.getCoName());
|
||||
invProductEntity.setYlqxzcrbarmc(erpOrderEntity.getProductCompany());
|
||||
invProductEntity.setZczbhhzbapzbh(erpOrderEntity.getAuthCode());
|
||||
if (orderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
||||
invProductEntity.setOutCount(erpOrderEntity.getCount());
|
||||
} else if (orderEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
||||
invProductEntity.setInCount(erpOrderEntity.getCount());
|
||||
}
|
||||
invProductService.insertInvProduct(invProductEntity);
|
||||
invProductEntity = invProductService.selectByUuid(relId, erpOrderEntity.getBatchNo());
|
||||
} else {
|
||||
if (orderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
||||
invProductEntity.setOutCount(invProductEntity.getOutCount() + erpOrderEntity.getCount());
|
||||
} else if (orderEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
||||
invProductEntity.setInCount(invProductEntity.getInCount() + erpOrderEntity.getCount());
|
||||
}
|
||||
invProductService.updateInvProduct(invProductEntity);
|
||||
}
|
||||
List<WarehouseEntity> warehouseEntities = codesService.findByReceiptId(orderId);
|
||||
if (warehouseEntities != null && warehouseEntities.size() > 0) {
|
||||
for (WarehouseEntity warehouseEntity : warehouseEntities) {
|
||||
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(warehouseEntity.getNameCode());
|
||||
if (udiInfoEntity.getUuid().equals(erpOrderEntity.getUuidFk())) {
|
||||
if ((warehouseEntity.getBatchNo() == null && erpOrderEntity.getBatchNo() == null) ||
|
||||
warehouseEntity.getBatchNo().equals(erpOrderEntity.getBatchNo())) {
|
||||
InvProductDetailEntity invProductDetailEntity = new InvProductDetailEntity();
|
||||
invProductDetailEntity.setProductIdFk(invProductEntity.getId() + "");
|
||||
invProductDetailEntity.setCode(warehouseEntity.getCode());
|
||||
invProductDetailEntity.setAction(warehouseEntity.getAction());
|
||||
invProductDetailEntity.setMainAction(warehouseEntity.getMainAction());
|
||||
invProductDetailEntity.setOrderIdFk(warehouseEntity.getOrderId());
|
||||
invProductDetailEntity.setCount(warehouseEntity.getCount());
|
||||
invProductDetailEntity.setUpdateTime(new Date());
|
||||
invProductDetailEntity.setCustomerId(orderEntity.getCustomerId());
|
||||
invProductDetailService.insertInvProduct(invProductDetailEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
<?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.glxp.sale.admin.dao.inventory.InvProductDao">
|
||||
|
||||
<select id="filterInvProduct" parameterType="com.glxp.sale.admin.req.inventory.FilterInvProductRequest"
|
||||
resultType="com.glxp.sale.admin.entity.inventory.InvProductEntity">
|
||||
SELECT * FROM inv_product
|
||||
<where>
|
||||
<if test="productsName != '' and productsName != null">
|
||||
AND productsName = #{productsName}
|
||||
</if>
|
||||
<if test="nameCode != '' and nameCode != null">
|
||||
AND nameCode = #{nameCode}
|
||||
</if>
|
||||
<if test="relIdFk != '' and relIdFk != null">
|
||||
AND relIdFk = #{relIdFk}
|
||||
</if>
|
||||
<if test="ggxh != '' and ggxh != null">
|
||||
AND ggxh = #{ggxh}
|
||||
</if>
|
||||
<if test="batchNo != '' and batchNo != null">
|
||||
AND batchNo = #{batchNo}
|
||||
</if>
|
||||
<if test="productionDate != '' and productionDate != null">
|
||||
AND productionDate = #{productionDate}
|
||||
</if>
|
||||
<if test="expireDate != '' and expireDate != null">
|
||||
AND expireDate = #{expireDate}
|
||||
</if>
|
||||
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
|
||||
AND ylqxzcrbarmc = #{ylqxzcrbarmc}
|
||||
</if>
|
||||
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
|
||||
AND zczbhhzbapzbh = #{zczbhhzbapzbh}
|
||||
</if>
|
||||
<if test="customerId != '' and customerId != null">
|
||||
AND customerId = #{customerId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="Map"
|
||||
resultType="com.glxp.sale.admin.entity.inventory.InvProductEntity">
|
||||
SELECT * FROM inv_product WHERE id = #{id}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="filterJoinInvProduct" parameterType="com.glxp.sale.admin.req.inventory.FilterInvProductRequest"
|
||||
resultType="com.glxp.sale.admin.res.inventory.InvProductResponse">
|
||||
SELECT
|
||||
inv_product.id,
|
||||
basic_products.cpmctymc,basic_products.nameCode,inv_product.relIdFk,basic_products.ggxh,
|
||||
inv_product.batchNo
|
||||
,inv_product.productionDate,inv_product.expireDate,
|
||||
basic_products.ylqxzcrbarmc,basic_products.zczbhhzbapzbh,
|
||||
inv_product.inCount,inv_product.outCount
|
||||
,inv_product.reCount,inv_product.customerId
|
||||
FROM inv_product
|
||||
inner join basic_udirel on inv_product.relIdFk = basic_udirel.id
|
||||
inner join basic_products on basic_udirel.uuid = basic_products.uuid
|
||||
<where>
|
||||
basic_products.diType=1
|
||||
<if test="cpmctymc != '' and cpmctymc != null">
|
||||
AND basic_products.cpmctymc = #{cpmctymc}
|
||||
</if>
|
||||
<if test="nameCode != '' and nameCode != null">
|
||||
AND basic_products.nameCode = #{nameCode}
|
||||
</if>
|
||||
<if test="relIdFk != '' and relIdFk != null">
|
||||
AND inv_product.relIdFk = #{relIdFk}
|
||||
</if>
|
||||
<if test="ggxh != '' and ggxh != null">
|
||||
AND basic_products.ggxh = #{ggxh}
|
||||
</if>
|
||||
<if test="batchNo != '' and batchNo != null">
|
||||
AND inv_product.batchNo = #{batchNo}
|
||||
</if>
|
||||
<if test="productionDate != '' and productionDate != null">
|
||||
AND inv_product.productionDate = #{productionDate}
|
||||
</if>
|
||||
<if test="expireDate != '' and expireDate != null">
|
||||
AND inv_product.expireDate = #{expireDate}
|
||||
</if>
|
||||
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
|
||||
AND basic_products.ylqxzcrbarmc = #{ylqxzcrbarmc}
|
||||
</if>
|
||||
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
|
||||
AND basic_products.zczbhhzbapzbh = #{zczbhhzbapzbh}
|
||||
</if>
|
||||
<if test="customerId != '' and customerId != null">
|
||||
AND inv_product.customerId = #{customerId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
<insert id="insertInvProduct" keyProperty="id"
|
||||
parameterType="com.glxp.sale.admin.entity.inventory.InvProductEntity">
|
||||
insert INTO inv_product
|
||||
(productsName,nameCode,relIdFk,ggxh,batchNo,
|
||||
productionDate,expireDate,ylqxzcrbarmc,zczbhhzbapzbh,
|
||||
inCount,outCount,reCount,customerId)
|
||||
values
|
||||
(
|
||||
#{productsName},#{nameCode},
|
||||
#{relIdFk},#{ggxh},#{batchNo},
|
||||
#{productionDate},#{expireDate},
|
||||
#{ylqxzcrbarmc},#{zczbhhzbapzbh},
|
||||
#{inCount},#{outCount},#{reCount},#{customerId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<delete id="deleteById" parameterType="Map">
|
||||
DELETE FROM inv_product WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<update id="updateInvProduct" parameterType="com.glxp.sale.admin.entity.inventory.InvProductEntity">
|
||||
UPDATE inv_product
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="productsName != null">productsName=#{productsName},</if>
|
||||
<if test="nameCode != null">nameCode=#{nameCode},</if>
|
||||
<if test="relIdFk != null">relIdFk=#{relIdFk},</if>
|
||||
<if test="ggxh != null">ggxh=#{ggxh},</if>
|
||||
<if test="batchNo != null">batchNo=#{batchNo},</if>
|
||||
<if test="productionDate != null">productionDate=#{productionDate},</if>
|
||||
<if test="expireDate != null">expireDate=#{expireDate},</if>
|
||||
<if test="ylqxzcrbarmc != null">ylqxzcrbarmc=#{ylqxzcrbarmc},</if>
|
||||
<if test="zczbhhzbapzbh != null">zczbhhzbapzbh=#{zczbhhzbapzbh},</if>
|
||||
<if test="inCount != null">inCount=#{inCount},</if>
|
||||
<if test="outCount != null">outCount=#{outCount},</if>
|
||||
<if test="reCount != null">reCount=#{reCount},</if>
|
||||
<if test="customerId != null">customerId=#{customerId},</if>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,83 @@
|
||||
<?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.glxp.sale.admin.dao.inventory.InvProductDetailDao">
|
||||
|
||||
<select id="filterInvProductDetail" parameterType="com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest"
|
||||
resultType="com.glxp.sale.admin.entity.inventory.InvProductDetailEntity">
|
||||
SELECT * FROM inv_product_detail
|
||||
<where>
|
||||
<if test="productIdFk != '' and productIdFk != null">
|
||||
AND productIdFk = #{productIdFk}
|
||||
</if>
|
||||
<if test="customerId != '' and customerId != null">
|
||||
AND customerId = #{customerId}
|
||||
</if>
|
||||
<if test="mainAction != '' and mainAction != null">
|
||||
AND mainAction = #{mainAction}
|
||||
</if>
|
||||
<if test="action != '' and action != null">
|
||||
AND action = #{action}
|
||||
</if>
|
||||
<if test="count != '' and count != null">
|
||||
AND count = #{count}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
<insert id="insertInvProductDetail" keyProperty="id"
|
||||
parameterType="com.glxp.sale.admin.entity.inventory.InvProductDetailEntity">
|
||||
insert INTO inv_product_detail
|
||||
(code,productIdFk,orderIdFk,customerId,mainAction,action,count,updateTime)
|
||||
values
|
||||
|
||||
(
|
||||
#{code},
|
||||
#{productIdFk},#{orderIdFk},
|
||||
#{customerId},#{mainAction},#{action},#{count},#{updateTime}
|
||||
)
|
||||
|
||||
</insert>
|
||||
|
||||
<insert id="insertInvProductDetails" keyProperty="id"
|
||||
parameterType="com.glxp.sale.admin.entity.inventory.InvProductDetailEntity">
|
||||
insert INTO inv_product_detail
|
||||
(code,productIdFk,customerId,mainAction,action,count,updateTime)
|
||||
values
|
||||
|
||||
<foreach collection="stockPrintEntities" item="item" index="index"
|
||||
separator=",">
|
||||
(
|
||||
#{item.code},
|
||||
#{item.productIdFk},#{item.orderIdFk},
|
||||
#{item.customerId},#{item.mainAction},#{item.action},#{item.count},#{item.updateTime}
|
||||
)
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
||||
|
||||
<delete id="deleteById" parameterType="Map">
|
||||
DELETE FROM inv_product_detail WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductId" parameterType="Map">
|
||||
DELETE FROM inv_product_detail WHERE productIdFk = #{productIdFk}
|
||||
</delete>
|
||||
|
||||
<update id="updateInvProductDetail" parameterType="com.glxp.sale.admin.entity.inventory.InvProductDetailEntity">
|
||||
UPDATE inv_product_detail
|
||||
<set>
|
||||
<if test="code != null">code=#{code},</if>
|
||||
<if test="productIdFk != null">productIdFk=#{productIdFk},</if>
|
||||
<if test="customerId != null">customerId=#{customerId},</if>
|
||||
<if test="mainAction != null">mainAction=#{mainAction},</if>
|
||||
<if test="action != null">action=#{action},</if>
|
||||
<if test="count != null">count=#{count},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue