|
@@ -1066,31 +1066,65 @@ class Systemfout extends Start_Controller {
|
|
|
$fullorder_name = $this->input->post('fullorder_name',true);
|
|
|
$outnumber = $this->input->post('outnumber',true);
|
|
|
$post = json_decode($post,true);
|
|
|
- $this->$fullorder_name->save($post,$outnumber);
|
|
|
-
|
|
|
- if($fullorder_name != 'fullorderxw'){
|
|
|
- // if(($item['warehouse'] != 5) || ($item['warehouse'] != 7) || ($item['warehouse'] != 8) || ($item['warehouse'] != 9) ){
|
|
|
- // $this->zzquque_u9->insert($item);
|
|
|
- // }
|
|
|
- $y = $this->$fullorder_name->read($outnumber);
|
|
|
- if( !in_array($y['type'],[5,7,8,9]) ){
|
|
|
- $data = [
|
|
|
- 'platform'=>$fullorder_name,
|
|
|
- 'warehouse'=>$y['type'],
|
|
|
- 'type'=>($y['type'] == 5)?11:10, //5代表美仓
|
|
|
- 'order_no'=>$y['number'],
|
|
|
- 'status'=>0,
|
|
|
- 'create_time'=>time(),
|
|
|
- 'update_time'=>time(),
|
|
|
- ];
|
|
|
- $this->zzquque_u9->insert($data);
|
|
|
+ $y = $this->$fullorder_name->read($outnumber);
|
|
|
+ if(empty($y)){
|
|
|
+ echo json_encode(array('msg'=>'订单异常不能出库','success'=>false));exit;
|
|
|
+ }
|
|
|
+ $warehouse = $this->warehouse->read($y['type']);
|
|
|
+ if(empty($warehouse)){
|
|
|
+ echo json_encode(array('msg'=>'仓库异常不能出库','success'=>false));exit;
|
|
|
+ }
|
|
|
+ if($y['library']== 2){
|
|
|
+ echo json_encode(array('msg'=>'订单已出库,请勿重复出库','success'=>false));exit;
|
|
|
+ }
|
|
|
+ if($y['library']== 3){
|
|
|
+ echo json_encode(array('msg'=>'订单已退库,请勿重复出库','success'=>false));exit;
|
|
|
+ }
|
|
|
+ $bdck = $warehouse['bdck'];
|
|
|
+ // $warehouse = $this->warehouse->read($y['type']);
|
|
|
+ $list = $this->$bdck->find_all("zd = '".$y['number']."' and warehouse = '".$y['type']."' and (state = '0' or state = '9')");
|
|
|
+ $this->db->trans_begin();
|
|
|
+ foreach ($list as $v)
|
|
|
+ {
|
|
|
+ $this->$bdck->save(array('state'=>1,'cktype'=>1,'orderinfo'=>$y['orderinfo'],'waybill'=>$y['waybill'],'outk'=>$post['librarytime'],'time'=>$post['librarytime']),$v['id']);
|
|
|
+ }
|
|
|
+ $this->$fullorder_name->save($post,$y['id']);
|
|
|
+ if ($this->db->trans_status() === TRUE)
|
|
|
+ {
|
|
|
+ $this->db->trans_commit();
|
|
|
+ if($fullorder_name != 'fullorderxw'){
|
|
|
+ // if(($item['warehouse'] != 5) || ($item['warehouse'] != 7) || ($item['warehouse'] != 8) || ($item['warehouse'] != 9) ){
|
|
|
+ // $this->zzquque_u9->insert($item);
|
|
|
+ // }
|
|
|
+ $y = $this->$fullorder_name->read($outnumber);
|
|
|
+ if( !in_array($y['type'],[5,7,8,9]) ){
|
|
|
+ $data = [
|
|
|
+ 'platform'=>$fullorder_name,
|
|
|
+ 'warehouse'=>$y['type'],
|
|
|
+ 'type'=>($y['type'] == 5)?11:10, //5代表美仓
|
|
|
+ 'order_no'=>$y['number'],
|
|
|
+ 'status'=>0,
|
|
|
+ 'create_time'=>time(),
|
|
|
+ 'update_time'=>time(),
|
|
|
+ ];
|
|
|
+ $this->zzquque_u9->insert($data);
|
|
|
+ }
|
|
|
}
|
|
|
+ echo json_encode(array('success'=>true));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $this->db->trans_rollback();
|
|
|
+ echo json_encode(array('msg'=>'出库失败,请重试','success'=>false));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
public function _fout_db($y,$warehouse,$bdck)//对比占单是否正确
|
|
|
{
|
|
|
+
|
|
|
$wh = $this->$bdck->find_all("zd = '".$y['number']."' and warehouse = '".$y['type']."' and (state = '0' or state = '9')");
|
|
|
$cpsl = 0;
|
|
|
$pp = explode('|',trim($y['whlabel'],'|'));
|