|
|
@@ -21,30 +21,80 @@ angular.module('app.storage').controller("drugDestroySaveCtrl", function ($scope
|
|
21
|
21
|
} else {
|
|
22
|
22
|
$scope.drugDestroy.destroyDate = $filter('date')(new Date(), "yyyy-MM-dd HH:mm:ss");
|
|
23
|
23
|
}
|
|
|
24
|
+
|
|
|
25
|
+ $scope.pageInfo = {pageNum: 1, pageSize: 10};
|
|
|
26
|
+ $scope.searchCondition = {drugKind: "", drugName: "",destroyType:""};//搜索条件
|
|
|
27
|
+
|
|
|
28
|
+ $scope.getDrugInfoList = function(){
|
|
|
29
|
+
|
|
|
30
|
+ var params = [];
|
|
|
31
|
+ params.destroyType = $scope.drugDestroy.destroyType;
|
|
|
32
|
+
|
|
|
33
|
+
|
|
|
34
|
+ var modalInstance = $uibModal.open({
|
|
|
35
|
+ size: 'lg',
|
|
|
36
|
+ templateUrl: 'app/business/util/views/drugStandingBook-list-modal.html',
|
|
|
37
|
+ controller: 'drugStandingBookListModalCtrl',
|
|
|
38
|
+ resolve: {
|
|
|
39
|
+ // items是一个回调函数
|
|
|
40
|
+ items: function () {
|
|
|
41
|
+ // 这个值会被模态框的控制器获取到
|
|
|
42
|
+ return params;
|
|
|
43
|
+ }
|
|
|
44
|
+
|
|
|
45
|
+ }
|
|
|
46
|
+ });
|
|
|
47
|
+
|
|
|
48
|
+ modalInstance.result.then(function (result) {
|
|
|
49
|
+ if (result != undefined && result != null) {
|
|
|
50
|
+ $scope.drugDestroy.drugNumber = result.drugNumber;
|
|
|
51
|
+ $scope.drugDestroy.drugKind = result.drugKind;
|
|
|
52
|
+ $scope.drugDestroy.drugName = result.drugName;
|
|
|
53
|
+ $scope.drugDestroy.drugType = result.drugType;
|
|
|
54
|
+ $scope.drugDestroy.drugPacking = result.drugPacking;
|
|
|
55
|
+ $scope.drugDestroy.drugSpecification = result.drugSpecification;
|
|
|
56
|
+ $scope.drugDestroy.drugUnit = result.drugSpecificationUnit;
|
|
|
57
|
+ $scope.drugDestroy.drugInfoId = result.depotId; // depotId 借用为药剂信息id
|
|
|
58
|
+ //$scope.drugDestroy.controlMan = $rootScope.userInfo.realName;
|
|
|
59
|
+ $scope.drugDestroy.destroyAmount = result.amount; // 库存数量
|
|
|
60
|
+ $scope.drugDestroy.manufacturer = result.manufacturer;
|
|
|
61
|
+
|
|
|
62
|
+ if($scope.drugDestroy.destroyType == "1"){
|
|
|
63
|
+ $scope.drugDestroy.destroyTotalNumber = commonUtilService.accMul($scope.drugDestroy.destroyAmount, $scope.drugDestroy.drugSpecification);
|
|
|
64
|
+
|
|
|
65
|
+ }else if($scope.drugDestroy.destroyType == "2"){
|
|
|
66
|
+ $scope.drugDestroy.destroyTotalNumber = 0;
|
|
|
67
|
+ }
|
|
|
68
|
+
|
|
|
69
|
+
|
|
|
70
|
+ // 用于数量效验
|
|
|
71
|
+ $scope.storageCount_v = result.applyAmount; // 库存数量
|
|
|
72
|
+ }
|
|
|
73
|
+ }, function (reason) {
|
|
|
74
|
+ console.log(reason);
|
|
|
75
|
+ });
|
|
|
76
|
+
|
|
|
77
|
+ };
|
|
24
|
78
|
|
|
25
|
79
|
// 销毁数量效验
|
|
26
|
80
|
$scope.checkNumber = function (destroyAmount) {
|
|
27
|
|
- // 只能在其他数据录入之后在匹配效验销毁数量,并且为: 药剂销毁
|
|
28
|
|
- if ('药剂销毁' === $scope.drugDestroy.destroyType) {
|
|
29
|
|
- if ($scope.isNotNll($scope.drugDestroy.drugKind)) // 药剂种类
|
|
30
|
|
- alert('药剂种类为空,无法效验库存.');
|
|
31
|
|
- else if ($scope.isNotNll($scope.drugDestroy.drugName)) // 药剂名称
|
|
32
|
|
- alert('药剂名称为空,无法效验库存.');
|
|
33
|
|
- else if ($scope.isNotNll($scope.drugDestroy.drugType)) // 药剂形态
|
|
34
|
|
- alert('药剂形态为空,无法效验库存.');
|
|
35
|
|
- else if ($scope.isNotNll($scope.drugDestroy.manufacturer)) // 生产厂家
|
|
36
|
|
- alert('生产厂家为空,无法效验库存.');
|
|
37
|
|
- else {
|
|
38
|
|
- drugStandingBookService.getRemainingQuantity($scope.drugDestroy).then(function (data) {
|
|
39
|
|
- if (data < destroyAmount) {
|
|
40
|
|
- alert('销毁数量不能大于库存数量.');
|
|
41
|
|
- $scope.drugDestroy.destroyAmount = null;
|
|
42
|
|
- }
|
|
43
|
|
- }, function (data) {
|
|
44
|
|
- });
|
|
|
81
|
+ //: 药剂销毁
|
|
|
82
|
+ if($scope.drugDestroy.destroyType == "1"){
|
|
|
83
|
+ drugStandingBookService.getRemainingQuantity($scope.drugDestroy).then(function (data) {
|
|
|
84
|
+ if (data < destroyAmount) {
|
|
|
85
|
+ alert('销毁数量不能大于库存数量.');
|
|
|
86
|
+ $scope.drugDestroy.destroyAmount = null;
|
|
|
87
|
+ $scope.drugDestroy.destroyTotalNumber = null;
|
|
|
88
|
+ }else{
|
|
|
89
|
+ $scope.drugDestroy.destroyTotalNumber = commonUtilService.accMul($scope.drugDestroy.destroyAmount, $scope.drugDestroy.drugSpecification);
|
|
|
90
|
+ }
|
|
|
91
|
+ }, function (data) {
|
|
|
92
|
+ });
|
|
|
93
|
+ }else if($scope.drugDestroy.destroyType == "2"){
|
|
|
94
|
+ $scope.drugDestroy.destroyTotalNumber = 0;
|
|
45
|
95
|
|
|
46
|
|
- }
|
|
47
|
|
- }
|
|
|
96
|
+ }
|
|
|
97
|
+
|
|
48
|
98
|
};
|
|
49
|
99
|
|
|
50
|
100
|
// 非空判断通用方法
|
|
|
@@ -64,7 +114,7 @@ angular.module('app.storage').controller("drugDestroySaveCtrl", function ($scope
|
|
64
|
114
|
}, "请输入正确的不为0的数字整数!");
|
|
65
|
115
|
|
|
66
|
116
|
$.validator.addMethod("validNumberD",function(value,element, params) {
|
|
67
|
|
- var checkNumber = /^\d*\.{0,1}\d{1,2}$/g;
|
|
|
117
|
+ var checkNumber = /^([1-9]\d*|0)(\.\d{1,2})?$/g;
|
|
68
|
118
|
return this.optional(element)||(checkNumber.test(value));
|
|
69
|
119
|
},"请输入正确的数字类型,最多两位小数!");
|
|
70
|
120
|
|
|
|
@@ -101,12 +151,12 @@ angular.module('app.storage').controller("drugDestroySaveCtrl", function ($scope
|
|
101
|
151
|
};
|
|
102
|
152
|
|
|
103
|
153
|
// 获取药剂生产厂家
|
|
104
|
|
- $scope.getManufacturerData = function () {
|
|
|
154
|
+ /* $scope.getManufacturerData = function () {
|
|
105
|
155
|
drugStorageService.getManufacturer().then(function (data) {
|
|
106
|
156
|
$scope.drugManufacturerList = data;
|
|
107
|
157
|
}, function (data) {
|
|
108
|
158
|
});
|
|
109
|
159
|
};
|
|
110
|
|
- $scope.getManufacturerData();
|
|
|
160
|
+ $scope.getManufacturerData();*/
|
|
111
|
161
|
|
|
112
|
162
|
});
|