Commit 9d8ac1c4 by Joneq

完成信息

parent 56e21dd1
......@@ -11,7 +11,7 @@ SYSTEM_NAME=服务初始服务(开发环境)
//laravels监听IP和端口
LARAVELS_LISTEN_IP=0.0.0.0
LARAVELS_LISTEN_PORT=40001
LARAVELS_LISTEN_PORT=40003
//进程数(线上建议开8个)
worker_num = 3
......
<?php
/**
* Created by 2020/5/8.
* User: Joneq
* Info: 2020/5/8
* Time: 上午10:04
*/
namespace App\Http\Controllers;
use App\Http\Model\Logic\PalletLogic;
use App\Http\Model\Logic\PickTaskLogic;
use Illuminate\Http\Request;
class AdminOutstoreController extends Controller
{
public function Entrance(Request $request, $id)
{
self::$errCode = 0;
self::$level = 1;
return $this->$id($request, $id);
}
//拣货任务生成
public function pickTaskActive($request)
{
$data = $request->all();
try{
$returnData = (new PickTaskLogic())->pickTaskActive($data);
}catch (\Exception $exception){
return $this->apiReturn($exception->getMessage().'|jsondata='.json_encode($data));
}
return $this->apiReturn($returnData);
}
//确认拣货
public function confirmPick($request)
{
$data = $request->all();
try{
$returnData = (new PickTaskLogic())->confirmPick($data);
}catch (\Exception $exception){
return $this->apiReturn($exception->getMessage().'|jsondata='.json_encode($data));
}
return $this->apiReturn($returnData);
}
//取消拣货
public function cancelPick($request)
{
$data = $request->all();
try{
$returnData = (new PickTaskLogic())->cancelPick($data);
}catch (\Exception $exception){
return $this->apiReturn($exception->getMessage().'|jsondata='.json_encode($data));
}
return $this->apiReturn($returnData);
}
//出库确认
public function confirmOutStore($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->confirmOutStore($data);
}catch (\Exception $exception){
return $this->apiReturn($exception->getMessage().'|jsondata='.json_encode($data));
}
return $this->apiReturn($returnData);
}
//出库取消
public function cancelOutStore($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->cancelOutStore($data);
}catch (\Exception $exception){
return $this->apiReturn($exception->getMessage().'|jsondata='.json_encode($data));
}
return $this->apiReturn($returnData);
}
//发货
public function deliverGoods($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->deliverGoods($data);
}catch (\Exception $exception){
return $this->apiReturn($exception->getMessage().'|jsondata='.json_encode($data));
}
return $this->apiReturn($returnData);
}
//装箱
public function packCheck($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->packCheck($data);
}catch (\Exception $exception){
return $this->apiReturn($exception->getMessage().'|jsondata='.json_encode($data));
}
return $this->apiReturn($returnData);
}
}
\ No newline at end of file
......@@ -8,12 +8,16 @@
namespace App\Http\Controllers;
use App\Http\Model\Logic\PalletLogic;
use App\Http\Model\Logic\PickTaskLogic;
use Illuminate\Http\Request;
use App\Http\Model\Logic\OutStoreLogic;
class OutstoreController extends Controller
{
public function Entrance(Request $request, $id)
{
self::$errCode = 0;
self::$level = 1;
return $this->$id($request, $id);
}
......@@ -25,7 +29,109 @@ class OutstoreController extends Controller
$inserData = OutStoreLogic::handleInsertData($data);
$returnData = OutStoreLogic::insertData($inserData);
}catch (\Exception $exception){
self::$errCode = 101;
return $this->apiReturn($exception->getMessage().'|jsondata='.json_encode($data));
}
return $this->apiReturn($returnData);
}
//获取当前卡板箱子信息
public function palletBoxList($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->palletBoxList($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//扫描出库列表
public function scan_out_store_list($request)
{
$data = $request->all();
try{
$returnData = (new PickTaskLogic())->getPickTaskDetailList($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//确认出库
public function confirm_out_store($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->confirmOutStore($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//取消出库
public function cancel_out_store($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->cancelOutStore($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//发货
public function deliver_goods($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->deliverGoods($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//装卡板
public function palletActive($request)
{
$data = $request->all();
try{
$returnData = (new PalletLogic())->palletActive($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//获取箱子信息
public function get_box_info($request)
{
$data = $request->all();
try{
$returnData = [
'box_sn'=>'XB12313',
'box_status'=>1,
'detail'=>[
['goods_name'=>'2131','number'=>1],
['goods_name'=>'2131','number'=>1],
['goods_name'=>'2131','number'=>1],
]
];
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
......
......@@ -7,6 +7,7 @@
*/
namespace App\Http\Controllers;
use App\Http\Model\Logic\CommonLogic;
use App\Http\Model\Logic\PickTaskLogic;
use Illuminate\Http\Request;
......@@ -15,6 +16,8 @@ class PicktaskController extends Controller
{
public function Entrance(Request $request, $id)
{
self::$errCode = 0;
self::$level = 1;
return $this->$id($request, $id);
}
......@@ -28,9 +31,53 @@ class PicktaskController extends Controller
$inserData = PickTaskLogic::handleInsertData($data);
$returnData = PickTaskLogic::insertData($inserData);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//获取前端拣货任务列表
public function getFrontPickTaskList($request)
{
$data = $request->all();
try{
$returnData = (new PickTaskLogic())->getFrontPickTaskList($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//确认拣货
public function confirmPick($request)
{
$data = $request->all();
try{
$returnData = (new PickTaskLogic())->confirmPick($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
//取消
public function cancelPick($request)
{
$data = $request->all();
try{
$returnData = (new PickTaskLogic())->cancelPick($data);
}catch (\Exception $exception){
if (empty(self::$errCode))self::$errCode=101;
return $this->apiReturn($exception->getMessage());
}
return $this->apiReturn($returnData);
}
}
\ No newline at end of file
<?php
/**
* Created by 2020/4/26.
* User: Joneq
* Info: 2020/4/26
* Time: 下午3:22
*/
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
class CustomerModel extends Model
{
protected $connection = 'mysql';
protected $table = 'customer';
protected $primaryKey = 'customer_id';
public $timestamps = false;
}
\ No newline at end of file
<?php
/**
* Created by 2020/4/26.
* User: Joneq
* Info: 2020/4/26
* Time: 下午4:56
*/
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
class GoodsModel extends Model
{
protected $connection = 'mysql';
protected $table = 'goods';
protected $primaryKey = 'goods_id';
public $timestamps = false;
}
\ No newline at end of file
<?php
/**
* Created by 2020/4/26.
* User: Joneq
* Info: 2020/4/26
* Time: 下午3:20
*/
namespace App\Http\Model\Logic;
use App\Http\Controllers\Controller;
class CommonLogic
{
//检测值是否为空
static public function checkEmpty($key,$data)
{
foreach ($key as $value){
if (!isset($data[$value]) || empty($data[$value])){
Controller::$level = 5;
Controller::$errCode = 1;
throw new \Exception($value.'is null');
}
}
}
//生成可预览时间
static public function getDataTime($time,$title='暂未生成时间')
{
if (empty($time)){
return $title;
}
return date('Y-m-d H:i:s',$time);
}
static public function getHaveKeyCn($value)
{
foreach ($value as $key=>$keyId){
$cn = self::getSqlKeyCn($key,$keyId);
if (is_string($cn)){
$value[$key."_cn"] = $cn;
}
}
return $value;
}
//获取sqlid的中文
static public function getSqlKeyCn($key,$value)
{
$title = '';
switch ($key){
case 'delivery_id'://发货人员
case 'admin_id'://根据id获取人员姓名
case 'pick_user_id'://拣货人
case 'confirm_user_id'://确认人
$title='该人暂未录入';
$value = 0;break;
case 'store_id'://根据仓库IDid获取名称
$title='该仓库暂未录入';
$value = 0;break;
case 'out_store_status':
$value = OutStoreLogic::getOutStoreStatus($value);break;
case 'receive_status':
$value = OutStoreLogic::getReceiveStatus($value);break;
case 'pick_status':
$value = PickTaskLogic::getPickStatus($value);break;
case 'pack_status':
$value = PackCheckLogic::getStatus($value);break;
case 'goods_id'://根据物料id获取物料编码
$title='该物料暂未录入';
$value = 0;break;
case 'delivery_type'://根据发货方式ID获取名称
$title='该发货方式暂未录入';
$value = 0;break;
case 'goods_name'://获取型号方式
$title='该型号暂未录入';
$value = 0;break;
case 'brand_name'://根据品牌IDid获取名称
$title='该品牌暂未录入';
$value = 0;break;
case 'pallet_id'://根据卡板IDid获取名称box_id
$title='该卡板暂未录入';
$value = 0;break;
case 'box_id'://根据卡板IDid获取名称
$title='该箱号暂未录入';
$value = 0;break;
case 'location_id'://根据货位id获取名称
$title='该货位暂未录入';
$value = 0;break;
case 'add_time':
case 'last_update_time':
case 'delivery_time':
case 'pick_time':
case 'confirm_time':
$value = self::getDataTime($value);break;
case 'is_apply_customs':
case 'is_need_pallet':
$value = $value?'是':'否';break;
case 'is_confirm':
$value = $value?'已确认':'未确认';break;
default:
break;
}
if ($title){
return $title;
}
return $value;
}
}
\ No newline at end of file
......@@ -8,35 +8,128 @@
namespace App\Http\Model\Logic;
use App\Http\Controllers\OutstoreController;
use App\Http\Controllers\Controller;
use App\Http\Model\CustomerModel;
use App\Http\Model\GoodsModel;
use App\Http\Model\OutStoreDetailModel;
use App\Http\Model\OutStoreModel;
use App\Http\Model\PickTaskDetailModel;
use App\Http\Model\PickTaskModel;
use App\Http\Model\StockModel;
use App\Http\Model\StoreModel;
use Illuminate\Support\Facades\DB;
class OutStoreLogic
{
static public $statusCn = [
'1'=>'未发货',
'2'=>'部分发货',
'3'=>'已发货',
];
static public $receiveStatusCn = [
'1'=>'未收货',
'2'=>'部分收货',
'3'=>'全部收货',
];
static public function getOutStoreStatus($status)
{
return array_get(self::$statusCn,$status,'状态异常!!');
}
static public function getReceiveStatus($status)
{
return array_get(self::$receiveStatusCn,$status,'状态异常!!');
}
static public function handleInsertData($data)
{
unset($data['unique']);
CommonLogic::checkEmpty(['erp_client_sn','erp_store_sn'],$data);
//判断该入库单号是否拥有
if (!empty(OutStoreModel::where('warehousing_sn',$data['warehousing_sn'])->value('out_store_id'))){
throw new \Exception('该入库单号已经存在');
Controller::$level = 5;Controller::$errCode = 2;
throw new \Exception('该入库单号已经存在'.$data['warehousing_sn']);
}
//判断入库详情是否为空
if(!isset($data['out_store_detail']) || empty($data['out_store_detail'])){
Controller::$level = 5;
Controller::$errCode = 3;
throw new \Exception('出库详情为空');
}
if (empty($data['customer_id'] = CustomerModel::where('erp_client_sn',$data['erp_client_sn'])->value('customer_id'))){
Controller::$level = 5;
Controller::$errCode = 4;
throw new \Exception('erp_client_sn 查询不到customer_id');
}
if (empty($data['store_id'] = StoreModel::where('erp_store_sn',$data['erp_store_sn'])->value('store_id'))){
Controller::$level = 5;
Controller::$errCode = 4;
throw new \Exception('erp_store_sn 查询不到store_id');
}
$data['out_store_sn'] = self::getOutStoreSn();
$data['add_time'] = time();
unset($data['unique']);
unset($data['erp_client_sn']);
unset($data['erp_store_sn']);
return $data;
}
//处理出库详情里面的插入数据
static public function handleOutStoreDetailInsertData($value,$outStoreData)
{
//获取erp的goodsid
if (!isset($value['erp_goods_id']) || empty($goodsInfo = GoodsModel::where('erp_goods_id',$value['erp_goods_id'])->first())){
Controller::$level = 5;
Controller::$errCode = 4;
throw new \Exception('erp_goods_id 查询不到商品id');
}
unset($value['erp_goods_id']);
//获取erp的goodsid
if (empty($stockInfo = StockModel::where('goods_id',$goodsInfo->goods_id)->orderBy('stock_id','desc')->first())){
Controller::$level = 5;
Controller::$errCode = 4;
throw new \Exception('goods_id查询不到商品库存信息'.$goodsInfo->goods_id);
}
$value['goods_id'] = $goodsInfo->goods_id;
$value['brand_id'] = $goodsInfo->brand_id;
//TODO 定位数据获取
$value['box_id'] = $stockInfo->box_id;
$value['pallet_id'] = $stockInfo->pallet_id;
$value['country_code'] = $stockInfo->country_id;
$value['batch'] = $stockInfo->batch;
$value['dc'] = $stockInfo->dc;
//获取入库单主单数据
$value['out_store_id'] = $outStoreData['out_store_id'];
$value['add_time'] = $outStoreData['add_time'];
$value['warehousing_sn'] = $outStoreData['warehousing_sn'];
$value['out_store_sn'] = $outStoreData['out_store_sn'];
$value['is_apply_customs'] = $outStoreData['is_apply_customs'];
unset($value['brand_name']);
return $value;
}
//增加数据
static public function insertData($insertData)
......@@ -51,32 +144,41 @@ class OutStoreLogic
unset($insertData['out_store_detail']);
//新增出库单
$outStoreId = OutStoreModel::insertGetId($insertData);
$outStoreId = $insertData['out_store_id'] = OutStoreModel::insertGetId($insertData);
//新增出库任务
$pickTaskId = PickTaskModel::insertGetId([
'pick_task_sn'=>PickTaskLogic::getPickTaskSn(),'warehousing_sn'=>$insertData['warehousing_sn'],
'out_store_id'=>$outStoreId,'store_id'=>$insertData['store_id'],'add_time'=>$insertData['add_time']
'out_store_id'=>$outStoreId,'store_id'=>$insertData['store_id'],//TODO
'add_time'=>$insertData['add_time']
]);
//判断是否商检,只要一个是就就是
$isInsp = 0;
//新增出库单详情
foreach ($detailDaata as $value){
$outStoreDetailId = OutStoreDetailModel::insertGetId(array_merge($value,[
'out_store_id'=>$outStoreId,'add_time'=>$insertData['add_time']
]));
//不需要报关才生成任务
if (empty($value['is_apply_customs'])){
PickTaskDetailModel::insertGetId(PickTaskLogic::handleInsertData([
'out_store_id'=>$outStoreId,'out_store_detail_id'=>$outStoreDetailId,
'pick_task_id'=>$pickTaskId
]));
if ($value['is_insp'] && !$isInsp){
OutStoreModel::where('out_store_id',$outStoreId)->update(['is_insp'=>1]);
}
$outStoreDetailId = OutStoreDetailModel::insertGetId(array_merge(self::handleOutStoreDetailInsertData($value,$insertData),['pick_task_id'=>$pickTaskId]));
//is_apply_customs报关任务默认隐藏
PickTaskDetailModel::insertGetId(PickTaskLogic::handleInsertData([
'out_store_id'=>$outStoreId,'out_store_detail_id'=>$outStoreDetailId,
'pick_task_id'=>$pickTaskId,'is_show'=>empty($insertData['is_apply_customs'])?1:0
]));
}
DB::commit();
}catch (\Exception $exception){
DB::rollBack();
throw new \Exception($exception->getMessage());
Controller::$level = 5;
Controller::$errCode = 5;
throw new \Exception('插入出库事物错误数据为 '.$exception->getMessage());
}
return [];
}
......
<?php
/**
* Created by 2020/4/28.
* User: Joneq
* Info: 2020/4/28
* Time: 下午4:35
*/
namespace App\Http\Model\Logic;
class PackCheckLogic
{
static public $statusCn = [
1=>'未打包复核',
2=>'部份打包复核',
3=>'完全打包复核',
];
static public function getStatus($status)
{
if (empty($status)){
return '暂无该种状态';
}
return array_get(self::$statusCn,$status,'状态异常!!');
}
}
\ No newline at end of file
<?php
/**
* Created by 2020/4/28.
* User: Joneq
* Info: 2020/4/28
* Time: 下午6:09
*/
namespace App\Http\Model\Logic;
use App\Http\Model\OutStoreDetailModel;
use App\Http\Model\PickTaskDetailModel;
use Illuminate\Support\Facades\DB;
class PalletLogic
{
public function palletBoxList($data)
{
//TODO查找出pallet_id
$data['pallet_id'] = 1;
$palletData = OutStoreDetailModel::where('pallet_id',$data['pallet_id'])->select('box_id','pallet_id')->get();
if (empty($palletData)){
return [];
}
$palletData = $palletData->toArray();
foreach ($palletData as $key=>$val){
$boxInfo = DB::table('box')->where('box_id',$val['box_id'])->first();
$palletInfo = DB::table('pallet')->where('pallet_id',$val['pallet_id'])->first();
$palletData[$key]['box_sn'] = $boxInfo->box_sn;
$palletData[$key]['pallet_sn'] = $palletInfo->pallet_sn;
$palletData[$key]['box_status'] = $boxInfo->status;
$palletData[$key]['pallet_status'] = $palletInfo->status;
}
return $palletData;
}
public function palletActive($data)
{
//TODO查找出pallet_id
$data['pallet_id'] = 1;
OutStoreDetailModel::whereIn('box_id',$data['box_id_arr'])->update(['pallet_id'=>$data['pallet_id']]);
return [];
}
//确认出库
public function confirmOutStore($data)
{
//获取需要修改的货品
if ($data['out_store_detail_id'] == 'all'){
$outStoreDetailIdArr = OutStoreDetailModel::where('out_store_id',$data['out_store_id'])->pluck('out_store_detail_id');
}else{
$outStoreDetailIdArr = [$data['out_store_detail_id']];
}
PickTaskDetailModel::whereIn('out_store_detail_id',$outStoreDetailIdArr)->update(['pick_status'=>4,'is_confirm'=>1]);
return [];
}
//取消出库
public function cancelOutStore($data)
{
//获取需要修改的货品
if ($data['out_store_detail_id'] == 'all'){
$outStoreDetailIdArr = OutStoreDetailModel::where('out_store_id',$data['out_store_id'])->pluck('out_store_detail_id');
}else{
$outStoreDetailIdArr = [$data['out_store_detail_id']];
}
PickTaskDetailModel::whereIn('out_store_detail_id',$outStoreDetailIdArr)->update(['pick_status'=>4,'is_confirm'=>0]);
return [];
}
//发货
public function deliverGoods($data)
{
if (empty($pickTaskDetailIdArr = explode(',',$data['pick_task_detail_id_str']))){
throw new \Exception('参数不完整');
}
//查找出所有的拣货详情
$outStoreDetailIdArr = PickTaskDetailModel::whereIn('pick_task_detail_id',$pickTaskDetailIdArr)->pluck('out_store_detail_id')->toArray();
if (empty($outStoreDetailIdArr)){
throw new \Exception('查找不到拣货详情');
}
//是否需要报关
if (OutStoreDetailModel::whereIn('out_store_detail_id',$outStoreDetailIdArr)->value('is_apply_customs') && (empty($data['weigh_val']))){
throw new \Exception('报关单据不可在此发货');
}
//查询状态
$packStatus = PickTaskDetailModel::whereIn('pick_task_detail_id',$pickTaskDetailIdArr)->pluck('pack_status');
$packStatus = array_filter($packStatus);
if (count($packStatus) > 1 || $packStatus[0] != 2){
throw new \Exception('单据存在已发货的记录,不可重复操作');
}
PickTaskDetailModel::wherIn('pick_task_detail_id',$pickTaskDetailIdArr)->update(['pack_status'=>4]);
OutStoreDetailModel::whereIn('out_store_detail_id',$outStoreDetailIdArr)->update([
'express_company'=>$data['express_company'],
'express_num'=>$data['express_num']
]);
//修改发货
return [];
}
//装箱
public function packCheck($data)
{
if (empty($pickTaskDetailIdArr = explode(',',$data['pick_task_detail_id_str']))){
throw new \Exception('装箱型号不能为空');
}
//查找出所有的拣货详情
$outStoreDetailIdArr = PickTaskDetailModel::whereIn('pick_task_detail_id',$pickTaskDetailIdArr)->pluck('out_store_detail_id')->toArray();
if (empty($outStoreDetailIdArr)){
throw new \Exception('查找不到拣货详情');
}
//是否需要报关
if (OutStoreDetailModel::whereIn('out_store_detail_id',$outStoreDetailIdArr)->value('is_apply_customs') && (empty($data['weigh_val']))){
throw new \Exception('报关单必须称重');
}
//是否有已经发货的
if (PickTaskDetailModel::whereIn('pick_task_detail_id',$pickTaskDetailIdArr)->where('pack_status',4)->value('pick_task_detail_id')){
throw new \Exception('单据存在已发货的记录,不可重复操作');
}
//查找出所有的客户ID,看是否有不同的
$outStoreIdArr = OutStoreDetailModel::whereIn('out_store_detail_id',$outStoreDetailIdArr)->pluck('out_store_id');
if (count(array_filter(OutStoreModel::whereIn('out_store_id',array_filter($outStoreIdArr))->pluck('customer_id'))) > 1){
throw new \Exception('不同委托方不可一起装箱');
}
PickTaskDetailModel::whereIn('pick_task_detail_id',$pickTaskDetailIdArr)->update(['pack_status'=>3]);
return [];
}
}
\ No newline at end of file
......@@ -17,4 +17,30 @@ class OutStoreDetailModel extends Model
protected $primaryKey = 'out_store_detail_id';
public $timestamps = false;
static public function getWhereObj($data)
{
$obj = self::where('add_time','>=',0);
foreach ($data as $key=>$value){
if (empty($value))continue;
switch ($key){
case 'create_time':
$obj = $obj->where('add_time','>=',strtotime($value));break;
case 'end_time':
$obj = $obj->where('add_time','<=',strtotime($value));break;
case 'out_store_id':
case 'pick_task_id':
$obj = $obj->where($key,$value);break;
case 'pallet_box_id':
$orWhere[] = ['box_id', '=', $value, 'OR'];
$orWhere[] = ['pallet_id', '=', $value, 'OR'];
$obj = $obj->where($orWhere);break;
default:
continue;
}
}
return $obj;
}
}
\ No newline at end of file
<?php
/**
* Created by 2020/4/28.
* User: Joneq
* Info: 2020/4/28
* Time: 下午6:11
*/
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
class PalletModel extends Model
{
protected $connection = 'mysql';
protected $table = 'pallet';
protected $primaryKey = 'pallet_id';
public $timestamps = false;
}
\ No newline at end of file
......@@ -17,4 +17,46 @@ class PickTaskDetailModel extends Model
protected $primaryKey = 'pick_task_detail_id';
public $timestamps = false;
static public function getWhereObj($data)
{
$obj = self::where('add_time','>=',0)->where('is_del',0);
foreach ($data as $key=>$value){
if (empty($value))continue;
switch ($key){
case 'create_time':
$obj = $obj->where('add_time','>=',strtotime($value));break;
case 'end_time':
$obj = $obj->where('add_time','<=',strtotime($value));break;
case 'out_store_id':
$obj = $obj->whereIn('out_store_id',is_array($data['out_store_id'])?$data['out_store_id']:[$data['out_store_id']]);break;
case 'out_store_detail_id':
$obj = $obj->whereIn('out_store_id',is_array($data['out_store_detail_id'])?$data['out_store_detail_id']:[$data['out_store_detail_id']]);break;
case 'pick_task_id':
case 'pack_status':
$obj = $obj->where($key,$value);break;
case 'pallet_box_id':
$orWhere[] = ['box_id', '=', $value, 'OR'];
$orWhere[] = ['pallet_id', '=', $value, 'OR'];
$outStoreIdArr = OutStoreDetailModel::getWhereObj([])->where($orWhere)->pluck('out_store_detail_id');
$obj = $obj->whereIn('out_store_detail_id',$outStoreIdArr);break;
case 'pallet_id':
$outStoreIdArr = OutStoreDetailModel::getWhereObj([])->where('pallet_id',$value)->pluck('out_store_detail_id')->toArray();
$obj = $obj->whereIn('out_store_detail_id',$outStoreIdArr);break;
case 'box_id':
$outStoreIdArr = OutStoreDetailModel::getWhereObj([])->where('box',$value)->pluck('out_store_detail_id')->toArray();
$obj = $obj->whereIn('out_store_detail_id',$outStoreIdArr);break;
case 'goods_name_box_id':
$orWhere[] = ['box_id', '=', $value, 'OR'];
$orWhere[] = ['goods_name', '=', $value, 'OR'];
$outStoreIdArr = OutStoreDetailModel::getWhereObj([])->where($orWhere)->pluck('out_store_detail_id');
$obj = $obj->whereIn('out_store_detail_id',$outStoreIdArr);break;
default:
continue;
}
}
return $obj;
}
}
\ No newline at end of file
<?php
/**
* Created by 2020/4/26.
* User: Joneq
* Info: 2020/4/26
* Time: 下午5:47
*/
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
class StockModel extends Model
{
protected $connection = 'mysql';
protected $table = 'stock';
protected $primaryKey = 'stock_id';
public $timestamps = false;
}
\ No newline at end of file
<?php
/**
* Created by 2020/4/26.
* User: Joneq
* Info: 2020/4/26
* Time: 下午4:43
*/
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
class StoreModel extends Model
{
protected $connection = 'mysql';
protected $table = 'store';
protected $primaryKey = 'store_id';
public $timestamps = false;
}
\ No newline at end of file
......@@ -8,8 +8,8 @@
return [
'SecretKey'=>'fh6y5t4rr351d2c3bryi',//接口加密密钥,与oss相同
'UploadKey'=>'fh6y5t4rr351d2c3bryi',//api的秘钥
'SystemCode'=>env('SYSTEM_CODE','00'),//系统编码,需要在tapd维护,请勿占用已使用的编码
'SystemName'=>env('SYSTEM_NAME','这家伙没设置系统'),//系统名称
'SystemCode'=>env('SYSTEM_CODE','03'),//系统编码,需要在tapd维护,请勿占用已使用的编码
'SystemName'=>env('SYSTEM_NAME','出库服务'),//系统名称
'path'=>realpath(__DIR__ . '/../').'/storage/logs/LogReport/',
'LARAVELS_LISTEN_PORT' => env('LARAVELS_LISTEN_PORT'),
......
......@@ -18,5 +18,7 @@ $router->get('/', function () use ($router) {
$router->post('/pick_task/{key}', 'PicktaskController@Entrance');
$router->post('/out_store/{key}', 'OutstoreController@Entrance');
$router->post('/admin_out_store/{key}', 'AdminOutstoreController@Entrance');
{"server":{"listen_ip":"0.0.0.0","listen_port":"40001","socket_type":1,"enable_coroutine_runtime":false,"server":"LaravelS","handle_static":false,"laravel_base_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","inotify_reload":{"enable":false,"watch_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","file_types":[".php"],"excluded_dirs":[],"log":true},"event_handlers":[],"websocket":{"enable":false},"sockets":[],"processes":[],"timer":{"enable":false,"jobs":[],"pid_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/laravels-timer.pid","max_wait_time":5},"events":[],"swoole_tables":[],"register_providers":[],"cleaners":[],"swoole":{"daemonize":false,"dispatch_mode":2,"reactor_num":4,"worker_num":"3","task_ipc_mode":1,"task_max_request":8000,"task_tmpdir":"/tmp","max_request":8000,"open_tcp_nodelay":true,"pid_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/laravels.pid","log_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/logs/swoole-2020-04.log","log_level":4,"document_root":"/usr/local/var/www/ichunt/scm_wms_outstore_service/public","buffer_output_size":2097152,"socket_buffer_size":134217728,"package_max_length":4194304,"reload_async":true,"max_wait_time":60,"enable_reuse_port":true,"enable_coroutine":false,"http_compression":false},"enable_gzip":false,"process_prefix":"/usr/local/var/www/ichunt/scm_wms_outstore_service","ignore_check_pid":false},"laravel":{"root_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","static_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service/public","cleaners":[],"register_providers":[],"is_lumen":true,"_SERVER":{"SHELL":"/bin/bash","TERM":"xterm-256color","HOMEBREW_BOTTLE_DOMAIN":"https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles","TMPDIR":"/var/folders/vd/95yw3kdx65n1qw9ggmkkkp7c0000gn/T/","Apple_PubSub_Socket_Render":"/private/tmp/com.apple.launchd.LRm7gkkp1N/Render","USER":"gongyang","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.DsiHWZisWS/Listeners","__CF_USER_TEXT_ENCODING":"0x1F5:0x19:0x34","PATH":"/usr/local/opt/mysql@5.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin","_":"/usr/bin/php","PWD":"/usr/local/var/www/ichunt/scm_wms_outstore_service","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"0","HOME":"/Users/gongyang","SHLVL":"2","LOGNAME":"gongyang","LC_CTYPE":"zh_CN.UTF-8","PHP_SELF":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","SCRIPT_NAME":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","SCRIPT_FILENAME":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","PATH_TRANSLATED":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","DOCUMENT_ROOT":"","REQUEST_TIME_FLOAT":1587635591.896035,"REQUEST_TIME":1587635591,"argv":["/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","laravels","config"],"argc":3,"APP_ENV":"local","APP_DEBUG":"true","APP_KEY":"","APP_TIMEZONE":"PRC","SYSTEM_CODE":"01","SYSTEM_NAME":"服务初始服务(开发环境)","LARAVELS_LISTEN_IP":"0.0.0.0","LARAVELS_LISTEN_PORT":"40001","worker_num":"3","DB_CONNECTION":"mysql","DB_HOST":"192.168.2.232","DB_USERNAME":"liexin_scm_wms","DB_PASSWORD":"liexin_scm_wms#zsyM","DB_PORT":"3306","DB_DATABASE":"liexin_scm_wms","DB_PREFIX":"lie_","REDIS_HOST":"192.168.1.235","REDIS_PASSWORD":"icDb29mLy2s","REDIS_PORT":"6379","REDIS_READ_HOST":"192.168.1.237","REDIS_READ_PASSWORD":"icDb29mLy2s","REDIS_READ_PORT":"6379","CACHE_DRIVER":"file","QUEUE_DRIVER":"sync","SHELL_VERBOSITY":0},"_ENV":{"APP_ENV":"local","APP_DEBUG":"true","APP_KEY":"","APP_TIMEZONE":"PRC","SYSTEM_CODE":"01","SYSTEM_NAME":"服务初始服务(开发环境)","LARAVELS_LISTEN_IP":"0.0.0.0","LARAVELS_LISTEN_PORT":"40001","worker_num":"3","DB_CONNECTION":"mysql","DB_HOST":"192.168.2.232","DB_USERNAME":"liexin_scm_wms","DB_PASSWORD":"liexin_scm_wms#zsyM","DB_PORT":"3306","DB_DATABASE":"liexin_scm_wms","DB_PREFIX":"lie_","REDIS_HOST":"192.168.1.235","REDIS_PASSWORD":"icDb29mLy2s","REDIS_PORT":"6379","REDIS_READ_HOST":"192.168.1.237","REDIS_READ_PASSWORD":"icDb29mLy2s","REDIS_READ_PORT":"6379","CACHE_DRIVER":"file","QUEUE_DRIVER":"sync","SHELL_VERBOSITY":0}}}
\ No newline at end of file
{"server":{"listen_ip":"0.0.0.0","listen_port":"40003","socket_type":1,"enable_coroutine_runtime":false,"server":"LaravelS","handle_static":false,"laravel_base_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","inotify_reload":{"enable":false,"watch_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","file_types":[".php"],"excluded_dirs":[],"log":true},"event_handlers":[],"websocket":{"enable":false},"sockets":[],"processes":[],"timer":{"enable":false,"jobs":[],"pid_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/laravels-timer.pid","max_wait_time":5},"events":[],"swoole_tables":[],"register_providers":[],"cleaners":[],"swoole":{"daemonize":false,"dispatch_mode":2,"reactor_num":4,"worker_num":"3","task_ipc_mode":1,"task_max_request":8000,"task_tmpdir":"/tmp","max_request":8000,"open_tcp_nodelay":true,"pid_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/laravels.pid","log_file":"/usr/local/var/www/ichunt/scm_wms_outstore_service/storage/logs/swoole-2020-05.log","log_level":4,"document_root":"/usr/local/var/www/ichunt/scm_wms_outstore_service/public","buffer_output_size":2097152,"socket_buffer_size":134217728,"package_max_length":4194304,"reload_async":true,"max_wait_time":60,"enable_reuse_port":true,"enable_coroutine":false,"http_compression":false},"enable_gzip":false,"process_prefix":"/usr/local/var/www/ichunt/scm_wms_outstore_service","ignore_check_pid":false},"laravel":{"root_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service","static_path":"/usr/local/var/www/ichunt/scm_wms_outstore_service/public","cleaners":[],"register_providers":[],"is_lumen":true,"_SERVER":{"SHELL":"/bin/bash","TERM":"xterm-256color","HOMEBREW_BOTTLE_DOMAIN":"https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles","TMPDIR":"/var/folders/vd/95yw3kdx65n1qw9ggmkkkp7c0000gn/T/","Apple_PubSub_Socket_Render":"/private/tmp/com.apple.launchd.y4PHUvRYlF/Render","USER":"gongyang","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.MXRCxiKd63/Listeners","__CF_USER_TEXT_ENCODING":"0x1F5:0x19:0x34","PATH":"/usr/local/opt/mysql@5.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin","_":"/usr/bin/php","PWD":"/usr/local/var/www/ichunt/scm_wms_outstore_service","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"0","HOME":"/Users/gongyang","SHLVL":"2","LOGNAME":"gongyang","LC_CTYPE":"zh_CN.UTF-8","PHP_SELF":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","SCRIPT_NAME":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","SCRIPT_FILENAME":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","PATH_TRANSLATED":"/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","DOCUMENT_ROOT":"","REQUEST_TIME_FLOAT":1588906010.009845,"REQUEST_TIME":1588906010,"argv":["/usr/local/var/www/ichunt/scm_wms_outstore_service/artisan","laravels","config"],"argc":3,"APP_ENV":"local","APP_DEBUG":"true","APP_KEY":"","APP_TIMEZONE":"PRC","SYSTEM_CODE":"01","SYSTEM_NAME":"服务初始服务(开发环境)","LARAVELS_LISTEN_IP":"0.0.0.0","LARAVELS_LISTEN_PORT":"40003","worker_num":"3","DB_CONNECTION":"mysql","DB_HOST":"192.168.2.232","DB_USERNAME":"liexin_scm_wms","DB_PASSWORD":"liexin_scm_wms#zsyM","DB_PORT":"3306","DB_DATABASE":"liexin_scm_wms","DB_PREFIX":"lie_","REDIS_HOST":"192.168.1.235","REDIS_PASSWORD":"icDb29mLy2s","REDIS_PORT":"6379","REDIS_READ_HOST":"192.168.1.237","REDIS_READ_PASSWORD":"icDb29mLy2s","REDIS_READ_PORT":"6379","CACHE_DRIVER":"file","QUEUE_DRIVER":"sync","SHELL_VERBOSITY":0},"_ENV":{"APP_ENV":"local","APP_DEBUG":"true","APP_KEY":"","APP_TIMEZONE":"PRC","SYSTEM_CODE":"01","SYSTEM_NAME":"服务初始服务(开发环境)","LARAVELS_LISTEN_IP":"0.0.0.0","LARAVELS_LISTEN_PORT":"40003","worker_num":"3","DB_CONNECTION":"mysql","DB_HOST":"192.168.2.232","DB_USERNAME":"liexin_scm_wms","DB_PASSWORD":"liexin_scm_wms#zsyM","DB_PORT":"3306","DB_DATABASE":"liexin_scm_wms","DB_PREFIX":"lie_","REDIS_HOST":"192.168.1.235","REDIS_PASSWORD":"icDb29mLy2s","REDIS_PORT":"6379","REDIS_READ_HOST":"192.168.1.237","REDIS_READ_PASSWORD":"icDb29mLy2s","REDIS_READ_PORT":"6379","CACHE_DRIVER":"file","QUEUE_DRIVER":"sync","SHELL_VERBOSITY":0}}}
\ No newline at end of file
16100
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment