|
|
@@ -95,6 +95,10 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
url : "/order",
|
|
|
templateUrl : "static/tpl/index/purc/order.html",
|
|
|
controller: 'PurcOrderCtrl'
|
|
|
+ }).state('purc.order_detail', {
|
|
|
+ url : "/order/:id",
|
|
|
+ templateUrl : "static/tpl/index/purc/order_detail.html",
|
|
|
+ controller: 'PurcOrderDetailCtrl'
|
|
|
}).state('sale.todo', {
|
|
|
url : "/todo",
|
|
|
templateUrl : "static/tpl/index/sale/todo.html"
|
|
|
@@ -1217,8 +1221,96 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
$scope.tableParams.page(1);
|
|
|
$scope.tableParams.reload();
|
|
|
};
|
|
|
- }]);
|
|
|
+ }]);
|
|
|
+
|
|
|
+ app.controller('PurcOrderDetailCtrl', ['$scope', '$stateParams', 'PurcOrder', 'PurcOrderItem', 'toaster', 'ReportService', function($scope, $stateParams, PurcOrder, PurcOrderItem, toaster, ReportService){
|
|
|
+ var loadData = function() {
|
|
|
+ PurcOrder.get({id: $stateParams.id}, function(data){
|
|
|
+ $scope.order = data;
|
|
|
+ var sum = 0;
|
|
|
+ angular.forEach($scope.order.orderItems, function(item){
|
|
|
+ sum += item.qty * item.price;
|
|
|
+ });
|
|
|
+ $scope.order.total = sum;
|
|
|
+ if($scope.order.display == 1) {//未查看的设为已查看
|
|
|
+ $scope.setDisplay('setRead', $scope.order.id);
|
|
|
+ }
|
|
|
+ $scope.loading = false;
|
|
|
+ });
|
|
|
+ };
|
|
|
+ loadData();
|
|
|
+ $scope.getReply = function(item) {
|
|
|
+ if(!item.replies) {
|
|
|
+ PurcOrderItem.getReply({orderItemId: item.id}, function(replies){
|
|
|
+ item.replies = replies;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $scope.openDatePicker = function($event, item, openParam) {
|
|
|
+ $event.preventDefault();
|
|
|
+ $event.stopPropagation();
|
|
|
+ item[openParam] = !item[openParam];
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.onReplyClick = function(item, inverse) {
|
|
|
+ if(item.reply) {
|
|
|
+ if(!item.reply.qty || item.reply.qty < 0 || item.reply.qty > item.qty) {
|
|
|
+ toaster.pop('warning', '提示', '请填写有效的回复数量!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var reply = angular.copy(item.reply);
|
|
|
+ if(reply.delivery) {
|
|
|
+ if(typeof reply.delivery == 'object')
|
|
|
+ reply.delivery = reply.delivery.getTime();
|
|
|
+ } else {
|
|
|
+ reply.delivery = item.delivery;
|
|
|
+ }
|
|
|
+ if(inverse && inverse == -1) reply.qty = -1 * reply.qty;// 取相反
|
|
|
+ $scope.loading = true;
|
|
|
+ PurcOrderItem.reply({orderItemId: item.id}, reply, function(){
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('info', '提示', (inverse == -1 ? '撤销成功':'回复成功'));
|
|
|
+ loadData();
|
|
|
+ }, function(response){
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '回复失败', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
+ // 采购单
|
|
|
+ $scope.print = function(order) {
|
|
|
+ PurcOrder.printCount({id: order.id},{});//增加打印此次
|
|
|
+ ReportService.print(order.enUU, 'PURCLIST', "where purc$orders.pu_id=" + order.id);
|
|
|
+ };
|
|
|
+
|
|
|
+ //设置为已查看
|
|
|
+ $scope.setDisplay = function(state, orderId) {
|
|
|
+ if(orderId) {//设置单个
|
|
|
+ PurcOrder[state].call({}, {ids: '' + orderId}, function(){
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function() {
|
|
|
+ toaster.pop('error', '错误', "设置失败");
|
|
|
+ });
|
|
|
+ } else {//设置已勾选的
|
|
|
+ var str = null;
|
|
|
+ angular.forEach($scope.tableParams.data, function(order) {
|
|
|
+ if(order.$selected == true) {
|
|
|
+ if(str != null && str != '') str += ',';
|
|
|
+ str += order.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(str != null && str != '') {
|
|
|
+ PurcOrder[state].call({}, {ids: '' + str}, function(){
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function() {
|
|
|
+ toaster.pop('error', '错误', "设置失败");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }]);
|
|
|
+
|
|
|
app.controller('SaleOrderCtrl', ['$scope', '$filter', 'PurcOrderItem', 'PurcOrder', 'ngTableParams', 'toaster', 'ReportService', 'BaseService', 'PurcOrderItemHis',
|
|
|
function($scope, $filter, PurcOrderItem, PurcOrder, ngTableParams, toaster, ReportService, BaseService, PurcOrderItemHis){
|
|
|
$scope.active = 'todo';
|
|
|
@@ -1493,8 +1585,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
// 采购单
|
|
|
$scope.print = function(order) {
|
|
|
PurcOrder.printCount({id: order.id},{});//增加打印此次
|
|
|
- console.log("------");
|
|
|
- console.log(order);
|
|
|
ReportService.print(order.enUU, 'PURCLIST', "where purc$orders.pu_id=" + order.id);
|
|
|
};
|
|
|
|
|
|
@@ -5535,6 +5625,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
|
|
|
$scope.print = function(order) {
|
|
|
MakeOrder.printCount({id: order.id},{});//增加打印此次
|
|
|
ReportService.print(order.enUU, 'MAKE', 'where make$orders.ma_id=' + order.id);
|
|
|
+
|
|
|
};
|
|
|
|
|
|
// 获取回复记录
|