|
@@ -2,6 +2,8 @@
|
|
|
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
+use app\admin\model\GoodLog;
|
|
|
+use app\admin\model\ProcessOrder;
|
|
|
use app\BaseController;
|
|
|
use think\App;
|
|
|
use think\facade\Db;
|
|
@@ -100,8 +102,10 @@ class Sale extends BaseController
|
|
|
$vat = [];
|
|
|
$inn = [];
|
|
|
if ($datainfo > 0) {
|
|
|
- $st = ["order_code"=>$orderCode,"status"=>1,"action_remark"=>'',"action_type"=>"create"];
|
|
|
- ActionLog::logAdd($this->post['token'],$st,"xsd",1,$st);
|
|
|
+ $st = ["order_code"=>$orderCode,"status"=>$status,"action_remark"=>'',"action_type"=>"create"];
|
|
|
+ ActionLog::logAdd($this->post['token'],$st,"XSQRD",$status,$data);
|
|
|
+ $order=["order_type"=>'XSQRD',"order_code"=>$orderCode,"order_id"=>$datainfo,"order_status"=>$status];
|
|
|
+ ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
foreach ($vi as $ion) {
|
|
|
$iten = [];
|
|
|
$iten['orderCode'] = $orderCode;
|
|
@@ -120,8 +124,6 @@ class Sale extends BaseController
|
|
|
// }
|
|
|
$vp = Db::name('sale_info')->insertAll($inn);
|
|
|
if ($vp == "") {
|
|
|
- $stn = ["order_code"=>$orderCode,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
|
|
|
- ActionLog::logAdd($this->post['token'],$stn,"xsd",0,$stn);
|
|
|
Db::rollback();
|
|
|
return error_show(1002, "添加失败");
|
|
|
}
|
|
@@ -152,8 +154,6 @@ class Sale extends BaseController
|
|
|
}
|
|
|
$vmp = Db::name('order_addr')->insertAll($vat);
|
|
|
if ($vmp) {
|
|
|
- $stp = ["order_code"=>$orderCode,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
|
|
|
- ActionLog::logAdd($this->post['token'],$stp,"xsd",0,$stp);
|
|
|
Db::commit();
|
|
|
return error_show(0, "销售订单创建成功");
|
|
|
}
|
|
@@ -319,8 +319,10 @@ class Sale extends BaseController
|
|
|
];
|
|
|
$datninfo = Db::name('sale')->where(['id' => $id, 'is_del' => 0])->save($datn);
|
|
|
if ($datninfo > 0) {
|
|
|
- $stn = ["order_code"=>$good_code,"status"=>$etid['status'],"action_remark"=>'',"action_type"=>"edit"];
|
|
|
- ActionLog::logAdd($this->post['token'],$stn,"xsd",$etid['status'],$stn);
|
|
|
+ $stn = ["order_code"=>$etid['orderCode'],"status"=>$etid['status'],"action_remark"=>'',"action_type"=>"edit"];
|
|
|
+ ActionLog::logAdd($this->post['token'],$stn,"XSQRD",$etid['status'],$datn);
|
|
|
+ $order=["order_type"=>'XSQRD',"order_code"=>$etid['orderCode'],"order_id"=>$id,"order_status"=>$etid['status']];
|
|
|
+ ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
foreach ($vi as $ion) {
|
|
|
$iten = [];
|
|
|
isset($ion['id']) && $ion['id'] !== "" ? $iten['id'] = $ion['id'] : '';
|
|
@@ -499,8 +501,10 @@ class Sale extends BaseController
|
|
|
}
|
|
|
$str = Db::name('sale')->update(['id' => $id, 'is_del' => 1, 'updatetime' => date("Y-m-d H:i:s")]);
|
|
|
if ($str) {
|
|
|
- $stc = ["order_code"=>$id,"status"=>0,"action_remark"=>'',"action_type"=>"delete"];
|
|
|
- ActionLog::logAdd($this->post['token'],$stc,"xsd",0,$stc);
|
|
|
+ $stc = ["order_code"=>$id,"status"=>$ed['status'],"action_remark"=>'',"action_type"=>"delete"];
|
|
|
+ ActionLog::logAdd($this->post['token'],$stc,"XSQRD",$ed['status'],['id' => $id, 'is_del' => 1, 'updatetime' => date("Y-m-d H:i:s")]);
|
|
|
+ $order=["order_type"=>'XSQRD',"order_code"=>$ed['orderCode'],"order_id"=>$id,"order_status"=>$ed['status']];
|
|
|
+ ProcessOrder::workdel($order);
|
|
|
return error_show(0, "删除成功");
|
|
|
} else {
|
|
|
return error_show(1002, "删除失败");
|
|
@@ -559,9 +563,10 @@ class Sale extends BaseController
|
|
|
$dio['updatetime'] = date("Y-m-d H:i:s");
|
|
|
$st = Db::name('sale')->save($dio);
|
|
|
if ($st) {
|
|
|
-
|
|
|
- $stc = ["order_code"=>$id,"status"=>$vmp,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
- ActionLog::logAdd($this->post['token'],$stc,"xsd",$dio['status'],$stc);
|
|
|
+ $stn = ["order_code"=>$dio['orderCode'],"status"=>$vmp,"action_remark"=>'',"action_type"=>"status"];
|
|
|
+ ActionLog::logAdd($this->post['token'],$stn, $dio['order_type'] == 2?"ZXQRD":"XSQRD",$dio['status'],$dio);
|
|
|
+ $order=["order_type"=>$dio['order_type'] == 2?"ZXQRD":"XSQRD","order_code"=>$dio['orderCode'],"order_id"=>$id,"order_status"=>$dio['status']];
|
|
|
+ ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
if ($status == 3 && $dio['order_type'] == 1) {
|
|
|
$dn = Db::name('sale_info')->where(['orderCode' => $st['orderCode']])->select();
|
|
|
foreach ($dn as $value) {
|
|
@@ -744,8 +749,11 @@ class Sale extends BaseController
|
|
|
];
|
|
|
$datainfo = Db::name('sale')->where(['id' => $id, 'is_del' => 0])->save($data);
|
|
|
if ($datainfo) {
|
|
|
- $stx = ["order_code"=> $id,"status"=>2,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
- ActionLog::logAdd($this->post['token'],$stx,"xsd",2,$stx);
|
|
|
+ $stx = ["order_code"=> $etid['orderCode'],"status"=>$etid['status'],"action_remark"=>'',
|
|
|
+ "action_type"=>"edit"];
|
|
|
+ ActionLog::logAdd($this->post['token'],$stx,$etid['order_type'] == 2?"ZXQRD":"XSQRD",2,$data);
|
|
|
+ $order=["order_type"=>$etid['order_type'] == 2?"ZXQRD":"XSQRD","order_code"=>$etid['orderCode'],"order_id"=>$id,"order_status"=>$data['status']];
|
|
|
+ ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
foreach ($vr as $value) {
|
|
|
$tm = [];
|
|
|
$tm['id'] = $value['id'];
|
|
@@ -754,8 +762,6 @@ class Sale extends BaseController
|
|
|
$tm['updatetime'] = date("Y-m-d H:i:s");
|
|
|
$dn = Db::name('order_addr')->save($tm);
|
|
|
if ($dn == false) {
|
|
|
- $stx = ["order_code"=>$value['id'],"status"=>0,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
- ActionLog::logAdd($this->post['token'],$stx,"xsd",0,$stx);
|
|
|
Db::rollback();
|
|
|
return error_show(1002, "更新失败");
|
|
|
}
|
|
@@ -851,10 +857,12 @@ class Sale extends BaseController
|
|
|
"addtime" => date("Y-m-d H:i:s"),
|
|
|
"updatetime" => date("Y-m-d H:i:s")
|
|
|
];
|
|
|
- $datainfo = Db::name('order_out')->insert($data);
|
|
|
- if ($datainfo) {
|
|
|
- $stx = ["order_code"=>$orderCode,"status"=>$status,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
- ActionLog::logAdd($this->post['token'],$stx,"xsd",$status,$stx);
|
|
|
+ $datainfo = Db::name('order_out')->insert($data,true);
|
|
|
+ if ($datainfo>0) {
|
|
|
+ $stx = ["order_code"=>$outCode,"status"=>$status,"action_remark"=>'',"action_type"=>"create"];
|
|
|
+ ActionLog::logAdd($this->post['token'],$stx,"CKD",$status,$data);
|
|
|
+ $order=["order_type"=>"CKD","order_code"=>$outCode,"order_id"=>$datainfo,"order_status"=>$data['status']];
|
|
|
+ ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
if ($status == 1) {
|
|
|
|
|
|
$var = Db::name('sale_info')->where(['orderCode' => $orderCode, 'wsm_code' => $wsm_code])->find();
|
|
@@ -864,7 +872,7 @@ class Sale extends BaseController
|
|
|
}
|
|
|
// $send = Db::name("order_out")->where(["wsm_code" => $wsm_code, 'orderCode' => $orderCode])->sum
|
|
|
//("send_num");
|
|
|
- // $item =$der['status'];
|
|
|
+ $item =$der['status'];
|
|
|
$der['send_num'] += $send_num;
|
|
|
$der['wsend_num'] -= $send_num;//($der['send_num'])?$der['wsend_num'] =="" ? $der['send']
|
|
|
$der['send_status'] = $der['send_num'] == 0 ? 1 : $der['wsend_num'] == 0 ? 3 : 2;
|
|
@@ -875,6 +883,11 @@ class Sale extends BaseController
|
|
|
Db::rollback();
|
|
|
return error_show(1003, "更新失败");
|
|
|
}
|
|
|
+ $stx = ["order_code"=>$orderCode,"status"=>$item,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
+ ActionLog::logAdd($this->post['token'],$stx,$der['order_type'] == 2?"ZXQRD":"XSQRD",$der['status'],
|
|
|
+ $der);
|
|
|
+ $order=["order_type"=>$der['order_type'] == 2?"ZXQRD":"XSQRD","order_code"=>$outCode,"order_id"=>$datainfo,"order_status"=>$data['status']];
|
|
|
+ ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
$str = Db::name('good_stock')->where(['wsm_code' => $var['wsm_code'], 'good_type_code' => $der['good_code']])->find();
|
|
|
if ($str == false) {
|
|
|
Db::rollback();
|
|
@@ -892,6 +905,9 @@ class Sale extends BaseController
|
|
|
Db::rollback();
|
|
|
return error_show(1002, "状态更新失败");
|
|
|
}
|
|
|
+ $good_data[]= ["stock_id"=>$str['id'],"type"=>2,'stock'=>$send_num,"stock_name"=>"wait_out_stock"];
|
|
|
+ $good_data[]= ["stock_id"=>$str['id'],"type"=>1,'stock'=>$send_num,"stock_name"=>"intra_stock"];
|
|
|
+ GoodLog::LogAdd($this->post['token'],$good_data,'CKD');
|
|
|
}
|
|
|
|
|
|
Db::commit();
|
|
@@ -935,6 +951,10 @@ class Sale extends BaseController
|
|
|
$codeinfo['updatetime'] = date("Y-m-d H:i:s");
|
|
|
$cust = Db::name('order_out')->save($codeinfo);
|
|
|
if ($cust) {
|
|
|
+ $stx = ["order_code"=>$outCode,"status"=>$time,"action_remark"=>'',"action_type"=>"status"];
|
|
|
+ ActionLog::logAdd($this->post['token'],$stx,"CKD",$codeinfo['status'],$codeinfo);
|
|
|
+ $order=["order_type"=>"CKD","order_code"=>$outCode,"order_id"=>$codeinfo['id'],"order_status"=>$codeinfo['status']];
|
|
|
+ ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
if ($status == 2) {
|
|
|
$ct = Db::name('sale_info')->where(['orderCode' => $dr['orderCode'], 'wsm_code' => $codeinfo['wsm_code']])->find();
|
|
|
if ($ct == false) {
|
|
@@ -952,8 +972,8 @@ class Sale extends BaseController
|
|
|
$var['intra_stock'] -= $codeinfo['send_num'];
|
|
|
$var['updatetime'] = date("Y-m-d H:i:s");
|
|
|
$stre = Db::name('good_stock')->save($var);
|
|
|
- $stx = ["order_code"=>$outCode,"status"=>$time,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
- ActionLog::logAdd($this->post['token'],$stx,"xsd", $codeinfo['status'],$stx);
|
|
|
+ $good_data[]= ["stock_id"=>$var['id'],"type"=>2,'stock'=>$codeinfo['send_num'],"stock_name"=>"intra_stock"];
|
|
|
+ GoodLog::LogAdd($this->post['token'],$good_data,'CKD');
|
|
|
if ($stre == false) {
|
|
|
Db::rollback();
|
|
|
return error_show(1002, "状态更新失败");
|
|
@@ -1077,8 +1097,10 @@ class Sale extends BaseController
|
|
|
$info['updatetime'] = date("Y-m-d H:i:s");
|
|
|
$up = Db::name("sale_diff")->save($info);
|
|
|
if ($up) {
|
|
|
- $stx = ["order_code"=>$id,"status"=>$item,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
- ActionLog::logAdd($this->post['token'],$stx,"sxd", $info['status'],$stx);
|
|
|
+ $stx = ["order_code"=>$info["orderCode"],"status"=>$item,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
+ ActionLog::logAdd($this->post['token'],$stx,"QRGCD",$info['status'],$info);
|
|
|
+ $order=["order_type"=>"QRGCD","order_code"=>$info["orderCode"],"order_id"=>$info['id'],"order_status"=>$info['status']];
|
|
|
+ ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
return app_show(0, "更新成功");
|
|
|
} else {
|
|
|
return error_show(1003, "更新失败");
|
|
@@ -1110,8 +1132,10 @@ class Sale extends BaseController
|
|
|
$info['updatetime'] = date("Y-m-d H:i:s");
|
|
|
$up = Db::name("sale_diff")->save($info);
|
|
|
if ($up) {
|
|
|
- $stx = ["order_code"=>$id,"status"=>$ite,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
- ActionLog::logAdd($this->post['token'],$stx,"sxd", $info['status'],$stx);
|
|
|
+ $stx = ["order_code"=>$info["orderCode"],"status"=>$ite,"action_remark"=>'',"action_type"=>"status"];
|
|
|
+ ActionLog::logAdd($this->post['token'],$stx,"QRGCD",$info['status'],$info);
|
|
|
+ $order=["order_type"=>"QRGCD","order_code"=>$info["orderCode"],"order_id"=>$info['id'],"order_status"=>$info['status']];
|
|
|
+ ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
return app_show(0, "更新成功");
|
|
|
} else {
|
|
|
return error_show(1003, "更新失败");
|