コード例 #1
0
 /** 对一个入库单实体添加基础数据 */
 private void fillEntity(Context context, Instorage entity, String type) {
   Login login = context.find(Login.class);
   Employee emp = context.find(Employee.class, login.getEmployeeId());
   entity.setRECID(context.newRECID());
   entity.setSheetType(type);
   entity.setCreateDate(new Date().getTime());
   if (CheckIsNull.isNotEmpty(entity.getPartnerId())) {
     Partner partner = context.find(Partner.class, entity.getPartnerId());
     if (null != partner) {
       entity.setPartnerName(partner.getName());
       entity.setPartnerShortName(partner.getShortName());
       entity.setPartnerCode(partner.getCode());
     }
   }
   Store store = context.find(Store.class, entity.getStoreId());
   if (null != store) {
     entity.setStoreName(store.getName());
     entity.setStoreNamePY(PinyinHelper.getLetter(store.getName()));
   }
   if (CheckingInType.Irregular.getCode().equals(type)
       || CheckingInType.Kit.getCode().equals(type)) {
     entity.setCreatorId(login.getEmployeeId());
     entity.setCreator(emp.getName());
   }
 }
コード例 #2
0
 @Override
 protected void handle(Context context, CheckinSheetTask task) throws Throwable {
   InsertSqlBuilder ib = new InsertSqlBuilder(context);
   ib.setTable(ERPTableNames.Inventory.CheckinSheet.getTableName());
   ib.addColumn("RECID", ib.guid, task.getEntity().getRECID());
   ib.addColumn("sheetNo", ib.STRING, task.getEntity().getSheetNo());
   ib.addColumn("sheetType", ib.STRING, task.getEntity().getSheetType());
   ib.addColumn("partnerId", ib.guid, task.getEntity().getPartnerId());
   ib.addColumn("partnerName", ib.STRING, task.getEntity().getPartnerName());
   ib.addColumn("namePY", ib.STRING, task.getEntity().getNamePY());
   ib.addColumn("partnerShortName", ib.STRING, task.getEntity().getPartnerShortName());
   ib.addColumn("relaBillsId", ib.guid, task.getEntity().getRelaBillsId());
   ib.addColumn("relaBillsNo", ib.STRING, task.getEntity().getRelaBillsNo());
   ib.addColumn("storeId", ib.guid, task.getEntity().getStoreId());
   ib.addColumn("storeName", ib.STRING, task.getEntity().getStoreName());
   ib.addColumn("storeNamePY", ib.STRING, task.getEntity().getStoreNamePY());
   ib.addColumn("goodsFrom", ib.STRING, task.getEntity().getGoodsFrom());
   ib.addColumn("remark", ib.STRING, task.getEntity().getRemark());
   ib.addColumn("buyPerson", ib.STRING, task.getEntity().getBuyPerson());
   ib.addColumn("buyDate", ib.DATE, task.getEntity().getBuyDate());
   ib.addColumn("amount", ib.DOUBLE, task.getEntity().getAmount());
   ib.addColumn("askedAmount", ib.DOUBLE, task.getEntity().getAskedAmount());
   ib.addColumn("paidAmount", ib.DOUBLE, task.getEntity().getPaidAmount());
   ib.addColumn("disAmount", ib.DOUBLE, task.getEntity().getDisAmount());
   ib.addColumn("checkinDate", ib.DATE, task.getEntity().getCheckinDate());
   ib.addColumn("checkinPerson", ib.guid, task.getEntity().getCheckinPerson());
   ib.addColumn("checkinPersonName", ib.STRING, task.getEntity().getCheckinPersonName());
   ib.addColumn("deptId", ib.guid, task.getEntity().getDeptId());
   ib.addColumn("creatorId", ib.guid, task.getEntity().getCreatorId());
   ib.addColumn("creator", ib.STRING, task.getEntity().getCreator());
   if (null != task.getEntity().getDeptId()) {
     Department depart = context.find(Department.class, task.getEntity().getDeptId());
     if (null != depart) {
       ib.addColumn("deptName", ib.STRING, depart.getName());
     } else {
       throw new Exception("获取用户部门信息出错!");
     }
   }
   if (null != task.getEntity().getPartnerId()) {
     Partner p = context.find(Partner.class, task.getEntity().getPartnerId());
     ib.addColumn("partnerCode", ib.STRING, p.getCode());
   }
   if (ib.execute() == 1) {
     doSaveDetails(context, task);
     task.setSuccess(true);
   }
   if (task.getEntity().getSheetType().equals(CheckingInType.Joint.getCode())
       || task.getEntity().getSheetType().equals(CheckingInType.RealGoods.getCode())
       || task.getEntity().getSheetType().equals(CheckingInType.Kit.getCode())) {
     return;
   }
   writeJointRecord(context, task);
 }