/**
  * 联营交易信息
  *
  * @param context
  * @param task
  * @throws Exception
  */
 private void writeJointRecord(Context context, CheckinSheetTask sheet) throws Exception {
   List<JointVentureTaskItem> items = new ArrayList<JointVentureTaskItem>();
   for (CheckInSheetItem det : sheet.getItems()) {
     JointVentureTaskItem item = new JointVentureTaskItem();
     item.setGoodsId(det.getGoodsId());
     item.setSheetId(sheet.getEntity().getRECID());
     item.setSheetNo(sheet.getEntity().getSheetNo());
     item.setCount(DoubleUtil.sub(0, det.getRealCount()));
     items.add(item);
   }
   context.handle(new CreateJointVentureTask(items));
 }
 @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);
 }