From 6664ba895c7b2b5837f53cea44692610848ff60c Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期四, 23 十月 2025 16:53:31 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java
index 3d3cd00..4a15e18 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java
@@ -22,6 +22,7 @@
 import com.ruoyi.system.dto.*;
 import com.ruoyi.system.importExcel.TErpGoodsExcel;
 import com.ruoyi.system.model.*;
+import com.ruoyi.system.query.PageAddListQuery;
 import com.ruoyi.system.query.TErpGoodsAdminQuery;
 import com.ruoyi.system.query.TErpGoodsQuery;
 import com.ruoyi.system.service.*;
@@ -140,7 +141,7 @@
      */
     @ApiOperation(value = "诊所 一键获取商品分页列表")
     @PostMapping(value = "/pageAddList")
-    public R<Page<TErpGoods>> pageAddList(@RequestBody BasePage query) {
+    public R<Page<TErpGoods>> pageAddList(@RequestBody PageAddListQuery query) {
         SysUser user = tokenService.getLoginUser().getUser();
         Integer roleType = user.getRoleType();
         String clinicSupplierId=null;
@@ -153,17 +154,9 @@
         }
         Page<TErpGoods> tErpGoodsPage = new Page<>(query.getPageNum(), query.getPageSize());
 
-        Page<TErpGoods> page = erpGoodsService.page(tErpGoodsPage, new LambdaQueryWrapper<TErpGoods>().eq(TErpGoods::getGoodsSource, 1).eq(TErpGoods::getState,1).eq(BaseModel::getDisabled, 0).isNotNull(TErpGoods::getPlatformCommissionPrice).last("and (NOT FIND_IN_SET(" + clinicSupplierId + ",clinic_ids) or  clinic_ids is null)"));
-        for (TErpGoods record : page.getRecords()) {
-            TCrmSupplier byId = crmSupplierService.getById(record.getSupplierClinicId());
-            record.setSupplierName(byId.getSupplierName());
-
-
-            TErpGoodsType byId1 = erpGoodsTypeService.getById(record.getTypeId());
-            record.setTypeName(byId1.getTypeName());
-
-        }
-        return R.ok(page);
+        List<TErpGoods> page = erpGoodsService.pageAddList(tErpGoodsPage,clinicSupplierId,query);
+        tErpGoodsPage.setRecords(page);
+        return R.ok(tErpGoodsPage);
     }
 
     /**
@@ -246,11 +239,15 @@
     public R<Boolean> clinicAdd(@Validated @RequestBody TErpClinicGoodsAddDto dto) {
         SysUser user = tokenService.getLoginUser().getUser();
         if (erpGoodsService.isExit(dto.getGoodsIdCode(), dto.getQuasiNumber(),null)) {
-            return R.fail("erp商品已存在");
+            return R.fail("erp商品已存在,商品条码重复");
+        }
+        if (erpGoodsService.isExitOne(dto.getGoodsIdCode(), dto.getQuasiNumber(),null)) {
+            return R.fail("erp商品已存在,国药准字号重复");
         }
         Integer roleType = user.getRoleType();
         TErpGoods goods = new TErpGoods();
         BeanUtils.copyProperties(dto,goods);
+        goods.setGoodsSpec(dto.getFormulationSpec()+"*"+dto.getPackingSpec());
         if(roleType == 5){
             // 诊所
             TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
@@ -261,7 +258,7 @@
         }
         goods.setCreateId(user.getUserId().toString());
         goods.setGoodsIdCode(dto.getGoodsIdCode());
-        goods.setClinicPurchasePrice(dto.getSalesAmount());
+//        goods.setClinicPurchasePrice(dto.getSalesAmount());
         return R.ok(erpGoodsService.save(goods));
     }
 
@@ -286,6 +283,7 @@
         goods.setCreateId(user.getUserId().toString());
         goods.setGoodsIdCode(dto.getGoodsIdCode());
         goods.setId(dto.getId());
+        goods.setGoodsSpec(dto.getFormulationSpec()+"*"+dto.getPackingSpec());
         return R.ok(erpGoodsService.updateById(goods));
     }
 

--
Gitblit v1.7.1