示例#1
0
 public function index()
 {
     vendor("GuoYaoService", LIB_PATH . "\\Service");
     define('DEBUG', true);
     $model = new OrderModel();
     //$sql = "UPDATE web_order SET orderNo='G01131009029',billDate='2013-10-09 10:29:05',userId='000032',userName='******',departure='',client='国药控股广州有限公司',clientName='(国药集团)高唐库',clientPhone='',clientMobile='',clientAddress='广东省-广州市-天河区-高唐工业园高普路91号',destination='',consignee='佛山市顺德区北滘医院',consigneeName='',consigneePhone='',consigneeMobile='',consigneeAddress='广东省-佛山市-顺德区-(北滘医院)(西)顺德区北滘镇林上路东城区一南路1号北滘医院西药库',goods='药品',qty=195,weight=0,cubage=0,package='纸箱',payType='月结',declareValue=0,insuranceValue=0,getMoney=0,transtype='汽运',deliverType='零担',signBackType='',receipt=0,receiptPhone=null,receiptAddress=null,receiptTime=null,requirementDate='2014-05-27 15:00:00',requirementTime='2014-05-27 15:00:00',addition=0,notice='0.0',sendFax=0,company='000032',sysdno=null,synupcount=0,synupsign=0,synupsigncount=0 WHERE id='88819'";
     $sql = "UPDATE web_order SET orderNo='G01131009029',billDate='2013-10-09 10:29:05',userId='000032',userName='******',departure='',client='',clientName='',clientPhone='',clientMobile='',clientAddress='',destination='',consignee='北滘医院',consigneeName='',consigneePhone='',consigneeMobile='',consigneeAddress='',goods='药品',qty=195,weight=0,cubage=0,package='纸箱',payType='月结',declareValue=0,insuranceValue=0,getMoney=0,transtype='汽运',deliverType='零担',signBackType='',receipt=0,receiptPhone=null,receiptAddress=null,receiptTime=null,requirementDate='2014-05-27 15:00:00',requirementTime='2014-05-27 15:00:00',addition=0,notice='0.0',sendFax=0,company='000032',sysdno=null,synupcount=0,synupsign=0,synupsigncount=0 WHERE id='88819'";
     $result = $model->execute($sql);
     //$service = new GuoYaoService();
     //echo "kenlong";
     //$service->readFromSPL();
     //$service->synup();
     //$service->updateFlag();
     /*
     $headmodel = new OrderModel();
     $find = $headmodel->where("orderNo = 'G01140307156'")->find();
     unset($find['dno']);
     unset($find['synup']);
     unset($find['billNo']);
     unset($find['OrderInfoId']);
     unset($find['status']);
     
     print_r($find);
     */
 }
示例#2
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;
 }