コード例 #1
0
 @Override
 protected void occur(Context context, CheckInEvent event) throws Throwable {
   if (CheckIsNull.isEmpty(event.getRelaOrderId()) || CheckIsNull.isEmpty(event.getType())) {
     throw new Throwable("相关单据编号和入库类型不能为空");
   }
   OrderInfo info = null;
   BillsEnum billsEnum = null;
   switch (event.getType()) {
       //			Purchase("01", "采购入库"), //
       //			Irregular("02", "零星采购"), //
       //			Return("03", "销售退货"), //
       //			RetailReturn("04","零售退货"),
       //			Other("05", "其他入库");
     case Purchase:
       info = context.find(PurchaseOrderInfo.class, event.getRelaOrderId());
       billsEnum = BillsEnum.PURCHASE;
       break;
     case Return:
       info = context.find(SaleCancel.class, event.getRelaOrderId());
       billsEnum = BillsEnum.SALE_CANCEL;
       break;
       //			case DirectSupply:
       //				info = context.find(PurchaseOrderInfo.class, event.getRelaOrderId());
       //				billsEnum = BillsEnum.PURCHASE;
       //				break;
     default:
       return;
   }
   if (CheckIsNull.isEmpty(info)) {
     throw new Throwable("相关单据编号在订单中不存在");
   }
   StatusEnum newstatus = InventoryDataUtil.getOrderStatusByIn(context, event.getRelaOrderId());
   if (!newstatus.isThis(info.getStatus())) {
     OrderUtil.modifystatus(
         billsEnum, context, info.getRECID(), newstatus, StatusEnum.getstatus(info.getStatus()));
     // 全部出库完成出库
     if (newstatus == StatusEnum.Store_All) {
       if (BillsEnum.PURCHASE == billsEnum) {
         context.dispatch(
             new PurchaseOrderChangedEvent(info.getRECID(), ChangedType.StoreFinish));
       } else {
         context.dispatch(new SalesReturnChangedEvent(info.getRECID(), ChangedType.StoreFinish));
       }
     }
   }
 }
コード例 #2
0
 @Override
 protected void occur(Context context, CheckOutEvent event) throws Throwable {
   if (CheckIsNull.isEmpty(event.getRelaOrderId()) || CheckIsNull.isEmpty(event.getType())) {
     throw new Throwable("相关单据编号和出库类型不能为空");
   }
   OrderInfo info = null;
   BillsEnum billsEnum = null;
   switch (event.getType()) {
       //			Sales("01", "销售出库"), //
       //			Return("02", "采购退货"), //
       //			Retail("03", "零售出库"), //
       //			Kit("04", "其他出库");
     case Sales:
       info = context.find(SaleOrderInfo.class, event.getRelaOrderId());
       billsEnum = BillsEnum.SALE;
       break;
     case Return:
       info = context.find(PurchaseCancel.class, event.getRelaOrderId());
       billsEnum = BillsEnum.PURCHASE_CANCEL;
       break;
     default:
       return;
   }
   if (CheckIsNull.isEmpty(info)) {
     throw new Throwable("相关单据编号在订单中不存在");
   }
   StatusEnum newstatus = InventoryDataUtil.getOrderStatusByOut(context, event.getRelaOrderId());
   if (!newstatus.isThis(info.getStatus())) {
     OrderUtil.modifystatus(
         billsEnum, context, info.getRECID(), newstatus, StatusEnum.getstatus(info.getStatus()));
     // 全部出库完成出库
     if (newstatus == StatusEnum.Store_All) {
       if (BillsEnum.SALE == billsEnum) {
         context.dispatch(new SalesOrderChangedEvent(info.getRECID(), ChangedType.StoreFinish));
       } else {
         context.dispatch(
             new PurchaseReturnChangedEvent(info.getRECID(), ChangedType.StoreFinish));
       }
     }
   }
 }
コード例 #3
0
 @Override
 protected void provide(Context context, ReportCommonKey key, List<ReportResult> list)
     throws Throwable {
   SubjectEnum subject = key.getSubject();
   if (null == subject) {
     return;
   }
   if (CheckIsNull.isEmpty(key.getTargets())) {
     return;
   }
   switch (subject) {
     case GoodsItem:
       GoodsSubjectProvider.provide(context, key, list);
       break;
     case DateTime:
       DateTimeProvider.provide(context, key, list);
       break;
       /** 客户 */
     case Customer:
       CustomerSubjectProvider.provide(context, key, list);
       break;
       /** 客户并销售人员 */
     case Customer_Employee:
       Customer_EmployeeSubjectProvider.provide(context, key, list);
       break;
       /** 供应商 */
     case Supplier:
       SupplierSubjectProvider.provide(context, key, list);
       break;
       /** 员工 */
     case Employee:
       EmployeeSubjectProvider.provide(context, key, list);
       break;
       /** 部门 */
     case Department:
       DepartmentSubjectProvider.provide(context, key, list);
       break;
       /** 地区 */
     case Area:
       AreaSubjectProvider.provide(context, key, list);
       break;
       /** 库存台账 */
     case InventoryBook:
       InventorySubjectProvider.provide(context, key, list);
       break;
       /** 公司 */
     case Company:
       TenantSubjectProvider.provide(context, key, list);
       break;
   }
 }
コード例 #4
0
 @SuppressWarnings("unchecked")
 @Override
 protected ReportChartDatas provide(Context context, ReportCommonKey key) throws Throwable {
   List<ReportResult> list = context.getList(ReportResult.class, key);
   if (CheckIsNull.isEmpty(key.getOrderTarget())) {
     return null;
   }
   Enum target = null;
   SubjectEnum subject = null;
   if (key.isDateColumn()) {
     subject = SubjectEnum.DateTime;
     target = ReportTargetUtil.getTarget(subject, key.getOrderTarget());
   } else {
     subject = key.getSubject();
     target = ReportTargetUtil.getTarget(subject, "Id");
   }
   ReportChartDatas datas = new ReportChartDatas(list, target);
   return datas;
 }