|
|
@@ -58,6 +58,8 @@ use App\ValueStore;
|
|
|
use App\Waybill;
|
|
|
use Carbon\Carbon;
|
|
|
use Carbon\CarbonPeriod;
|
|
|
+use Decimal\Decimal;
|
|
|
+use Doctrine\DBAL\Exception;
|
|
|
use Firebase\JWT\JWT;
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
@@ -70,6 +72,7 @@ use Illuminate\Support\Facades\Http;
|
|
|
use Illuminate\Support\Facades\URL;
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
use Laravel\Horizon\Events\JobFailed;
|
|
|
+use Monolog\Handler\IFTTTHandler;
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Web\Service;
|
|
|
|
|
|
class TestController extends Controller
|
|
|
@@ -91,8 +94,8 @@ class TestController extends Controller
|
|
|
public function test()
|
|
|
{
|
|
|
$a = 1;
|
|
|
- if ($a>2)dd(1);
|
|
|
- else if($a==0)dd(2);
|
|
|
+ if ($a > 2) dd(1);
|
|
|
+ else if ($a == 0) dd(2);
|
|
|
dd(3);
|
|
|
}
|
|
|
|
|
|
@@ -104,8 +107,8 @@ class TestController extends Controller
|
|
|
->where('class', 'like', 'https://was.baoshi56.com/package/logistic/batchUpdate%')->pluck('description');
|
|
|
foreach ($descriptions as $description) {
|
|
|
$description = substr($description, 9);
|
|
|
- $description = \Illuminate\Support\Str::before($description,"}");
|
|
|
- $obj= json_decode($description.'}',true);
|
|
|
+ $description = \Illuminate\Support\Str::before($description, "}");
|
|
|
+ $obj = json_decode($description . '}', true);
|
|
|
OrderPackage::query()
|
|
|
->whereIn('logistic_number', $obj['logistic_numbers'])
|
|
|
->update([
|
|
|
@@ -114,4 +117,77 @@ class TestController extends Controller
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function testUpdateInv()
|
|
|
+ {
|
|
|
+ ini_set('max_execution_time', 0);
|
|
|
+ ini_set('memory_limit', '4096M');
|
|
|
+ $sql = <<<sql
|
|
|
+select FMLOTNUM,FMLOCATION,PLANTOLOCATION,CREATE_TRANSACTIONID,SKU,CUSTOMERID from TSK_TASKLISTS
|
|
|
+where CUSTOMERID=?
|
|
|
+ AND FMLOCATION= ?
|
|
|
+ AND OPENWHO = ?
|
|
|
+ AND TASKPROCESS = ?
|
|
|
+ AND DOCTYPE = ?
|
|
|
+ AND TASKTYPE = ?
|
|
|
+ AND LOTATT05=?
|
|
|
+ AND LOTATT08=?
|
|
|
+ AND PLANTOID = ?
|
|
|
+ and OPENTIME>=TO_DATE(?,'yyyy-mm-dd hh24:mi:ss')
|
|
|
+ and OPENTIME<=TO_DATE(?,'yyyy-mm-dd hh24:mi:ss')
|
|
|
+sql;
|
|
|
+ $CUSTOMERID = 'JIANSHANG';
|
|
|
+ $FMLOCATION = 'STAGEWH02';
|
|
|
+ $OPENWHO = 'WCS';
|
|
|
+ $TASKPROCESS = '00';
|
|
|
+ $DOCTYPE = 'ASN';
|
|
|
+ $TASKTYPE = 'PA';
|
|
|
+ $LOTATT05 = 'MJ-CP';
|
|
|
+ $LOTATT08 = 'ZP';
|
|
|
+ $PLANTOID = '*';
|
|
|
+ $traceid = 'JIANSHANG03';
|
|
|
+ $start = '2021-09-02 23:59:59';
|
|
|
+ $end = '2021-09-03 11:10:00';
|
|
|
+ $res = DB::connection("oracle")->select(DB::raw($sql),
|
|
|
+ [$CUSTOMERID, $FMLOCATION, $OPENWHO, $TASKPROCESS, $DOCTYPE, $TASKTYPE, $LOTATT05, $LOTATT08, $PLANTOID, $start, $end]);
|
|
|
+ $resItems = array_chunk($res, 200);
|
|
|
+ foreach ($resItems as $res) {
|
|
|
+ DB::connection("oracle")->beginTransaction();
|
|
|
+ try {
|
|
|
+ foreach ($res as $re) {
|
|
|
+ DB::connection("oracle")->table('INV_LOT_LOC_ID')
|
|
|
+ ->where([
|
|
|
+ 'LOTNUM' => $re->fmlotnum,
|
|
|
+ 'LOCATIONID' => $re->fmlocation,
|
|
|
+ 'CUSTOMERID' => $re->customerid,
|
|
|
+ 'sku' => $re->sku,
|
|
|
+ 'TRACEID' => '*',
|
|
|
+ ])
|
|
|
+ ->update([
|
|
|
+ 'TRACEID' => $traceid,
|
|
|
+ 'EDITWHO' => 'WCS_',
|
|
|
+ ]);
|
|
|
+ if ($re->fmlocation != $re->plantolocation) {
|
|
|
+ DB::connection("oracle")->table('INV_LOT_LOC_ID')
|
|
|
+ ->where([
|
|
|
+ 'LOTNUM' => $re->fmlotnum,
|
|
|
+ 'LOCATIONID' => $re->plantolocation,
|
|
|
+ 'CUSTOMERID' => $re->customerid,
|
|
|
+ 'sku' => $re->sku,
|
|
|
+ 'TRACEID' => '*',
|
|
|
+ ])
|
|
|
+ ->update([
|
|
|
+ 'TRACEID' => $traceid,
|
|
|
+ 'EDITWHO' => 'WCS_',
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ DB::connection("oracle")->commit();
|
|
|
+ }
|
|
|
+ dd(true);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ DB::connection("oracle")->rollBack();
|
|
|
+ dd($e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|