|
|
@@ -4,10 +4,12 @@ import com.chinaitop.depot.business.mapper.BusinessDrugStandingBookMapper;
|
|
4
|
4
|
import com.chinaitop.depot.business.model.*;
|
|
5
|
5
|
import com.chinaitop.depot.business.service.BusinessDrugStandingBookService;
|
|
6
|
6
|
import com.github.pagehelper.PageHelper;
|
|
|
7
|
+import org.apache.commons.lang.StringUtils;
|
|
7
|
8
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
8
|
9
|
import org.springframework.stereotype.Service;
|
|
9
|
10
|
|
|
10
|
11
|
import javax.servlet.http.HttpServletRequest;
|
|
|
12
|
+import java.lang.reflect.Field;
|
|
11
|
13
|
import java.util.Date;
|
|
12
|
14
|
import java.util.List;
|
|
13
|
15
|
import java.util.Map;
|
|
|
@@ -447,5 +449,46 @@ public class BusinessDrugStandingBookServiceImpl implements BusinessDrugStanding
|
|
447
|
449
|
|
|
448
|
450
|
}
|
|
449
|
451
|
|
|
|
452
|
+ /**
|
|
|
453
|
+ * 获取台账剩余存数量.
|
|
|
454
|
+ *
|
|
|
455
|
+ * @param drugStandingBook
|
|
|
456
|
+ * @return
|
|
|
457
|
+ */
|
|
|
458
|
+ @Override
|
|
|
459
|
+ public Integer getRemainingQuantity(BusinessDrugStandingBook drugStandingBook) {
|
|
|
460
|
+ BusinessDrugStandingBookExample example = getExapleObject(drugStandingBook);
|
|
|
461
|
+ List<BusinessDrugStandingBook> businessDrugStandingBooks = drugStandingBookMapper.selectByExample(example);
|
|
|
462
|
+ if (businessDrugStandingBooks.size() > 0)
|
|
|
463
|
+ return businessDrugStandingBooks.get(0).getAmount(); // 台账剩余存数量
|
|
|
464
|
+ return 0;
|
|
|
465
|
+ }
|
|
|
466
|
+
|
|
|
467
|
+ // 查询条件
|
|
|
468
|
+ private synchronized BusinessDrugStandingBookExample getExapleObject(BusinessDrugStandingBook drugStandingBook) {
|
|
|
469
|
+ BusinessDrugStandingBookExample example = new BusinessDrugStandingBookExample();
|
|
|
470
|
+ if (drugStandingBook != null) {
|
|
|
471
|
+ BusinessDrugStandingBookExample.Criteria createCriteria = example.createCriteria();
|
|
|
472
|
+ // 查询条件
|
|
|
473
|
+ createCriteria.andIsLastShelfDataEqualTo(1); // 是否是最后的货架号盘点数据
|
|
|
474
|
+ Integer orgId = drugStandingBook.getOrgId();
|
|
|
475
|
+ if (null != orgId)
|
|
|
476
|
+ createCriteria.andOrgIdEqualTo(orgId); // 组织编码
|
|
|
477
|
+ Integer drugName = drugStandingBook.getDrugName();
|
|
|
478
|
+ if (null != drugName)
|
|
|
479
|
+ createCriteria.andDrugNameEqualTo(drugName); // 药剂名称 drug_name
|
|
|
480
|
+ Integer drugType = drugStandingBook.getDrugType();
|
|
|
481
|
+ if (null != drugType)
|
|
|
482
|
+ createCriteria.andDrugTypeEqualTo(drugType); // 药剂形态 drug_type
|
|
|
483
|
+ Integer drugKind = drugStandingBook.getDrugKind();
|
|
|
484
|
+ if (null != drugKind)
|
|
|
485
|
+ createCriteria.andDrugKindEqualTo(drugKind); // 药剂类型 drug_kind
|
|
|
486
|
+ String manufacturer = drugStandingBook.getManufacturer();
|
|
|
487
|
+ if (StringUtils.isNotBlank(manufacturer))
|
|
|
488
|
+ createCriteria.andManufacturerEqualTo(manufacturer); // 生产厂家 manufacturer
|
|
|
489
|
+ }
|
|
|
490
|
+ return example;
|
|
|
491
|
+ }
|
|
|
492
|
+
|
|
450
|
493
|
|
|
451
|
494
|
}
|