Merge branch '20231126-yw' into dev_ksck

# Conflicts:
#	src/main/java/com/glxp/api/dao/thrsys/ThrInvOrderDetailMapper.java
#	src/main/java/com/glxp/api/dao/thrsys/ThrInvOrderMapper.java
#	src/main/java/com/glxp/api/service/thrsys/ThrInvOrderDetailService.java
#	src/main/java/com/glxp/api/service/thrsys/ThrInvOrderService.java
#	src/main/resources/mybatis/mapper/thrsys/ThrInvOrderDetailMapper.xml
#	src/main/resources/mybatis/mapper/thrsys/ThrInvOrderMapper.xml
dev_20240306
anthonywj 1 year ago
commit 9e79e7cda9

@ -78,6 +78,11 @@ public class Constant {
*/
public static final String INV_PLACE_ORDER = "PO";
/**
*
*/
public static final String TRIPARTITE_INV_ORDER = "SFIO";
public static final String dlThrProducts = "THR_DOWNLOAD_PRODUCTS";
public static final String dlThrInvProducts = "THR_DOWNLOAD_INV_PRODUCTS";

@ -327,5 +327,7 @@ public class ConstantStatus {
public static final int SPACE_OUT_SET = 1; //按指定货位出库
public static final int SPACE_OUT_CODE = 2; //按条码默认货位出库
//三方出入库单据
public static final int SFIO_DRAFT = 0; //草稿
public static final int SFIO_CFMD = 1; //已确认
}

@ -3,6 +3,6 @@ package com.glxp.api.constant;
public interface ConstantType {
String TYPE_STOCK_CHECK = "StockCheck"; //盘点
String TYPE_PUT = "WareHouseIn"; //
String TYPE_OUT = "WareHouseOut"; //
String TYPE_PUT = "WareHouseIn"; //
String TYPE_OUT = "WareHouseOut"; //
}

@ -50,5 +50,10 @@ public interface ThirdSysConstant {
*/
String SICKER_QUERY_URL = "sickerQueryUrl";
/**
*
*/
String INV_ORDER_QUERY_URL = "invOrderUrl";
}

@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.text.ParseException;
import java.util.Date;
@Slf4j
@RestController

@ -0,0 +1,111 @@
package com.glxp.api.controller.thrsys;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.thrsys.ThrInvOrder;
import com.glxp.api.entity.thrsys.ThrInvOrderDetail;
import com.glxp.api.entity.thrsys.ThrOrderDetailEntity;
import com.glxp.api.entity.thrsys.ThrOrderEntity;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.thrsys.*;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.service.thrsys.ThrInvOrderDetailService;
import com.glxp.api.service.thrsys.ThrInvOrderService;
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 javax.validation.Valid;
import java.util.List;
@RestController
public class ThrInvOrderController {
@Resource
ThrInvOrderService thrInvOrderService;
@Resource
ThrInvOrderDetailService thrInvOrderDetailService;
@AuthRuleAnnotation("")
@GetMapping("/udiwms/thrsys/getThrInvOrders")
public BaseResponse getOrders(FilterThrInvOrderRequest filterThrInvOrderRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<ThrInvOrder> thrInvOrders
= thrInvOrderService.filterThrInvOrder(filterThrInvOrderRequest);
PageInfo<ThrInvOrder> pageInfo;
pageInfo = new PageInfo<>(thrInvOrders);
PageSimpleResponse<ThrInvOrder> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrInvOrders);
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@GetMapping("/udiwms/thrsys/getThrInvOrderDetails")
public BaseResponse getThrInvOrderDetails(FilterThrInvOrderDetailRequest filterThrInvOrderDetailRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<ThrInvOrderDetail> thrInvOrderDetails
= thrInvOrderDetailService.filterThrInvOrderDetails(filterThrInvOrderDetailRequest);
PageInfo<ThrInvOrderDetail> pageInfo;
pageInfo = new PageInfo<>(thrInvOrderDetails);
PageSimpleResponse<ThrInvOrderDetail> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrInvOrderDetails);
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@PostMapping("/udiwms/thrsys/delThrInvOrderDetail")
public BaseResponse delThrInvOrderDetail(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
String id = deleteRequest.getId();
int b = thrInvOrderDetailService.delThrInvOrderDetail(Integer.parseInt(id));
if (b > 0) return ResultVOUtils.success("删除成功");
else return ResultVOUtils.error(500, "无法删除!");
}
@AuthRuleAnnotation("")
@PostMapping("/udiwms/thrsys/delThrInvOrder")
public BaseResponse delThrInvOrder(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
String billNo = deleteRequest.getBillNo();
int b = thrInvOrderService.delThrInvOrderByBillNo(billNo);
if (b > 0) {
thrInvOrderDetailService.delThrInvOrderDetailByBillNo(billNo);
return ResultVOUtils.success("删除成功");
}
else return ResultVOUtils.error(500, "无法删除!");
}
@AuthRuleAnnotation("")
@PostMapping("/udiwms/thrsys/generateOrder")
public BaseResponse generateOrder(@RequestBody @Valid GenerateOrderRequest generateOrderRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (thrInvOrderService.generateOrder(generateOrderRequest)){
return ResultVOUtils.success("生成成功");
}
return ResultVOUtils.error(500, "生成失败!");
}
}

@ -5,6 +5,7 @@ import com.glxp.api.entity.basic.BasicSkProjectDetailEntity;
import com.glxp.api.req.basic.FilterUdiRelRequest;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -16,4 +17,5 @@ public interface BasicDestinyRelMapper extends BaseMapperPlus<BasicDestinyRelMap
List<UdiRelevanceResponse> filterDestinyProducts(FilterUdiRelRequest filterUdiRelRequest);
List<BasicSkProjectDetailEntity> filterDestinyRelListByPId(@Param("thrCode") String thrCode);
}

@ -1,9 +1,27 @@
package com.glxp.api.dao.thrsys;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.thrsys.ThrInvOrderDetailEntity;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.dao.inout.IoOrderDetailBizDao;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.thrsys.ThrInvOrderDetail;
import com.glxp.api.req.thrsys.FilterThrInvOrderDetailRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ThrInvOrderDetailMapper extends BaseMapper<ThrInvOrderDetailEntity> {
public interface ThrInvOrderDetailMapper extends BaseMapperPlus<ThrInvOrderDetailMapper, ThrInvOrderDetail, ThrInvOrderDetail> {
int deleteByPrimaryKey(Integer id);
int insert(ThrInvOrderDetail record);
int insertSelective(ThrInvOrderDetail record);
ThrInvOrderDetail selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ThrInvOrderDetail record);
int updateByPrimaryKey(ThrInvOrderDetail record);
List<ThrInvOrderDetail> filterThrOrderDetailDetail(FilterThrInvOrderDetailRequest filterThrInvOrderDetailRequest);
}

@ -1,9 +1,26 @@
package com.glxp.api.dao.thrsys;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.thrsys.ThrInvOrderEntity;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.thrsys.ThrInvOrder;
import com.glxp.api.entity.thrsys.ThrInvOrderDetail;
import com.glxp.api.req.thrsys.FilterThrInvOrderRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ThrInvOrderMapper extends BaseMapper<ThrInvOrderEntity> {
public interface ThrInvOrderMapper extends BaseMapperPlus<ThrInvOrderMapper, ThrInvOrder, ThrInvOrder> {
int deleteByPrimaryKey(Integer id);
int insert(ThrInvOrder record);
int insertSelective(ThrInvOrder record);
ThrInvOrder selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ThrInvOrder record);
int updateByPrimaryKey(ThrInvOrder record);
List<ThrInvOrder> filterThrInvOrder(FilterThrInvOrderRequest filterThrInvOrderRequest);
}

@ -4,6 +4,7 @@ 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 io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**

@ -0,0 +1,108 @@
package com.glxp.api.entity.thrsys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
*
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "thr_inv_order")
public class ThrInvOrder implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
private String billNo;
/**
*
*/
private Date billDate;
/**
*
*/
private Date startDate;
/**
*
*/
private Date endDate;
/**
*
*/
private String mainAction;
/**
*
*/
private String billType;
/**
*
*/
private String thirdSysFk;
/**
*
*/
private String deptCode;
/**
*
*/
private String invCode;
/**
*
*/
private String spaceCode;
/**
*
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private String createUser;
/**
*
*/
private Date updateTime;
/**
*
*/
private String updateUser;
/**
*
*/
private String remark;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,156 @@
package com.glxp.api.entity.thrsys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "thr_inv_order_detail")
public class ThrInvOrderDetail implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
private String orderIdFk;
/**
*
*/
private String cpmctymc;
/**
*
*/
private Long relId;
/**
* /
*/
private String thrCode;
/**
* DI
*/
private String nameCode;
/**
*
*/
private String ggxh;
/**
*
*/
private Long batchNo;
/**
*
*/
private String measname;
/**
*
*/
private BigDecimal price;
/**
*
*/
private Date productionDate;
/**
*
*/
private Date expireDate;
/**
*
*/
private String ylqxzcrbarmc;
/**
* /
*/
private String zczbhhzbapzbh;
/**
*
*/
private String inCount;
/**
*
*/
private String outCount;
/**
*
*/
private String supName;
/**
*
*/
private String deptName;
/**
*
*/
private String deptCode;
/**
*
*/
private String invName;
/**
*
*/
private String invCode;
/**
*
*/
private String spaceCode;
/**
*
*/
private String spaceName;
/**
*
*/
private String reCount;
/**
*
*/
private String mainAction;
/**
*
*/
private String manufacturer;
/**
*
*/
private String remark;
private static final long serialVersionUID = 1L;
}

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.ConstantType;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.req.inv.FilterInvProductRequest;
import com.glxp.api.req.thrsys.ThrOnhandRequest;
@ -18,6 +19,7 @@ import okhttp3.OkHttpClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -78,9 +80,22 @@ public class ErpInvClient {
public BaseResponse<PageSimpleResponse<ThrInvResultResponse>> getInvResult(FilterInvProductRequest invProductRequest) {
ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(invProductRequest.getThirdSys());
String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/inv/getInvResult";
// String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/inv/getInvResult";
String url = basicThirdSysEntity.getThridUrl() + invProductRequest.getThirdSysUrlValue();
try {
String response = httpOkClient.uCloudPost(url, invProductRequest);
// ThrInvResultResponse thrInvResultResponse = new ThrInvResultResponse();
// thrInvResultResponse.setThrCode("11");
// thrInvResultResponse.setOutCount("2");
// thrInvResultResponse.setBillType(ConstantType.TYPE_OUT);
// ArrayList<ThrInvResultResponse> objects = new ArrayList<>();
// objects.add(thrInvResultResponse);
// PageSimpleResponse<ThrInvResultResponse> thrInvResultResponsePageSimpleResponse = new PageSimpleResponse<>();
// thrInvResultResponsePageSimpleResponse.setList(objects);
// BaseResponse<PageSimpleResponse<ThrInvResultResponse>> pageSimpleResponseBaseResponse = new BaseResponse<>();
// pageSimpleResponseBaseResponse.setCode(20000);
// pageSimpleResponseBaseResponse.setData(thrInvResultResponsePageSimpleResponse);
// return pageSimpleResponseBaseResponse;
BaseResponse<PageSimpleResponse<ThrInvResultResponse>> listBaseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThrInvResultResponse>>>() {
});

@ -124,6 +124,7 @@ public class FilterInvProductRequest extends ListPageRequest {
private Date startDate;
private Date endDate;
private String thirdSys;
private String thirdSysUrlValue;
private Long compareId;

@ -0,0 +1,13 @@
package com.glxp.api.req.thrsys;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
@Data
public class FilterThrInvOrderDetailRequest extends ListPageRequest {
private String orderIdFk;
}

@ -0,0 +1,32 @@
package com.glxp.api.req.thrsys;
import com.glxp.api.res.thrsys.ThrOrderResponse;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
import java.util.List;
@Data
public class FilterThrInvOrderRequest extends ListPageRequest {
/**
*
*/
private String billNo;
/**
*
*/
private String thirdSysFk;
/**
*
*/
private String startDate; //起始日期
/**
*
*/
private String endDate; //结束日期
/**
*
*/
private String billType;
}

@ -0,0 +1,28 @@
package com.glxp.api.req.thrsys;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@Data
public class GenerateOrderRequest {
/**
*
*/
@NotEmpty(message = "来源单据号不能为空!")
private String billNo;
/**
*
*/
@NotEmpty(message = "业务类型不能为空!")
private String action;
/**
*
*/
@NotEmpty(message = "往来单位不能为空!")
private String fromCorp;
}

@ -2,31 +2,145 @@ package com.glxp.api.res.inv;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class ThrInvResultResponse {
private Integer id;
// private Long id;
// /**
// * 单据号
// */
// private String orderIdFk;
/**
*
*/
private String cpmctymc;
// /**
// * 物资字典主键
// */
// private Long relId;
/**
* /
*/
private String thrCode;
/**
* DI
*/
private String nameCode;
/**
*
*/
private String ggxh;
private String batchNo;
/**
*
*/
private Integer batchNo;
/**
*
*/
private String measname;
private String price;
private String productionDate;
private String expireDate;
/**
*
*/
private BigDecimal price;
/**
*
*/
private Date productionDate;
/**
*
*/
private Date expireDate;
/**
*
*/
private String ylqxzcrbarmc;
/**
* /
*/
private String zczbhhzbapzbh;
private Integer inCount;
private Integer outCount;
/**
*
*/
private String inCount;
/**
*
*/
private String outCount;
/**
*
*/
private String supName;
/**
*
*/
private String deptName;
/**
*
*/
private String deptCode;
/**
*
*/
private String invName;
/**
*
*/
private String invCode;
/**
*
*/
private String spaceCode;
/**
*
*/
private String spaceName;
private Integer reCount;
// /**
// * 实际数量
// */
// private String reCount;
/**
*
*/
private String mainAction;
/**
*
*/
private String manufacturer;
/**
*
*/
private String remark;
/**
*
*/
private String billType;
}

@ -150,4 +150,8 @@ public class BasicDestinyRelService extends ServiceImpl<BasicDestinyRelMapper, B
}
return ResultVOUtils.success("下载成功!");
}
public List<BasicSkProjectDetailEntity> filterDestinyRelListByPId(String thrCode) {
return basicDestinyRelMapper.filterDestinyRelListByPId(thrCode);
}
}

@ -148,7 +148,7 @@ public class StockCompareServiceImpl extends CustomServiceImpl<StockCompareMappe
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(filterInvProductRequest.getThirdSys(), item.getThrCode());
if (udiRelevanceEntity != null)
invCpThrProuductEntity.setRelId(udiRelevanceEntity.getId());
invCpThrProuductEntity.setBatchNo(item.getBatchNo());
invCpThrProuductEntity.setBatchNo(item.getBatchNo()+"");
invCpThrProuductEntity.setUpdateTime(new Date());
invCpThrProuductEntity.setCreateTime(new Date());
invCpThrProuductEntity.setCompareId(filterInvProductRequest.getCompareId());

@ -1,10 +1,14 @@
package com.glxp.api.service.thrsys;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.thrsys.ThrInvOrderDetailMapper;
import com.glxp.api.entity.thrsys.ThrInvOrderDetailEntity;
@Service
public class ThrInvOrderDetailService extends ServiceImpl<ThrInvOrderDetailMapper, ThrInvOrderDetailEntity> {
import com.glxp.api.entity.thrsys.ThrInvOrderDetail;
import com.glxp.api.req.thrsys.FilterThrInvOrderDetailRequest;
import java.util.List;
public interface ThrInvOrderDetailService {
public List<ThrInvOrderDetail> filterThrInvOrderDetails(FilterThrInvOrderDetailRequest filterThrInvOrderDetailRequest);
int delThrInvOrderDetail(Integer id);
int delThrInvOrderDetailByBillNo(String billNo);
}

@ -1,10 +1,35 @@
package com.glxp.api.service.thrsys;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.entity.thrsys.ThrInvOrderEntity;
import com.glxp.api.dao.thrsys.ThrInvOrderMapper;
@Service
public class ThrInvOrderService extends ServiceImpl<ThrInvOrderMapper, ThrInvOrderEntity> {
import com.glxp.api.entity.thrsys.ThrInvOrder;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.req.inv.FilterInvProductRequest;
import com.glxp.api.req.thrsys.FilterThrInvOrderRequest;
import com.glxp.api.req.thrsys.GenerateOrderRequest;
import java.util.List;
public interface ThrInvOrderService {
/**
*
*/
public void handleExternalThrInvOrder(FilterInvProductRequest filterInvProductRequest);
void downloadInvOrder(ThrSystemDetailEntity thrSystemDetailEntity);
/**
*
* @param filterThrInvOrderRequest
* @return
*/
List<ThrInvOrder> filterThrInvOrder(FilterThrInvOrderRequest filterThrInvOrderRequest);
int delThrInvOrderByBillNo(String billNo);
/**
*
* @param generateOrderRequest
* @return
*/
boolean generateOrder(GenerateOrderRequest generateOrderRequest);
}

@ -0,0 +1,47 @@
package com.glxp.api.service.thrsys.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.thrsys.ThrInvOrderDetailMapper;
import com.glxp.api.entity.thrsys.ThrInvOrderDetail;
import com.glxp.api.entity.thrsys.ThrOrderDetailEntity;
import com.glxp.api.req.thrsys.FilterThrInvOrderDetailRequest;
import com.glxp.api.service.thrsys.ThrInvOrderDetailService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class ThrInvOrderDetailServiceImpl implements ThrInvOrderDetailService {
@Resource
ThrInvOrderDetailMapper thrInvOrderDetailMapper;
@Override
public List<ThrInvOrderDetail> filterThrInvOrderDetails(FilterThrInvOrderDetailRequest filterThrInvOrderDetailRequest) {
if (filterThrInvOrderDetailRequest == null) {
return Collections.emptyList();
}
if (filterThrInvOrderDetailRequest.getPage() != null) {
int offset = (filterThrInvOrderDetailRequest.getPage() - 1) * filterThrInvOrderDetailRequest.getLimit();
PageHelper.offsetPage(offset, filterThrInvOrderDetailRequest.getLimit());
}
List<ThrInvOrderDetail> data = thrInvOrderDetailMapper.filterThrOrderDetailDetail(filterThrInvOrderDetailRequest);
return data;
}
@Override
public int delThrInvOrderDetail(Integer id) {
return thrInvOrderDetailMapper.deleteByPrimaryKey(id);
}
@Override
public int delThrInvOrderDetailByBillNo(String billNo) {
UpdateWrapper<ThrInvOrderDetail> uw = new UpdateWrapper<>();
uw.eq("orderIdFk",billNo);
return thrInvOrderDetailMapper.delete(uw);
}
}

@ -0,0 +1,307 @@
package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.constant.Constant;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.constant.ConstantType;
import com.glxp.api.dao.thrsys.ThrInvOrderDetailMapper;
import com.glxp.api.dao.thrsys.ThrInvOrderMapper;
import com.glxp.api.entity.basic.BasicSkProjectDetailEntity;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.inout.IoOrderEntity;
import com.glxp.api.entity.system.SystemParamConfigEntity;
import com.glxp.api.entity.thrsys.ThrInvOrder;
import com.glxp.api.entity.thrsys.ThrInvOrderDetail;
import com.glxp.api.entity.thrsys.ThrOrderEntity;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.http.ErpInvClient;
import com.glxp.api.req.inv.FilterInvProductRequest;
import com.glxp.api.req.thrsys.FilterThrInvOrderRequest;
import com.glxp.api.req.thrsys.GenerateOrderRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.inv.ThrInvResultResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.basic.impl.BasicDestinyRelService;
import com.glxp.api.service.inout.IoOrderDetailBizService;
import com.glxp.api.service.inout.IoOrderService;
import com.glxp.api.service.system.SystemParamConfigService;
import com.glxp.api.service.thrsys.ThrInvOrderService;
import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.OrderNoTypeBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrInvOrderServiceImpl implements ThrInvOrderService {
@Resource
ErpInvClient erpInvClient;
@Resource
BasicDestinyRelService basicDestinyRelService;
@Resource
ThrInvOrderMapper thrInvOrderMapper;
@Resource
ThrInvOrderDetailMapper thrInvOrderDetailMapper;
@Resource
SystemParamConfigService systemParamConfigService;
@Resource
GennerOrderUtils gennerOrderUtils;
@Resource
CustomerService customerService;
@Resource
IoOrderService ioOrderService;
@Resource
IoOrderDetailBizService ioOrderDetailBizService;
// 设置要输出的日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
@Override
public void handleExternalThrInvOrder(FilterInvProductRequest filterInvProductRequest) {
BaseResponse<PageSimpleResponse<ThrInvResultResponse>> baseResponse = erpInvClient.getInvResult(filterInvProductRequest);
if (baseResponse.getCode() == 20000) {
List<ThrInvResultResponse> list = baseResponse.getData().getList();
if (CollectionUtil.isNotEmpty(list)) {
String billNo = generateBillNo(filterInvProductRequest);//单据号
//处理 返回实体 转换成 单据 和 单据明细
List<ThrInvOrderDetail> thrInvOrderDetails = new ArrayList<>();
handleExternalConvertThrInvOrderDetail(list, thrInvOrderDetails, billNo);
if (CollectionUtil.isNotEmpty(thrInvOrderDetails)) {
ThrInvOrder thrInvOrder = new ThrInvOrder();
handleExternalConvertThrInvOrder(billNo, filterInvProductRequest, thrInvOrder, list.get(0));
//保存数据
thrInvOrderMapper.insert(thrInvOrder);
thrInvOrderDetailMapper.insertBatch(thrInvOrderDetails);
}
}
}
}
@Override
public void downloadInvOrder(ThrSystemDetailEntity thrSystemDetailEntity) {
log.info("自动抓取第三方出入库明细生成单据定时任务开始");
FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
filterInvProductRequest.setThirdSys(thrSystemDetailEntity.getThirdSysFk());
filterInvProductRequest.setThirdSysUrlValue(thrSystemDetailEntity.getValue());
String days = getBeginAndEndDateByDays(1);
filterInvProductRequest.setStartDate(stringToDate(days + " 00:00:00"));
filterInvProductRequest.setEndDate(stringToDate(days + " 23:59:59"));
handleExternalThrInvOrder(filterInvProductRequest);
log.info("自动抓取第三方出入库明细生成单据定时任务结束");
}
@Override
public List<ThrInvOrder> filterThrInvOrder(FilterThrInvOrderRequest filterThrInvOrderRequest) {
if (filterThrInvOrderRequest == null) {
return Collections.emptyList();
}
if (filterThrInvOrderRequest.getPage() != null) {
int offset = (filterThrInvOrderRequest.getPage() - 1) * filterThrInvOrderRequest.getLimit();
PageHelper.offsetPage(offset, filterThrInvOrderRequest.getLimit());
}
List<ThrInvOrder> data = thrInvOrderMapper.filterThrInvOrder(filterThrInvOrderRequest);
return data;
}
@Override
public int delThrInvOrderByBillNo(String billNo) {
UpdateWrapper<ThrInvOrder> uw = new UpdateWrapper<>();
uw.eq("billNo", billNo);
return thrInvOrderMapper.delete(uw);
}
@Override
public boolean generateOrder(GenerateOrderRequest generateOrderRequest) {
String billNo = generateOrderRequest.getBillNo();
//通过单号获取单据信息
QueryWrapper<ThrInvOrder> qw = new QueryWrapper<>();
qw.eq("billNo",billNo);
ThrInvOrder thrInvOrder = thrInvOrderMapper.selectOne(qw);
if (Objects.isNull(thrInvOrder)) return false;
//通过单号获取单据明细信息
QueryWrapper<ThrInvOrderDetail> qwd = new QueryWrapper<>();
qwd.eq("orderIdFk",billNo);
List<ThrInvOrderDetail> thrInvOrderDetails = thrInvOrderDetailMapper.selectList(qwd);
if (CollectionUtil.isNotEmpty(thrInvOrderDetails)) return false;
//新单号
String newBillNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd"));
IoOrderEntity ioOrderEntity = new IoOrderEntity();
ioOrderEntity.setBillNo(newBillNo);
ioOrderEntity.setMainAction(thrInvOrder.getMainAction());
ioOrderEntity.setFromCorp(generateOrderRequest.getFromCorp());
ioOrderEntity.setInvCode(thrInvOrder.getInvCode());
ioOrderEntity.setDeptCode(thrInvOrder.getDeptCode());
ioOrderEntity.setFromType(ConstantStatus.FROM_THRORDER);//网页新增
ioOrderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);//草稿
ioOrderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);//草稿
ioOrderEntity.setCorpOrderId(billNo);//单据号
ioOrderEntity.setUpdateTime(new Date());
ioOrderEntity.setCreateTime(new Date());
Long userId = customerService.getUserId();
ioOrderEntity.setCreateUser(userId + "");
ioOrderEntity.setUpdateUser(userId + "");
ioOrderEntity.setOrderType(ConstantStatus.ORDER_TYPE_NORMAL);//正常单据处理
List<IoOrderDetailBizEntity> newOrderDetailBiz = new ArrayList<>(thrInvOrderDetails.size());
if (!copyOrderDetailBiz(thrInvOrderDetails,newOrderDetailBiz)){
return false;
}
ioOrderService.insertOrder(ioOrderEntity);
return ioOrderDetailBizService.batchInsertBizs(newOrderDetailBiz);
}
private boolean copyOrderDetailBiz(List<ThrInvOrderDetail> thrInvOrderDetails, List<IoOrderDetailBizEntity> newOrderDetailBiz) {
/**
* 1
* 2
*/
return true;
}
/**
* SFIO + 6 + 6 + 6
*
* @param filterInvProductRequest
* @return
*/
private String generateBillNo(FilterInvProductRequest filterInvProductRequest) {
String startDate = sdf.format(filterInvProductRequest.getStartDate()).substring(2);
String endDate = sdf.format(filterInvProductRequest.getEndDate()).substring(2);
Integer random = new Random().nextInt(900000) + 100000;
return Constant.TRIPARTITE_INV_ORDER + startDate + endDate + random;
}
/**
*
*
* @param filterInvProductRequest
* @param thrInvOrder
* @param thrInvResultResponse
*/
private void handleExternalConvertThrInvOrder(String billNo, FilterInvProductRequest filterInvProductRequest, ThrInvOrder thrInvOrder, ThrInvResultResponse thrInvResultResponse) {
Date newDate = new Date();
thrInvOrder.setBillNo(billNo);//单据号
thrInvOrder.setBillDate(newDate);//单据时间
thrInvOrder.setStartDate(filterInvProductRequest.getStartDate());//库存开始时间
thrInvOrder.setEndDate(filterInvProductRequest.getEndDate());//库存结束时间
thrInvOrder.setMainAction(thrInvResultResponse.getMainAction());//出入库类型
thrInvOrder.setBillType(thrInvResultResponse.getMainAction());//第三方单据类型
thrInvOrder.setThirdSysFk(filterInvProductRequest.getThirdSys());//外部系统
thrInvOrder.setDeptCode(thrInvResultResponse.getDeptCode());//部门编号
thrInvOrder.setInvCode(thrInvResultResponse.getInvCode());//仓库代码
thrInvOrder.setSpaceCode(thrInvResultResponse.getSpaceCode());//货位编码
thrInvOrder.setStatus(ConstantStatus.SFIO_DRAFT);//单据状态 草稿
thrInvOrder.setCreateTime(newDate);
thrInvOrder.setCreateUser("系统自动");
}
/**
*
*
* @param list
* @param thrInvOrderDetails
* @param billNo
*/
private void handleExternalConvertThrInvOrderDetail(List<ThrInvResultResponse> list, List<ThrInvOrderDetail> thrInvOrderDetails, String billNo) {
Integer inv_set_enable = Integer.valueOf(systemParamConfigService.selectValueByParamKey("inv_set_enable"));
if (inv_set_enable == null || inv_set_enable == 0) {
list.forEach(item -> {
String mainAction = item.getMainAction();
Integer count = 0;
if (ConstantType.TYPE_PUT.equals(mainAction)) {
count = Integer.valueOf(item.getInCount());
} else {
count = Integer.valueOf(item.getOutCount());
}
ThrInvOrderDetail thrInvOrderDetail = new ThrInvOrderDetail();
BeanUtils.copyProperties(item, thrInvOrderDetail);
thrInvOrderDetail.setOrderIdFk(billNo);
thrInvOrderDetail.setRelId(Long.parseLong(item.getThrCode()));
thrInvOrderDetail.setReCount(String.valueOf(count));
thrInvOrderDetails.add(thrInvOrderDetail);
});
} else {
list.forEach(item -> {
String thrCode = item.getThrCode();
String mainAction = item.getMainAction();
Integer count = 0;
if (ConstantType.TYPE_PUT.equals(mainAction)) {
count = Integer.valueOf(item.getInCount());
} else {
count = Integer.valueOf(item.getOutCount());
}
//通过thrCode获取到项目组套
List<BasicSkProjectDetailEntity> skProjectDetailEntityList = basicDestinyRelService.filterDestinyRelListByPId(thrCode);
if (CollectionUtil.isNotEmpty(skProjectDetailEntityList) && count > 0) {
Integer finalCount = count;
skProjectDetailEntityList.forEach(sk -> {
ThrInvOrderDetail thrInvOrderDetail = new ThrInvOrderDetail();
BeanUtils.copyProperties(item, thrInvOrderDetail);
thrInvOrderDetail.setOrderIdFk(billNo);
thrInvOrderDetail.setRelId(sk.getRelId());
Integer skCount = sk.getCount();
if (skCount != null && skCount > 0) {
thrInvOrderDetail.setReCount(String.valueOf(skCount * finalCount));
thrInvOrderDetails.add(thrInvOrderDetail);
}
});
}
});
}
}
/**
* (n)
*
* @param n
* @return
*/
public static String getBeginAndEndDateByDays(int n) {
Date date = new Date();//取时间
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(calendar.DATE, -1);//把日期往前减少一天,若想把日期向后推一天则将负数改为正数
date = calendar.getTime();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
return formatter.format(date);
}
public static Date stringToDate(String time) {
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = dateformat.parse(time);
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
}

@ -9,6 +9,7 @@ import com.glxp.api.constant.ThirdSysConstant;
import com.glxp.api.dao.schedule.ScheduledDao;
import com.glxp.api.dao.system.SyncDataSetDao;
import com.glxp.api.dao.thrsys.ThrSystemDetailDao;
import com.glxp.api.entity.inv.InvPlaceOrderEntity;
import com.glxp.api.entity.system.ScheduledEntity;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.req.basic.GetSickRequest;
@ -63,6 +64,8 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
private IoOrderService orderService;
@Resource
ThrOrderService thrOrderService;
@Resource
ThrInvOrderService thrInvOrderService;
final Logger logger = LoggerFactory.getLogger(SyncHeartTask.class);
@Resource
@ -138,6 +141,10 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
//下载患者信息
downloadSicker(thrSystemDetailEntity);
break;
case ThirdSysConstant.INV_ORDER_QUERY_URL:
//下载出入库明细
downloadInvOrder(thrSystemDetailEntity);
break;
default:
//其他接口暂不处理
break;
@ -171,6 +178,29 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
}
}
/**
*
*
* @param thrSystemDetailEntity
*/
private void downloadInvOrder(ThrSystemDetailEntity thrSystemDetailEntity) {
//校验任务并更新redis数据执行标识
if (verifyTask(thrSystemDetailEntity)) {
getExecutor().submit(() -> {
log.info("开始下载三方出入库明细");
try {
thrInvOrderService.downloadInvOrder(thrSystemDetailEntity);
} catch (Exception e) {
log.error("下载三方出入库明细异常", ExceptionUtils.getStackTrace(e));
} finally {
updateTask(getTaskKey(thrSystemDetailEntity));
}
log.info("下载三方出入库明细完成");
});
}
}
/**
*
*

@ -284,4 +284,12 @@
</where>
group by basic_products.uuid
</select>
<select id="filterDestinyRelListByPId" resultType="com.glxp.api.entity.basic.BasicSkProjectDetailEntity">
select pd.*
from basic_sk_project p
LEFT join basic_sk_project_detail pd ON pd.pId = p.id
where p.code = #{thrCode}
</select>
</mapper>

@ -1,7 +1,7 @@
<?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.api.dao.thrsys.ThrInvOrderDetailMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.thrsys.ThrInvOrderDetailEntity">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.thrsys.ThrInvOrderDetail">
<!--@mbg.generated-->
<!--@Table thr_inv_order_detail-->
<id column="id" jdbcType="INTEGER" property="id" />
@ -39,4 +39,329 @@
deptName, deptCode, invName, invCode, spaceCode, spaceName, reCount, mainAction,
manufacturer, remark
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from thr_inv_order_detail
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from thr_inv_order_detail
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.thrsys.ThrInvOrderDetail" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into thr_inv_order_detail (orderIdFk, cpmctymc, relId,
thrCode, nameCode, ggxh,
batchNo, measname, price,
productionDate, expireDate, ylqxzcrbarmc,
zczbhhzbapzbh, inCount, outCount,
supName, deptName, deptCode,
invName, invCode, spaceCode,
spaceName, reCount, mainAction,
manufacturer, remark)
values (#{orderIdFk,jdbcType=VARCHAR}, #{cpmctymc,jdbcType=VARCHAR}, #{relId,jdbcType=INTEGER},
#{thrCode,jdbcType=VARCHAR}, #{nameCode,jdbcType=VARCHAR}, #{ggxh,jdbcType=VARCHAR},
#{batchNo,jdbcType=INTEGER}, #{measname,jdbcType=VARCHAR}, #{price,jdbcType=DECIMAL},
#{productionDate,jdbcType=TIMESTAMP}, #{expireDate,jdbcType=TIMESTAMP}, #{ylqxzcrbarmc,jdbcType=VARCHAR},
#{zczbhhzbapzbh,jdbcType=VARCHAR}, #{inCount,jdbcType=VARCHAR}, #{outCount,jdbcType=VARCHAR},
#{supName,jdbcType=VARCHAR}, #{deptName,jdbcType=VARCHAR}, #{deptCode,jdbcType=VARCHAR},
#{invName,jdbcType=VARCHAR}, #{invCode,jdbcType=VARCHAR}, #{spaceCode,jdbcType=VARCHAR},
#{spaceName,jdbcType=VARCHAR}, #{reCount,jdbcType=VARCHAR}, #{mainAction,jdbcType=VARCHAR},
#{manufacturer,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.thrsys.ThrInvOrderDetail" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into thr_inv_order_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderIdFk != null">
orderIdFk,
</if>
<if test="cpmctymc != null">
cpmctymc,
</if>
<if test="relId != null">
relId,
</if>
<if test="thrCode != null">
thrCode,
</if>
<if test="nameCode != null">
nameCode,
</if>
<if test="ggxh != null">
ggxh,
</if>
<if test="batchNo != null">
batchNo,
</if>
<if test="measname != null">
measname,
</if>
<if test="price != null">
price,
</if>
<if test="productionDate != null">
productionDate,
</if>
<if test="expireDate != null">
expireDate,
</if>
<if test="ylqxzcrbarmc != null">
ylqxzcrbarmc,
</if>
<if test="zczbhhzbapzbh != null">
zczbhhzbapzbh,
</if>
<if test="inCount != null">
inCount,
</if>
<if test="outCount != null">
outCount,
</if>
<if test="supName != null">
supName,
</if>
<if test="deptName != null">
deptName,
</if>
<if test="deptCode != null">
deptCode,
</if>
<if test="invName != null">
invName,
</if>
<if test="invCode != null">
invCode,
</if>
<if test="spaceCode != null">
spaceCode,
</if>
<if test="spaceName != null">
spaceName,
</if>
<if test="reCount != null">
reCount,
</if>
<if test="mainAction != null">
mainAction,
</if>
<if test="manufacturer != null">
manufacturer,
</if>
<if test="remark != null">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderIdFk != null">
#{orderIdFk,jdbcType=VARCHAR},
</if>
<if test="cpmctymc != null">
#{cpmctymc,jdbcType=VARCHAR},
</if>
<if test="relId != null">
#{relId,jdbcType=INTEGER},
</if>
<if test="thrCode != null">
#{thrCode,jdbcType=VARCHAR},
</if>
<if test="nameCode != null">
#{nameCode,jdbcType=VARCHAR},
</if>
<if test="ggxh != null">
#{ggxh,jdbcType=VARCHAR},
</if>
<if test="batchNo != null">
#{batchNo,jdbcType=INTEGER},
</if>
<if test="measname != null">
#{measname,jdbcType=VARCHAR},
</if>
<if test="price != null">
#{price,jdbcType=DECIMAL},
</if>
<if test="productionDate != null">
#{productionDate,jdbcType=TIMESTAMP},
</if>
<if test="expireDate != null">
#{expireDate,jdbcType=TIMESTAMP},
</if>
<if test="ylqxzcrbarmc != null">
#{ylqxzcrbarmc,jdbcType=VARCHAR},
</if>
<if test="zczbhhzbapzbh != null">
#{zczbhhzbapzbh,jdbcType=VARCHAR},
</if>
<if test="inCount != null">
#{inCount,jdbcType=VARCHAR},
</if>
<if test="outCount != null">
#{outCount,jdbcType=VARCHAR},
</if>
<if test="supName != null">
#{supName,jdbcType=VARCHAR},
</if>
<if test="deptName != null">
#{deptName,jdbcType=VARCHAR},
</if>
<if test="deptCode != null">
#{deptCode,jdbcType=VARCHAR},
</if>
<if test="invName != null">
#{invName,jdbcType=VARCHAR},
</if>
<if test="invCode != null">
#{invCode,jdbcType=VARCHAR},
</if>
<if test="spaceCode != null">
#{spaceCode,jdbcType=VARCHAR},
</if>
<if test="spaceName != null">
#{spaceName,jdbcType=VARCHAR},
</if>
<if test="reCount != null">
#{reCount,jdbcType=VARCHAR},
</if>
<if test="mainAction != null">
#{mainAction,jdbcType=VARCHAR},
</if>
<if test="manufacturer != null">
#{manufacturer,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glxp.api.entity.thrsys.ThrInvOrderDetail">
<!--@mbg.generated-->
update thr_inv_order_detail
<set>
<if test="orderIdFk != null">
orderIdFk = #{orderIdFk,jdbcType=VARCHAR},
</if>
<if test="cpmctymc != null">
cpmctymc = #{cpmctymc,jdbcType=VARCHAR},
</if>
<if test="relId != null">
relId = #{relId,jdbcType=INTEGER},
</if>
<if test="thrCode != null">
thrCode = #{thrCode,jdbcType=VARCHAR},
</if>
<if test="nameCode != null">
nameCode = #{nameCode,jdbcType=VARCHAR},
</if>
<if test="ggxh != null">
ggxh = #{ggxh,jdbcType=VARCHAR},
</if>
<if test="batchNo != null">
batchNo = #{batchNo,jdbcType=INTEGER},
</if>
<if test="measname != null">
measname = #{measname,jdbcType=VARCHAR},
</if>
<if test="price != null">
price = #{price,jdbcType=DECIMAL},
</if>
<if test="productionDate != null">
productionDate = #{productionDate,jdbcType=TIMESTAMP},
</if>
<if test="expireDate != null">
expireDate = #{expireDate,jdbcType=TIMESTAMP},
</if>
<if test="ylqxzcrbarmc != null">
ylqxzcrbarmc = #{ylqxzcrbarmc,jdbcType=VARCHAR},
</if>
<if test="zczbhhzbapzbh != null">
zczbhhzbapzbh = #{zczbhhzbapzbh,jdbcType=VARCHAR},
</if>
<if test="inCount != null">
inCount = #{inCount,jdbcType=VARCHAR},
</if>
<if test="outCount != null">
outCount = #{outCount,jdbcType=VARCHAR},
</if>
<if test="supName != null">
supName = #{supName,jdbcType=VARCHAR},
</if>
<if test="deptName != null">
deptName = #{deptName,jdbcType=VARCHAR},
</if>
<if test="deptCode != null">
deptCode = #{deptCode,jdbcType=VARCHAR},
</if>
<if test="invName != null">
invName = #{invName,jdbcType=VARCHAR},
</if>
<if test="invCode != null">
invCode = #{invCode,jdbcType=VARCHAR},
</if>
<if test="spaceCode != null">
spaceCode = #{spaceCode,jdbcType=VARCHAR},
</if>
<if test="spaceName != null">
spaceName = #{spaceName,jdbcType=VARCHAR},
</if>
<if test="reCount != null">
reCount = #{reCount,jdbcType=VARCHAR},
</if>
<if test="mainAction != null">
mainAction = #{mainAction,jdbcType=VARCHAR},
</if>
<if test="manufacturer != null">
manufacturer = #{manufacturer,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glxp.api.entity.thrsys.ThrInvOrderDetail">
<!--@mbg.generated-->
update thr_inv_order_detail
set orderIdFk = #{orderIdFk,jdbcType=VARCHAR},
cpmctymc = #{cpmctymc,jdbcType=VARCHAR},
relId = #{relId,jdbcType=INTEGER},
thrCode = #{thrCode,jdbcType=VARCHAR},
nameCode = #{nameCode,jdbcType=VARCHAR},
ggxh = #{ggxh,jdbcType=VARCHAR},
batchNo = #{batchNo,jdbcType=INTEGER},
measname = #{measname,jdbcType=VARCHAR},
price = #{price,jdbcType=DECIMAL},
productionDate = #{productionDate,jdbcType=TIMESTAMP},
expireDate = #{expireDate,jdbcType=TIMESTAMP},
ylqxzcrbarmc = #{ylqxzcrbarmc,jdbcType=VARCHAR},
zczbhhzbapzbh = #{zczbhhzbapzbh,jdbcType=VARCHAR},
inCount = #{inCount,jdbcType=VARCHAR},
outCount = #{outCount,jdbcType=VARCHAR},
supName = #{supName,jdbcType=VARCHAR},
deptName = #{deptName,jdbcType=VARCHAR},
deptCode = #{deptCode,jdbcType=VARCHAR},
invName = #{invName,jdbcType=VARCHAR},
invCode = #{invCode,jdbcType=VARCHAR},
spaceCode = #{spaceCode,jdbcType=VARCHAR},
spaceName = #{spaceName,jdbcType=VARCHAR},
reCount = #{reCount,jdbcType=VARCHAR},
mainAction = #{mainAction,jdbcType=VARCHAR},
manufacturer = #{manufacturer,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="filterThrOrderDetailDetail" parameterType="com.glxp.api.req.thrsys.FilterThrInvOrderDetailRequest"
resultType="com.glxp.api.entity.thrsys.ThrInvOrderDetail">
SELECT *
FROM thr_inv_order_detail
<where>
<if test="orderIdFk != '' and orderIdFk != null">
AND orderIdFk = #{orderIdFk}
</if>
</where>
</select>
</mapper>

@ -1,7 +1,7 @@
<?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.api.dao.thrsys.ThrInvOrderMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.thrsys.ThrInvOrderEntity">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.thrsys.ThrInvOrder">
<!--@mbg.generated-->
<!--@Table thr_inv_order-->
<id column="id" jdbcType="INTEGER" property="id" />
@ -11,6 +11,7 @@
<result column="endDate" jdbcType="TIMESTAMP" property="endDate" />
<result column="mainAction" jdbcType="VARCHAR" property="mainAction" />
<result column="billType" jdbcType="VARCHAR" property="billType" />
<result column="thirdSysFk" jdbcType="VARCHAR" property="thirdSysFk" />
<result column="deptCode" jdbcType="VARCHAR" property="deptCode" />
<result column="invCode" jdbcType="VARCHAR" property="invCode" />
<result column="spaceCode" jdbcType="VARCHAR" property="spaceCode" />
@ -23,7 +24,242 @@
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, billNo, billDate, startDate, endDate, mainAction, billType, deptCode, invCode,
id, billNo, billDate, startDate, endDate, mainAction, billType,thirdSysFk, deptCode, invCode,
spaceCode, `status`, createTime, `createUser`, updateTime, updateUser, remark
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from thr_inv_order
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from thr_inv_order
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.thrsys.ThrInvOrder" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into thr_inv_order (billNo, billDate, startDate,
endDate, mainAction, billType,thirdSysFk,
deptCode, invCode, spaceCode,
`status`, createTime, `createUser`,
updateTime, updateUser, remark
)
values (#{billNo,jdbcType=VARCHAR}, #{billDate,jdbcType=TIMESTAMP}, #{startDate,jdbcType=TIMESTAMP},
#{endDate,jdbcType=TIMESTAMP}, #{mainAction,jdbcType=VARCHAR}, #{billType,jdbcType=VARCHAR},#{thirdSysFk,jdbcType=VARCHAR},
#{deptCode,jdbcType=VARCHAR}, #{invCode,jdbcType=VARCHAR}, #{spaceCode,jdbcType=VARCHAR},
#{status,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.thrsys.ThrInvOrder" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into thr_inv_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="billNo != null">
billNo,
</if>
<if test="billDate != null">
billDate,
</if>
<if test="startDate != null">
startDate,
</if>
<if test="endDate != null">
endDate,
</if>
<if test="mainAction != null">
mainAction,
</if>
<if test="billType != null">
billType,
</if>
<if test="thirdSysFk != null">
thirdSysFk,
</if>
<if test="deptCode != null">
deptCode,
</if>
<if test="invCode != null">
invCode,
</if>
<if test="spaceCode != null">
spaceCode,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
createTime,
</if>
<if test="createUser != null">
`createUser`,
</if>
<if test="updateTime != null">
updateTime,
</if>
<if test="updateUser != null">
updateUser,
</if>
<if test="remark != null">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="billNo != null">
#{billNo,jdbcType=VARCHAR},
</if>
<if test="billDate != null">
#{billDate,jdbcType=TIMESTAMP},
</if>
<if test="startDate != null">
#{startDate,jdbcType=TIMESTAMP},
</if>
<if test="endDate != null">
#{endDate,jdbcType=TIMESTAMP},
</if>
<if test="mainAction != null">
#{mainAction,jdbcType=VARCHAR},
</if>
<if test="billType != null">
#{billType,jdbcType=VARCHAR},
</if>
<if test="thirdSysFk != null">
#{thirdSysFk,jdbcType=VARCHAR},
</if>
<if test="deptCode != null">
#{deptCode,jdbcType=VARCHAR},
</if>
<if test="invCode != null">
#{invCode,jdbcType=VARCHAR},
</if>
<if test="spaceCode != null">
#{spaceCode,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUser != null">
#{updateUser,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glxp.api.entity.thrsys.ThrInvOrder">
<!--@mbg.generated-->
update thr_inv_order
<set>
<if test="billNo != null">
billNo = #{billNo,jdbcType=VARCHAR},
</if>
<if test="billDate != null">
billDate = #{billDate,jdbcType=TIMESTAMP},
</if>
<if test="startDate != null">
startDate = #{startDate,jdbcType=TIMESTAMP},
</if>
<if test="endDate != null">
endDate = #{endDate,jdbcType=TIMESTAMP},
</if>
<if test="mainAction != null">
mainAction = #{mainAction,jdbcType=VARCHAR},
</if>
<if test="billType != null">
billType = #{billType,jdbcType=VARCHAR},
</if>
<if test="thirdSysFk != null">
thirdSysFk = #{thirdSysFk,jdbcType=VARCHAR},
</if>
<if test="deptCode != null">
deptCode = #{deptCode,jdbcType=VARCHAR},
</if>
<if test="invCode != null">
invCode = #{invCode,jdbcType=VARCHAR},
</if>
<if test="spaceCode != null">
spaceCode = #{spaceCode,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
createTime = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createUser != null">
`createUser` = #{createUser,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
updateTime = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUser != null">
updateUser = #{updateUser,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glxp.api.entity.thrsys.ThrInvOrder">
<!--@mbg.generated-->
update thr_inv_order
set billNo = #{billNo,jdbcType=VARCHAR},
billDate = #{billDate,jdbcType=TIMESTAMP},
startDate = #{startDate,jdbcType=TIMESTAMP},
endDate = #{endDate,jdbcType=TIMESTAMP},
mainAction = #{mainAction,jdbcType=VARCHAR},
billType = #{billType,jdbcType=VARCHAR},
thirdSysFk = #{thirdSysFk,jdbcType=VARCHAR},
deptCode = #{deptCode,jdbcType=VARCHAR},
invCode = #{invCode,jdbcType=VARCHAR},
spaceCode = #{spaceCode,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT},
createTime = #{createTime,jdbcType=TIMESTAMP},
`createUser` = #{createUser,jdbcType=VARCHAR},
updateTime = #{updateTime,jdbcType=TIMESTAMP},
updateUser = #{updateUser,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="filterThrInvOrder" parameterType="com.glxp.api.req.thrsys.FilterThrInvOrderRequest"
resultType="com.glxp.api.entity.thrsys.ThrInvOrder">
SELECT thr_inv_order.*
FROM thr_inv_order
<where>
<if test="billNo != '' and billNo != null">
AND billNo like concat('%', #{billNo}, '%')
</if>
<if test="billType != '' and billType != null">
AND billType = #{billType}
</if>
<if test="thirdSysFk != '' and thirdSysFk != null">
AND thirdSysFk = #{thirdSysFk}
</if>
<if test="startDate != null and startDate != ''">
<![CDATA[
and DATE_FORMAT(billdate, '%Y-%m-%d') >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
]]>
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[
and DATE_FORMAT(billdate, '%Y-%m-%d') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
]]>
</if>
</where>
ORDER BY thr_inv_order.billNo DESC
</select>
</mapper>

Loading…
Cancel
Save