robgridley / pace-api Goto Github PK
View Code? Open in Web Editor NEWA PHP client for EFI Pace's SOAP API.
License: MIT License
A PHP client for EFI Pace's SOAP API.
License: MIT License
I am trying to select a list of job parts under a selected job. I don't see any example on this api for this. Could you help me with how to get them?
Thanks,
Ryan
Hi,
I am trying to insert data into the "NonChargeableTime" object but getting the error saying 'soap fault'.
$NonChargeableTime = $pace->NonChargeableTime;
$NonChargeableTime->startDate = new Carbon($nbStartDate);
$NonChargeableTime->startTime = new Carbon($nbStartTime);
$NonChargeableTime->endDate = new Carbon($endDate);
$NonChargeableTime->endTime = new Carbon($endTime);
$NonChargeableTime->nonChargeableType = (int) $nbType;
if(!is_null($nbCostCenter)){
$NonChargeableTime->costCenter = $nbCostCenter;
}
if(!is_null($nbNote)){
$NonChargeableTime->note = $nbNote;
}
$NonChargeableTime->save();
dd($NonChargeableTime);
Am I doing wrong on this code?? (FYI, I am using the version 1.0.0 at the moment)
Thanks,
Ryan
As part of our on going development we are replacing many of the API calls with direct SQL select statements. With that we are getting a massive improvement in speed and gaining some much desired flexibility. But does anyone know how to get fileAttachments without the API, or a clever way through it? Many thanks and happy new year!
Joe
I encountered an issue with this API wrapper when I moved an app from development to production. Sending data to Pace over the Internet rather than over our LAN resulted in sporadic failures with this error:
SoapFault exception: [HTTP] Error Fetching http headers in /www/app/vendor/robgridley/pace-api/src/Services/CreateObject.php:20
I believe I've found a solution, editing Soap/Factory.php and adding the following to Factory::$options:
[
'connection_timeout' => 5000,
'cache_wsdl' => WSDL_CACHE_NONE,
'keep_alive' => false,
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP |
SOAP_COMPRESSION_DEFLATE
];
This seems to fix the issue (along with ini_set('default_socket_timeout', 5000)).
I'd rather not modify your library or fork it, but I know if I leave this hack in here it'll get nuked on a composer update 9 months from now and I'll have forgotten all about it.
What are your thoughts on properly integrating these settings into the library? I'm not sure if I stuck these options in the right place, there might be a better place, or perhaps add a parameter to the Pace class constructor so that end users can pass whatever params they want?
Thoughts?
Hi,
I am trying to read and update the dates which are Carbon instances.
For reading,
I convert the Carbon instance to array when I read the date value. But I don't think this is the right way of doing it. Also, the PACE system only stores the date value but when I look at the carbon instance value in the API, the 'date' is displaying as date time value.
e.g. +"date": "2015-07-31 04:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
For updating,
If I update the value with just a date ('Y-m-d'), would it cause an issue? Also, how do I update these date values?
Thanks,
Ryan
Hi,
i want to create a login function to pace using the pace api with laravel, so how can i catch the SOAP error if the username and password is not correct to connect to the pace server rather than getting this error "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://192.168.1.127/rpc/services/FindObjects?wsdl' : failed to load external entity "http://192.168.1.127/rpc/services/FindObjects?wsdl"..
Thank you..
Hate to open an issue for this simple question, but is this usable without Laravel? I just started setting up and stopped on this error:
Fatal error: Class 'Illuminate\Support\ServiceProvider' not found in C:\xampp\htdocs\pace-api-master\src\PaceServiceProvider.php on line 9
Hi @robgridley
Thank you for providing me the solution for the earlier questions. Now, I am trying to paginate the result like below but it seems to work.
$jobs = $pace->job
->filter('@adminStatus', 'O')
->sort('customer/@custName')
->paginate(1, 50)
->filterKeys(function ($key){
return strpos($key, 'P') !== 0;
});
Could you advise on this please>
Thanks,
Ryan
Hello Rob,
I've been working with EFI's SDK for a few months and has been quite challenging. I found your pace-api noted in EFI's Forum and downloaded from github... I couldn't believe how easy it was to install and use within a day. I can't thank you enough.
I'm hoping you can help with this segment of the Report Service. I'm trying to execute a report and then download to a pdf.
http://IPADDRESS/reports/company:public/reportReader/view/NOTE+Jacket.pdf?init=pdf&prompt0=140780&key=10462&baseObjectKey=140780
Having issues with curl etc... I was hoping you would, at some point, include ReportService to pace-api so reports could be easily executed via api call.
Currently running Productivity Suite: v3.0 ePace (UI 3.0) - 27.12-833 (201601131253). I ran a current service list below to show that Report Services is available in 27 and a few others. I would know how to use the others even if they were available..
ReportService
InvokePaceConnect
GeoLocate
CustomizationService
InvokeProcess
InvokeAction
SystemInspector
FindCompany
Let me know you thoughts or if I can help is anyway. I'm very new to API and although I don't have the expertise to write the code, I'm able to figure out how to use the pace-api tool you have created.
Much appreciated,
Larry
Hi,
I am trying to understand between adminStatus/@openjob and @AdminStatus.
Could you advise me the differences between them?
Thanks,
Ryan
Is it possible to call Pace Actions such as calculateEstimate and convertEstimateToJob?
Do you happen to have any example code for writing attachments? Here's a sample of what I've been trying:
$file = $this->pace->FileAttachment;
$file->attachment = base64_encode(file_get_contents('example.pdf'));
$file->baseObject = 'Quote';
$file->baseObjectKey = 15310;
$file->save();
This always produces the error "Uncaught Exception: SoapFault, attachment field is null".
Even if I read an existing attachment and try to update the "attachment" field it produces that error.
It seems that attachment
is the primary key for FileAttachment
as well as the vault key (not sure the difference). It's not used for the file content itself.
Any idea how is this actually done?
Hi,
I just upgraded my php version from 7.0 to 7.3.4 and ran a simple query (please see below).
$x = $pace->job->read(128910);
The job in Pace exists but it returned the error message (Class 'SoapClient' not found).
I removed the package and reinstalled it by composer.
I printed the $pace object and compared it with the working one and there's no difference.
Thanks,
Ryan
Hello, I wrote a customized API that is currently writing large estimates to our Pace v27 production server. Everything is working.
When I point a copy of the API at the Development server where V28.2 is installed, the API creates the estimate. After that the API times out when it hits any kind of ObjectHttpBinding .
Hi robgridley,
I tried it with the code sample you provided me but didn't work. I have got the errors (please see below).
$result = $pace->model('PaceConnectResult')->read(99999);
$attachment = $result->fileAttachments()->first();
$attachment->getContent(); // the XML file content
Unknown field 'paceConnectResult' on object 'FileAttachment'
Originally posted by @rkang30 in #31 (comment)
Hi,
I am creating jobPart using the code below but the value of qtyToMfg is always set to 1 no matter what value I enter. In this case, I set it to 25 but it returns 1 after saving the jobPart.
$jobPart = $pace->jobPart;
$jobPart->job = "127629";
$jobPart->jobProduct = 184012;
$jobPart->jobPart = "74";
$jobPart->description = "3 Panel Brochures - Eng & Fr - 74";
$jobPart->flatSizeW = 8.55;
$jobPart->flatSizeH = 10.54;
$jobPart->pressSheetNumOut = 2;
$jobPart->sheetsOffPress = 200;
$jobPart->U_productionType = "ISM Print";
$jobPart->printRunMethod = 5006;
$jobPart->qtyToMfg = 25;
$jobPart->save();
Hi,
I just recognize that the value of final size on the pace system is not matching with the value from api.
For example,
The final size on my pace system is 22″ x 28″. The value from API is 65.0.
Could you advise me on this please?
Thanks,
Ryan
Hi,
I would like to access Job/Product/Parts' history (url: .../object/Job/history/xxx) via API but don't know how to access it.
I used $job->history() but this returns only an empty history object.
Thanks,
Hello, i am new to laravel and now i am using your api to communicate our pace server with the laravel and i got a SOAP communication error in the very beginning, after i have put the ip for the pace server and also the username and password, i try to connect with pace. But, the following error is keep showing up and i dont know how to solve it. Can you please check into it. The error is like this:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://xxx.xxx.xxx.xxx/rpc/services/Version?wsdl' : failed to load external entity "https://xxx.xxx.xxx.xxx/rpc/services/Version?wsdl"
Hi,
I am trying to insert a jobCost to a jobPart but it didn't seem to work. (please see below). When I checked the job cost detail for this job, the new job I have added didn't show up.
$jobCost = $pace->JobCost;
$jobCost->job = '112419';
$jobCost->jobPart = '01';
$jobCost->activityCode = '40501';
$jobCost->hours = 1;
$jobCost->save();
dd($jobCost);
Please advise me if I am doing it correctly in terms of adding a new data.
Thanks,
Ryan
First, thanks for writing such a fantastically useful library. I've looked through the source code and I love how you used magic methods to do most of the heavy lifting, it's really elegant stuff. My question; your docs skip over how to do a basic 'select', how do you get everything without filtering? The docs jump right into filtering without showing how to do just grab everything. I've tried a number of attempts and haven't been successful--is there a technical restriction preventing this sort of thing or have I am I missing something really obvious? Thanks.
Hi,
your library is amazing :)
In the latest version of Pace is field tags. How can I to search by this field and how to enter this field?
Thanks
Radek
Hi,
When I create a job cost object for a click charge, I get two records. One with prodUnits = 1 and another with empty prodUnits. The activity code (for clicks) that I supplied does have an inventory item. Is this happening because of the absence of inventory item?
$clicksJobCost = $pace->JobCost;
$clicksJobCost->job = 'xxx';
$clicksJobCost->jobPart = '04';
$clicksJobCost->activityCode = '52598'; //click charge activity code
$clicksJobCost->prodUnits = 1;
$clicksJobCost->save();
Thanks,
I'm interested in uploading attachments to pace
Thanks for any tips
hello @robgridley ,
When i try to do the paginate i got the following error
"Call to undefined method Pace\KeyCollection::links() (View: C:\laragon\www\productmanager\resources\views\parts\show.blade.php)"
in my controller i do the paginate and send the result to the view like this
"$jobs = $pace->job
->filter('adminStatus/@openjob', true)
->find()->paginate(1,3);
return view('parts.show',compact('jobs'));"
and in my blade i try to show the list like this
"@foreach($jobs as $jb)
<tr>
<td>{{$jb->enteredBy}}</td>
<td>{{$jb->job}}</td>
<td>{{$jb->customer}}</td>
</tr>
@endforeach
</div>
{{ $jobs->links() }}"
can you guys please help me pointing out what is wrong with this one again.. Thanks to you all..
Hi,
I am trying to fetch the total number of job parts under a job product when it's in json string format.
Basically I am fetching the job products data via ajax. The php side (server side) that the ajax is requesting is below.
$jobProducts = $job->jobProducts()->sort('@id', true)->find() ;
return $jobProducts; //this becomes json string
Generally, if I just had a $jobProduct model in php, I can fetch the number of job parts like below.
foreach($jobProducts as $jobProduct){
$numofJobParts = count($jobProduct->jobParts());
}
But, I am currently turning the object to string in order to get a json string. This way, I can't fetch the number of job parts.
What I am doing at the moment is that I basically looping the $jobProducts into 'foreach' and get the number number of job parts and append the each field value to a new array and return back to front side.
This is inefficient. Because, I am looping it on the server side and client side in order to display the data.
Is there any better way of fetching the number of job parts?
Thanks,
Ryan
Seriously. Your PHP library save me hours of work, if not more. Thanks again. If you are ever in the states near Boston or Rhode Island dinner and a couple of drinks is on me.
Hi,
I am trying to update 'jobPart' property of 'JobNote' object but doesn't seem to work. I have contacted EFI to see if it's their issue but haven't heard back from them yet. In the mean time, I would like to pick your brain as to how I need to save in order to update 'jobPart'.
Thanks,
$jobNote = $pace->jobNote->read(550986);
$jobNote->jobPart = '02';
$jobNote->save();
dd($jobNote);
We're getting seemingly random timeouts in our app on different pages, we suspect it's on the Pace server's end but need more data to figure out what's going on.
Apache error log only shows something like:
mod_fcgid: read data timeout in 120 seconds
We're at our wit's end troubleshooting this. I followed this post and hacked the API a bit to add some logging to hopefully see where apache is timing out:
https://stackoverflow.com/q/1729345/398242
I'm not too familiar with the SoapClient lib but It seems that __doRequest()
and __soapCall()
aren't actually called using this API?
I know this isn't an issue with the API itself but hoped someone could have some insight.
Hi,
I noticed that when I updated a date value, the date on efi system displayed one day earlier.
For example,
$inputs['to_kitting_date'] = '2017-09-01';
$job->U_ToKitting = new Carbon($inputs['to_kitting_date']);
$job->save();
The carbon date translated it as 2017-09-01 00:00:00 and the efi system calculated it as one day earlier than 2017-09-01 (which is 2017-08-31) as there's zero hour, min, and second.
When I store it as below:
$job->U_ToKitting = new Carbon($inputs['to_kitting_date'].' 04:00:00');
$job->save();
The correct date was showing up on efi system.
Is there any better way of saving it other than what I have tried?
Thanks,
Ryan
Hi,
I am trying to test the post receiving php script via the page below. But it's showing the process popup box but not going anywhere. I have tested against other external post and worked fine. My php code is below as well. Could you advise me what's wrong with my code? (I honestly think that the pace itself doesn't post the value to the given url though)
Thanks,
The xml file that I have attached for testing.
<?xml version="1.0" encoding="UTF-8"?>
<imports xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<import type="Job" event="2">
<Job primaryKey="124396">
<adminStatus>O</adminStatus>
<sourceOrganizationCompany>647e8cfe-8882-4238-99bf-00f249d6d022</sourceOrganizationCompany>
</Job>
</import>
</imports>
The php code I used: (p.s. I am using Laravel framework and this is my method)
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: *');
header('Access-Control-Max-Age: 2000');
$inputs = $request->all();
return response()->json($inputs);
Does anyone know the credentials for the pace SQL with write access? someone here messed up an import and it would be a million times easier to fix it in the SQL directly.
hello @robgridley ,
how can i retrieve all jobs which include (closed and cancelled) jobs, not only open jobs? Which keyword i have to use in the filter? Because when i used the ->filter('adminStatus/@openJob', true) it only gives me the open jobs without the closed and cancelled one. Can you please point me out?
thanks.
Hi All,
So I am creating a job, adding materials to it in the form of inventoryItems, creating shipments, etc. What I am at a loss to do is to get the inventoryItem to actually pull the quantity out of inventory. I have tried adding a new inventoryLine transaction which seems to get me closer, but still no luck. I have also added the inventoryLine to an invetoryBatch and then posted the batch in space, but it still doesn't deduct the quantity. Any ideas? here is the bit of code I am using to add the item and the line...
$newItem = $this->pace->jobMaterial;
$newItem->job = $newJobNumber;
$newItem->jobPart = '01';
$newItem->inventoryItem = $bin->inventoryItem;
$newItem->plannedQuantity = $bin->pickQty;
$newItem->inventoryBin = $bin->inventoryBin;
$newItem->inventoryLocation = $bin->inventoryLocation;
$newItem->save();
$newLine = $this->pace->inventoryLine;
$newLine->job = $newJobNumber;
$newLine->jobPart = '01';
$newLine->quantity = $bin->pickQty;
$newLine->inventoryItem = $bin->inventoryItem;
$newLine->inventoryLocation = $bin->inventoryLocation;
$newLine->inventoryBin = $bin->inventoryBin;
$newBatch = $this->pace->inventoryBatch;
$newBatch->save();
$newLine->inventoryBatch = $newBatch;
$newLine->transactionType = '2';
$newLine->uom = 'EA';
$newLine->qtyUom = 'EA';
$newLine->save();`
This could be an issue with Pace or something I've overlooked.
Is there any way to use filter()
while being case insensitive? I ran into an issue looking up contacts by email address, in some cases they had uppercase letters in Pace and had to sidestep it using contains()
.
// Value in Pace is [email protected]
// no result
$pace->contact->filter('@email', '[email protected]')->first();
// returns correct object but isn't desirable
$pace->contact->contains('@email', '[email protected]')->first();
Is there an existing solution?
Hi,
I am having trouble sorting the job parts by job part number. Since the job part number is string, it doesn't sort the way I like. Is there any way that I can convert the type of job part number to integer in sorting?
if I run this code below:
$jobParts = $job->jobParts()
->sort('@jobPart', false)
->find();
The results are like below;
job part no: 01
job part no: 02
job part no: 03
job part no: 04
job part no: 05
job part no: 06
job part no: 07
job part no: 08
job part no: 09
job part no: 10
job part no: 100
job part no: 101
job part no: 102
job part no: 103
job part no: 104
job part no: 105
job part no: 106
job part no: 107
job part no: 108
job part no: 109
job part no: 11
job part no: 110
Thank you,
Ryan
Simply, I am trying to assign a contact to a job shipment instead on assigning the value to each field.
So, if I pull up a list of a customers contacts using...
$contacts = $this->pace->Contact->filter('@customer', '=', $customer)->find();
Then I take the id of one of those contacts and then create and assign it to a jobShipment with the other required info like so....
$newShipment = $this->pace->jobShipment;
$newShipment->job = $newJobNumber;
$newShipment->contactNumber = $contactid;
$newShipment->shipmentType = '8';
$newShipment->shipVia = $shiptype;
$newShipment->shipInNameOf = 2;
$newShipment->inventoryItem = $newItem->inventoryItem;
$newShipment->carton1Quantity = $totalquantity;
$newShipment->carton1Count = '1';
$newShipment->carton1Note = $descriptionstring;
$newShipment->save();
I get nothing in the shipping details in pace. Now if I manually take all of the information from the contact (name address, city, state, etc... and assign them to the appropriate fields, it works fine, except we now have a duplicate contact. Which would destroy the integrity of the contact list in the end. So has anyone successfully assigned an existing contact to a shipment, I am at a loss on how to solve this one other than buy so support time, but it would be truly frustrating to buy the time and have them say can't do it too bad. Thanks
Hello,
After I created a new user-defined object and try to insert value to the attribute of that UDO, it says like this: "Type must be CapitalizedWords". What is that error means and how to solve it?
Thanks.
I am using datatables.js with server side search, pagination, sort and filter. While I have much of it working I cannot seem to pass a variable into the xpath grouped filter. My code is below.
->filter(function ($xpath) { $xpath->contains('@job', $searched); $xpath->orContains('@scheduledShipDate', $searched); $xpath->orContains('@promiseDate', $searched); })
$searched is the variable I need to pass. in a standard nested function I would do something like ->filter(function ($xpath) use $search {blah, blah, blah,
But alas, it does not work. Thanks for any help.
Joe
Hi All,
On about 60% of our reports I get the following error when using the new report service.
`
Type: SoapFault
Message: java.lang.String cannot be cast to java.lang.Integer
Filename: /Library/Server/Web/Data/Sites/Default/stockit2/application/vendor/robgridley/pace-api/src/Soap/SoapClient.php
Line Number: 48
Backtrace:
<p style="margin-left:10px">
File: /Library/Server/Web/Data/Sites/Default/stockit2/application/vendor/robgridley/pace-api/src/Soap/SoapClient.php<br />
Line: 48<br />
Function: __call </p>
<p style="margin-left:10px">
File: /Library/Server/Web/Data/Sites/Default/stockit2/application/vendor/robgridley/pace-api/src/Services/ReportService.php<br />
Line: 17<br />
Function: __call </p>
<p style="margin-left:10px">
File: /Library/Server/Web/Data/Sites/Default/stockit2/application/vendor/robgridley/pace-api/src/Report/Builder.php<br />
Line: 135<br />
Function: executeReport </p>`
I am calling the reports like so....
$fred = $this->pace->report(10443)->baseObjectKey((int)$shipid)->get();
I can run many reports, default or custom, but not all. I even took the one report I really need and in crystal one by one deleted each field and element, and kept trying it until it was empty and I still got the error. Any thought or ideas? Maybe a way to get a more descriptive error message? I get that something in the line is getting a string when it wants an integer, but I have no idea where.
Thanks as usual.
As an enhancement request, it would be nice to support the loadValueObjects implementation of the FindObjects service that is outlined in the Pace API documentation.
Hi,
The efi told me that I will have to use file attachment api to connect to file attachment.
http://your host.com/rpc/services/AttachmentService?wsdl
Is this something I will have to make another connection in order to access the attachements? If so, do you have a php wrapper for this?
Thanks,
Ryan
Hi,
I have a list of csrs with associate data that exists in different layers. But it took me over 2mins for about 50 csrs.
The values that I am pulling are below.
csr id, csr name, number of active jobs that are associated with the csr id, total job parts, and planned hours (this is sum of job plannedHours under each job with certain activity code.)
here below is my code to pull these data
$results = [];
$count = 0;
foreach($csrs as $csr_id => $csr_name){
$results[$count]['csr_id'] = $csr_id;
$results[$count]['csr_name'] = $csr_name;
$active_jobs = $this->paceStartSql()
->filter('@csr', (int) $csr_id)
->sort('@job', true)
->find()
->filterKeys(function($key){
return preg_match('/^[0-9]{6,}$/', $key);
});
$active_dockets = count($active_jobs);
$results[$count]['active_dockets'] = $active_dockets;
$parts = 0;
$hours = 0;
foreach($active_jobs as $job){
$jobParts = $job->totalParts;
$plannedHours = (!is_null($job->jobPlans()->filter('@activityCode', $this->prePressJobPlanCode)->first())) ? $job->jobPlans()->filter('@activityCode', $this->prePressJobPlanCode)->first()->plannedHours : 0;
$parts += $jobParts;
$hours += $plannedHours;
}
$results[$count]['total_parts'] = $parts;
$results[$count]['booked_hours'] = $hours;
$count++;
}
return $results;
Is there any faster way of pulling the data?
Thanks in advance,
Ryan
The documentation has this to say about dates:
"Dates are automatically converted to and from Carbon instances. "
In my experience this is at least partially false. Example:
$job = $pace->model('Job');
$job->promiseDate = '2018-08-31';
...
$job->save();
All the date formats I tried, even the date format in the DateTimeMapping ('Y-m-d\TH:i:s.u\Z') fail to convert and you get a SoapFault on the toXml() method in DateTimeMapping.php.
The workaround is to simply pass Carbon objects to the API wrapper when creating things. So my above snippet turns into:
$job = $pace->model('Job');
$job->promiseDate = new \Carbon\Carbon('2018-08-31');
...
$job->save();
This works perfectly. I don't necessarily think this is a bug, but the documentation is very misleading and because the wrapper doesn't trap this error scenario and output a reasonable error message I had to spend hours diving into the wrapper source code to uncover this mis-documented requirement.
I would suggest that the documentation be updated to indicate that Carbon objects are needed when setting any date fields. Extra credit would be updating the toXml() method to throw a human-readable error if it's handed a non-Carbon datetime.
How to use this service?
Thanks
Hi,
I ran the code below and encountered the error below.
$jobMaterial = $pace->jobMaterial->contains('@unitPrice', '146.69')->first();
Error message:
Cannot compare string '146.69' to CurrencyAlt4
I put the string value('146.69') as the "unitPrice" is string. I don't know what 'CurrencyAlt4' is.
It would be appreciated if you could shine some lights here.
Thanks,
Ryan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.