Exemple #1
0
 /**
  * 删除订单
  *
  * @param xml string $request
  * @return xml string
  */
 private function orderDelete($request)
 {
     try {
         $id = $request["body"]["id"];
         if (!$id) {
             return $this->createResult($request["head"]["type"], -3, 'not a valid action');
         }
         $model = new OrderModel();
         $result = $model->where("id = {$id} and status = 0")->delete();
         if (!$result) {
             return $this->createResult($request["head"]["type"], -1, 'delete error');
         }
         return $this->createResult($request["head"]["type"], 1, 'success', 1);
     } catch (Exception $e) {
         return $this->createResult($request["head"]["type"], -1, 'error in order delete');
     }
 }
 public function t()
 {
     $model = new OrderModel();
     $rs = $model->where("orderNo ='" . $head["orderNo"] . "'")->find();
     print_r($rs);
     /*
     vendor("WebOrderService",LIB_PATH."\Service");
     
     $service = new WebOrderService();
     
     $result = $service->login((object)array("userID"=>"00100001","userPass"=>"0000"));
     
     print_r((object)$result);
     */
 }
Exemple #3
0
 /**
  * 保存订单
  *
  */
 private function saveOrder($data)
 {
     try {
         $headmodel = new OrderModel();
         //作废标记处理
         if ($data['FILEFUNCTION'] === 'CANCEL') {
             $sql = "update web_order set status = -1 where orderNo = '" . $data['ECNO'] . "';";
             $headmodel->execute($sql);
             $headmodel->commit();
             return true;
         }
         //查找已经存在的记录
         $find = $headmodel->where("orderNo = '" . $data['ECNO'] . "'")->find();
         if ($find['id']) {
             unset($find['dno']);
             unset($find['synup']);
             unset($find['billNo']);
             unset($find['OrderInfoId']);
             unset($find['status']);
             $head = $find;
         }
         //订单头文件
         $head["departure"] = '';
         $head["destination"] = '';
         $head["orderNo"] = $data['ECNO'];
         $head["client"] = '国药控股广州有限公司';
         $head["clientName"] = $data['CONSIGNOR'] != 'null' ? $data['CONSIGNOR'] : '';
         $head["clientPhone"] = $data['CONPHONE'] != 'null' ? $data['CONPHONE'] : '';
         $head["clientAddress"] = $data['CONADDRESS'] != 'null' ? $data['CONADDRESS'] : '';
         $head["consignee"] = $data['CUSTOMERNNAME'] != 'null' ? $data['CUSTOMERNNAME'] : '';
         $head["consigneeName"] = $data['CUSCONTACT'] != 'null' ? $data['CUSCONTACT'] : '';
         $head["consigneePhone"] = $data['CUSNPHONENO'] != 'null' ? $data['CUSNPHONENO'] : '';
         $head["consigneeAddress"] = $data['CUSTADDRESS'] != 'null' ? $data['CUSTADDRESS'] : '';
         $head["deliverType"] = $data['TMSLOADINGMETHOD'] != 'null' ? $data['TMSLOADINGMETHOD'] : '';
         $head["goods"] = '药品';
         //$data['GOODSTYPE']!='null'?$data['GOODSTYPE']:'';
         $head["package"] = '';
         $head["qty"] = intval($data['TOTALQUANTITY']);
         $head["weight"] = 0;
         $head["addition"] = intval($data['INVOICENUMBER']);
         $head["notice"] = $data['REQUIREMENT'] != 'null' ? $data['REQUIREMENT'] : '';
         $head["transtype"] = $this->authname == 'NGWL01' ? '空运' : '汽运';
         //$orderhead->Transporttype;
         $head["declareValue"] = 0;
         $head["sendFax"] = 0;
         $head["requirementDate"] = $data['DELIVETIME'];
         $head["requirementTime"] = $data['DELIVETIME'];
         $head["userName"] = $data['CREATER'] != 'null' ? $data['CREATER'] : '';
         $head["userId"] = '000032';
         $head["company"] = '000032';
         $head["billDate"] = $data['CREATETIME'];
         date_default_timezone_set("Asia/Shanghai");
         //额外信息
         $head["clientMobile"] = '';
         $head["consigneeMobile"] = '';
         $head["getMoney"] = 0;
         $head["cubage"] = 0;
         $head["package"] = '纸箱';
         $head["payType"] = "月结";
         $head["insuranceValue"] = 0;
         $head["signBackType"] = '';
         //save head
         if ($head['id']) {
             $rs = $headmodel->save($head);
         } else {
             $rs = $headmodel->where("not exist")->add($head);
         }
         if ($rs === false) {
             $this->addLog("save head error");
             return false;
         }
         //save detail
         $detail['orderNo'] = $data["ECNO"];
         $detail['businessNo'] = $data["LEGNO"];
         $detail['OUTORDERID'] = $data["OUTORDERID"];
         $detail['LOTNO'] = $data["LOTNO"];
         $detail['GOODSTYPE'] = $data["GOODSTYPE"];
         $detail['TRASNCONDITION'] = $data['TRASNCONDITION'];
         $detail['PRODUCTTYPE'] = $data["PRODUCTTYPE"];
         $detail['QUANTITY'] = intval($data["QUANTITY"]);
         $detail['QUANTITYUNIT'] = intval($data["QUANTITYUNIT"]);
         $detail['QUNITNAME'] = $data["QUNITNAME"];
         $detail['PACKWEIGHT'] = intval($data["PACKWEIGHT"]);
         $detail['CARTONQUANITTY'] = intval($data["CARTONQUANITTY"]);
         $detail['PLACESUPPLYDTLID'] = $data["PLACESUPPLYDTLID"];
         $detail['OWNERGOODSID'] = $data["OWNERGOODSID"];
         $detailmodel = new OrderdetailModel();
         $find = $detailmodel->where("orderNo = '" . $data['ECNO'] . "' and businessNo='" . $data['LEGNO'] . "'")->find();
         if (!$find) {
             $detailmodel->add($detail);
         } else {
             if (DEBUG) {
                 $this->debug('duplicate', "found detail" . $detail['orderNo'] . " " . $data['LEGNO']);
             }
         }
     } catch (Exception $e) {
         $this->addLog("save order Exception error" . $e->getMessage());
         return false;
     }
     $this->orderno = $data['ECNO'];
     return true;
 }