예제 #1
0
    public function mailByHand($receive_id)
    {
        // 返回值数组
        $result = array('success' => true, 'info' => '编辑成功');
        $now = date('Y-m-d H:i:s');
        $user_session = new Zend_Session_Namespace('user');
        $user_id = $user_session->user_info['user_id'];
        $receive = new Erp_Model_Stock_receive();
        $items = new Erp_Model_Purchse_Receiveitems();
        $itemsorder = new Erp_Model_Purchse_Receiveitemsorder();
        $receive_items_order = new Erp_Model_Purchse_Receiveitemsorder();
        $order = new Erp_Model_Purchse_Order();
        $receiveData = $receive->getData(null, $receive_id);
        $itemsData = $items->getData($receive_id);
        $orderNumArr = array();
        foreach ($itemsData as $item) {
            $numbers = explode(',', $item['items_order_number']);
            foreach ($numbers as $number) {
                if (!in_array($number, $orderNumArr)) {
                    array_push($orderNumArr, $number);
                }
            }
        }
        // 订单关联人员(申请人、审核人)
        $relatedUserInfo = count($orderNumArr) > 0 ? $receive_items_order->getReqRelatedUsers($orderNumArr) : array();
        // 到货通知
        $member = new Admin_Model_Member();
        $warehouse = new Erp_Model_Warehouse_Warehouse();
        $noticeTo = $member->getMemberWithManagerByName('采购到货通知');
        $noticeMails = array();
        $noticeUsers = array();
        foreach ($noticeTo as $n) {
            if ($n['email'] != '' && !in_array($n['user_id'], $noticeUsers)) {
                array_push($noticeMails, $n['email']);
                array_push($noticeUsers, $n['user_id']);
            }
        }
        foreach ($relatedUserInfo as $n) {
            if ($n['email'] != '' && !in_array($n['user_id'], $noticeUsers)) {
                array_push($noticeMails, $n['email']);
                array_push($noticeUsers, $n['user_id']);
            }
        }
        $mail = new Application_Model_Log_Mail();
        $supplierArr = array();
        $supplierIdArr = array();
        $i = 0;
        $itemsTable = '<style type="text/css">
table.gridtable {
	font-family: verdana,arial,sans-serif;
	font-size:11px;
	color:#333333;
	border-width: 1px;
	border-color: #666666;
	border-collapse: collapse;
}
table.gridtable th {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #dedede;
}
table.gridtable td {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #ffffff;
}
</style><table class="gridtable"><tr>
                                <th>#</th>
                                <th>供应商</th>
                                <th>采购订单</th>
                                <th>物料号</th>
                                <th>物料名称</th>
                                <th>物料描述</th>
                                <th>收货数量</th>
                                <th>单位</th>
                                <th>收货仓库</th>
                                <th>备注</th>
                                <th>备注</th>
                                <th>申请信息</th>
                                </tr>';
        foreach ($itemsData as $val) {
            $itemInfo = '';
            if ($val['items_order_number']) {
                $itemInfoData = $order->getItemDetails($val['items_order_number'], $val['items_code']);
                $itemInfo = '<table class="gridtable"><tr>
							<th>申请单号</th>
							<th>申请日期</th>
							<th>申请数量</th>
							<th>下单数量</th>
							<th>订单数量</th>
                            <th>客户收件人地址简码</th>
                            <th>客户合同号</th>
							</tr>';
                foreach ($itemInfoData as $d) {
                    $itemInfo .= '<tr>
							      <td>' . $d['req_number'] . '</td>
							      <td>' . $d['req_item_date'] . '</td>
							      <td>' . $d['req_item_qty'] . '</td>
							      <td>' . $d['order_req_item_qty'] . '</td>
							      <td>' . $d['order_item_qty'] . '</td>
							      <td>' . $d['customer_address'] . '</td>
							      <td>' . $d['customer_aggrement'] . '</td>
							      </tr>';
                }
                $itemInfo .= '</table>';
            }
            $i++;
            $numberArr = explode(',', $val['items_order_number']);
            foreach ($numberArr as $n) {
                $supplierData = $order->getSupplierByNumber($n);
                if (isset($supplierData['id']) && !in_array($supplierData['id'], $supplierIdArr)) {
                    array_push($supplierArr, $supplierData['supplier_code'] . ' ' . $supplierData['supplier_name']);
                    array_push($supplierIdArr, $supplierData['id']);
                }
            }
            $warehouseInfo = $warehouse->getInfoByCode($val['items_warehouse_code']);
            $itemsTable .= '<tr>
							<td>' . $i . '</td>
							<td>' . implode(', ', $supplierArr) . '</td>
							<td>' . $val['items_order_number'] . '</td>
							<td>' . $val['items_code'] . '</td>
							<td>' . $val['items_name'] . '</td>
							<td>' . $val['items_description'] . '</td>
							<td>' . $val['items_qty'] . '</td>
							<td>' . $val['items_unit'] . '</td>
							<td>' . $val['items_warehouse_code'] . ' ' . $warehouseInfo['name'] . '</td>
							<td>' . $val['items_remark'] . '</td>
							<td>' . $itemInfo . '</td>
							</tr>';
        }
        $itemsTable .= '</table>';
        $mailContent = '<div>采购到货,请登录系统查看:</div>
					    <div>
					    <p><b>收货单号:</b>' . $receiveData['number'] . '</p>
					    <p><b>收货日期:</b>' . $receiveData['date'] . '</p>
					    <p><b>收货人:</b>' . $user_session->user_info['user_name'] . '</p>
					    <p><b>描述:</b>' . $receiveData['description'] . '</p>
					    <p><b>备注:</b>' . $receiveData['remark'] . '</p>
					    </div><div>' . $itemsTable . '</div><hr>';
        $mailData = array('type' => '通知', 'subject' => '到货通知 - ' . $receiveData['number'] . ' - ' . implode(', ', $supplierArr), 'cc' => $user_session->user_info['user_email'], 'content' => $mailContent, 'add_date' => $now, 'to' => implode(',', $noticeMails), 'user_id' => $user_id);
        try {
            // 记录邮件日志并发送邮件
            //echo '<pre>';print_r($mailData);exit;
            $mail->send($mail->insert($mailData));
        } catch (Exception $e) {
            $result['success'] = false;
            $result['info'] = $e->getMessage();
        }
        echo Zend_Json::encode($result);
        exit;
    }
예제 #2
0
    public function edititemsAction()
    {
        // 返回值数组
        $result = array('success' => true, 'info' => '编辑成功');
        $request = $this->getRequest()->getParams();
        $now = date('Y-m-d H:i:s');
        $user_session = new Zend_Session_Namespace('user');
        $user_id = $user_session->user_info['user_id'];
        $json = json_decode($request['json']);
        $return_id = $json->return_id;
        $json_items = $json->items;
        $items_updated = $json_items->updated;
        $items_inserted = $json_items->inserted;
        $items_deleted = $json_items->deleted;
        $receive = new Erp_Model_Stock_receive();
        $items = new Erp_Model_Purchse_Receiveitems();
        $itemsorder = new Erp_Model_Purchse_Receiveitemsorder();
        $receiveData = $receive->getData(null, $return_id, '采购退货');
        // 更新
        if (count($items_updated) > 0) {
            foreach ($items_updated as $val) {
                $data = array('order_number' => $val->items_order_number, 'code' => $val->items_code, 'name' => $val->items_name, 'description' => $val->items_description, 'qty' => $val->items_qty, 'unit' => $val->items_unit, 'remark' => $val->items_remark, 'update_user' => $user_id, 'update_time' => $now);
                try {
                    $items->update($data, "id = " . $val->items_id);
                    // 记录分拆数据
                    $splitData = array('receive_number' => $receiveData['number'], 'receive_item_id' => $val->items_id, 'items_order_qty' => $val->items_order_qty, 'items_order_item_price' => $val->items_order_item_price, 'items_code' => $val->items_code, 'items_order_id' => $val->items_order_id, 'items_order_number' => $val->items_order_number);
                    $this->saveSplitItem($splitData);
                } catch (Exception $e) {
                    $result['success'] = false;
                    $result['info'] = $e->getMessage();
                    echo Zend_Json::encode($result);
                    exit;
                }
            }
        }
        // 此次退货货的采购订单号
        $orderNumArr = array();
        // 插入
        if (count($items_inserted) > 0) {
            foreach ($items_inserted as $val) {
                $data = array('receive_id' => $return_id, 'order_number' => $val->items_order_number, 'code' => $val->items_code, 'name' => $val->items_name, 'description' => $val->items_description, 'qty' => $val->items_qty, 'price' => $val->items_price, 'unit' => $val->items_unit, 'remark' => $val->items_remark, 'warehouse_code' => $val->items_warehouse_code, 'create_user' => $user_id, 'create_time' => $now, 'update_user' => $user_id, 'update_time' => $now);
                try {
                    $receive_item_id = $items->insert($data);
                    // 记录分拆数据
                    $splitData = array('return_number' => $receiveData['number'], 'receive_item_id' => $receive_item_id, 'items_qty' => $val->items_qty, 'items_price' => $val->items_price, 'items_code' => $val->items_code, 'items_order_id' => $val->items_order_id, 'items_order_item_id' => $val->items_order_item_id, 'items_warehouse_code' => $val->items_warehouse_code, 'items_order_number' => $val->items_order_number);
                    $this->saveSplitItem($splitData);
                    if (!in_array($val->items_order_number, $orderNumArr)) {
                        array_push($orderNumArr, $val->items_order_number);
                    }
                } catch (Exception $e) {
                    $result['success'] = false;
                    $result['info'] = $e->getMessage();
                    echo Zend_Json::encode($result);
                    exit;
                }
            }
        }
        // 更新总计
        $items->refreshReceiveTotal($return_id);
        // 退货通知
        $receive_items_order = new Erp_Model_Purchse_Receiveitemsorder();
        $order = new Erp_Model_Purchse_Order();
        $relatedUserInfo = count($orderNumArr) > 0 ? $receive_items_order->getReqRelatedUsers($orderNumArr) : array();
        $member = new Admin_Model_Member();
        $warehouse = new Erp_Model_Warehouse_Warehouse();
        $noticeTo = $member->getMemberWithManagerByName('采购退货通知');
        $noticeMails = array();
        $noticeUsers = array();
        foreach ($noticeTo as $n) {
            if ($n['email'] != '' && !in_array($n['user_id'], $noticeUsers)) {
                array_push($noticeMails, $n['email']);
                array_push($noticeUsers, $n['user_id']);
            }
        }
        foreach ($relatedUserInfo as $n) {
            if ($n['email'] != '' && !in_array($n['user_id'], $noticeUsers)) {
                array_push($noticeMails, $n['email']);
                array_push($noticeUsers, $n['user_id']);
            }
        }
        $mail = new Application_Model_Log_Mail();
        $supplierArr = array();
        $i = 0;
        $itemsTable = '<style type="text/css">
table.gridtable {
	font-family: verdana,arial,sans-serif;
	font-size:11px;
	color:#333333;
	border-width: 1px;
	border-color: #666666;
	border-collapse: collapse;
}
table.gridtable th {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #dedede;
}
table.gridtable td {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #ffffff;
}
</style><table class="gridtable"><tr>
                                <th>#</th>
                                <th>供应商</th>
                                <th>采购订单</th>
                                <th>物料号</th>
                                <th>物料名称</th>
                                <th>物料描述</th>
                                <th>退货数量</th>
                                <th>单位</th>
                                <th>退货仓库</th>
                                <th>备注</th>
                                <th>订单信息</th>
                                </tr>';
        foreach ($items_inserted as $val) {
            $itemInfo = '';
            if ($val->items_order_number) {
                $itemInfoData = $order->getItemDetails($val->items_order_number, $val->items_code);
                $itemInfo = '<table class="gridtable"><tr>
							<th>申请单号</th>
							<th>申请日期</th>
							<th>申请数量</th>
							<th>下单数量</th>
							<th>订单数量</th>
                            <th>客户收件人地址简码</th>
                            <th>客户合同号</th>
							</tr>';
                foreach ($itemInfoData as $d) {
                    $itemInfo .= '<tr>
							      <td>' . $d['req_number'] . '</td>
							      <td>' . $d['req_item_date'] . '</td>
							      <td>' . $d['req_item_qty'] . '</td>
							      <td>' . $d['order_req_item_qty'] . '</td>
							      <td>' . $d['order_item_qty'] . '</td>
							      <td>' . $d['customer_address'] . '</td>
							      <td>' . $d['customer_aggrement'] . '</td>
							      </tr>';
                }
                $itemInfo .= '</table>';
                $supplier = $d['supplier_code'] . ' ' . $d['supplier_name'];
                if (!in_array($supplier, $supplierArr)) {
                    array_push($supplierArr, $supplier);
                }
            }
            $i++;
            $warehouseInfo = $warehouse->getInfoByCode($val->items_warehouse_code);
            $itemsTable .= '<tr>
							<td>' . $i . '</td>
							<td>' . $supplier . '</td>
							<td>' . $val->items_order_number . '</td>
							<td>' . $val->items_code . '</td>
							<td>' . $val->items_name . '</td>
							<td>' . $val->items_description . '</td>
							<td>' . $val->items_qty . '</td>
							<td>' . $val->items_unit . '</td>
							<td>' . $val->items_warehouse_code . ' ' . $warehouseInfo['name'] . '</td>
							<td>' . $val->items_remark . '</td>
							<td>' . $itemInfo . '</td>
							</tr>';
        }
        $itemsTable .= '</table>';
        $mailContent = '<div>采购退货,请登录系统查看:</div>
					    <div>
					    <p><b>退货单号:</b>' . $receiveData['number'] . '</p>
					    <p><b>收货日期:</b>' . $receiveData['date'] . '</p>
					    <p><b>收货人:</b>' . $user_session->user_info['user_name'] . '</p>
					    <p><b>描述:</b>' . $receiveData['description'] . '</p>
					    <p><b>备注:</b>' . $receiveData['remark'] . '</p>
					    </div><div>' . $itemsTable . '</div><hr>';
        $mailData = array('type' => '通知', 'subject' => '退货通知 - ' . $receiveData['number'] . ' - ' . implode(', ', $supplierArr), 'cc' => $user_session->user_info['user_email'], 'content' => $mailContent, 'add_date' => $now, 'to' => implode(',', $noticeMails), 'user_id' => implode(',', $noticeUsers));
        try {
            // 记录邮件日志并发送邮件
            $mail->send($mail->insert($mailData));
        } catch (Exception $e) {
            $result['success'] = false;
            $result['info'] = $e->getMessage();
        }
        echo Zend_Json::encode($result);
        exit;
    }
예제 #3
0
    public function edititemsAction()
    {
        // 返回值数组
        $result = array('success' => true, 'info' => '编辑成功');
        $request = $this->getRequest()->getParams();
        $now = date('Y-m-d H:i:s');
        $user_session = new Zend_Session_Namespace('user');
        $user_id = $user_session->user_info['user_id'];
        $json = json_decode($request['json']);
        $receive_id = $json->transfer_id;
        $json_items = $json->items;
        $items_updated = $json_items->updated;
        $items_inserted = $json_items->inserted;
        $items_deleted = $json_items->deleted;
        $receive = new Erp_Model_Stock_receive();
        $items = new Erp_Model_Purchse_Receiveitems();
        $stock = new Erp_Model_Stock_Stock();
        $warehouse = new Erp_Model_Warehouse_Warehouse();
        $receiveData = $receive->getData(null, $receive_id, '调拨');
        // 更新
        if (count($items_updated) > 0) {
            foreach ($items_updated as $val) {
                $data = array('code' => $val->items_code, 'name' => $val->items_name, 'description' => $val->items_description, 'qty' => $val->items_qty, 'unit' => $val->items_unit, 'warehouse_code' => $val->items_warehouse_code, 'warehouse_code_transfer' => $val->items_warehouse_code_transfer, 'remark' => $val->items_remark, 'update_user' => $user_id, 'update_time' => $now);
                try {
                    $items->update($data, "id = " . $val->items_id);
                } catch (Exception $e) {
                    $result['success'] = false;
                    $result['info'] = $e->getMessage();
                    echo Zend_Json::encode($result);
                    exit;
                }
            }
        }
        // 插入
        if (count($items_inserted) > 0) {
            foreach ($items_inserted as $val) {
                $total = round($val->items_qty * $val->items_price, 2);
                $data = array('receive_id' => $receive_id, 'code' => $val->items_code, 'name' => $val->items_name, 'description' => $val->items_description, 'qty' => $val->items_qty, 'price' => $val->items_price, 'total' => $total, 'unit' => $val->items_unit, 'warehouse_code' => $val->items_warehouse_code, 'warehouse_code_transfer' => $val->items_warehouse_code_transfer, 'remark' => $val->items_remark, 'create_user' => $user_id, 'create_time' => $now, 'update_user' => $user_id, 'update_time' => $now);
                try {
                    $receive_item_id = $items->insert($data);
                    // 记录库存数据
                    $stockData = array('code' => $val->items_code, 'warehouse_code' => $val->items_warehouse_code_transfer, 'qty' => $val->items_qty, 'total' => $total, 'create_user' => $user_id, 'create_time' => $now, 'doc_type' => '调拨收货', 'transaction_type' => $receiveData['transaction_type'], 'doc_number' => $receiveData['number']);
                    $stock->insert($stockData);
                    $qty = round(0 - $val->items_qty, 4);
                    $total = round(0 - $total, 2);
                    // 记录库存数据
                    $stockData = array('code' => $val->items_code, 'warehouse_code' => $val->items_warehouse_code, 'qty' => $qty, 'total' => $total, 'create_user' => $user_id, 'create_time' => $now, 'doc_type' => '调拨发货', 'doc_number' => $receiveData['number']);
                    $stock->insert($stockData);
                } catch (Exception $e) {
                    $result['success'] = false;
                    $result['info'] = $e->getMessage();
                    echo Zend_Json::encode($result);
                    exit;
                }
            }
        }
        // 更新总计
        $items->refreshReceiveTotal($receive_id);
        if ($result['success']) {
            // 转储通知(针对从待检仓转出)
            if ($receiveData['transaction_type'] == '外购入库' && $receiveData['order_id'] != '') {
                // 计算收货入库数量(订单、申请)
                $receiveModel = new Erp_Model_Stock_Receive();
                $receiveModel->correctInStockQty($receive_id);
                $member = new Admin_Model_Member();
                $noticeMails = array();
                $noticeUsers = array();
                $noticeTo = $member->getMemberWithManagerByName('外购入库');
                // 通知:外购入库
                foreach ($noticeTo as $n) {
                    if ($n['email'] != '' && !in_array($n['user_id'], $noticeUsers)) {
                        array_push($noticeMails, $n['email']);
                        array_push($noticeUsers, $n['user_id']);
                    }
                }
                $noticeTo = $member->getMemberWithManagerByName('库房');
                // 通知:库房
                foreach ($noticeTo as $n) {
                    if ($n['email'] != '' && !in_array($n['user_id'], $noticeUsers)) {
                        array_push($noticeMails, $n['email']);
                        array_push($noticeUsers, $n['user_id']);
                    }
                }
                // 通知:QA
                $noticeTo = $member->getMemberWithManagerByName('QA');
                foreach ($noticeTo as $n) {
                    if ($n['email'] != '' && !in_array($n['user_id'], $noticeUsers)) {
                        array_push($noticeMails, $n['email']);
                        array_push($noticeUsers, $n['user_id']);
                    }
                }
                // 通知:外购入库通知
                $noticeTo = $member->getMemberWithManagerByName('外购入库通知');
                foreach ($noticeTo as $n) {
                    if ($n['email'] != '' && !in_array($n['user_id'], $noticeUsers)) {
                        array_push($noticeMails, $n['email']);
                        array_push($noticeUsers, $n['user_id']);
                    }
                }
                // 获取采购订单信息
                $order = new Erp_Model_Purchse_Order();
                $order_data = $order->getData(null, $receiveData['order_id']);
                // 获取采购订单相关参与人员
                $receive_items_order = new Erp_Model_Purchse_Receiveitemsorder();
                $relatedUserInfo = $receive_items_order->getReqRelatedUsers(array($order_data['number']));
                foreach ($relatedUserInfo as $n) {
                    if ($n['email'] != '' && !in_array($n['user_id'], $noticeUsers)) {
                        array_push($noticeMails, $n['email']);
                        array_push($noticeUsers, $n['user_id']);
                    }
                }
                $mail = new Application_Model_Log_Mail();
                $itemsTable = '<style type="text/css">
table.gridtable {
	font-family: verdana,arial,sans-serif;
	font-size:11px;
	color:#333333;
	border-width: 1px;
	border-color: #666666;
	border-collapse: collapse;
}
table.gridtable th {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #dedede;
}
table.gridtable td {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #ffffff;
}
</style><table class="gridtable"><tr>
                                <th>#</th>
                                <th>物料号</th>
                                <th>物料名称</th>
                                <th>物料描述</th>
                                <th>数量</th>
                                <th>单位</th>
                                <th>出库仓位</th>
                                <th>入库仓位</th>
                                <th>备注</th>
                                </tr>';
                $i = 0;
                foreach ($items_inserted as $val) {
                    $i++;
                    $warehouseInfo = $warehouse->getInfoByCode($val->items_warehouse_code);
                    $warehouseTransferInfo = $warehouse->getInfoByCode($val->items_warehouse_code_transfer);
                    $stockQty = $stock->getStockQty($val->items_code, array($val->items_warehouse_code));
                    $stockTransferQty = $stock->getStockQty($val->items_code, array($val->items_warehouse_code_transfer));
                    $itemsTable .= '<tr>
							<td>' . $i . '</td>
							<td>' . $val->items_code . '</td>
							<td>' . $val->items_name . '</td>
							<td>' . $val->items_description . '</td>
							<td>' . $val->items_qty . '</td>
							<td>' . $val->items_unit . '</td>
							<td>' . $val->items_warehouse_code . ' ' . $warehouseInfo['name'] . ' [' . $stockQty['total'] . ']</td>
							<td>' . $val->items_warehouse_code_transfer . ' ' . $warehouseTransferInfo['name'] . ' [' . $stockTransferQty['total'] . ']</td>
							<td>' . $val->items_remark . '</td>
							</tr>';
                }
                $itemsTable .= '</table>';
                $title = '库存调拨 - ' . $receiveData['transaction_type'] . ' [' . $order_data['supplier_code'] . ' ' . $order_data['supplier_ename'] . ']';
                $mailContent = '<div>' . $title . ',请登录系统查看:</div>
					    <div>
					    <p><b>单据号:</b>' . $receiveData['number'] . '</p>
					    <p><b>日期:</b>' . $receiveData['date'] . '</p>
					    <p><b>采购订单:</b>' . $order_data['number'] . '</p>
					    <p><b>制单人:</b>' . $user_session->user_info['user_name'] . '</p>
					    <p><b>描述:</b>' . $receiveData['description'] . '</p>
					    <p><b>备注:</b>' . $receiveData['remark'] . '</p>
					    </div><div>' . $itemsTable . '</div><hr>';
                $mailData = array('type' => '通知', 'subject' => $title, 'cc' => $user_session->user_info['user_email'], 'content' => $mailContent, 'add_date' => $now, 'to' => implode(',', $noticeMails), 'user_id' => $user_id);
                try {
                    // 记录邮件日志并发送邮件
                    $mail->send($mail->insert($mailData));
                } catch (Exception $e) {
                    $result['success'] = false;
                    $result['info'] = $e->getMessage();
                }
            } else {
                $member = new Admin_Model_Member();
                $noticeMails = array();
                $noticeUsers = array();
                $noticeTo = $member->getMemberWithManagerByName('通知-库存交易-调拨');
                foreach ($noticeTo as $n) {
                    if ($n['email'] != '' && !in_array($n['user_id'], $noticeUsers)) {
                        array_push($noticeMails, $n['email']);
                        array_push($noticeUsers, $n['user_id']);
                    }
                }
                if (count($noticeMails)) {
                    $warehouse = new Erp_Model_Warehouse_Warehouse();
                    $title = '库存交易-调拨-' . $receiveData['transaction_type'];
                    $mailContent = '<div><b>' . $title . '</b>,请登录系统查看:</div>
                            <div>
                            <p><b>单据号:</b>' . $receiveData['number'] . '</p>
                            <p><b>制单员:</b>' . $user_session->user_info['user_name'] . '</p>
                            <p><b>描述:</b>' . $receiveData['description'] . '</p>
                            <p><b>备注:</b>' . $receiveData['remark'] . '</p>
                            <p><b>时间:</b>' . $receiveData['create_time'] . '</p>
                            </div><hr>';
                    $mailContent .= '<div><style type="text/css">
    table.gridtable {
    	font-family: verdana,arial,sans-serif;
    	font-size:12px;
    	color:#333333;
    	border-width: 1px;
    	border-color: #666666;
    	border-collapse: collapse;
    }
    table.gridtable th {
    	border-width: 1px;
    	padding: 8px;
    	border-style: solid;
    	border-color: #666666;
    	background-color: #dedede;
    }
    table.gridtable td {
    	border-width: 1px;
    	padding: 8px;
    	border-style: solid;
    	border-color: #666666;
    	background-color: #ffffff;
    }
    .delete{
    	text-decoration: line-through;
    	color: #FF0000;
    }
    .update{
    	font-weight: bold;
    	color: #000093;
    }
    .inactive{
    	font-weight: bold;
    	color: #999999;
    }
    </style><table class="gridtable">
                    			<tr>
                    			<th>#</th>
                    			<th>物料号</th>
                    			<th>名称</th>
                    			<th>描述</th>
                    			<th>数量</th>
                    			<th>单位</th>
                    			<th>出库仓位</th>
                    			<th>入货仓位</th>
                    			<th>备注</th>
                    			</tr>';
                    $itemsData = $items->getData($receive_id);
                    $i = 0;
                    foreach ($itemsData as $d) {
                        $i++;
                        $warehouseData = $warehouse->getInfoByCode($d['items_warehouse_code']);
                        $warehouseInfo = $warehouseData["code"];
                        if (isset($warehouseData["name"])) {
                            $warehouseInfo = $warehouseData["code"] . ' ' . $warehouseData["name"];
                        }
                        $warehouseTransferData = $warehouse->getInfoByCode($d['items_warehouse_code_transfer']);
                        $warehouseTransferInfo = $warehouseTransferData["code"];
                        if (isset($warehouseTransferData["name"])) {
                            $warehouseTransferInfo = $warehouseTransferData["code"] . ' ' . $warehouseTransferData["name"];
                        }
                        $mailContent .= '<tr>
                            <td>' . $i . '</td>
                            <td>' . $d['items_code'] . '</td>
                            <td>' . $d['items_name'] . '</td>
                            <td>' . $d['items_description'] . '</td>
                            <td>' . $d['items_qty'] . '</td>
                            <td>' . $d['items_unit'] . '</td>
                            <td>' . $warehouseInfo . '</td>
                            <td>' . $warehouseTransferInfo . '</td>
                            <td>' . $d['items_remark'] . '</td>
                          </tr>';
                    }
                    $mailContent .= '</table></div><hr>';
                    $mailData = array('type' => '通知', 'subject' => $title, 'cc' => $user_session->user_info['user_email'], 'content' => $mailContent, 'add_date' => $now, 'to' => implode(',', $noticeMails), 'user_id' => $user_id);
                    try {
                        // 记录邮件日志并发送邮件
                        $mail = new Application_Model_Log_Mail();
                        $mail->send($mail->insert($mailData));
                    } catch (Exception $e) {
                        $result['success'] = false;
                        $result['info'] = $e->getMessage();
                    }
                }
            }
        }
        echo Zend_Json::encode($result);
        exit;
    }