diff --git a/src/main/java/com/qs/serve/modules/goods/service/impl/GoodsCustomerPriceServiceImpl.java b/src/main/java/com/qs/serve/modules/goods/service/impl/GoodsCustomerPriceServiceImpl.java index f74e1847..b1b88ed3 100644 --- a/src/main/java/com/qs/serve/modules/goods/service/impl/GoodsCustomerPriceServiceImpl.java +++ b/src/main/java/com/qs/serve/modules/goods/service/impl/GoodsCustomerPriceServiceImpl.java @@ -12,6 +12,7 @@ import com.qs.serve.modules.goods.entity.GoodsSku; import com.qs.serve.modules.goods.entity.bo.GoodsCustomerPriceBo; import com.qs.serve.modules.goods.entity.bo.GoodsCustomerPriceSingleBo; import com.qs.serve.modules.goods.entity.dto.InventoryCusPrice; +import com.qs.serve.modules.goods.entity.so.InventoryCusPriceQuery; import com.qs.serve.modules.goods.mapper.GoodsSkuMapper; import com.qs.serve.modules.seeyon.service.SeeYonRequestService; import com.qs.serve.modules.seeyon.service.impl.SeeYonRequestBaseService; @@ -27,9 +28,11 @@ import com.qs.serve.modules.goods.entity.GoodsCustomerPrice; import com.qs.serve.modules.goods.service.GoodsCustomerPriceService; import com.qs.serve.modules.goods.mapper.GoodsCustomerPriceMapper; +import java.time.LocalDate; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -161,24 +164,47 @@ public class GoodsCustomerPriceServiceImpl extends ServiceImpl cusPriceList = new ArrayList<>(); + List allCusPriceList = new ArrayList<>(); R res = seeYonRequestBaseService.postBase(TbsSeeYonConst.ERP_CUS_INV_LAST_UPD+"/"+maxId,null,"查询最近更新的客户特殊价"); if(res.getStatus().equals(200)){ - cusPriceList = JsonUtil.jsonToList(res.getData(), InventoryCusPrice.class); + allCusPriceList = JsonUtil.jsonToList(res.getData(), InventoryCusPrice.class); } - assert cusPriceList != null; - for (InventoryCusPrice cusPrice : cusPriceList) { - if(maxId==null || cusPrice.getRowId() > maxId){ - maxId = cusPrice.getRowId(); + assert allCusPriceList != null; + long times = System.currentTimeMillis(); + + Map> cusPriceMap = allCusPriceList.stream().collect(Collectors.groupingBy(InventoryCusPrice::getCusCode)); + for (String cusCode : cusPriceMap.keySet()) { + List cusPriceList = cusPriceMap.get(cusCode); + List skuCodes = cusPriceList.stream().map(InventoryCusPrice::getInvCode).collect(Collectors.toList()); + List goodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper().in(GoodsSku::getSkuCode,skuCodes)); + List goodsCustomerPriceList = new ArrayList<>(); + + InventoryCusPriceQuery query = new InventoryCusPriceQuery(); + query.setCusCode(cusCode); + query.setInvCodes(skuCodes); + R erpRs = seeYonRequestBaseService.postBase(TbsSeeYonConst.ERP_CUS_INV_PRICE,query,"查询客户特殊价"); + List erpCusPriceList = new ArrayList<>(); + if(erpRs.getStatus().equals(200)){ + erpCusPriceList = JsonUtil.jsonToList(erpRs.getData(), InventoryCusPrice.class); } - GoodsCustomerPrice customerPrice = this.getByCusCodeAndSkuCode(cusPrice.getCusCode(),cusPrice.getInvCode()); - if(customerPrice==null){ - GoodsSku goodsSku = goodsSkuMapper.selectBySkuCode(cusPrice.getInvCode()); - BmsSupplier supplier = bmsSupplierMapper.selectOne(new LambdaQueryWrapper() - .eq(BmsSupplier::getCode,cusPrice.getCusCode())); - customerPrice = new GoodsCustomerPrice(); + + BmsSupplier supplier = bmsSupplierMapper.selectOne(new LambdaQueryWrapper() + .eq(BmsSupplier::getCode,cusCode)); + + for (InventoryCusPrice cusPrice : erpCusPriceList) { + GoodsSku goodsSku = null; + for (GoodsSku skuItem : goodsSkus) { + if(skuItem.getSkuCode().equals(cusPrice.getInvCode())){ + goodsSku = skuItem; + } + } + //跳过无效商品 + if(goodsSku==null){ + continue; + } + GoodsCustomerPrice customerPrice = new GoodsCustomerPrice(); customerPrice.setSupplierId(supplier.getId()); customerPrice.setSupplierCode(supplier.getCode()); customerPrice.setSupplierName(supplier.getName()); @@ -188,10 +214,21 @@ public class GoodsCustomerPriceServiceImpl extends ServiceImpl0){ + //移除旧历史 + this.remove(new LambdaQueryWrapper() + .eq(GoodsCustomerPrice::getSupplierCode,cusCode) + .in(GoodsCustomerPrice::getSkuCode,goodsSkus) + ); + this.saveBatch(goodsCustomerPriceList); + } + } + + for (InventoryCusPrice cusPrice : allCusPriceList) { + if(maxId==null || cusPrice.getRowId() > maxId){ + maxId = cusPrice.getRowId(); } } if(maxId!=0){ diff --git a/src/main/java/com/qs/serve/modules/oms/service/impl/OmsOrderPart1ServiceImpl.java b/src/main/java/com/qs/serve/modules/oms/service/impl/OmsOrderPart1ServiceImpl.java index 0fefd819..a4495691 100644 --- a/src/main/java/com/qs/serve/modules/oms/service/impl/OmsOrderPart1ServiceImpl.java +++ b/src/main/java/com/qs/serve/modules/oms/service/impl/OmsOrderPart1ServiceImpl.java @@ -140,6 +140,9 @@ public class OmsOrderPart1ServiceImpl implements OmsOrderPart1Service { if(batch.getEndDate().isBefore(nowDate)){ errorImminentIds.add(new SimpleKeyValue("临期品已过期",batch.getId())); } + if(batch.getQuantity()-batch.getOrderQuantity()<=0){ + errorImminentIds.add(new SimpleKeyValue("临期品库存不足",batch.getId())); + } } } diff --git a/src/main/java/com/qs/serve/modules/tbs/entity/vo/TbsBudgetVo.java b/src/main/java/com/qs/serve/modules/tbs/entity/vo/TbsBudgetVo.java index 5eeffa35..dd11da10 100644 --- a/src/main/java/com/qs/serve/modules/tbs/entity/vo/TbsBudgetVo.java +++ b/src/main/java/com/qs/serve/modules/tbs/entity/vo/TbsBudgetVo.java @@ -52,6 +52,9 @@ public class TbsBudgetVo implements Serializable { /** 是否允许跨年,控制停用状态 */ private Integer crossYearFlag; + /** 不活动的 0/1 用于随意关停预算 */ + private Integer inactiveFlag; + /** 科目id */ @NotNull(message = "科目id不能为空") private Long subjectId; diff --git a/src/main/resources/mapper/goods/GoodsCustomerPriceMapper.xml b/src/main/resources/mapper/goods/GoodsCustomerPriceMapper.xml index e9ec065c..22784007 100644 --- a/src/main/resources/mapper/goods/GoodsCustomerPriceMapper.xml +++ b/src/main/resources/mapper/goods/GoodsCustomerPriceMapper.xml @@ -52,16 +52,16 @@ and `goods_customer_price`.`del_flag` = 0 and `goods_customer_price`.`id` = #{query.id} and `goods_customer_price`.`supplier_id` = #{query.supplierId} - and `goods_customer_price`.`supplier_code` = #{query.supplierCode} - and `goods_customer_price`.`supplier_name` = #{query.supplierName} - and `goods_customer_price`.`sku_code` = #{query.skuCode} + and `goods_customer_price`.`supplier_code` like concat('%',#{query.supplierCode},'%') + and `goods_customer_price`.`supplier_name` like concat('%',#{query.supplierName},'%') + and `goods_customer_price`.`sku_code` like concat('%',#{query.skuCode},'%') and `goods_customer_price`.`sku_id` = #{query.skuId} - and `goods_customer_price`.`sku_name` = #{query.skuName} + and `goods_customer_price`.`sku_name` like concat('%',#{query.skuName},'%') and `goods_customer_price`.`sku_unit` = #{query.skuUnit} and `goods_customer_price`.`init_price` = #{query.initPrice} and `goods_customer_price`.`real_price` = #{query.realPrice} - and `goods_customer_price`.`maker` = #{query.maker} - and `goods_customer_price`.`maker_code` = #{query.makerCode} + and `goods_customer_price`.`maker` like concat('%',#{query.maker},'%') + and `goods_customer_price`.`maker_code` like concat('%',#{query.makerCode},'%') and `goods_customer_price`.`mark_time` = #{query.markTime} and `goods_customer_price`.`create_time` = #{query.createTime} and `goods_customer_price`.`create_by` = #{query.createBy}