|
@@ -313,12 +313,56 @@ class Model_logic_u9xgsd extends Lin_Model {
|
|
return $this->logic_tools->ret_arr(1,"审核销售单成功");
|
|
return $this->logic_tools->ret_arr(1,"审核销售单成功");
|
|
}
|
|
}
|
|
//创建关联销售单
|
|
//创建关联销售单
|
|
- public function createXsTwo($tmp_info){
|
|
|
|
- $info = $this->logic_order->getInfoByPlat($tmp_info['platform'],$tmp_info['order_no']);
|
|
|
|
- $info['zq_u9_id'] = $tmp_info['id'];
|
|
|
|
- $dc_params = $this->createData($info);
|
|
|
|
- //创建香港仓的销售单
|
|
|
|
- $xsd_res = $this->apiyyv1->xsdCreate($dc_params,$this->getToken(140));
|
|
|
|
|
|
+ public function createXsTwo($info){
|
|
|
|
+ $time = time();
|
|
|
|
+ if(empty($info['dc_data'])){
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
|
|
+ $tmp_list = json_decode($info['dc_data'],true);
|
|
|
|
+ if(empty($tmp_list)){
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
|
|
+ $total_goods_num = 0;//订单产品总数量
|
|
|
|
+ foreach($tmp_list as $k=>$v){
|
|
|
|
+ $total_goods_num += $v['costuomqty'];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $avg_price = floor(($info['shouldmoney']*1000)/$total_goods_num)/1000;
|
|
|
|
+ $list = [];
|
|
|
|
+ foreach($tmp_list as $k=>$v){
|
|
|
|
+ $list[] = [
|
|
|
|
+ 'jm'=>$v['iteminfo_itemcode'],
|
|
|
|
+ 'zh'=>$v['iteminfo_itemname'],
|
|
|
|
+ 'final_price'=>$avg_price,//目前先不设置 等后期财务说了再说
|
|
|
|
+ 'dcsl'=>$v['costuomqty'],
|
|
|
|
+ 'is_register'=>0,//商品是否被注册 先都当没注册 后面会先确认下
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $dc_params = [
|
|
|
|
+ 'gys'=>$this->gys,//供应商
|
|
|
|
+ 'number'=>$info['number'],//erp订单编码
|
|
|
|
+ "TransOutDocType_Code"=>"TransOut001",//组织间调拨
|
|
|
|
+ "time"=>$time,
|
|
|
|
+ 'TransferDirection'=>0,//普通
|
|
|
|
+ 'yyid'=>$tmp_list[0]['descflexfield_pubdescseg2'],//来源店铺 这种需要在店铺表中有
|
|
|
|
+ 'shipremarks'=>$tmp_list[0]['descflexfield_pubdescseg5'],//订单的备注
|
|
|
|
+ 'dcckbm'=>$this->xdcp_code,//调出仓库编码
|
|
|
|
+ 'drckbm'=>$this->xdxgls_code,//调入仓库编码
|
|
|
|
+ 'drzz_code'=>$this->xdxgzzcode,//调入组织Code
|
|
|
|
+ 'owner_code'=>$this->xdzzcode,//货主组织Code
|
|
|
|
+ 'ztcode'=>$this->ztcode,//账套
|
|
|
|
+ 'tb_org_arr'=>$this->tb_org_arr,//要同步的组织列表
|
|
|
|
+ 'list'=>$list
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ echo "<pre>";
|
|
|
|
+ var_dump($dc_params);
|
|
|
|
+ die;
|
|
|
|
+ //创建香港仓的销售单
|
|
|
|
+ $xsd_res = $this->apiyyv1->xsdTwoCreate($dc_params,$this->getToken(140));
|
|
|
|
|
|
if(empty($xsd_res[0]['Data'][0]['m_code'])){
|
|
if(empty($xsd_res[0]['Data'][0]['m_code'])){
|
|
$this->editData($info['zq_u9_id'],['xs_two_status'=>-1,'update_time'=>time()],$info['number'],7,1,'xs_two',$xsd_res[1],$xsd_res[0]);
|
|
$this->editData($info['zq_u9_id'],['xs_two_status'=>-1,'update_time'=>time()],$info['number'],7,1,'xs_two',$xsd_res[1],$xsd_res[0]);
|