1. Business documents in EAS usually have many F7s. Generally, I use the object ID to query the object and assign the value to the corresponding attribute of the document.
For example:
//Payment method
purInWarehs.setPaymentType(PaymentTypeFactory. getLocalInstance(ctx)
.getPaymentTypeInfo(new ObjectUuidPK(“2fa35444-5a23- 43fb-99ee-6d4fa5f260da6BCA0AB5”)));
It can actually be replaced by:
PaymentTypeInfo paymentType = new PaymentTypeInfo ();
paymentType.setId(new ObjectUuidPK((“2fa35444-5a23-43fb-99ee-6d4fa5f260da6BCA0AB5”));//Similar to this way of writing
2. There are some documents, such as purchase receipt When calling the interface method, you need to set up some organizations in the following Context. These attributes were not set during the previous test, and the system did not even throw an exception. There is no problem with submitting and saving the documents, but the data just can’t be entered. Set After these attributes, the exception came out
OrgUnitInfo ou =new OrgUnitInfo();
ou.setId(BOSUuid.read(getDefaultCU(ctx)));//Organization ID
AdminOrgUnitInfo adminUnit=new AdminOrgUnitInfo();
adminUnit.setId(ou.getId());
ContextUtil.setCurrentAdminUnit(ctx, adminUnit );
SaleOrgUnitInfo saleUnit=new SaleOrgUnitInfo();
saleUnit.setId(ou.getId());
ContextUtil.setCurrentSaleUnit (ctx,saleUnit);
StorageOrgUnitInfo storageUnit=new StorageOrgUnitInfo( );
storageUnit.setId(ou.getId());
ContextUtil.setCurrentStorageUnit(ctx, storageUnit);
3. After saving the business document, the data is stored in the database, but it will not be displayed in the list interface. The solution to this problem is to find a correct piece of data ( Data that can be displayed in the list interface), then compare the fields of the two data in the database, mainly some organizational fields,
4. Interface transfer After the received documents can be saved, click Submit to indicate that NUll cannot be inserted into a table.
The solution to this problem: First assign a value to this field. If it is confirmed that there is a value, you must save it before submitting it. Query this data and submit it.
For example:
//Save IObjectPK pk = PurInWarehsBillFactory.getLocalInstance(ctx).save(purInWarehs); purInWarehs = PurInWarehsBillFactory.getLocalInstance(ctx) .getPurInWarehsBillInfo(pk); PurInWarehsBillFactory getLocalInstance(ctx).submit(pk,purInWarehs)