|
|
@@ -12,6 +12,7 @@ use App\CommodityBarcode;
|
|
|
use App\Console\Commands\CreateOwnerAreaReport;
|
|
|
use App\Console\Commands\CreateOwnerBillReport;
|
|
|
use App\Console\Commands\CreateOwnerReport;
|
|
|
+use App\Console\Commands\SyncBatchTask;
|
|
|
use App\Console\Commands\SyncWmsCommoditiesInformation;
|
|
|
use App\Console\Commands\SyncWMSOrderTask;
|
|
|
use App\Console\Commands\WasSyncWmsAsnInformation;
|
|
|
@@ -170,6 +171,31 @@ sql;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ public function test1(){
|
|
|
+ $a = [1,2,3];
|
|
|
+ $b = [2,3];
|
|
|
+ dd(array_diff($a,$b));
|
|
|
+ /* $sql = <<<sql
|
|
|
+ select * from DOC_ORDER_HEADER WHERE ORDERNO in ('SO190628006175','SO190628006415',
|
|
|
+'SO190628007767','SO190628007535','SO190628007503','SO190628006567','SO190628006569','SO190628006995')
|
|
|
+sql;
|
|
|
+
|
|
|
+ DB::connection("oracle")->select(DB::raw($sql));*/
|
|
|
+ $a = new SyncWMSOrderTask();
|
|
|
+ $a->handle();
|
|
|
+ /*$order = new OracleDOCOrderHeaderService();
|
|
|
+ $arr = $order->getOrderInfoByOrderNos(['SO190628006175','SO190628006415',
|
|
|
+ 'SO190628007767','SO190628007535','SO190628007503','SO190628006567','SO190628006569','SO190628006995']);
|
|
|
+ dump($arr[0]);
|
|
|
+ app("OrderService")->syncOrder($arr);*/
|
|
|
+ }
|
|
|
+
|
|
|
+ public function test2(){
|
|
|
+ $a = new SyncBatchTask();
|
|
|
+ $a->handle();
|
|
|
+ //DB::connection("oracle")->select(DB::raw("select * from DOC_WAVE_DETAILS where waveno = 'W210121000004'"));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public function zzd()
|
|
|
{
|
|
|
@@ -595,59 +621,6 @@ sql;
|
|
|
if (count($error) > 0) app('LogService')->log(__METHOD__, "同步时WMS中未找到这些订单_two", json_encode($error));
|
|
|
}
|
|
|
|
|
|
- function test1()
|
|
|
- {
|
|
|
- $statistics = ProcessStatistic::query()->whereNull('revenue')->get();
|
|
|
- $id = array_column($statistics->toArray(), 'process_id');
|
|
|
- $processes = Process::query()->where(function (Builder $query) {
|
|
|
- $query->where('status', '待交接')->orWhere('status', '交接完成');
|
|
|
- })->whereIn('id', $id)->get();
|
|
|
- $sign_end = true;
|
|
|
- foreach ($processes as $process) {
|
|
|
- if (count($process->processDailies) > 0) {
|
|
|
- $completed_amount = 0;
|
|
|
- foreach ($process->processDailies as $processDaily) {
|
|
|
- $completed_amount = $completed_amount + ($processDaily->output);
|
|
|
- }
|
|
|
- $process->completed_amount = $completed_amount;
|
|
|
- }
|
|
|
- //统计:
|
|
|
- $revenue = ($process->unit_price) * ($process->completed_amount); //收入合计
|
|
|
- $processDailies = ProcessDaily::with('processDailyParticipants')->where('process_id', $process->id)->where('output', '>', 0)->get();
|
|
|
- $duration_days = count($processDailies); //完成天数
|
|
|
- $duration_man_hours = 0; //总工时
|
|
|
- $total_cost = 0; //合计成本
|
|
|
- foreach ($processDailies as $processDailyOne) {
|
|
|
- foreach ($processDailyOne->processDailyParticipants as $processDailyParticipant) {
|
|
|
- if (!$processDailyParticipant->unit_price && !$processDailyParticipant->hour_price) continue;
|
|
|
- $duration_man_hours += $processDailyParticipant->hour_count;
|
|
|
- if ($processDailyParticipant->unit_count) {
|
|
|
- $total_cost += ($processDailyParticipant->unit_count) * ($processDailyParticipant->unit_price);
|
|
|
- continue;
|
|
|
- }
|
|
|
- $total_cost += ($processDailyParticipant->hour_count) * ($processDailyParticipant->hour_price);
|
|
|
- }
|
|
|
- };
|
|
|
- $processStatistic = ProcessStatistic::query()->find($process->id);
|
|
|
- $processStatistic->revenue = $revenue;
|
|
|
- $processStatistic->duration_days = $duration_days;
|
|
|
- $processStatistic->duration_man_hours = $duration_man_hours;
|
|
|
- if ($sign_end) $processStatistic->ended_at = date('Y-m-d H:i:s');
|
|
|
- if (!$revenue || !$total_cost) {
|
|
|
- $processStatistic->update();
|
|
|
- continue;
|
|
|
- }
|
|
|
- $gross_profit = $revenue - $total_cost; //毛利润
|
|
|
- if ($gross_profit != 0) $gross_profit_rate = $gross_profit / $revenue; //毛利率;
|
|
|
- else $gross_profit_rate = 0;
|
|
|
- $processStatistic->total_cost = $total_cost;
|
|
|
- $processStatistic->gross_profit = $gross_profit;
|
|
|
- $processStatistic->gross_profit_rate = $gross_profit_rate;
|
|
|
- $processStatistic->update();
|
|
|
- app('LogService')->log(__METHOD__, "修改二次加工单统计单_" . __FUNCTION__, json_encode($processStatistic), Auth::user()['id']);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public function test5()
|
|
|
{
|
|
|
ini_set('max_execution_time', 2500);
|