1.调整删除临时码表数据逻辑,当单据不存在数据时,删除单据

master
x_z 3 years ago
parent 1ac50c2c5f
commit f6fd34f8a4

@ -11,27 +11,24 @@ import com.glxp.udi.admin.constant.ConstantStatus;
import com.glxp.udi.admin.entity.auth.AuthAdmin; import com.glxp.udi.admin.entity.auth.AuthAdmin;
import com.glxp.udi.admin.entity.inout.*; import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.entity.udid.UdiEntity; import com.glxp.udi.admin.entity.udid.UdiEntity;
import com.glxp.udi.admin.service.inout.OrderService;
import com.glxp.udi.admin.service.inout.WarehouseService;
import com.glxp.udi.admin.service.inout.WarehouseTempService;
import com.glxp.udi.admin.req.inout.*; import com.glxp.udi.admin.req.inout.*;
import com.glxp.udi.admin.req.inventory.FilterInvLinkDataRequest; import com.glxp.udi.admin.req.inventory.FilterInvLinkDataRequest;
import com.glxp.udi.admin.res.PageSimpleResponse; import com.glxp.udi.admin.res.PageSimpleResponse;
import com.glxp.udi.admin.res.basic.BussinessTypResponse; import com.glxp.udi.admin.res.basic.BussinessTypResponse;
import com.glxp.udi.admin.service.auth.AuthAdminService; import com.glxp.udi.admin.service.auth.AuthAdminService;
import com.glxp.udi.admin.service.inout.UdiInfoService; import com.glxp.udi.admin.service.inout.*;
import com.glxp.udi.admin.service.inout.WarehouseBussinessTypeService;
import com.glxp.udi.admin.service.inout.WarehouseUserService;
import com.glxp.udi.admin.thread.TransInoutService; import com.glxp.udi.admin.thread.TransInoutService;
import com.glxp.udi.admin.util.FilterUdiUtils; import com.glxp.udi.admin.util.FilterUdiUtils;
import com.glxp.udi.common.enums.ResultEnum; import com.glxp.udi.common.enums.ResultEnum;
import com.glxp.udi.common.util.ResultVOUtils; import com.glxp.udi.common.util.ResultVOUtils;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; 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.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -86,25 +83,7 @@ public class WareHouseController {
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@GetMapping("warehouse/inout/deleteCodesTempById") @GetMapping("warehouse/inout/deleteCodesTempById")
public BaseResponse deleteCodesTempById(String id) { public BaseResponse deleteCodesTempById(String id) {
WarehousetempEntity warehousetemp = warehouseTempService.findTempById(id); return warehouseTempService.deleteCodesTempById(id);
if (null == warehousetemp) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
if (warehousetemp.getCount() != null && warehousetemp.getCount() > 1) {
warehousetemp.setCount(warehousetemp.getCount() - 1);
warehouseTempService.updateById(warehousetemp);
} else {
warehouseTempService.deleteTempWarehouses(Collections.singletonList(warehousetemp.getId()));
}
List<WarehousetempEntity> tempByOrderId = warehouseTempService.findTempByOrderId(warehousetemp.getOrderId());
if (tempByOrderId.size() == 0) {
DeleteRequest deleteRequest = new DeleteRequest();
deleteRequest.setOrderId(warehousetemp.getOrderId());
warehouseTempService.deleteCode(deleteRequest);
}
return ResultVOUtils.success();
} }
/** /**

@ -51,4 +51,12 @@ public interface CodesTempDao extends BaseMapper<WarehousetempEntity> {
* @param orderId * @param orderId
*/ */
void updateActDateByOrderId(@Param("actDate") String actDate, @Param("orderId") String orderId); void updateActDateByOrderId(@Param("actDate") String actDate, @Param("orderId") String orderId);
/**
*
*
* @param orderId
* @return
*/
int countByOrderId(@Param("orderId") String orderId);
} }

@ -17,4 +17,12 @@ public interface OrderDetailDao extends BaseMapper<OrderDetailEntity> {
* @param id * @param id
*/ */
void deleteByOrderId(@Param("orderId") String orderId); void deleteByOrderId(@Param("orderId") String orderId);
/**
*
*
* @param orderDetailEntity
*/
void update(OrderDetailEntity orderDetailEntity);
} }

@ -11,11 +11,13 @@ import com.glxp.udi.admin.entity.udid.UdiEntity;
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest; import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
import com.glxp.udi.admin.util.FilterUdiUtils; import com.glxp.udi.admin.util.FilterUdiUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
@Service @Service
@Transactional(rollbackFor = Exception.class)
public class InvProductDetailService { public class InvProductDetailService {
@Resource @Resource

@ -9,11 +9,13 @@ import com.glxp.udi.admin.dao.inout.InvProductDao;
import com.glxp.udi.admin.entity.inout.InvProductEntity; import com.glxp.udi.admin.entity.inout.InvProductEntity;
import com.glxp.udi.admin.req.inventory.FilterInvProductRequest; import com.glxp.udi.admin.req.inventory.FilterInvProductRequest;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
@Service @Service
@Transactional(rollbackFor = Exception.class)
public class InvProductService { public class InvProductService {
@Resource @Resource

@ -9,11 +9,13 @@ import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
import com.glxp.udi.admin.req.inout.DeleteRequest; import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
@Service @Service
@Transactional(rollbackFor = Exception.class)
public class OrderDetailService { public class OrderDetailService {
@Resource @Resource
@ -41,15 +43,8 @@ public class OrderDetailService {
public void updateOrderDetail(OrderDetailEntity orderDetailEntity) { public void updateOrderDetail(OrderDetailEntity orderDetailEntity) {
UpdateWrapper<OrderDetailEntity> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<OrderDetailEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.setEntity(orderDetailEntity); updateWrapper.eq("id", orderDetailEntity.getId());
updateWrapper orderDetailDao.update(orderDetailEntity);
.set("price", orderDetailEntity.getPrice())
.set("firstSalesInvNo", orderDetailEntity.getFirstSalesInvNo())
.set("secSalesInvNo", orderDetailEntity.getSecSalesInvNo())
.set("secSalesListNo", orderDetailEntity.getSecSalesListNo())
.set("invoiceDate", orderDetailEntity.getInvoiceDate())
.eq("id", orderDetailEntity.getId());
orderDetailDao.update(orderDetailEntity, updateWrapper);
} }
public long statCount(String orderId) { public long statCount(String orderId) {
@ -70,7 +65,7 @@ public class OrderDetailService {
.eq(StrUtil.isNotBlank(orderDetailRequest.getOrderIdFk()), "orderIdFk", orderDetailRequest.getOrderIdFk()) .eq(StrUtil.isNotBlank(orderDetailRequest.getOrderIdFk()), "orderIdFk", orderDetailRequest.getOrderIdFk())
.eq(null != orderDetailRequest.getCustomerId(), "customerId", orderDetailRequest.getCustomerId()) .eq(null != orderDetailRequest.getCustomerId(), "customerId", orderDetailRequest.getCustomerId())
.eq(StrUtil.isNotBlank(orderDetailRequest.getUuidFk()), "uuidFk", orderDetailRequest.getUuidFk()) .eq(StrUtil.isNotBlank(orderDetailRequest.getUuidFk()), "uuidFk", orderDetailRequest.getUuidFk())
.eq(StrUtil.isNotBlank(orderDetailRequest.getRelId()),"relId", orderDetailRequest.getRelId()) .eq(StrUtil.isNotBlank(orderDetailRequest.getRelId()), "relId", orderDetailRequest.getRelId())
.eq(StrUtil.isNotBlank(orderDetailRequest.getLotno()), "batchNo", orderDetailRequest.getLotno()); .eq(StrUtil.isNotBlank(orderDetailRequest.getLotno()), "batchNo", orderDetailRequest.getLotno());
return wrapper; return wrapper;
} }

@ -32,6 +32,7 @@ import com.glxp.udi.common.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@ -40,6 +41,7 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
@Transactional(rollbackFor = Exception.class)
public class OrderService { public class OrderService {
@Lazy @Lazy

@ -15,12 +15,14 @@ import com.glxp.udi.admin.req.inout.*;
import com.glxp.udi.admin.req.inventory.FilterInvProductRequest; import com.glxp.udi.admin.req.inventory.FilterInvProductRequest;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@Service @Service
@Transactional(rollbackFor = Exception.class)
public class WarehouseService { public class WarehouseService {
@Lazy @Lazy

@ -5,22 +5,28 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.dao.inout.CodesTempDao; import com.glxp.udi.admin.dao.inout.CodesTempDao;
import com.glxp.udi.admin.dao.inout.OrderDao;
import com.glxp.udi.admin.entity.inout.WarehousetempEntity; import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import com.glxp.udi.admin.req.inout.DeleteRequest; import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest; import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
import com.glxp.udi.common.enums.ResultEnum;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections;
import java.util.List; import java.util.List;
@Service @Service
@Transactional @Transactional(rollbackFor = Exception.class)
public class WarehouseTempService { public class WarehouseTempService {
@Resource @Resource
private CodesTempDao codesTempDao; private CodesTempDao codesTempDao;
@Resource
private OrderDao orderDao;
public IPage<WarehousetempEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) { public IPage<WarehousetempEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) {
QueryWrapper<WarehousetempEntity> wrapper = buildCodesTempQueryWrapper(warehouseQueryRequest); QueryWrapper<WarehousetempEntity> wrapper = buildCodesTempQueryWrapper(warehouseQueryRequest);
@ -82,4 +88,30 @@ public class WarehouseTempService {
public void deleteCodes(List<Long> ids) { public void deleteCodes(List<Long> ids) {
codesTempDao.deleteBatchIds(ids); codesTempDao.deleteBatchIds(ids);
} }
/**
*
*
* @param id
*/
public BaseResponse deleteCodesTempById(String id) {
WarehousetempEntity warehousetemp = findTempById(id);
if (null == warehousetemp) {
return com.glxp.udi.common.util.ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
if (warehousetemp.getCount() != null && warehousetemp.getCount() > 1) {
warehousetemp.setCount(warehousetemp.getCount() - 1);
updateById(warehousetemp);
} else {
deleteTempWarehouses(Collections.singletonList(id));
}
//判断此单据是否还存在条码,如果不存在,则直接删除此单据
int count = codesTempDao.countByOrderId(warehousetemp.getOrderId());
if (count == 0) {
orderDao.deleteById(warehousetemp.getOrderId());
}
return com.glxp.udi.common.util.ResultVOUtils.success();
}
} }

@ -30,4 +30,8 @@
<update id="updateActDateByOrderId"> <update id="updateActDateByOrderId">
update io_codes_temp set actDate = #{actDate} where orderId = #{orderId} update io_codes_temp set actDate = #{actDate} where orderId = #{orderId}
</update> </update>
<select id="countByOrderId" resultType="int">
select count(*) from io_codes_temp where orderId = #{orderId}
</select>
</mapper> </mapper>

@ -7,4 +7,28 @@
from io_order_detail from io_order_detail
where orderIdFk = #{orderId} where orderIdFk = #{orderId}
</delete> </delete>
<update id="update">
update io_order_detail
set orderIdFk = #{orderIdFk},
relId = #{relId},
uuidFk = #{uuidFk},
nameCode = #{nameCode},
batchNo = #{batchNo},
productName = #{productName},
productCompany = #{productCompany},
produceDate = #{produceDate},
expireDate = #{expireDate},
zczbhhzbapzbh = #{zczbhhzbapzbh},
ggxh = #{ggxh},
packRatio = #{packRatio},
reCount = #{reCount},
count = #{count},
price = #{price},
firstSalesInvNo = #{firstSalesInvNo},
secSalesInvNo = #{secSalesInvNo},
secSalesListNo = #{secSalesListNo},
invoiceDate = #{invoiceDate}
where id = #{id}
</update>
</mapper> </mapper>
Loading…
Cancel
Save