|
@@ -15,6 +15,7 @@ class Model_logic_u9action extends Lin_Model {
|
|
|
$this->load->_model("Model_systemtransfer","systemtransfer");
|
|
|
$this->load->_model("Model_shop","shop");
|
|
|
$this->load->_model("Model_zzququeu9_logs","zzququeu9_logs");
|
|
|
+ $this->load->_model('Model_logic_tools','logic_tools');
|
|
|
}
|
|
|
public function getToken($type){
|
|
|
$name = "get_yytoken_".$type;
|
|
@@ -65,14 +66,14 @@ class Model_logic_u9action extends Lin_Model {
|
|
|
|
|
|
}
|
|
|
//进行入库单操作
|
|
|
- private function doRkd($data){
|
|
|
+ public function doRkd($data){
|
|
|
$token = $this->getToken(120);
|
|
|
if(empty($data['child_order_no'])){
|
|
|
$this->editData($data['id'],['bzsh_status'=>-1,'update_time'=>time()],$data['order_no'],20,1,'scrk_cj',$data,[
|
|
|
'code'=>-1,
|
|
|
'msg'=>'没有找到子订单号'
|
|
|
]);
|
|
|
- return ;
|
|
|
+ return $this->logic_tools->ret_arr(-1,"没有找到子订单号");
|
|
|
}
|
|
|
|
|
|
$info = $this->systemtransfer->read($data['child_order_no']);
|
|
@@ -83,7 +84,7 @@ class Model_logic_u9action extends Lin_Model {
|
|
|
'code'=>-1,
|
|
|
'msg'=>'没有找到子订单号'
|
|
|
]);
|
|
|
- return ;
|
|
|
+ return $this->logic_tools->ret_arr(-1,"没有找到子订单号");
|
|
|
}
|
|
|
$sc = explode('~',$info['scid']);
|
|
|
$info['rkid'] = $sc[0];//配货的生产id
|
|
@@ -109,13 +110,15 @@ class Model_logic_u9action extends Lin_Model {
|
|
|
$res = $this->apiyyv1->cprkCreate($params,$token);
|
|
|
if(isset($res[0]['Data'][0]['m_isSucess'])&& $res[0]['Data'][0]['m_isSucess'] == 1){
|
|
|
$this->editData($data['id'],['bzsh_no'=>$res[0]['Data'][0]['m_code'],'bzsh_status'=>1,'update_time'=>time()],$info['number'],20,1,'scrk_cj',$res[1],$res[0]);
|
|
|
+ return $this->logic_tools->ret_arr(1,"成品入库单创建成功");
|
|
|
}else{
|
|
|
$this->editData($data['id'],['bzsh_status'=>-1,'update_time'=>time()],$info['number'],20,1,'scrk_cj',$res[1],$res[0]);
|
|
|
+ return $this->logic_tools->ret_arr(-1,"成品入库单创建失败");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
//对入库单进行检查
|
|
|
- private function checkRkd($info){
|
|
|
+ public function checkRkd($info){
|
|
|
$token = $this->getToken(120);
|
|
|
$params = [
|
|
|
[
|
|
@@ -131,19 +134,21 @@ class Model_logic_u9action extends Lin_Model {
|
|
|
$res = $this->apiyyv1->cprkCx($params,$token);
|
|
|
if(!(isset($res[0]['Data'][0]['m_isSucess']) && $res[0]['Data'][0]['m_isSucess'] == 1)){
|
|
|
//查询失败 这里不做状态变更 只是做记录
|
|
|
- return $this->editData($info['id'],['update_time'=>time()],$info['order_no'],20,2,'scrk_ck',$res[1],$res[0]);
|
|
|
+ $this->editData($info['id'],['update_time'=>time()],$info['order_no'],20,2,'scrk_ck',$res[1],$res[0]);
|
|
|
+ return $this->logic_tools->ret_arr(-1,"成品入库单还未审核,请稍后审核");
|
|
|
}
|
|
|
$res = $this->apiyyv1->cprkApprove($params,$token);
|
|
|
}
|
|
|
//如果再错误就 没办法了
|
|
|
if(isset($res[0]['Data'][0]['m_isSucess']) && $res[0]['Data'][0]['m_isSucess'] == 1){
|
|
|
$this->editData($info['id'],['bzsh_status'=>3,'update_time'=>time()],$info['order_no'],20,3,'scrk_sh',$res[1],$res[0]);
|
|
|
+ return $this->logic_tools->ret_arr(-1,"成品入库单还未审核,请联系到u9核对成品入库单的状态");
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
//进行销售单操作
|
|
|
- private function createXsd($info){
|
|
|
+ public function createXsd($info){
|
|
|
$order_info = $this->logic_order->getInfo('number = "'.$info['order_no'].'"',"number,shop,shouldmoney");
|
|
|
if(empty($order_info)){
|
|
|
return [];
|
|
@@ -167,17 +172,19 @@ class Model_logic_u9action extends Lin_Model {
|
|
|
$res = $this->apiyyv1->gcxsdWaiXiaoCreate($params,$token);
|
|
|
if($res[0]['Data'][0]['m_isSucess'] != 1){
|
|
|
$this->editData($info['id'],['xs_status'=>-1,'update_time'=>time()],$info['order_no'],2,1,'xs',$res[1],$res[0]);
|
|
|
+ return $this->logic_tools->ret_arr(1,"销售单创建成功");
|
|
|
}else{
|
|
|
$this->editData($info['id'],['xs_no'=>$res[0]['Data'][0]['m_code'],'xs_status'=>1,'update_time'=>time()],$info['order_no'],2,1,'xs',$res[1],$res[0]);
|
|
|
+ return $this->logic_tools->ret_arr(-1,"销售单创建失败");
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
- private function checkXsd($info){
|
|
|
+ public function checkXsd($info){
|
|
|
|
|
|
}
|
|
|
|
|
|
//对销售单进行检查 并创建标准出货单
|
|
|
- private function xcXsAndCreateScd($info){
|
|
|
+ public function xcXsAndCreateScd($info){
|
|
|
$token = $this->getToken(120);
|
|
|
$res = $this->apiyyv1->xsdCxByNo($info['xs_no'],$token);
|
|
|
//如果没审核 那么就不管
|
|
@@ -212,7 +219,7 @@ class Model_logic_u9action extends Lin_Model {
|
|
|
'code'=>-1,
|
|
|
'msg'=>'标准出库的信息异常,请查看'
|
|
|
]);
|
|
|
- return ;
|
|
|
+ return $this->logic_tools->ret_arr(-1,"标准出库的信息异常,请查看");
|
|
|
}
|
|
|
$tmp_info = [
|
|
|
'zq_u9_id'=>$info['id'],
|
|
@@ -226,13 +233,15 @@ class Model_logic_u9action extends Lin_Model {
|
|
|
$res = $this->apiyyv1->bzchCreate($tmp_info,$token);
|
|
|
if($res[0]['Data'][0]['m_isSucess'] != 1){
|
|
|
$this->editData($info['id'],['bzch_status'=>-1,'update_time'=>time()],$info['order_no'],5,1,'bzch',$res[1],$res[0]);
|
|
|
+ return $this->logic_tools->ret_arr(-1,"标准出库的信息异常,请查看");
|
|
|
}else{
|
|
|
$this->editData($info['id'],['bzch_no'=>$res[0]['Data'][0]['m_code'],'bzch_status'=>1,'xs_status'=>3,'update_time'=>time()],$info['order_no'],5,1,'bzch',$res[1],$res[0]);
|
|
|
+ return $this->logic_tools->ret_arr(1,"标准出库创建成功");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
//对标准出货单进行审核
|
|
|
- private function checkBzch($info){
|
|
|
+ public function checkBzch($info){
|
|
|
$res = $this->apiyyv1->bzchSubmitAndApprove(['number'=>$info['bzch_no']],$this->getToken(120));
|
|
|
// print_r($res[0]);
|
|
|
// print_r($res[1]);
|