Example #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());
   }
 }
Example #2
0
 /** 保存明细数据 */
 private void addDetails(Context context, Instorage entity, List<InstorageItem> detailList)
     throws Exception {
   if (null == detailList || detailList.isEmpty()) {
     throw new Exception("生成入库单失败(明细数据缺失)");
   }
   for (InstorageItem det : detailList) {
     det.setSheetId(entity.getRECID());
     det.setId(context.newRECID());
     context.handle(new InstorageItemTask(det), Method.INSERT);
   }
 }
Example #3
0
 /*
  * 生成付款记录
  *
  * @param task
  *
  * @param context
  */
 public void createPayBills(Context context, CheckInSheet sheet) {
   long today = new Date().getTime();
   CreatePaymentTask task = new CreatePaymentTask();
   CreatePaymentTask.Item item =
       task
       .new Item(
           sheet.getRECID(),
           sheet.getSheetNo(),
           sheet.getRelaBillsId(),
           sheet.getRelaBillsNo(),
           today,
           sheet.getAmount(),
           sheet.getAmount(),
           0d);
   task.setId(context.newRECID());
   task.setAmount(sheet.getAmount());
   task.setPartnerId(sheet.getPartnerId());
   task.setPartnerName(sheet.getPartnerName());
   task.setPayDate(today);
   task.setPaymentType(PaymentType.PAY_CGFK.getCode());
   task.setRemark(sheet.getRemark());
   task.setItems(new Item[] {item});
   context.handle(task);
 }