移除盘点相关功能

test
anthonywj 1 year ago
parent 1b6eb549d8
commit 1b3c16482a

@ -1,88 +0,0 @@
package com.glxp.api.controller.inv;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageInfo;
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.inv.InvCountCodesEntity;
import com.glxp.api.req.inv.FilterInvCountCodesRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.service.inv.InvCountCodesService;
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 InvCountCodesController {
@Resource
private InvCountCodesService invCountCodesService;
/**
*
*
* @param codesRequest
* @return
*/
@GetMapping("/inv/count/codes/filter")
public BaseResponse filterList(FilterInvCountCodesRequest codesRequest) {
List<InvCountCodesEntity> list = invCountCodesService.filterList(codesRequest);
PageInfo<InvCountCodesEntity> pageInfo = new PageInfo<>(list);
PageSimpleResponse<InvCountCodesEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(list);
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*
* @param codesRequest
* @return
*/
@PostMapping("/inv/count/codes/deleteCode")
public BaseResponse deleteCode(@RequestBody FilterInvCountCodesRequest codesRequest) {
if (null == codesRequest || StrUtil.isBlank(codesRequest.getOrderIdFk()) || StrUtil.isBlank(codesRequest.getRelId()) || StrUtil.isBlank(codesRequest.getCode())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return invCountCodesService.deleteCode(codesRequest);
}
/**
*
*
* @param invCountCodes
* @return
*/
@PostMapping("/inv/count/codes/addCode")
public BaseResponse addCode(@RequestBody InvCountCodesEntity invCountCodes) {
if (null == invCountCodes || StrUtil.isBlank(invCountCodes.getCode())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return invCountCodesService.addCode(invCountCodes);
}
/**
*
*
* @param orderIdFk
* @return
*/
@GetMapping("/inv/count/codes/getCountOrderCodesNum")
public BaseResponse getCountOrderCodesNum(String orderIdFk) {
if (StrUtil.isBlank(orderIdFk)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
Long codesNum = invCountCodesService.getCountOrderCodesNum(orderIdFk);
return ResultVOUtils.success(codesNum);
}
}

@ -1,197 +0,0 @@
package com.glxp.api.controller.inv;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
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.inv.InvCountOrderEntity;
import com.glxp.api.entity.system.SystemPDFModuleEntity;
import com.glxp.api.entity.system.SystemPDFTemplateEntity;
import com.glxp.api.req.inout.InspectionPDFTemplateRequest;
import com.glxp.api.req.inv.AddInvCountOrderSaveRequest;
import com.glxp.api.req.inv.FilterInvCountOrderRequest;
import com.glxp.api.req.inv.InvCountOrderPrintRequest;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.system.FilterPdfModuleRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.inv.InvCountOrderResponse;
import com.glxp.api.service.inv.InvCountOrderService;
import com.glxp.api.service.system.SystemPDFModuleService;
import com.glxp.api.service.system.SystemPDFTemplateService;
import com.glxp.api.util.JasperUtils;
import org.springframework.beans.factory.annotation.Value;
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.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*/
@RestController
public class InvCountOrderController {
@Resource
private InvCountOrderService invCountOrderService;
@Resource
private SystemPDFTemplateService systemPDFTemplateService;
@Resource
private SystemPDFModuleService systemPDFModuleService;
@Value("${file_path}")
private String filePath;
/**
*
*
* @param filterInvCountOrderRequest
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("/inv/count/order/filter")
public BaseResponse filterList(FilterInvCountOrderRequest filterInvCountOrderRequest) {
List<InvCountOrderResponse> list = invCountOrderService.filterList(filterInvCountOrderRequest);
PageInfo<InvCountOrderResponse> pageInfo = new PageInfo<>(list);
PageSimpleResponse<InvCountOrderResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(pageInfo.getList());
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*
* @param deleteRequest
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/inv/count/order/delete")
public BaseResponse delete(@RequestBody DeleteRequest deleteRequest) {
invCountOrderService.deleteOrder(deleteRequest.getId());
return ResultVOUtils.success();
}
/**
*
*
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/inv/count/order/saveCountOrder")
public BaseResponse saveCountOrder(@RequestBody InvCountOrderEntity invCountOrder, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (null == invCountOrder) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return invCountOrderService.saveCountOrder(invCountOrder);
}
/**
*
*
* @param id
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("/inv/count/order/submitAudit")
public BaseResponse submitAudit(String id) {
if (StrUtil.isBlank(id)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return invCountOrderService.submitAudit(id);
}
/**
*
*
* @param filterInvCountOrderRequest
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/inv/count/order/updateCountOrderStatus")
public BaseResponse updateCountOrderStatus(@RequestBody FilterInvCountOrderRequest filterInvCountOrderRequest) {
if (null == filterInvCountOrderRequest || StrUtil.isBlank(filterInvCountOrderRequest.getId()) || null == filterInvCountOrderRequest.getStatus()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return invCountOrderService.updateCountOrderStatus(filterInvCountOrderRequest.getId(), filterInvCountOrderRequest.getStatus());
}
/**
*
*
* @param inspectionPDFTemplateRequest
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/invCount/order/verifyTemplateFile")
public BaseResponse verifyTemplateFile(@RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) {
if (null == inspectionPDFTemplateRequest) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数不能为空!");
}
//查询模板文件是否存在
FilterPdfModuleRequest systemPDFModuleRequest = new FilterPdfModuleRequest();
systemPDFModuleRequest.setId(inspectionPDFTemplateRequest.getModuleId());
SystemPDFModuleEntity systemPDFModule = systemPDFModuleService.findSystemPDFModule(systemPDFModuleRequest);
if (null == systemPDFModule) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "所属模块错误");
}
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(String.valueOf(systemPDFModule.getTemplateId()));
if (null == systemPDFTemplateEntity) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "模板错误");
}
return ResultVOUtils.success(systemPDFModule.getTemplateId());
}
/**
*
*
* @param invCountOrderPrintRequest
* @param request
* @param response
* @throws Exception
*/
@AuthRuleAnnotation("")
@PostMapping("/invCount/order/printOrder")
public void printOrder(@RequestBody InvCountOrderPrintRequest invCountOrderPrintRequest, HttpServletRequest request, HttpServletResponse response) throws Exception {
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(invCountOrderPrintRequest.getTemplateId());
//打印单号标签
Map<String, Object> data = new HashMap<>(1);
data.put("orderId", invCountOrderPrintRequest.getOrderId());
Map<String, List<Map<String, Object>>> printData = new HashMap<>(1);
printData.put("data", Arrays.asList(data));
JasperUtils.jasperReport(request, response, JSONUtil.toJsonStr(printData), filePath + "/pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}
//------------------------------------------------------手持终端接口---------------------------------------------------------------
/**
*
*
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/invCount/order/saveCountOrderForPDA")
public BaseResponse saveCountOrderForPDA(@RequestBody @Valid AddInvCountOrderSaveRequest addInvCountOrderSaveRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
return invCountOrderService.saveCountOrderForPDA(addInvCountOrderSaveRequest);
}
}

@ -1,91 +0,0 @@
package com.glxp.api.controller.inv;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageInfo;
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.inv.InvCountOrderDetailEntity;
import com.glxp.api.req.inv.AddInvCountOrderSaveRequest;
import com.glxp.api.req.inv.FilterInvCountOrderDetailRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.inv.InvCountOrderDetailResponse;
import com.glxp.api.service.inv.InvCountOrderDetailService;
import lombok.extern.slf4j.Slf4j;
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;
/**
*
*/
@Slf4j
@RestController
public class InvCountOrderDetailController {
@Resource
private InvCountOrderDetailService invCountOrderDetailService;
/**
*
*
* @return
*/
@GetMapping("/inv/count/order/detail/filter")
public BaseResponse filterList(FilterInvCountOrderDetailRequest detailRequest) {
List<InvCountOrderDetailResponse> list = invCountOrderDetailService.filterCountDetail(detailRequest);
PageInfo<InvCountOrderDetailResponse> pageInfo = new PageInfo<>(list);
PageSimpleResponse<InvCountOrderDetailResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(pageInfo.getList());
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*
* @param detailRequest
* @return
*/
@PostMapping("/inv/count/order/detail/deleteOrderDetail")
public BaseResponse deleteOrderDetail(@RequestBody FilterInvCountOrderDetailRequest detailRequest) {
if (null == detailRequest || null == detailRequest.getId()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return invCountOrderDetailService.deleteOrderDetail(detailRequest);
}
/**
*
*
* @param invCountOrderDetail
* @return
*/
@PostMapping("/inv/count/order/detail/addCountOrderDetail")
public BaseResponse addCountOrderDetail(@RequestBody InvCountOrderDetailEntity invCountOrderDetail) {
if (null == invCountOrderDetail || StrUtil.isBlank(invCountOrderDetail.getOrderIdFk()) || null == invCountOrderDetail.getRelId()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return invCountOrderDetailService.addCountOrderDetail(invCountOrderDetail);
}
/**
*
*
* @param addInvCountOrderSaveRequest
* @return
*/
@PostMapping("/inv/count/order/detail/batchAddDetail")
public BaseResponse batchAddDetail(@RequestBody AddInvCountOrderSaveRequest addInvCountOrderSaveRequest) {
if (null == addInvCountOrderSaveRequest || CollUtil.isEmpty(addInvCountOrderSaveRequest.getCountOrderDetailList())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return invCountOrderDetailService.batchAddDetail(addInvCountOrderSaveRequest.getOrderId(), addInvCountOrderSaveRequest.getCountOrderDetailList());
}
}

@ -1,79 +0,0 @@
package com.glxp.api.dao.inv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.inv.InvCountCodesEntity;
import com.glxp.api.req.inv.FilterInvCountCodesRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Dao
*/
public interface InvCountCodesDao extends BaseMapper<InvCountCodesEntity> {
/**
*
*
* @param orderId
*/
void deleteByOrderId(@Param("orderId") String orderId);
/**
*
*
* @param codesRequest
* @return
*/
List<InvCountCodesEntity> filterList(FilterInvCountCodesRequest codesRequest);
/**
* ID
*
* @param orderIdFk
* @return
*/
Long countByOrderIdFk(@Param("orderIdFk") String orderIdFk);
/**
*
*
* @param orderIdFk
* @return
*/
Long countByOrderId(@Param("orderIdFk") String orderIdFk);
/**
*
*
* @param code
* @param orderIdFk
* @return
*/
Long selectCountByCodeAndOrderId(@Param("code") String code, @Param("orderIdFk") String orderIdFk);
/**
*
*
* @param orderId
*/
void resetCountFiledValue(@Param("orderId") String orderId);
/**
* ID
*
* @param orderIdFk
* @param productId
* @return
*/
List<InvCountCodesEntity> selectByOrderIdAndProductId(@Param("orderIdFk") String orderIdFk, @Param("productId") String productId);
/**
*
*
* @param codesRequest
* @return
*/
List<String> selectCodes(FilterInvCountCodesRequest codesRequest);
}

@ -1,63 +0,0 @@
package com.glxp.api.dao.inv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.inv.InvCountOrderEntity;
import com.glxp.api.req.inv.FilterInvCountOrderRequest;
import com.glxp.api.res.inv.InvCountOrderResponse;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Dao
*/
public interface InvCountOrderDao extends BaseMapper<InvCountOrderEntity> {
/***
*
* @param filterInvCountOrderRequest
* @return
*/
List<InvCountOrderResponse> filterList(FilterInvCountOrderRequest filterInvCountOrderRequest);
/**
* id
*
* @param id
* @return
*/
String selectOrderIdById(@Param("id") String id);
/**
*
*
* @param deptCode
* @param invCode
* @param invSpaceCode
* @return
*/
Integer countBySpaceCode(@Param("deptCode") String deptCode, @Param("invCode") String invCode, @Param("invSpaceCode") String invSpaceCode);
/**
*
*
* @param invCountOrder
*/
void updateByOrderId(InvCountOrderEntity invCountOrder);
/**
*
*
* @param orderId
* @return
*/
InvCountOrderEntity selectByOrderId(@Param("orderId") String orderId);
/**
*
*
* @param orderId
*/
void deleteByOrderId(@Param("orderId") String orderId);
}

@ -1,86 +0,0 @@
package com.glxp.api.dao.inv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.inv.InvCountOrderDetailEntity;
import com.glxp.api.req.inv.FilterInvCountOrderDetailRequest;
import com.glxp.api.res.inv.InvCountOrderDetailResponse;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Dao
*/
public interface InvCountOrderDetailDao extends BaseMapper<InvCountOrderDetailEntity> {
/**
*
*
* @param orderId
*/
void deleteByOrderId(@Param("orderId") String orderId);
/**
*
*
* @param detailRequest
* @return
*/
List<InvCountOrderDetailEntity> filterList(FilterInvCountOrderDetailRequest detailRequest);
/**
* ID
*
* @param orderIdFk
* @return
*/
Long countByOrderIdFk(@Param("orderIdFk") String orderIdFk);
/**
*
*
* @param detailRequest
* @return
*/
List<InvCountOrderDetailResponse> filterCountDetail(FilterInvCountOrderDetailRequest detailRequest);
/**
* ID
*
* @param orderIdFk
* @param productId
*/
void deleteByOrderIdAndProductId(@Param("orderIdFk") String orderIdFk, @Param("productId") Long productId);
/**
* DI
*
* @param orderIdFk
* @param nameCode
* @return
*/
InvCountOrderDetailEntity selectOrderDetail(@Param("orderIdFk") String orderIdFk, @Param("nameCode") String nameCode, @Param("batchNo") String batchNo, @Param("produceDate") String produceDate, @Param("expireDate") String expireDate);
/**
*
*
* @param orderId
* @return
*/
List<InvCountOrderDetailEntity> selectByOrderId(@Param("orderId") String orderId);
/**
*
*
* @param orderId
*/
void resetCountFiledValue(@Param("orderId") String orderId);
/**
*
*
* @param list
*/
int updateBatch(List<InvCountOrderDetailEntity> list);
}

@ -1,71 +0,0 @@
package com.glxp.api.entity.inv;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
*
*/
@Data
@TableName(value = "inv_count_codes")
public class InvCountCodesEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* ID
*/
@TableField(value = "orderIdFk")
private String orderIdFk;
/**
* ID
*/
@TableField(value = "relId")
private Long relId;
/**
*
*/
@TableField(value = "code")
private String code;
/**
* 0 1
*/
@TableField(value = "`status`")
private Integer status;
/**
*
*/
@TableField(value = "batchNo")
private String batchNo;
/**
*
*/
@TableField(value = "`count`")
private Integer count;
public static final String COL_ID = "id";
public static final String COL_ORDERIDFK = "orderIdFk";
public static final String COL_RELID = "relId";
public static final String COL_CODE = "code";
public static final String COL_STATUS = "status";
public static final String COL_BATCHNO = "batchNo";
public static final String COL_COUNT = "count";
}

@ -1,119 +0,0 @@
package com.glxp.api.entity.inv;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
*
*/
@Data
@TableName(value = "inv_count_order_detail")
public class InvCountOrderDetailEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
*
*/
@TableField(value = "orderIdFk")
private String orderIdFk;
/**
* ID
*/
@TableField(value = "relId")
private Long relId;
/**
* DI
*/
@TableField(value = "nameCode")
private String nameCode;
/**
*
*/
@TableField(value = "batchNo")
private String batchNo;
/**
*
*/
@TableField(value = "produceDate")
private String produceDate;
/**
*
*/
@TableField(value = "expireDate")
private String expireDate;
/**
*
*/
@TableField(value = "serialNo")
private String serialNo;
/**
*
*/
@TableField(value = "countNum")
private Integer countNum;
/**
*
*/
@TableField(value = "invNum")
private Integer invNum;
/**
*
*/
@TableField(value = "profitNum")
private Integer profitNum;
/**
*
*/
@TableField(value = "lossNum")
private Integer lossNum;
/**
* 0 1
*/
@TableField(value = "`status`")
private Integer status;
public static final String COL_ID = "id";
public static final String COL_ORDERIDFK = "orderIdFk";
public static final String COL_RELID = "relId";
public static final String COL_NAMECODE = "nameCode";
public static final String COL_BATCHNO = "batchNo";
public static final String COL_PRODUCEDATE = "produceDate";
public static final String COL_EXPIREDATE = "expireDate";
public static final String COL_SERIALNO = "serialNo";
public static final String COL_COUNTNUM = "countNum";
public static final String COL_INVNUM = "invNum";
public static final String COL_PROFITNUM = "profitNum";
public static final String COL_LOSSNUM = "lossNum";
public static final String COL_STATUS = "status";
}

@ -1,137 +0,0 @@
package com.glxp.api.entity.inv;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
*
*/
@Data
@TableName(value = "inv_count_order")
public class InvCountOrderEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
*
*/
@TableField(value = "orderId")
private String orderId;
/**
*
*/
@TableField(value = "deptCode")
private String deptCode;
/**
*
*/
@TableField(value = "invCode")
private String invCode;
/**
*
*/
@TableField(value = "invSpaceCode")
private String invSpaceCode;
/**
* 使 ,
*/
@TableField(value = "inOrderIds")
private String inOrderIds;
/**
* 使 ,
*/
@TableField(value = "outOrderIds")
private String outOrderIds;
/**
* 0 1 2
*/
@TableField(value = "countType")
private Integer countType;
/**
* 0 1 2
*/
@TableField(value = "`status`")
private Integer status;
/**
* ID
*/
@TableField(value = "`createUser`")
private String createUser;
/**
*
*/
@TableField(value = "createTime")
private Date createTime;
/**
*
*/
@TableField(value = "updateTime")
private Date updateTime;
/**
* ID
*/
@TableField(value = "auditUser")
private String auditUser;
/**
*
*/
@TableField(value = "auditTime")
private Date auditTime;
/**
*
*/
@TableField(value = "remark")
private String remark;
public static final String COL_ID = "id";
public static final String COL_ORDERID = "orderId";
public static final String COL_DEPTCODE = "deptCode";
public static final String COL_INVCODE = "invCode";
public static final String COL_INVSPACECODE = "invSpaceCode";
public static final String COL_INORDERIDS = "inOrderIds";
public static final String COL_OUTORDERIDS = "outOrderIds";
public static final String COL_COUNTTYPE = "countType";
public static final String COL_STATUS = "status";
public static final String COL_CREATEUSER = "createUser";
public static final String COL_CREATETIME = "createTime";
public static final String COL_UPDATETIME = "updateTime";
public static final String COL_AUDITUSER = "auditUser";
public static final String COL_AUDITTIME = "auditTime";
public static final String COL_REMARK = "remark";
}

@ -1,34 +0,0 @@
package com.glxp.api.req.inv;
import com.glxp.api.entity.inv.InvCountCodesEntity;
import com.glxp.api.entity.inv.InvCountOrderDetailEntity;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
*
*/
@Data
public class AddInvCountOrderSaveRequest {
/**
*
*/
@NotBlank(message = "盘点单号为空")
private String orderId;
/**
*
*/
@NotEmpty(message = "盘点产品不能为空")
private List<InvCountCodesEntity> countCodeList;
/**
*
*/
private List<InvCountOrderDetailEntity> countOrderDetailList;
}

@ -1,46 +0,0 @@
package com.glxp.api.service.inv;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.entity.inv.InvCountCodesEntity;
import com.glxp.api.req.inv.FilterInvCountCodesRequest;
import java.util.List;
/**
* Service
*/
public interface InvCountCodesService {
/**
*
*
* @param codesRequest
* @return
*/
List<InvCountCodesEntity> filterList(FilterInvCountCodesRequest codesRequest);
/**
*
*
* @param codesRequest
* @return
*/
BaseResponse deleteCode(FilterInvCountCodesRequest codesRequest);
/**
*
*
* @param invCountCodes
* @return
*/
BaseResponse addCode(InvCountCodesEntity invCountCodes);
/**
*
*
* @param orderIdFk
* @return
*/
Long getCountOrderCodesNum(String orderIdFk);
}

@ -1,48 +0,0 @@
package com.glxp.api.service.inv;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.entity.inv.InvCountOrderDetailEntity;
import com.glxp.api.req.inv.FilterInvCountOrderDetailRequest;
import com.glxp.api.res.inv.InvCountOrderDetailResponse;
import java.util.List;
/**
* Service
*/
public interface InvCountOrderDetailService {
List<InvCountOrderDetailEntity> filterList(FilterInvCountOrderDetailRequest detailRequest);
/**
*
*
* @return
*/
List<InvCountOrderDetailResponse> filterCountDetail(FilterInvCountOrderDetailRequest detailRequest);
/**
*
*
* @param detailRequest
* @return
*/
BaseResponse deleteOrderDetail(FilterInvCountOrderDetailRequest detailRequest);
/**
*
*
* @param invCountOrderDetail
* @return
*/
BaseResponse addCountOrderDetail(InvCountOrderDetailEntity invCountOrderDetail);
/**
*
*
* @param orderId
* @param countOrderDetailList
* @return
*/
BaseResponse batchAddDetail(String orderId, List<InvCountOrderDetailEntity> countOrderDetailList);
}

@ -1,63 +0,0 @@
package com.glxp.api.service.inv;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.entity.inv.InvCountOrderEntity;
import com.glxp.api.req.inv.AddInvCountOrderSaveRequest;
import com.glxp.api.req.inv.FilterInvCountOrderRequest;
import com.glxp.api.res.inv.InvCountOrderResponse;
import java.util.List;
/**
* Service
*/
public interface InvCountOrderService {
/**
*
*
* @param filterInvCountOrderRequest
* @return
*/
List<InvCountOrderResponse> filterList(FilterInvCountOrderRequest filterInvCountOrderRequest);
/**
*
*
* @param id
*/
void deleteOrder(String id);
/**
*
*
* @param invCountOrder
*/
BaseResponse saveCountOrder(InvCountOrderEntity invCountOrder);
/**
*
*
* @param id
* @return
*/
BaseResponse submitAudit(String id);
/**
*
*
* @param id
* @param status
* @return
*/
BaseResponse updateCountOrderStatus(String id, Integer status);
/**
*
*
* @param addInvCountOrderSaveRequest
* @return
*/
BaseResponse saveCountOrderForPDA(AddInvCountOrderSaveRequest addInvCountOrderSaveRequest);
}

@ -1,140 +0,0 @@
package com.glxp.api.service.inv.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
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.dao.basic.UdiRelevanceDao;
import com.glxp.api.dao.inv.InvCountCodesDao;
import com.glxp.api.dao.inv.InvCountOrderDetailDao;
import com.glxp.api.entity.basic.UdiEntity;
import com.glxp.api.entity.inv.InvCountCodesEntity;
import com.glxp.api.entity.inv.InvCountOrderDetailEntity;
import com.glxp.api.req.inv.FilterInvCountCodesRequest;
import com.glxp.api.service.inv.InvCountCodesService;
import com.glxp.api.util.udi.FilterUdiUtils;
import com.glxp.api.util.udi.UdiCalCountUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class InvCountCodesServiceImpl implements InvCountCodesService {
@Resource
private InvCountCodesDao invCountCodesDao;
@Resource
private InvCountOrderDetailDao invCountOrderDetailDao;
@Resource
private UdiRelevanceDao udiRelevanceDao;
@Resource
private UdiCalCountUtil udiCalCountUtil;
@Override
public List<InvCountCodesEntity> filterList(FilterInvCountCodesRequest codesRequest) {
if (null == codesRequest) {
return Collections.emptyList();
}
if (null != codesRequest.getPage() && null != codesRequest.getLimit()) {
PageHelper.offsetPage((codesRequest.getPage() - 1) * codesRequest.getLimit(), codesRequest.getLimit());
}
return invCountCodesDao.filterList(codesRequest);
}
@Override
public BaseResponse deleteCode(FilterInvCountCodesRequest codesRequest) {
//查询盘点单据码详情
List<InvCountCodesEntity> list = invCountCodesDao.filterList(codesRequest);
if (CollUtil.isEmpty(list)) {
return ResultVOUtils.error(ResultEnum.DATA_NOT);
}
UdiEntity udi = FilterUdiUtils.getUdi(list.get(0).getCode());
InvCountOrderDetailEntity invCountOrderDetail = invCountOrderDetailDao.selectOrderDetail(list.get(0).getOrderIdFk(), udi.getUdi(), udi.getBatchNo(), udi.getProduceDate(), udi.getExpireDate());
InvCountCodesEntity countCodes = list.get(0);
if (countCodes.getCount() == 1) {
//条码数量等于1删除条码
invCountCodesDao.deleteById(list.get(0).getId());
} else {
//条码数量大于1将条码数量 -1
countCodes.setCount(countCodes.getCount() - 1);
invCountCodesDao.updateById(countCodes);
}
//将此单据详情的盘点数量 - 1
invCountOrderDetail.setCountNum(invCountOrderDetail.getCountNum() - udiCalCountUtil.getActCount(udi.getUdi()));
//盘点数量删减之后,重新计算盈亏状态
int diff = invCountOrderDetail.getInvNum() - invCountOrderDetail.getCountNum();
if (diff > 0) {
invCountOrderDetail.setLossNum(Math.abs(diff));
//盘亏
invCountOrderDetail.setStatus(0);
} else if (diff < 0) {
invCountOrderDetail.setProfitNum(Math.abs(diff));
//盘盈
invCountOrderDetail.setStatus(1);
} else {
//平衡
invCountOrderDetail.setStatus(2);
}
//更新盘点单据详情
invCountOrderDetailDao.updateById(invCountOrderDetail);
return ResultVOUtils.success();
}
@Override
public BaseResponse addCode(InvCountCodesEntity invCountCodes) {
//解析条码
UdiEntity udi = FilterUdiUtils.getUdi(invCountCodes.getCode());
//查询单据详情,是否包含此产品
InvCountOrderDetailEntity invCountOrderDetail = invCountOrderDetailDao.selectOrderDetail(invCountCodes.getOrderIdFk(), udi.getUdi(), udi.getBatchNo(), udi.getProduceDate(), udi.getExpireDate());
if (null == invCountOrderDetail) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "当前仓库或货位不存在此产品");
}
//判断条码是否重复
FilterInvCountCodesRequest codesRequest = new FilterInvCountCodesRequest();
codesRequest.setOrderIdFk(invCountCodes.getOrderIdFk());
codesRequest.setCode(invCountCodes.getCode());
List<InvCountCodesEntity> codesList = invCountCodesDao.filterList(codesRequest);
if (CollUtil.isEmpty(codesList)) {
//新增条码
invCountCodes.setRelId(invCountOrderDetail.getRelId());
invCountCodes.setBatchNo(udi.getBatchNo());
invCountCodes.setCount(1);
invCountCodesDao.insert(invCountCodes);
} else {
if (StrUtil.isNotBlank(udi.getBatchNo()) && StrUtil.isNotBlank(udi.getSerialNo())) {
//条码为标准条码,批次号和序列号都存在,条码重复
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "条码重复!");
} else if ((StrUtil.isBlank(udi.getBatchNo()) && StrUtil.isBlank(udi.getSerialNo()) || (StrUtil.isNotBlank(udi.getBatchNo()) && StrUtil.isBlank(udi.getSerialNo())))) {
//批次号或序列号,其中一个字段为空,直接修改数量
InvCountCodesEntity countCodes = codesList.get(0);
countCodes.setCount(countCodes.getCount() + 1);
invCountCodesDao.updateById(countCodes);
} else {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "条码重复!");
}
}
//修改码明细
invCountOrderDetail.setCountNum(invCountOrderDetail.getCountNum() + udiCalCountUtil.getActCount(udi.getUdi()));
invCountOrderDetailDao.updateById(invCountOrderDetail);
return ResultVOUtils.success();
}
@Override
public Long getCountOrderCodesNum(String orderIdFk) {
return invCountCodesDao.countByOrderId(orderIdFk);
}
}

@ -1,136 +0,0 @@
package com.glxp.api.service.inv.impl;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageHelper;
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.dao.inv.*;
import com.glxp.api.entity.inv.InvCountCodesEntity;
import com.glxp.api.entity.inv.InvCountOrderDetailEntity;
import com.glxp.api.entity.inv.InvCountOrderEntity;
import com.glxp.api.entity.inv.InvProductEntity;
import com.glxp.api.req.inv.FilterInvCountOrderDetailRequest;
import com.glxp.api.res.inv.InvCountOrderDetailResponse;
import com.glxp.api.service.inv.InvCountOrderDetailService;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.TransactionIsolationLevel;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class InvCountOrderDetailServiceImpl implements InvCountOrderDetailService {
@Resource
private InvCountOrderDetailDao invCountOrderDetailDao;
@Resource
private InvCountOrderDao invCountOrderDao;
@Resource
private InvProductDao invProductDao;
@Resource
private SqlSessionFactory sqlSessionFactory;
@Resource
private InvProductDetailDao invProductDetailDao;
@Override
public List<InvCountOrderDetailEntity> filterList(FilterInvCountOrderDetailRequest detailRequest) {
if (null == detailRequest) {
return Collections.emptyList();
}
if (null != detailRequest.getPage() && null != detailRequest.getLimit()) {
PageHelper.offsetPage((detailRequest.getPage() - 1) * detailRequest.getLimit(), detailRequest.getLimit());
}
return invCountOrderDetailDao.filterList(detailRequest);
}
@Override
public List<InvCountOrderDetailResponse> filterCountDetail(FilterInvCountOrderDetailRequest detailRequest) {
if (null == detailRequest) {
return Collections.emptyList();
}
if (null != detailRequest.getPage() && null != detailRequest.getLimit()) {
PageHelper.offsetPage((detailRequest.getPage() - 1) * detailRequest.getLimit(), detailRequest.getLimit());
}
return invCountOrderDetailDao.filterCountDetail(detailRequest);
}
@Override
public BaseResponse deleteOrderDetail(FilterInvCountOrderDetailRequest detailRequest) {
InvCountOrderDetailEntity invCountOrderDetail = invCountOrderDetailDao.selectById(detailRequest.getId());
if (null == invCountOrderDetail) {
return ResultVOUtils.error(ResultEnum.DATA_NOT);
}
//删除盘点单据详情
invCountOrderDetailDao.deleteById(detailRequest.getId());
//删除盘点单据详情的条码数据
invCountOrderDetailDao.deleteByOrderIdAndProductId(invCountOrderDetail.getOrderIdFk(), invCountOrderDetail.getRelId());
return ResultVOUtils.success();
}
@Override
public BaseResponse addCountOrderDetail(InvCountOrderDetailEntity invCountOrderDetail) {
//查询单据信息
InvCountOrderEntity invCountOrder = invCountOrderDao.selectByOrderId(invCountOrderDetail.getOrderIdFk());
InvProductEntity invProductEntity = invProductDao.selectProductInfo(invCountOrderDetail.getRelId(), invCountOrderDetail.getBatchNo(), invCountOrder.getDeptCode(), invCountOrder.getInvCode(), invCountOrder.getInvSpaceCode());
invCountOrderDetail.setInvNum(invProductEntity.getReCount());
invCountOrderDetail.setCountNum(0);
invCountOrderDetailDao.insert(invCountOrderDetail);
return ResultVOUtils.success();
}
@Override
public BaseResponse batchAddDetail(String orderId, List<InvCountOrderDetailEntity> countOrderDetailList) {
InvCountOrderEntity invCountOrder = invCountOrderDao.selectByOrderId(orderId);
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
InvCountOrderDetailDao mapper = sqlSession.getMapper(InvCountOrderDetailDao.class);
InvCountCodesDao codeMapper = sqlSession.getMapper(InvCountCodesDao.class);
for (InvCountOrderDetailEntity orderDetailEntity : countOrderDetailList) {
InvProductEntity invProductEntity = invProductDao.selectProductInfo(orderDetailEntity.getRelId(), orderDetailEntity.getBatchNo(), invCountOrder.getDeptCode(), invCountOrder.getInvCode(), invCountOrder.getInvSpaceCode());
orderDetailEntity.setInvNum(invProductEntity.getReCount());
orderDetailEntity.setCountNum(0);
//TODO 此查询无法区分无序列号条码,待优化
//查询此库存的详情,构造并插入码数据
List<String> codes = invProductDetailDao.selectCountOrderCodes(invCountOrder.getInvCode(), invCountOrder.getInvSpaceCode(), orderDetailEntity.getRelId(), orderDetailEntity.getBatchNo());
if (CollUtil.isNotEmpty(codes)) {
Map<String, InvCountCodesEntity> codesMap = new HashMap<>(codes.size());
for (String code : codes) {
InvCountCodesEntity codesEntity = codesMap.get(code);
if (null == codesEntity) {
//构造条码信息
codesEntity = new InvCountCodesEntity();
codesEntity.setCode(code);
codesEntity.setOrderIdFk(orderId);
codesEntity.setCount(1);
codesEntity.setBatchNo(orderDetailEntity.getBatchNo());
codesEntity.setRelId(orderDetailEntity.getRelId());
codesMap.put(code, codesEntity);
} else {
codesEntity.setCount(codesEntity.getCount() + 1);
}
}
for (String key : codesMap.keySet()) {
codeMapper.insert(codesMap.get(key));
}
}
mapper.insert(orderDetailEntity);
}
sqlSession.commit();
sqlSession.close();
return ResultVOUtils.success();
}
}

@ -1,576 +0,0 @@
package com.glxp.api.service.inv.impl;
import org.springframework.beans.BeanUtils;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
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.constant.Constant;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.constant.ConstantType;
import com.glxp.api.dao.basic.BasicBusTypeChangeDao;
import com.glxp.api.dao.basic.BasicBussinessTypeDao;
import com.glxp.api.dao.basic.BasicCorpDao;
import com.glxp.api.dao.basic.UdiRlSupDao;
import com.glxp.api.dao.inout.IoCodeDao;
import com.glxp.api.dao.inout.IoCodeTempDao;
import com.glxp.api.dao.inout.IoOrderDao;
import com.glxp.api.dao.inv.InvCountCodesDao;
import com.glxp.api.dao.inv.InvCountOrderDao;
import com.glxp.api.dao.inv.InvCountOrderDetailDao;
import com.glxp.api.dao.inv.InvProductDetailDao;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.basic.BasicBusTypeChangeEntity;
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
import com.glxp.api.entity.basic.UdiEntity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inout.IoOrderEntity;
import com.glxp.api.entity.inv.InvCountCodesEntity;
import com.glxp.api.entity.inv.InvCountOrderDetailEntity;
import com.glxp.api.entity.inv.InvCountOrderEntity;
import com.glxp.api.entity.inv.InvProductDetailEntity;
import com.glxp.api.req.inv.*;
import com.glxp.api.res.inv.InvCountOrderResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.inv.InvCountCodesService;
import com.glxp.api.service.inv.InvCountOrderService;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.OrderNoTypeBean;
import com.glxp.api.util.udi.FilterUdiUtils;
import com.glxp.api.util.udi.UdiCalCountUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class InvCountOrderServiceImpl implements InvCountOrderService {
@Resource
private InvCountOrderDao invCountOrderDao;
@Resource
private InvCountOrderDetailDao invCountOrderDetailDao;
@Resource
private InvCountCodesDao invCountCodesDao;
@Resource
private GennerOrderUtils gennerOrderUtils;
@Resource
private CustomerService customerService;
@Resource
private InvProductDetailDao invProductDetailDao;
@Resource
private BasicBusTypeChangeDao busTypeChangeDao;
@Resource
private BasicBussinessTypeDao bussinessTypeDao;
@Resource
private BasicCorpDao corpDao;
@Resource
private IoOrderDao orderDao;
@Resource
private IoCodeTempDao codesTempDao;
@Resource
private InvCountCodesService invCountCodesService;
@Resource
private IoCodeDao codesDao;
@Resource
private UdiRlSupDao udiRlSupDao;
@Resource
private UdiCalCountUtil udiCalCountUtil;
@Override
public List<InvCountOrderResponse> filterList(FilterInvCountOrderRequest filterInvCountOrderRequest) {
if (null == filterInvCountOrderRequest) {
return Collections.emptyList();
}
if (null != filterInvCountOrderRequest.getPage() && null != filterInvCountOrderRequest.getLimit()) {
PageHelper.offsetPage((filterInvCountOrderRequest.getPage() - 1) * filterInvCountOrderRequest.getLimit(), filterInvCountOrderRequest.getLimit());
}
return invCountOrderDao.filterList(filterInvCountOrderRequest);
}
@Override
public void deleteOrder(String id) {
String orderId = invCountOrderDao.selectOrderIdById(id);
log.info("开始删除盘点单据,盘点单号: {}", orderId);
invCountOrderDao.deleteByOrderId(orderId);
if (invCountOrderDetailDao.countByOrderIdFk(orderId) > 0) {
invCountOrderDetailDao.deleteByOrderId(orderId);
}
if (invCountCodesDao.countByOrderIdFk(orderId) > 0) {
invCountCodesDao.deleteByOrderId(orderId);
}
log.info("盘点单据删除完成");
}
@Override
public BaseResponse saveCountOrder(InvCountOrderEntity invCountOrder) {
if (invCountOrder.getCountType() == 0 || invCountOrder.getCountType() == 2) {
//整库盘点
if (StrUtil.isBlank(invCountOrder.getDeptCode()) || StrUtil.isBlank(invCountOrder.getInvCode())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "请选择仓库信息!");
}
} else if (invCountOrder.getCountType() == 1) {
//货位盘点
if (StrUtil.isBlank(invCountOrder.getDeptCode()) || StrUtil.isBlank(invCountOrder.getInvCode()) || StrUtil.isBlank(invCountOrder.getInvSpaceCode())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "请选择仓库和货位信息!");
}
}
//封装相关数据
//未提交
invCountOrder.setStatus(0);
if (StrUtil.isBlank(invCountOrder.getOrderId())) {
//生成单据号
String orderId = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.COUNT_ORDER, "yyyyMMdd"));
//盘点单号
invCountOrder.setOrderId(orderId);
AuthAdmin user = customerService.getUserBean();
invCountOrder.setCreateUser(user.getUserName());
invCountOrder.setCreateTime(new Date());
invCountOrder.setUpdateTime(new Date());
invCountOrderDao.insert(invCountOrder);
} else {
InvCountOrderEntity oldData = invCountOrderDao.selectByOrderId(invCountOrder.getOrderId());
BeanUtils.copyProperties(invCountOrder, oldData, "id", "createTime", "createUser");
oldData.setUpdateTime(new Date());
invCountOrderDao.updateByOrderId(oldData);
}
return ResultVOUtils.success(invCountOrder);
}
@Override
public BaseResponse submitAudit(String id) {
InvCountOrderEntity invCountOrder = invCountOrderDao.selectById(Integer.valueOf(id));
if (null == invCountOrder) {
return ResultVOUtils.error(ResultEnum.DATA_ERROR, "单据不存在");
}
if (invCountOrder.getStatus() != 0) {
return ResultVOUtils.error(ResultEnum.DATA_ERROR, "单据已提交,请勿重复提交");
}
//查询单据详情和码表是否存在,如果无单据详情和条码,不允许提交
Long detailCount = invCountOrderDetailDao.countByOrderIdFk(invCountOrder.getOrderId());
if (detailCount == 0) {
return ResultVOUtils.error(ResultEnum.DATA_ERROR, "请先选择盘点产品");
}
Long codesCount = invCountCodesDao.countByOrderIdFk(invCountOrder.getOrderId());
if (codesCount == 0) {
return ResultVOUtils.error(ResultEnum.DATA_ERROR, "请扫描需要盘点的产品");
}
//更新状态
invCountOrder.setStatus(1);
invCountOrder.setUpdateTime(new Date());
//查询单据详情,计算盘点盈亏状态
List<InvCountOrderDetailEntity> detailList = invCountOrderDetailDao.selectByOrderId(invCountOrder.getOrderId());
for (InvCountOrderDetailEntity invCountOrderDetail : detailList) {
int diff = invCountOrderDetail.getInvNum() - invCountOrderDetail.getCountNum();
if (diff > 0) {
invCountOrderDetail.setLossNum(Math.abs(diff));
//盘亏
invCountOrderDetail.setStatus(0);
} else if (diff < 0) {
invCountOrderDetail.setProfitNum(Math.abs(diff));
//盘盈
invCountOrderDetail.setStatus(1);
} else {
//平衡
invCountOrderDetail.setStatus(2);
}
}
//更新单据信息
invCountOrderDao.updateById(invCountOrder);
//更新单据详情
invCountOrderDetailDao.updateBatch(detailList);
return ResultVOUtils.success();
}
@Override
public BaseResponse saveCountOrderForPDA(AddInvCountOrderSaveRequest addInvCountOrderSaveRequest) {
InvCountOrderEntity invCountOrder = invCountOrderDao.selectByOrderId(addInvCountOrderSaveRequest.getOrderId());
if (null == invCountOrder) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "此单据不存在");
}
if (invCountOrder.getStatus() != 0) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "此单据不可编辑");
}
//解析条码,修改单据详情,修改单据状态为待审核
invCountOrder.setStatus(1);
invCountOrder.setUpdateTime(new Date());
List<InvCountCodesEntity> countCodeList = addInvCountOrderSaveRequest.getCountCodeList();
for (InvCountCodesEntity invCountCodes : countCodeList) {
invCountCodesService.addCode(invCountCodes);
}
submitAudit(invCountOrder.getId().toString());
return ResultVOUtils.success();
}
@Override
public BaseResponse updateCountOrderStatus(String id, Integer status) {
InvCountOrderEntity invCountOrder = invCountOrderDao.selectById(Integer.valueOf(id));
invCountOrder.setStatus(status);
invCountOrder.setAuditUser(customerService.getUserBean().getUserName());
invCountOrder.setAuditTime(new Date());
invCountOrder.setUpdateTime(new Date());
if (status == 0) {
//审核不通过
//查询盘点单据详情,清空盘盈/盘亏数值
invCountOrderDetailDao.resetCountFiledValue(invCountOrder.getOrderId());
} else {
//审核通过
//根据单据详情生成相关单据
log.info("单据审核通过,开始生成扫码单据");
ThreadUtil.execAsync(() -> {
countOrderTransfer(invCountOrder);
});
}
invCountOrderDao.updateById(invCountOrder);
return ResultVOUtils.success();
}
/**
*
*
* @param invCountOrder
*/
private void countOrderTransfer(InvCountOrderEntity invCountOrder) {
//查询单据生成设置,是否已经配置对应单据类型,若未配置则结束转单流程
List<BasicBussinessTypeEntity> transferOrderSettings = getOrderSettings();
if (CollUtil.isEmpty(transferOrderSettings)) {
log.error("未配置盘点转单设置,无法转单!");
return;
}
/**
*
* 1
* 2 / =
* 3
*
* 1
* 2 / =
* 3
*/
//获取出入库码明细
List<IoCodeTempEntity> inCodes = getOrderCodes(invCountOrder, "in");
List<IoCodeTempEntity> outCodes = getOrderCodes(invCountOrder, "out");
//生成盘盈/盘亏单据
createNewOrder(invCountOrder, inCodes, outCodes, transferOrderSettings);
log.info("盘点转单完成");
}
/**
* /
*
* @param invCountOrder
* @param inCodes
* @param outCodes
* @param transferOrderSettings
*/
private void createNewOrder(InvCountOrderEntity invCountOrder, List<IoCodeTempEntity> inCodes, List<IoCodeTempEntity> outCodes, List<BasicBussinessTypeEntity> transferOrderSettings) {
BasicBussinessTypeEntity inBusType = new BasicBussinessTypeEntity();
BasicBussinessTypeEntity outBusType = new BasicBussinessTypeEntity();
for (BasicBussinessTypeEntity basicBussinessTypeEntity : transferOrderSettings) {
if (basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
inBusType = basicBussinessTypeEntity;
} else if (basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
outBusType = basicBussinessTypeEntity;
}
}
if (CollUtil.isNotEmpty(inCodes)) {
log.info("开始生成盘盈单据");
//开始生成盘盈单据
String inOrderId = buildOrder(invCountOrder, inCodes, inBusType);
log.info("盘点单据:{} 生成的盘盈入库单据号:{}", invCountOrder.getOrderId(), inOrderId);
invCountOrder.setInOrderIds(inOrderId);
//更新单据号
invCountOrderDao.updateById(invCountOrder);
log.info("盘盈单据生成成功");
}
if (CollUtil.isNotEmpty(outCodes)) {
//开始生成盘亏单据
log.info("开始生成盘亏单据");
String outOrderId = buildOrder(invCountOrder, outCodes, outBusType);
log.info("盘点单据:{} 生成的盘亏出库单据号:{}", invCountOrder.getOrderId(), outOrderId);
invCountOrder.setOutOrderIds(outOrderId);
//更新单据号
invCountOrderDao.updateById(invCountOrder);
log.info("盘亏单据生成成功");
}
}
/**
*
*
* @param invCountOrder
* @param codeTempList
* @param busType
*/
private String buildOrder(InvCountOrderEntity invCountOrder, List<IoCodeTempEntity> codeTempList, BasicBussinessTypeEntity busType) {
if (CollUtil.isNotEmpty(codeTempList)) {
//构造单据数据
IoOrderEntity order = new IoOrderEntity();
order.setMainAction(busType.getMainAction());
order.setAction(busType.getAction());
Date date = new Date();
order.setCreateTime(date);
order.setUpdateTime(date);
order.setDeptCode(invCountOrder.getDeptCode());
order.setInvCode(invCountOrder.getInvCode());
//查询单据往来单位信息
order.setFromCorp(busType.getDefaultUnit());
order.setFromType(ConstantStatus.FROM_COUNT);
order.setCorpOrderId(CustomUtil.getId() + "x");
//设置为草稿状态
order.setStatus(1);
order.setDealStatus(1);
order.setOrderType(3); //正常单据
//设置上传状态为未上传
order.setExportStatus(0);
String prefix = StrUtil.trim(busType.getPrefix());
prefix = Constant.SCAN_ORDER + (StrUtil.isBlank(prefix) ? "" : prefix);
//生成单据号
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(prefix, "yyyyMMdd"));
order.setBillNo(orderNo);
//对条码统一设置创建时间,单号等信息
codeTempList.forEach(codeTemp -> {
codeTemp.setCreateTime(date);
codeTemp.setOrderId(orderNo);
codeTemp.setAction(order.getAction());
codeTemp.setCorpOrderId(order.getCorpOrderId());
});
orderDao.insert(order);
codesTempDao.insertBatch(codeTempList);
return orderNo;
}
return null;
}
/**
*
*
* @param invCountOrder
* @param type in/out
* @return
*/
private List<IoCodeTempEntity> getOrderCodes(InvCountOrderEntity invCountOrder, String type) {
//构造库存详情查询参数
FilterInvProductDetailRequest invProductDetailRequest = new FilterInvProductDetailRequest();
invProductDetailRequest.setDeptCode(invCountOrder.getDeptCode());
invProductDetailRequest.setInvCode(invCountOrder.getInvCode());
//锁库存,查询库存更新时间早于或等于盘点单创建时间的数据 TODO 暂时注释掉锁库存的逻辑,盘点单转业务单暂不锁库存
//invProductDetailRequest.setUpdateTime(DateUtil.toDateStr(invCountOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
//判断盘点单据的货位字段是否为空,不为空则添加货位查询参数
if (StrUtil.isNotBlank(invCountOrder.getInvSpaceCode())) {
invProductDetailRequest.setInvSpaceCode(invCountOrder.getInvSpaceCode());
}
//查询盘点单据详情
FilterInvCountOrderDetailRequest countOrderDetailRequest = new FilterInvCountOrderDetailRequest();
countOrderDetailRequest.setOrderIdFk(invCountOrder.getOrderId());
countOrderDetailRequest.setStatus(type.equals("in") ? 1 : 0); //查询盈利/亏损的盘点单据详情
List<InvCountOrderDetailEntity> detailList = invCountOrderDetailDao.filterList(countOrderDetailRequest);
List<IoCodeTempEntity> codeList = new ArrayList<>();
//查找条码列表
if (type.equals("in")) {
log.info("开始生成盘盈单据码明细");
//查找盘盈条码列表
detailList.forEach(invCountOrderDetailEntity -> {
invProductDetailRequest.setRelId(String.valueOf(invCountOrderDetailEntity.getRelId()));
invProductDetailRequest.setBatchNo(invProductDetailRequest.getBatchNo());
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailDao.filterInvProductDetailList(invProductDetailRequest);
//查询盘点码明细
FilterInvCountCodesRequest countCodesRequest = new FilterInvCountCodesRequest();
countCodesRequest.setOrderIdFk(invCountOrder.getOrderId());
countCodesRequest.setRelId(String.valueOf(invCountOrderDetailEntity.getRelId()));
countCodesRequest.setBatchNo(invCountOrderDetailEntity.getBatchNo());
List<String> countCodeList = invCountCodesDao.selectCodes(countCodesRequest);
List<String> invProductDetailCodes = invProductDetailEntities.stream().map(InvProductDetailEntity::getCode).collect(Collectors.toList());
List<String> profitCodes = CollUtil.subtractToList(countCodeList, invProductDetailCodes);
if (CollUtil.isNotEmpty(invProductDetailCodes) && CollUtil.isEmpty(profitCodes)) {
/**
*
*
*/
IoCodeTempEntity codeTempEntity = buildCodeTempEntity(invCountOrder, countCodeList.get(0), invCountOrderDetailEntity);
codeList.add(codeTempEntity);
} else {
for (String code : profitCodes) {
if (!verifyCodeExist(codeList, code)) {
//生成码明细
IoCodeTempEntity codeTempEntity = buildCodeTempEntity(invCountOrder, code, invCountOrderDetailEntity);
codeList.add(codeTempEntity);
}
}
}
});
log.info("盘盈单据码明细生成成功");
} else {
log.info("开始生成盘亏单据码明细");
detailList.forEach(invCountOrderDetailEntity -> {
invProductDetailRequest.setRelId(String.valueOf(invCountOrderDetailEntity.getRelId()));
invProductDetailRequest.setBatchNo(invCountOrderDetailEntity.getBatchNo());
//查询库存详情
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailDao.filterInvProductDetailList(invProductDetailRequest);
//查询盘点码明细
FilterInvCountCodesRequest countCodesRequest = new FilterInvCountCodesRequest();
countCodesRequest.setOrderIdFk(invCountOrder.getOrderId());
countCodesRequest.setRelId(String.valueOf(invCountOrderDetailEntity.getRelId()));
countCodesRequest.setBatchNo(invCountOrderDetailEntity.getBatchNo());
List<String> countCodeList = invCountCodesDao.selectCodes(countCodesRequest);
List<String> invProductDetailCodes = invProductDetailEntities.stream().map(InvProductDetailEntity::getCode).collect(Collectors.toList());
List<String> lossCodes = CollUtil.subtractToList(invProductDetailCodes, countCodeList);
if (CollUtil.isNotEmpty(countCodeList) && CollUtil.isEmpty(lossCodes)) {
//盘点的码不为空,但是盘点数量和库存数量不一样,比对差集结果为空,说明是同一个条码,数量不同,直接根据盘亏数量计算生成一个扫码单据的码明细
//生成码详情
IoCodeTempEntity codeTempEntity = buildCodeTempEntity(invCountOrder, countCodeList.get(0), invCountOrderDetailEntity);
codeList.add(codeTempEntity);
} else {
for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
if (!countCodeList.contains(invProductDetailEntity.getCode()) && !verifyCodeExist(codeList, invProductDetailEntity.getCode())) {
InvCountOrderDetailEntity orderDetailEntity = new InvCountOrderDetailEntity();
BeanUtils.copyProperties(invCountOrderDetailEntity, orderDetailEntity);
orderDetailEntity.setStatus(0);
IoCodeTempEntity codeTempEntity = buildCodeTempEntity(invCountOrder, invProductDetailEntity.getCode(), invCountOrderDetailEntity);
codeList.add(codeTempEntity);
}
}
}
});
log.info("盘亏单据码名称生成成功");
}
return codeList;
}
/**
*
*
* @param codeList
* @param code
* @return
*/
private boolean verifyCodeExist(List<IoCodeTempEntity> codeList, String code) {
for (IoCodeTempEntity codeTempEntity : codeList) {
if (codeTempEntity.getCode().equals(code)) {
return true;
}
}
return false;
}
/**
*
*
* @param invCountOrder
* @param code
* @param invCountOrderDetailEntity
* @return
*/
private IoCodeTempEntity buildCodeTempEntity(InvCountOrderEntity invCountOrder, String code, InvCountOrderDetailEntity invCountOrderDetailEntity) {
IoCodeTempEntity codeTemp = new IoCodeTempEntity();
codeTemp.setCode(code);
codeTemp.setRelId(invCountOrderDetailEntity.getRelId());
codeTemp.setMainAction(invCountOrderDetailEntity.getStatus() == 0 ? ConstantType.TYPE_OUT : ConstantType.TYPE_PUT);
codeTemp.setDeptCode(invCountOrder.getDeptCode());
codeTemp.setInvCode(invCountOrder.getInvCode());
UdiEntity udi = FilterUdiUtils.getUdi(code);
codeTemp.setBatchNo(udi.getBatchNo());
codeTemp.setNameCode(udi.getUdi());
codeTemp.setProduceDate(udi.getProduceDate());
codeTemp.setExpireDate(udi.getExpireDate());
codeTemp.setSerialNo(udi.getSerialNo());
//计算码数量
int actCount = udiCalCountUtil.getActCount(codeTemp.getNameCode());
//判断此码有无批次号和序列号
if ((StrUtil.isBlank(codeTemp.getBatchNo()) && StrUtil.isBlank(codeTemp.getSerialNo())) || (StrUtil.isBlank(codeTemp.getSerialNo()) && StrUtil.isNotBlank(codeTemp.getBatchNo()))) {
//根据盘点盈亏状态取盘点数量值
int countNum = invCountOrderDetailEntity.getStatus() == 0 ? invCountOrderDetailEntity.getLossNum() : invCountOrderDetailEntity.getProfitNum();
int codeNum = countNum / actCount;
codeTemp.setCount(codeNum);
codeTemp.setReCount(codeNum);
} else {
codeTemp.setCount(actCount);
codeTemp.setReCount(actCount);
}
//获取盘点盈亏状态值
String countStatus = invCountOrderDetailEntity.getStatus() == 0 ? "loss" : "profit";
//设置供应商信息
setSupInfo(codeTemp, countStatus);
return codeTemp;
}
/**
*
*
* @param codeTemp
* @param countStatus
*/
private void setSupInfo(IoCodeTempEntity codeTemp, String countStatus) {
/**
* 使
*
* ID
*
* 1
*/
if (countStatus.equals("loss")) {
log.info("生成盘亏单据条码供应商信息,条码信息:{}", codeTemp.getCode());
List<String> supIds = invProductDetailDao.selectSupIdByCode(codeTemp.getCode());
if (CollUtil.isNotEmpty(supIds) && supIds.size() == 1) {
//此产品在库存中存在且只绑定了一个供应商若绑定了多个供应商则不填供应商ID字段生成单据之后会进入异常单据页面由操作人员手动指定供应商
codeTemp.setSupId(supIds.get(0));
}
} else {
log.info("生成盘盈单据条码供应商详情,条码信息:{}", codeTemp.getCode());
List<String> unitFkList = udiRlSupDao.selectUnitFkByRelId(codeTemp.getRelId());
if (CollUtil.isNotEmpty(unitFkList) && unitFkList.size() == 1) {
//此产品只绑定了一个供应商若绑定了多个供应商则不填供应商ID字段生成单据之后会进入异常单据页面手动指定供应商
codeTemp.setSupId(unitFkList.get(0));
}
}
}
/**
*
*
* @return
*/
private List<BasicBussinessTypeEntity> getOrderSettings() {
//查询类型为盘点转单的配置
List<BasicBusTypeChangeEntity> list = busTypeChangeDao.selectList(new QueryWrapper<BasicBusTypeChangeEntity>().eq("type", 4));
if (CollUtil.isNotEmpty(list)) {
List<BasicBussinessTypeEntity> busTypes = new ArrayList<>(2);
for (BasicBusTypeChangeEntity basicBusTypeChangeEntity : list) {
if ("PYRK".equals(basicBusTypeChangeEntity.getOriginAction().toUpperCase()) || "PKCK".equals(basicBusTypeChangeEntity.getOriginAction().toUpperCase())) {
busTypes.add(bussinessTypeDao.selectOne(new QueryWrapper<BasicBussinessTypeEntity>().eq("action", basicBusTypeChangeEntity.getTargetAction())));
}
}
return busTypes;
}
return null;
}
}

@ -1,79 +0,0 @@
<?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.inv.InvCountCodesDao">
<delete id="deleteByOrderId">
delete
from inv_count_codes
where orderIdFk = #{orderId}
</delete>
<select id="filterList" resultType="com.glxp.api.entity.inv.InvCountCodesEntity">
select *
from inv_count_codes
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND orderIdFk = #{orderIdFk}
</if>
<if test="relId != null and relId != ''">
AND relId = #{relId}
</if>
<if test="code != null and code != ''">
AND code like concat('%', #{code}, '%')
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
</where>
</select>
<select id="countByOrderIdFk" resultType="java.lang.Long">
select count(*)
from inv_count_codes
where orderIdFk = #{orderIdFk}
</select>
<select id="countByOrderId" resultType="java.lang.Long">
select sum(count)
from inv_count_codes
where orderIdFk = #{orderIdFk}
</select>
<select id="selectCountByCodeAndOrderId" resultType="java.lang.Long">
select count(*)
from inv_count_codes
where orderIdFk = #{orderIdFk}
and code = #{code}
</select>
<update id="resetCountFiledValue">
update inv_count_codes
set status = null
where orderIdFk = #{orderId}
</update>
<select id="selectByOrderIdAndProductId" resultType="com.glxp.api.entity.inv.InvCountCodesEntity">
select *
from inv_count_codes
where orderIdFk = #{orderIdFk}
and relId = #{productId}
</select>
<select id="selectCodes" resultType="java.lang.String">
select code
from inv_count_codes
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND orderIdFk = #{orderIdFk}
</if>
<if test="relId != null and relId != ''">
AND relId = #{relId}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
</where>
</select>
</mapper>

@ -1,96 +0,0 @@
<?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.inv.InvCountOrderDao">
<select id="filterList" resultType="com.glxp.api.res.inv.InvCountOrderResponse">
select co.id,
co.orderId,
co.deptCode,
co.invCode,
co.invSpaceCode,
co.invSpaceCode,
co.createUser,
co.createTime,
co.updateTime,
co.auditUser,
co.auditTime,
co.status,
co.remark,
co.inOrderIds,
co.outOrderIds,
co.countType,
(select `name` from auth_dept where code = co.deptCode) deptName,
(select `name` from auth_warehouse where code = co.invCode) invName,
(select `name` from auth_space where code = co.invSpaceCode) invSpaceName
from inv_count_order co
<where>
<if test="invCode != null and invCode != ''">
AND co.invCode = #{invCode}
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND co.invSpaceCode = #{invSpaceCode}
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND co.invSpaceCode = #{invSpaceCode}
</if>
<if test="status != null">
AND co.status = #{status}
</if>
<if test="orderId != null and orderId != ''">
AND co.orderId like concat('%', #{orderId}, '%')
</if>
</where>
order by co.updateTime desc
</select>
<select id="selectOrderIdById" resultType="java.lang.String">
select orderId
from inv_count_order
where id = #{id}
</select>
<select id="countBySpaceCode" resultType="java.lang.Integer">
select count(*)
from inv_count_order
<where>
<if test="deptCode != null and deptCode != ''">
AND deptCode = #{deptCode}
</if>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND invSpaceCode = #{invSpaceCode}
</if>
</where>
</select>
<update id="updateByOrderId">
update inv_count_order
set deptCode = #{deptCode,jdbcType=VARCHAR},
invCode = #{invCode,jdbcType=VARCHAR},
invSpaceCode = #{invSpaceCode,jdbcType=VARCHAR},
`createUser` = #{createUser,jdbcType=VARCHAR},
createTime = #{createTime,jdbcType=TIMESTAMP},
updateTime = #{updateTime,jdbcType=TIMESTAMP},
auditUser = #{auditUser,jdbcType=VARCHAR},
auditTime = #{auditTime,jdbcType=TIMESTAMP},
`status` = #{status,jdbcType=BOOLEAN},
remark = #{remark,jdbcType=VARCHAR},
inOrderIds = #{inOrderIds,jdbcType=VARCHAR},
outOrderIds = #{outOrderIds,jdbcType=VARCHAR},
countType = #{countType,jdbcType=INTEGER}
where orderId = #{orderId}
</update>
<select id="selectByOrderId" resultType="com.glxp.api.entity.inv.InvCountOrderEntity">
select *
from inv_count_order
where orderId = #{orderId}
</select>
<delete id="deleteByOrderId">
delete
from inv_count_order
where orderId = #{orderId}
</delete>
</mapper>

@ -1,150 +0,0 @@
<?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.inv.InvCountOrderDetailDao">
<delete id="deleteByOrderId">
delete
from inv_count_order_detail
where orderIdFk = #{orderId}
</delete>
<select id="filterList" resultType="com.glxp.api.entity.inv.InvCountOrderDetailEntity">
select *
from inv_count_order_detail
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND orderIdFk = #{orderIdFk}
</if>
<if test="status != null">
AND status = #{status}
</if>
</where>
</select>
<select id="countByOrderIdFk" resultType="java.lang.Long">
select count(*)
from inv_count_order_detail
where orderIdFk = #{orderIdFk}
</select>
<select id="filterCountDetail" resultType="com.glxp.api.res.inv.InvCountOrderDetailResponse">
select od.*, bp.cpmctymc productName, bp.ggxh, bp.ylqxzcrbarmc, bp.zczbhhzbapzbh
from inv_count_order_detail od
left join basic_udirel bu on od.relId = bu.id
left join basic_products bp on bu.uuid = bp.uuid
where orderIdFk = #{orderIdFk}
group by od.id
</select>
<delete id="deleteByOrderIdAndProductId">
delete
from inv_count_codes
where orderIdFk = #{orderIdFk}
and relId = #{productId}
</delete>
<select id="selectOrderDetail" resultType="com.glxp.api.entity.inv.InvCountOrderDetailEntity">
select *
from inv_count_order_detail
<where>
<if test="nameCode != null and nameCode != ''">
AND nameCode = #{nameCode}
</if>
<if test="orderIdFk != null and orderIdFk != ''">
AND orderIdFk = #{orderIdFk}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="produceDate != null and produceDate != ''">
AND produceDate = #{produceDate}
</if>
<if test="expireDate != null and expireDate != ''">
AND expireDate = #{expireDate}
</if>
</where>
</select>
<select id="selectByOrderId" resultType="com.glxp.api.entity.inv.InvCountOrderDetailEntity">
select *
from inv_count_order_detail
where orderIdFk = #{orderId}
</select>
<select id="resetCountFiledValue">
update inv_count_order_detail
set profitNum = null,
lossNum = null,
status = null
where orderIdFk = #{orderId}
</select>
<update id="updateBatch" parameterType="java.util.List">
update inv_count_order_detail
<trim prefix="set" suffixOverrides=",">
<trim prefix="orderIdFk = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.orderIdFk,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="relId = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.relId,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="nameCode = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.nameCode,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="batchNo = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.batchNo,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="produceDate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.produceDate,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="expireDate = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.expireDate,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="serialNo = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.serialNo,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="countNum = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.countNum,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="invNum = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.invNum,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="profitNum = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.profitNum,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="lossNum = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.lossNum,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=INTEGER}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
</mapper>
Loading…
Cancel
Save