1.添加单据编辑功能相关接口

2.扫码单据和业务单据添加审核时间字段

----- 添加数据sql脚本 -----

-- 扫码单据表添加审核时间字段
ALTER TABLE `spms`.`io_order`
ADD COLUMN `auditTime` datetime NULL COMMENT '审核时间' AFTER `updateTime`;
-- 刷写审核时间字段
update io_order set auditTime = updateTime;

-- 业务单据表添加审核时间字段
ALTER TABLE `spms`.`stock_order`
ADD COLUMN `auditTime` datetime NULL COMMENT '审核时间' AFTER `updateTime`;

-- 刷写审核时间字段
update stock_order set auditTime = updateTime;
master
x_z 3 years ago
parent df21a3ccd4
commit 7938c80929

@ -16,13 +16,13 @@ import com.glxp.sale.admin.entity.udid.UdiEntity;
import com.glxp.sale.admin.req.inout.*;
import com.glxp.sale.admin.req.inventory.FilterInvUserRequest;
import com.glxp.sale.admin.res.PageSimpleResponse;
import com.glxp.sale.admin.res.inout.OrderEditRequest;
import com.glxp.sale.admin.service.auth.CustomerService;
import com.glxp.sale.admin.service.basic.BussinessTypeService;
import com.glxp.sale.admin.service.info.CompanyService;
import com.glxp.sale.admin.service.inout.*;
import com.glxp.sale.admin.service.inventory.InvWarehouseService;
import com.glxp.sale.admin.thread.InvProductsTrService;
import com.glxp.sale.admin.thread.IoTransInoutService;
import com.glxp.sale.admin.util.CustomUtil;
import com.glxp.sale.admin.util.FilterUdiUtils;
import com.glxp.sale.common.enums.ResultEnum;
@ -38,10 +38,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@ -56,8 +53,6 @@ public class OrderController {
@Resource
private OrderDetailService orderDetailService;
@Resource
IoTransInoutService ioTransInoutService;
@Resource
StockOrderService stockOrderService;
@Resource
InvProductsTrService invProductsTrService;
@ -71,7 +66,6 @@ public class OrderController {
InvWarehouseService invWarehouseService;
@Resource
WarehouseUserService warehouseUserService;
@Resource
CustomerService customerService;
@ -137,14 +131,18 @@ public class OrderController {
@AuthRuleAnnotation("")
@PostMapping("udiwms/inout/order/delete")
public BaseResponse deleteOrder(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
String id = deleteRequest.getId();
if (StrUtil.isBlank(deleteRequest.getId()) && CollUtil.isEmpty(deleteRequest.getIds())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
if (CollUtil.isNotEmpty(deleteRequest.getIds())) {
orderService.deleteOrders(deleteRequest.getIds());
} else {
orderService.deleteOrders(Arrays.asList(deleteRequest.getId()));
}
orderService.deleteById(id);
orderDetailService.deleteByOrderId(id);
return ResultVOUtils.success("删除成功");
}
@ -525,5 +523,34 @@ public class OrderController {
}
}
/**
*
*
* @param billNo
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("/udiwms/inout/order/filterOrderForDelete")
public BaseResponse filterOrderForDelete(String billNo) {
if (StrUtil.isBlank(billNo)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
List<OrderEntity> orderEntities = orderService.filterOrderForDelete(billNo);
PageInfo<OrderEntity> pageInfo = new PageInfo<>(orderEntities);
PageSimpleResponse<OrderEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(orderEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@PostMapping("/udiwms/inout/order/updateOrderInfo")
public BaseResponse updateOrderInfo(@RequestBody OrderEditRequest orderEditRequest) {
if (null == orderEditRequest || StrUtil.isBlank(orderEditRequest.getActDate()) || CollUtil.isEmpty(orderEditRequest.getOrderIds())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
orderService.updateOrderInfo(orderEditRequest.getActDate(), orderEditRequest.getAuditTime(), orderEditRequest.getOrderIds());
return ResultVOUtils.success();
}
}

@ -292,51 +292,6 @@ public class StockOrderController {
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*
* @param stockOrderFilterRequest
* @return
*/
@GetMapping("/udiwms/stock/order/filterOrderForDelete")
public BaseResponse filterOrderForDelete(StockOrderFilterRequest stockOrderFilterRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
List<StockOrderEntity> stockOrderEntityList;
if (StringUtils.isNotBlank(stockOrderFilterRequest.getCorpId())) {
CompanyEntity companyEntity = companyService.findCompany(Long.parseLong(stockOrderFilterRequest.getCorpId()));
if (companyEntity.getUnitIdFk().equals("110")) {
Integer userId = customerService.getUserId();
stockOrderFilterRequest.setUnitIdFk(null);
stockOrderFilterRequest.setUserId(customerService.getUserId());
InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectByCode(stockOrderFilterRequest.getLocStorageCode());
FilterInvUserRequest filterInvUserRequest = new FilterInvUserRequest();
filterInvUserRequest.setCode(invWarehouseEntity.getCode());
filterInvUserRequest.setUserid(userId.longValue());
filterInvUserRequest.setIsDirector(true);
List<WarehouseUserEntity> warehouseUserEntities = warehouseUserService.filterWarehouseUsers(filterInvUserRequest);
if (CollUtil.isEmpty(warehouseUserEntities)) {
stockOrderFilterRequest.setUnionUser(userId);
}
} else
stockOrderFilterRequest.setUnitIdFk(companyEntity.getUnitIdFk());
stockOrderFilterRequest.setCorpId(null);
}
stockOrderEntityList = stockOrderService.filterListOr(stockOrderFilterRequest);
PageInfo<StockOrderEntity> pageInfo;
pageInfo = new PageInfo<>(stockOrderEntityList);
//判断订单是否可以补单
List<StockOrderResponse> resultList = orderService.checkSupplementOrder(stockOrderEntityList);
PageSimpleResponse<StockOrderResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(resultList);
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@GetMapping("/udiwms/stock/order/filterDetail")
public BaseResponse filterDetail(StockOrderFilterRequest stockOrderFilterRequest,
@ -419,21 +374,6 @@ public class StockOrderController {
return ResultVOUtils.success();
}
/**
*
*
* @param id
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("/udiwms/stock/order/deleteOrder")
public BaseResponse deleteOrder(@RequestParam("id") String id) {
if (StrUtil.isBlank(id)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return stockOrderService.deleteOrder(id);
}
@AuthRuleAnnotation("")
@PostMapping("/udiwms/stock/order/update")
public BaseResponse submitStockOrder(@RequestBody StockOrderEntity stockOrderEntity) {

@ -11,18 +11,18 @@ import com.glxp.sale.admin.entity.auth.AuthAdmin;
import com.glxp.sale.admin.entity.auth.AuthLicense;
import com.glxp.sale.admin.entity.basic.BasicUnitMaintainEntity;
import com.glxp.sale.admin.entity.basic.BussinessTypeEntity;
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
import com.glxp.sale.admin.entity.info.CompanyEntity;
import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity;
import com.glxp.sale.admin.entity.inout.*;
import com.glxp.sale.admin.entity.inout.OrderEntity;
import com.glxp.sale.admin.entity.inout.StockOrderEntity;
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
import com.glxp.sale.admin.entity.inout.WarehouseUserEntity;
import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity;
import com.glxp.sale.admin.entity.param.SystemParamConfigEntity;
import com.glxp.sale.admin.entity.udid.UdiEntity;
import com.glxp.sale.admin.exception.JsonException;
import com.glxp.sale.admin.req.basic.CompanyProductRelevanceRequest;
import com.glxp.sale.admin.req.basic.FilterUdiInfoRequest;
import com.glxp.sale.admin.req.info.FilterCompanyProductRelevanceRequest;
import com.glxp.sale.admin.req.inout.*;
import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest;
import com.glxp.sale.admin.res.PageSimpleResponse;
import com.glxp.sale.admin.res.basic.BussinessTypResponse;
import com.glxp.sale.admin.res.basic.CompanyProductRelevanceResponse;
@ -32,6 +32,7 @@ import com.glxp.sale.admin.service.auth.AuthAdminService;
import com.glxp.sale.admin.service.auth.CustomerService;
import com.glxp.sale.admin.service.basic.BasicUnitMaintainService;
import com.glxp.sale.admin.service.basic.BussinessTypeService;
import com.glxp.sale.admin.service.basic.UdiInfoService;
import com.glxp.sale.admin.service.basic.UdiRelevanceService;
import com.glxp.sale.admin.service.info.CompanyProductRelevanceService;
import com.glxp.sale.admin.service.info.CompanyService;
@ -44,8 +45,6 @@ import com.glxp.sale.common.enums.ResultEnum;
import com.glxp.sale.common.res.BaseResponse;
import com.glxp.sale.common.util.ResultVOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@ -55,7 +54,10 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@RestController
@ -91,11 +93,12 @@ public class WareHouseController {
CompanyProductRelevanceService companyProductRelevanceService;
@Resource
SystemParamConfigService systemParamConfigService;
Logger logger = LoggerFactory.getLogger(StockOrderController.class);
@Resource
StockOrderService stockOrderService;
@Resource
GennerOrderUtils gennerOrderUtils;
@Resource
private UdiInfoService udiInfoService;
@AuthRuleAnnotation("")
@GetMapping("admin/warehouse/inout/list")
@ -414,8 +417,8 @@ public class WareHouseController {
return ResultVOUtils.error(500, "超出预验收库存数量");
}
}
}else {
if(invProductDetailEntity.getCount()<1){
} else {
if (invProductDetailEntity.getCount() < 1) {
return ResultVOUtils.error(500, "超出预验收库存数量");
}
}
@ -677,11 +680,11 @@ public class WareHouseController {
try {
String customerId = getCustomerId();
if(customerId.equals("110")){
if (customerId.equals("110")) {
Integer userId = customerService.getUserId();
postOrderRequest.setCustomerId(customerId);
postOrderRequest.setUserId(userId);
}else {
} else {
postOrderRequest.setUserId(null);
}
@ -844,4 +847,29 @@ public class WareHouseController {
return ResultVOUtils.success();
}
/**
*
*
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/warehouse/inout/replaceCodes")
public BaseResponse replaceCodes(@RequestBody CodesReplaceRequest codesReplaceRequest) {
if (StrUtil.isBlank(codesReplaceRequest.getCode())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
UdiEntity udi = FilterUdiUtils.getUdi(codesReplaceRequest.getCode());
if (null == udi || StrUtil.isBlank(udi.getUdi())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "条码错误");
}
//判断udi码是否在产品信息中已维护如未维护则返回错误否则库存无法对应
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(udi.getUdi());
if (null == udiInfoEntity) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "产品未维护");
}
codesReplaceRequest.setUdiEntity(udiInfoEntity);
codesService.replaceCodes(codesReplaceRequest);
return ResultVOUtils.success();
}
}

@ -45,6 +45,13 @@ public interface CodesDao {
boolean updateSupId(@Param("supId") String supId, @Param("nameCode") String nameCode, @Param("orderId") String orderId);
void updateDelFlag(@Param("orderId") String orderId, @Param("delFlag") boolean delFlag);
/**
*
*
* @param orderId
* @return
*/
List<String> selectOrderIdsByOrderId(@Param("orderId") String orderId);
boolean deleteByOrderIdAndCode(@Param("orderId") String orderId, @Param("code") String code);
}

@ -53,5 +53,22 @@ public interface OrderDao {
List<OrderEntity> findAllByTime(OrderFilterRequest orderFilterRequest);
void updateDelFlag(@Param("id") String id, @Param("delFlag") boolean delFlag);
/**
* IDID
*
* @param billNo
* @return
*/
OrderEntity selectByBillNo(String billNo);
List<OrderEntity> selectByIds(@Param("orderIds") List<String> orderIds);
/**
*
*
* @param actDate
* @param orderIds
* @return
*/
boolean updateOrderTime(@Param("actDate") String actDate, @Param("auditTime") String auditTime, @Param("updateTime") String updateTime, @Param("orderIds") List<String> orderIds);
}

@ -44,5 +44,22 @@ public interface OrderDetailDao {
boolean deleteByOrderId(@Param("id") String id);
void updateDelFlag(@Param("orderIdFk") String orderIdFk, @Param("delFlag") boolean delFlag);
/**
* nameCodeorderId
*
* @param nameCode
* @param orderId
* @return
*/
ErpOrderEntity selectByNameCodeAndOrderId(@Param("nameCode") String nameCode, @Param("orderId") String orderId);
boolean deleteByOrderIdAndNameCode(@Param("orderId") String orderId, @Param("nameCode") String nameCode);
/**
*
*
* @param orderId
* @return
*/
int countByOrderId(@Param("orderId") String orderId);
}

@ -49,5 +49,11 @@ public interface StockOrderDao {
*/
StockOrderEntity selectById(@Param("id") String id);
void updateDelFlag(@Param("id") String id, @Param("delFlag") boolean delFlag);
/**
*
*
* @param orderIdFk
* @return
*/
boolean deleteByOrderIdFk(String orderIdFk);
}

@ -27,5 +27,5 @@ public interface StockOrderDetailDao {
StockOrderDetailEntity findOne(@Param("id") String id);
void updateDelFlag(@Param("orderIdFk") String orderIdFk, @Param("delFlag") boolean delFlag);
boolean deleteByOrderIdAndProductId(@Param("orderId") String orderId, @Param("productId") String productId);
}

@ -30,5 +30,12 @@ public interface InvProductDetailDao {
InvProductDetailEntity isExit(FilterInvProductDetailRequest filterInvProductDetailRequest);
void updateDelFlag(@Param("orderIdFk") String orderIdFk, @Param("delFlag") boolean delFlag);
/**
* orderId
*
* @param orderIdFk
*/
boolean deleteByOrderId(@Param("orderIdFk") String orderIdFk);
boolean deleteByOrderIdAndCode(@Param("orderId") String orderId, @Param("code") String code);
}

@ -23,7 +23,7 @@ public class ErpOrderEntity {
* dtlgoodsqty : 4000
*/
private long id;
private Long id;
private String erpOrderId;
private String iodtlId;
private String inoutId;
@ -77,7 +77,4 @@ public class ErpOrderEntity {
private String bindRlFk;
//是否删除
private boolean delFlag;
}

@ -48,8 +48,7 @@ public class OrderEntity {
private String originUllageSupNo;
private Date updateTime;
private boolean preCheck;
//是否删除
private boolean delFlag;
//审核时间
private Date auditTime;
}

@ -37,7 +37,4 @@ public class StockOrderDetailEntity {
private String manufactory;
private boolean allowNoBatch;
//是否删除
private boolean delFlag;
}

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class StockOrderEntity {
@ -35,7 +36,9 @@ public class StockOrderEntity {
private Integer createUser;
private Integer reviewUser;
//是否删除
private boolean delFlag;
//审核时间
private Date auditTime;
//更新时间
private Date updateTime;
}

@ -35,9 +35,6 @@ public class WarehouseEntity {
private String mySupId;
//是否删除
private boolean delFlag;
public String getSupId() {
if (supId == null) {

@ -26,7 +26,4 @@ public class InvProductDetailEntity {
private String invStorageCode;
private String invWarehouseCode;
//是否删除
private boolean delFlag;
}

@ -0,0 +1,34 @@
package com.glxp.sale.admin.req.inout;
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
import lombok.Data;
/**
*
*/
@Data
public class CodesReplaceRequest {
/**
*
*/
private String code;
/**
*
*/
private String count;
/**
*
*/
private String newCode;
/**
*
*/
private Integer newCount;
private UdiInfoEntity udiEntity;
}

@ -0,0 +1,19 @@
package com.glxp.sale.admin.res.inout;
import lombok.Data;
import java.util.List;
@Data
public class OrderEditRequest {
//创建时间
private String actDate;
//审核时间
private String auditTime;
//扫码单据号
private List<String> orderIds;
}

@ -16,4 +16,5 @@ public class WarehouseResponse {
private long id;
private String fromCorp;
private Integer count;
private String orderId;
}

@ -1,6 +1,7 @@
package com.glxp.sale.admin.service.inout;
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
import com.glxp.sale.admin.req.inout.CodesReplaceRequest;
import com.glxp.sale.admin.req.inout.WarehouseQueryRequest;
import java.util.List;
@ -39,4 +40,11 @@ public interface CodesService {
boolean updateRelId(String relId, String nameCode, String orderId);
boolean updateSupId(String sup, String nameCode, String orderId);
/**
*
*
* @param codesReplaceRequest
*/
void replaceCodes(CodesReplaceRequest codesReplaceRequest);
}

@ -71,4 +71,29 @@ public interface OrderService {
* @return
*/
List<StockOrderResponse> checkSupplementOrder(List<StockOrderEntity> stockOrderEntityList);
/**
*
*
* @param billNo
* @return
*/
List<OrderEntity> filterOrderForDelete(String billNo);
/**
*
*
* @param ids
*/
void deleteOrders(List<String> ids);
/**
*
*
* @param actDate
* @param auditTime
* @param orderIds
* @return
*/
boolean updateOrderInfo(String actDate, String auditTime, List<String> orderIds);
}

@ -4,7 +4,6 @@ import com.glxp.sale.admin.entity.inout.StockOrderEntity;
import com.glxp.sale.admin.entity.inout.StockOrderPrintEntity;
import com.glxp.sale.admin.req.inout.StockOrderFilterRequest;
import com.glxp.sale.admin.req.inout.StockOrderQueryRequest;
import com.glxp.sale.common.res.BaseResponse;
import java.util.List;
@ -44,12 +43,4 @@ public interface StockOrderService {
*/
List<StockOrderEntity> getSupplementOrderBillNoList();
/**
*
*
* @param id
* @return
*/
BaseResponse deleteOrder(String id);
}

@ -1,11 +1,20 @@
package com.glxp.sale.admin.service.inout.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.sale.admin.dao.inout.CodesDao;
import com.glxp.sale.admin.constant.ConstantType;
import com.glxp.sale.admin.dao.inout.*;
import com.glxp.sale.admin.dao.inventory.InvProductDao;
import com.glxp.sale.admin.dao.inventory.InvProductDetailDao;
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity;
import com.glxp.sale.admin.entity.inventory.InvProductEntity;
import com.glxp.sale.admin.req.inout.CodesReplaceRequest;
import com.glxp.sale.admin.req.inout.WarehouseQueryRequest;
import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest;
import com.glxp.sale.admin.req.inventory.FilterInvProductRequest;
import com.glxp.sale.admin.service.inout.CodesService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
@ -16,6 +25,18 @@ public class CodesServiceImpl implements CodesService {
@Resource
CodesDao codesDao;
@Resource
private InvProductDao invProductDao;
@Resource
private InvProductDetailDao invProductDetailDao;
@Resource
private OrderDetailDao orderDetailDao;
@Resource
private StockOrderDetailDao stockOrderDetailDao;
@Resource
private OrderDao orderDao;
@Resource
private StockOrderDao stockOrderDao;
@Override
public List<WarehouseEntity> listWarehouse(WarehouseQueryRequest warehouseQueryRequest) {
@ -130,4 +151,58 @@ public class CodesServiceImpl implements CodesService {
return codesDao.updateSupId(sup, nameCode, orderId);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void replaceCodes(CodesReplaceRequest codesReplaceRequest) {
List<WarehouseEntity> codeList = codesDao.findByCode(codesReplaceRequest.getCode());
//删除码表,添加新的条码,并更新库存
for (WarehouseEntity warehouseEntity : codeList) {
//构造新的码
WarehouseEntity codeEntity = new WarehouseEntity();
//删除码详情
codesDao.deleteByOrderIdAndCode(warehouseEntity.getOrderId(), warehouseEntity.getCode());
//查询库存详情
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
filterInvProductDetailRequest.setOriginCode(codesReplaceRequest.getCode());
filterInvProductDetailRequest.setOrderIdFk(codeEntity.getOrderId());
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
InvProductDetailEntity invProductDetailEntity = invProductDetailEntities.get(0); //库存
//删除库存详情
invProductDetailDao.deleteByOrderIdAndCode(warehouseEntity.getOrderId(), codesReplaceRequest.getCode());
//查询原库存详情和新的库存详情
FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
filterInvProductRequest.setRelIdFk(invProductDetailEntity.getProductIdFk());
InvProductEntity invProductEntity = invProductDao.filterInvProduct(filterInvProductRequest).get(0);
if (invProductDetailEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
//出库
int count = invProductEntity.getOutCount() + invProductDetailEntity.getCount();
invProductEntity.setOutCount(count);
} else if (invProductDetailEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
//入库
int count = invProductEntity.getInCount() - invProductDetailEntity.getCount();
invProductEntity.setInCount(count);
}
//更新库存
invProductDao.updateInvProduct(invProductEntity);
//删除单据详情
orderDetailDao.deleteByOrderIdAndNameCode(warehouseEntity.getOrderId(), codesReplaceRequest.getUdiEntity().getNameCode());
stockOrderDetailDao.deleteByOrderIdAndProductId(warehouseEntity.getOrderId(), warehouseEntity.getRelId());
int orderDetailCount = orderDetailDao.countByOrderId(warehouseEntity.getOrderId());
if (orderDetailCount == 0) {
//当单据详情数量为0时删除扫码单据和业务单据
orderDao.deleteById(warehouseEntity.getOrderId());
stockOrderDao.deleteByOrderIdFk(warehouseEntity.getOrderId());
}
}
}
}

@ -5,16 +5,24 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.sale.admin.constant.ConstantStatus;
import com.glxp.sale.admin.constant.ConstantType;
import com.glxp.sale.admin.dao.basic.BussinessTypeDao;
import com.glxp.sale.admin.dao.inout.*;
import com.glxp.sale.admin.dao.inventory.InvProductDao;
import com.glxp.sale.admin.dao.inventory.InvProductDetailDao;
import com.glxp.sale.admin.dao.inventory.InvWarehouseDao;
import com.glxp.sale.admin.entity.basic.BussinessTypeEntity;
import com.glxp.sale.admin.entity.inout.OrderEntity;
import com.glxp.sale.admin.entity.inout.StockOrderEntity;
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity;
import com.glxp.sale.admin.entity.inventory.InvProductEntity;
import com.glxp.sale.admin.entity.param.SystemParamConfigEntity;
import com.glxp.sale.admin.req.inout.OrderFilterRequest;
import com.glxp.sale.admin.req.inout.OrderQueryRequest;
import com.glxp.sale.admin.req.inout.StockOrderFilterRequest;
import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest;
import com.glxp.sale.admin.req.inventory.FilterInvProductRequest;
import com.glxp.sale.admin.res.inout.StockOrderResponse;
import com.glxp.sale.admin.service.inout.OrderService;
import com.glxp.sale.admin.service.param.SystemParamConfigService;
@ -24,11 +32,14 @@ import com.glxp.sale.common.res.BaseResponse;
import com.glxp.sale.common.util.ResultVOUtils;
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.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Service
@ -52,6 +63,14 @@ public class OrderServiceImpl implements OrderService {
SystemParamConfigService systemParamConfigService;
@Resource
GennerOrderUtils gennerOrderUtils;
@Resource
private InvProductDao invProductDao;
@Resource
private InvProductDetailDao invProductDetailDao;
@Resource
private StockOrderDetailDao stockOrderDetailDao;
@Resource
private OrderDetailDao orderDetailDao;
@Override
public List<OrderEntity> listOrders(OrderQueryRequest orderQueryRequest) {
@ -294,5 +313,101 @@ public class OrderServiceImpl implements OrderService {
return result;
}
@Override
public List<OrderEntity> filterOrderForDelete(String billNo) {
OrderEntity orderEntity = orderDao.selectByBillNo(billNo);
if (null == orderEntity) {
return Collections.emptyList();
}
//查询码表中所有的单据号
List<String> orderIds = codesDao.selectOrderIdsByOrderId(orderEntity.getId());
if (orderIds.size() > 1) {
orderIds.removeIf(s -> s.equals(orderEntity.getId()));
} else {
return Collections.singletonList(orderEntity);
}
List<OrderEntity> orderEntities = orderDao.selectByIds(orderIds);
orderEntities.add(0, orderEntity);
return orderEntities;
}
@Transactional(rollbackFor = Exception.class)
@Override
public void deleteOrders(List<String> ids) {
for (String id : ids) {
log.info("开始删除单号为:" + id + "的单据");
//查询扫码单据
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
orderFilterRequest.setId(id);
OrderEntity orderEntity = orderDao.findOne(orderFilterRequest);
if (orderEntity.getStatus() == 4) {
//查询库存详情
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
filterInvProductDetailRequest.setOrderIdFk(id);
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
Map<String, List<InvProductDetailEntity>> invProductDetailMap = invProductDetailEntities.stream().collect(Collectors.groupingBy(InvProductDetailEntity::getProductIdFk));
List<InvProductEntity> invProductList = new ArrayList<>(invProductDetailMap.keySet().size());
for (String productIdFk : invProductDetailMap.keySet()) {
FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
filterInvProductRequest.setRelIdFk(productIdFk);
List<InvProductEntity> invProductEntities = invProductDao.filterInvProduct(filterInvProductRequest);
InvProductEntity invProductEntity = invProductEntities.get(0);
List<InvProductDetailEntity> temp = invProductDetailMap.get(productIdFk);
String mainAction = temp.get(0).getMainAction();
int sum = temp.stream().mapToInt(InvProductDetailEntity::getCount).sum();
if (mainAction.equals(ConstantType.TYPE_PUT)) {
//入库,在原有库存基础上减库存
int count = invProductEntity.getInCount() - sum;
invProductEntity.setInCount(count);
} else if (mainAction.equals(ConstantType.TYPE_OUT)) {
//出库,在原有库存上增加库存
int count = invProductEntity.getOutCount() + sum;
invProductEntity.setOutCount(count);
}
invProductList.add(invProductEntity);
}
//删除单据相关数据,更新库存
try {
//更新库存
for (InvProductEntity invProductEntity : invProductList) {
invProductDao.updateInvProduct(invProductEntity);
}
//删除库存详情
invProductDetailDao.deleteByOrderId(id);
//删除码详情
codesDao.deleteByOrderId(id);
//查询业务单据
StockOrderFilterRequest stockOrderFilterRequest = new StockOrderFilterRequest();
stockOrderFilterRequest.setBillNo(orderEntity.getErpFk());
StockOrderEntity stockOrderEntity = stockOrderDao.findOne(stockOrderFilterRequest);
//删除业务单据详情
stockOrderDetailDao.deleteByOrderIdFk(stockOrderEntity.getId());
//删除业务单据
stockOrderDao.deleteById(stockOrderEntity.getId());
//删除扫码单据详情
orderDetailDao.deleteByOrderId(id);
//删除扫码单据
orderDao.deleteById(id);
log.info("单号为:" + id + " 的单据已删除");
} catch (Exception e) {
log.error("删除单据失败", e);
throw new RuntimeException("删除单据失败");
}
} else {
//未验收单据
orderDao.deleteById(id);
orderDetailDao.deleteByOrderId(id);
}
}
}
@Override
public boolean updateOrderInfo(String actDate, String auditTime, List<String> orderIds) {
return orderDao.updateOrderTime(actDate, auditTime, DateUtil.getDateTime(), orderIds);
}
}

@ -1,48 +1,23 @@
package com.glxp.sale.admin.service.inout.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.sale.admin.constant.ConstantType;
import com.glxp.sale.admin.dao.inout.*;
import com.glxp.sale.admin.dao.inventory.InvProductDao;
import com.glxp.sale.admin.dao.inventory.InvProductDetailDao;
import com.glxp.sale.admin.dao.inout.StockOrderDao;
import com.glxp.sale.admin.entity.inout.StockOrderEntity;
import com.glxp.sale.admin.entity.inout.StockOrderPrintEntity;
import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity;
import com.glxp.sale.admin.entity.inventory.InvProductEntity;
import com.glxp.sale.admin.req.inout.StockOrderFilterRequest;
import com.glxp.sale.admin.req.inout.StockOrderQueryRequest;
import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest;
import com.glxp.sale.admin.req.inventory.FilterInvProductRequest;
import com.glxp.sale.admin.service.inout.StockOrderService;
import com.glxp.sale.common.res.BaseResponse;
import com.glxp.sale.common.util.ResultVOUtils;
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.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class StockOrderServiceImpl implements StockOrderService {
@Resource
StockOrderDao stockOrderDao;
@Resource
private InvProductDetailDao invProductDetailDao;
@Resource
private InvProductDao invProductDao;
@Resource
private StockOrderDetailDao stockOrderDetailDao;
@Resource
private OrderDao orderDao;
@Resource
private OrderDetailDao orderDetailDao;
@Resource
private CodesDao codesDao;
@Override
public List<StockOrderEntity> listStockOrders(StockOrderQueryRequest stockOrderQueryRequest) {
@ -137,52 +112,4 @@ public class StockOrderServiceImpl implements StockOrderService {
return stockOrderDao.selectSupplementOrderList();
}
@Transactional(rollbackFor = Exception.class)
@Override
public BaseResponse deleteOrder(String id) {
//查询业务单据数据
StockOrderEntity stockOrderEntity = stockOrderDao.selectById(id);
//查询库存详情
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
filterInvProductDetailRequest.setOrderIdFk(stockOrderEntity.getOrderIdFk());
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
Map<String, List<InvProductDetailEntity>> map = invProductDetailEntities.stream().collect(Collectors.groupingBy(InvProductDetailEntity::getProductIdFk));
List<InvProductEntity> invProductEntities = new ArrayList<>(map.keySet().size());
for (String key : map.keySet()) {
//查询库存
FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
filterInvProductRequest.setRelIdFk(key);
List<InvProductEntity> invProductEntityList = invProductDao.filterInvProduct(filterInvProductRequest);
InvProductEntity invProductEntity = invProductEntityList.get(0);
List<InvProductDetailEntity> list = map.get(key);
String mainAction = list.get(0).getMainAction();
int count = list.stream().mapToInt(InvProductDetailEntity::getCount).sum();
if (mainAction.equals(ConstantType.TYPE_OUT)) {
//出库,删除单据,库存做增加
int result = invProductEntity.getOutCount() + count;
invProductEntity.setOutCount(result);
} else if (mainAction.equals(ConstantType.TYPE_PUT)) {
//入库,删除单据,库存做扣减
int result = invProductEntity.getInCount() - count;
invProductEntity.setInCount(result);
}
invProductEntities.add(invProductEntity);
}
//更新单据状态和库存数据
stockOrderDao.updateDelFlag(stockOrderEntity.getId(), true);
stockOrderDetailDao.updateDelFlag(stockOrderEntity.getId(), true);
orderDao.updateDelFlag(stockOrderEntity.getOrderIdFk(), true);
orderDetailDao.updateDelFlag(stockOrderEntity.getOrderIdFk(), true);
codesDao.updateDelFlag(stockOrderEntity.getOrderIdFk(), true);
for (InvProductEntity invProductEntity : invProductEntities) {
invProductDao.updateInvProduct(invProductEntity);
}
invProductDetailDao.updateDelFlag(stockOrderEntity.getOrderIdFk(), true);
return ResultVOUtils.success("删除成功");
}
}

@ -15,7 +15,6 @@
SELECT *
FROM io_codes
<where>
delFlag = 0
<if test="corpOrderId != '' and corpOrderId!=null">
and orderId = #{corpOrderId}
</if>
@ -100,21 +99,19 @@
FROM io_codes
WHERE `code` = #{code}
AND 'action' <![CDATA[ <> ]]> 'StockCheck'
AND delFlag = 0
</select>
<select id="findByReceiptId" parameterType="Map" resultType="com.glxp.sale.admin.entity.inout.WarehouseEntity">
SELECT *
FROM io_codes
WHERE `orderId` = #{orderId}
AND 'action' <![CDATA[ <> ]]> 'StockCheck'
and delFlag = 0
</select>
<select id="searchCode" parameterType="Map" resultType="com.glxp.sale.admin.entity.inout.WarehouseEntity">
SELECT *
FROM io_codes
WHERE delFlag = 0 and (SUBSTRING(`code`, 1, 14) = #{code}
WHERE SUBSTRING(`code`, 1, 14) = #{code}
or SUBSTRING(`code`, 2, 14) = #{code}
or SUBSTRING(`code`, 3, 14) = #{code})
or SUBSTRING(`code`, 3, 14) = #{code}
</select>
<select id="findCodesById" parameterType="Map"
@ -122,13 +119,11 @@
SELECT code
FROM io_codes
WHERE `orderId` = #{orderId}
and delFlag = 0
</select>
<select id="getByCorpOrderId" resultType="com.glxp.sale.admin.entity.inout.WarehouseEntity">
select *
from io_codes
where corpOrderId = #{corpOrderId}
and delFlag = 0
</select>
<update id="updateOrderId" parameterType="Map">
UPDATE io_codes
@ -177,15 +172,20 @@
<if test="invStorageCode != null">invStorageCode=#{invStorageCode},</if>
<if test="invWarehouseCode != null">invWarehouseCode=#{invWarehouseCode},</if>
<if test="locStorageCode != null">locStorageCode=#{locStorageCode},</if>
<if test="delFlag != null">delFlag=#{delFlag},</if>
</trim>
WHERE id=#{id}
</update>
<select id="selectOrderIdsByOrderId" resultType="java.lang.String">
select orderId
from io_codes
where code = (select code from io_codes where orderId = #{orderId} limit 1)
</select>
<update id="updateDelFlag">
update io_codes
set delFlag = #{delFlag}
<delete id="deleteByOrderIdAndCode">
delete
from io_codes
where orderId = #{orderId}
</update>
and code = #{code}
</delete>
</mapper>

@ -8,7 +8,6 @@
SELECT *
FROM io_order
where status = 'success'
and delFlag = false
</select>
<select id="listOrderError" parameterType="com.glxp.sale.admin.req.inout.OrderQueryRequest"
@ -17,7 +16,6 @@
select *
from io_order
where `status` <![CDATA[ <> ]]> 'success'
and delFlag = false
ORDER BY actDate DESC
</select>
@ -27,7 +25,6 @@
select *
from io_order
where corpOrderId in (select corpOrderId from io_order group by corpOrderId HAVING COUNT(corpOrderId) > 1)
and delFlag = false
ORDER BY actDate DESC
</select>
@ -36,7 +33,7 @@
fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus,
receiveStatus, erpFk, stockCheckFk, customerId, supId,
exportFilePath, locStorageCode, supplementNo, ullageSupNo, createUser, reviewUser,
outChangeEnable, originUllageSupNo,preCheck,delFlag)
outChangeEnable, originUllageSupNo, preCheck)
values (#{id},
#{action},
#{corpOrderId},
@ -55,49 +52,45 @@
#{erpFk},
#{stockCheckFk},
#{customerId}, #{supId}, #{exportFilePath}, #{locStorageCode}, #{supplementNo},
#{ullageSupNo}, #{createUser}, #{reviewUser}, #{outChangeEnable}, #{originUllageSupNo},#{preCheck}
#{delFlag})
#{ullageSupNo}, #{createUser}, #{reviewUser}, #{outChangeEnable}, #{originUllageSupNo}, #{preCheck})
</insert>
<insert id="importOrder" keyProperty="id" parameterType="com.glxp.sale.admin.entity.inout.OrderEntity">
replace
INTO io_order(id, action, corpOrderId, actDate, fromCorpId, actor, mainAction,
fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus,
receiveStatus, erpFk, stockCheckFk, customerId, supId,
exportFilePath, locStorageCode, supplementNo, ullageSupNo, createUser, reviewUser,
outChangeEnable, originUllageSupNo,preCheck, delFlag)
values (
#{id},
#{action},
#{corpOrderId},
#{actDate},
#{fromCorpId},
#{actor},
#{mainAction},
#{fromCorp},
#{status},
#{remark},
#{exportStatus},
#{fromType},
#{contrastStatus},
#{signStatus},
#{receiveStatus},
#{erpFk},
#{stockCheckFk},
#{customerId},
#{supId},
#{exportFilePath},
#{locStorageCode},
#{supplementNo},
#{ullageSupNo},
#{createUser},
#{reviewUser},
#{outChangeEnable},
#{originUllageSupNo},
#{preCheck},
#{delFlag}
)
INTO io_order(id, action, corpOrderId, actDate, fromCorpId, actor, mainAction,
fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus,
receiveStatus, erpFk, stockCheckFk, customerId, supId,
exportFilePath, locStorageCode, supplementNo, ullageSupNo, createUser, reviewUser,
outChangeEnable, originUllageSupNo, preCheck)
values (#{id},
#{action},
#{corpOrderId},
#{actDate},
#{fromCorpId},
#{actor},
#{mainAction},
#{fromCorp},
#{status},
#{remark},
#{exportStatus},
#{fromType},
#{contrastStatus},
#{signStatus},
#{receiveStatus},
#{erpFk},
#{stockCheckFk},
#{customerId},
#{supId},
#{exportFilePath},
#{locStorageCode},
#{supplementNo},
#{ullageSupNo},
#{createUser},
#{reviewUser},
#{outChangeEnable},
#{originUllageSupNo},
#{preCheck})
</insert>
@ -133,7 +126,7 @@
<if test="outChangeEnable != null">outChangeEnable=#{outChangeEnable},</if>
<if test="originUllageSupNo != null">originUllageSupNo=#{originUllageSupNo},</if>
<if test="preCheck != null">preCheck=#{preCheck},</if>
<if test="delFlag != null">delFlag=#{delFlag},</if>
<if test="auditTime != null">auditTime=#{auditTime},</if>
</trim>
WHERE id = #{id}
</update>
@ -187,7 +180,6 @@
SELECT io_order.* FROM io_order
INNER JOIN inv_warehouse_user on io_order.locStorageCode = inv_warehouse_user.`code`
<where>
io_order.delFlag = false
<if test="id != '' and id!=null">
and io_order.id =#{id}
</if>
@ -268,7 +260,6 @@
SELECT io_order.* FROM io_order
INNER JOIN inv_warehouse_user on io_order.locStorageCode = inv_warehouse_user.`code`
<where>
io_order.delFlag = false
<if test="id != '' and id!=null">
and io_order.id =#{id}
</if>
@ -343,7 +334,6 @@
SELECT io_order.* FROM io_order
INNER JOIN inv_warehouse_user on io_order.locStorageCode = inv_warehouse_user.`code`
<where>
io_order.delFlag = false
<if test="id != '' and id!=null">
and io_order.id =#{id}
</if>
@ -414,7 +404,6 @@
SELECT io_order.* FROM io_order
INNER JOIN inv_warehouse_user on io_order.locStorageCode = inv_warehouse_user.`code`
<where>
io_order.delFlag = false
<if test="id != '' and id!=null">
and io_order.id =#{id}
</if>
@ -477,7 +466,6 @@
resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
SELECT * FROM io_order
<where>
io_order.delFlag = false
<if test="id != '' and id!=null">
and id =#{id}
</if>
@ -507,7 +495,6 @@
resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
SELECT * FROM io_order
<where>
io_order.delFlag = false
<if test="status != '' and status!=null">
and status = #{status}
</if>
@ -533,7 +520,6 @@
<foreach collection="warehouseEntityList" item="item" open="(" separator="," close=")">
#{item.orderId}
</foreach>
and delFlag = false
</select>
<select id="filterListByOrder" parameterType="java.util.List"
@ -542,14 +528,34 @@
<foreach collection="orderList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and delFlag = false
</select>
<update id="updateDelFlag">
<select id="selectByBillNo" resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
select *
from io_order
where status = 4
and (id = #{billNo} or erpFk = #{billNo})
</select>
<select id="selectByIds" resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
select *
from io_order
where id in
<foreach collection="orderIds" separator="," index="index" item="item" open="(" close=")">
#{item}
</foreach>
order by id desc
</select>
<update id="updateOrderTime">
update io_order
set delFlag = #{delFlag}
where id = #{id}
set actDate = #{actDate},
auditTime = #{auditTime},
updateTime = #{updateTime}
where id in
<foreach collection="orderIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</update>
</mapper>

@ -8,7 +8,6 @@
select io_order_detail.* ,basic_corp.name supName from io_order_detail
left join basic_corp on io_order_detail.supId = basic_corp.erpId
<where>
io_order_detail.delFlag = false
<if test="erpOrderId != '' and erpOrderId!=null">
and io_order_detail.erpOrderId = #{erpOrderId}
</if>
@ -31,14 +30,12 @@
<foreach item="item" index="index" collection="orderids" open="(" separator="," close=")">
#{item}
</foreach>
and delFlag = false
</select>
<select id="filterMyErpMainOrder" parameterType="com.glxp.sale.admin.entity.inout.FilterErpOrderRequest"
resultType="com.glxp.sale.admin.entity.inout.ErpOrderEntity">
select * from io_order_detail
<where>
delFlag = false
<if test="erpOrderId != '' and erpOrderId!=null">
and erpOrderId = #{erpOrderId}
</if>
@ -54,7 +51,6 @@
resultType="com.glxp.sale.admin.entity.inout.ErpOrderEntity">
select * from io_order_detail
<where>
delFlag = false
<if test="erpOrderId != '' and erpOrderId!=null">
and erpOrderId = #{erpOrderId}
</if>
@ -75,7 +71,6 @@
<foreach item="item" index="index" collection="docids" open="(" separator="," close=")">
#{item}
</foreach>
and delFlag = false
</select>
<select id="selectAllIds" parameterType="java.util.List"
resultType="java.lang.String">
@ -86,7 +81,6 @@
#{item}
</foreach>
)
and delFlag = false
GROUP BY erpOrderId
</select>
@ -94,7 +88,6 @@
resultType="java.lang.String">
select erpOrderId from io_order_detail
<where>
delFlag = false
<if test="orderId != '' and orderId!=null">
and orderIdFk = #{orderId}
</if>
@ -106,7 +99,6 @@
resultType="com.glxp.sale.admin.entity.inout.ErpOrderEntity">
select erpOrderId,orderIdFk from io_order_detail
<where>
delFlag = false
<if test="orderId != '' and orderId!=null">
and orderIdFk <![CDATA[ <> ]]> #{orderId}
</if>
@ -122,7 +114,7 @@
batchNo,erpCount,credate,nameCode,productCompany,
coName,authCode,packSpec,packRatio,bhzxxsbzsl,
zxxsbzbhsydysl,orderIdFk,`count`,reCount,productDate,expireDate,bindStatus,bindRlFk,uuidFk,supId,bindSupStatus
,ylqxzcrbarmc,secSalesListNo,firstSalesInvNo,secSalesInvNo,invoiceDate,price,delFlag)
,ylqxzcrbarmc,secSalesListNo,firstSalesInvNo,secSalesInvNo,invoiceDate,price)
values(
#{id},
#{companyid},
@ -149,8 +141,7 @@
#{count},
#{reCount},
#{productDate},
#{expireDate}
,
#{expireDate},
#{bindStatus},
#{bindRlFk},
#{uuidFk},
@ -161,8 +152,7 @@
#{firstSalesInvNo},
#{secSalesInvNo},
#{invoiceDate},
#{price},
#{delFlag}
#{price}
)
</insert>
@ -171,7 +161,7 @@
companyid,erpOrderId,iodtlId,inoutId,goodsunit,goodsid,batchNoId,goodsname,companyname,
batchNo,erpCount,credate,nameCode,productCompany,
coName,authCode,packSpec,packRatio,bhzxxsbzsl,zxxsbzbhsydysl,orderIdFk,count,reCount,productDate,expireDate
,bindStatus,bindRlFk,uuidFk,supId,bindSupStatus,ylqxzcrbarmc,secSalesListNo,firstSalesInvNo,secSalesInvNo,invoiceDate,price,delFlag)
,bindStatus,bindRlFk,uuidFk,supId,bindSupStatus,ylqxzcrbarmc,secSalesListNo,firstSalesInvNo,secSalesInvNo,invoiceDate,price)
values
<foreach collection="erpOrderEntities" item="item" index="index"
separator=",">
@ -198,7 +188,7 @@
#{item.secSalesListNo},
#{item.firstSalesInvNo},
#{item.secSalesInvNo},
#{item.invoiceDate},#{item.price}, #{item.delFlag}
#{item.invoiceDate},#{item.price}
)
</foreach>
@ -226,7 +216,6 @@
<if test="invoiceDate != null">invoiceDate=#{invoiceDate},</if>
<if test="productCompany != null">productCompany=#{productCompany},</if>
<if test="bindSupStatus != null">bindSupStatus=#{bindSupStatus},</if>
<if test="delFlag != null">delFlag=#{delFlag},</if>
</trim>
WHERE id = #{id}
</update>
@ -255,10 +244,23 @@
WHERE `id` = #{id}
</select>
<update id="updateDelFlag">
update io_order_detail
set delFlag = #{delFlag}
where orderIdFk = #{orderIdFk}
</update>
<select id="selectByNameCodeAndOrderId" resultType="com.glxp.sale.admin.entity.inout.ErpOrderEntity">
select *
from io_order_detail
where nameCode = #{nameCode}
and orderIdFk = #{orderId}
</select>
<delete id="deleteByOrderIdAndNameCode">
delete from io_order_detail
where orderIdFk = #{orderId}
and nameCode = #{nameCode}
</delete>
<select id="countByOrderId" resultType="int">
select count(*)
from io_order_detail
where orderIdFk = #{orderId}
</select>
</mapper>

@ -8,7 +8,7 @@
SELECT *
FROM stock_order
INNER JOIN inv_warehouse_user on stock_order.locStorageCode = inv_warehouse_user.`code`
where status = 'success' and delFlag = false
where status = 'success'
group by stock_order.id
</select>
@ -18,7 +18,7 @@
select *
from stock_order
INNER JOIN inv_warehouse_user on stock_order.locStorageCode = inv_warehouse_user.`code`
where `status` = '101' and stock_order.delFlag = false
where `status` = '101'
group by stock_order.id
ORDER BY id DESC
@ -29,7 +29,7 @@
insert INTO stock_order(id, billNo, billdate, corpId, corpName, billType, billFlag,
thirdSysFk, status, statusInfo, type, sourceType,
printStatus, unitIdFk, customerId, thirdOrderFk, orderIdFk,
totalPrice, locStorageCode, supplementNo, createUser, reviewUser, delFlag)
totalPrice, locStorageCode, supplementNo, createUser, reviewUser)
values (#{id},
#{billNo},
#{billdate},
@ -43,7 +43,7 @@
#{type},
#{sourceType},
#{printStatus}, #{unitIdFk}, #{customerId}, #{thirdOrderFk}, #{orderIdFk}, #{totalPrice},
#{locStorageCode}, #{supplementNo}, #{createUser}, #{reviewUser}, #{delFlag})
#{locStorageCode}, #{supplementNo}, #{createUser}, #{reviewUser})
</insert>
<update id="updateById" parameterType="com.glxp.sale.admin.entity.inout.StockOrderEntity">
UPDATE stock_order
@ -69,7 +69,6 @@
<if test="supplementNo != null">supplementNo=#{supplementNo},</if>
<if test="createUser != null">createUser=#{createUser},</if>
<if test="reviewUser != null">reviewUser=#{reviewUser},</if>
<if test="delFlag != null">delFlag=#{delFlag},</if>
</trim>
WHERE id = #{id}
</update>
@ -101,7 +100,6 @@
SELECT stock_order.* FROM stock_order
INNER JOIN inv_warehouse_user on stock_order.locStorageCode = inv_warehouse_user.`code`
<where>
stock_order.delFlag = false
<if test="id != '' and id!=null">
and id =#{id}
</if>
@ -187,7 +185,6 @@
resultType="com.glxp.sale.admin.entity.inout.StockOrderEntity">
SELECT * FROM stock_order
<where>
delFlag = false
<if test="id != '' and id!=null">
and id =#{id}
</if>
@ -232,7 +229,6 @@
stock_order_detail.orderIdFk
left join inv_warehouse on inv_warehouse.code = stock_order.locStorageCode
<where>
stock_order.delFlag = false
<if test="id != '' and id!=null">
and stock_order.id =#{id}
</if>
@ -252,9 +248,8 @@
<select id="selectSupplementOrderList" resultType="com.glxp.sale.admin.entity.inout.StockOrderEntity">
select *
from stock_order
where delFlag = false
and (supplementNo is null
or supplementNo = '')
where supplementNo is null
or supplementNo = ''
</select>
<select id="selectById" resultType="com.glxp.sale.admin.entity.inout.StockOrderEntity">
@ -263,10 +258,10 @@
where id = #{id}
</select>
<update id="updateDelFlag">
update stock_order
set delFlag = #{delFlag}
where id = #{id}
</update>
<delete id="deleteByOrderIdFk">
delete
from stock_order
where orderIdFk = #{orderIdFk}
</delete>
</mapper>

@ -8,7 +8,6 @@
select stock_order_detail.*,basic_udirel.allowNoBatch from stock_order_detail
left join basic_udirel on stock_order_detail.relId = basic_udirel.id
<where>
delFlag = false
<if test="orderIdFk != '' and orderIdFk!=null">
and orderIdFk = #{orderIdFk}
</if>
@ -41,7 +40,6 @@
right JOIN basic_products
ON stock_order_detail.productId = basic_products.uuid
<where>
stock_order_detail.delFlag = false
<if test="orderIdFk != '' and orderIdFk!=null">
and orderIdFk = #{orderIdFk}
</if>
@ -68,7 +66,7 @@
INTO stock_order_detail(id,
orderIdFk,productId,productName,spec,batchNo,productDate,
expireDate,count,reCount,sweepCount,ylqxzcrbarmc,zczbhhzbapzbh,price,relId,
manufactory,firstSalesInvNo,secSalesInvNo,secSalesListNo,invoiceDate,delFlag)
manufactory,firstSalesInvNo,secSalesInvNo,secSalesListNo,invoiceDate)
values(
#{id},
#{orderIdFk},
@ -89,8 +87,7 @@
#{firstSalesInvNo},
#{secSalesInvNo},
#{secSalesListNo},
#{invoiceDate},
#{delFlag}
#{invoiceDate}
)
</insert>
@ -99,7 +96,7 @@
replace INTO stock_order_detail(id,
orderIdFk,productId,productName,spec,batchNo,productDate,
expireDate,count,reCount,sweepCount,ylqxzcrbarmc,zczbhhzbapzbh,price,relId,
manufactory,firstSalesInvNo,secSalesInvNo,secSalesListNo,invoiceDate,delFlag)
manufactory,firstSalesInvNo,secSalesInvNo,secSalesListNo,invoiceDate)
values
<foreach collection="stockOrderDetailEntities" item="item" index="index"
separator=",">
@ -117,7 +114,7 @@
#{item.sweepCount},
#{item.ylqxzcrbarmc},
#{item.zczbhhzbapzbh},#{item.price},#{item.relId},#{item.manufactory},#{item.firstSalesInvNo},#{item.secSalesInvNo},
#{item.secSalesListNo},#{item.invoiceDate},#{item.delFlag}
#{item.secSalesListNo},#{item.invoiceDate}
)
</foreach>
@ -139,7 +136,6 @@
<if test="invoiceDate != null">invoiceDate=#{invoiceDate},</if>
<if test="relId != null">relId=#{relId},</if>
<if test="manufactory != null">manufactory=#{manufactory},</if>
<if test="delFlag != null">delFlag=#{delFlag},</if>
</set>
WHERE id = #{id}
</update>
@ -161,14 +157,14 @@
SELECT *
FROM stock_order_detail
WHERE id = #{id}
and delFlag = false
limit 1
</select>
<update id="updateDelFlag">
update stock_order_detail
set delFlag = #{delFlag}
where orderIdFk = #{orderIdFk}
</update>
<delete id="deleteByOrderIdAndProductId">
delete
from stock_order_detail
where productId = #{productId}
and orderIdFk = (select id from stock_order where stock_order.orderIdFk = #{orderId})
</delete>
</mapper>

@ -8,7 +8,6 @@
SELECT *
FROM inv_product_detail
<where>
delFlag = false
<if test="productIdFk != '' and productIdFk != null">
AND productIdFk = #{productIdFk}
</if>
@ -64,7 +63,6 @@
SELECT inv_product_detail.* ,io_order.fromCorp,io_order.fromCorpId FROM inv_product_detail
inner join io_order on inv_product_detail.orderIdFk = io_order.id
<where>
inv_product_detail.delFlag = false
<if test="productIdFk != '' and productIdFk != null">
AND productIdFk = #{productIdFk}
</if>
@ -119,12 +117,12 @@
(code, productIdFk, orderIdFk, customerId, mainAction, `action`, `count`, updateTime,
purchaseType, batchNo, productionDate, expireDate, unitFk, stockIdFk, supId, originCode,
invStorageCode,
invWarehouseCode, delFlag)
invWarehouseCode)
values (#{code},
#{productIdFk}, #{orderIdFk},
#{customerId}, #{mainAction}, #{action}, #{count}, #{updateTime},
#{purchaseType}, #{batchNo}, #{productionDate}, #{expireDate}, #{unitFk}, #{stockIdFk}, #{supId},
#{originCode}, #{invStorageCode}, #{invWarehouseCode}, #{delFlag})
#{originCode}, #{invStorageCode}, #{invWarehouseCode})
</insert>
<insert id="insertInvProductDetails" keyProperty="id"
@ -133,7 +131,7 @@
(code, productIdFk, orderIdFk, customerId, mainAction, `action`, `count`, updateTime,
purchaseType, batchNo, productionDate, expireDate, unitFk, stockIdFk, supId, originCode,
invStorageCode,
invWarehouseCode, delFlag)
invWarehouseCode)
values
<foreach collection="invProductDetailEntitys" item="item" index="index"
@ -143,8 +141,7 @@
#{item.customerId}, #{item.mainAction}, #{item.action}, #{item.count}, #{item.updateTime},
#{item.purchaseType}, #{item.batchNo}, #{item.productionDate}, #{item.expireDate},
#{item.unitFk}, #{item.stockIdFk},
#{item.supId}, #{item.originCode}, #{item.invStorageCode}, #{item.invWarehouseCode},
#{item.delFlag})
#{item.supId}, #{item.originCode}, #{item.invStorageCode}, #{item.invWarehouseCode})
</foreach>
</insert>
@ -195,7 +192,6 @@
<if test="originCode != null">originCode=#{originCode},</if>
<if test="invStorageCode != null">invStorageCode=#{invStorageCode},</if>
<if test="invWarehouseCode != null">invWarehouseCode=#{invWarehouseCode},</if>
<if test="delFlag != null">delFlag=#{delFlag},</if>
</trim>
WHERE id = #{id}
</update>
@ -203,7 +199,6 @@
resultType="java.lang.Integer">
SELECT count(0) FROM inv_product_detail
<where>
delFlag = false
<if test="productIdFk != '' and productIdFk != null">
AND productIdFk = #{productIdFk}
</if>
@ -253,7 +248,6 @@
resultType="com.glxp.sale.admin.entity.inventory.InvProductDetailEntity">
SELECT * FROM inv_product_detail
<where>
delFlag = false
<if test="productIdFk != '' and productIdFk != null">
AND productIdFk = #{productIdFk}
</if>
@ -292,10 +286,17 @@
</select>
<update id="updateDelFlag">
update inv_product_detail
set delFlag = #{delFlag}
<delete id="deleteByOrderId">
delete
from inv_product_detail
where orderIdFk = #{orderIdFk}
</update>
</delete>
<delete id="deleteByOrderIdAndCode">
delete
from inv_product_detail
where orderIdFk = #{orderId}
and code = #{code}
</delete>
</mapper>
Loading…
Cancel
Save