上传的图像用于项目: 'CST技术支持'
  1. CST技术支持
  2. SLAL2-1871

【和黄药业】设计函数取年中调整的薪资档案数据

XMLWord打印

    • Icon: 技术问题 技术问题
    • 解决结果: 完成
    • Icon: High High
    • 202102
    • H-和黄药业-Y2019081
    • hryl-uat.shpl
    • 基础通用功能
    • 隐藏

      def F_Get_WorkDay_First_Last(*args):
      #参数解释: BeginDate -> 起始日, EndDate -> 结束日, day_type -> 取值类型
      #返回: 从员工对应的日历中,根据起始日和结束日统计指定期段中指定类型的天数
      if len(args) == 0 or len(args) == 1:
      return 0
      elif len(args) == 2:
      BeginDate = args[0]
      EndDate = args[1]
      day_type = 1
      elif len(args) == 3:
      BeginDate = args[0]
      EndDate = args[1]
      day_type = args[2]
      else:
      return 0
      workday_data = global_dict['F_Workday'] or []
      holiday_data = global_dict['F_Holiday'] or []
      legal_holiday_data = global_dict['F_LegalHoliday'] or []
      employee_id = individual_dict['ref_employee_id']
      employee_days = global_dict['F_get_day_type_form_item'][employee_id]
      lower_date = datetime.datetime.strptime(BeginDate, '%Y-%m-%d')
      upper_date = datetime.datetime.strptime(EndDate, '%Y-%m-%d')
      if not (upper_date and lower_date) or lower_date > upper_date:
      return 0
      if day_type == 1:
      count_legal_holiday = 0
      count_workday = 0
      count_daytype_workday = 0
      count_daytype_workoff = 0
      while True:
      str_lower_date = lower_date.strftime('%Y-%m-%d')
      if str_lower_date in legal_holiday_data:
      count_legal_holiday += 1
      count_workday += 1
      elif str_lower_date in workday_data or lower_date.weekday() not in [5,6] and str_lower_date not in holiday_data:
      count_workday += 1

      if day_type in [4, 5]:
      day_type_value = employee_days[str_lower_date]
      if day_type == 4 and day_type_value and day_type_value == 'schedule_workday':
      count_daytype_workday += 1
      elif day_type == 5 and day_type_value and day_type_value == 'schedule_day_off':
      count_daytype_workoff += 1

      #2020.11.09,Elvis.Yu,增加day_type==91 and count_workday-count_legal_holiday>0,找到第一个工作日(不含法定假日)退出
      if day_type==1 and count_workday-count_legal_holiday>0:
      break
      elif lower_date >= upper_date:
      lower_date=None
      break
      lower_date = lower_date + timedelta(days=1)

      if lower_date:
      lower_date =lower_date.strftime('%Y-%m-%d')
      return lower_date
      if day_type == 2:
      count_legal_holiday = 0
      count_workday = 0
      count_daytype_workday = 0
      count_daytype_workoff = 0
      while True:
      str_upper_date = upper_date.strftime('%Y-%m-%d')
      if str_upper_date in legal_holiday_data:
      count_legal_holiday += 1
      count_workday += 1
      elif str_upper_date in workday_data or upper_date.weekday() not in [5,6] and str_upper_date not in holiday_data:
      count_workday += 1

      if day_type in [4, 5]:
      day_type_value = employee_days[str_lower_date]
      if day_type == 4 and day_type_value and day_type_value == 'schedule_workday':
      count_daytype_workday += 1
      elif day_type == 5 and day_type_value and day_type_value == 'schedule_day_off':
      count_daytype_workoff += 1

      #2020.11.09,Elvis.Yu,增加day_type==91 and count_workday-count_legal_holiday>0,找到第一个工作日(不含法定假日)退出
      if day_type==2 and count_workday-count_legal_holiday>0:
      break
      elif upper_date <= lower_date:
      upper_date=None
      break
      upper_date = upper_date - timedelta(days=1)

      if upper_date:
      upper_date =upper_date.strftime('%Y-%m-%d')
      return upper_date

      显示
      def F_Get_WorkDay_First_Last(*args): #参数解释: BeginDate -> 起始日, EndDate -> 结束日, day_type -> 取值类型 #返回: 从员工对应的日历中,根据起始日和结束日统计指定期段中指定类型的天数 if len(args) == 0 or len(args) == 1: return 0 elif len(args) == 2: BeginDate = args [0] EndDate = args [1] day_type = 1 elif len(args) == 3: BeginDate = args [0] EndDate = args [1] day_type = args [2] else: return 0 workday_data = global_dict ['F_Workday'] or [] holiday_data = global_dict ['F_Holiday'] or [] legal_holiday_data = global_dict ['F_LegalHoliday'] or [] employee_id = individual_dict ['ref_employee_id'] employee_days = global_dict ['F_get_day_type_form_item'] [employee_id] lower_date = datetime.datetime.strptime(BeginDate, '%Y-%m-%d') upper_date = datetime.datetime.strptime(EndDate, '%Y-%m-%d') if not (upper_date and lower_date) or lower_date > upper_date: return 0 if day_type == 1: count_legal_holiday = 0 count_workday = 0 count_daytype_workday = 0 count_daytype_workoff = 0 while True: str_lower_date = lower_date.strftime('%Y-%m-%d') if str_lower_date in legal_holiday_data: count_legal_holiday += 1 count_workday += 1 elif str_lower_date in workday_data or lower_date.weekday() not in [5,6] and str_lower_date not in holiday_data: count_workday += 1 if day_type in [4, 5] : day_type_value = employee_days [str_lower_date] if day_type == 4 and day_type_value and day_type_value == 'schedule_workday': count_daytype_workday += 1 elif day_type == 5 and day_type_value and day_type_value == 'schedule_day_off': count_daytype_workoff += 1 #2020.11.09,Elvis.Yu,增加day_type==91 and count_workday-count_legal_holiday>0,找到第一个工作日(不含法定假日)退出 if day_type==1 and count_workday-count_legal_holiday>0: break elif lower_date >= upper_date: lower_date=None break lower_date = lower_date + timedelta(days=1) if lower_date: lower_date =lower_date.strftime('%Y-%m-%d') return lower_date if day_type == 2: count_legal_holiday = 0 count_workday = 0 count_daytype_workday = 0 count_daytype_workoff = 0 while True: str_upper_date = upper_date.strftime('%Y-%m-%d') if str_upper_date in legal_holiday_data: count_legal_holiday += 1 count_workday += 1 elif str_upper_date in workday_data or upper_date.weekday() not in [5,6] and str_upper_date not in holiday_data: count_workday += 1 if day_type in [4, 5] : day_type_value = employee_days [str_lower_date] if day_type == 4 and day_type_value and day_type_value == 'schedule_workday': count_daytype_workday += 1 elif day_type == 5 and day_type_value and day_type_value == 'schedule_day_off': count_daytype_workoff += 1 #2020.11.09,Elvis.Yu,增加day_type==91 and count_workday-count_legal_holiday>0,找到第一个工作日(不含法定假日)退出 if day_type==2 and count_workday-count_legal_holiday>0: break elif upper_date <= lower_date: upper_date=None break upper_date = upper_date - timedelta(days=1) if upper_date: upper_date =upper_date.strftime('%Y-%m-%d') return upper_date

      设计函数计算薪资档案项年中调整的数据,

      查找范围:薪资档案项有效起始日期 < 开始时间(参数2)且 (有效期止为空或 大于等于结束时间(参数2) )
      即查找 当年发生过1次调整的薪资档案项

      参数 有5个:(开始时间,结束时间,薪资档案项编码,类型:(date或value),1或2)
      第四个参数:date 返回薪资档案项调整生效日期,
      第五个参数:如第四个参数选择的是date,则第五个参数可忽略,
      1 返回的是 调整前的金额,2返回调整后的金额

            wenqiang.liu 刘文强
            jason.zhou 周子深
            表决:
            0 为这个问题表决

              创建日期:
              已更新:
              已解决: