|
@@ -43,8 +43,7 @@ class Sale extends Base
|
|
|
return error_show(1004,"未找到平台供应商数据");
|
|
|
}
|
|
|
$goodtype =isset($this->post['goodtype']) && $this->post['goodtype'] !=="" ?intval($this->post['goodtype']):"1";
|
|
|
- $order_type =isset($this->post['order_type']) && $this->post['order_type'] !=="" ?intval($this->post['order_type'])
|
|
|
- :"1";
|
|
|
+ $order_type =isset($this->post['order_type']) && $this->post['order_type'] !=="" ?intval($this->post['order_type']) :"1";
|
|
|
$sendtype =isset($this->post['sendtype']) && $this->post['sendtype'] !=="" ?intval($this->post['sendtype']):"";
|
|
|
if($sendtype===''){
|
|
|
return error_show(1004,"参数sendtype不能为空");
|
|
@@ -174,6 +173,7 @@ class Sale extends Base
|
|
|
"weight"=>$ct['noble_weight'],
|
|
|
"gold_price"=>isset($ct['cgd_gold_price'])?$ct['cgd_gold_price']:0,
|
|
|
"order_type"=>$is_stock==1?1:2,
|
|
|
+ "order_source"=>1,//1直接下单
|
|
|
"createrid"=>$ct['createrid'],
|
|
|
"creater"=>$ct['creater'],
|
|
|
'send_way'=>2
|
|
@@ -229,6 +229,7 @@ class Sale extends Base
|
|
|
"is_stock"=>$is_stock,
|
|
|
"is_activity"=>$is_activity===""?0:$is_activity,
|
|
|
"order_type"=>$is_stock==1?1:2,
|
|
|
+ "order_source"=>1,//1直接下单
|
|
|
// "poNo"=>$poNo,
|
|
|
'good_weight'=>$ct['noble_weight'],
|
|
|
'gold_price'=>isset($ct['cgd_gold_price'])?$ct['cgd_gold_price']:0,
|
|
@@ -287,7 +288,9 @@ class Sale extends Base
|
|
|
"good_num"=>$good_num,
|
|
|
"spuCode"=>$spuCode,
|
|
|
"companyNo"=>$supplierNo,
|
|
|
- "cost_fee"=>isset($good['cost_fee'])?$good['cost_fee']:0
|
|
|
+ "cost_fee"=>isset($good['cost_fee'])?$good['cost_fee']:0,
|
|
|
+ 'order_type' => $data['order_type'],
|
|
|
+ 'order_source' => $data['order_source'],
|
|
|
],$standing_book_da);
|
|
|
if($bol==false){
|
|
|
Db::rollback();
|
|
@@ -515,6 +518,7 @@ class Sale extends Base
|
|
|
"lasttime"=>date("Y-m-d H:i:s"),
|
|
|
"is_del"=>0,
|
|
|
"order_type"=>$data['order_type'],
|
|
|
+ "order_source"=>$data['order_source'],
|
|
|
"good_type"=>$data['good_type'],
|
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
@@ -542,6 +546,7 @@ class Sale extends Base
|
|
|
'spuCode' => $data['spuCode'],
|
|
|
'skuCode' => $data['skuCode'],
|
|
|
'order_type' => $data['order_type'],
|
|
|
+ 'order_source' => $data['order_source'],
|
|
|
'supplierNo' => $data['supplierNo'],
|
|
|
"companyNo" => $data['companyNo'],
|
|
|
]);
|
|
@@ -862,6 +867,7 @@ class Sale extends Base
|
|
|
"gold_price"=>$zxinfo['gold_price'],
|
|
|
"is_diff"=>$zxinfo['is_diff'],
|
|
|
"order_type"=>3,
|
|
|
+ "order_source"=>2,//咨询
|
|
|
'send_way'=>$zxinfo['send_way']
|
|
|
];
|
|
|
$token=isset($this->post['token'])&&$this->post['token']!=""? trim($this->post['token']):"";
|
|
@@ -935,6 +941,7 @@ class Sale extends Base
|
|
|
"is_activity"=>0,
|
|
|
"proof_id"=>0,
|
|
|
"order_type"=>3,
|
|
|
+ "order_source"=>2,//2咨询
|
|
|
'good_weight'=>$zxinfo['good_weight'],
|
|
|
'gold_price'=>$zxinfo['gold_price'],
|
|
|
'cost_price'=>$zxinfo['sale_cost_fee'],
|
|
@@ -948,7 +955,11 @@ class Sale extends Base
|
|
|
$datainfo = Db::name('sale')->insert($data, true);
|
|
|
if($datainfo>0){
|
|
|
|
|
|
- $standing_book_data = ['sale_id' => $datainfo, 'infoNo' => $zxinfo['infoNo'], 'updatetime' => date('Y-m-d H:i:s')];
|
|
|
+ $standing_book_data = [
|
|
|
+ 'sale_id' => $datainfo,
|
|
|
+ 'infoNo' => $zxinfo['infoNo'],
|
|
|
+ 'updatetime' => date('Y-m-d H:i:s')
|
|
|
+ ];
|
|
|
|
|
|
//修改状态,添加待办
|
|
|
ActionLog::logAdd($this->post['token'], [
|
|
@@ -1373,7 +1384,8 @@ class Sale extends Base
|
|
|
"weight"=>$goodinfo['good_weight'],
|
|
|
"gold_price"=>$goodinfo['gold_price'],
|
|
|
"good_type"=>1,
|
|
|
- "order_type"=>4,
|
|
|
+ "order_type"=>3,//3咨询商品
|
|
|
+ "order_source"=>3,//项目
|
|
|
"send_way"=>$goodinfo['send_way'],
|
|
|
|
|
|
];
|
|
@@ -1405,7 +1417,8 @@ class Sale extends Base
|
|
|
"is_stock"=>0,
|
|
|
"is_activity"=>0,
|
|
|
"proof_id"=>0,
|
|
|
- "order_type"=>4,
|
|
|
+ "order_type"=>3,//咨询商品
|
|
|
+ "order_source"=>3,//项目
|
|
|
'good_weight'=>$goodinfo['good_weight'],
|
|
|
'gold_price'=>$goodinfo['gold_price'],
|
|
|
'cost_price'=>$goodinfo['sale_cost_fee'],
|
|
@@ -1544,7 +1557,7 @@ class Sale extends Base
|
|
|
"check_num" => 0,
|
|
|
"error_num" => 0,
|
|
|
"wsm_code" => "",
|
|
|
- "order_type" => 4,
|
|
|
+ "order_type" => 3,//3咨询商品
|
|
|
"status" => 0,
|
|
|
"addtime" => date("Y-m-d H:i:s"),
|
|
|
"updatetime" => date("Y-m-d H:i:s")
|
|
@@ -1672,7 +1685,8 @@ class Sale extends Base
|
|
|
"is_stock"=>$good['is_stock'],
|
|
|
"is_activity"=>0,
|
|
|
"proof_id"=>0,
|
|
|
- "order_type"=>$good['is_stock']==1?1:2,
|
|
|
+ "order_type"=>$good['is_stock']==1?1:2,//1备库,2非库存品
|
|
|
+ 'order_source' => 3,//3项目
|
|
|
'good_weight'=>$good['noble_weight'],
|
|
|
'gold_price'=>isset($good['cgd_gold_price'])? $good['cgd_gold_price']:0,
|
|
|
'cost_price'=>$goodlass['cost_fee'],
|
|
@@ -1724,6 +1738,7 @@ class Sale extends Base
|
|
|
"createrid"=>$good['createrid'],
|
|
|
"creater"=>$good['creater'],
|
|
|
"order_type"=>$good['is_stock']==1?1:2,
|
|
|
+ 'order_source' => 3,//3项目
|
|
|
'send_way'=>2
|
|
|
];
|
|
|
if($good['is_stock']==0) {
|
|
@@ -1739,7 +1754,7 @@ class Sale extends Base
|
|
|
return 1; //库存不足
|
|
|
}
|
|
|
|
|
|
- $bol =$this->RelaCgd(['orderCode'=>$orderCode,"good_num"=>$data['good_num'],"spuCode"=>$good['spuCode'],"companyNo"=>$data['companyNo'],"cost_fee"=>$goodlass['cost_fee']],$standing_book_data);
|
|
|
+ $bol =$this->RelaCgd(['orderCode'=>$orderCode,"good_num"=>$data['good_num'],"spuCode"=>$good['spuCode'],"companyNo"=>$data['companyNo'],"cost_fee"=>$goodlass['cost_fee'],'order_type'=>$cgd['order_type'],'order_source'=>$cgd['order_source']],$standing_book_data);
|
|
|
if($bol==false){
|
|
|
return 3;//关联采购失败
|
|
|
}
|
|
@@ -1943,7 +1958,7 @@ class Sale extends Base
|
|
|
->cursor();
|
|
|
$data = [];
|
|
|
foreach ($list as $value) {
|
|
|
- if($value['order_type']==3|| $value['order_type']==4){
|
|
|
+ if($value['order_type']==3){
|
|
|
$var = Db::name("good_zixun")->where(["spuCode"=>$value['good_code'],"is_del"=>0])->find();
|
|
|
$value["speclist"]=isset($var['specinfo'])&&$var['specinfo']!=""? json_decode($var['specinfo'],true):"";
|
|
|
}else {
|
|
@@ -2154,7 +2169,7 @@ class Sale extends Base
|
|
|
if (empty($einfo)) {
|
|
|
return error_show(1002, "未找到销售订单数据");
|
|
|
}
|
|
|
- if($einfo['order_type']==3|| $einfo['order_type']==4){
|
|
|
+ if($einfo['order_type']==3){
|
|
|
$goon = Db::name("good_zixun")->where(["spuCode"=>$einfo['good_code'],"is_del"=>0])->find();
|
|
|
}else {
|
|
|
$goon = Db::name('good_platform')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')
|
|
@@ -2426,6 +2441,7 @@ class Sale extends Base
|
|
|
"is_del" => 0,
|
|
|
"status" => $dio['send_type'] == 1 ? 3 : 0,
|
|
|
"order_type" => 2,
|
|
|
+ "order_source" => 3,//3项目,废弃接口???
|
|
|
"addtime" => date("Y-m-d H:i:s"),
|
|
|
"updatetime" => date("Y-m-d H:i:s")
|
|
|
];
|
|
@@ -2878,7 +2894,7 @@ class Sale extends Base
|
|
|
|
|
|
$data = [];
|
|
|
foreach ($list as $value) {
|
|
|
- if($value['order_type']==3|| $value['order_type']==4){
|
|
|
+ if($value['order_type']==3){
|
|
|
$goon = Db::name("good_zixun")->where(["spuCode"=>$value['good_code'],"is_del"=>0])->find();
|
|
|
}else {
|
|
|
$goon = Db::name('good_platform')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')
|
|
@@ -3080,7 +3096,7 @@ class Sale extends Base
|
|
|
if ($einfo==false) {
|
|
|
return error_show(1002, "未找到销售订单数据");
|
|
|
}
|
|
|
- if($einfo['order_type']==3|| $einfo['order_type']==4){
|
|
|
+ if($einfo['order_type']==3){
|
|
|
$goon = Db::name("good_zixun")->where(["spuCode"=>$einfo['good_code'],"is_del"=>0])->find();
|
|
|
}else {
|
|
|
$goon = Db::name('good_platform')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')
|
|
@@ -3190,7 +3206,7 @@ class Sale extends Base
|
|
|
$wsmcode = Db::name("warehouse_info")->alias("k")->leftJoin("supplier c", "k.supplierNo=c.code")
|
|
|
->where(["k.wsm_code" => $value['wsm_code']])->field("k.name as wsm_name,c.name,c.code")->find();
|
|
|
$addr = Db::name("order_addr")->where(["id" => $value['addrid']])->find();
|
|
|
- if($value['order_type']==3|| $value['order_type']==4){
|
|
|
+ if($value['order_type']==3){
|
|
|
$goon = Db::name("good_zixun")->where(["spuCode"=>$value['good_code'],"is_del"=>0])->find();
|
|
|
}else {
|
|
|
$goon = Db::name('good_platform')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')
|
|
@@ -3221,7 +3237,7 @@ class Sale extends Base
|
|
|
return error_show(1002, "未找到出库数据");
|
|
|
}
|
|
|
$item = Db::name("sale")->where(['orderCode' => $codeinfo['orderCode']])->find();
|
|
|
- if($item['order_type']==3|| $item['order_type']==4){
|
|
|
+ if($item['order_type']==3){
|
|
|
$goodinfo = Db::name("good_zixun")->where(["spuCode"=>$item['good_code'],"is_del"=>0])->find();
|
|
|
if($goodinfo==false){
|
|
|
return error_show(1004,"未找到商品数据");
|
|
@@ -3437,6 +3453,7 @@ class Sale extends Base
|
|
|
->where('orderCode', $orderCode)
|
|
|
->update([
|
|
|
'order_type' => $der['order_type'],
|
|
|
+ 'order_source' => $der['order_source'],
|
|
|
'cgdNo' => $order['cgdNo'],
|
|
|
'outCode' => $outCode,
|
|
|
'customer_code' => $der['customer_code'],
|
|
@@ -3625,7 +3642,8 @@ class Sale extends Base
|
|
|
"status"=>3,
|
|
|
"lasttime"=>$cgdinfo['lasttime'],
|
|
|
"is_del"=>0,
|
|
|
- "order_type"=>5,
|
|
|
+ "order_type"=>$outinfo['order_type'],
|
|
|
+ "order_source"=>$outinfo['order_source'],
|
|
|
"good_type"=>$cgdinfo['good_type'],
|
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
@@ -3641,6 +3659,7 @@ class Sale extends Base
|
|
|
'cgdNo' => $QrdCgd['cgdNo'],
|
|
|
'spuCode' => $outinfo['spuCode'],
|
|
|
'order_type' => $QrdCgd['order_type'],
|
|
|
+ 'order_source' => $QrdCgd['order_source'],
|
|
|
'supplierNo' => $cgdinfo['supplierNo'],
|
|
|
"companyNo" => $cgdinfo['companyNo'],
|
|
|
// 'addtime' => date('Y-m-d H:i:s'),
|
|
@@ -3668,7 +3687,7 @@ class Sale extends Base
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
- $merge_num = Db::name("purchease_order")->where(["bkcode"=>$cgdinfo['bkcode'],"order_type"=>5,"is_del"=>0])
|
|
|
+ $merge_num = Db::name("purchease_order")->where(["bkcode"=>$cgdinfo['bkcode'],"order_type"=>1,"is_del"=>0])
|
|
|
->field("sum(send_num)-sum(th_num) as num")->find();
|
|
|
$cgd['balance_num']=$cgd['total_num']-$merge_num['num'];
|
|
|
$cgd['merge_num']=$merge_num['num'];
|
|
@@ -3957,7 +3976,7 @@ class Sale extends Base
|
|
|
|
|
|
foreach ($list as &$value) {
|
|
|
|
|
|
- if ($value['order_type'] == 3 || $value['order_type'] == 4) {
|
|
|
+ if ($value['order_type'] == 3) {
|
|
|
$temp = Db::name("good_zixun")
|
|
|
->where(["spuCode" => $value['产品编号'], "is_del" => 0])
|
|
|
->field('id,specinfo,good_unit')
|