|
@@ -0,0 +1,45 @@
|
|
|
+package com.rongwei.bscommon.system.service.impl;
|
|
|
+
|
|
|
+import com.rongwei.bscommon.system.service.DrugService;
|
|
|
+import com.rongwei.bsentity.domain.QhseDrugManageDetailDo;
|
|
|
+import com.rongwei.bsentity.domain.QhseDrugManageUseDetailDo;
|
|
|
+import com.rongwei.rwcommon.base.R;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * DrugServiceImpl class
|
|
|
+ *
|
|
|
+ * @author XH
|
|
|
+ * @date 2025/09/17
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class DrugServiceImpl implements DrugService {
|
|
|
+ @Autowired
|
|
|
+ private QhseDrugManageDetailServiceImpl qhseDrugManageDetailService;
|
|
|
+ @Autowired
|
|
|
+ private QhseDrugManageServiceImpl qhseDrugManageService;
|
|
|
+ /**
|
|
|
+ * 库存数量更新
|
|
|
+ *
|
|
|
+ * @param dis
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public R inventoryQuantityUpdate(List<String> ids) {
|
|
|
+ List<QhseDrugManageDetailDo> qhseDrugManageUseDetailDos = qhseDrugManageDetailService.getBaseMapper().selectBatchIds(ids);
|
|
|
+
|
|
|
+ if(qhseDrugManageUseDetailDos.isEmpty()){
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ List<String> drugIds = qhseDrugManageUseDetailDos.stream().map(QhseDrugManageDetailDo::getDrugmanageid).collect(Collectors.toList());
|
|
|
+ // 库存数量更新
|
|
|
+ qhseDrugManageService.getBaseMapper().updateTotalPriceAndNum(drugIds);
|
|
|
+ // 更新预警状态
|
|
|
+ qhseDrugManageDetailService.getBaseMapper().updateWarningState(ids);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+}
|