123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <?php
- declare (strict_types = 1);
- namespace app\command;
- use think\console\Command;
- use think\console\Input;
- use think\console\input\Argument;
- use think\console\input\Option;
- use think\console\Output;
- use think\facade\Cache;
- use think\facade\Db;
- class execpp extends Command
- {
- protected $db="";
- protected function configure()
- {
- // 指令配置
- $this->setName('CopyData')
- ->setDescription('the CopyData command');
- }
- protected function execute(Input $input, Output $output)
- {
- $qrd = $this->GetData();
- //var_dump($qrd);
- Db::startTrans();
- try{
- foreach ($qrd as $value){
- $source =Db::table("source_all")->where(["productNo"=>$value['productNo']])->find();
- $value['qrd_pay_status'] = $value['qrd_pay_status']=='未回'?1 :3;
- $value['qrd_inv_status'] = $value['qrd_inv_status']=='未开'?1 :3;
- // if($source==false){
- // Db::table("source_all")->insert($value);
- // }
- // $cgd = Db::table("cgd")->where(["cgdNo"=>$value['cgdNo']])->find();
- // if($cgd){
- // Db::table("source_all")->where(["productNo"=>$value['productNo']])->save($cgd);
- // }
- // $qrd =Db::name("qrd")->where(["sequenceNo"=>$value['qrdNo']])->find();
- // if($qrd==false){
- // $qrdData=[
- // "name"=>'网络部确认单'.$value['qrdNo'],
- // 'createdTime'=>date("Y-m-d H:i:s"),
- // 'sequenceNo'=>$value['qrdNo'],
- // 'sales_name'=>$value['sale_name'],
- // 'sales_depart'=>$value['suppitem'],
- // 'customer'=>isset($value['companyName']) ? $value['companyName'] : "",
- // 'total_fee'=>$value['sale_total'],
- // 'mobile'=>'',
- // 'contactor'=>'',
- // 'qrddate'=>date("Y-m-d H:i:s"),
- // 'companyNo'=>$value['companyNo'],
- // 'supplerName'=>$value['supperinfo'],
- // 'addr'=>'',
- // 'depart'=>$value['suppitem'],
- // 'type'=>1,
- // 'apay_fee'=>$value['qrd_apay_fee'],
- // 'pay_fee'=>0,
- // 'wpay_fee'=>$value['qrd_wpay_fee'],
- // 'ainv_fee'=>$value['qrd_ainv_fee'],
- // 'inv_fee'=>0,
- // 'winv_fee'=>$value['qrd_winv_fee'],
- // 'inv_status'=>$value['qrd_inv_status'],
- // 'pay_status'=>$value['qrd_pay_status'] ,
- // 'status'=>1,
- // 'addtime'=>date("Y-m-d H:i:s"),
- // 'updatetime'=>date("Y-m-d H:i:s")
- // ];
- // Db::name("qrd")->insert($qrdData);
- // }
- $qrdinfo =Db::name("qrd_info")->where(["sequenceNo"=>$value['qrdNo']])->find();
- if($qrdinfo==false){
- $data = [
- 'name' => '网络部确认单',
- 'createdTime' => date("Y-m-d H:i:s"),
- 'startTime' => date("Y-m-d H:i:s"),
- 'finishTime' => date("Y-m-d H:i:s"),
- "Date1617081795606"=>date("Y-m-d H:i:s"),
- // 'ownerName'=>date("Y-m-d H:i:s"),
- // 'departmentName'=>date("Y-m-d H:i:s"),
- 'sequenceNo' => $value['qrdNo'],
- 'sequenceStatus' => 1,
- 'ShortText1617022967356' => '网络部',
- 'text1617499162303'=>$value['product_code'],
- 'ShortText1617365292699' => $value['product_name'],
- "ShortText1617367958909" => $value['tax'],
- 'text1617365646297'=> $value['poNo'],
- "ShortText1618447165317"=>$value['companyName'],
- "Number1617365688048" => $value['order_num'],
- 'ShortText1617650669915' => $value['qrd_type'],
- 'ShortText1617650701648' =>$value['qrdNo'],
- "Number1618248810624" => $value['sale_price'],
- 'Number1618248813613' =>$value['sale_total'],
- "Number1618249015661" =>$value['order_num'],
- "number1618249149738" => $value['qrd_wpay_fee'], //wpay
- 'Number1618249146997'=>$value['qrd_apay_fee'],// apayaw
- "Number1618249205231" => $value['qrd_winv_fee'],//winv
- "Number1618249202608" => $value['qrd_ainv_fee'], //ainv
- 'ShortText1618446949933' =>'',
- 'ShortText1618446973813' => '',
- 'LongText1618446982973' =>'',
- 'ShortText1618559007040' => 3,
- 'ShortText1618559043560' => $value['qrd_pay_status'],
- 'ShortText1618559274859' => $value['qrd_inv_status'],
- "ShortText1617499192065"=>$value['cat_f'],
- 'StaffSelector1619488013389' => $value['sale_name'],
- 'ShortText1619523689586' => $value['suppitem'],
- 'ShortText1620750298602' =>isset($source['supplierNo'])?$source['supplierNo']:"",
- 'ShortText1620750301301' => isset($source['supplierName']) ? $source['supplierName'] : "",
- 'Date1620370378620' => date("Y-m-d H:i:s"),
- 'departmentName' => $value['suppitem'],
- 'ShortText1619542951283' =>$value['companyNo'],
- 'ShortText1619523892833' => isset($value['companyName']) ? $value['companyName'] : "",
- 'StaffSelector1618445844046' => $value['sale_name'],
- 'StaffSelector1618445850209' => $value['suppitem'],
- 'ownerName' =>$value['sale_name'],
- ];
- Db::name("qrd_info")->save($data);
- }
- }
- Db::commit();
- }catch (\Exception $e){
- echo $e->getMessage();
- Db::rollback();
- }
- $output->writeln('CopyData');
- }
- protected function GetData(){
- $isT= Db::table("qrd")->select();
- return $isT;
- }
- protected function GetCGD(){
- $isT= Db::table("cgd")->select();
- return $isT;
- }
- }
|