예제 #1
0
def order_list():
    """件名大分類データ一覧の初期表示  GETのrequestを受付
    当処理はhtmlテンプレート及び画面用コンテンツを返します。
    """
    data = getOrderList(current_user.group_id)
    cont = orderListCont(data)
    return render_template('order_data_management/order-list.html', cont=cont)
예제 #2
0
def sub_order_edit(subOrderId):
    """件名小分類データ修正処理
    
    一覧画面からデータの「コード」を押下後、GETのrequestを受付します。
    htmlテンプレート及び画面用コンテンツを返します。

    :param subOrderId: 選択された件名小分類データのID
    """
    dto = getSubOrderDetails(subOrderId)
    if not dto:
        flash(Messages.WARNING_NOT_FOUND_ALREADY_UPDATED_DELETED,
              Messages.WARNING_CSS)
        return redirect(url_for('orderData.sub_order_list'))

    clientList = getComItemList('client_cd')
    orderList = getOrderList(current_user.group_id)
    form = SubOrderDataForm()
    form.clientCd.choices = [(i.item_cd, i.item_value) for i in clientList]
    form.orderCd.choices = [(i.orderCd, i.orderValue) for i in orderList]
    form.subOrderId.data = dto.sub_order_id
    form.clientCd.data = dto.client_cd
    form.orderCd.data = dto.order_cd
    form.subOrderCd.data = dto.sub_order_cd
    form.subOrderValue.data = dto.sub_order_value
    form.displayOrder.data = dto.display_order
    form.isActive.data = dto.is_active

    cont = detailsCont(form)
    return render_template('order_data_management/sub-order-details.html',
                           cont=cont)
예제 #3
0
파일: clientWork.py 프로젝트: 70ucanbin/IMS
def clinent_work_create(month, day):
    """稼働作成処理

    一覧画面から「新規作成」を押下後、GETのrequestを受付します。
    htmlテンプレート及び画面用コンテンツを返します。

    :param month: 追加対象データの月
    :param day: 追加対象データの日
    """
    try:
        date(date.today().year, month, day)
    except ValueError:
        return redirect(url_for('clientWork.clinent_work_calendar'))

    cont = detailCont(month, day, ClientWorkForm())
    cont.is_self = True

    orderList = getOrderList(current_user.group_id)
    comboList = getOrderComBoList(orderList, True)

    hoursList = getNumberList(0, 24, 1)
    minutesList = getNumberList(0, 60, 5)

    cont.form.orderCd.choices = [(i.key, i.value) for i in comboList]
    cont.form.workHours.choices = [(i.key, i.value) for i in hoursList]
    cont.form.workMinutes.choices = [(i.key, i.value) for i in minutesList]

    return render_template('client_work/client-work-details.html', cont=cont)
예제 #4
0
def sub_order_list():
    """件名小分類データ一覧の初期表示  GETのrequestを受付
    当処理はhtmlテンプレート及び画面用コンテンツを返します。
    """
    orderList = getOrderList(current_user.group_id)
    comboList = getOrderComBoList(orderList)
    if not comboList:
        flash(Messages.NO_FOUND_ORDER, Messages.WARNING_CSS)
        return redirect(url_for('orderData.order_list'))
    cont = subOrderListCont(comboList)
    return render_template('order_data_management/sub-order-list.html',
                           cont=cont)
예제 #5
0
def sub_order_create():
    """件名小分類データ作成処理
    
    件名小分類一覧画面から「新規作成」を押下後、GETのrequestを受付します。
    htmlテンプレート及び画面用コンテンツを返します。
    """
    clientList = getComItemList('client_cd')
    orderList = getOrderList(current_user.group_id)
    form = SubOrderDataForm()
    form.clientCd.choices = [(i.item_cd, i.item_value) for i in clientList]
    form.orderCd.choices = [(i.orderCd, i.orderValue) for i in orderList]
    cont = detailsCont(form)
    return render_template('order_data_management/sub-order-details.html',
                           cont=cont)
예제 #6
0
def sub_order_save():
    """件名小分類データ詳細画面登録処理

    formのデータをDBに保存します。
    処理終了後は件名小分類データ一覧画面へ遷移します。
    """
    clientList = getComItemList('client_cd')
    orderList = getOrderList(current_user.group_id)
    form = SubOrderDataForm()
    form.clientCd.choices = [(i.item_cd, i.item_value) for i in clientList]
    form.orderCd.choices = [(i.orderCd, i.orderValue) for i in orderList]
    if form.validate_on_submit():
        if form.subOrderId.data:
            isUpdate = True
            dto = getSubOrderDetails(form.subOrderId.data)
            if dto:
                pass
            else:
                flash(Messages.WARNING_NOT_FOUND_ALREADY_UPDATED_DELETED,
                      Messages.WARNING_CSS)
                return redirect(url_for('orderData.sub_order_list'))
        else:
            isUpdate = False

        data = form.data
        data['groupId'] = current_user.group_id
        data['updateUser'] = current_user.user_id
        data['isActive'] = bool(form.isActive.data)

        try:
            insertUpdateSubOrder(data, isUpdate)
        except Exception:
            return redirect(url_for('orderData.sub_order_list'))

        if isUpdate:
            flash(Messages.SUCCESS_UPDATED, Messages.SUCCESS_CSS)
        else:
            flash(Messages.SUCCESS_INSERTED, Messages.SUCCESS_CSS)
        return redirect(url_for('orderData.sub_order_list'))

    for error in form.errors.values():
        flash(error[0], Messages.DANGER_CSS)

    cont = detailsCont(form)

    return render_template('order_data_management/sub-order-details.html',
                           cont=cont)
예제 #7
0
파일: clientWork.py 프로젝트: 70ucanbin/IMS
def clinent_work_edit(clientWorkId):
    """稼働修正処理

    一覧画面から「稼働時間」を押下後、GETのrequestを受付します。
    htmlテンプレート及び画面用コンテンツを返します。

    :param clientWorkId: 対象データのID
    """
    dto = getDto(clientWorkId)
    if not dto:
        flash(Messages.WARNING_NOT_FOUND_ALREADY_UPDATED_DELETED,
              Messages.WARNING_CSS)
        return redirect(url_for('clientWork.clinent_work_list', month=0))

    cont = detailCont(dto.workMonth, dto.workDay, ClientWorkForm())
    if dto.userId == current_user.user_id:
        cont.is_self = True
    orderList = getOrderComBoList(getOrderList(current_user.group_id), True)
    if dto.orderCd:
        subOrderList = getSubOrderList(current_user.group_id, dto.orderCd)
        if subOrderList:
            cont.form.subOrderCd.choices = [(i.subOrderCd, i.subOrderValue)
                                            for i in subOrderList]

    hoursList = getNumberList(0, 24, 1)
    minutesList = getNumberList(0, 60, 5)
    cont.form.clientWorkId.data = dto.clientWorkId
    cont.form.orderCd.choices = [(i.key, i.value) for i in orderList]
    cont.form.orderCd.data = dto.orderCd
    cont.form.taskCd.data = dto.taskCd
    cont.form.workHours.choices = [(i.key, i.value) for i in hoursList]
    cont.form.workHours.data = dto.workHours
    cont.form.workMinutes.choices = [(i.key, i.value) for i in minutesList]
    cont.form.workMinutes.data = dto.workMinutes
    cont.form.note.data = dto.note

    return render_template('client_work/client-work-details.html', cont=cont)
예제 #8
0
파일: clientWork.py 프로젝트: 70ucanbin/IMS
def clinent_work_save(month, day):
    """稼働詳細画面登録処理

    formのデータをDBに保存します。
    処理終了後は稼働一覧画面へ遷移します。

    :param month: 一覧画面へ戻るときに遷移前の月を渡します。
    :param day: 一覧画面へ戻るときに遷移前の月を渡します。
    """
    form = ClientWorkForm()
    orderList = getOrderComBoList(getOrderList(current_user.group_id), True)
    if form.orderCd.data:
        subOrderList = getSubOrderList(current_user.group_id,
                                       form.orderCd.data)
        if subOrderList:
            form.subOrderCd.choices = [(i.subOrderCd, i.subOrderValue)
                                       for i in subOrderList]
    hoursList = getNumberList(0, 24, 1)
    minutesList = getNumberList(0, 60, 5)

    form.orderCd.choices = [(i.key, i.value) for i in orderList]
    form.workHours.choices = [(i.key, i.value) for i in hoursList]
    form.workMinutes.choices = [(i.key, i.value) for i in minutesList]
    if form.validate_on_submit():
        # (新規・修正)判定
        dto = getDto(form.clientWorkId.data)
        if form.clientWorkId.data:
            isUpdate = True
            if dto and dto.userId == current_user.user_id:
                pass
            else:
                flash(Messages.WARNING_NOT_FOUND_ALREADY_UPDATED_DELETED,
                      Messages.WARNING_CSS)
                return redirect(
                    url_for('clientWork.clinent_work_list',
                            month=month,
                            day=day))
        else:
            isUpdate = False

        data = form.data
        data['userId'] = current_user.user_id
        data['year'] = date.today().year
        data['month'] = month
        data['day'] = day
        workTime = str(data['workHours']) + ':' + str(data['workMinutes'])
        data['workTime'] = datetime.strptime(workTime, '%H:%M')
        insertUpdateDto(data, isUpdate)
        if isUpdate:
            flash(Messages.SUCCESS_UPDATED, Messages.SUCCESS_CSS)
        else:
            flash(Messages.SUCCESS_INSERTED, Messages.SUCCESS_CSS)
        return redirect(
            url_for('clientWork.clinent_work_list', month=month, day=day))

    for error in form.errors.values():
        flash(error[0], Messages.DANGER_CSS)

    cont = detailCont(month, day, form)
    cont.is_self = True

    return render_template('client_work/client-work-details.html', cont=cont)