|
|
@@ -999,34 +999,42 @@ class destination_delivery {
|
|
|
|
|
|
//前端按钮 后台权限拦截
|
|
|
common::checkedActionLegal($serial_no,$operate);
|
|
|
- $sql = "";
|
|
|
- //审核通过时,才取下放当时应用修改的地址
|
|
|
- if ($status == "Approve") {
|
|
|
- $delivery_booking = common::excuteObjectSql("select *,array_to_json(address_country) as address_country,
|
|
|
- array_to_json(h_serial_no) as h_serial_no_json,
|
|
|
- TO_CHAR( delivery_date, 'HH24:MI') AS _delivery_time,
|
|
|
- delivery_date::date AS _delivery_date
|
|
|
- from public.kln_destination_delivery where serial_no = '$serial_no'");
|
|
|
|
|
|
- $onine_address = common::excuteListSql("select * from public.contacts_address_online where delivery_serial_no = '$serial_no'");
|
|
|
+ global $db;
|
|
|
+ $db->StartTrans();
|
|
|
+ try {
|
|
|
+ $sql = "";
|
|
|
+ //审核通过时,才取下放当时应用修改的地址
|
|
|
+ if ($status == "Approve") {
|
|
|
+ $delivery_booking = common::excuteObjectSql("select *,array_to_json(address_country) as address_country,
|
|
|
+ array_to_json(h_serial_no) as h_serial_no_json,
|
|
|
+ TO_CHAR( delivery_date, 'HH24:MI') AS _delivery_time,
|
|
|
+ delivery_date::date AS _delivery_date
|
|
|
+ from public.kln_destination_delivery where serial_no = '$serial_no'");
|
|
|
|
|
|
- $sql .= "delete from public.contacts_address_online where delivery_serial_no = '$serial_no';";
|
|
|
- $sql .=common::returnDAddressRecord($delivery_booking["address_country"],$onine_address);
|
|
|
+ $onine_address = common::excuteListSql("select * from public.contacts_address_online where delivery_serial_no = '$serial_no'");
|
|
|
+ $sql .= "delete from public.contacts_address_online where delivery_serial_no = '$serial_no';";
|
|
|
+ $sql .=common::returnDAddressRecord($delivery_booking["address_country"],$onine_address);
|
|
|
|
|
|
- //Booking自動同步到Ksmart WO 的逻辑 保存在do_header和do_details表里
|
|
|
- $sql .=common::saveWorkOrder($delivery_booking);
|
|
|
- }
|
|
|
- if ($status == "Reject" || $status == "Cancel") {
|
|
|
- //这种情况,清除当前用户对这一票的修改和添加的信息
|
|
|
- $sql .= "delete from public.contacts_address_online where delivery_serial_no = '$serial_no';";
|
|
|
- }
|
|
|
+ //Booking自動同步到Ksmart WO 的逻辑 保存在do_header和do_details表里
|
|
|
+ common::saveWorkOrder($delivery_booking);
|
|
|
+ }
|
|
|
+ if ($status == "Reject" || $status == "Cancel") {
|
|
|
+ //这种情况,清除当前用户对这一票的修改和添加的信息
|
|
|
+ $sql .= "delete from public.contacts_address_online where delivery_serial_no = '$serial_no';";
|
|
|
+ }
|
|
|
|
|
|
- $sql .= "update public.kln_destination_delivery set status = '$status', modify_by = '"._getLoginName()."',update_time = now() where serial_no = '$serial_no';";
|
|
|
- $sql .="INSERT INTO public.kln_destination_delivery_operation_log(
|
|
|
- serial_no, action,notes, create_by, created_time, created_zone)
|
|
|
- VALUES ('$serial_no', '$status','$notes', '$action_user', now(), ''); ";
|
|
|
+ $sql .= "update public.kln_destination_delivery set status = '$status', modify_by = '"._getLoginName()."',update_time = now() where serial_no = '$serial_no';";
|
|
|
+ $sql .= "INSERT INTO public.kln_destination_delivery_operation_log(
|
|
|
+ serial_no, action,notes, create_by, created_time, created_zone)
|
|
|
+ VALUES ('$serial_no', '$status','$notes', '$action_user', now(), ''); ";
|
|
|
+
|
|
|
+ $db->Execute($sql) or ((!$db->ErrorMsg()) or error_log(common::dbLog($db, $sql), 0));
|
|
|
+ $rs = $db->CompleteTrans();
|
|
|
+ } catch (Exception $e) {
|
|
|
+ $db->RollbackTrans();
|
|
|
+ }
|
|
|
|
|
|
- $rs = common::excuteUpdateSql($sql);
|
|
|
if ($rs === FALSE){
|
|
|
$data = array("msg" => "Update Error");
|
|
|
common::echo_json_encode(200,$data);
|