"Lot/serial nbr ('anyNumber') can not found in the system", why am i getting this? - acumatica

"Lot/serial nbr ('anyNumber') can not found in the system", why am i getting this when transfer inventory from a location to another?
1) Transferred inventory from SHIPMENT location/warehouse to another location warehouse.
2) then transferring again from above location warehouse to another warehouse/location. then got error.
INTransferEntry transferGraph = PXGraph.CreateInstance<INTransferEntry>();
INRegister reg = new INRegister();
reg.SiteID = lotDetail.WarehouseID;
reg.ToSiteID = distribution.ToWarehouseID;
reg.TransferType = Order.Current.TranType;
reg.DocType = INDocType.Transfer;
reg.TranDate = DateTime.Now;
reg.TotalQty = distribution.Qty;
reg = transferGraph.transfer.Insert(reg);
INTran tran = new INTran();
tran.INTransitQty = distribution.Qty;
tran.InventoryID = Order.Current.InventoryID;
tran.ToLocationID = distribution.ToLocationID;
tran.ToSiteID = distribution.ToWarehouseID;
tran.TranType = INTranType.Transfer;
tran.InvtMult = INTranType.InvtMult(tran.TranType);
tran.Qty = distribution.Qty;
tran.ReasonCode = distribution.ReasonCode;
tran.SiteID = lotDetail.WarehouseID;
tran.LocationID = lotDetail.LocationID;
tran.TranDesc = distribution.Description;
tran.LotSerialNbr = lotDetail.LotSerNumVal;
tran = transferGraph.transactions.Insert(tran);

You need to look at the INTranSplit DAC, it links the Lot Tracking with the INTran DAC to manage the existing Lots linked to the INItem

Related

Change Item Price when Creating Purchase Order via PHP in Netsuite

I am attempting to create open purchase orders in Netsuite during a system migration using Netsuite's PHP Toolkit for 2019_2. I am able to create the purchase order and line items without a problem, but I cannot figure out how to change the item cost on the line item. Setting the line item extended total works, but setting the rate field does not. Can anyone shed any light on why the price is not being set?
I've tried both $poi->item->rate = "5.00"; and $poi->item->rate = 5.00; with no success. The documentation says that this field is a string.
https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2019_2/schema/other/purchaseorderitem.html
$service = new NetSuiteService();
$po = new PurchaseOrder();
$po->tranId = 'PO111111';
$po->tranDate = '2019-03-27T00:00:00';
$po->approvalStatus = new RecordRef();
$po->approvalStatus->internalId = 2;
$po->entity = new RecordRef();
$po->entity->externalId = 'VENDORNAME';
// Create PO Item
$poi = new PurchaseOrderItem();
$poi->item = new RecordRef();
$poi->item->externalId = 'ITEMNUMBER';
$poi->item->rate = "5.00";
$poi->quantity = 10;
$po->itemList = new PurchaseOrderItemList();
$po->itemList->item = array($poi);
$request = new AddRequest();
$request->record = $po;
$addResponse = $service->add($request);
if (!$addResponse->writeResponse->status->isSuccess) {
echo "ADD ERROR";
print_r($addResponse);
} else {
echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
}
Set the rate on the purchase order line instead of trying to do it on the item record.
$poi->rate = "5.00";

How to create a new customer via code

Hello how do I add a new customer with a default contact in my process in code behind.
So far I have this but I need to create a contact object link the two somehow.
PX.Objects.AR.Customer m = new PX.Objects.AR.Customer();
m.AcctCD = "Test1";
m.AcctName = "Joe Bloggs";
m.Type = "CU";
Customers.Insert(m);
Persist();
CustomerMaint graph = PXGraph.CreateInstance<CustomerMaint>();
Customer cust = new Customer();
cust.AcctName = "Company Name";
cust = (Customer)graph.CurrentCustomer.Insert(cust);
Address addr = (Address)graph.Addresses.Current;
addr.AddressLine1 = "Address 1";
addr.AddressLine2 = "Address 2";
addr.City = "City";
addr.State = "State";
addr.PostalCode = "Zip";
addr.CountryID = "Country";
graph.Addresses.Update(addr);
Contact contact = (Contact)graph.DefContact.Current;
contact.ContactType = ContactTypesAttribute.BAccountProperty;
contact.FirstName = "FirstName";
contact.LastName = "Last Name";
contact.EMail = "emaiL#email.com";
contact.WebSite = "www.website.com";
contact.Phone1 = "1234567890";
contact.Fax = "1234567890";
graph.DefContact.Update(contact);
graph.Actions.PressSave();
This what I did seems to work good. Got instance of the customermaint graph. Insert new Customer into currentcustomer and edit current def contact.
PX.Objects.AR.CustomerMaint graph = PXGraph.CreateInstance<PX.Objects.AR.CustomerMaint>();
PX.Objects.AR.Customer m = new PX.Objects.AR.Customer();
m.AcctCD = "Test4";
m.AcctName = "Jo Bloggs";
m.Type = "CU";
graph.CurrentCustomer.Insert(m);
PX.Objects.CR.Contact c = graph.DefContact.Current;
c.ContactType = "AP";
c.FullName = "Joe Bloggs";
c.EMail = "joe#Bloggs.com";
graph.Actions.PressSave();

eConnect 10.0 SLPRSNID & SALSTERR not importing in new line items

The following code helps to import a sales line to an invoice:
Dim LineItems(dtItem.Rows.Count) As taSopLineIvcInsert_ItemsTaSopLineIvcInsert
Dim salesLine As New taSopLineIvcInsert_ItemsTaSopLineIvcInsert
'Create Invoice Sales lines
For Each dr In dtItem.Rows
With salesLine
.CUSTNMBR = dr.Item("acctno")
.SOPNUMBE = invoiceNumber
.SOPTYPE = 3
.DOCID = "STD INV"
.QUANTITY = dr.Item("Qty")
.ITEMNMBR = dr.Item("Item")
.ITEMDESC = dr.Item("Memo")
.UNITPRCE = dr.Item("SalesPrice")
.XTNDPRCE = dr.Item("Credit")
.TAXAMNT = 0
.UOFM = "Each"
.SALSTERR = "GENERAL"
.ReqShipDate = dtHdr.Rows(0).Item("InvoiceDate").ToString()
.FUFILDAT = dr.Item("Date1").ToString()
.ACTLSHIP = dr.Item("Date1").ToString()
'.NONINVEN = 0
.DOCDATE = dtHdr.Rows(0).Item("InvoiceDate").ToString()
.SLPRSNID = "C1"
End With
LineItems(rowCtr) = salesLine
rowCtr = rowCtr + 1
Next
The fields for SLPRSNID & SALSTERR are just ignored. The invoice itself is being created with all the line items. ANY ideas from anyone with experience using this API are appreciated!
Since we are not integrating SOP commissions data, importing SLPRSNID & SALSTERR on line items using code like above is not supported. However, eConnect does expose pre and post stored procedures to customize business logic. The following was added in taSopHdrIvcInsertPost to implement the import:
/** Custom Business Logic */
if ((#I_vSLPRSNID <> '') and (#I_vSALSTERR <> ''))
begin
update SOP10200
set SLPRSNID = #I_vSLPRSNID, SALSTERR = #I_vSALSTERR
where SOPNUMBE = #I_vSOPNUMBE and SOPTYPE = #I_vSOPTYPE
end
/** Custom Business Logic */
NOTE: with this implementation, the specific SLPRSNID & SALSTERR will have to be provided to the line items, it will not automatically post from header data, or any customer setup data in GP - your integration has to pass the values in.

DirectorySearcher.Filter which queries active directory to return upcoming events of the current week

I am trying to get all birthdays and anniversaries which fall under current week. I am using Directory Searcher and LDAP. I am new to LDAP and I am using the below code:
string _path = "LDAP:";
System.DirectoryServices.DirectoryEntry entry = new System.DirectoryServices.DirectoryEntry(_path);
DirectorySearcher ds = new DirectorySearcher(entry);
string month = DateTime.Now.Month.ToString();
string day = DateTime.Today.Day + numDays.ToString();
ds.Filter = "(&(objectClass=user)(description=" + month + "\\" + day +"))";
SortOption option = new SortOption("description", System.DirectoryServices.SortDirection.Ascending);
ds.Sort = option;
DataSet dSet = new DataSet();
DataTable dTable = new DataTable("Events");
dTable.Columns.Add("birthday");
foreach (System.DirectoryServices.SearchResult resEvent in ds.FindAll())
{
System.DirectoryServices.DirectoryEntry de1 = resEvent.GetDirectoryEntry();
DataRow dRow = dTable.NewRow();
if (de1.Properties["description"].Value != null)
{
dRow["birthday"] = de1.Properties["description"].Value.ToString();
dTable.Rows.Add(dRow);
}
}
dSet.Tables.Add(dTable);
return dSet;
Are your events stored under the user's description attribute?
Not much detailas to what your attribute values look like.
You are trying to user c# which I do not have access to, but from a LDAP Query, this works:
(&(objectClass=user)(description=09/15*))
-jim

core data giving merge conflict with single MOC and main thread used for core data

I'm using core data with a single NSManagedObjectContext and am doing all operation for core data on the main thread. The new and old row given in error description are identical and am at hoping that someone can explain why am getting a merge conflict. Setting merge policy to overwrite is causing the app to run into high CPU in simulator and become unresponsive.
However, when I try to update managed objects in one entity, the app crashes with following error,
NSMergeConflict (0x7144390) for NSManagedObject (0x7225db0) with objectID '0x721c0a0 <x-coredata://94349DC2-C441-4102-9C65-60737E940135/Locations/p1>' with oldVersion = 2 and newVersion = 3 and
old cached row = {\n AccountInfo = \"0x721bae0 <x-coredata://94349DC2-C441-4102-9C65-60737E940135/Account/p1>\";\n City = \"<null>\";\n Country = \"Russian Federation\";\n EntryStatusId = \"<null>\";\n ExitStatusId = \"<null>\";\n IsCorporateLocation = 1;\n IsVisible = 1;\n Latitude = 50;\n LocationId = 10003;\n Longitude = 40;\n Name = \"Test Location\";\n Radius = 304;\n State = \"Province of Voronezh\";\n Street = \"<null>\";\n Units = METER;\n Zip = \"<null>\";\n} and
new database row = {\n AccountInfo = \"0x7144560 <x-coredata://94349DC2-C441-4102-9C65-60737E940135/Account/p1>\";\n City = \"<null>\";\n Country = \"Russian Federation\";\n EntryStatusId = \"<null>\";\n ExitStatusId = \"<null>\";\n IsCorporateLocation = 1;\n IsVisible = 1;\n Latitude = 50;\n LocationId = 10003;\n Longitude = 40;\n Name = \"Test Location\";\n Radius = 304;\n State = \"Province of Voronezh\";\n Street = \"<null>\";\n Units = METER;\n Zip = \"<null>\";\n}
Update: The error doesn't happen if I save the MOC after updating every object but happens if I update all the objects and then save MOC. Anyone knows why this is happening?
The error suggest that you do actually have two separate contexts. You only get a merge when you have two or more context writing to the same store.
I would suggest logging the context before every save, everywhere you perform a save to make certain you only have one active context.
It is posible to let the Core Data deals with this conflicts automatically instead of throw an Exception. See this post: http://pauloliveira.net/tech/core-data-merging-conflicts

Resources