业务单据与本地单据优化

master
anthonywj 3 years ago
parent a9cf69056b
commit da79ec6e4f

@ -257,6 +257,7 @@ public class WareHouseController {
warehouseEntity.setFromCorp(addOrderRequest.getFromCorp());
warehouseEntity.setBatchNo(udiEntity.getBatchNo());
warehouseEntity.setProduceDate(udiEntity.getProduceDate());
warehouseEntity.setNameCode(udiEntity.getUdi());
warehouseEntity.setExpireDate(udiEntity.getExpireDate());
warehouseEntity.setSerialNo(udiEntity.getSerialNo());
warehouseEntity.setCount(1);

@ -19,6 +19,7 @@ import com.glxp.sale.admin.service.basic.UdiRelevanceService;
import com.glxp.sale.admin.service.param.SystemParamConfigService;
import com.glxp.sale.admin.service.inout.OrderDetailService;
import com.glxp.sale.admin.service.inout.OrderService;
import com.glxp.sale.admin.thread.InvProductsTrService;
import com.glxp.sale.admin.thread.IoTransInoutService;
import org.springframework.stereotype.Service;
@ -37,6 +38,8 @@ public class ContrastErpUtil {
@Resource
IoTransInoutService ioTransInoutService;
@Resource
InvProductsTrService InvProductsTrService;
public ContrastErpUtil() {
@ -117,6 +120,8 @@ public class ContrastErpUtil {
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_SUCCESS);
orderService.updateOrder(orderEntity);
ioTransInoutService.printOrder(orderEntity.getId());
InvProductsTrService.genInvProducts(orderEntity.getId());
}
if (errorData.size() > 0) {
new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, errorData);

@ -191,7 +191,7 @@ public class InoutUtils {
List<UdiInfoEntity> returnOrderDetail = new ArrayList<>();
Map<String, UdiInfoEntity> sortMaps = new HashMap<>();
for (UdiInfoEntity detailCodeEntity : udiInfoEntities) {
String key = detailCodeEntity.getNameCode();
String key = detailCodeEntity.getUuid() + detailCodeEntity.getBatchNo();//todo 20211118 从nameCode修改为UUID未测试
UdiInfoEntity temp = sortMaps.get(key);
if (temp != null) {
detailCodeEntity.setCount(temp.getCount() + detailCodeEntity.getCount());
@ -218,6 +218,7 @@ public class InoutUtils {
erpOrderEntity.setProductCompany(erpDetailCodeEntity.getYlqxzcrbarmc());
erpOrderEntity.setAuthCode(erpDetailCodeEntity.getZczbhhzbapzbh());
erpOrderEntity.setPackSpec(erpDetailCodeEntity.getGgxh());
erpOrderEntity.setUuidFk(erpDetailCodeEntity.getUuid());
erpOrderEntities.add(erpOrderEntity);
}
if (!erpOrderEntities.isEmpty())

@ -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);
}

@ -38,6 +38,7 @@ public class ErpOrderEntity {
private String expireDate;
private Integer erpCount;
private Integer reCount;
private String uuidFk;
private String nameCode;

@ -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;
}
}

@ -6,6 +6,7 @@ import com.glxp.sale.admin.req.inout.WarehouseQueryRequest;
import java.util.List;
public interface CodesService {
List<WarehouseEntity> listWarehouse(WarehouseQueryRequest warehouseQueryRequest);
boolean insertWarehouse(WarehouseEntity warehouseEntity);

@ -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);
}
}
}
}
}
}
}
}
}
}

@ -61,13 +61,13 @@ public class IoTransInoutService {
@Resource
private BussinessTypeService bussinessTypeService;
@Resource
private ThrOrderService thrOrderService;
@Resource
ThrDataService thrDataService;
@Resource
StockOrderService stockOrderService;
@Resource
StockOrderDetailService stockOrderDetailService;
@Resource
InvProductsTrService invProductsTrService;
//web端新增订单
@ -228,6 +228,7 @@ public class IoTransInoutService {
//因为只需用到条码,所以不需要重新读取
new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, insertList);
orderService.updateOrderStatus(orderEntity.getId(), ConstantStatus.ORDER_STATUS_SUCCESS);
invProductsTrService.genInvProducts(orderEntity.getId());
printOrder(orderEntity.getId());
}
@ -256,7 +257,8 @@ public class IoTransInoutService {
@Async
public void repeatPrint(OrderEntity orderEntity) {
printOrder(orderEntity.getId());
syncprintOrder(orderEntity.getId());
invProductsTrService.genInvProducts(orderEntity.getId());
}
public void checkOrder(OrderEntity orderEntity) {
@ -276,6 +278,7 @@ public class IoTransInoutService {
myErpOrderService.deleteByOrderId(orderEntity.getId());
new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, transData);
printOrder(orderEntity.getId());
invProductsTrService.genInvProducts(orderEntity.getId());
}
}
@ -297,6 +300,7 @@ public class IoTransInoutService {
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderEntity.getAction());
new ContrastErpUtil(udiUrl).contrastErp(udiInfoService, udiRelevanceService, myErpOrderService,
orderService, transData, systemParamConfigService, bussinessTypeEntity);
} else {
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_FAIL);
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
@ -328,6 +332,11 @@ public class IoTransInoutService {
//校验ERP单后订单详情转入等待打印
@Async
public void printOrder(String orderId) {
syncprintOrder(orderId);
}
public void syncprintOrder(String orderId) {
OrderEntity orderEntity = orderService.findById(orderId);
if (orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_SUCCESS && orderEntity.getErpFk() == null
) {
@ -346,7 +355,6 @@ public class IoTransInoutService {
boolean isError = false;
for (ErpOrderEntity erpOrderEntity : erpOrderEntities) {
StockOrderDetailEntity stockOrderDetailEntity = new StockOrderDetailEntity();
// stockOrderDetailEntity.setOrderIdFk(stockOrderEntity.getId());
stockOrderDetailEntity.setProductId(erpOrderEntity.getGoodsid());
stockOrderDetailEntity.setProductName(erpOrderEntity.getGoodsname());
@ -424,6 +432,7 @@ public class IoTransInoutService {
}
}
public StockOrderEntity genStockOrder(OrderEntity orderEntity, BussinessTypeEntity bussinessTypeEntity) {
//生成业务单据记录
StockOrderEntity stockOrderEntity = new StockOrderEntity();

@ -7,7 +7,7 @@
<insert id="insertCodesTemp" parameterType="java.util.List">
INSERT INTO io_codes_temp
(action, mainAction,code, corpOrderId, actor,actDate,
fromCorpId, fromCorp, orderId,batchNo,produceDate,expireDate,serialNo,count)
fromCorpId, fromCorp, orderId,batchNo,produceDate,expireDate,serialNo,count,nameCode)
VALUES
<foreach collection="codes" item="item" index="index"
separator=",">
@ -25,7 +25,7 @@
,#{item.produceDate}
,#{item.expireDate}
,#{item.serialNo}
,#{item.count}
,#{item.count},#{item.nameCode}
)
</foreach>
</insert>
@ -33,7 +33,8 @@
<insert id="insertCodesTempSingle" keyProperty="id" parameterType="com.glxp.sale.admin.entity.inout.WarehouseEntity">
INSERT INTO io_codes_temp(action, mainAction, code, corpOrderId, actor, actDate,
fromCorpId, fromCorp, orderId, batchNo, produceDate, expireDate, serialNo, count)
fromCorpId, fromCorp, orderId, batchNo, produceDate, expireDate, serialNo,
count,nameCode)
values(
#{action},
#{mainAction},
@ -48,7 +49,7 @@
#{produceDate},
#{expireDate},
#{serialNo},
#{count}
#{count},#{nameCode}
)
</insert>

@ -111,7 +111,7 @@
batchNoId,goodsname,companyname,
batchNo,erpCount,credate,nameCode,productCompany,
coName,authCode,packSpec,packRatio,bhzxxsbzsl,
zxxsbzbhsydysl,orderIdFk,count,reCount,productDate,expireDate,bindStatus,bindRlFk)
zxxsbzbhsydysl,orderIdFk,count,reCount,productDate,expireDate,bindStatus,bindRlFk,uuidFk)
values(
#{id},
#{companyid},
@ -128,7 +128,7 @@
#{credate},
#{nameCode},#{productCompany},#{coName},#{authCode},#{packSpec},#{packRatio},
#{bhzxxsbzsl},#{zxxsbzbhsydysl},#{orderIdFk},#{count},#{reCount},#{productDate},#{expireDate}
,#{bindStatus},#{bindRlFk}
,#{bindStatus},#{bindRlFk},#{uuidFk}
)
</insert>
@ -137,7 +137,7 @@
companyid,erpOrderId,iodtlId,inoutId,goodsunit,goodsid,batchNoId,goodsname,companyname,
batchNo,erpCount,credate,nameCode,productCompany,
coName,authCode,packSpec,packRatio,bhzxxsbzsl,zxxsbzbhsydysl,orderIdFk,count,reCount,productDate,expireDate
,bindStatus,bindRlFk)
,bindStatus,bindRlFk,uuidFk)
values
<foreach collection="erpOrderEntities" item="item" index="index"
separator=",">
@ -159,20 +159,23 @@
#{item.packRatio}, #{item.bhzxxsbzsl},
#{item.zxxsbzbhsydysl}, #{item.orderIdFk},
#{item.count},#{item.reCount},#{item.productDate},#{item.expireDate},
#{item.bindStatus}, #{item.bindRlFk})
#{item.bindStatus}, #{item.bindRlFk},#{item.uuidFk}
)
</foreach>
</insert>
<update id="updateErpOrder" parameterType="com.glxp.sale.admin.entity.inout.ErpOrderEntity">
UPDATE io_order_detail
<set>
<trim prefix="set" suffixOverrides=",">
<if test="goodsid != null">goodsid=#{goodsid},</if>
<if test="goodsname != null">goodsname=#{goodsname},</if>
<if test="bindStatus != null">bindStatus=#{bindStatus},</if>
<if test="bindRlFk != null">bindRlFk=#{bindRlFk},</if>
<if test="count != null">count=#{count},</if>
<if test="reCount != null">reCount=#{reCount},</if>
</set>
<if test="uuidFk != null">uuidFk=#{uuidFk},</if>
</trim>
WHERE id = #{id}
</update>
<delete id="deleteById" parameterType="Map">

@ -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…
Cancel
Save