|
@@ -7,7 +7,7 @@ class Model_logic_u9xg extends Lin_Model {
|
|
|
public $xdcp_code = '13001';//许昌成品库的编码 测试的时候就用龙盈工厂的仓库
|
|
|
public $xdxgzzcode = '140';//香港组织公司编码
|
|
|
public $xdxgls_code = '14003';//香港临时库的编码 测试的时候用销售公司成品库的编码
|
|
|
- public $ztcode = '001';//账套的code;
|
|
|
+ public $ztcode = '9966';//账套的code;
|
|
|
public $tb_org_arr =[101,110,130,140];//同步组织
|
|
|
public $gys = "98002";//供应商 98001 龙盈 98002 龙熠
|
|
|
//切记要修改token_120的token真正的token!!!!
|
|
@@ -70,22 +70,16 @@ class Model_logic_u9xg extends Lin_Model {
|
|
|
//查询调出单生成的调入单是否生成 如果生成了就审核 如果没生成 说明异常了 这种都是按步骤走的
|
|
|
public function xdlsThreeStep($list){
|
|
|
foreach($list as $k=>$v){
|
|
|
- $r = $this->apiyyv1->drdcxBydcd($v['order_no'],$this->getToken(140));
|
|
|
+ $r = $this->apiyyv1->drdcxBydcd($v['dc_no'],$this->getToken(140));
|
|
|
+
|
|
|
//如果获取对应调入单没有成功
|
|
|
if(empty($r[0]['Data'][0]['docno'])){
|
|
|
$this->editData($v['id'],['dr_status'=>-1,'update_time'=>time()],$v['order_no'],6,1,'dr',$r[1],$r[0]);
|
|
|
continue;
|
|
|
}
|
|
|
- if(count($r[0]['Data'])>1){
|
|
|
- foreach($r[0]['Data'] as $item){
|
|
|
- if($item['descflexfield_pubdescseg4'] == $v['order_no']){
|
|
|
- $dr_no = $item['docno'];
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- $dr_no = $r[0]['Data'][0]['docno'];
|
|
|
- }
|
|
|
- $this->editData($v['id'],['dr_no'=>$r[0]['Data'][0]['docno'],'dr_status'=>1,'update_time'=>time()],$v['order_no'],6,1,'dr',$r[1],$r[0]);
|
|
|
+ $dr_no = $r[0]['Data'][0]["docno"];
|
|
|
+
|
|
|
+ $this->editData($v['id'],['dr_no'=>$dr_no,'dr_status'=>1,'update_time'=>time()],$v['order_no'],6,1,'dr',$r[1],$r[0]);
|
|
|
|
|
|
//提交调入单
|
|
|
$rr = $this->apiyyv1->drdSubmit(['number'=>$dr_no],$this->getToken(140));
|
|
@@ -135,38 +129,48 @@ class Model_logic_u9xg extends Lin_Model {
|
|
|
'zq_u9_id'=>$item['id'],
|
|
|
'drckbm'=>$this->xdxgls_code,
|
|
|
'number'=>$item['order_no'],
|
|
|
+ 'order_no'=>$item['order_no'],
|
|
|
'xs_no'=>$k,
|
|
|
- 'xs_no_two'=>$k,
|
|
|
+ 'xs_two_no'=>$k,
|
|
|
'list'=>$v
|
|
|
];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
foreach($final_list as $info){
|
|
|
- $bzch_res = $this->apiyyv1->bzchCreate($info,$this->getToken(140));
|
|
|
- if(empty($bzch_res[0]['Data'][0]['m_code'])){
|
|
|
- $this->editData($info['zq_u9_id'],['bzch_status'=>-1,'update_time'=>time()],$info['number'],4,1,'bzch',$bzch_res[1],$bzch_res[0]);
|
|
|
- return ;
|
|
|
- }
|
|
|
-
|
|
|
- //更新销售单数据
|
|
|
- $bzch_no = $bzch_res[0]['Data'][0]["m_code"];
|
|
|
- $this->editData($info['zq_u9_id'],['bzch_no'=>$bzch_no,'bzch_status'=>1,'update_time'=>time()],$info['number'],4,1,'bzch',$bzch_res[1],$bzch_res[0]);
|
|
|
+ $this->xdlsFiveStepAfter($info);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ public function xdlsFiveStepAfter($info){
|
|
|
+ //先审核 然后在执行
|
|
|
+ $r = $this->xsSubAndCheck140($info);
|
|
|
+ if(!$r){
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ $bzch_res = $this->apiyyv1->bzchCreate($info,$this->getToken(140));
|
|
|
+ if(empty($bzch_res[0]['Data'][0]['m_code'])){
|
|
|
+ $this->editData($info['zq_u9_id'],['bzch_status'=>-1,'update_time'=>time()],$info['number'],4,1,'bzch',$bzch_res[1],$bzch_res[0]);
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新销售单数据
|
|
|
+ $bzch_no = $bzch_res[0]['Data'][0]["m_code"];
|
|
|
+ $this->editData($info['zq_u9_id'],['bzch_no'=>$bzch_no,'bzch_status'=>1,'update_time'=>time()],$info['number'],4,1,'bzch',$bzch_res[1],$bzch_res[0]);
|
|
|
+ }
|
|
|
//审核香港标准出库单
|
|
|
public function xdlsSixStep($list){
|
|
|
foreach($list as $k =>$v){
|
|
|
$bzch_res = $this->apiyyv1->bzchSubmitAndApprove(['number'=>$v['bzch_no']],$this->getToken(140));
|
|
|
if(empty($bzch_res[0]['Data'][0]['m_code'])){
|
|
|
- $this->editData($v['id'],['bzch_status'=>-1,'update_time'=>time()],$v['order_no'],4,3,'bzch',$bzch_res[1],$bzch_res[0]);
|
|
|
+ $this->editData($v['id'],['bzch_status'=>-3,'update_time'=>time()],$v['order_no'],4,3,'bzch',$bzch_res[1],$bzch_res[0]);
|
|
|
return ;
|
|
|
}
|
|
|
//更新销售单数据
|
|
|
$bzch_no = $bzch_res[0]['Data'][0]["m_code"];
|
|
|
- $this->editData($v['id'],['bzch_no'=>$bzch_no,'bzch_status'=>1,'update_time'=>time()],$v['order_no'],4,3,'bzch',$bzch_res[1],$bzch_res[0]);
|
|
|
+ $this->editData($v['id'],['bzch_no'=>$bzch_no,'bzch_status'=>3,'update_time'=>time()],$v['order_no'],4,3,'bzch',$bzch_res[1],$bzch_res[0]);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -352,6 +356,27 @@ class Model_logic_u9xg extends Lin_Model {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ public function xsSubAndCheck140($info){
|
|
|
+ $r = $this->apiyyv1->xsdSubmit([
|
|
|
+ 'number'=>$info['xs_two_no']
|
|
|
+ ],$this->getToken(140));
|
|
|
+
|
|
|
+ if(!$r[0]['Data'][0]['m_isSucess']){
|
|
|
+ $this->editData($info['zq_u9_id'],['xs_two_status'=>-2,'update_time'=>time()],$info['order_no'],2,2,'xs',$r[1],$r[0]);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $this->editData($info['zq_u9_id'],['xs_two_status'=>2,'update_time'=>time()],$info['order_no'],2,2,'xs',$r[1],$r[0]);
|
|
|
+ $rr = $this->apiyyv1->xsdApprove([
|
|
|
+ 'number'=>$info['xs_two_no']
|
|
|
+ ],$this->getToken(140));
|
|
|
+ if(!$rr[0]['Data'][0]['m_isSucess']){
|
|
|
+ $this->editData($info['zq_u9_id'],['xs_two_status'=>-3,'update_time'=>time()],$info['order_no'],2,3,'xs',$rr[1],$rr[0]);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $this->editData($info['zq_u9_id'],['xs_two_status'=>3,'update_time'=>time()],$info['order_no'],2,3,'xs',$rr[1],$rr[0]);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
//建立销售单 和出货单
|
|
|
public function xdlsAfterDetail($info,$typeclass,$classid){
|
|
|
|
|
@@ -394,7 +419,7 @@ class Model_logic_u9xg extends Lin_Model {
|
|
|
$shop = $this->shop->read($info['shop']);
|
|
|
if(empty($shop['yyid'])){
|
|
|
//如果没有在u9上设置店铺的组织 那么需要设置
|
|
|
- $this->editData($info['zq_u9_id'],['dc_status'=>-1,'update_time'=>time()],$info['number'],1,1,'',[],$this->logic_tools->ret_arr(-1,'店铺没有在u9平台设置参数'));
|
|
|
+ $this->editData($info['zq_u9_id'],['xs_two_status'=>-1,'update_time'=>time()],$info['number'],1,1,'',[],$this->logic_tools->ret_arr(-1,'店铺没有在u9平台设置参数'));
|
|
|
return ;
|
|
|
}
|
|
|
|